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

:root {
    --primary: #007AFF;
    --primary-dark: #0056b3;
    --border: #dee2e6;
    --text: #212529;
    --text-light: #6c757d;
    --success: #34C759;
    --wet-color: #34C759;
    --dry-color: #FF9500;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #F0EDE8;
    color: var(--text);
    font-size: 13px;
}

.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 8px;
    gap: 8px;
}

/* 顶部标题区 - 单行 */
.header {
    background: white;
    border-radius: 8px;
    padding: 8px 16px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.title-section h1 {
    font-size: 16px;
    color: #1a1a2e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-formula {
    font-size: 12px;
    color: var(--text-light);
    font-weight: normal;
    margin-left: 12px;
}

/* === 顶部链接（P2.2 新增） === */
.header-links {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: auto;
}
.header-link {
    display: inline-block;
    color: #667eea;
    text-decoration: none;
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #667eea;
    transition: all 0.2s;
    white-space: nowrap;
}
.header-link:hover {
    background: #667eea;
    color: white;
}

/* === 🌐 语言切换器（P5.2） === */
.i18n-switcher {
    position: relative;
    display: inline-block;
}
.i18n-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(102,126,234,0.08);
    color: #667eea;
    border: 1px solid #667eea;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: inherit;
}
.i18n-btn:hover { background: #667eea; color: white; }
.i18n-btn-icon { font-size: 14px; line-height: 1; }
.i18n-btn-current { font-weight: 600; font-size: 11px; letter-spacing: 0.5px; }
.i18n-btn-caret { font-size: 10px; line-height: 1; opacity: 0.7; }
.i18n-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 100;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    background: var(--panel, #fff);
    border: 1px solid var(--border, #e5e5e7);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    min-width: 140px;
    font-size: 13px;
}
.i18n-menu[hidden] { display: none; }
.i18n-menu li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}
.i18n-menu li:hover { background: rgba(102,126,234,0.08); }
.i18n-menu li.is-active { color: #667eea; font-weight: 600; }
.i18n-menu-flag {
    display: inline-block;
    width: 24px;
    text-align: center;
    font-size: 11px;
    opacity: 0.6;
    font-weight: 600;
}
.i18n-menu-name { flex: 1; }
.i18n-menu-check { color: #667eea; opacity: 0; }
.i18n-menu li.is-active .i18n-menu-check { opacity: 1; }

/* === 画廊 header 链接 === */
.gallery-header-links {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* === Toast 通知（P2.2 新增） === */
@keyframes toastIn {
    from { opacity: 0; transform: translate(-50%, 10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.header-formula sub {
    font-size: 10px;
}

/* 主内容区 */
.main-content {
    flex: 1;
    display: flex;
    gap: 8px;
    min-height: 0;
}

/* 左侧控制面板 */
.control-panel {
    width: 260px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

.panel-section {
    background: white;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.panel-section h3 {
    font-size: 12px;
    color: #333;
    margin-bottom: 6px;
}

/* 色环+颜料组 */
.color-group-row {
    display: flex;
    gap: 10px;
}

.color-wheel-section {
    position: relative;
    flex-shrink: 0;
}

#colorWheel {
    cursor: crosshair;
    border-radius: 50%;
    display: block;
}

.wheel-cursor {
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    transform: translate(-50%, -50%);
    top: 50px;
    left: 50px;
    background: #FF3B30;
}

.hue-slider {
    width: 100px;
    margin-top: 6px;
    -webkit-appearance: none;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, hsl(0, 100%, 50%), hsl(60, 100%, 50%), hsl(120, 100%, 50%), hsl(180, 100%, 50%), hsl(240, 100%, 50%), hsl(300, 100%, 50%), hsl(360, 100%, 50%));
    cursor: pointer;
}

.hue-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    border: 1px solid #333;
    cursor: pointer;
}

.color-presets-section {
    flex: 1;
}

.color-presets {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    margin-bottom: 6px;
}

.scheme-label {
    text-align: center;
    font-size: 11px;
    color: #888;
    padding: 2px 0;
    margin-bottom: 4px;
}

.style-selector-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 12px;
}

.color-style-select {
    flex: 1;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    background: white;
    font-size: 12px;
    cursor: pointer;
}

.color-style-select:focus {
    outline: none;
    border-color: var(--primary);
}

.color-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.15s;
}

.color-btn:hover {
    transform: scale(1.15);
}

.color-btn.active {
    border-color: #333;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.3);
}

.current-color-display {
    pointer-events: none;
    /* 👈 就加这一行！ */
    display: flex;
    align-items: center;
    gap: 6px;
}

.color-preview {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background: #FF3B30;
    border: 1px solid #ddd;
}

.color-hex {
    font-family: monospace;
    font-size: 11px;
    color: #333;
}

/* 混色器 */
.mixer-colors {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.mixer-slot {
    flex: 1;
    height: 32px;
    border-radius: 6px;
    border: 1px dashed #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #aaa;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}

.mixer-slot:not(.empty):hover {
    border-color: #999;
}

.mixer-slot.selected {
    border-color: var(--primary);
    border-style: solid;
}

.mixer-slot .slot-delete {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 12px;
    height: 12px;
    background: rgba(0, 0, 0, 0.4);
    color: white;
    border-radius: 50%;
    font-size: 8px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.mixer-slot:not(.empty):hover .slot-delete {
    display: flex;
}

.mixer-sliders {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 6px;
}

.mix-ratio {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: #666;
}

.mix-ratio span {
    width: 12px;
    text-align: center;
}

.ratio-slider {
    flex: 1;
    -webkit-appearance: none;
    height: 4px;
    border-radius: 2px;
    background: #ddd;
    cursor: pointer;
}

.ratio-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

.mixer-result {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    background: #f5f5f5;
    border-radius: 6px;
    margin-bottom: 6px;
}

.result-preview {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #808080;
    border: 1px solid #ddd;
}

.result-hex {
    font-family: monospace;
    font-size: 12px;
    font-weight: 600;
}

.mixer-buttons {
    display: flex;
    gap: 4px;
}

.mixer-buttons .btn {
    flex: 1;
    padding: 6px 8px;
    font-size: 11px;
}

/* 拆色分析按钮 - 和其他按钮一样 */
.btn-analyze {
    flex: 1;
    padding: 6px 8px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    font-size: 11px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
}

.btn-analyze:hover {
    background: linear-gradient(135deg, #ff5252 0%, #d63031 100%);
}

/* 清空画布按钮 */
#clearCanvasBtn {
    background: #ced4da;
    color: #333;
    border: 1px solid #adb5bd;
}

#clearCanvasBtn:hover {
    background: #c5ced4;
}

/* 打开图片按钮 */
#openImageBtn {
    background: #e9ecef;
    color: #333;
    border: 1px solid #adb5bd;
}

#openImageBtn:hover {
    background: #dee2e6;
}

/* 图形按钮 */
.shape-buttons {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.shape-btn {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.shape-btn:hover {
    background: #e9ecef;
}

.shape-btn.active {
    background: #007AFF;
    border-color: #007AFF;
    color: white;
}

.shape-options {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.shape-hollow-btn {
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s;
}

.shape-hollow-btn:hover {
    background: #e9ecef;
}

.shape-hollow-btn.active {
    background: #5856d6;
    color: white;
    border-color: #5856d6;
}

/* 更多按钮 */
.shape-more-btn {
    width: 100%;
    padding: 4px 8px;
    margin-top: 6px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 11px;
    color: #666;
    transition: all 0.15s;
}

.shape-more-btn:hover {
    background: #e9ecef;
}

/* 图形选择浮层 */
.shape-picker-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000000;
    align-items: center;
    justify-content: center;
}

.shape-picker-overlay.show {
    display: flex;
}

.shape-picker-panel {
    background: white;
    border-radius: 12px;
    padding: 16px;
    min-width: 320px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.shape-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.shape-picker-close {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: #f0f0f0;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shape-picker-close:hover {
    background: #e0e0e0;
}

.shape-picker-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}

.shape-picker-grid .shape-btn {
    width: 40px;
    height: 40px;
    font-size: 18px;
}

/* 保存图片按钮 */
#saveImageBtn {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

#saveImageBtn:hover {
    background: #ffeeba;
}

/* 吸管按钮 */
.btn-eyedropper {
    pointer-events: all;
    /* 👈 按钮自己能点 */
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    margin-left: 4px;
}

.btn-eyedropper:hover {
    background: #e9ecef;
}

.btn-eyedropper.active {
    background: #007AFF;
    border-color: #007AFF;
}

.btn-eyedropper.active::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 6px;
    animation: eyedropper-pulse 0.8s infinite;
}

@keyframes eyedropper-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(0, 122, 255, 0.4);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(0, 122, 255, 0);
    }
}

/* 撤销重做按钮组 */
.undo-redo-group {
    display: flex;
    gap: 6px;
}

.btn-undo,
.btn-redo {
    flex: 1;
    padding: 6px 8px;
    font-size: 11px;
    border: 1px solid #dee2e6;
}

.btn-undo {
    background: #6c757d;
    color: white;
}

.btn-undo:hover {
    background: #5a6268;
}

.btn-redo {
    background: #6c757d;
    color: white;
}

.btn-redo:hover {
    background: #5a6268;
}

/* 拆色结果面板 */
.analyze-section {
    background: #fffbeb;
}

.analyze-result {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.analyze-slot {
    flex: 1;
    text-align: center;
}

.analyze-color {
    width: 100%;
    height: 40px;
    border-radius: 6px;
    border: 1px solid #ddd;
    margin-bottom: 4px;
}

.analyze-name {
    display: block;
    font-size: 11px;
    font-weight: 500;
}

.analyze-ratio {
    display: block;
    font-size: 10px;
    color: #666;
}

.analyze-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 8px;
    background: white;
    border-radius: 6px;
}

.preview-label {
    font-size: 10px;
    color: #666;
}

.analyze-target,
.analyze-mixed {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid #ddd;
}

.analyze-similarity {
    font-size: 11px;
    color: #666;
    text-align: center;
    margin-bottom: 8px;
}

/* 加水量 & 笔触大小 */
.water-section h3,
.brush-section h3 {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.water-slider,
.brush-slider {
    width: 100%;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    cursor: pointer;
    margin: 6px 0;
}

.water-slider {
    background: linear-gradient(to right, #87CEEB, #4682B4);
}

.brush-slider {
    background: linear-gradient(to right, #ddd, #666);
}

.brush-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}

.brush-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 4px;
    font-size: 11px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    gap: 2px;
}

.brush-item:hover {
    background: #f0f0f0;
}

.brush-item.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.brush-item span:first-child {
    font-size: 16px;
}

.brush-name {
    font-size: 9px;
    line-height: 1;
}

.brush-params {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brush-params .slider-container {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
}

.brush-params .slider-container .slider-label {
    font-size: 9px;
    color: #888;
    min-width: 12px;
}

.brush-params .slider-container span:last-child {
    min-width: 30px;
    text-align: right;
    font-size: 10px;
}

.tool-section h3 {
    margin-bottom: 6px;
}

.tool-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tool-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-btn:hover {
    background: #f0f0f0;
    border-color: var(--primary);
}

.tool-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.tool-btn.small {
    width: 28px;
    height: 28px;
    font-size: 12px;
    border-radius: 4px;
}

.water-slider::-webkit-slider-thumb,
.brush-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--primary);
    cursor: pointer;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 4px;
}

.slider-label {
    font-size: 10px;
    color: var(--text-light);
}

.sl-slider-row {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 6px 10px 4px;
}

.sl-slider-item {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.sl-slider-item .slider-label {
    width: 24px;
    font-size: 10px;
    flex-shrink: 0;
}

.sl-slider {
    flex: 1;
    min-width: 40px;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    cursor: pointer;
    background: linear-gradient(to right, #888, hsl(0, 100%, 50%));
}

.sl-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #444;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

#saturationSlider {
    background: linear-gradient(to right, #888, hsl(0, 100%, 50%));
}

#lightnessSlider {
    background: linear-gradient(to right, #000, #ccc, #fff);
}

/* 层状态 */
.status-section {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
}

.status-label {
    font-size: 12px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(52, 199, 89, 0.15);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.wet {
    background: var(--wet-color);
    animation: pulse 1.5s infinite;
}

.status-dot.dry {
    background: var(--dry-color);
    animation: none;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.status-text {
    font-size: 11px;
    font-weight: 500;
}

/* 图层面板 */
.layers-panel {
    padding: 8px 10px;
}

.layers-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.layers-header h3 {
    font-size: 12px;
    color: #333;
    margin: 0;
}

.layers-btns {
    display: flex;
    gap: 4px;
}

.btn-layer {
    width: 22px;
    height: 22px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.btn-layer:hover {
    background: #e9ecef;
}

.layer-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 200px;
    overflow-y: auto;
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    background: #f8f9fa;
    transition: background 0.15s;
}

.layer-item:hover {
    background: #e9ecef;
}

.layer-item.active {
    background: #007AFF;
    color: white;
}

.layer-item.locked {
    opacity: 0.6;
}

.layer-clip-btn {
    font-size: 10px;
    cursor: pointer;
    padding: 0 2px;
    opacity: 0.5;
}

.layer-clip-btn.active {
    opacity: 1;
    color: #e74c3c;
}

.layer-blend-select {
    font-size: 10px;
    padding: 1px;
}

.layer-vis-btn, .layer-lock-btn, .layer-up-btn, .layer-down-btn {
    cursor: pointer;
    font-size: 10px;
    flex-shrink: 0;
    opacity: 0.7;
}

.layer-vis-btn:hover, .layer-lock-btn:hover, .layer-up-btn:hover, .layer-down-btn:hover {
    opacity: 1;
}

.layer-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 画布区域 */
.canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    position: relative;
    z-index: 1;
    transition: margin-right 0.2s;
}

.canvas-area.ai-panel-open {
    margin-right: 0;
}

.canvas-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}

.btn-zoom {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.btn-zoom:hover {
    background: #e9ecef;
}

.zoom-level {
    font-size: 12px;
    color: #666;
    min-width: 44px;
    text-align: center;
}

.toolbar-divider {
    color: #ddd;
    margin: 0 2px;
}

.toolbar-spacer {
    flex: 1;
}

.ai-side-panel {
    width: 0;
    flex-shrink: 0;
    overflow: hidden;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    transition: width 0.2s;
}

.ai-side-panel.visible {
    width: 350px;
}

.ai-panel-resize-handle {
    width: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: ew-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
}

.ai-panel-header {
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-panel-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
}

.ai-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-analyze-section {
    display: flex;
    justify-content: center;
    padding: 8px 0;
}

.ai-analyze-btn {
    width: 100%;
    padding: 10px 16px;
    font-size: 14px;
}

.ai-colors-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px;
}

.ai-colors-label {
    font-size: 11px;
    color: #666;
    margin-bottom: 8px;
}

.ai-colors-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-color-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.ai-color-item:hover {
    background: #f0f0f0;
}

.ai-color-chip {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

.ai-color-chip:hover {
    transform: scale(1.05);
    border-color: #667eea;
}

.ai-color-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.ai-color-name {
    font-size: 12px;
    color: #333;
    min-width: 50px;
}

.ai-color-hex {
    font-size: 11px;
    color: #666;
    font-family: monospace;
}

.ai-color-pct {
    font-size: 11px;
    color: #667eea;
    font-weight: bold;
    margin-left: auto;
}

.ai-prompt-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-prompt-label {
    font-size: 11px;
    color: #666;
}

.ai-prompt-text {
    flex: 1;
    min-height: 120px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 12px;
    resize: none;
    font-family: inherit;
}

.ai-prompt-btns {
    display: flex;
    gap: 8px;
}

.ai-btn {
    flex: none;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    background: #667eea;
    color: white;
    transition: background 0.2s;
    width: auto;
    min-width: 80px;
    text-align: center;
}

.ai-btn:hover {
    background: #764ba2;
}

.ai-gen-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px;
}

.ai-gen-label {
    font-size: 11px;
    color: #666;
    margin-bottom: 8px;
}

.ai-gen-preview {
    text-align: center;
}

.ai-gen-btns {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.ai-gen-img {
    max-width: 100%;
    border-radius: 6px;
    cursor: pointer;
}

.ai-style-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px;
    display: block;
}

.ai-style-label {
    font-size: 11px;
    color: #666;
    margin-bottom: 6px;
}

.ai-style-text {
    font-size: 12px;
    color: #333;
    line-height: 1.5;
}

.ai-user-desc-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-user-desc-label {
    font-size: 11px;
    color: #666;
}

.ai-user-desc-text {
    min-height: 60px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 12px;
    resize: none;
    font-family: inherit;
}

.ai-use-style-section {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 0;
}

.ai-use-style-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #333;
    cursor: pointer;
}

.ai-use-style-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.ai-style-result-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px;
}

.ai-style-result-label {
    font-size: 11px;
    color: #666;
    margin-bottom: 6px;
}

.ai-style-result-text {
    font-size: 12px;
    color: #333;
    line-height: 1.5;
    min-height: 60px;
    width: 100%;
    resize: vertical;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 6px 8px;
box-sizing: border-box;
    font-family: inherit;
}

.ai-presets-label {
    font-size: 11px;
    color: #666;
    margin-bottom: 6px;
}

.ai-presets-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}

.ai-preset-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 4px;
    background: #f8f9fa;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-preset-item:hover {
    background: #e9ecef;
}

.ai-preset-item.active {
    background: #007AFF;
    color: white;
}

.ai-preset-icon {
    font-size: 18px;
}

.ai-preset-name {
    font-size: 10px;
    text-align: center;
}

.ai-preset-tag {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 8px;
    padding: 1px 3px;
    background: #ff9500;
    color: white;
    border-radius: 3px;
}

.ai-preset-tag-color {
    background: #007AFF;
}

.ai-prompt-section .ai-btn {
    flex: none;
    padding: 6px 16px;
    font-size: 12px;
}

.ai-aspect-section {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-aspect-label {
    font-size: 12px;
    color: #666;
}

#aiAspectSelect {
    font-size: 12px;
    padding: 4px 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: white;
    cursor: pointer;
}

.btn-settings {
    margin-left: auto;
}

/* === Toast 通知（P2.2 新增） === */
@keyframes toastIn {
    from { opacity: 0; transform: translate(-50%, 10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* === AI 配额条（P3.1） === */
.ai-quota-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(90deg, #fff7e6 0%, #fff 100%);
    border: 1px solid #ffd591;
    border-radius: 6px;
    padding: 6px 10px;
    margin-bottom: 8px;
    font-size: 12px;
}
.ai-quota-text { color: #874d00; }
.ai-quota-text strong { color: #d46b08; font-size: 13px; }
.ai-quota-upgrade {
    background: linear-gradient(90deg, #fa8c16 0%, #fa541c 100%);
    color: white;
    border: none;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 11px;
    cursor: pointer;
    font-weight: 600;
}
.ai-quota-upgrade:hover { opacity: 0.9; }
.ai-quota-bar.exhausted {
    background: linear-gradient(90deg, #fff1f0 0%, #fff 100%);
    border-color: #ffa39e;
}
.ai-quota-bar.exhausted .ai-quota-text { color: #a8071a; }

/* === 付费墙弹窗（P3.4） === */
.paywall-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.65);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.paywall-modal {
    background: white;
    border-radius: 16px;
    padding: 32px 28px 24px;
    max-width: 720px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-height: 90vh;
    overflow-y: auto;
}
.paywall-modal h2 {
    margin: 0 0 8px;
    font-size: 22px;
    text-align: center;
    color: #1c1c1e;
}
.paywall-reason {
    text-align: center;
    color: #999;
    font-size: 13px;
    margin: 0 0 24px;
}
.paywall-close {
    position: absolute;
    top: 12px; right: 12px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    width: 32px; height: 32px;
    border-radius: 50%;
}
.paywall-close:hover { background: #f5f5f5; }
.paywall-plans {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
@media (max-width: 600px) {
    .paywall-plans { grid-template-columns: 1fr; }
}
.paywall-plan {
    border: 2px solid #e5e5e7;
    border-radius: 10px;
    padding: 16px 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}
.paywall-plan:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102,126,234,0.15);
}
.paywall-plan-recommended {
    border-color: #667eea;
    background: linear-gradient(180deg, #f0f3ff 0%, #fff 100%);
}
.paywall-plan-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(90deg, #fa8c16 0%, #fa541c 100%);
    color: white;
    font-size: 11px;
    padding: 2px 10px;
    border-radius: 10px;
    white-space: nowrap;
}
.paywall-plan-name {
    font-size: 14px;
    font-weight: 600;
    color: #1c1c1e;
    margin-bottom: 6px;
}
.paywall-plan-price {
    font-size: 24px;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 10px;
}
.paywall-plan-price span {
    font-size: 12px;
    color: #999;
    font-weight: 400;
}
.paywall-plan ul {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 12px;
    color: #555;
    text-align: left;
}
.paywall-plan ul li {
    padding: 3px 0;
}
.paywall-note {
    text-align: center;
    color: #999;
    font-size: 11px;
    margin: 0;
    padding: 12px;
    background: #f9f9f9;
    border-radius: 6px;
}

/* === 教程弹窗（P4.1） === */
.tutorial-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.tutorial-modal {
    background: var(--panel, white);
    border-radius: 12px;
    max-width: 720px;
    width: 100%;
    max-height: 85vh;
    overflow: auto;
    padding: 28px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.tutorial-close {
    position: absolute;
    top: 12px; right: 12px;
    background: none; border: none;
    font-size: 24px; cursor: pointer;
    color: #999; width: 32px; height: 32px;
    border-radius: 50%;
}
.tutorial-close:hover { background: rgba(0,0,0,0.05); }
.tutorial-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border, #e5e5e7);
    margin-bottom: 16px;
    padding-bottom: 8px;
}
.tutorial-tab {
    background: none; border: none;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    color: #666;
    border-radius: 6px;
    transition: all 0.2s;
}
.tutorial-tab:hover { background: rgba(102,126,234,0.08); }
.tutorial-tab.active {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
}
.tutorial-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    padding: 6px 0;
    border-bottom: 1px dashed var(--border, #e5e5e7);
}
.tutorial-filter button {
    background: var(--panel, #fafafa);
    border: 1px solid var(--border, #e5e5e7);
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}
.tutorial-filter button:hover {
    border-color: #fa8c16;
    color: #fa8c16;
}
.tutorial-filter button.active {
    background: linear-gradient(90deg, #fa8c16 0%, #fa541c 100%);
    color: white;
    border-color: transparent;
    font-weight: 600;
}
.tutorial-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}
.tutorial-card {
    background: var(--panel, #fafafa);
    border: 1px solid var(--border, #e5e5e7);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}
.tutorial-card-thumb {
    width: 100%;
    height: 120px;
    background: linear-gradient(135deg, #e0e0e0 0%, #f5f5f5 100%);
    background-size: cover;
    background-position: center;
    border-radius: 6px;
    margin-bottom: 8px;
    position: relative;
    overflow: hidden;
}
.tutorial-card-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,0.3) 100%);
}
.tutorial-card-thumb-label {
    position: absolute;
    bottom: 4px;
    left: 6px;
    color: white;
    font-size: 10px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
    z-index: 1;
}
.tutorial-card-thumb-noref {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 24px;
}
.tutorial-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
    border-color: #667eea;
}
.tutorial-card.scenic {
    border-left: 3px solid #fa8c16;
}
.tutorial-card-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 4px;
    color: var(--text, #1c1c1e);
}
.tutorial-card-desc {
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
    line-height: 1.4;
}
.tutorial-card-meta {
    display: flex;
    gap: 8px;
    font-size: 11px;
    color: #aaa;
}
.tutorial-card-progress {
    background: #f0f0f0;
    height: 4px;
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}
.tutorial-card-progress-bar {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    height: 100%;
    transition: width 0.3s;
}
.tutorial-card-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(90deg, #fa8c16 0%, #fa541c 100%);
    color: white;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 8px;
}

/* === 教程运行中横幅 === */
.tutorial-running-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 99999;
    background: linear-gradient(90deg, #fff7e6 0%, #fff 100%);
    border-bottom: 2px solid #ffd591;
    padding: 10px 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    font-size: 13px;
    animation: slideDown 0.3s ease-out;
}
@keyframes slideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.tutorial-running-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.tutorial-running-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #874d00;
}
.tutorial-running-info strong { font-size: 14px; color: #5c3300; }
.tutorial-running-info span {
    color: #b07800;
    font-size: 12px;
    background: rgba(255, 213, 145, 0.3);
    padding: 2px 8px;
    border-radius: 10px;
}
.tutorial-running-prompt {
    color: #444;
    font-size: 13px;
    line-height: 1.5;
}
.tutorial-running-focus {
    color: #d46b08;
    font-size: 12px;
    font-weight: 500;
}
.tutorial-running-progress {
    width: 100%;
    height: 4px;
    background: rgba(255, 213, 145, 0.4);
    border-radius: 2px;
    overflow: hidden;
}
.tutorial-running-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #ffa940, #fa8c16);
    border-radius: 2px;
    transition: width 0.3s;
}
.tutorial-running-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.tutorial-btn {
    padding: 5px 14px;
    border-radius: 12px;
    border: 1px solid #ffd591;
    background: white;
    cursor: pointer;
    font-size: 12px;
    color: #874d00;
    transition: all 0.15s;
}
.tutorial-btn:hover { background: #fff7e6; }
.tutorial-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.tutorial-btn-primary {
    background: linear-gradient(90deg, #ffa940, #fa8c16);
    color: white;
    border-color: #fa8c16;
    font-weight: 600;
}
.tutorial-btn-primary:hover { background: linear-gradient(90deg, #ffc069, #ffa940); }
.tutorial-btn-secondary { background: white; }

/* === AI 评画弹窗（P4.3） === */
.critique-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.65);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.critique-modal {
    background: var(--panel, white);
    border-radius: 16px;
    padding: 32px;
    max-width: 440px;
    width: 100%;
    text-align: center;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.critique-modal h2 { margin: 0 0 20px; font-size: 18px; }
.critique-close {
    position: absolute; top: 12px; right: 12px;
    background: none; border: none;
    font-size: 24px; cursor: pointer;
    color: #999; width: 32px; height: 32px;
    border-radius: 50%;
}
.critique-close:hover { background: rgba(0,0,0,0.05); }
.critique-score {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}
.critique-score-ring {
    width: 80px; height: 80px;
    border-radius: 50%;
    background: conic-gradient(#667eea var(--p, 0%), #f0f0f0 0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: #1c1c1e;
    position: relative;
}
.critique-score-ring::after {
    content: '';
    position: absolute;
    inset: 6px;
    background: var(--panel, white);
    border-radius: 50%;
    z-index: 0;
}
.critique-score-ring span { position: relative; z-index: 1; }
.critique-score-label { font-size: 18px; color: #999; }
.critique-comment {
    background: #f9f9f9;
    padding: 14px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
    color: #444;
    text-align: left;
    margin-bottom: 12px;
}
.critique-weak {
    text-align: left;
    font-size: 12px;
    color: #888;
    margin-bottom: 16px;
}
.critique-weak strong { color: #d46b08; }
.critique-actions {
    display: flex;
    gap: 8px;
}
.critique-btn {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}
.critique-btn-secondary {
    background: white;
    border: 1px solid #ddd;
    color: #666;
}
.critique-btn-primary {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* === 暗色主题（P4.4） === */
[data-theme="dark"] {
    --bg: #1a1a1a;
    --text: #e6e6e6;
    --text-light: #a0a0a0;
    --border: #2a2a2a;
    --panel: #232323;
}
[data-theme="dark"] body { background: var(--bg); color: var(--text); }
[data-theme="dark"] .header,
[data-theme="dark"] .control-panel,
[data-theme="dark"] .panel-section,
[data-theme="dark"] .ai-side-panel,
[data-theme="dark"] .modal,
[data-theme="dark"] .paywall-modal,
[data-theme="dark"] .tutorial-modal,
[data-theme="dark"] .critique-modal {
    background: var(--panel) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}
[data-theme="dark"] .header h1 { color: var(--text); }
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: #1a1a1a;
    color: var(--text);
    border-color: var(--border);
}
[data-theme="dark"] .btn-toolbar { color: var(--text); }
[data-theme="dark"] .tutorial-card { background: #2a2a2a; border-color: #333; }
[data-theme="dark"] .critique-comment { background: #2a2a2a; color: var(--text); }
[data-theme="dark"] .critique-btn-secondary { background: #2a2a2a; border-color: #444; color: var(--text); }
[data-theme="dark"] .paywall-plan { background: #2a2a2a; border-color: #444; }
[data-theme="dark"] .paywall-plan-recommended { background: linear-gradient(180deg, #2a2a3e 0%, #2a2a2a 100%); }
[data-theme="dark"] .paywall-note { background: #1a1a1a; color: var(--text-light); }
.ad-banner {
    position: fixed;
    bottom: 16px;
    right: 16px;
    background: linear-gradient(90deg, #fff7e6 0%, #ffe7ba 100%);
    border: 1px solid #ffd591;
    border-radius: 24px;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    max-width: 380px;
}
.ad-icon { font-size: 20px; }
.ad-text { color: #874d00; }
.ad-text strong { color: #d46b08; }
.ad-cta {
    color: white;
    background: linear-gradient(90deg, #fa8c16 0%, #fa541c 100%);
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.ad-close {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 16px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    padding: 0;
}
.ad-close:hover { background: rgba(0,0,0,0.05); }
@media (max-width: 600px) {
    .ad-banner { font-size: 11px; max-width: 90vw; }
}
.ai-style-strength-section {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}

.ai-strength-label {
    font-size: 11px;
    color: #666;
    white-space: nowrap;
}

.ai-strength-slider {
    flex: 1;
}

.strength-slider {
    width: 100%;
    -webkit-appearance: none;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(to right, #ccc, #007AFF);
    cursor: pointer;
}

.strength-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    border: 1px solid #007AFF;
    cursor: pointer;
}

.ai-portrait-section {
    padding: 6px 0;
}

.ai-portrait-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #666;
    cursor: pointer;
}

.ai-portrait-label input {
    cursor: pointer;
}

.ai-batch-section {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}

.ai-batch-label {
    font-size: 11px;
    color: #666;
}

.ai-batch-options {
    display: flex;
    gap: 8px;
}

.ai-batch-options label {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: #666;
    cursor: pointer;
}

.ai-batch-options input {
    cursor: pointer;
}

.ai-multi-style-section {
    padding: 6px 0;
}

.ai-multi-label {
    font-size: 11px;
    color: #666;
    margin-bottom: 6px;
}

.ai-multi-slots {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
}

.ai-multi-slot {
    flex: 1;
    height: 50px;
    border: 1px dashed #ccc;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #999;
    cursor: pointer;
}

.ai-multi-slot:not(.empty) {
    border-style: solid;
    background-size: cover;
    background-position: center;
}

.ai-multi-ratio {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    color: #666;
}

.multi-ratio-slider {
    flex: 1;
    -webkit-appearance: none;
    height: 4px;
    border-radius: 2px;
    background: #dee2e6;
    cursor: pointer;
}

.multi-ratio-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #007AFF;
    cursor: pointer;
}

/* === 景区写生横幅（P1.6 新增） === */
.scenic-banner {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 16px;
    text-align: center;
    font-size: 12px;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    transition: all 0.2s;
}
.scenic-banner:hover {
    background: linear-gradient(90deg, #5a6fd8 0%, #6a4391 100%);
    letter-spacing: 0.3px;
}
.scenic-banner strong {
    font-weight: 600;
    margin-right: 4px;
}
.scenic-banner .scenic-tag {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
    padding: 1px 6px;
    margin: 0 3px;
    font-size: 11px;
}

.ai-result-panel {
    background: white;
    border-top: 1px solid #dee2e6;
    padding: 8px 12px;
}

.ai-result-title {
    font-size: 11px;
    color: #667eea;
    font-weight: bold;
    margin-bottom: 6px;
}

.ai-settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-settings-modal {
    background: white;
    border-radius: 12px;
    width: 320px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.ai-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #dee2e6;
    font-size: 14px;
    font-weight: bold;
}

.ai-settings-close {
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    font-size: 18px;
    cursor: pointer;
    color: #666;
}

.ai-settings-body {
    padding: 16px;
}

.ai-settings-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.ai-settings-row label {
    width: 60px;
    font-size: 12px;
    color: #666;
}

.ai-settings-row input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
}

.ai-settings-row select {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
}

.ai-settings-footer {
    padding: 12px 16px;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: flex-end;
}

.btn-toolbar {
    height: 28px;
    padding: 0 8px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-toolbar:hover {
    background: #e9ecef;
}

.canvas-wrapper {
    flex: 1;
    background: transparent;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    overflow: auto;
    position: relative;
}

#paintCanvas {
    z-index: 999999 !important;
    /* 👈 最强层级，谁都挡不住 */
    background: rgba(0,0,0,0);
    border-radius: 4px;
    cursor: crosshair;
    pointer-events: none;
    /* 确保填满父容器 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#layersContainer {
    position: absolute;
    top: 8px;
    left: 8px;
    width: calc(100% - 16px);
    height: calc(100% - 16px);
    pointer-events: none;
}

#layersContainer canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 4px;
}

/* 底部工具栏 */
.bottom-bar {
    background: white;
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}

.brush-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.brush-preview {
    display: inline-block;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #FF3B30;
    opacity: 0.8;
    border: 1px solid #ddd;
    vertical-align: middle;
}

/* 按钮 */
.btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: white;
    color: #333;
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #f5f5f5;
}

.btn-mix {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-small {
    background: var(--success);
    color: white;
}

/* 按钮组 */
.button-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.button-group .btn {
    width: 100%;
    justify-content: center;
}

/* AI风格提取 - 底部面板 */
.ai-extract-panel {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border-top: 1px solid #dee2e6;
    padding: 8px 12px;
}

.ai-extract-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
    color: #333;
}

.ai-header-btns {
    display: flex;
    gap: 6px;
}

.ai-upload-btn {
    padding: 4px 10px;
    font-size: 11px;
    border: 1px solid #667eea;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    color: #667eea;
}

.ai-upload-btn:hover {
    background: #667eea10;
}

.ai-preview-area {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.ai-preview-img {
    width: 60px;
    height: 60px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.ai-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: #667eea;
    font-size: 11px;
}

.ai-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #667eea40;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.ai-result-area {
    margin-top: 8px;
}

.ai-result-header {
    margin-bottom: 6px;
}

.ai-result-title {
    font-size: 11px;
    color: #667eea;
    font-weight: bold;
}

.ai-colors-row {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.ai-color-chip {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid rgba(0,0,0,0.15);
    transition: transform 0.15s;
}

.ai-color-chip:hover {
    transform: scale(1.15);
}

.ai-prompt-area {
    margin-bottom: 8px;
}

.ai-prompt-label {
    font-size: 10px;
    color: #666;
    margin-bottom: 4px;
}

.ai-prompt-text {
    width: 100%;
    min-height: 50px;
    font-size: 11px;
    color: #333;
    line-height: 1.4;
    background: #fafafa;
    padding: 6px 8px;
    border-radius: 4px;
    resize: none;
    border: 1px solid #ddd;
    font-family: inherit;
}

.ai-prompt-btns {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.ai-btn {
    padding: 4px 10px;
    font-size: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    color: #333;
}

.ai-btn:hover {
    background: #f0f0f0;
}

.ai-gen-area {
    margin-top: 8px;
}

.ai-gen-label {
    font-size: 10px;
    color: #666;
    margin-bottom: 4px;
}

.ai-gen-img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.ai-error {
    color: #F53F3F;
    font-size: 11px;
    padding: 6px;
    background: #F53F3F10;
    border-radius: 4px;
    margin-top: 6px;
}

/* 响应式 */
@media (max-width: 800px) {
    .main-content {
        flex-direction: column;
    }

    .control-panel {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        max-height: 35vh;
    }

    .panel-section {
        flex: 1;
        min-width: 150px;
    }

    .header-formula {
        display: none;
    }
}

/* === P4.5 多档响应式 === */

/* 中等屏 800-1200px：AI 抽屉默认收起 */
@media (max-width: 1200px) {
    .ai-side-panel {
        width: 240px;
    }
}

/* 平板 600-800px：左侧面板压窄，AI 抽屉转到底部 */
@media (max-width: 800px) {
    .main-content {
        flex-direction: column;
    }
    .control-panel {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        max-height: 35vh;
        overflow-y: auto;
    }
    .panel-section {
        flex: 1 1 200px;
        min-width: 150px;
    }
    .ai-side-panel {
        width: 100%;
        max-height: 30vh;
    }
    .header-formula { display: none; }
    .scenic-banner { font-size: 11px; padding: 4px 8px; }
    .scenic-tag { padding: 2px 6px; font-size: 10px; }
}

/* 大手机 400-600px：控件变小 */
@media (max-width: 600px) {
    body { font-size: 12px; }
    .header h1 { font-size: 14px; }
    .btn-toolbar { padding: 4px 8px; font-size: 11px; }
    .control-panel { max-height: 30vh; }
    .panel-section { padding: 6px; }
    .canvas-container { min-height: 50vh; }
    .tutorial-modal { max-width: 95vw; max-height: 90vh; overflow-y: auto; }
    .tutorial-card { padding: 10px; }
    .paywall-plans { flex-direction: column; }
    .paywall-plan { width: 100%; }
}

/* 小手机 <400px：浮动 FAB 模式 */
@media (max-width: 400px) {
    .control-panel { display: none; }
    .control-panel.mobile-open {
        display: flex;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        z-index: 9999;
        max-height: 50vh;
        background: var(--panel, white);
        box-shadow: 0 -4px 16px rgba(0,0,0,0.2);
    }
    .fab-toggle {
        display: flex !important;
    }
    .canvas-container { width: 100%; height: calc(100vh - 60px); }
    .ai-side-panel { display: none; }
    .ai-side-panel.mobile-open {
        display: block;
        position: fixed;
        top: 60px; right: 0; bottom: 0;
        width: 80%;
        z-index: 9999;
        background: var(--panel, white);
        box-shadow: -4px 0 16px rgba(0,0,0,0.2);
    }
}

/* FAB 浮动按钮（默认隐藏，只在小屏显示） */
.fab-toggle {
    display: none;
    position: fixed;
    bottom: 20px; right: 20px;
    width: 48px; height: 48px;
    border-radius: 50%;
    background: var(--primary, #667eea);
    color: white;
    border: none;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 9998;
}
.fab-toggle.ai { right: 80px; }
}