* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #ffffff;
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 2800px;
    margin: 0 auto;
    background: white;
    border: 4px solid #000000;
    border-radius: 0;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #f5576c 75%, #ffc371 100%);
    color: white;
    padding: 30px;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(
            0deg,
            rgba(255,255,255,0.05) 0px,
            rgba(255,255,255,0.05) 1px,
            transparent 1px,
            transparent 2px
        ),
        repeating-linear-gradient(
            90deg,
            rgba(255,255,255,0.05) 0px,
            rgba(255,255,255,0.05) 1px,
            transparent 1px,
            transparent 2px
        );
    pointer-events: none;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.nav-bar {
    display: flex;
    gap: 20px;
}

.nav-btn {
    padding: 10px 20px;
    border: 2px solid #ffffff;
    background: transparent;
    color: #ffffff;
    border-radius: 0;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s;
}

.nav-btn:hover {
    background: #ffffff;
    color: #000000;
}

.nav-btn.active {
    background: #ffffff;
    color: #000000;
}

.header-title {
    text-align: left;
}

header h1 {
    font-size: 3em;
    margin-bottom: 0;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.language-switch {
    display: flex;
    gap: 5px;
    background: transparent;
    border: 2px solid #ffffff;
    border-radius: 0;
    padding: 4px;
}

.lang-btn {
    padding: 8px 16px;
    border: 2px solid #ffffff;
    background: transparent;
    color: #ffffff;
    cursor: pointer;
    border-radius: 0;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.lang-btn:hover {
    background: #ffffff;
    color: #667eea;
}

.lang-btn.active {
    background: #ffffff;
    color: #667eea;
    border: 2px solid #ffffff;
}

@media (max-width: 768px) {
    header {
        padding: 20px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .header-title {
        text-align: center;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .nav-bar {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    
    .nav-btn {
        padding: 8px 16px;
        font-size: 0.9em;
    }
    
    .language-switch {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .lang-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
}

.upload-section {
    padding: 40px;
}

.upload-area {
    border: 3px dashed #000000;
    border-radius: 0;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #ffffff;
}

.upload-area:hover {
    border-color: #000000;
    background: #f0f0f0;
}

.upload-area.dragover {
    border-color: #764ba2;
    background: #e8ebff;
    transform: scale(1.01);
}

.upload-icon {
    font-size: 4em;
    margin-bottom: 16px;
}

.upload-area p {
    font-size: 1.2em;
    color: #555;
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 0.9em;
    color: #888;
}

.workspace {
    padding: 30px;
}

.mode-switch {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.mode-btn {
    padding: 10px 20px;
    border: 2px solid #000;
    background: white;
    color: #000;
    border-radius: 0;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s;
}

.mode-btn:hover {
    background: #000;
    color: white;
}

.mode-btn.active {
    background: #000;
    color: white;
}

.pixel-mode-switch {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    justify-content: center;
}

.advanced-only {
    opacity: 0;
    height: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, height 0.3s ease;
}

.advanced-mode .advanced-only {
    opacity: 1;
    height: auto;
}

.preview-section {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    background: #f8f9fa;
    border-radius: 0;
    padding: 20px;
    border: 4px dashed #000000;
}

.preview-left {
    flex: 1;
}

.preview-right {
    flex: 0 0 420px;
}

.controls-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    height: 100%;
}

.global-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    padding-top: 25px;
    border-top: 2px solid #e9ecef;
}

.preview-panel {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
}

.preview-panel h3 {
    margin-bottom: 16px;
    color: #333;
    font-size: 1.1em;
}

.canvas-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #e9ecef;
    border-radius: 8px;
    min-height: 200px;
    overflow: hidden;
}

/* 拼豆图纸的画布容器没有尺寸限制 */
.perler-canvas-wrapper {
    max-height: none;
    overflow: visible;
}

canvas {
    display: block;
    image-rendering: pixelated;
}

/* 拼豆图纸的画布没有尺寸限制 */
.perler-canvas-wrapper canvas {
    max-width: none;
    max-height: none;
}

.size-info {
    margin-top: 12px;
    text-align: center;
    color: #666;
    font-size: 0.9em;
}

#pixelatedCanvas, #perlerCanvas {
    transition: width 0.2s ease, height 0.2s ease;
}

.canvas-zoom-control {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.canvas-zoom-control label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 0.95em;
}

.canvas-zoom-control input[type="range"] {
    width: 100%;
    cursor: pointer;
}

.controls {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
}

.control-group {
    margin-bottom: 30px;
}

.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 1em;
}

.control-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #000000;
    border-radius: 0;
    font-size: 1em;
}

input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 0;
    background: #ffffff;
    outline: none;
    -webkit-appearance: none;
    border: 2px solid #000000;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 0;
    background: #000000;
    cursor: pointer;
    border: 2px solid #000000;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 0;
    background: #000000;
    cursor: pointer;
    border: 2px solid #000000;
}

.size-inputs {
    display: flex;
    gap: 20px;
}

.size-inputs > div {
    flex: 1;
}

.size-inputs label {
    display: inline-block;
    margin-bottom: 6px;
    font-weight: normal;
}

.size-inputs input[type="number"] {
    width: 120px;
    padding: 8px 12px;
    border: 2px solid #000000;
    border-radius: 0;
    font-size: 1em;
    margin-right: 6px;
    transition: border-color 0.3s;
    background: #ffffff;
}

.size-inputs input[type="number"]:focus {
    outline: none;
    border-color: #000000;
    background: #f0f0f0;
}

.color-count-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-count-inputs input[type="range"] {
    flex: 1;
}

.color-count-inputs input[type="number"] {
    width: 70px;
    padding: 8px 10px;
    border: 2px solid #000000;
    border-radius: 0;
    font-size: 1em;
    transition: border-color 0.3s;
    background: #ffffff;
}

.color-count-inputs input[type="number"]:focus {
    outline: none;
    border-color: #000000;
    background: #f0f0f0;
}

.preset-sizes {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.preset-btn {
    padding: 10px 20px;
    border: 2px solid #000000;
    background: #ffffff;
    color: #000000;
    border-radius: 0;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    transition: all 0.3s;
}

.preset-btn:hover {
    background: #000000;
    color: #ffffff;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #000000;
}

.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    padding-top: 25px;
    border-top: 2px solid #e9ecef;
}

.btn {
    flex: 1;
    padding: 14px 24px;
    border: 2px solid #000000;
    border-radius: 0;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    background: #ffffff;
    color: #000000;
}

.btn-primary {
    background: #ffffff;
    color: #000000;
    border: 2px solid #000000;
}

.btn-primary:hover {
    background: #000000;
    color: #ffffff;
}

.btn-secondary {
    background: #ffffff;
    color: #000000;
    border-color: #000000;
}

.btn-secondary:hover {
    background: #f0f0f0;
    color: #000000;
}

.btn-secondary.color-pick-active {
    border-width: 4px;
    border-style: double;
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.btn-danger {
    background: #ffffff;
    color: #dc3545;
    border-color: #dc3545;
}

.btn-danger:hover {
    background: #dc3545;
    color: #ffffff;
    transform: translateY(0);
    box-shadow: 0 0 0 rgba(220, 53, 69, 0.4);
}

select {
    padding: 10px 15px;
    border: 2px solid #000000;
    border-radius: 0;
    font-size: 1em;
    background: #ffffff;
    cursor: pointer;
    transition: border-color 0.3s;
    color: #000000;
}

select:focus {
    outline: none;
    border-color: #000000;
    background: #f0f0f0;
}

input[type="color"] {
    width: 60px;
    height: 40px;
    border: 2px solid #000000;
    border-radius: 0;
    cursor: pointer;
    padding: 2px;
    transition: border-color 0.3s;
}

input[type="color"]:hover {
    border-color: #000000;
}

input[type="color"]:focus {
    outline: none;
    border-color: #000000;
}

.color-usage-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    margin-bottom: 6px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    transition: all 0.2s;
}

.color-usage-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.color-usage-item.selected {
    border-color: #667eea;
    background: #f0f2ff;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 2px solid #ddd;
    flex-shrink: 0;
}

.color-info {
    flex: 1;
    min-width: 0;
}

.color-count {
    font-weight: 600;
    color: #333;
    font-size: 0.9em;
}

.color-percentage {
    font-size: 0.8em;
    color: #888;
    margin-left: 8px;
}

.color-rgb {
    font-size: 0.75em;
    color: #999;
    font-family: monospace;
}

.color-action-btn {
    padding: 4px 8px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    color: #666;
    transition: all 0.2s;
    flex-shrink: 0;
}

.color-action-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.color-action-btn.remove {
    border-color: #dc3545;
    color: #dc3545;
}

.color-action-btn.remove:hover {
    background: #dc3545;
    color: white;
}

.sort-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.sort-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    color: #666;
    transition: all 0.2s;
}

.sort-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.sort-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.edit-tools {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.edit-tool-btn {
    padding: 8px 16px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    color: #666;
    transition: all 0.2s;
    flex: 1;
    min-width: 60px;
}

.edit-tool-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.edit-tool-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.current-color-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.current-color-wrapper input[type="color"] {
    width: 50px;
    height: 40px;
}

#currentColorValue {
    font-family: monospace;
    font-size: 0.95em;
    color: #666;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    margin: 15% auto;
    padding: 40px;
    border: 2px solid #000000;
    width: 80%;
    max-width: 700px;
    border-radius: 0;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0.3);
}

.smart-optimize-modal .modal-content {
    max-width: 1200px;
    width: 88vw;
    max-height: 65vh;
    margin: 17.5vh auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.form-group {
    margin-bottom: 30px;
}

.form-group label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: #000000;
    font-size: 1.5em;
}

.form-group input {
    width: 100%;
    padding: 20px;
    border: 2px solid #000000;
    border-radius: 0;
    font-size: 1.5em;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid #e9ecef;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* 全屏模式样式 */
.smart-optimize-modal.fullscreen {
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.smart-optimize-modal.fullscreen .modal-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.smart-optimize-modal.fullscreen .modal-content {
    max-width: 100vw;
    width: 100vw;
    max-height: 100vh;
    height: 100vh;
    margin: 0;
    border-radius: 0;
    border: none;
    overflow: auto;
}

.smart-optimize-modal.fullscreen .modal-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.smart-optimize-modal.fullscreen .modal-body {
    padding: 15px;
}

/* 过渡动画 */
.smart-optimize-modal .modal-content {
    transition: all 0.3s ease;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
    color: #000000;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2em;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
    line-height: 1;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

.smart-optimize-modal .modal-body {
    padding: 15px;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    flex: 1;
}

.optimization-summary {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 12px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.summary-item:last-child {
    margin-bottom: 0;
}

.summary-label {
    color: #666;
}

.summary-value {
    font-weight: 600;
    color: #333;
}

.optimization-settings {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.optimization-settings .control-group {
    margin-bottom: 12px;
}

.optimization-settings .control-group:last-child {
    margin-bottom: 0;
}

.optimization-settings label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 0.95em;
}

.optimization-settings input[type="range"] {
    width: 100%;
    cursor: pointer;
}

.suggestion-item.merge-suggestion {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-left: 3px solid #667eea;
}

.suggestions-list {
    max-height: 700px;
    overflow-y: auto;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.suggestion-item.accepted {
    border-color: #28a745;
    background: #ffffff;
}

.suggestion-item.rejected {
    border-color: #dc3545;
    background: #ffffff;
}

.color-swatch-small {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 2px solid #ddd;
    flex-shrink: 0;
}

.suggestion-info {
    flex: 1;
    min-width: 0;
}

.suggestion-text {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.suggestion-text .arrow {
    color: #667eea;
    font-weight: bold;
}

.suggestion-beans {
    font-size: 0.85em;
    color: #888;
    margin-top: 4px;
}

.suggestion-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.suggestion-action-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.2s;
}

.suggestion-action-btn.accept {
    border-color: #28a745;
    color: #28a745;
}

.suggestion-action-btn.accept:hover {
    background: #28a745;
    color: white;
}

.suggestion-action-btn.reject {
    border-color: #dc3545;
    color: #dc3545;
}

.suggestion-action-btn.reject:hover {
    background: #dc3545;
    color: white;
}

.suggestion-action-btn.preview {
    border-color: #667eea;
    color: #667eea;
}

.suggestion-action-btn.preview:hover {
    background: #667eea;
    color: white;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px 25px;
    border-top: 1px solid #e9ecef;
}

.modal-footer .btn {
    flex: 1;
    padding: 14px 24px;
    font-size: 1em;
}

#perlerContent {
    display: flex;
    flex-direction: column;
}

#perlerChartArea {
    display: flex;
    flex-direction: column;
}

.perler-chart-wrapper {
    display: flex;
    flex-direction: column;
}

.perler-summary {
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    text-align: center;
    padding: 0 10px;
    width: 100%;
}

.perler-chart-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#colorLegendArea {
    display: flex;
    justify-content: center;
}

#colorLegendArea.horizontal {
    flex-direction: row;
    justify-content: flex-start;
}

#colorLegend {
    display: flex;
    justify-content: center;
}

.timer-section {
    padding: 40px;
}

.modal-content.smart-optimize-modal {
    max-width: 1600px;
    width: 98vw;
}

.smart-optimize-container {
    display: flex;
    gap: 25px;
    align-items: flex-start;
}

.optimization-preview {
    flex: 0 0 450px;
    display: flex;
    flex-direction: column;
}

.optimization-preview h3 {
    margin: 0 0 10px 0;
    font-size: 1.1em;
    color: #333;
}

.preview-canvas-wrapper {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#optimizationPreviewCanvas {
    max-width: 100%;
    image-rendering: pixelated;
    border-radius: 4px;
}

.preview-canvas-wrapper-large {
    position: relative;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.brush-cursor {
    position: absolute;
    pointer-events: none;
    border: 2px solid rgba(0, 123, 255, 0.8);
    background: rgba(0, 123, 255, 0.1);
    border-radius: 4px;
    display: none;
    z-index: 100;
}

.smart-optimize-container .suggestions-list {
    flex: 1;
    max-height: 500px;
}

@media (max-width: 1024px) {
    .smart-optimize-container {
        flex-direction: column;
    }
    
    .optimization-preview {
        flex: none;
        width: 100%;
    }
}

.timer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #000000;
}

.timer-header h2 {
    font-size: 2em;
    color: #000000;
}

.timers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.timer-card {
    border: 2px solid #000000;
    border-radius: 0;
    padding: 20px;
    background: #ffffff;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0.3);
}

.timer-title {
    font-size: 1.2em;
    font-weight: 600;
    text-align: center;
    margin-bottom: 15px;
    color: #000000;
}

.timer-display {
    font-size: 3em;
    font-weight: bold;
    text-align: center;
    margin-bottom: 20px;
    color: #000000;
    font-family: monospace;
}

.timer-settings {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.timer-settings input {
    width: 60px;
    padding: 8px;
    border: 2px solid #000000;
    border-radius: 0;
    font-size: 1em;
    font-weight: 600;
    text-align: center;
}

.timer-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.timer-btn.btn-danger {
    background: #ff0000;
    color: #ffffff;
}

.timer-btn.btn-danger:hover {
    background: #cc0000;
    color: #ffffff;
}

.timer-btn {
    padding: 10px 20px;
    border: 2px solid #000000;
    background: #ffffff;
    color: #000000;
    border-radius: 0;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s;
}

.timer-btn:hover {
    background: #000000;
    color: #ffffff;
}

.timer-btn.active {
    background: #000000;
    color: #ffffff;
}

#colorLegend.horizontal {
    justify-content: flex-start;
}

#colorLegend canvas {
    max-width: none;
}

@media (max-width: 768px) {
    .perler-layout-horizontal {
        flex-direction: column;
    }
}

@media (max-width: 1400px) {
    .preview-section {
        flex-direction: column;
    }

    .preview-right {
        flex: none;
        width: 100%;
    }
}

/* 悬浮快照按钮 */
.snapshot-float-btn {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    border-radius: 0;
    background: #ffffff;
    color: #000000;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    border: 2px solid #000000;
    transition: all 0.2s ease;
    z-index: 9999;
}

.snapshot-float-btn:hover {
    transform: translateY(-50%) scale(1.1);
    background: #000000;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.snapshot-float-btn:active {
    transform: translateY(-50%) scale(1.05);
}

/* 悬浮快照面板 */
.snapshot-panel {
    position: fixed;
    left: 90px;
    top: 50%;
    transform: translateY(-50%);
    width: 420px;
    max-height: 80vh;
    background: #ffffff;
    border-radius: 0;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    z-index: 9998;
    overflow: hidden;
    border: 2px solid #000000;
}

.snapshot-panel.show {
    display: flex;
}

.snapshot-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom: 2px solid #000000;
}

.snapshot-panel-header h3 {
    margin: 0;
    font-size: 1.1em;
    font-weight: 600;
}

.snapshot-panel-header .close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 20px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.snapshot-panel-header .close-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

.snapshot-panel-content {
    padding: 15px;
    overflow-y: auto;
    flex: 1;
    max-height: calc(80vh - 65px);
}

/* 快照列表项 */
.snapshot-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 15px;
    margin-bottom: 12px;
    background: #f8f9fa;
    border-radius: 0;
    border: 2px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.2s;
}

.snapshot-item:hover {
    background: #ffffff;
    border-color: #667eea;
    box-shadow: 0 2px 5px rgba(102, 126, 234, 0.1);
}

.snapshot-item-info {
    flex: 1;
    margin-right: 15px;
}

.snapshot-item-title {
    font-weight: 600;
    color: #000000;
    margin-bottom: 5px;
    font-size: 0.95em;
}

.snapshot-item-meta {
    font-size: 0.82em;
    color: #666666;
    line-height: 1.5;
}

.snapshot-item-meta .change-positive {
    color: #27ae60;
    font-weight: 500;
}

.snapshot-item-meta .change-negative {
    color: #e74c3c;
    font-weight: 500;
}

.snapshot-item-desc {
    margin-top: 5px;
    font-size: 0.8em;
    color: #888888;
}

.snapshot-item-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.snapshot-item-actions .btn {
    padding: 6px 12px;
    font-size: 0.8em;
    border-radius: 0;
}

/* 智能优化三栏布局 */
.smart-optimize-three-column {
    display: flex;
    gap: 10px;
    flex: 1;
    min-height: 0;
}

.left-panel {
    flex: 2;
    min-width: 0;
    overflow-y: auto;
    padding-right: 8px;
    border-right: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
}

.center-panel {
    flex: 5;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.right-panel {
    flex: 3;
    min-width: 0;
    overflow-y: auto;
    padding-left: 8px;
    border-left: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
}

.optimization-preview-large {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.optimization-preview-large h3 {
    margin: 0 0 10px 0;
    font-size: 1.1em;
    color: #333;
}

.preview-canvas-wrapper-large {
    flex: 1;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    min-height: 450px;
    max-height: 680px;
}

.preview-canvas-wrapper-large canvas {
    max-width: 100%;
    max-height: 100%;
    image-rendering: pixelated;
    cursor: crosshair;
    border-radius: 4px;
}

.brush-tool-panel {
    background: #f0f8ff;
    border: 1px solid #b3d9ff;
    border-radius: 8px;
    padding: 10px;
    margin-top: 12px;
}

.brush-tool-panel h3 {
    margin: 0 0 10px 0;
    font-size: 0.95em;
    color: #333;
}

.brush-mode-buttons {
    display: flex;
    gap: 5px;
}

.brush-mode-buttons .btn.active {
    background: #667eea;
    border-color: #667eea;
}

.brush-tool-panel .control-group {
    margin-bottom: 12px;
}

.brush-tool-panel .control-group:last-child {
    margin-bottom: 0;
}

@media (max-width: 1200px) {
    .smart-optimize-three-column {
        flex-direction: column;
        height: auto;
        max-height: 80vh;
    }
    
    .left-panel,
    .right-panel {
        flex: none;
        min-width: auto;
        border: none;
        padding: 0;
    }
    
    .center-panel {
        min-height: 400px;
    }
}

@media (max-width: 768px) {
    .size-inputs {
        flex-direction: column;
    }

    .action-buttons {
        flex-direction: column;
    }

    .global-actions {
        flex-direction: column;
    }
}
