﻿/* ========== 全局变量与重置 ========== */
:root {
    --bg-primary: #1a1d24;
    --bg-secondary: #22262f;
    --bg-tertiary: #2a2f3a;
    --bg-hover: #343a48;
    --bg-card: #ffffff;
    --bg-stat: #f7f9fc;
    --border-color: #3a3f4d;
    --text-primary: #e4e6eb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --accent: #ff7a18;
    --accent-hover: #ff9240;
    --accent-glow: rgba(255, 122, 24, 0.25);
    --accent-secondary: #3ebce2;
    --accent-purple: #b843c5;
    --danger: #ef4444;
    --success: #10b981;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.15);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.2);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.3);
    --shadow-card: 0 10px 30px rgba(0,0,0,0.08);
    --grid-line: rgba(255,255,255,0.08);
    --grid-ten: rgba(255,122,24,0.3);
}
/* 浅色主题 */
body.light-theme {
    --bg-primary: #f0f2f5;
    --bg-secondary: #eef0f4;
    --bg-tertiary: #e4e7ec;
    --bg-hover: #dfe3ea;
    --bg-card: #ffffff;
    --bg-stat: #f7f9fc;
    --border-color: #d1d5db;
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --accent: #ff7a18;
    --accent-hover: #ff9240;
    --accent-glow: rgba(255, 122, 24, 0.2);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
    --shadow-card: 0 10px 30px rgba(0,0,0,0.08);
    --grid-line: rgba(0,0,0,0.08);
    --grid-ten: rgba(255,122,24,0.4);
}
* { margin: 0; padding: 0; box-sizing: border-box; }

/* 修改后（正常滚动） */
html, body { 
  width: 100%; 
  min-height: 100%;  /* 内容少时占满一屏，内容多时自动撑开 */
  overflow-x: hidden; /* 只禁止横向滚动，保留纵向滚动 */
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif; 
  transition: background 0.3s, color 0.3s; 
}

/* ========== 自定义滚动条（多彩渐变+立体浮起） ========== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { 
    background: var(--bg-primary); 
    border-radius: 4px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.35);
}
::-webkit-scrollbar-thumb { 
    background: linear-gradient(
        135deg,
        var(--accent-purple),
        var(--accent-secondary),
        var(--accent),
        #ffd460
    );
    border-radius: 4px; 
    transition: all 0.25s ease;
    box-shadow: 
        inset 0 1px 1px rgba(255, 255, 255, 0.35),
        inset 0 -1px 1px rgba(0, 0, 0, 0.2),
        0 2px 4px rgba(0, 0, 0, 0.3),
        0 0 6px rgba(255, 122, 24, 0.2);
}
::-webkit-scrollbar-thumb:hover { 
    filter: brightness(1.25) saturate(1.15);
    box-shadow: 
        inset 0 1px 1px rgba(255, 255, 255, 0.5),
        inset 0 -1px 1px rgba(0, 0, 0, 0.25),
        0 4px 12px rgba(0, 0, 0, 0.45),
        0 0 18px rgba(255, 122, 24, 0.45);
}
/* ========== 上传引导页（液态玻璃+灵动动效） ========== */
.upload-page {
    width: 100vw;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, #1a1d24 0%, #2a2f3a 50%, #1a1d24 100%);
    color: var(--text-primary);
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 40px 20px 80px;
    box-sizing: border-box;
}
body.light-theme .upload-page {
    background: linear-gradient(135deg, #fef3e7 0%, #ffffff 50%, #e8f1ff 100%);
}
/* 背景动态渐变光斑 */
.upload-bg-blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
    animation: blobFloat 12s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}
.blob-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
    top: -200px;
    right: -150px;
    animation-delay: 0s;
}
.blob-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--accent-secondary) 0%, transparent 70%);
    bottom: -180px;
    left: -120px;
    animation-delay: -4s;
}
.blob-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--accent-purple) 0%, transparent 70%);
    top: 40%;
    left: 10%;
    animation-delay: -8s;
}
@keyframes blobFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.08); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}
/* 浮动装饰点阵 */
.upload-pattern {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.05) 1px, transparent 1px),
        radial-gradient(circle at 80% 70%, rgba(255,122,24,0.08) 1px, transparent 1px);
    background-size: 40px 40px, 60px 60px;
    pointer-events: none;
    animation: patternMove 20s linear infinite;
    z-index: 0;
}
@keyframes patternMove {
    0% { background-position: 0 0, 0 0; }
    100% { background-position: 40px 40px, 60px -60px; }
}
/* 顶部主卡片 */
.upload-hero {
    text-align: center;
    margin-bottom: 60px;
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 920px;
}
.upload-card {
    text-align: center;
    padding: 64px 88px;
    background: rgba(34, 38, 47, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-xl);
    box-shadow: 
        0 8px 40px rgba(0,0,0,0.2),
        inset 0 1px 0 rgba(255,255,255,0.15),
        inset 0 -1px 0 rgba(0,0,0,0.1);
    position: relative;
    z-index: 1;
    backdrop-filter: blur(28px) saturate(140%);
    -webkit-backdrop-filter: blur(28px) saturate(140%);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
    margin-bottom: 60px;
    box-sizing: border-box;
}
body.light-theme .upload-card {
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 
        0 8px 40px rgba(0,0,0,0.08),
        inset 0 1px 0 rgba(255,255,255,0.8);
}
/* 卡片鼠标跟随高光 */
.upload-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(255, 255, 255, 0.08),
        transparent 40%
    );
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 0;
}
body.light-theme .upload-card::before {
    background: radial-gradient(
        600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(255, 122, 24, 0.06),
        transparent 40%
    );
}
.upload-card:hover {
    transform: translateY(-4px);
    box-shadow: 
        0 16px 60px rgba(0,0,0,0.25),
        inset 0 1px 0 rgba(255,255,255,0.2);
    border-color: rgba(255, 122, 24, 0.3);
}
.upload-card-inner {
    position: relative;
    z-index: 1;
}
.upload-icon {
    width: 76px;
    height: 76px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, var(--accent), #ffb347);
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    box-shadow: 0 8px 28px var(--accent-glow);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.upload-card:hover .upload-icon {
    transform: scale(1.08) rotate(-6deg);
}
.upload-card h1 {
    font-size: 32px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #fff 0%, #ffd4a8 40%, #ffb347 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1px;
    font-weight: 700;
}
body.light-theme .upload-card h1 {
    background: linear-gradient(135deg, #1f2937 0%, #ff7a18 50%, #ff9240 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.upload-card .subtitle {
    color: var(--text-secondary);
    margin-bottom: 36px;
    font-size: 14px;
}
.upload-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 40px;
    text-align: left;
}
.feature-item {
    padding: 18px 18px;
    background: rgba(42, 47, 58, 0.5);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255,255,255,0.06);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}
body.light-theme .feature-item {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0,0,0,0.06);
}
.feature-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
    transition: left 0.6s ease;
}
.feature-item:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 122, 24, 0.3);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}
.feature-item:hover::before {
    left: 100%;
}
.feature-icon {
    font-size: 22px;
    margin-bottom: 8px;
    display: inline-block;
    transition: transform 0.3s ease;
}
.feature-item:hover .feature-icon {
    transform: scale(1.15);
}
.feature-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.feature-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.6;
}
.upload-btn-main {
    padding: 16px 32px;
    min-width: 240px;
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 6px 24px var(--accent-glow);
    position: relative;
    overflow: hidden;
}
.upload-btn-main::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    transition: left 0.5s ease;
}
.upload-btn-main:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 36px var(--accent-glow);
}
.upload-btn-main:hover::before {
    left: 100%;
}
.upload-btn-main:active { transform: translateY(0) scale(0.98); }
.upload-tips {
    margin-top: 28px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.8;
}
#file-input-main { display: none; }

/* 手绘模式次要按钮 */
.upload-btn-secondary {
    padding: 16px 32px;
    min-width: 240px;
    font-size: 16px;
    font-weight: 600;
    background: transparent;
    color: var(--text-primary);
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}
body.light-theme .upload-btn-secondary {
    border-color: rgba(0,0,0,0.12);
    color: var(--text-primary);
}
.upload-btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px var(--accent-glow);
}
.upload-btn-secondary:active { transform: translateY(0) scale(0.98); }

/* ========== 手绘模式：精简布局 ========== */
body.hand-draw-mode .panel-left {
    width: 320px; /* 适当加宽，容纳色板和导出功能 */
}

/* 手绘模式：仅隐藏和「图片转拼豆」强相关的功能 */
body.hand-draw-mode .section-gen-mode,       /* 生成模式 */
body.hand-draw-mode .section-edge-smooth,    /* 边缘平滑 */
body.hand-draw-mode .section-convert {       /* 一键转换按钮 */
    display: none !important;
}

/* 手绘模式：隐藏左侧头部的「换图」按钮 */
body.hand-draw-mode .panel-header #btn-change-image {
    display: none;
}

/* 手绘模式：画布区域自动占满剩余宽度 */
body.hand-draw-mode .canvas-area {
    width: calc(100vw - 320px - 430px); /* 左260 + 右370，剩余全给画布 */
}

/* 手绘模式：左侧面板内边距微调，更紧凑 */
body.hand-draw-mode .panel-content {
    padding: 14px;
}

/* 手绘模式：隐藏右上角原图切换按钮 */
body.hand-draw-mode .view-toggle-btn {
    display: none;
}

/* 手绘模式：隐藏按图适配比例按钮 */
body.hand-draw-mode #btn-fit-ratio {
    display: none !important;
}

/* 手绘模式专属控件：默认隐藏，手绘模式显示 */
.hand-draw-only {
    display: none;
}
body.hand-draw-mode .hand-draw-only {
    display: block;
}

/* 手绘模式：颜色选择器适配深色主题 */
body:not(.light-theme) .hand-draw-only input[type="color"] {
    border: 1px solid rgba(255,255,255,0.12);
}

/* 功能亮点区块 */
.upload-section {
    width: 100%;
    max-width: 1100px;
    margin-bottom: 70px;
    position: relative;
    z-index: 1;
    box-sizing: border-box;
}
.section-heading {
    text-align: center;
    margin-bottom: 36px;
}
.section-heading h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}
.section-heading p {
    font-size: 13px;
    color: var(--text-secondary);
}
.features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}
.feature-card {
    padding: 24px 20px;
    background: rgba(34, 38, 47, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px) saturate(130%);
    -webkit-backdrop-filter: blur(20px) saturate(130%);
    transition: all 0.3s ease;
    text-align: center;
    box-sizing: border-box;
}
body.light-theme .feature-card {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.8);
}
.feature-card:hover {
    transform: translateY(-6px);
    border-color: var(--accent);
    box-shadow: 0 12px 32px rgba(0,0,0,0.2);
}
.feature-card-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 16px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    background: linear-gradient(135deg, rgba(255,122,24,0.15), rgba(255,122,24,0.05));
    border: 1px solid rgba(255,122,24,0.2);
}
.feature-card h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.feature-card p {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* 使用步骤区块 */
.steps-wrap {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
    gap: 16px;
}
.step-item {
    flex: 1;
    text-align: center;
    position: relative;
}
.step-number {
    width: 48px;
    height: 48px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px var(--accent-glow);
    transition: transform 0.3s ease;
}
.step-item:hover .step-number {
    transform: scale(1.1);
}
.step-item h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.step-item p {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.6;
}
.step-line {
    position: absolute;
    top: 24px;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
    opacity: 0.3;
    z-index: -1;
}
/* 第1-2步连线：从第1步中心到第2步中心 */
.step-line.line-1 {
    left: 16.666%;
    width: 33.333%;
}
/* 第2-3步连线：从第2步中心到第3步中心 */
.step-line.line-2 {
    left: 50%;
    width: 33.333%;
}
/* 支持色板区块 */
.palette-showcase {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
.palette-brand-card {
    padding: 22px;
    background: rgba(34, 38, 47, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px) saturate(130%);
    -webkit-backdrop-filter: blur(20px) saturate(130%);
    transition: all 0.3s ease;
    box-sizing: border-box;
}
body.light-theme .palette-brand-card {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.8);
}
.palette-brand-card:hover {
    border-color: var(--accent-secondary);
    transform: translateY(-4px);
}
.palette-brand-card h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.palette-preview {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 2px;
    margin-bottom: 12px;
}
.palette-preview span {
    aspect-ratio: 1;
    border-radius: 2px;
}
.palette-brand-card p {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.6;
}




/* ========== 主编辑器 三栏布局 ========== */
.editor-page {
    display: none;
    width: 100vw;
    height: 100vh;
    background: var(--bg-primary);
    color: var(--text-primary);
}
.panel {
    background: var(--bg-secondary);
    background-image: 
        radial-gradient(circle at 8% 5%, rgba(255, 122, 24, 0.08), transparent 35%),
        radial-gradient(circle at 92% 95%, rgba(62, 188, 226, 0.08), transparent 35%),
        radial-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 22px 22px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
}
.panel-left { width: 300px; border-right: 1px solid var(--border-color); }
.panel-right { width: 380px; border-left: 1px solid var(--border-color); }

/* 面板拖拽手柄 */
.panel-resize-handle {
    position: absolute;
    top: 0;
    width: 6px;
    height: 100%;
    cursor: ew-resize;
    background: transparent;
    z-index: 20;
    transition: background 0.2s ease;
}
.panel-resize-handle:hover {
    background: var(--accent);
    opacity: 0.5;
}
.panel-resize-handle:active {
    background: var(--accent);
    opacity: 0.7;
}
.panel-resize-left { right: -3px; }
.panel-resize-right { left: -3px; }

.panel-header {
    padding: 16px 20px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.5px;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.panel-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.panel-right .panel-content {
    height: 0;
}
.panel-right .section {
    margin-bottom: 18px;
    flex-shrink: 0;
}
.panel-right .palette-section {
    flex: 0 0 auto;
    min-height: 0;
    margin-bottom: 18px;
}

/* ========== 👇 新版悬浮折叠按钮样式 👇 ========== */
/* 面板容器：允许按钮露出边缘（关键修复） */
/* ========== 新版：贴边式折叠按钮 ========== */
.panel {
    position: relative;
    overflow: visible;
}
.panel-content {
    overflow-y: auto;
    overflow-x: hidden;
}

/* 按钮本体：超薄、低存在感 */
.panel-float-toggle {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 36px;
    padding: 0;
    margin: 0;
    border: none;
    background: rgba(42, 47, 58, 0.35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: rgba(255,255,255,0.6);
    font-size: 14px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    z-index: 30;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    font-family: serif;
}

/* 左侧按钮：直边贴面板右边缘，圆角朝画布 */
.panel-left .panel-float-toggle {
    left: 100%;
    border-radius: 0 6px 6px 0;
}

/* 右侧按钮：直边贴面板左边缘，圆角朝画布 */
.panel-right .panel-float-toggle {
    right: 100%;
    border-radius: 6px 0 0 6px;
}

/* hover：轻微加宽+高亮 */
.panel-float-toggle:hover {
    width: 18px;
    background: var(--accent);
    color: #fff;
    box-shadow: 0 0 8px var(--accent-glow);
}

/* 浅色主题适配 */
body.light-theme .panel-float-toggle {
    background: rgba(255, 255, 255, 0.55);
    color: rgba(0,0,0,0.45);
}
body.light-theme .panel-float-toggle:hover {
    background: var(--accent);
    color: #fff;
}

/* 面板折叠状态 */
.panel-left.collapsed {
    width: 0 !important;
    min-width: 0;
    border-right: none;
}
.panel-right.collapsed {
    width: 0 !important;
    min-width: 0;
    border-left: none;
}

.panel-left.collapsed .panel-resize-left,
.panel-right.collapsed .panel-resize-right,
.panel.collapsed .panel-header,
.panel.collapsed .panel-content {
    display: none;
}

/* ========== 👆 新版样式结束 👆 ========== */
/* ========== 通用组件（液态玻璃效果） ========== */
.section { margin-bottom: 22px; }
.section-title {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-left: 3px solid var(--accent);
    padding-left: 8px;
    font-weight: 600;
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.section-header .section-title {
    margin-bottom: 0;
}
.palette-toggle {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    padding: 2px 8px;
    border-radius: 6px;
}
.palette-toggle:hover {
    color: var(--accent);
    background: var(--bg-tertiary);
}
.select-wrapper {
    position: relative;
    margin-bottom: 10px;
}
.select-wrapper select {
    width: 100%;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px) saturate(120%);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    font-size: 12px;
    outline: none;
    cursor: pointer;
    appearance: none;
    transition: all 0.25s ease;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    box-sizing: border-box;
}
.select-wrapper select:focus { 
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 0 3px var(--accent-glow);
}
.select-wrapper::after {
    content: '▾';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 12px;
    pointer-events: none;
}
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 12px;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px) saturate(120%);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    user-select: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    box-sizing: border-box;
}
.btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        0 4px 12px rgba(0, 0, 0, 0.15);
}
.btn:active { transform: translateY(0); }
.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border: none;
    color: #fff;
    box-shadow: 0 4px 14px var(--accent-glow);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-hover), #ffa94d);
    color: #fff;
    box-shadow: 0 6px 20px var(--accent-glow);
}
.btn-danger {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--danger);
}
.btn-danger:hover { 
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--danger);
}
.btn.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border: none;
    color: #fff;
    box-shadow: 0 2px 10px var(--accent-glow);
}
.btn-group { display: flex; gap: 4px; flex-wrap: wrap; }
.btn-group .btn { flex: 1; min-width: 0; }
.input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.input-row label {
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 64px;
    flex-shrink: 0;
}
.input-row input[type="number"] {
    flex: 1;
    padding: 7px 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px) saturate(120%);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    font-size: 12px;
    outline: none;
    width: 100%;
    text-align: right;
    font-family: monospace;
    transition: all 0.25s ease;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    box-sizing: border-box;
}
.input-row input[type="number"]:focus { 
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 0 3px var(--accent-glow);
}
/* 边缘平滑：滑块+数字框同行适配 */
.input-row input[type="range"] + input[type="number"] {
    flex: 0 0 52px;
    margin-left: 8px;
    text-align: center;
    padding: 7px 4px;
    font-family: monospace;
}
input[type="range"] {
    width: 100%;
    height: 4px;
    background: var(--bg-primary);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 6px var(--accent-glow);
}
input[type="range"]::-webkit-slider-thumb:hover { 
    transform: scale(1.2); 
    box-shadow: 0 4px 12px var(--accent-glow);
}
input[type="range"]:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 12px;
    color: var(--text-secondary);
}
.switch {
    position: relative;
    width: 40px;
    height: 22px;
    background: var(--bg-primary);
    border-radius: 11px;
    cursor: pointer;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}
.switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.switch.on {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 2px 6px var(--accent-glow);
}
.switch.on::after { left: 20px; background: #fff; }
/* ========== 中间画布区域 ========== */
.canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    background: var(--bg-primary);
    min-width: 0;
}
.canvas-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
    padding: 0;
}
.view-toggle-btn {
    position: absolute;
    top: 24px;
    right: 24px;
    z-index: 20;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    color: #ff7a18;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
}
.view-toggle-btn svg {
    width: 16px;
    height: 16px;
}
.view-toggle-btn:hover {
    background: #ff7a18;
    color: #fff;
    transform: scale(1.08);
}
.change-image-btn {
    top: 66px;
    right: 24px;
}
.change-image-btn:hover {
    background: #ff7a18;
    color: #fff;
    transform: scale(1.08);
}
.canvas-container { 
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: left top;
}
.ruler-top {
    position: absolute;
    top: 0;
    left: 24px;
    height: 22px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
    z-index: 5;
    border-radius: 4px 4px 0 0;
    transform-origin: left top;
}
.ruler-top canvas { display: block; image-rendering: pixelated; }
.ruler-left {
    position: absolute;
    top: 22px;
    left: 0;
    width: 24px;
    background: var(--bg-tertiary);
    border-right: 1px solid var(--border-color);
    overflow: hidden;
    z-index: 5;
    border-radius: 4px 0 0 4px;
    transform-origin: left top;
}
.ruler-left canvas { display: block; image-rendering: pixelated; }
.ruler-bottom {
    position: absolute;
    bottom: 0;
    left: 24px;
    height: 22px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    overflow: hidden;
    z-index: 5;
    border-radius: 0 0 4px 4px;
    transform-origin: left top;
}
.ruler-bottom canvas { display: block; image-rendering: pixelated; }
.ruler-right {
    position: absolute;
    top: 22px;
    right: 0;
    width: 24px;
    background: var(--bg-tertiary);
    border-left: 1px solid var(--border-color);
    overflow: hidden;
    z-index: 5;
    border-radius: 0 4px 4px 0;
    transform-origin: left top;
}
.ruler-right canvas { display: block; image-rendering: pixelated; }
.canvas-main {
    position: relative;
    margin-top: 22px;
    margin-left: 24px;
    margin-bottom: 22px;
    margin-right: 24px;
    border-radius: 0 4px 4px 0;
    box-shadow: var(--shadow-md);
}
.canvas-stack {
    position: relative;
    line-height: 0;
    border-radius: 4px;
    overflow: hidden;
    transform-origin: left top;
}
.canvas-stack canvas {
    position: absolute;
    top: 0;
    left: 0;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    transform: translateZ(0);
}
.canvas-stack canvas:first-child { position: relative; }
#canvas-bg { z-index: 1; }
#canvas-main { z-index: 2; cursor: crosshair; transition: opacity 0.2s; }
.canvas-container.no-ruler .ruler-top,
.canvas-container.no-ruler .ruler-left,
.canvas-container.no-ruler .ruler-bottom,
.canvas-container.no-ruler .ruler-right { display: none; }
.canvas-container.no-ruler .canvas-main { margin-top: 0; margin-left: 0; margin-bottom: 0; margin-right: 0; }
/* ========== 颜色悬浮提示 ========== */
.color-tooltip {
    position: absolute;
    z-index: 999;
    pointer-events: none;
    padding: 8px 12px;
    background: rgba(34, 38, 47, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px) saturate(140%);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 12px;
    line-height: 1.5;
    display: none;
    gap: 8px;
    align-items: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    white-space: nowrap;
}
body.light-theme .color-tooltip {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.08);
}
.color-tooltip-swatch {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid rgba(255,255,255,0.2);
    flex-shrink: 0;
}
body.light-theme .color-tooltip-swatch {
    border-color: rgba(0,0,0,0.15);
}
/* ========== 底部区域：用料统计（占满宽度） ========== */
.bottom-area {
    flex-shrink: 0;
    display: flex;
    gap: 20px;
    padding: 14px 24px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    max-height: 160px;
    overflow: hidden;
    transition: height 0.45s linear, max-height 0.45s linear;
    position: relative;
    box-sizing: border-box;
}
/* 隐藏原图例区域，空间全给统计 */
.legend-area {
    display: none;
}
/* 用料统计占满底部宽度 */
.bottom-area .stats-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin: 0;
    padding: 0;
    border-top: none;
}
.bottom-area .stats-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 10px;
    flex-shrink: 0;
}
.bottom-area .stat-item {
    text-align: center;
    padding: 10px 4px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px) saturate(120%);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
    border-radius: var(--radius-sm);
    transition: all 0.25s ease;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    box-sizing: border-box;
}
.bottom-area .stat-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        0 4px 12px rgba(0, 0, 0, 0.1);
}
.bottom-area .stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}
.bottom-area .stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
}
.bottom-area .stats-list {
    flex: 1;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(10px) saturate(120%);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
    scrollbar-width: thin;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.bottom-area .stats-list::-webkit-scrollbar { width: 6px; }
.bottom-area .stat-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    font-size: 11px;
    border-bottom: 1px solid var(--bg-secondary);
    transition: background 0.2s;
}
.bottom-area .stat-row:last-child { border-bottom: none; }
.bottom-area .stat-row:hover {
    background: rgba(255, 255, 255, 0.06);
}
.bottom-area .stat-row.disabled { opacity: 0.35; }
.bottom-area .stat-row .swatch {
    width: 14px;
    height: 14px;
    border-radius: 2px;
    flex-shrink: 0;
}
.bottom-area .stat-row .color-code {
    color: var(--text-secondary);
    min-width: 32px;
}
.bottom-area .stat-row .count {
    margin-left: auto;
    color: var(--text-primary);
    font-weight: 600;
}
.canvas-grab { cursor: grab !important; }
.canvas-grabbing { cursor: grabbing !important; }
.palette-size-btn.active {
    box-shadow: 0 2px 8px var(--accent-glow);
}
.file-input { display: none; }
#print-area { display: none; }
/* ========== 右侧：当前颜色 ========== */
.current-color-display {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px) saturate(130%);
    -webkit-backdrop-filter: blur(12px) saturate(130%);
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    transition: all 0.3s ease;
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 2px 8px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
}
.current-color-display:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        0 6px 16px rgba(0, 0, 0, 0.12);
}
.current-color-box {
    width: 44px;
    height: 44px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1), 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}
.current-color-display:hover .current-color-box {
    transform: scale(1.05);
}
.current-color-info {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.7;
}
.current-color-info .color-name {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 13px;
}
.tool-group .tool-btn {
    flex-direction: column;
    gap: 4px;
    padding: 12px 6px;
    font-size: 11px;
    line-height: 1.2;
}
.tool-group .tool-btn span {
    font-size: 20px;
    line-height: 1;
    transition: transform 0.2s;
}
.tool-btn:hover span {
    transform: scale(1.15);
}
.color-manage-row {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}
.color-manage-row .btn {
    flex: 1;
}
.disabled-info {
    font-size: 11px;
    color: var(--text-secondary);
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px) saturate(120%);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
    border-radius: var(--radius-sm);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    box-sizing: border-box;
}
.disabled-info strong {
    color: var(--accent);
    font-weight: 600;
}
.disabled-tip {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.5;
}
.palette-section {
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.palette-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.palette-tab {
    padding: 5px 9px;
    font-size: 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}
.palette-tab:hover { color: var(--accent); border-color: var(--accent); }
.palette-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
/* 色板网格 */
.palette-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 3px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px) saturate(120%);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
    border-radius: var(--radius-sm);
    overflow-y: hidden;
    scrollbar-width: thin;
    max-height: 92px;
    transition: height 0.45s linear, max-height 0.45s linear;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.palette-grid::-webkit-scrollbar { width: 6px; }
/* 展开状态显示全部 */
.palette-section.expanded .palette-grid {
    max-height: 550px;
    overflow-y: auto;
}
.color-swatch {
    aspect-ratio: 1;
    border: 2px solid transparent;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}
.color-swatch:hover {
    transform: scale(1.3);
    z-index: 10;
    box-shadow: 0 0 12px var(--accent-glow);
}
.color-swatch.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--bg-secondary), 0 0 0 3px var(--accent);
    z-index: 5;
}
.color-swatch.disabled {
    opacity: 0.2;
    filter: grayscale(1);
}
.palette-tips {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 10px;
    line-height: 1.5;
}
/* 浅色主题液态玻璃适配 */
body.light-theme .btn {
    background: rgba(255, 255, 255, 0.55);
    border-color: rgba(255, 255, 255, 0.7);
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        0 2px 8px rgba(0, 0, 0, 0.04);
}
body.light-theme .btn:hover {
    background: rgba(255, 255, 255, 0.8);
    border-color: var(--accent);
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        0 4px 12px rgba(0, 0, 0, 0.08);
}
body.light-theme .btn-primary,
body.light-theme .btn.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border: none;
    color: #fff;
}
body.light-theme .btn-primary:hover,
body.light-theme .btn.active:hover {
    background: linear-gradient(135deg, var(--accent-hover), #ffa94d);
    color: #fff;
    box-shadow: 0 6px 20px var(--accent-glow);
}
body.light-theme .select-wrapper select,
body.light-theme .input-row input[type="number"] {
    background: rgba(255, 255, 255, 0.55);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        0 2px 6px rgba(0, 0, 0, 0.03);
}
body.light-theme .select-wrapper select:focus,
body.light-theme .input-row input[type="number"]:focus {
    background: rgba(255, 255, 255, 0.85);
    border-color: var(--accent);
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        0 0 0 3px var(--accent-glow);
}
body.light-theme .current-color-display,
body.light-theme .palette-grid,
body.light-theme .legend-item,
body.light-theme .stat-item,
body.light-theme .stats-list,
body.light-theme .disabled-info {
    background: rgba(255, 255, 255, 0.55);
    border-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px) saturate(120%);
    -webkit-backdrop-filter: blur(12px) saturate(120%);
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        0 2px 8px rgba(0, 0, 0, 0.04);
}
body.light-theme .current-color-display:hover,
body.light-theme .stat-item:hover,
body.light-theme .legend-item:hover {
    background: rgba(255, 255, 255, 0.8);
    border-color: var(--accent);
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        0 6px 16px rgba(0, 0, 0, 0.08);
}
body.light-theme .stat-row:hover {
    background: rgba(255, 255, 255, 0.6);
}

/* ========== 全局触控优化 ========== */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
}
input, textarea, select {
    user-select: text;
}

/* ========== 平板端适配（768px ~ 1024px） ========== */


/* ========== 手机端适配（<768px） ========== */


/* 桌面端隐藏移动端Tab */




/* ========== 底部区域拖拽与收缩 ========== */
.bottom-area {
    position: relative;
    min-height: 0;
    overflow: visible;
}
/* 高度拖拽手柄 */
.bottom-resize-handle {
    position: absolute;
    top: -3px;
    left: 0;
    width: 100%;
    height: 8px;
    cursor: ns-resize;
    background: transparent;
    z-index: 20;
    transition: background 0.2s ease;
}
.bottom-resize-handle:hover {
    background: var(--accent);
    opacity: 0.5;
}
.bottom-resize-handle:active {
    background: var(--accent);
    opacity: 0.7;
}
/* 收缩按钮 */
.stats-toggle {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    transition: all 0.2s ease;
    padding: 4px 10px;
    border-radius: 6px;
    position: relative;
    z-index: 30;
}
.stats-toggle:hover {
    color: var(--accent);
    background: var(--bg-tertiary);
}
/* 完全收缩：整个区域归零，只保留箭头悬浮在预览区底边 */
.bottom-area.fully-collapsed {
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border-top: 0 !important;
    gap: 0 !important;
    overflow: visible !important;
}
.bottom-area.fully-collapsed .legend-area,
.bottom-area.fully-collapsed .bottom-resize-handle {
    display: none !important;
}
.bottom-area.fully-collapsed .stats-section {
    display: block !important;
    position: static !important;
    width: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
}
.bottom-area.fully-collapsed .stats-section .section-header {
    display: block !important;
    position: static !important;
    margin: 0 !important;
    padding: 0 !important;
}
.bottom-area.fully-collapsed .stats-section .section-title,
.bottom-area.fully-collapsed .stats-section .stats-summary,
.bottom-area.fully-collapsed .stats-section .stats-list {
    display: none !important;
}
.bottom-area.fully-collapsed .stats-toggle {
    display: flex !important;
    position: absolute;
    left: 50%;
    top: -18px;
    transform: translateX(-50%);
    width: 34px;
    height: 20px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--border-color);
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    background: var(--bg-secondary);
}

@media print {
    body * { visibility: hidden; }
    #print-area, #print-area * { visibility: visible; }
    #print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
}


/* 桌面/平板隐藏移动端底部 Tab，保持与原单文件版一致 */
@media (min-width: 768px) {
    .mobile-tab-bar {
        display: none !important;
    }
}


/* =========================================================
   V1 卡密系统
   游客可完整浏览引导页；点击进入编辑器时才要求授权
   ========================================================= */
.license-modal,
.purchase-modal {
    position: fixed;
    inset: 0;
    z-index: 99990;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}
.license-modal.is-open,
.purchase-modal.is-open {
    display: flex;
}
.license-modal-backdrop,
.purchase-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 11, 18, 0.72);
    backdrop-filter: blur(8px);
}
.license-modal-card,
.purchase-modal-card {
    position: relative;
    z-index: 1;
    width: min(440px, 100%);
    max-height: min(720px, calc(100vh - 40px));
    overflow: auto;
    box-sizing: border-box;
    padding: 30px 28px 24px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    background: linear-gradient(145deg, rgba(28, 32, 42, 0.98), rgba(18, 21, 28, 0.98));
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
    color: #f4f7fb;
    text-align: center;
    animation: licenseModalIn .18s ease-out;
}
body.light-theme .license-modal-card,
body.light-theme .purchase-modal-card {
    background: linear-gradient(145deg, rgba(255,255,255,.98), rgba(246,249,253,.98));
    color: #1b2230;
    border-color: rgba(30, 40, 60, .12);
}
@keyframes licenseModalIn {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.license-modal-close,
.purchase-modal-close {
    position: absolute;
    right: 12px;
    top: 10px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: inherit;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    opacity: .7;
}
.license-modal-close:hover,
.purchase-modal-close:hover {
    opacity: 1;
    background: rgba(127,127,127,.12);
}
.license-modal-icon {
    font-size: 42px;
    margin: 2px 0 8px;
}
.license-modal-card h2,
.purchase-modal-card h2 {
    margin: 0 0 8px;
    font-size: 23px;
}
.license-modal-subtitle,
.purchase-modal-card > p {
    margin: 0 0 18px;
    color: #8f9aaa;
    font-size: 13px;
    line-height: 1.6;
}
body.light-theme .license-modal-subtitle,
body.light-theme .purchase-modal-card > p {
    color: #697386;
}
.license-input-wrap {
    margin-bottom: 12px;
}
#license-code-input {
    width: 100%;
    height: 48px;
    box-sizing: border-box;
    border: 1px solid rgba(127, 140, 160, .32);
    border-radius: 12px;
    outline: none;
    background: rgba(127, 140, 160, .10);
    color: inherit;
    padding: 0 14px;
    font-size: 14px;
    text-align: center;
    letter-spacing: .8px;
}
#license-code-input:focus {
    border-color: var(--accent, #ff7a18);
    box-shadow: 0 0 0 3px rgba(255,122,24,.12);
}
.license-primary-btn,
.license-buy-btn,
.license-secondary-btn {
    width: 100%;
    min-height: 44px;
    border-radius: 11px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    transition: .18s ease;
}
.license-primary-btn {
    background: linear-gradient(135deg, #ff7a18, #ff9b42);
    color: white;
    box-shadow: 0 8px 24px rgba(255,122,24,.22);
}
.license-primary-btn:hover { transform: translateY(-1px); filter: brightness(1.04); }
.license-primary-btn:disabled { opacity: .6; cursor: wait; transform: none; }
.license-buy-btn {
    margin-top: 10px;
    background: transparent;
    color: var(--accent, #ff7a18);
    border-color: rgba(255,122,24,.35);
}
.license-buy-btn:hover {
    background: rgba(255,122,24,.08);
}
.license-secondary-btn {
    margin-top: 12px;
    background: rgba(127,127,127,.10);
    color: inherit;
    border-color: rgba(127,127,127,.20);
}
.license-status {
    min-height: 20px;
    margin-top: 10px;
    font-size: 12px;
    line-height: 1.5;
    color: #ffb15c;
}
.license-status.success { color: #43d17b; }
.license-status.error { color: #ff6b6b; }
.license-types {
    margin-top: 15px;
    color: #8f9aaa;
    font-size: 11px;
}
.purchase-modal-card {
    width: min(560px, 100%);
}
.purchase-modal-card img {
    display: block;
    width: 100%;
    max-height: calc(100vh - 230px);
    object-fit: contain;
    border-radius: 12px;
    background: #fff;
}

/* 编辑器顶部卡密状态 */
.editor-license-bar {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 7px 12px;
    box-sizing: border-box;
    border-bottom: 1px solid rgba(127, 140, 160, .14);
    background: rgba(127, 140, 160, .045);
    color: #aeb8c7;
    font-size: 12px;
    line-height: 1.4;
}
.editor-license-icon {
    flex: 0 0 auto;
    font-size: 13px;
}
#editor-license-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.editor-license-bar.is-active {
    color: #78dba0;
}
.editor-license-bar.is-expiring {
    color: #ffb15c;
}
.editor-license-bar.is-error {
    color: #ff7777;
}
body.light-theme .editor-license-bar {
    color: #697386;
    background: rgba(127, 140, 160, .06);
    border-bottom-color: rgba(30, 40, 60, .08);
}
body.light-theme .editor-license-bar.is-active {
    color: #20834b;
}
body.light-theme .editor-license-bar.is-expiring {
    color: #a65b00;
}
body.light-theme .editor-license-bar.is-error {
    color: #c33a3a;
}

@media (max-width: 480px) {
    .license-modal,
    .purchase-modal { padding: 12px; }
    .license-modal-card,
    .purchase-modal-card { padding: 26px 18px 18px; border-radius: 16px; }
    .license-modal-icon { font-size: 36px; }
}

/* V2 账号登录 */
.editor-account-btn{margin-left:auto;border:1px solid rgba(255,255,255,.14);background:rgba(255,255,255,.08);color:inherit;border-radius:8px;padding:3px 8px;font-size:11px;cursor:pointer}.license-hint{margin-top:10px;font-size:11px;color:var(--text-secondary,#8b95a7);line-height:1.6}.license-form{display:flex;flex-direction:column;gap:9px}.license-form .license-input-wrap{margin:0}.license-modal-card{max-width:430px}

/* ===== 账号登录/激活界面 V2.1：大输入框 + 手机端优化 ===== */
.license-modal-card{
    width:min(460px, calc(100vw - 28px));
    padding:34px 30px 28px;
    border-radius:24px;
    background:linear-gradient(145deg,rgba(30,34,44,.985),rgba(18,21,28,.985));
    box-shadow:0 30px 90px rgba(0,0,0,.52),0 0 0 1px rgba(255,255,255,.04);
}
.license-modal-icon{
    width:64px;height:64px;margin:0 auto 14px;
    display:flex;align-items:center;justify-content:center;
    border-radius:20px;
    background:linear-gradient(135deg,rgba(255,122,24,.18),rgba(255,155,66,.08));
    border:1px solid rgba(255,145,55,.2);
    font-size:32px;
}
.license-modal-card h2{font-size:25px;letter-spacing:-.3px;margin-bottom:7px}
.license-modal-subtitle{font-size:13px;margin-bottom:22px}
.license-form{width:100%}
.license-input-wrap{margin-bottom:14px}
.license-input-wrap input{
    display:block;
    width:100%;
    min-height:56px;
    box-sizing:border-box;
    padding:0 17px;
    border:1px solid rgba(150,160,180,.24);
    border-radius:14px;
    outline:none;
    background:rgba(255,255,255,.065);
    color:#f6f8fb;
    font-size:16px;
    line-height:56px;
    transition:border-color .18s,box-shadow .18s,background .18s,transform .18s;
    -webkit-appearance:none;
}
.license-input-wrap input::placeholder{color:#8d97a8}
.license-input-wrap input:focus{
    border-color:rgba(255,128,28,.8);
    background:rgba(255,255,255,.085);
    box-shadow:0 0 0 4px rgba(255,122,24,.12);
}
.license-primary-btn{
    min-height:54px;
    margin-top:3px;
    border-radius:14px;
    font-size:16px;
    letter-spacing:.2px;
}
.license-buy-btn{
    min-height:48px;
    margin-top:10px;
    border-radius:14px;
    font-size:14px;
}
.license-get-card-btn{
    width:100%;
    min-height:48px;
    margin-top:10px;
    padding:0 12px;
    border:0;
    border-radius:14px;
    background:rgba(255,255,255,.055);
    color:#aeb8c7;
    cursor:pointer;
    font-size:14px;
    font-weight:600;
    transition:.18s ease;
}
.license-get-card-btn:hover{
    background:rgba(255,122,24,.1);
    color:#ff9b42;
}
.license-status{
    min-height:22px;
    margin-top:13px;
    padding:0 4px;
    font-size:13px;
}
.license-types{
    margin-top:18px;
    padding-top:15px;
    border-top:1px solid rgba(255,255,255,.07);
    font-size:12px;
}
.license-hint{font-size:11px;line-height:1.55;margin-top:7px}
.editor-buy-card-btn{color:#ff9b42}
@media (max-width:600px){
    .license-modal{padding:12px}
    .license-modal-card{
        width:100%;
        max-height:calc(100dvh - 24px);
        padding:30px 18px 22px;
        border-radius:22px;
    }
    .license-modal-icon{width:58px;height:58px;border-radius:18px;font-size:29px}
    .license-modal-card h2{font-size:22px}
    .license-modal-subtitle{font-size:12px;margin-bottom:18px}
    .license-input-wrap input{
        min-height:58px;
        font-size:16px;
        border-radius:14px;
    }
    .license-primary-btn{min-height:56px;font-size:16px}
    .license-buy-btn,.license-get-card-btn{min-height:50px}
    .purchase-modal-card{width:100%;padding:24px 14px 18px;border-radius:20px}
}
