/* ========================================
   设计令牌 — Google Material 3 官方色板
   参考：m3.material.io / Google AI Studio
   ======================================== */
:root {
    /* ── Primary：Google Blue ── */
    --md-primary:              #1a73e8;   /* Google Blue 600 */
    --md-primary-hover:        #1557b0;   /* Google Blue 700 */
    --md-on-primary:           #ffffff;
    --md-primary-container:    #d3e3fd;   /* Blue 50 */
    --md-on-primary-container: #041e49;   /* Blue 900 */

    /* ── Secondary ── */
    --md-secondary:            #5f6368;   /* Google Grey 600 */
    --md-secondary-container:  #e8f0fe;   /* Blue 50 lighter */
    --md-on-secondary-container: #1a237e;

    /* ── Surface：Google Cloud White ── */
    --md-surface:              #f0f4f9;   /* Google 浅蓝灰 */
    --md-surface-container:    #ffffff;   /* 纯白容器 */
    --md-surface-container-low: #f8f9fa;  /* Google Grey 50 */
    --md-surface-container-high: #e8eaed; /* Google Grey 200 */
    --md-surface-variant:      #e8eaed;   /* Google Grey 200 */

    /* ── On Surface ── */
    --md-on-surface:           #202124;   /* Google Grey 900 */
    --md-on-surface-variant:   #5f6368;   /* Google Grey 600 */

    /* ── Outline ── */
    --md-outline:              #dadce0;   /* Google Grey 300 */
    --md-outline-variant:      #e8eaed;   /* Google Grey 200 */

    /* ── Status ── */
    --md-error:                #d93025;   /* Google Red */
    --md-error-container:      #fce8e6;
    --md-success:              #1e8e3e;   /* Google Green */
    --md-success-container:    #e6f4ea;
    --md-warning:              #f9ab00;   /* Google Yellow */
    --md-warning-container:    #fef7e0;
    --md-info:                 #1a73e8;

    /* ── Google 四色 ── */
    --google-blue:   #4285f4;
    --google-red:    #ea4335;
    --google-yellow: #fbbc04;
    --google-green:  #34a853;

    /* ── 圆角：Material 3 ── */
    --radius-xs:   4px;
    --radius-s:    8px;
    --radius-m:    12px;
    --radius-l:    16px;
    --radius-xl:   28px;
    --radius-full: 9999px;

    /* ── 形状系统：Material 3 Expressive ── */
    --shape-corner-none: 0px;
    --shape-corner-extra-small: 4px;
    --shape-corner-small: 8px;
    --shape-corner-medium: 12px;
    --shape-corner-large: 16px;
    --shape-corner-extra-large: 28px;
    --shape-corner-full: 9999px;

    /* 特殊形状 */
    --shape-pill: 100px;
    --shape-stadium: 50%;
    --shape-circle: 50%;

    /* 不对称圆角 */
    --shape-corner-top: 16px 16px 0 0;
    --shape-corner-bottom: 0 0 16px 16px;
    --shape-corner-left: 16px 0 0 16px;
    --shape-corner-right: 0 16px 16px 0;

    /* 额外形状变体 */
    --shape-corner-extra-small-top: 4px 4px 0 0;
    --shape-corner-extra-small-bottom: 0 0 4px 4px;
    --shape-corner-small-top: 8px 8px 0 0;
    --shape-corner-small-bottom: 0 0 8px 8px;
    --shape-corner-medium-top: 12px 12px 0 0;
    --shape-corner-medium-bottom: 0 0 12px 12px;
    --shape-corner-large-top: 16px 16px 0 0;
    --shape-corner-large-bottom: 0 0 16px 16px;
    --shape-corner-extra-large-top: 28px 28px 0 0;
    --shape-corner-extra-large-bottom: 0 0 28px 28px;

    /* 形状交互 */
    --shape-interactive-default: var(--shape-corner-medium);
    --shape-interactive-hover: var(--shape-corner-large);
    --shape-interactive-active: var(--shape-corner-small);

    /* ── Elevation：Material 3 ── */
    --elevation-0: none;
    --elevation-1: 0 1px 2px rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
    --elevation-2: 0 1px 2px rgba(60,64,67,.3), 0 2px 6px 2px rgba(60,64,67,.15);
    --elevation-3: 0 4px 8px 3px rgba(60,64,67,.15), 0 1px 3px rgba(60,64,67,.3);
    --elevation-4: 0 6px 10px 4px rgba(60,64,67,.15), 0 2px 3px rgba(60,64,67,.3);

    /* ── Motion：Google Gemini 风格 ── */
    --motion-standard:     cubic-bezier(0.2, 0, 0, 1);
    --motion-decelerate:   cubic-bezier(0, 0, 0, 1);
    --motion-accelerate:   cubic-bezier(0.3, 0, 1, 1);
    --motion-emphasized:   cubic-bezier(0.2, 0, 0, 1);
    --motion-bounce:       cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-short:      120ms;
    --duration-medium:     200ms;
    --duration-long:       350ms;
    --transition:          all 0.2s var(--motion-standard);
    --transition-fast:     all 0.12s var(--motion-standard);
    --transition-emphasized: all 0.25s var(--motion-emphasized);

    /* ── 字体 ── */
    --font: 'Google Sans', 'Roboto', system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --font-mono: 'Roboto Mono', 'Courier New', monospace;

    /* ── Material 3 字体系统 ── */
    /* Display - 大标题 */
    --font-display-large: 57px;
    --font-display-medium: 45px;
    --font-display-small: 36px;

    /* Headline - 标题 */
    --font-headline-large: 32px;
    --font-headline-medium: 28px;
    --font-headline-small: 24px;

    /* Title - 副标题 */
    --font-title-large: 22px;
    --font-title-medium: 16px;
    --font-title-small: 14px;

    /* Body - 正文 */
    --font-body-large: 16px;
    --font-body-medium: 14px;
    --font-body-small: 12px;

    /* Label - 标签 */
    --font-label-large: 14px;
    --font-label-medium: 12px;
    --font-label-small: 11px;

    /* 字重 */
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-bold: 700;

    /* 行高 */
    --line-height-tight: 1.12;
    --line-height-normal: 1.25;
    --line-height-relaxed: 1.5;
    --line-height-loose: 1.75;

    /* 字间距 */
    --letter-spacing-tight: -0.25px;
    --letter-spacing-normal: 0;
    --letter-spacing-wide: 0.25px;

    /* ── 间距系统：严格遵循8dp网格 ── */
    --space-unit: 8px;
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;
    --space-4xl: 96px;

    /* 组件间距 */
    --space-component: var(--space-md);
    --space-section: var(--space-xl);
    --space-page: var(--space-3xl);

    /* ── 布局 ── */
    --navbar-h: 72px;
    --content-max: 1200px;

    /* ══════════════════════════════════════
       Material 3 窗口分级系统 (Window Size Classes)
       Compact:   0–599dp
       Medium:    600–839dp
       Expanded:  840–1199dp
       Large:     1200–1599dp
       Extra-large: 1600dp+
    ═════════════════════════════════════ */

    /* 窗口分级标记（由 JS 或 media query 设置） */
    --m3-window-class: expanded;

    /* ── M3 动态栅格系统 ── */
    /* 栅格列数：Compact=4, Medium+=12 */
    --m3-grid-columns: 12;
    /* 栅格间距 */
    --m3-grid-gutter: 16px;
    /* 栅格外边距 */
    --m3-grid-margin: 16px;
    /* 内容最大宽度 */
    --m3-content-max: 1240px;
    /* 内容居中 */
    --m3-content-align: center;

    /* ── M3 实验室页三栏栅格 ── */
    /* 参数面板 | 画布 | 历史面板 */
    --m3-lab-sidebar: 280px;
    --m3-lab-history: 220px;
    --m3-lab-gap: 16px;
    --m3-lab-padding: 16px;

    /* ── M3 组件自适应行为标记 ── */
    /* Reposition | Resize | Reflow | Show/Hide */
    --m3-sidebar-behavior: show;   /* show | drawer */
    --m3-history-behavior: show;  /* show | drawer */
    --m3-nav-behavior: pill;      /* pill | rail | drawer */
}

/* ── M3 窗口分级：Extra-large (≥1600dp) ── */
@media (min-width: 100rem) {
    :root {
        --m3-window-class: xl;
        --m3-grid-gutter: 24px;
        --m3-grid-margin: 32px;
        --m3-lab-sidebar: 340px;
        --m3-lab-history: 280px;
        --m3-lab-gap: 10px;
        --m3-lab-padding: 12px;

        /* 历史卡片 XL 尺寸 */
        --hc-gap: 8px;
        --hc-card-radius: var(--shape-corner-extra-large);
        --hc-img-radius: var(--shape-corner-large);
        --hc-name-font: 13px;
        --hc-name-weight: 500;
        --hc-name-line: 1.35;
        --hc-status-font: 11px;
        --hc-time-font: 11px;
        --hc-card-px: 10px;
        --hc-card-py: 10px;
        --hc-info-px: 10px;
        --hc-info-pt: 10px;
        --hc-info-pb: 6px;
        --hc-info-gap: 6px;
        --hc-meta-gap: 5px;
    }
}

/* ── M3 窗口分级：Large (1200–1599dp) ── */
@media (max-width: 99.9375rem) {
    :root {
        --m3-window-class: large;
    }
    /* 历史卡片 Large 尺寸 — 与默认一致 */
}

/* ── M3 窗口分级：Expanded (840–1199dp) ── */
@media (max-width: 74.9375rem) {
    :root {
        --m3-window-class: expanded;
        --m3-lab-sidebar: 280px;
        --m3-lab-history: 210px;
        --m3-lab-gap: 16px;
        --m3-lab-padding: 16px;
    }
}

/* ── M3 窗口分级：Medium (600–839dp) ── */
@media (max-width: 52.4375rem) {
    :root {
        --m3-window-class: medium;
        --m3-grid-columns: 4;
        --m3-grid-gutter: 16px;
        --m3-grid-margin: 16px;
        --m3-lab-sidebar: 260px;
        --m3-lab-history: 190px;
        --m3-lab-gap: 12px;
        --m3-lab-padding: 12px;
    }
}

/* ── M3 窗口分级：Compact (0–599dp) ── */
@media (max-width: 37.4375rem) {
    :root {
        --m3-window-class: compact;
        --m3-grid-columns: 4;
        --m3-grid-gutter: 16px;
        --m3-grid-margin: 16px;
        --m3-lab-sidebar: 240px;
        --m3-lab-history: 170px;
        --m3-lab-gap: 12px;
        --m3-lab-padding: 12px;
        --navbar-h: 64px;

        /* 历史卡片 Compact 尺寸 */
        --hc-gap: 4px;
        --hc-card-radius: var(--shape-corner-medium);
        --hc-img-radius: var(--shape-corner-small);
        --hc-name-font: 11px;
        --hc-name-weight: 500;
        --hc-name-line: 1.25;
        --hc-status-font: 9px;
        --hc-time-font: 9px;
        --hc-card-px: 6px;
        --hc-card-py: 6px;
        --hc-info-px: 6px;
        --hc-info-pt: 6px;
        --hc-info-pb: 3px;
        --hc-info-gap: 3px;
        --hc-meta-gap: 2px;
    }
}

/* ══════════════════════════════════════
   深色模式 — Material 3 Dark Scheme
   参考：m3.material.io/styles/color/dark-theme
══════════════════════════════════════ */
[data-theme="dark"] {
    /* ── Primary：柔和的蓝色 ── */
    --md-primary:              #a8c7fa;   /* Blue 200 - 主色调更柔和 */
    --md-primary-hover:        #8ab4f8;   /* Blue 300 */
    --md-primary-dim:          #7fb3f5;   /* Blue 300 变体 */
    --md-on-primary:           #062e6f;   /* Blue 900 */
    --md-primary-container:    #0842a0;   /* Blue 700 - 容器色更深 */
    --md-on-primary-container: #d3e3fd;   /* Blue 50 */

    /* ── Secondary：中性灰蓝 ── */
    --md-secondary:              #c4c7c5;   /* Grey 300 */
    --md-secondary-hover:        #d3d5d3;
    --md-secondary-container:    #444746;   /* Grey 700 */
    --md-on-secondary-container: #e0e3e1;   /* Grey 200 */

    /* ── Tertiary：辅助色 ── */
    --md-tertiary:              #7fd4e8;   /* Cyan 300 */
    --md-tertiary-container:    #004d5c;
    --md-on-tertiary-container: #bfe9f1;

    /* ── Surface：分层表面系统 ── */
    /* 最底层 - 背景 */
    --md-surface-dim:           #131416;   /* 最暗的表面 */
    --md-surface:               #1a1b1e;   /* 基础表面色 */
    
    /* 容器层级 - 从低到高 */
    --md-surface-container-lowest: #0e0f11; /* 最低层容器 */
    --md-surface-container-low:    #1c1d20; /* 低层容器 */
    --md-surface-container:        #202124; /* 标准容器 */
    --md-surface-container-high:   #27282b; /* 高层容器 */
    --md-surface-container-highest:#2d2e31; /* 最高层容器 */
    
    /* 特殊表面 */
    --md-surface-variant:       #3c4043;   /* 变体表面 */
    --md-surface-inverse:       #e8eaed;   /* 反转表面 */
    --md-on-surface-inverse:    #202124;

    /* ── On Surface：文本和图标 ── */
    --md-on-surface:            #e3e3e3;   /* 主要文本 - 更亮 */
    --md-on-surface-variant:    #b4b8ba;   /* 次要文本 */
    --md-on-surface-dim:        #8b9093;   /* 禁用文本 */
    
    /* ── Outline：边框和分隔 ── */
    --md-outline:               #616161;   /* 标准边框 */
    --md-outline-variant:       #3d3d3d;   /* 变体边框 */
    --md-outline-dim:           #2d2d2d;   /* 淡边框 */

    /* ── Error：错误状态 ── */
    --md-error:                 #f2b8b5;   /* Red 200 */
    --md-error-hover:           #ef9a9a;
    --md-error-container:       #8b1a1a;
    --md-on-error-container:    #fce8e6;

    /* ── Success：成功状态 ── */
    --md-success:               #a7d3a0;   /* Green 200 */
    --md-success-hover:         #81c995;
    --md-success-container:     #1a4d1a;
    --md-on-success-container:  #e6f4ea;

    /* ── Warning：警告状态 ── */
    --md-warning:               #fdd663;   /* Yellow 300 */
    --md-warning-hover:         #ffeb99;
    --md-warning-container:     #4d3800;
    --md-on-warning-container:  #fef7e0;

    /* ── Info：信息状态 ── */
    --md-info:                  #8ab4f8;   /* Blue 300 */
    --md-info-container:        #0d47a1;
    --md-on-info-container:     #e3f2fd;

    /* ── Google 四色（暗色模式优化）── */
    --google-blue:   #8ab4f8;
    --google-red:    #f28b82;
    --google-yellow: #fdd663;
    --google-green:  #81c995;

    /* ── 特殊效果色 ── */
    --md-scrim:                 rgba(0, 0, 0, 0.32);    /* 遮罩层 */
    --md-scrim-variant:         rgba(0, 0, 0, 0.16);    /* 轻遮罩 */
    --md-shadow:                rgba(0, 0, 0, 0.5);     /* 阴影色 */
    --md-overlay:               rgba(255, 255, 255, 0.08); /* 覆盖层 */

    /* ── Elevation：暗色模式阴影 ── */
    --elevation-0: none;
    --elevation-1: 
        0 1px 2px rgba(0, 0, 0, 0.3), 
        0 1px 3px 1px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    --elevation-2: 
        0 1px 2px rgba(0, 0, 0, 0.3), 
        0 2px 6px 2px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    --elevation-3: 
        0 4px 8px 3px rgba(0, 0, 0, 0.15), 
        0 1px 3px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    --elevation-4: 
        0 6px 10px 4px rgba(0, 0, 0, 0.15), 
        0 2px 3px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    --elevation-5:
        0 8px 12px 6px rgba(0, 0, 0, 0.15),
        0 4px 4px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.05);

    /* ── 渐变效果 ── */
    --gradient-surface: linear-gradient(180deg, 
        var(--md-surface-container-low) 0%, 
        var(--md-surface-container) 100%);
    --gradient-elevated: linear-gradient(180deg, 
        var(--md-surface-container) 0%, 
        var(--md-surface-container-high) 100%);
    --gradient-primary: linear-gradient(135deg, 
        var(--md-primary) 0%, 
        var(--md-primary-hover) 100%);
}

/* ══════════════════════════════════════
   全局基础样式
══════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: var(--font);
    background: var(--md-surface-container);
    color: var(--md-on-surface);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; }

/* 页面切换动画 */
.page {
    position: absolute;
    top: var(--navbar-h);
    left: 0;
    right: 0;
    min-height: calc(100vh - var(--navbar-h));
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s var(--motion-standard), transform 0.3s var(--motion-standard);
    pointer-events: none;
}

.page.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.page.hidden {
    display: none;
}

/* 滚动条 - 全局隐藏 */
::-webkit-scrollbar { width: 0; height: 0; display: none; }
* { scrollbar-width: none; }

/* 工作流选择弹窗滚动条 - 保留 */
.wf-sidebar::-webkit-scrollbar { width: 8px; height: 8px; display: block; }
.wf-sidebar::-webkit-scrollbar-track { background: transparent; }
.wf-sidebar::-webkit-scrollbar-thumb {
    background: var(--md-outline);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: content-box;
}
.wf-sidebar::-webkit-scrollbar-thumb:hover { background: var(--md-on-surface-variant); background-clip: content-box; }
.wf-sidebar { scrollbar-width: thin; }

/* 历史面板列表 — 隐藏滚动条（使用返回顶部按钮替代） */
.history-list {
    scrollbar-width: none !important;
}

/* 加载动画 */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
    width: 20px; height: 20px;
    border: 2.5px solid var(--md-outline);
    border-top-color: var(--md-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* dialogIn */
@keyframes dialogIn { from{opacity:0;transform:scale(0.95)} to{opacity:1;transform:scale(1)} }

/* dialogOut */
@keyframes dialogOut { from{opacity:1;transform:scale(1)} to{opacity:0;transform:scale(0.95)} }

/* overlayIn / overlayOut */
@keyframes overlayIn { from{opacity:0} to{opacity:1} }
@keyframes overlayOut { from{opacity:1} to{opacity:0} }

/* 弹窗入场/出场动画类 */
.modal-enter { animation: overlayIn .2s cubic-bezier(.2,0,0,1) forwards; }
.modal-enter > * { animation: dialogIn .22s cubic-bezier(.2,0,0,1) forwards; }
.modal-leave { animation: overlayOut .15s cubic-bezier(.4,0,1,1) forwards; pointer-events:none; }
.modal-leave > * { animation: dialogOut .15s cubic-bezier(.4,0,1,1) forwards; }

/* pulse */
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* ══════════════════════════════════════
   Material 3 字体样式类
══════════════════════════════════════ */

/* Display - 大标题 */
.text-display-large {
    font-size: var(--font-display-large);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-tight);
    letter-spacing: var(--letter-spacing-tight);
}

.text-display-medium {
    font-size: var(--font-display-medium);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-tight);
    letter-spacing: 0;
}

.text-display-small {
    font-size: var(--font-display-small);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-tight);
    letter-spacing: 0;
}

/* Headline - 标题 */
.text-headline-large {
    font-size: var(--font-headline-large);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-normal);
    letter-spacing: 0;
}

.text-headline-medium {
    font-size: var(--font-headline-medium);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-normal);
    letter-spacing: 0;
}

.text-headline-small {
    font-size: var(--font-headline-small);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-normal);
    letter-spacing: 0;
}

/* Title - 副标题 */
.text-title-large {
    font-size: var(--font-title-large);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-normal);
    letter-spacing: 0;
}

.text-title-medium {
    font-size: var(--font-title-medium);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-normal);
    letter-spacing: 0.15px;
}

.text-title-small {
    font-size: var(--font-title-small);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-normal);
    letter-spacing: 0.1px;
}

/* Body - 正文 */
.text-body-large {
    font-size: var(--font-body-large);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-relaxed);
    letter-spacing: 0.5px;
}

.text-body-medium {
    font-size: var(--font-body-medium);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-relaxed);
    letter-spacing: 0.25px;
}

.text-body-small {
    font-size: var(--font-body-small);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-relaxed);
    letter-spacing: 0.4px;
}

/* Label - 标签 */
.text-label-large {
    font-size: var(--font-label-large);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-normal);
    letter-spacing: 0.1px;
}

.text-label-medium {
    font-size: var(--font-label-medium);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-normal);
    letter-spacing: 0.5px;
}

.text-label-small {
    font-size: var(--font-label-small);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-normal);
    letter-spacing: 0.5px;
}

/* 强调字体样式 */
.text-display-large-emphasized {
    font-size: var(--font-display-large);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-tight);
    letter-spacing: var(--letter-spacing-tight);
}

.text-display-medium-emphasized {
    font-size: var(--font-display-medium);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-tight);
    letter-spacing: 0;
}

.text-display-small-emphasized {
    font-size: var(--font-display-small);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-tight);
    letter-spacing: 0;
}

.text-headline-large-emphasized {
    font-size: var(--font-headline-large);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-normal);
    letter-spacing: 0;
}

.text-headline-medium-emphasized {
    font-size: var(--font-headline-medium);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-normal);
    letter-spacing: 0;
}

.text-headline-small-emphasized {
    font-size: var(--font-headline-small);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-normal);
    letter-spacing: 0;
}

.text-title-large-emphasized {
    font-size: var(--font-title-large);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-normal);
    letter-spacing: 0;
}

.text-title-medium-emphasized {
    font-size: var(--font-title-medium);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-normal);
    letter-spacing: 0.15px;
}

.text-title-small-emphasized {
    font-size: var(--font-title-small);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-normal);
    letter-spacing: 0.1px;
}

.text-body-large-emphasized {
    font-size: var(--font-body-large);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-relaxed);
    letter-spacing: 0.5px;
}

.text-body-medium-emphasized {
    font-size: var(--font-body-medium);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-relaxed);
    letter-spacing: 0.25px;
}

.text-body-small-emphasized {
    font-size: var(--font-body-small);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-relaxed);
    letter-spacing: 0.4px;
}

.text-label-large-emphasized {
    font-size: var(--font-label-large);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-normal);
    letter-spacing: 0.1px;
}

.text-label-medium-emphasized {
    font-size: var(--font-label-medium);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-normal);
    letter-spacing: 0.5px;
}

.text-label-small-emphasized {
    font-size: var(--font-label-small);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-normal);
    letter-spacing: 0.5px;
}

/* ══════════════════════════════════════
   形状交互类
══════════════════════════════════════ */

/* 形状交互 */
.shape-interactive {
    border-radius: var(--shape-interactive-default);
    transition: border-radius 0.3s var(--motion-standard);
}

.shape-interactive:hover {
    border-radius: var(--shape-interactive-hover);
}

.shape-interactive:active {
    border-radius: var(--shape-interactive-active);
}

/* 形状应用类 */
.shape-none { border-radius: var(--shape-corner-none); }
.shape-extra-small { border-radius: var(--shape-corner-extra-small); }
.shape-small { border-radius: var(--shape-corner-small); }
.shape-medium { border-radius: var(--shape-corner-medium); }
.shape-large { border-radius: var(--shape-corner-large); }
.shape-extra-large { border-radius: var(--shape-corner-extra-large); }
.shape-full { border-radius: var(--shape-corner-full); }
.shape-pill { border-radius: var(--shape-pill); }
.shape-stadium { border-radius: var(--shape-stadium); }
.shape-circle { border-radius: var(--shape-circle); }

/* 不对称圆角类 */
.shape-top { border-radius: var(--shape-corner-top); }
.shape-bottom { border-radius: var(--shape-corner-bottom); }
.shape-left { border-radius: var(--shape-corner-left); }
.shape-right { border-radius: var(--shape-corner-right); }

/* 额外形状变体类 */
.shape-extra-small-top { border-radius: var(--shape-corner-extra-small-top); }
.shape-extra-small-bottom { border-radius: var(--shape-corner-extra-small-bottom); }
.shape-small-top { border-radius: var(--shape-corner-small-top); }
.shape-small-bottom { border-radius: var(--shape-corner-small-bottom); }
.shape-medium-top { border-radius: var(--shape-corner-medium-top); }
.shape-medium-bottom { border-radius: var(--shape-corner-medium-bottom); }
.shape-large-top { border-radius: var(--shape-corner-large-top); }
.shape-large-bottom { border-radius: var(--shape-corner-large-bottom); }
.shape-extra-large-top { border-radius: var(--shape-corner-extra-large-top); }
.shape-extra-large-bottom { border-radius: var(--shape-corner-extra-large-bottom); }

/* ========================================
   布局 — Navbar、容器、页面结构
   ======================================== */

/* ── Navbar — Google Material 3 标准 ── */
.navbar {
    height: var(--navbar-h);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 var(--space-md);
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1000;
    border-bottom: 1px solid transparent;
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
}
[data-theme="dark"] .navbar {
    background: rgba(31, 31, 31, 0.92);
}
.navbar.scrolled {
    border-color: var(--md-outline-variant);
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.08);
}

.navbar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-title-large);
    font-weight: 400;
    color: var(--md-on-surface-variant);
    user-select: none;
    transition: color 0.2s cubic-bezier(0.2, 0, 0, 1);
}
.navbar-logo:hover {
    color: var(--md-on-surface);
}

/* 中间 pill 导航 — Navigation Bar */
.navbar-nav {
    display: flex;
    background: var(--md-surface-container);
    padding: var(--space-xs);
    border-radius: var(--shape-corner-full);
    gap: var(--space-xs);
    justify-self: center;
}
.navbar-nav a {
    color: var(--md-on-surface-variant);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--shape-corner-full);
    font-size: var(--font-label-large);
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    white-space: nowrap;
    position: relative;
}
.navbar-nav a:hover {
    background: rgba(26, 115, 232, 0.08);
    color: var(--md-on-surface);
}
.navbar-nav a:active {
    background: rgba(26, 115, 232, 0.12);
}
.navbar-nav a.active {
    background: var(--md-secondary-container);
    color: var(--md-on-primary-container);
}
[data-theme="dark"] .navbar-nav a.active {
    color: var(--md-primary);
}

/* 右侧用户区 */
.navbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    justify-self: end;
}
.balance-chip {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-label-medium);
    font-weight: 500;
    color: var(--md-primary);
    background: var(--md-primary-container);
    padding: var(--space-xs) var(--space-sm) var(--space-xs) 14px;
    border-radius: var(--shape-corner-full);
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
}
.balance-chip:hover {
    background: var(--md-secondary-container);
}
.balance-add-btn {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: var(--md-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    flex-shrink: 0;
}
.balance-add-btn:hover {
    background: var(--md-primary);
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
}
.balance-add-btn:active {
    transform: scale(0.95);
}
.user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
}
.theme-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--md-on-surface-variant);
    transition: var(--transition-fast);
}
.theme-btn:hover { background: var(--md-surface); }

/* ── 容器 — M3 动态栅格 ── */
.container {
    max-width: var(--m3-content-max);
    margin: 0 auto;
    padding: 0 var(--m3-grid-margin);
}
.container-sm { max-width: 800px; margin: 0 auto; padding: 0 var(--m3-grid-margin); }

/* ── 通用网格 ── */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-xl);
}
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: var(--space-xl);
}

/* ── 通告条 ── */
.announcement-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-sm) var(--space-md);
    background: #e8f0fe;
    color: #1a73e8;
    font-size: var(--font-label-medium);
    font-weight: 500;
    gap: var(--space-sm);
    position: sticky;
    top: 56px;
    z-index: 999;
}
.announcement-bar.urgent {
    background: #fce8e6;
    color: #c5221f;
}
.announcement-bar.update {
    background: #e6f4ea;
    color: #137333;
}
[data-theme="dark"] .announcement-bar {
    background: #1a3a5c;
    color: #8ab4f8;
}
[data-theme="dark"] .announcement-bar.urgent {
    background: #4c1c1c;
    color: #f28b82;
}
[data-theme="dark"] .announcement-bar.update {
    background: #1e3a2a;
    color: #81c995;
}
.announcement-content {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}
.announcement-close {
    width: var(--space-lg);
    height: var(--space-lg);
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    opacity: 0.7;
    transition: opacity 0.15s, background 0.15s;
}
.announcement-close:hover {
    opacity: 1;
    background: rgba(0,0,0,0.08);
}

/* ── 用户菜单 ── */
.user-menu {
    position: absolute;
    top: calc(100% + var(--space-sm));
    right: 0;
    min-width: 200px;
    background: #fff;
    border-radius: var(--shape-corner-medium);
    box-shadow: 0 2px 10px rgba(0,0,0,0.12), 0 4px 20px rgba(0,0,0,0.08);
    z-index: 1001;
    padding: var(--space-sm) 0;
    animation: menuFadeIn 0.15s ease-out;
}
[data-theme="dark"] .user-menu {
    background: #292a2d;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3), 0 4px 20px rgba(0,0,0,0.2);
}
@keyframes menuFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.user-menu-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
}
.user-menu-header img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}
.user-menu-info {
    flex: 1;
    min-width: 0;
}
.user-menu-info div {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
[data-theme="dark"] .user-menu-info div:first-child { color: #e8eaed; }
[data-theme="dark"] .user-menu-info div:last-child { color: #9aa0a6; }
.user-menu-divider {
    height: 1px;
    background: #dadce0;
    margin: 4px 0;
}
[data-theme="dark"] .user-menu-divider { background: #5f6368; }
.user-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 10px var(--space-md);
    cursor: pointer;
    transition: background 0.15s;
    color: #202124;
    text-decoration: none;
}
[data-theme="dark"] .user-menu-item { color: #e8eaed; }
.user-menu-item:hover {
    background: #f1f3f4;
}
[data-theme="dark"] .user-menu-item:hover { background: #3c4043; }
.user-menu-item svg {
    flex-shrink: 0;
}

/* ── 通告红点 ── */
.notice-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: #ea4335;
    border-radius: 50%;
    border: 2px solid #fff;
}
[data-theme="dark"] .notice-dot {
    border-color: #292a2d;
}

/* ── 通告卡片 ── */
.notice-card {
    padding: 14px var(--space-md);
    border-radius: var(--shape-corner-medium);
    margin-bottom: 10px;
    background: #f8f9fa;
}
.notice-card:last-child { margin-bottom: 0; }
.notice-card.urgent { background: #fce8e6; }
.notice-card.update { background: #e6f4ea; }
[data-theme="dark"] .notice-card { background: #3c4043; }
[data-theme="dark"] .notice-card.urgent { background: #4c1c1c; }
[data-theme="dark"] .notice-card.update { background: #1e3a2a; }
.notice-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-xs);
}
.notice-card-type {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}
.notice-card-type.info { background: #e8f0fe; color: #1a73e8; }
.notice-card-type.urgent { background: #fce8e6; color: #c5221f; }
.notice-card-type.update { background: #e6f4ea; color: #137333; }
.notice-card-time {
    font-size: 11px;
    color: #5f6368;
}
.notice-card-content {
    font-size: var(--font-body-medium);
    color: #202124;
    line-height: 1.5;
}
[data-theme="dark"] .notice-card-content { color: #e8eaed; }

/* Compact: 隐藏导航、缩小容器 padding — 由 M3 窗口分级控制 */
@media (max-width: 37.4375rem) {
    .navbar-nav { display: none; }
    .container, .container-sm { padding: 0 var(--space-md); }
}

/* ========================================
   组件 — 按钮、输入框、卡片、徽章
   ======================================== */

/* ── 波纹效果 ── */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ── 按钮 — Google Material 3 标准 ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px var(--space-md);
    border-radius: var(--shape-corner-full);
    font-size: var(--font-label-large);
    font-weight: 500;
    font-family: var(--font);
    transition: all 0.2s var(--motion-standard);
    cursor: pointer;
    border: none;
    white-space: nowrap;
    line-height: 1.25;
    position: relative;
    overflow: hidden;
    min-height: 40px;
}

.btn-tonal .ripple, .btn-outlined .ripple, .btn-text .ripple {
    background: rgba(26, 115, 232, 0.2);
}

.btn-danger .ripple {
    background: rgba(217, 48, 37, 0.3);
}

/* Filled Button - 填充按钮 */
.btn-filled {
    background: var(--md-primary);
    color: var(--md-on-primary);
    box-shadow: none;
}
.btn-filled:hover {
    box-shadow: var(--elevation-1);
    background: var(--md-primary);
}
.btn-filled:hover::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.08);
    pointer-events: none;
}
.btn-filled:active {
    box-shadow: none;
}
.btn-filled:active::before {
    background: rgba(255, 255, 255, 0.12);
}
.btn-filled:disabled {
    opacity: 0.38;
    cursor: not-allowed;
    box-shadow: none;
}

/* Tonal Button - 色调按钮 */
.btn-tonal {
    background: var(--md-secondary-container);
    color: var(--md-on-secondary-container, #041e49);
    box-shadow: none;
}
.btn-tonal:hover {
    box-shadow: var(--elevation-1);
}
.btn-tonal:hover::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(26, 115, 232, 0.08);
    pointer-events: none;
}
.btn-tonal:active::before {
    background: rgba(26, 115, 232, 0.12);
}

/* Outlined Button - 描边按钮 */
.btn-outlined {
    background: transparent;
    color: var(--md-primary);
    border: 1px solid var(--md-outline);
}
.btn-outlined:hover {
    background: var(--md-primary-container);
    border-color: var(--md-outline);
}
.btn-outlined:active {
    background: var(--md-primary-container);
}

/* Text Button - 文本按钮 */
.btn-text {
    background: transparent;
    color: var(--md-primary);
    padding: 10px var(--space-sm);
}
.btn-text:hover {
    background: var(--md-primary-container);
}
.btn-text:active {
    background: var(--md-primary-container);
}

/* Danger Button - 危险按钮 */
.btn-danger {
    background: transparent;
    color: var(--md-error);
    border: 1px solid var(--md-error);
}
.btn-danger:hover {
    background: var(--md-error-container);
}
.btn-danger:active {
    background: var(--md-error-container);
}

/* FAB - 悬浮操作按钮 */
.btn-fab {
    width: var(--space-lg);
    height: var(--space-lg);
    padding: 0;
    border-radius: var(--shape-corner-large);
    background: var(--md-primary-container);
    color: var(--md-on-primary-container);
    box-shadow: var(--elevation-3);
}
.btn-fab:hover {
    box-shadow: var(--elevation-4);
}
.btn-fab:active {
    box-shadow: var(--elevation-3);
}

/* 尺寸变体 */
.btn-lg {
    padding: var(--space-md) var(--space-xl);
    font-size: var(--font-body-large);
    min-height: var(--space-lg);
}
.btn-sm {
    padding: var(--space-xs) var(--space-md);
    font-size: var(--font-label-medium);
    min-height: var(--space-lg);
}
.btn-full { width: 100%; }

/* ── 富有表现力的按钮变体 ── */
.btn-expressive {
    padding: 14px var(--space-xl);
    font-size: var(--font-body-large);
    font-weight: 600;
    border-radius: var(--shape-corner-full);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s var(--motion-bounce);
    min-height: var(--space-lg);
}

.btn-expressive:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.btn-expressive:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-expressive-filled {
    background: var(--md-primary);
    color: var(--md-on-primary);
}

.btn-expressive-tonal {
    background: var(--md-primary-container);
    color: var(--md-on-primary-container);
}

/* ── 富有表现力的卡片变体 ── */
.card-expressive {
    border-radius: var(--shape-corner-extra-large);
    padding: var(--space-xl);
    background: linear-gradient(135deg, 
        var(--md-surface-container) 0%, 
        var(--md-surface-container-high) 100%);
    box-shadow: 0 2px 8px rgba(60, 64, 67, 0.1);
    transition: all 0.3s var(--motion-standard);
}

.card-expressive:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(60, 64, 67, 0.15);
}

.card-expressive-elevated {
    background: var(--md-surface-container-high);
    box-shadow: var(--elevation-2);
}

.card-expressive-elevated:hover {
    box-shadow: var(--elevation-3);
}

/* ── 输入框 — Google Material 3 标准 ── */
.input-field {
    width: 100%;
    border: 1px solid var(--md-outline);
    background: var(--md-surface-container);
    padding: var(--space-md);
    border-radius: var(--shape-corner-medium);
    font-family: var(--font);
    font-size: var(--font-body-medium);
    color: var(--md-on-surface);
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    outline: none;
    resize: vertical;
}
.input-field:hover {
    border-color: var(--md-on-surface);
}
.input-field:focus {
    background: var(--md-surface-container);
    border-color: var(--md-primary);
    border-width: 2px;
    padding: 15px;
    box-shadow: none;
}
.input-field::placeholder {
    color: var(--md-on-surface-variant);
}
.input-field:disabled {
    background: var(--md-surface-variant);
    color: var(--md-on-surface-variant);
    border-color: var(--md-outline-variant);
    cursor: not-allowed;
}

/* Outlined TextField 容器 */
.text-field {
    position: relative;
    width: 100%;
}
.text-field-label {
    position: absolute;
    left: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    font-size: var(--font-body-medium);
    color: var(--md-on-surface-variant);
    background: var(--md-surface-container);
    padding: 0 var(--space-xs);
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    pointer-events: none;
}
.text-field input:focus + .text-field-label,
.text-field input:not(:placeholder-shown) + .text-field-label {
    top: 0;
    font-size: var(--font-body-small);
    color: var(--md-primary);
}

/* Prompt 输入框 */
.prompt-input-wrap {
    position: relative;
}

.prompt-use-btn {
    position: absolute;
    bottom: var(--space-sm);
    right: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-body-small);
    font-weight: 500;
    color: var(--md-primary);
    background: var(--md-surface-container);
    border: 1px solid var(--md-outline);
    border-radius: var(--shape-corner-full);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    z-index: 1;
}

.prompt-use-btn:hover {
    background: var(--md-primary-container);
    border-color: var(--md-primary);
}

.prompt-use-btn.hidden {
    display: none;
}

.input-field.has-preview {
    background: var(--md-primary-container);
    border-color: var(--md-primary);
    border-style: dashed;
}

[data-theme="dark"] .input-field.has-preview {
    background: rgba(26, 115, 232, 0.15);
}

.input-label {
    display: block;
    font-size: var(--font-body-small);
    font-weight: 500;
    color: var(--md-on-surface-variant);
    margin-bottom: var(--space-sm);
    letter-spacing: 0.01em;
}

/* 错误状态输入框 */
.input-field.error {
    border-color: var(--md-error);
}
.input-field.error:focus {
    border-color: var(--md-error);
}
.input-field.error + .input-error-text {
    color: var(--md-error);
    font-size: var(--font-body-small);
    margin-top: var(--space-xs);
}

/* ── 卡片 — Google Material 3 标准 ── */
.card {
    background: var(--md-surface-container);
    border-radius: var(--shape-corner-large);
    padding: var(--space-md);
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    border: 1px solid var(--md-outline-variant);
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(60, 64, 67, 0.08), 0 4px 12px rgba(60, 64, 67, 0.06);
}
[data-theme="dark"] .card:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.card-elevated {
    background: var(--md-surface-container);
    border-radius: var(--shape-corner-large);
    padding: var(--space-md);
    box-shadow: var(--elevation-1);
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    border: none;
}
.card-elevated:hover {
    box-shadow: var(--elevation-2);
    transform: translateY(-2px);
}

.card-outlined {
    background: var(--md-surface-container);
    border-radius: var(--shape-corner-large);
    padding: var(--space-md);
    border: 1px solid var(--md-outline);
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
}
.card-outlined:hover {
    border-color: var(--md-on-surface-variant);
}

.card-white {
    background: var(--md-surface-container);
    border: 1px solid var(--md-outline-variant);
    border-radius: var(--shape-corner-large);
    overflow: hidden;
}

/* ── 徽章 — Google Material 3 标准 ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--shape-corner-extra-small);
    font-size: var(--font-label-small);
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.badge-blue {
    background: var(--md-primary-container);
    color: var(--md-on-primary-container);
}
.badge-update {
    font-size: 12px;
    padding: 3px 10px;
    background: var(--md-primary);
    color: var(--md-on-primary);
    border-radius: 100px;
    font-weight: 500;
    line-height: 1.4;
}
.badge-green {
    background: var(--md-success-container);
    color: var(--md-success);
}
.badge-yellow {
    background: var(--md-warning-container);
    color: var(--md-warning);
}
.badge-red {
    background: var(--md-error-container);
    color: var(--md-error);
}

/* 大徽章 */
.badge-lg {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-body-small);
    border-radius: var(--shape-corner-small);
}

/* ── 分割线 ── */
.divider { height: 1px; background: var(--md-surface); margin: 0; }

/* ── 加载动画（@keyframes spin + .spinner 已在 tokens.css 定义） ── */

/* ── Google 四色旋转加载器 ── */
@keyframes google-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes google-pulse {
    0% { transform: scale(0.9); opacity: 0.7; }
    100% { transform: scale(1.1); opacity: 1; }
}

@keyframes google-arc-dash {
    0%, 100% { stroke-dasharray: 55, 100; stroke-dashoffset: 0; }
    50% { stroke-dasharray: 20, 100; stroke-dashoffset: -10; }
}

.google-loader {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.google-loader svg {
    width: 48px;
    height: 48px;
}

.google-loader.spin-group {
    transform-origin: center;
    animation: google-spin 1.5s linear infinite;
}

.google-loader .pulse-star {
    transform-origin: center;
    animation: google-pulse 1.5s ease-in-out infinite alternate;
}

.google-loader .arc {
    animation: google-arc-dash 1.5s ease-in-out infinite;
}

/* 大尺寸加载器 */
.google-loader-lg svg {
    width: 64px;
    height: 64px;
}

/* 小尺寸加载器 */
.google-loader-sm svg {
    width: 32px;
    height: 32px;
}

/* 超小尺寸加载器 */
.google-loader-xs svg {
    width: 20px;
    height: 20px;
}

/* 状态图标中的加载器 */
.status-icon.google-loader {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    margin-right: 4px;
}

/* 画布加载状态 */
.canvas-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    gap: 16px;
    color: var(--md-on-surface-variant);
}

/* ── 列表项交错渐入 ── */
@keyframes listItemFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.list-animate {
    animation: listItemFadeIn 0.35s var(--motion-standard) forwards;
}

/* ── 滚动触发渐入 ── */
@keyframes scrollFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.scroll-animate {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s var(--motion-standard), transform 0.6s var(--motion-standard);
}

.scroll-animate.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ── 骨架屏加载 ── */
@keyframes skeleton-loading {
    0% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0 50%;
    }
}

.skeleton {
    background: linear-gradient(90deg, var(--md-outline-variant) 25%, var(--md-outline) 50%, var(--md-outline-variant) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--shape-corner-small);
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-text:last-child {
    margin-bottom: 0;
}

.skeleton-title {
    height: 20px;
    margin-bottom: 12px;
    border-radius: 4px;
    width: 70%;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-card {
    padding: var(--space-md);
    border-radius: var(--shape-corner-large);
    background: var(--md-surface-container);
    border: 1px solid var(--md-outline-variant);
}

.canvas-loading p {
    font-size: var(--font-body-medium);
    color: #5f6368;
    margin: 0;
}

.canvas-loading .pending-title {
    font-size: var(--font-body-large);
    font-weight: 500;
    color: var(--md-on-surface);
    margin-top: var(--space-sm);
}

.canvas-loading .pending-timer {
    font-size: 24px;
    font-weight: 400;
    color: var(--md-primary);
    font-family: var(--font-mono, 'Roboto Mono', monospace);
    letter-spacing: 0.05em;
}

.canvas-loading .pending-status {
    font-size: var(--font-label-medium);
    color: var(--md-on-surface-variant);
    padding: var(--space-xs) var(--space-sm);
    background: var(--md-surface-container);
    border-radius: var(--shape-corner-full);
}

/* ── Toast — Google Material 3 ── */
.toast-container {
    position: fixed;
    bottom: var(--space-md);
    left: 0;
    right: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    align-items: center;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: #323232;
    color: #fff;
    padding: 14px 20px;
    border-radius: var(--shape-corner-medium);
    font-size: var(--font-body-medium);
    font-weight: 400;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    animation: toastIn 0.3s var(--motion-bounce);
    pointer-events: auto;
    max-width: 90vw;
    transform-origin: center bottom;
}

.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-msg {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toast-success {
    background: #1e8e3e;
}

.toast-success .toast-icon {
    color: #a8dab5;
}

.toast-error {
    background: #d93025;
}

.toast-error .toast-icon {
    color: #f8d7da;
}

.toast-info {
    background: #323232;
}

.toast-info .toast-icon {
    color: #8ab4f8;
}

.toast-out {
    animation: toastOut 0.25s var(--motion-standard) forwards;
}

@keyframes toastIn {
    from { 
        opacity: 0; 
        transform: translateY(20px) scale(0.9); 
    } 
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
}

@keyframes toastOut {
    from { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    } 
    to { 
        opacity: 0; 
        transform: translateY(-10px) scale(0.95); 
    }
}

[data-theme="dark"] .toast {
    background: #e8eaed;
    color: #202124;
}

[data-theme="dark"] .toast-success {
    background: #1e8e3e;
    color: #fff;
}

[data-theme="dark"] .toast-error {
    background: #d93025;
    color: #fff;
}

/* ========================================
   工具类 — 显示隐藏 / 动画过渡
   从 JS 内联 style.xxx 提取而来
   ======================================== */

/* ── 显示/隐藏 ── */
.hidden { display: none !important; }

/* ── 入场动画（从下方滑入） ── */
@keyframes animSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.anim-slide-in {
    animation: animSlideIn 0.3s cubic-bezier(0.2, 0, 0, 1) forwards;
}

/* ── 入场动画（从下方缩放滑入 — 用于菜单/卡片） ── */
@keyframes animScaleIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.anim-scale-in {
    animation: animScaleIn 0.3s cubic-bezier(0.2, 0, 0, 1) forwards;
}

/* ── 退场动画（向右滑出） ── */
@keyframes animSlideOutRight {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(16px); }
}
.anim-slide-out-right {
    animation: animSlideOutRight 0.2s ease forwards;
}

/* ── 淡入 ── */
@keyframes animFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.anim-fade-in {
    animation: animFadeIn 0.25s ease forwards;
}

/* ── 列表项交错渐入（带 delay 工具类） ── */
.anim-stagger-item {
    opacity: 0;
    transform: translateY(8px);
    animation: animSlideIn 0.3s cubic-bezier(0.2, 0, 0, 1) forwards;
}
.anim-stagger-item:nth-child(1)  { animation-delay: 0ms; }
.anim-stagger-item:nth-child(2)  { animation-delay: 30ms; }
.anim-stagger-item:nth-child(3)  { animation-delay: 60ms; }
.anim-stagger-item:nth-child(4)  { animation-delay: 90ms; }
.anim-stagger-item:nth-child(5)  { animation-delay: 120ms; }
.anim-stagger-item:nth-child(6)  { animation-delay: 150ms; }

/* ── 占位符/容器淡入过渡（配合 JS requestAnimationFrame） ── */
.fade-placeholder {
    opacity: 0;
    transition: opacity 0.25s ease;
}
.fade-placeholder.visible {
    opacity: 1;
}

/* ── 缩略图加载过渡 ── */
.thumb-loading {
    opacity: 0;
    transition: opacity 0.2s ease;
}
.thumb-loading.loaded {
    opacity: 1;
}

/* ── 上传进度条填充 ── */
.upload-progress-fill {
    height: 100%;
    background: var(--md-primary);
    border-radius: inherit;
    transition: width 0.3s ease;
}

/* ── 历史加载指示器 ── */
.history-load-more {
    text-align: center;
    padding: 10px;
    color: var(--md-on-surface-variant);
    font-size: 12px;
}

/* ── 历史滚动哨兵 ── */
.history-scroll-sentinel {
    height: 1px;
    width: 100%;
}

/* ── 额外上传槽位 ── */
.dropzone-extra {
    margin-top: 8px;
    position: relative;
}

/* ── 移除按钮（上传槽位内） ── */
.dz-remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
[data-theme="dark"] .dz-remove-btn {
    background: rgba(255, 255, 255, 0.1);
}

/* ── 悬停效果（替代 onmouseover/onmouseout 内联样式） ── */
.hover-lift {
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.hover-lift:hover {
    box-shadow: 0 4px 16px rgba(60, 64, 67, 0.2);
    transform: translateY(-2px);
}
[data-theme="dark"] .hover-lift:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.hover-lift-sm {
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.hover-lift-sm:hover {
    box-shadow: 0 4px 12px rgba(60, 64, 67, 0.2);
    transform: translateY(-2px);
}
[data-theme="dark"] .hover-lift-sm:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.hover-bg {
    transition: background 0.15s ease;
}
.hover-bg:hover {
    background: var(--md-surface);
}

/* ── 点赞按钮状态 ── */
.like-btn-liked {
    color: #f59e0b;
    border-color: #f59e0b;
    background: #fef3c7;
}
[data-theme="dark"] .like-btn-liked {
    background: rgba(245, 158, 11, 0.15);
}

/* ── 作品网格 ── */
.works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    width: 100%;
}

/* ── 刷新按钮旋转 ── */
@keyframes spinOnce {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
.refresh-spin svg {
    animation: spinOnce 0.4s ease;
}

/* ── Community 遮罩层 ── */
.community-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(32, 33, 36, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.community-overlay.visible {
    display: flex;
}

/* ── 懒加载提示 ── */
.lazy-loading-hint {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    color: var(--md-on-surface-variant);
    z-index: 10;
}

/* ── 更新弹窗遮罩 ── */
.update-modal-inline {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(32, 33, 36, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

/* ── 公告栏 ── */
.announcement-bar { display: none; }
.announcement-bar.visible { display: flex; }

/* ── 用户菜单 ── */
.user-menu { display: none; }
.user-menu.visible { display: block; }

/* ── 文本色工具类 ── */
.text-primary { color: var(--md-primary); }
.text-error { color: var(--md-error); }
.text-success { color: var(--md-success, #1e8e3e); }

/* ========================================
   页面专属样式
   ======================================== */

/* ══ 探索页 Hero (Google 标准风格) ══ */
.hero-section {
    min-height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px var(--space-3xl);
    text-align: center;
    background: var(--md-surface-container);
}

.hero-content {
    max-width: 640px;
    margin: 0 auto;
}

.hero-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) 14px;
    background: #e8f0fe;
    border-radius: var(--shape-corner-full);
    font-size: 12px;
    font-weight: 500;
    color: #1a73e8;
    margin-bottom: var(--space-lg);
}

.hero-tag-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #1a73e8;
}

.hero-title {
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 400;
    color: #202124;
    margin: 0 0 var(--space-lg);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: clamp(15px, 1.6vw, 17px);
    color: #5f6368;
    line-height: 1.6;
    margin: 0 0 40px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

.hero-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-btn {
    padding: 12px 28px;
    border-radius: var(--shape-corner-full);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.hero-btn-primary {
    background: #1a73e8;
    color: #fff;
}

.hero-btn-primary:hover {
    background: #1557b0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.hero-btn-secondary {
    background: var(--md-surface-container);
    color: var(--md-primary);
    border: 1px solid var(--md-outline);
}

.hero-btn-secondary:hover {
    background: var(--md-surface-container-low);
    border-color: var(--md-primary);
}

/* 暗色模式适配 — 由 [data-theme="dark"] 控制，不使用系统偏好 */

/* 旧版 Hero 样式（保留兼容） */
.hero {
    padding: clamp(60px, 10vh, 100px) 24px clamp(48px, 8vh, 80px);
    text-align: center;
    background: radial-gradient(circle at 50% 0%, #e8f0fe 0%, transparent 70%);
}
.hero-sub {
    color: var(--md-on-surface-variant);
    font-size: clamp(15px, 2vw, 18px);
    margin-bottom: 32px;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

/* 统计卡片 */
.stat-card {
    background: var(--md-surface);
    border-radius: var(--shape-corner-extra-large);
    padding: 32px;
    transition: var(--transition);
}
.stat-card:hover { transform: translateY(-4px); background: var(--md-surface-container-high); }
.stat-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--md-on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}
.stat-value {
    font-size: 44px;
    font-weight: 400;
    color: var(--md-on-surface);
    line-height: 1;
    margin-bottom: 8px;
}
.stat-value small { font-size: 16px; }
.stat-note { font-size: 13px; }

/* 作品卡片 */
.work-card {
    background: var(--md-surface-container);
    border: 1px solid var(--md-outline-variant);
    border-radius: var(--shape-corner-large);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
}
.work-card:hover { box-shadow: var(--elevation-3); transform: translateY(-3px); border-color: transparent; }
.work-thumb {
    aspect-ratio: 4/3;
    background: var(--md-surface);
    overflow: hidden;
    position: relative;
}
.work-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.work-card:hover .work-thumb img { transform: scale(1.04); }
.work-thumb-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.5rem;
    background: linear-gradient(135deg, #e8f0fe, #d3e3fd);
}
.work-info { padding: var(--space-lg); }
.work-title { font-size: 14px; font-weight: 500; color: var(--md-on-surface); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.work-meta { font-size: 12px; color: var(--md-on-surface-variant); display: flex; align-items: center; gap: 8px; }
.work-author { display: flex; align-items: center; gap: 4px; }
.work-avatar { width: 16px; height: 16px; border-radius: 50%; background: var(--md-primary-container); display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; color: var(--md-primary); flex-shrink: 0; }
.work-likes { margin-left: auto; display: flex; align-items: center; gap: 3px; }

/* ── Footer 四列布局 ── */
.studio-footer{background:var(--md-surface-container-low);border-top:1px solid var(--md-outline-variant);margin-top:0}
.sf-main{display:flex;gap:48px;max-width:1200px;margin:0 auto;padding:40px 24px}
.sf-brand{flex:1.2;min-width:200px}
.sf-logo{display:flex;align-items:center;gap:10px;margin-bottom:12px}
.sf-logo-text{font-size:18px;font-weight:600;color:var(--md-on-surface)}
.sf-desc{font-size:14px;color:var(--md-on-surface-variant);line-height:1.6;margin:0;max-width:280px}
.sf-links{display:flex;gap:56px;flex:1}
.sf-col h4{font-size:13px;font-weight:500;color:var(--md-on-surface);margin:0 0 14px;letter-spacing:.02em}
.sf-col a{display:block;font-size:13px;color:var(--md-on-surface-variant);text-decoration:none;padding:5px 0;transition:color .15s}
.sf-col a:hover{color:var(--md-primary)}
.sf-bottom{border-top:1px solid var(--md-outline-variant);padding:16px 24px;max-width:1200px;margin:0 auto;display:flex;justify-content:space-between;font-size:12px;color:var(--md-on-surface-variant)}
@media(max-width:768px){.sf-main{flex-direction:column;gap:32px;padding:32px 20px}.sf-links{gap:32px;flex-wrap:wrap}.sf-bottom{flex-direction:column;gap:6px;text-align:center}}

/* 排行榜 */
.rank-card {
    background: var(--md-surface-container);
    border: 1px solid var(--md-outline-variant);
    border-radius: var(--shape-corner-large);
    overflow: hidden;
}
.rank-header {
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--md-surface);
    display: flex; align-items: center; justify-content: space-between;
}
.rank-header-title { font-size: 14px; font-weight: 500; }
.rank-row {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 20px;
    transition: background 0.15s;
    cursor: default;
}
.rank-row:hover { background: var(--md-surface); }
.rank-no { font-size: 13px; font-weight: 700; color: var(--md-on-surface-variant); width: 20px; text-align: center; flex-shrink: 0; }
.rank-no.gold { color: #f9ab00; }
.rank-no.silver { color: #9aa0a6; }
.rank-no.bronze { color: #c77b30; }
.rank-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--md-primary-container); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; color: var(--md-primary); flex-shrink: 0; }
.rank-info { flex: 1; min-width: 0; }
.rank-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-sub { font-size: 11px; color: var(--md-on-surface-variant); }
.rank-likes { font-size: 12px; color: var(--md-on-surface-variant); flex-shrink: 0; }

/* ══ 实验室页 (Create/Workspace) ══ */
/* Material 3 动态栅格：所有窗口分级统一三栏布局 */
/* 栅格变量来自 tokens.css --m3-lab-* */

.create-layout {
    display: grid;
    /* 三栏：参数面板 | 画布 | 历史面板 */
    grid-template-columns: var(--m3-lab-sidebar) 1fr var(--m3-lab-history);
    grid-template-areas: "params canvas history";
    gap: var(--m3-lab-gap);
    padding: var(--m3-lab-padding);
    height: calc(100vh - var(--navbar-h));
    background: var(--md-surface);
}

.panel {
    background: var(--md-surface-container);
    border-radius: var(--shape-corner-extra-large);
    padding: 16px;
    overflow-y: auto;
}
.side-panel { display: flex; flex-direction: column; gap: 0; min-height: 0; }
.main-canvas {
    border-radius: var(--shape-corner-extra-large);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--md-surface-container);
    position: relative;
    overflow: hidden;
    padding: 0;
}
.history-panel {
    display: flex !important;
    flex-direction: column;
    flex-shrink: 0;
    width: var(--m3-lab-history);
    height: 100%;
    padding: 16px;
    background: var(--md-surface-container);
    border-radius: var(--shape-corner-extra-large);
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
}

.panel-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--md-on-surface);
    letter-spacing: 0;
    flex-shrink: 0;
    padding: 0 4px 8px;
    line-height: 1.3;
}
.panel-section { margin-bottom: var(--space-md); }

/* 工作流选择器 — Google Material 3 标准 */
.workflow-select {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px;
    background: var(--md-surface-container);
    border-radius: var(--shape-corner-medium);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    border: 1px solid var(--md-outline);
    font-family: var(--font);
    font-size: 13px;
    color: var(--md-on-surface);
}
.workflow-select:hover {
    background: var(--md-surface-container-high);
    border-color: var(--md-on-surface);
}
.workflow-select:active {
    background: var(--md-surface-container-high);
}
.workflow-select.selected {
    border-color: var(--md-primary);
    background: var(--md-primary-container);
}

.wf-placeholder {
    color: var(--md-on-surface-variant);
    font-size: 13px;
}

.wf-selected-name {
    font-size: 13px;
    color: var(--md-on-surface);
    font-weight: 500;
}

/* 上传区 — Google Material 3 标准 */
.dropzone {
    border: 2px dashed var(--md-outline);
    border-radius: var(--shape-corner-medium);
    padding: 24px 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    color: var(--md-on-surface-variant);
    font-size: 13px;
    background: var(--md-surface-container);
}
.dropzone:hover {
    border-color: var(--md-primary);
    background: var(--md-primary-container);
    color: var(--md-primary);
}
.dropzone.dragover {
    border-color: var(--md-primary);
    background: var(--md-primary-container);
    border-style: solid;
}

/* 画布占位 */
.canvas-placeholder {
    text-align: center;
    color: var(--md-outline-variant);
}
.canvas-placeholder svg { margin-bottom: 16px; }
.canvas-placeholder p { font-size: 14px; color: var(--md-on-surface-variant); }

/* 结果图 */
.canvas-result { width: 100%; height: 100%; object-fit: contain; display: block; }

/* 画布结果切换过渡动画 */
@keyframes canvasFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.canvas-fade-in { animation: canvasFadeIn 0.3s ease-out; }

/* 工具栏 */
.canvas-toolbar {
    position: absolute;
    top: var(--space-md); right: var(--space-md);
    display: flex; gap: var(--space-sm);
}
.toolbar-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    display: flex; align-items: center; justify-content: center;
    color: var(--md-on-surface-variant);
    box-shadow: var(--elevation-1);
    transition: var(--transition-fast);
    cursor: pointer;
}
.toolbar-btn:hover { background: var(--md-surface-container); box-shadow: var(--elevation-2); color: var(--md-primary); }


/* ══ 历史记录 — Material 3 卡片列表 ══ */
/* 竖向卡片：Google Material 3 风格 — 圆角卡片 + 柔和阴影 + Chip状态标签 */

:root {
    --hc-gap: 6px;
    --hc-card-radius: var(--shape-corner-large);
    --hc-img-radius: var(--shape-corner-medium);
    --hc-name-font: 12px;
    --hc-name-weight: 500;
    --hc-name-line: 1.3;
    --hc-status-font: 10px;
    --hc-time-font: 10px;
    --hc-menu-size: 24px;
    --hc-card-px: 8px;
    --hc-card-py: 8px;
    --hc-info-px: 8px;
    --hc-info-pt: 8px;
    --hc-info-pb: 4px;
    --hc-info-gap: 4px;
    --hc-meta-gap: 4px;
}

/* ── 列表容器（隐藏滚动条） ── */
.history-list {
    display: block; overflow-y: auto; overflow-x: hidden;
    flex: 1 1 0%; min-height: 0;
    padding: 2px;
    scrollbar-width: none !important; -ms-overflow-style: none;
}
.history-list::-webkit-scrollbar { display: none !important; }

/* ── 返回顶部按钮 ── */
.scroll-top-btn {
    position: absolute; bottom: 12px; right: 12px;
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--md-primary); color: #fff;
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--elevation-2);
    opacity: 0; visibility: hidden;
    transform: scale(0.8) translateY(8px);
    transition: opacity .2s ease, transform .25s cubic-bezier(.2,0,0,1), visibility 0s .2s;
    z-index: 10;
}
.scroll-top-btn.visible { opacity: 1; visibility: visible; transform: scale(1) translateY(0); transition: opacity .2s ease, transform .3s cubic-bezier(.34,1.56,.64,1); }
.scroll-top-btn:hover { background: var(--md-primary-hover); box-shadow: var(--elevation-3); transform: scale(1.08) translateY(0) !important; }
.scroll-top-btn:active { transform: scale(.95) !important; }
.scroll-top-btn svg { width: 16px; height: 16px; }

/* ── 加载更多指示器（.history-load-more 已在 components.css 定义） ── */

/* ══════════════════════════════
   卡片主体 — Google M3 Filled Card
   浅蓝灰底色 + 大圆角 + 无阴影/边框
   ══════════════════════════════ */
.history-item {
    background: var(--md-surface-container-low);
    border-radius: var(--hc-card-radius);
    overflow: visible; cursor: pointer;
    transition: background-color .2s ease;
    position: relative; display: flex; flex-direction: column;
    gap: 0; padding: var(--hc-card-py) var(--hc-card-px);
    margin-bottom: var(--hc-gap);
    border: none;
    box-shadow: none;
}
[data-theme="dark"] .history-item {
    background: var(--md-surface-container-low);
}

/* 悬浮 — 浅色加深，暗色变亮 */
.history-item:hover {
    background: var(--md-surface-container-high);
}
[data-theme="dark"] .history-item:hover {
    background: var(--md-surface-container);
}

/* 按下 */
.history-item:active {
    background: var(--md-surface-container-high);
}
[data-theme="dark"] .history-item:active {
    background: var(--md-surface-container-high);
}

/* 键盘焦点 */
.history-item:focus-visible {
    outline: 2px solid var(--md-primary);
    outline-offset: 1px;
}

/* 选中 */
.history-item.active,
.history-item.selected {
    background: var(--md-primary-container);
}
.history-item.active:hover,
.history-item.selected:hover {
    background: #c6dffa;
}
[data-theme="dark"] .history-item.active,
[data-theme="dark"] .history-item.selected {
    background: rgba(138,180,248,.15);
}
[data-theme="dark"] .history-item.active:hover,
[data-theme="dark"] .history-item.selected:hover {
    background: rgba(138,180,248,.22);
}

/* ── 缩略图区域 — 内部圆角容器 ── */
.history-item > img {
    width: 100%; aspect-ratio: 16/9; object-fit: cover;
    border-radius: var(--hc-img-radius);
    flex-shrink: 0; display: block;
}
.history-item > .history-thumb-wrap {
    width: 100%; aspect-ratio: 16/9; flex-shrink: 0;
    position: relative; overflow: hidden;
    border-radius: var(--hc-img-radius);
    display: flex; align-items: center; justify-content: center;
    background: var(--md-surface-container-high);
}
[data-theme="dark"] .history-item > .history-thumb-wrap {
    background: var(--md-surface-container-high);
}
.history-item > .history-thumb-wrap > img { width: 100%; height: 100%; object-fit: cover; display: block; position: absolute; inset: 0; }

.history-thumb-video {
    width: 100%; height: 100%;
    border-radius: var(--hc-img-radius);
    background: var(--md-surface-container-low);
    display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.history-thumb-play {
    position: absolute; bottom: 6px; right: 6px;
    width: 28px; height: 28px; border-radius: 50%;
    background: rgba(0,0,0,.55);
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px); transition: transform .15s;
}
.history-item:hover .history-thumb-play { transform: scale(1.06); }
.history-thumb-play svg { width: 14px; height: 14px; }

.history-thumb-loading {
    display: inline-block; width: 22px; height: 22px;
    border: 2.5px solid var(--md-outline-variant);
    border-top-color: var(--md-primary);
    border-radius: 50%;
    animation: thumb-spin .8s linear infinite;
}
@keyframes thumb-spin { to { transform: rotate(360deg); } }

.history-item-placeholder {
    width: 100%; aspect-ratio: 16/9;
    background: var(--md-surface-container-high);
    border-radius: var(--hc-img-radius);
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
[data-theme="dark"] .history-item-placeholder {
    background: linear-gradient(135deg, var(--md-surface-container), var(--md-surface-container-high));
}
.history-item-placeholder svg { width: 28px; height: 28px; opacity: .30; }
.history-item-placeholder .google-loader-xs svg { width: 22px; height: 22px; opacity: 1; }
.history-item > .history-thumb-wrap > svg { width: 28px; height: 28px; opacity: .30; flex-shrink: 0; }
.history-item-placeholder-text { background: linear-gradient(135deg, #f0f4fa, #e8edf5); }
.history-item-placeholder-error { background: rgba(217,48,37,.06); color: var(--md-error); }
.history-item-placeholder-error svg { opacity: .50; }
.history-item-error { opacity: .88; }
.history-item-error:hover { background: rgba(217,48,37,.03); }

/* 多图角标 */
.history-thumb-badge {
    position: absolute; top: 5px; left: 5px;
    min-width: 18px; height: 18px; border-radius: 9px;
    background: rgba(0,0,0,.55); color: #fff;
    font-size: 10px; font-weight: 600; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    padding: 0 4px; z-index: 2;
}

/* ══════════════════════════════
   信息区 — 2×2 网格排版
   功能名称        日期
   状态            运行时间
   ══════════════════════════════ */
.history-item .history-info {
    flex-shrink: 0; min-width: 0; overflow: hidden;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 2px 8px;
    padding: var(--hc-info-pt) var(--hc-info-px) var(--hc-info-pb);
    align-items: center;
}

/* 功能名称 — 左上 */
.history-item .history-name {
    font-size: var(--hc-name-font);
    font-weight: var(--hc-name-weight);
    color: #1f1f1f;
    line-height: var(--hc-name-line);
    white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; min-width: 0;
    letter-spacing: 0.01em;
    margin: 0;
    grid-column: 1; grid-row: 1;
}
[data-theme="dark"] .history-item .history-name { color: var(--md-on-surface); }

/* 日期 — 右上 */
.history-item .history-time {
    font-size: var(--hc-time-font);
    color: var(--md-on-surface-variant);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    line-height: 1.3;
    grid-column: 2; grid-row: 1;
    text-align: right;
}
[data-theme="dark"] .history-item .history-time { color: var(--md-on-surface-variant); }

/* 状态 — 左下 */
.history-item .history-status {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 0; border-radius: 0;
    font-size: var(--hc-status-font); font-weight: 600; line-height: 1.35;
    white-space: nowrap;
    flex-shrink: 0;
    grid-column: 1; grid-row: 2;
    justify-content: flex-start;
}

/* 运行时长 — 右下 */
.history-item .history-duration {
    font-size: var(--hc-time-font);
    color: var(--md-on-surface-variant);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    line-height: 1.3;
    grid-column: 2; grid-row: 2;
    text-align: right;
}
[data-theme="dark"] .history-item .history-duration { color: var(--md-on-surface-variant); }

/* ══════════════════════════════
   状态 Chip 颜色 — M3 Assist Chip
   ══════════════════════════════ */

/* 已完成 — Google Green */
.history-item .history-status.done { background: none; color: var(--md-success); }
/* 运行中 — Google Blue */
.history-item .history-status.running { background: none; color: var(--md-primary); }
/* 失败 — Google Red */
.history-item .history-status.error { background: none; color: var(--md-error); }
/* 排队/待处理 — Google Grey */
.history-item .history-status.pending { background: none; color: var(--md-on-surface-variant); }
/* 过期 — 浅灰 */
.history-item .history-status.expired { background: none; color: var(--md-on-surface-dim); }

/* 暗色模式 */
[data-theme="dark"] .history-item .history-status.done { background: none; color: var(--md-success); }
[data-theme="dark"] .history-item .history-status.running { background: none; color: var(--md-primary); }
[data-theme="dark"] .history-item .history-status.error { background: none; color: var(--md-error); }
[data-theme="dark"] .history-item .history-status.pending { background: none; color: var(--md-on-surface-variant); }
[data-theme="dark"] .history-item .history-status.expired { background: none; color: var(--md-on-surface-dim); }

/* Chip 内耗时文字 */
.status-time { font-variant-numeric: tabular-nums; margin-left: 2px; opacity: .70; flex-shrink: 0; white-space: nowrap; }
.done .status-time { opacity: 1; }

/* 状态图标 */
.history-item .status-icon {
    width: 14px; height: 14px;
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.history-item .status-icon svg { width: 14px !important; height: 14px !important; }
.history-item .status-icon.queued-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.history-item .status-icon-lightning { animation: lightning-pulse 1.5s ease-in-out infinite; }
@keyframes lightning-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(.92); }
}

/* ── 菜单按钮 — 浮于缩略图上 ── */
.history-menu-btn {
    width: var(--hc-menu-size);
    height: var(--hc-menu-size);
    min-width: var(--hc-menu-size);
    max-width: var(--hc-menu-size);
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.45);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s ease, background 0.15s ease, transform 0.15s ease;
    flex-shrink: 0;
    visibility: visible !important;
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    opacity: 0;
    backdrop-filter: blur(6px);
}

.history-item:hover .history-menu-btn { opacity: 1; }
.history-menu-btn:hover { background: rgba(0,0,0,0.65); transform: scale(1.05); }
.history-menu-btn:active { background: rgba(0,0,0,0.75); transform: scale(0.95); }
.history-menu-btn svg { width: 14px; height: 14px; }

/* ── 菜单弹出层 ── */
.history-menu {
    position: absolute;
    right: 14px;
    top: 40px;
    background: var(--md-surface-container);
    border-radius: var(--shape-corner-medium);
    box-shadow: 0 6px 20px rgba(60,64,67,.22), 0 2px 8px rgba(60,64,67,.12);
    min-width: 150px;
    padding: 6px 0;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.94) translateY(-6px);
    transform-origin: top left;
    transition: all 0.18s cubic-bezier(0.2, 0, 0, 1);
}
.history-item.menu-open { z-index: 100; }
.history-menu.show {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
}

.history-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    font-size: 13px;
    color: var(--md-on-surface);
    cursor: pointer;
    transition: background 0.12s ease;
}
.history-menu-item:hover { background: rgba(26,115,232,.06); }
.history-menu-item svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--md-on-surface-variant); }
.history-menu-item-danger { color: #d93025; }
.history-menu-item-danger svg { color: #d93025; }
.history-menu-item-danger:hover { background: rgba(217,48,37,.06); }
.history-menu-divider { height: 1px; background: var(--md-outline-variant); margin: 4px 0; }

/* ── 过期状态 ── */
:root { --expired-opacity: 0.45; }
[data-theme="dark"] { --expired-opacity: 0.55; }
.history-item.history-item-expired { opacity: var(--expired-opacity); cursor: default; }
.history-item.history-item-expired:hover { background: var(--md-surface-container-low); box-shadow: none; }
[data-theme="dark"] .history-item.history-item-expired:hover { background: var(--md-surface-container-low); }
.history-item-expired .history-item-placeholder { background: var(--md-surface-container-high); }

/* ── 空状态 ── */
.history-empty {
    padding: 40px 16px;
    text-align: center;
    color: var(--md-on-surface-variant);
    font-size: 13px;
}

/* ── 响应式：极窄面板 ── */
@media (max-width: 220px) {
    :root {
        --hc-card-radius: var(--shape-corner-medium);
        --hc-img-radius: var(--shape-corner-small);
        --hc-gap: 4px;
        --hc-name-font: 11px;
        --hc-time-font: 9px;
        --hc-status-font: 9px;
        --hc-card-px: 6px;
        --hc-card-py: 6px;
        --hc-info-px: 6px;
        --hc-info-pt: 6px;
        --hc-info-pb: 3px;
        --hc-info-gap: 3px;
        --hc-meta-gap: 2px;
    }
    .history-menu-btn { display: none; }
    .history-thumb-play { width: 28px; height: 28px; }
    .history-thumb-play svg { width: 12px; height: 12px; }
    .history-thumb-badge { min-width: 18px; height: 18px; font-size: 10px; }
}

/* ── 状态通用样式 ── */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-running { background: var(--md-primary); animation: pulse 1.5s ease-in-out infinite; }
.status-done { background: var(--md-success); }
.status-error { background: var(--md-error); }
/* @keyframes pulse 已在 tokens.css 定义 */

/* ══ 账户页 ══ */
.account-hero {
    text-align: center;
    padding: var(--space-lg) 0 var(--space-md);
}
.account-avatar {
    width: var(--space-lg); height: var(--space-lg);
    border-radius: 50%;
    margin: 0 auto var(--space-sm);
    display: block;
}
.account-name { font-size: var(--font-title-large); font-weight: 500; margin-bottom: var(--space-xs); }
.account-email { font-size: var(--font-label-medium); color: var(--md-on-surface-variant); }

.account-section-label {
    font-size: var(--font-body-small);
    font-weight: 700;
    color: var(--md-on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 var(--space-sm) var(--space-md);
}
.account-card {
    background: var(--md-surface-container);
    border: 1px solid var(--md-outline-variant);
    border-radius: var(--shape-corner-large);
    overflow: hidden;
    margin-bottom: 24px;
}
.account-row {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--md-surface);
    cursor: pointer;
    transition: background 0.15s;
    gap: 12px;
}
.account-row:last-child { border-bottom: none; }
.account-row:hover { background: var(--md-surface); }
.row-icon { color: var(--md-on-surface-variant); flex-shrink: 0; }
.row-label { width: 160px; font-size: 14px; color: var(--md-on-surface); flex-shrink: 0; }
.row-value { flex: 1; font-size: 14px; color: var(--md-on-surface-variant); }
.row-arrow { color: var(--md-on-surface-variant); margin-left: auto; flex-shrink: 0; }

@media (max-width: 600px) {
    .account-row { flex-direction: column; align-items: flex-start; gap: 4px; }
    .row-label { width: 100%; font-weight: 600; }
    .row-arrow { display: none; }
}

/* ══ 弹层 — Google Material 3 标准 ══ */
.overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: 
        opacity 300ms linear,
        visibility 300ms;
}
.overlay:not(.hidden) {
    opacity: 1;
    visibility: visible;
}
.overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.dialog {
    background: var(--md-surface-container);
    border-radius: var(--shape-corner-extra-large);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 
        0 8px 12px 6px rgba(60, 64, 67, 0.15),
        0 4px 4px rgba(60, 64, 67, 0.3);
    opacity: 0;
    transform: scale(0.9) translateY(10px);
    transition: 
        opacity 400ms cubic-bezier(0.05, 0.7, 0.1, 1),
        transform 400ms cubic-bezier(0.05, 0.7, 0.1, 1);
}
.overlay:not(.hidden) .dialog {
    opacity: 1;
    transform: scale(1) translateY(0);
}
.overlay.hidden .dialog {
    opacity: 0;
    transform: scale(1) translateY(0);
    transition-duration: 200ms;
    transition-timing-function: cubic-bezier(0.4, 0, 1, 1);
}

.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--md-outline-variant);
}
.dialog-title {
    font-size: var(--font-body-large);
    font-weight: 500;
}
.dialog-close {
    width: var(--space-lg);
    height: var(--space-lg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--md-on-surface-variant);
    transition: var(--transition-fast);
    cursor: pointer;
}
.dialog-close:hover {
    background: var(--md-surface);
}
.dialog-body {
    padding: 20px var(--space-lg);
}

/* ══════════════════════════════════════
   探索页 — Google 扁平风格
══════════════════════════════════════ */

/* Hero */
.cp-hero {
    background: linear-gradient(180deg, #e8f0fe 0%, #f8f9fa 100%);
    border-bottom: 1px solid var(--md-outline-variant);
    padding: clamp(40px, 8vh, 72px) var(--space-md) 0;
    text-align: center;
}
.cp-hero-inner { max-width: 600px; margin: 0 auto; padding-bottom: var(--space-xl); }
.cp-hero-title {
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 400;
    color: var(--md-on-surface);
    margin-bottom: var(--space-sm);
    letter-spacing: -0.5px;
    line-height: 1.2;
}
.cp-hero-sub {
    font-size: 15px;
    color: var(--md-on-surface-variant);
    margin-bottom: var(--space-lg);
    line-height: 1.6;
}
.cp-hero-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) 28px;
    background: var(--md-primary);
    color: #fff;
    border: none;
    border-radius: var(--shape-corner-full);
    font-family: var(--font);
    font-size: var(--font-label-large);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}
.cp-hero-btn:hover { background: var(--md-primary-hover); }

/* 统计行 */
.cp-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    background: #fff;
    border-top: 1px solid var(--md-outline-variant);
    padding: 16px 24px;
}
.cp-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 32px;
}
.cp-stat-val {
    font-size: 22px;
    font-weight: 400;
    color: var(--md-on-surface);
    line-height: 1;
    margin-bottom: 4px;
}
.cp-stat-val small { font-size: 14px; }
.cp-stat-label {
    font-size: 11px;
    color: var(--md-on-surface-variant);
    letter-spacing: 0.02em;
}
.cp-stat-divider {
    width: 1px;
    height: 32px;
    background: var(--md-outline-variant);
}

/* Chip 筛选条 */
.cp-chips-bar {
    background: #fff;
    border-bottom: 1px solid var(--md-outline-variant);
    padding: 0 24px;
    position: sticky;
    top: var(--navbar-h);
    z-index: 50;
}
.cp-chips {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 8px;
    padding: 10px 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.cp-chips::-webkit-scrollbar { display: none; }
.cp-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 16px;
    border-radius: var(--shape-corner-full);
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--md-outline-variant);
    background: #fff;
    color: var(--md-on-surface);
    cursor: pointer;
    white-space: nowrap;
    font-family: var(--font);
    transition: var(--transition-fast);
    flex-shrink: 0;
}
.cp-chip:hover { background: var(--md-surface); }
.cp-chip.active {
    background: var(--md-primary-container);
    border-color: var(--md-primary-container);
    color: var(--md-primary);
}

/* 主体布局 */
.cp-body {
    max-width: var(--m3-content-max);
    margin: 0 auto;
    padding: var(--space-lg) var(--space-md) var(--space-3xl);
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: var(--space-lg);
    align-items: start;
}

/* 作品区 */
.cp-feed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.cp-feed-title {
    font-size: var(--font-label-large);
    font-weight: 500;
    color: var(--md-on-surface);
}
.cp-text-btn {
    font-size: var(--font-label-medium);
    color: var(--md-primary);
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--shape-corner-small);
    transition: var(--transition-fast);
}
.cp-text-btn:hover { background: var(--md-primary-container); }

/* 作品网格 */
.cp-works-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--md-outline-variant);
    border: 1px solid var(--md-outline-variant);
    border-radius: var(--shape-corner-large);
    overflow: hidden;
}
.cp-work-card {
    background: #fff;
    cursor: pointer;
    transition: background var(--transition-fast);
}
.cp-work-card:hover { background: var(--md-surface); }
.cp-work-thumb {
    aspect-ratio: 4/3;
    overflow: hidden;
    background: var(--md-surface);
    position: relative;
}
.cp-work-thumb img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    transition: transform 0.3s;
}
.cp-work-card:hover .cp-work-thumb img { transform: scale(1.03); }
.cp-work-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem;
    background: linear-gradient(135deg, #e8f0fe, #d3e3fd);
}
.cp-work-info { padding: 10px var(--space-sm); }
.cp-work-title {
    font-size: var(--font-label-medium); font-weight: 500;
    color: var(--md-on-surface);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-bottom: 3px;
}
.cp-work-meta {
    font-size: var(--font-label-small); color: var(--md-on-surface-variant);
    display: flex; align-items: center; gap: 6px;
}
.cp-work-author-dot {
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--md-primary-container);
    display: flex; align-items: center; justify-content: center;
    font-size: 8px; font-weight: 700; color: var(--md-primary);
    flex-shrink: 0;
}
.cp-work-likes { margin-left: auto; }

/* 加载行 */
.cp-loading-row {
    grid-column: 1 / -1;
    display: flex; align-items: center; justify-content: center;
    gap: 10px; padding: var(--space-lg);
    color: var(--md-on-surface-variant); font-size: var(--font-label-medium);
    background: #fff;
}

/* 侧边栏 */
.cp-sidebar { display: flex; flex-direction: column; gap: var(--space-md); }

.cp-widget {
    background: var(--md-surface-container);
    border: 1px solid var(--md-outline-variant);
    border-radius: var(--shape-corner-large);
    overflow: hidden;
}
.cp-widget-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--md-outline-variant);
}
.cp-widget-title { font-size: 13px; font-weight: 500; color: var(--md-on-surface); }
.cp-badge-green {
    font-size: 10px; font-weight: 600;
    padding: 2px 8px; border-radius: var(--shape-corner-full);
    background: #e6f4ea; color: #1e8e3e;
}

/* 排行榜行 */
.cp-rank-row {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 16px;
    transition: background var(--transition-fast);
}
.cp-rank-row:hover { background: var(--md-surface); }
.cp-rank-no {
    font-size: 12px; font-weight: 700;
    color: var(--md-on-surface-variant);
    width: 18px; text-align: center; flex-shrink: 0;
}
.cp-rank-no.gold   { color: #f9ab00; }
.cp-rank-no.silver { color: #9aa0a6; }
.cp-rank-no.bronze { color: #c77b30; }
.cp-rank-av {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--md-primary-container);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; color: var(--md-primary);
    flex-shrink: 0;
}
.cp-rank-info { flex: 1; min-width: 0; }
.cp-rank-name { font-size: 13px; font-weight: 500; color: var(--md-on-surface); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-rank-sub  { font-size: 11px; color: var(--md-on-surface-variant); }
.cp-rank-likes { font-size: 11px; color: var(--md-on-surface-variant); flex-shrink: 0; }

/* 挑战 */
.cp-challenge { padding: 12px 16px; }
.cp-challenge-name { font-size: 13px; font-weight: 500; color: var(--md-on-surface); margin-bottom: 4px; }
.cp-challenge-desc { font-size: 12px; color: var(--md-on-surface-variant); line-height: 1.5; margin-bottom: 10px; }
.cp-challenge-foot { display: flex; align-items: center; justify-content: space-between; }
.cp-challenge-reward { font-size: 12px; font-weight: 500; color: var(--md-primary); }
.cp-divider { height: 1px; background: var(--md-outline-variant); }

.cp-tonal-btn {
    padding: 5px 14px; border-radius: var(--shape-corner-full);
    background: var(--md-primary-container); color: var(--md-primary);
    border: none; font-family: var(--font); font-size: 12px; font-weight: 500;
    cursor: pointer; transition: var(--transition-fast);
}
.cp-tonal-btn:hover { filter: brightness(0.95); }
.cp-outline-btn {
    padding: 5px 14px; border-radius: var(--shape-corner-full);
    background: transparent; color: var(--md-primary);
    border: 1px solid var(--md-outline-variant);
    font-family: var(--font); font-size: 12px; font-weight: 500;
    cursor: pointer; transition: var(--transition-fast);
}
.cp-outline-btn:hover { background: var(--md-primary-container); border-color: var(--md-primary-container); }

/* 响应式 */
@media (max-width: 960px) {
    .cp-body { grid-template-columns: 1fr; }
    .cp-sidebar { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
}
@media (max-width: 640px) {
    .cp-works-grid { grid-template-columns: repeat(2, 1fr); }
    .cp-stats { gap: 0; }
    .cp-stat { padding: 0 16px; }
    .cp-body { padding: 16px 16px 48px; }
    .cp-chips-bar { padding: 0 16px; }
    .cp-hero { padding: clamp(32px, 6vh, 48px) 16px 0; }
    .cp-sidebar { grid-template-columns: 1fr; }
}

/* 深色模式 — 已统一迁移至 dark-mode.css，此处保留空注释占位 */

/* ══════════════════════════════════════
   工作流选择弹窗 — Google Material 3
   断点规范: 480 / 720 / 1024 / 1440px
   8dp 网格系统 | auto-fill 自适应布局
══════════════════════════════════════ */

.wf-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(32, 33, 36, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: wfFadeIn 0.25s cubic-bezier(0.2, 0, 0, 1);
}

.wf-modal-overlay.hidden { display: none; }

.wf-modal-overlay.is-closing {
    animation: wfFadeOut 0.2s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes wfFadeIn { 
    from { opacity: 0; } 
    to { opacity: 1; } 
}

@keyframes wfFadeOut { 
    from { opacity: 1; } 
    to { opacity: 0; } 
}

@keyframes wfSlideUp {
    from { opacity: 0; transform: translateY(24px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.wf-modal {
    background: var(--md-surface-container);
    border-radius: var(--shape-corner-extra-large);
    width: min(92vw, 1120px);
    height: min(88vh, 720px);
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(60, 64, 67, 0.24), 0 2px 8px rgba(60, 64, 67, 0.16);
    display: flex;
    flex-direction: column;
    animation: wfSlideUp 0.35s cubic-bezier(0.2, 0, 0, 1);
}

.is-closing .wf-modal {
    animation: wfSlideDown 0.2s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes wfSlideDown {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(16px) scale(0.98); }
}

.wf-modal-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    flex-shrink: 0;
}

.wf-modal-title {
    font-size: 22px;
    font-weight: 500;
    color: var(--md-on-surface);
    margin: 0;
    letter-spacing: -0.01em;
    flex-shrink: 0;
}

.wf-close-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--md-on-surface-variant);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}

.wf-close-btn:hover {
    background: var(--md-surface);
}

.wf-search {
    width: 200px;
    padding: 8px 14px 8px 36px;
    border: 1px solid var(--md-outline-variant);
    border-radius: var(--shape-corner-full);
    font-family: var(--font);
    font-size: 13px;
    color: var(--md-on-surface);
    background: var(--md-surface);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s, width 0.25s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235f6368' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 10px center;
    flex-shrink: 0;
    margin-left: auto;
}

.wf-search:focus {
    border-color: var(--md-primary);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
    background-color: #fff;
    width: 260px;
}

.wf-search::placeholder { color: var(--md-on-surface-variant); }

.wf-modal-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    border-top: 1px solid var(--md-outline-variant);
}

.wf-sidebar {
    width: 200px;
    flex-shrink: 0;
    border-right: 1px solid var(--md-outline-variant);
    padding: 12px 8px;
    overflow-y: auto;
    background: var(--md-surface-container-low);
}

.wf-cat-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--md-on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 12px 12px 8px;
}

.wf-cat-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wf-cat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--md-on-surface-variant);
    cursor: pointer;
    border-radius: var(--shape-corner-full);
    margin: 2px 4px;
    transition: background 0.2s cubic-bezier(0.2, 0, 0, 1), color 0.2s, transform 0.15s;
}

.wf-cat-item:hover {
    background: var(--md-secondary-container);
    color: var(--md-on-secondary-container);
    transform: translateX(2px);
}

.wf-cat-item.active {
    background: var(--md-secondary-container);
    color: var(--md-on-secondary-container);
    font-weight: 600;
}

.wf-cat-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.wf-main {
    flex: 1;
    padding: 16px 24px 24px;
    overflow-y: auto;
}

/* M3 auto-fill 自适应网格 — 卡片最小 220px，自动填充列数 */
.wf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.wf-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: 12px;
    min-height: 92px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--shape-corner-large);
    cursor: pointer;
    overflow: hidden;
    position: relative;
    transition: background 0.2s cubic-bezier(0.2, 0, 0, 1), color 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.wf-card:hover {
    background: var(--md-secondary-container);
    border-color: transparent;
    transform: translateX(2px);
}

.wf-card:active {
    background: var(--md-secondary-container);
    transform: translateX(1px);
}

.wf-card.active {
    background: var(--md-secondary-container);
    border-color: transparent;
}

.wf-card.active .wf-card-name {
    font-weight: 600;
}

.wf-card-thumb {
    width: 68px;
    height: 68px;
    flex-shrink: 0;
    aspect-ratio: auto;
    overflow: hidden;
    background: var(--md-surface-container);
    position: relative;
    border-radius: var(--shape-corner-medium);
    border: 1px solid var(--md-outline-variant);
}

.wf-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wf-thumb-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--md-on-surface-variant);
    opacity: 0.5;
}

.wf-card-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 0;
    min-height: 68px;
    justify-content: center;
    padding: 0;
}

.wf-card-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--md-on-surface);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
    line-height: 1.28;
}

.wf-card-cost {
    font-size: 12px;
    font-weight: 500;
    color: var(--md-primary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1.2;
}

.wf-card-cost svg {
    flex-shrink: 0;
}

.wf-card-desc {
    font-size: 11px;
    color: var(--md-on-surface-variant);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── M3 响应式断点 ── */

/* 平板竖屏 / 小桌面 (≤1024px) */
@media (max-width: 1024px) {
    .wf-modal {
        width: min(94vw, 960px);
        height: min(85vh, 680px);
    }
    .wf-sidebar { width: 180px; }
    .wf-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

/* 平板竖屏 / 大手机 (≤720px) */
@media (max-width: 720px) {
    .wf-modal {
        width: min(96vw, 100%);
        height: 92vh;
        border-radius: var(--shape-corner-large);
    }
    .wf-modal-header { padding: 16px 20px; }
    .wf-modal-title { font-size: 20px; }
    .wf-search { width: 140px; }
    .wf-search:focus { width: 180px; }
    .wf-modal-body { flex-direction: column; }
    .wf-sidebar { 
        width: 100%; 
        border-right: none; 
        border-bottom: 1px solid var(--md-outline-variant);
        padding: 8px;
        overflow-x: auto;
        overflow-y: hidden;
        max-height: 52px;
    }
    .wf-cat-list {
        flex-direction: row;
        gap: 4px;
        padding-bottom: 8px;
    }
    .wf-cat-item {
        white-space: nowrap;
        margin: 0;
        padding: 8px 14px;
        font-size: 13px;
    }
    .wf-cat-item:hover { transform: none; }
    .wf-card:hover { transform: none; }
    .wf-main { padding: 12px 16px 16px; }
    .wf-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
    .wf-card { border-radius: var(--shape-corner-medium); }
    .wf-card-thumb { width: 56px; height: 56px; }
    .wf-card-info { min-height: 56px; }
    .wf-card-name { font-size: 13px; }
}

/* 手机 (≤480px) */
@media (max-width: 480px) {
    .wf-modal-overlay { padding: 8px; }
    .wf-modal {
        width: 100%;
        height: 95vh;
        border-radius: var(--shape-corner-large);
    }
    .wf-modal-header { padding: 14px 16px; }
    .wf-modal-title { font-size: 18px; }
    .wf-search { width: 100px; padding: 6px 10px 6px 30px; font-size: 12px; background-size: 12px; background-position: 8px center; }
    .wf-search:focus { width: 140px; }
    .wf-main { padding: 10px 12px 12px; }
    .wf-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .wf-card { 
        flex-direction: column; 
        align-items: stretch;
        gap: 8px; 
        padding: 8px;
        min-height: auto;
    }
    .wf-card:hover { transform: none; }
    .wf-card-thumb { width: 100%; height: 0; aspect-ratio: 16/9; }
    .wf-card-info { min-height: auto; gap: 4px; padding: 4px 4px 0; }
    .wf-card-desc { -webkit-line-clamp: 1; }
}

.wf-selected-cost {
    font-size: 12px;
    color: var(--md-on-surface-variant);
    margin-left: auto;
}

/* 上传区域增强 */
.dropzone.has-file {
    border-style: solid;
    border-color: var(--md-primary);
    padding: 8px;
}

.dropzone.has-file .dz-content {
    display: none;
}

.dz-content p {
    margin: 0;
}

.dz-preview {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 10px;
    min-height: 72px;
}

/* 左侧：图一/图二/音频 标签 */
.dz-preview-label {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    padding: 8px 12px;
    background: var(--md-primary-container);
    border-radius: var(--shape-corner-small);
    font-size: 12px;
    font-weight: 500;
    color: var(--md-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    flex-shrink: 0;
}

/* 右侧：预览图/图标（自适应撑满） */
.dz-preview-media {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 56px;
    overflow: hidden;
    border-radius: var(--shape-corner-small);
}

.dz-preview img {
    width: 100%;
    height: auto;
    max-height: 140px;
    object-fit: contain;
    border-radius: var(--shape-corner-small);
}

/* 视频/音频的图标占位 — 在 .dz-preview-media 内居中 */
.dz-preview-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--md-surface-container);
    border-radius: var(--shape-corner-small);
    color: var(--md-primary);
    flex-shrink: 0;
}

/* 音频/视频文件名覆盖层 */
.dz-preview-name {
    position: absolute;
    bottom: 4px;
    left: 4px; right: 4px;
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-radius: 100px;
    z-index: 2;
}

/* 删除按钮 — 始终可见，hover时高亮 */
.dz-remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    border: 1.5px solid rgba(255, 255, 255, 0.7);
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: all 0.2s ease;
    z-index: 10;
}

.dz-preview:hover .dz-remove-btn {
    opacity: 1;
}

.dz-remove-btn:hover {
    background: var(--md-error, #b3261e);
    border-color: transparent;
    opacity: 1;
}

/* 参数面板 */
.params-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.params-row {
    display: flex;
    gap: 12px;
}

.param-cell {
    flex: 1;
    min-width: 0;
    display: flex !important;
    flex-direction: column !important;
}

.param-cell-full {
    flex: none;
    width: 100%;
    display: flex !important;
    flex-direction: column !important;
}

.param-group {
    margin-bottom: 8px;
    display: flex !important;
    flex-direction: column !important;
}

.param-group:last-child {
    margin-bottom: 0;
}

.param-group .input-label {
    order: -1 !important;
    margin-bottom: 4px !important;
    font-size: 12px;
}

.param-group .input-field {
    order: 1 !important;
    padding: 8px 12px;
    font-size: 13px;
}

.param-group .input-field:focus {
    padding: 7px 11px;
}

/* 模型选择框 — 与工作流选择框尺寸一致 */
#modelContainer .input-field {
    padding: 10px 14px;
}

#modelContainer .input-field:focus {
    padding: 9px 13px;
}

.param-select {
    cursor: pointer;
}

.param-textarea {
    resize: vertical;
    min-height: 60px;
}

.param-desc {
    font-size: 11px;
    color: var(--md-on-surface-variant);
    margin-top: 4px;
}

/* 按钮消耗显示 */
.btn-cost {
    font-size: 12px;
    opacity: 0.8;
    margin-left: 4px;
}

/* 画布加载状态（.canvas-loading 已在 components.css 定义） */

.canvas-run-timer {
    font-variant-numeric: tabular-nums;
    color: var(--md-primary);
    font-weight: 500;
    margin-left: 4px;
}

.canvas-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.canvas-error p {
    margin: 0;
}

/* 画布运行中状态 */
.canvas-pending {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--md-on-surface-variant);
}

.pending-glow-wrap {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pending-glow-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid transparent;
}

.pending-glow-ring-1 {
    width: 80px;
    height: 80px;
    border-color: var(--md-primary);
    opacity: 0.2;
    animation: pending-pulse 2s ease-out infinite;
}

.pending-glow-ring-2 {
    width: 60px;
    height: 60px;
    border-color: var(--md-primary);
    opacity: 0.4;
    animation: pending-pulse 2s ease-out infinite 0.3s;
}

.pending-glow-ring-3 {
    width: 40px;
    height: 40px;
    border-color: var(--md-primary);
    opacity: 0.6;
    animation: pending-pulse 2s ease-out infinite 0.6s;
}

.pending-glow-core {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--md-primary);
}

.spin-anim {
    animation: spin 2s linear infinite;
}

/* @keyframes pending-pulse 仅用于此处 */
@keyframes pending-pulse {
    0% { transform: scale(0.8); opacity: 0.8; }
    100% { transform: scale(1.2); opacity: 0; }
}

/* @keyframes spin 已在 tokens.css 定义 */

.pending-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--md-on-surface);
    text-align: center;
}

.pending-timer {
    font-size: 32px;
    font-weight: 300;
    color: var(--md-primary);
    font-variant-numeric: tabular-nums;
}

.pending-status {
    font-size: 13px;
    color: var(--md-on-surface-variant);
}

/* ══ 纯文本结果展示 ══ */
.canvas-text-result {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 680px;
    max-height: 100%;
    background: var(--md-surface);
    border-radius: var(--shape-corner-large);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.1);
}
.canvas-text-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--md-outline-variant);
    font-size: 14px;
    font-weight: 500;
    color: var(--md-on-surface);
}
.canvas-text-header svg { color: var(--md-primary); flex-shrink: 0; }
.canvas-text-body {
    flex: 1;
    padding: 16px 20px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 14px;
    line-height: 1.7;
    color: var(--md-on-surface);
    max-height: 50vh;
    font-family: inherit;
}
.canvas-text-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--md-outline-variant);
}

/* ══ 音频结果展示 ══ */
.canvas-audio-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 40px;
}

/* ══ 多图画廊 ══ */
.canvas-gallery {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}
.gallery-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    overflow: hidden;
}
.gallery-thumbs {
    display: flex;
    gap: 6px;
    padding: 10px 0 2px;
    justify-content: center;
    flex-shrink: 0;
    overflow-x: auto;
}
.gallery-thumb {
    width: 52px;
    height: 52px;
    border-radius: var(--shape-corner-small);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s, transform 0.15s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--md-surface-container);
}
.gallery-thumb:hover {
    border-color: var(--md-primary);
    transform: scale(1.05);
}
.gallery-thumb.active {
    border-color: var(--md-primary);
    box-shadow: 0 0 0 1px var(--md-primary);
}
.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.gallery-thumb svg {
    color: var(--md-on-surface-variant);
    opacity: 0.6;
}
.gallery-thumb.active svg {
    color: var(--md-primary);
    opacity: 1;
}

/* ══ 历史卡片多图角标（保留，与新卡片配合） ══ */
.history-thumb-wrap {
    position: relative;
    flex-shrink: 0;
}

/* 响应式规则已移至 responsive.css */

/* ── 上传进度条（.upload-progress-fill 已在 components.css 定义） ── */

/* ========================================
   Modal 组件样式 — 从 index.html 内联样式提取
   覆盖：遮罩层 / 关闭按钮 / 表单输入 / 按钮 / 错误提示
   ======================================== */

/* ── 遮罩层（5处重复） ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 8000;
    background: rgba(32,33,36,0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    padding: 16px;
}

/* ── 遮罩层 - 更新版（z-index:9000, 更强模糊） ── */
.modal-overlay-prominent {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(32,33,36,0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    padding: 16px;
}

/* ── 弹窗卡片 ── */
.modal-card {
    background: var(--md-surface-container);
    border-radius: 28px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 24px rgba(60,64,67,.3);
    position: relative;
}

.modal-card-wide {
    max-width: 480px;
}

/* ── 弹窗头部 ── */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--md-outline-variant);
}

.modal-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--md-on-surface);
    margin: 0;
}

/* ── 关闭按钮（4处重复） ── */
.modal-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5f6368;
    z-index: 1;
    transition: background 0.15s;
}

.modal-close-btn:hover {
    background: #f1f3f4;
}

/* 暗色模式适配 */
[data-theme="dark"] .modal-close-btn:hover {
    background: var(--md-surface);
}

/* 弹窗内部关闭按钮（absolute 定位） */
.modal-close-btn-abs {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5f6368;
    z-index: 1;
    transition: background 0.15s;
}

.modal-close-btn-abs:hover {
    background: #f1f3f4;
}

[data-theme="dark"] .modal-close-btn-abs:hover {
    background: var(--md-surface);
}

/* ── 弹窗 body ── */
.modal-body {
    padding: 20px;
}

.modal-body-lg {
    padding: 28px 32px;
}

/* ── 表单输入框（8处重复） ── */
.modal-input {
    width: 100%;
    padding: 13px 16px;
    border: 1px solid #dadce0;
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    color: #202124;
    background: #fff;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

.modal-input:focus {
    border-color: var(--md-primary);
    box-shadow: 0 0 0 2px rgba(26,115,232,0.18);
}

[data-theme="dark"] .modal-input {
    border-color: var(--md-outline-variant);
    color: var(--md-on-surface);
    background: var(--md-surface);
}

[data-theme="dark"] .modal-input:focus {
    border-color: var(--md-primary);
}

/* 验证码输入框 */
.modal-input-code {
    width: 100%;
    padding: 13px 16px;
    border: 1px solid #dadce0;
    border-radius: 12px;
    font-family: inherit;
    font-size: 18px;
    text-align: center;
    letter-spacing: 6px;
    color: #202124;
    background: #fff;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

.modal-input-code:focus {
    border-color: var(--md-primary);
    box-shadow: 0 0 0 2px rgba(26,115,232,0.18);
}

[data-theme="dark"] .modal-input-code {
    border-color: var(--md-outline-variant);
    color: var(--md-on-surface);
    background: var(--md-surface);
}

/* ── 主要按钮（3处重复） ── */
.modal-btn-primary {
    width: 100%;
    padding: 13px;
    background: var(--md-primary);
    color: var(--md-on-primary);
    border: none;
    border-radius: 100px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

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

.modal-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 中等尺寸按钮 */
.modal-btn-primary-md {
    width: 100%;
    padding: 12px;
    background: var(--md-primary);
    color: var(--md-on-primary);
    border: none;
    border-radius: 100px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

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

/* 行内按钮 */
.modal-btn-primary-inline {
    padding: 10px 24px;
    background: var(--md-primary);
    color: var(--md-on-primary);
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.modal-btn-primary-inline:hover {
    background: var(--md-primary-hover);
}

/* ── 次要按钮 ── */
.modal-btn-secondary {
    flex: 1;
    padding: 12px;
    border: 1px solid #dadce0;
    border-radius: 100px;
    background: #fff;
    color: #5f6368;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.modal-btn-secondary:hover {
    background: #f8f9fa;
}

[data-theme="dark"] .modal-btn-secondary {
    border-color: var(--md-outline-variant);
    background: var(--md-surface);
    color: var(--md-on-surface-variant);
}

[data-theme="dark"] .modal-btn-secondary:hover {
    background: var(--md-surface-container);
}

/* ── 文字按钮/链接（4处重复） ── */
.modal-link {
    color: var(--md-primary);
    cursor: pointer;
}

/* ── 错误提示（4处重复） ── */
.modal-error {
    color: #d93025;
    font-size: 12px;
    min-height: 16px;
    margin-bottom: 10px;
}

.modal-error-sm {
    color: #d93025;
    font-size: 12px;
    min-height: 0;
    margin-bottom: 6px;
}

[data-theme="dark"] .modal-error,
[data-theme="dark"] .modal-error-sm {
    color: #f28b82;
}

/* ── 标签（4处重复） ── */
.modal-label {
    font-size: 12px;
    font-weight: 500;
    color: #5f6368;
    display: block;
    margin-bottom: 6px;
}

[data-theme="dark"] .modal-label {
    color: var(--md-on-surface-variant);
}

/* ── 面板标题 ── */
.modal-panel-title {
    font-size: 22px;
    font-weight: 400;
    color: #202124;
    text-align: center;
    margin: 12px 0 6px;
}

[data-theme="dark"] .modal-panel-title {
    color: var(--md-on-surface);
}

.modal-panel-subtitle {
    font-size: 13px;
    color: #5f6368;
    text-align: center;
    margin: 0 0 20px;
}

[data-theme="dark"] .modal-panel-subtitle {
    color: var(--md-on-surface-variant);
}

/* ── Tab 切换 ── */
.modal-tab-bar {
    display: flex;
    background: #f1f3f4;
    border-radius: 100px;
    padding: 3px;
    gap: 2px;
    margin-bottom: 18px;
}

[data-theme="dark"] .modal-tab-bar {
    background: var(--md-surface-container);
}

.modal-tab-btn {
    flex: 1;
    padding: 7px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.modal-tab-btn-active {
    background: #fff;
    color: #202124;
    box-shadow: 0 1px 3px rgba(60,64,67,.2);
}

.modal-tab-btn-inactive {
    background: none;
    color: #5f6368;
}

[data-theme="dark"] .modal-tab-btn-active {
    background: var(--md-surface);
    color: var(--md-on-surface);
}

[data-theme="dark"] .modal-tab-btn-inactive {
    color: var(--md-on-surface-variant);
}

/* ── 弹窗图标容器（2处重复） ── */
.modal-icon-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #e8f0fe;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

[data-theme="dark"] .modal-icon-circle {
    background: rgba(26,115,232,0.15);
}

/* ── 弹窗图标容器 - 大号（更新弹窗） ── */
.modal-icon-circle-lg {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

/* ── 步骤圆圈（找回密码） ── */
.modal-step-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #dadce0;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    transition: background 0.3s;
}

.modal-step-circle-active {
    background: var(--md-primary);
}

.modal-step-circle-done {
    background: #1e8e3e;
}

[data-theme="dark"] .modal-step-circle-done {
    background: #81c995;
}

/* ── 步骤条分隔线 ── */
.modal-step-line {
    width: 28px;
    height: 1px;
    background: #dadce0;
    margin: 0 4px;
}

/* ── 密码强度条 ── */
.modal-pwd-bar {
    height: 2px;
    border-radius: 1px;
    background: #dadce0;
    margin-bottom: 12px;
    transition: all 0.3s;
    width: 0;
}

.modal-pwd-bar-weak {
    background: #d93025;
}

.modal-pwd-bar-medium {
    background: #f9ab00;
}

.modal-pwd-bar-strong {
    background: #1e8e3e;
}

[data-theme="dark"] .modal-pwd-bar-weak {
    background: #f28b82;
}

[data-theme="dark"] .modal-pwd-bar-medium {
    background: #fdd663;
}

[data-theme="dark"] .modal-pwd-bar-strong {
    background: #81c995;
}

/* ── 提示框（微信绑定） ── */
.modal-info-box {
    background: #e8f0fe;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 12px;
    color: #5f6368;
    margin-bottom: 14px;
    line-height: 1.5;
}

[data-theme="dark"] .modal-info-box {
    background: rgba(26,115,232,0.1);
    color: var(--md-on-surface-variant);
}

/* ── 二维码图片 ── */
.modal-qr-img {
    width: 140px;
    height: 140px;
    border-radius: 12px;
    border: 1px solid #dadce0;
    display: block;
    margin: 0 auto 10px;
}

.modal-qr-img-sm {
    width: 130px;
    height: 130px;
    border-radius: 12px;
    border: 1px solid #dadce0;
    display: block;
    margin: 0 auto;
}

[data-theme="dark"] .modal-qr-img,
[data-theme="dark"] .modal-qr-img-sm {
    border-color: var(--md-outline-variant);
}

/* ── 更新弹窗头部渐变 ── */
.modal-update-header {
    background: linear-gradient(135deg, var(--md-primary), #0d47a1);
    padding: 28px 24px;
    text-align: center;
}

/* ── 侧栏卡片（社区页） ── */
.sidebar-card {
    background: var(--md-surface-container);
    border: 1px solid var(--md-outline-variant);
    border-radius: 16px;
    overflow: hidden;
}

.sidebar-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 10px;
    border-bottom: 1px solid var(--md-outline-variant);
}

.sidebar-card-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--md-on-surface);
}

/* ── 平台动态"最新"标记 ── */
.badge-new {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 100px;
    background: #e8f0fe;
    color: var(--md-primary);
}

/* ── 表单行间距 ── */
.form-row {
    margin-bottom: 14px;
}

.form-row-sm {
    margin-bottom: 12px;
}

.form-row-lg {
    margin-bottom: 16px;
}

.form-row-xl {
    margin-bottom: 20px;
}

/* ── 验证码容器（.captcha-row / .captcha-box 已在 auth.css 定义） ── */

.captcha-hint {
    font-size: 11px;
    color: #9aa0a6;
    margin: 4px 0 0;
}

/* ── 社区页布局容器 ── */
.community-feed {
    max-width: 1500px;
    margin: 0 auto;
    padding: 32px 24px 64px;
    box-sizing: border-box;
}

.community-layout {
    display: flex;
    gap: 24px;
    align-items: start;
}

.community-main {
    flex: 1;
    min-width: 0;
}

.community-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex-shrink: 0;
    width: 320px;
}

/* ── 精选标题行 ── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-title-inline {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

/* ── 加载占位 ── */
.loading-placeholder {
    padding: 40px;
    text-align: center;
    color: var(--md-on-surface-variant);
}

.loading-placeholder-sm {
    padding: 20px;
    text-align: center;
    color: var(--md-on-surface-variant);
}

/* ── 账户页弹窗内滚动区 ── */
.modal-scroll {
    max-height: 400px;
    overflow-y: auto;
}

/* ── 底部文字链接 ── */
.modal-footer-text {
    text-align: center;
    font-size: 13px;
    color: #5f6368;
    margin-top: 16px;
}

[data-theme="dark"] .modal-footer-text {
    color: var(--md-on-surface-variant);
}

/* ── 卡密兑换分隔线 ── */
.modal-divider {
    border-top: 1px solid #e8eaed;
    padding-top: 16px;
}

[data-theme="dark"] .modal-divider {
    border-color: var(--md-outline-variant);
}

/* ── 卡密扫码购买标题 ── */
.redeem-scan-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.redeem-scan-title span {
    font-size: 13px;
    font-weight: 500;
    color: #5f6368;
}

[data-theme="dark"] .redeem-scan-title span {
    color: var(--md-on-surface-variant);
}

/* ── 兑换码输入行 ── */
.redeem-input-row {
    display: flex;
    gap: 8px;
}

/* ── 二维码加载占位 ── */
.redeem-loading {
    font-size: 12px;
    color: #5f6368;
    text-align: center;
    padding: 20px 0;
}

/* ========================================
   Auth 页面专属样式 — Google 风格紧凑布局
   ======================================== */

/* 整页居中，不超出视口 */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--md-surface);
    padding: 16px;
}

/* 卡片：固定最大宽度，内边距紧凑 */
.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--md-surface-container);
    border: 1px solid var(--md-outline-variant);
    border-radius: var(--shape-corner-extra-large);
    padding: 32px 28px 24px;
    box-shadow: var(--elevation-1);
}

/* Logo 行 */
.auth-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 400;
    color: var(--md-on-surface-variant);
    margin-bottom: 20px;
    justify-content: center;
}

/* 标题 */
.auth-title {
    font-size: 22px;
    font-weight: 400;
    color: var(--md-on-surface);
    text-align: center;
    margin-bottom: 20px;
    line-height: 1.3;
}

/* 表单字段 */
.f {
    margin-bottom: 12px;
}
.f label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--md-on-surface-variant);
    margin-bottom: 4px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.f input, .f select {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--md-outline-variant);
    border-radius: var(--shape-corner-medium);
    font-family: var(--font);
    font-size: 14px;
    color: var(--md-on-surface);
    background: var(--md-surface-container);
    outline: none;
    transition: var(--transition-fast);
    line-height: 1.4;
}
.f input:focus, .f select:focus {
    border-color: var(--md-primary);
    box-shadow: 0 0 0 2px rgba(26,115,232,0.18);
}

/* 错误提示 */
.err {
    font-size: 12px;
    color: var(--md-error);
    min-height: 16px;
    margin-bottom: 10px;
    line-height: 1.4;
}

/* 主按钮 */
.auth-btn {
    width: 100%;
    padding: 11px;
    background: var(--md-primary);
    color: var(--md-on-primary);
    border: none;
    border-radius: var(--shape-corner-full);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    margin-top: 4px;
}
.auth-btn:hover:not(:disabled) { background: var(--md-primary-hover); box-shadow: var(--elevation-1); }
.auth-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* 次要按钮 */
.auth-btn-text {
    width: 100%;
    padding: 8px;
    background: none;
    border: none;
    font-family: var(--font);
    font-size: 13px;
    color: var(--md-primary);
    cursor: pointer;
    transition: var(--transition-fast);
    border-radius: var(--shape-corner-full);
}
.auth-btn-text:hover { background: var(--md-primary-container); }

/* 底部链接行 */
.auth-footer {
    text-align: center;
    font-size: 13px;
    color: var(--md-on-surface-variant);
    margin-top: 14px;
}
.auth-footer a { color: var(--md-primary); cursor: pointer; }
.auth-footer a:hover { text-decoration: underline; }

/* 分割线 */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0;
    font-size: 12px;
    color: var(--md-on-surface-variant);
}
.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--md-outline-variant);
}

/* Tab 切换 */
.auth-tabs {
    display: flex;
    background: var(--md-surface);
    border-radius: var(--shape-corner-full);
    padding: 3px;
    gap: 2px;
    margin-bottom: 18px;
}
.auth-tab {
    flex: 1;
    padding: 7px;
    border-radius: var(--shape-corner-full);
    font-size: 13px;
    font-weight: 500;
    color: var(--md-on-surface-variant);
    cursor: pointer;
    border: none;
    background: none;
    font-family: var(--font);
    transition: var(--transition-fast);
    text-align: center;
}
.auth-tab.active {
    background: var(--md-surface-container);
    color: var(--md-on-surface);
    box-shadow: var(--elevation-1);
}

/* 验证码行 */
.captcha-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.captcha-row input { flex: 1; }
.captcha-box {
    min-width: 110px;
    padding: 0 12px;
    background: var(--md-surface);
    border: 1px solid var(--md-outline-variant);
    border-radius: var(--shape-corner-medium);
    font-size: 14px;
    font-weight: 500;
    color: var(--md-on-surface);
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    user-select: none;
}
.captcha-box:hover { background: var(--md-primary-container); border-color: var(--md-primary); }

/* 密码强度条 */
.pwd-strength {
    height: 2px;
    border-radius: 1px;
    margin-top: 5px;
    background: var(--md-outline-variant);
    transition: all 0.3s;
}
.pwd-strength.weak   { background: var(--md-error);   width: 33%; }
.pwd-strength.medium { background: var(--md-warning);  width: 66%; }
.pwd-strength.strong { background: var(--md-success);  width: 100%; }

/* 微信区域 */
.wx-area { text-align: center; }
.wx-icon-box {
    width: 64px; height: 64px;
    background: var(--md-success-container);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 10px;
}
.wx-hint {
    font-size: 13px;
    color: var(--md-on-surface-variant);
    line-height: 1.6;
    margin-bottom: 14px;
}
.wx-code-input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--md-outline-variant);
    border-radius: var(--shape-corner-medium);
    font-family: var(--font);
    font-size: 20px;
    text-align: center;
    letter-spacing: 8px;
    outline: none;
    color: var(--md-on-surface);
    background: var(--md-surface-container);
    transition: var(--transition-fast);
    margin-bottom: 10px;
}
.wx-code-input:focus { border-color: var(--md-primary); box-shadow: 0 0 0 2px rgba(26,115,232,0.18); }

/* 步骤条 */
.step-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 20px;
}
.step-node { display: flex; align-items: center; gap: 6px; }
.step-circle {
    width: 24px; height: 24px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700;
    background: var(--md-outline-variant); color: #fff;
    transition: background 0.3s; flex-shrink: 0;
}
.step-circle.active { background: var(--md-primary); }
.step-circle.done   { background: var(--md-success); }
.step-label { font-size: 11px; color: var(--md-on-surface-variant); }
.step-line { width: 28px; height: 1px; background: var(--md-outline-variant); margin: 0 4px; }

/* 步骤内容 */
.step { display: none; }
.step.active { display: block; }

/* 信息提示框 */
.info-box {
    background: var(--md-primary-container);
    border-radius: var(--shape-corner-medium);
    padding: 10px 12px;
    font-size: 12px;
    color: var(--md-on-primary-container);
    margin-bottom: 12px;
    line-height: 1.5;
}

/* 成功页 */
.success-view { text-align: center; padding: 8px 0 4px; }
.success-icon { font-size: 3rem; margin-bottom: 12px; }
.success-title { font-size: 18px; font-weight: 400; margin-bottom: 6px; }
.success-sub { font-size: 13px; color: var(--md-on-surface-variant); margin-bottom: 20px; }

/* 绑定面板 */
.bind-info {
    background: var(--md-primary-container);
    border-radius: var(--shape-corner-medium);
    padding: 10px 12px;
    font-size: 12px;
    color: var(--md-on-primary-container);
    margin-bottom: 12px;
    line-height: 1.5;
}

/* 深色模式 */
[data-theme="dark"] .auth-page { background: var(--md-surface); }
[data-theme="dark"] .auth-card { background: var(--md-surface-container); border-color: var(--md-outline-variant); }
[data-theme="dark"] .f input, [data-theme="dark"] .f select { background: var(--md-surface-container-high); border-color: var(--md-outline); color: var(--md-on-surface); }
[data-theme="dark"] .f input:focus, [data-theme="dark"] .f select:focus { border-color: var(--md-primary); box-shadow: 0 0 0 2px rgba(168, 199, 250, 0.25); }
[data-theme="dark"] .wx-code-input { background: var(--md-surface-container-high); border-color: var(--md-outline); color: var(--md-on-surface); }
[data-theme="dark"] .wx-code-input:focus { border-color: var(--md-primary); box-shadow: 0 0 0 2px rgba(168, 199, 250, 0.25); }
[data-theme="dark"] .captcha-box { background: var(--md-surface-container-high); border-color: var(--md-outline); }
[data-theme="dark"] .captcha-box:hover { background: var(--md-primary-container); border-color: var(--md-primary); }
[data-theme="dark"] .auth-tabs { background: var(--md-surface-container-high); }
[data-theme="dark"] .auth-tab.active { background: var(--md-surface-container); color: var(--md-on-surface); }
[data-theme="dark"] .info-box, [data-theme="dark"] .bind-info { background: var(--md-primary-container); color: var(--md-on-primary-container); }
[data-theme="dark"] .wx-icon-box { background: var(--md-success-container); }
[data-theme="dark"] .step-circle { background: var(--md-outline); color: var(--md-on-surface-dim); }
[data-theme="dark"] .step-circle.active { background: var(--md-primary); color: var(--md-on-primary); }
[data-theme="dark"] .step-circle.done { background: var(--md-success); color: var(--md-on-primary); }

/* ── 算力兑换 — 扫码购买蓝色卡片（同订阅方案风格） ── */
.redeem-qrcodes {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.redeem-qr-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #e8f0fe;
    border-radius: 12px;
    padding: 16px 18px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
    border: 1px solid transparent;
}
.redeem-qr-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(26,115,232,0.15);
    border-color: #c2d9f7;
}
.redeem-qr-card:active {
    transform: translateY(0);
}
/* 左侧二维码区域 */
.redeem-qr-card-left {
    width: 56px; height: 56px; flex-shrink: 0;
    border-radius: 10px;
    background: #fff;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.redeem-qr-card-left img {
    width: 48px; height: 48px; object-fit: contain;
}
/* 右侧信息区 */
.redeem-qr-card-right {
    flex: 1; min-width: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
/* 左侧：标题+描述 */
.redeem-qr-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
.redeem-qr-title {
    font-size: 14px; font-weight: 600; color: #1a73e8;
    line-height: 1.3;
}
.redeem-qr-desc {
    font-size: 12px; color: #5f6368;
    line-height: 1.4;
}
/* 右侧：价格徽章 */
.redeem-qr-badge {
    flex-shrink: 0;
    background: #1a73e8;
    color: #fff;
    font-size: 13px; font-weight: 600;
    padding: 5px 14px;
    border-radius: 100px;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

/* ========================================
   响应式系统 — Google Material 3 窗口分级
   Window Size Classes:
     Compact:      0–599dp   (≤37.4375rem)
     Medium:       600–839dp (37.5–52.4375rem)
     Expanded:     840–1199dp (52.5–74.9375rem)
     Large:        1200–1599dp (75–99.9375rem)
     Extra-large:  ≥1600dp   (≥100rem)
   ======================================== */

/* ══════════════════════════════════════
   全局容器自适应
══════════════════════════════════════ */
.container, .container-sm {
    width: 100%;
    padding-inline: var(--m3-grid-margin);
}
.container    { max-width: var(--m3-content-max); margin-inline: auto; }
.container-sm { max-width: 840px; margin-inline: auto; }

/* ══════════════════════════════════════
   Navbar — M3 组件自适应
══════════════════════════════════════ */
.navbar {
    padding-inline: var(--m3-grid-margin);
}

/* Medium: 缩小导航间距 */
@media (max-width: 52.4375rem) {
    .navbar-nav a { padding: 8px 14px; font-size: 13px; }
    .balance-chip { display: none; }
}

/* Compact: 隐藏导航文字，只保留图标或完全隐藏 */
@media (max-width: 37.4375rem) {
    .navbar-nav { display: none; }
    .navbar { padding-inline: var(--space-md); }
}

/* ══════════════════════════════════════
   探索页 (Community) — M3 栅格自适应
══════════════════════════════════════ */

/* Hero 区域 */
#page-community > section {
    padding-inline: var(--m3-grid-margin);
}
#page-community > section > div[style*="z-index:1"] {
    max-width: min(760px, 100%);
}

/* 统计数字行 */
#page-community > section .stat-row-inline {
    flex-wrap: wrap;
    gap: var(--space-sm);
}

/* 内容区 */
#communityFeed {
    padding-inline: var(--m3-grid-margin);
    padding-block: var(--space-lg) var(--space-3xl);
}

/* 主网格：Large+ 双栏，Expanded 单栏 */
#communityFeed > div {
    display: flex;
    gap: var(--space-lg);
    align-items: start;
}

/* Expanded: 侧边栏横排 */
@media (max-width: 74.9375rem) {
    #communityFeed > div {
        gap: var(--space-md);
    }
    #communityFeed > div > div:last-child {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--space-md);
        width: 100%;
    }
}

/* Medium: 内容区缩小间距 */
@media (max-width: 52.4375rem) {
    #communityFeed > div > div:last-child {
        grid-template-columns: 1fr;
    }
}

/* Compact: 瀑布流列数自适应 */
#worksGrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    justify-content: stretch;
    gap: var(--space-sm);
    width: 100%;
}
#worksGrid > * {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
}

@media (max-width: 37.4375rem) {
    #communityFeed { padding-inline: var(--space-md); padding-block: var(--space-md) var(--space-3xl); }
    #worksGrid { gap: var(--space-xs); }
}

/* ══════════════════════════════════════
   实验室页 (Create) — M3 动态栅格
   使用 tokens.css 中的 --m3-lab-* 变量
   所有窗口分级统一使用三栏布局
   ═════════════════════════════════════ */
/* 实验室页布局由 pages.css 统一控制 */

/* ══════════════════════════════════════
   账户页 — M3 组件自适应
══════════════════════════════════════ */
#page-account .container-sm {
    padding-block: 0 var(--space-3xl);
}
.account-hero { padding-block: clamp(24px, 4vh, 48px) clamp(16px, 3vh, 32px); }
.account-avatar { width: clamp(64px, 8vw, 96px); height: clamp(64px, 8vw, 96px); }
.account-name { font-size: clamp(20px, 2.5vw, 28px); }
.row-label { width: clamp(120px, 15vw, 180px); }

@media (max-width: 37.4375rem) {
    .account-row { padding: 14px var(--space-md); }
    .row-label { width: 100%; font-weight: 600; }
    .row-arrow { display: none; }
    .account-section-label { margin-left: var(--space-sm); }
}

/* ══════════════════════════════════════
   弹窗 — M3 组件自适应 (Reposition)
══════════════════════════════════════ */

/* 作品详情：Expanded+ 左右，Medium 上下 */
#communityOverlay .dialog-lr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 400px;
}

@media (max-width: 52.4375rem) {
    #communityOverlay .dialog-lr {
        grid-template-columns: 1fr;
    }
    #communityOverlay .dialog-lr > div:first-child {
        min-height: 220px;
        border-radius: 0 !important;
    }
}

/* 弹窗本身宽度 */
#communityOverlay > div {
    max-width: min(var(--dialog-max, 560px), calc(100vw - 32px));
    max-height: min(88vh, 800px);
}

/* ══════════════════════════════════════
   登录/注册/找回密码 — M3 自适应
══════════════════════════════════════ */
.auth-page { padding: var(--m3-grid-margin); }
.auth-card {
    padding: clamp(28px, 5vw, 48px) clamp(20px, 4vw, 40px);
    max-width: min(440px, 100%);
}

@media (max-width: 37.4375rem) {
    .auth-card { border-radius: var(--shape-corner-large); }
}

/* ══════════════════════════════════════
   字体响应式 — M3 Typography Scale
══════════════════════════════════════ */
body { font-size: 14px; }

/* ══════════════════════════════════════
   触摸目标最小 48px — M3 无障碍
══════════════════════════════════════ */
@media (pointer: coarse) {
    .btn { min-height: 48px; }
    .navbar-nav a { min-height: 48px; display: flex; align-items: center; }
    .account-row { min-height: 56px; }
    .cp-rank-row { min-height: 48px; }
}

/* ══════════════════════════════════════
   深色模式补充
══════════════════════════════════════ */
[data-theme="dark"] #communityFeed { background: var(--md-surface-container); }
[data-theme="dark"] .create-layout { background: var(--md-surface); }
[data-theme="dark"] .panel { background: var(--md-surface-container); }

/* ══════════════════════════════════════
   参数面板 — M3 Reflow 自适应
══════════════════════════════════════ */
@media (max-width: 37.4375rem) {
    .params-row {
        flex-direction: column;
        gap: 0;
    }
    .param-cell {
        width: 100%;
    }
}

/* ══════════════════════════════════════
   打印
══════════════════════════════════════ */
@media print {
    .navbar, .cp-chips-bar { display: none; }
    #communityFeed { padding: 0; }
}

/* ══════════════════════════════════════
   减少动画 — M3 无障碍
══════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ══════════════════════════════════════
   Compact (手机) 体验优化
══════════════════════════════════════ */
@media (max-width: 37.4375rem) {
    /* 增大触摸目标 */
    .btn {
        min-height: 48px;
        min-width: 48px;
        padding: 12px 24px;
    }

    .btn-expressive {
        min-height: 64px;
        padding: 16px 32px;
    }

    /* 优化间距 — 8dp 步进 */
    .container { padding: 0 var(--space-md); }
    .container-sm { padding: 0 var(--space-md); }

    /* 导航栏 */
    .navbar { height: 64px; padding: 0 var(--space-md); }

    /* 卡片 */
    .card { padding: var(--space-lg); margin-bottom: var(--space-md); }
    .card-expressive { padding: var(--space-lg); }

    /* 字体 */
    .hero-title { font-size: 28px; line-height: 1.3; }
    .hero-subtitle { font-size: 14px; line-height: 1.5; }

    /* 网格 */
    .grid-3 { gap: var(--space-lg); }
    .grid-2 { gap: var(--space-lg); }

    /* Hero */
    .hero-section { padding: 36px var(--space-lg) 28px; }

    /* 按钮 */
    .hero-actions { gap: var(--space-sm); }

    /* 表单 */
    .input-field { min-height: 48px; padding: 12px 16px; }

    /* 历史记录列表项 — 容器查询自适应 */
    .history-item { min-height: 44px; }

    /* 菜单项 */
    .history-menu-item { min-height: 48px; padding: 12px 16px; }
}

/* ══════════════════════════════════════
   移动端底部导航栏 — M3 Navigation Bar
══════════════════════════════════════ */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: var(--md-surface-container);
    border-top: 1px solid var(--md-outline-variant);
    display: none;
    justify-content: space-around;
    align-items: center;
    padding: 0 var(--space-md);
    z-index: 1000;
    box-shadow: 0 -2px 8px rgba(60, 64, 67, 0.1);
}

@media (max-width: 37.4375rem) {
    .mobile-nav { display: flex; }
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm);
    min-width: 64px;
    min-height: 56px;
    color: var(--md-on-surface-variant);
    transition: color 0.2s var(--motion-standard);
    cursor: pointer;
}

.mobile-nav-item:hover { color: var(--md-primary); }
.mobile-nav-item.active { color: var(--md-primary); }

.mobile-nav-item svg { width: 24px; height: 24px; }
.mobile-nav-item span { font-size: 12px; font-weight: 500; }

/* ══════════════════════════════════════
   触摸反馈 — M3 Touch Feedback
══════════════════════════════════════ */
@media (pointer: coarse) {
    .btn:active { transform: scale(0.98); }
    .card:active { transform: scale(0.99); }
    .history-item:active { transform: scale(0.99); }
    .work-card:active { transform: scale(0.99); }
}

/* ══════════════════════════════════════
   深色模式优化 — Material 3 Dark Theme
   统一管理所有深夜模式样式
══════════════════════════════════════ */

/* ── 导航栏优化（已由 layout.css 内联 [data-theme="dark"] 规则覆盖） ── */

/* ── 公告栏优化 ── */
[data-theme="dark"] .announcement-bar {
    background: var(--md-primary);
    color: var(--md-on-primary);
    border-bottom: 1px solid rgba(26, 115, 232, 0.3);
}

[data-theme="dark"] .announcement-bar.urgent {
    background: var(--md-error-container);
    color: var(--md-on-error-container);
}

[data-theme="dark"] .announcement-bar.update {
    background: var(--md-success-container);
    color: var(--md-on-success-container);
}

/* ── 用户菜单优化（已由 layout.css 内联 [data-theme="dark"] 规则覆盖） ── */

/* ── 通告红点/卡片优化（已由 layout.css 内联 [data-theme="dark"] 规则覆盖） ── */

/* ── 卡片优化 ── */
[data-theme="dark"] .card {
    background: var(--md-surface-container);
    border: 1px solid var(--md-outline-variant);
}

[data-theme="dark"] .card:hover {
    background: var(--md-surface-container-high);
    box-shadow: var(--elevation-2);
    border-color: var(--md-outline);
}

[data-theme="dark"] .card-elevated {
    background: var(--md-surface-container-high);
    border: 1px solid var(--md-outline-variant);
}

/* ── 输入框优化 ── */
[data-theme="dark"] .input-field {
    background: var(--md-surface-container);
    border: 1px solid var(--md-outline);
    color: var(--md-on-surface);
}

[data-theme="dark"] .input-field:hover {
    border-color: var(--md-on-surface-variant);
}

[data-theme="dark"] .input-field:focus {
    border-color: var(--md-primary);
    background: var(--md-surface-container-high);
    box-shadow: 0 0 0 1px var(--md-primary);
}

[data-theme="dark"] .input-field::placeholder {
    color: var(--md-on-surface-dim);
}

[data-theme="dark"] .input-field.has-preview {
    background: rgba(26, 115, 232, 0.15);
    border-color: var(--md-primary);
}

/* ── 按钮优化 ── */
[data-theme="dark"] .btn-primary {
    background: var(--md-primary);
    color: var(--md-on-primary);
}

[data-theme="dark"] .btn-primary:hover {
    background: var(--md-primary-hover);
    box-shadow: var(--elevation-2);
}

[data-theme="dark"] .btn-secondary {
    background: var(--md-surface-container-high);
    color: var(--md-primary);
    border: 1px solid var(--md-outline);
}

[data-theme="dark"] .btn-secondary:hover {
    background: var(--md-surface-container-highest);
    border-color: var(--md-primary);
}

[data-theme="dark"] .btn-outline {
    background: transparent;
    color: var(--md-primary);
    border: 1px solid var(--md-outline);
}

[data-theme="dark"] .btn-outline:hover {
    background: rgba(168, 199, 250, 0.08);
    border-color: var(--md-primary);
}

/* ── Toast 通知优化 ── */
[data-theme="dark"] .toast {
    background: var(--md-surface-inverse);
    color: var(--md-on-surface-inverse);
    box-shadow: var(--elevation-3);
}

[data-theme="dark"] .toast-success {
    background: var(--md-success);
    color: var(--md-on-primary);
}

[data-theme="dark"] .toast-error {
    background: var(--md-error);
    color: var(--md-on-primary);
}

[data-theme="dark"] .toast-warning {
    background: var(--md-warning);
    color: var(--md-on-primary);
}

/* ── 统计卡片优化 ── */
[data-theme="dark"] .stat-card {
    background: var(--md-surface-container);
    border: 1px solid var(--md-outline-variant);
}

[data-theme="dark"] .stat-card:hover {
    background: var(--md-surface-container-high);
    border-color: var(--md-outline);
}

/* ── 社区页面优化（已由 pages.css 内联 [data-theme="dark"] 规则覆盖） ── */

/* ── 工作流弹窗优化 ── */
[data-theme="dark"] .wf-modal-overlay {
    background: var(--md-scrim);
}

[data-theme="dark"] .wf-modal {
    background: var(--md-surface-container);
    border: 1px solid var(--md-outline-variant);
}

[data-theme="dark"] .wf-sidebar {
    background: var(--md-surface-container-low);
    border-right: 1px solid var(--md-outline-variant);
}

[data-theme="dark"] .wf-item {
    background: var(--md-surface-container);
    border: 1px solid var(--md-outline-variant);
}

[data-theme="dark"] .wf-item:hover {
    background: var(--md-surface-container-high);
    border-color: var(--md-outline);
}

[data-theme="dark"] .wf-item.selected {
    background: var(--md-primary);
    border-color: var(--md-primary);
    color: var(--md-on-primary);
}

/* ── 历史记录优化 — 基础值与内联 [data-theme="dark"] 已用 CSS 变量，此处仅保留额外覆盖 ── */

[data-theme="dark"] .history-item.active,
[data-theme="dark"] .history-item.selected {
    box-shadow: 0 0 0 1px var(--md-primary);
}

/* ── 加载状态优化 ── */
[data-theme="dark"] .spinner {
    border-color: var(--md-outline);
    border-top-color: var(--md-primary);
}

[data-theme="dark"] .canvas-loading {
    background: var(--md-surface-container);
}

/* ── 滚动条优化 ── */
[data-theme="dark"] .wf-sidebar::-webkit-scrollbar-thumb {
    background: var(--md-outline);
}

[data-theme="dark"] .wf-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--md-on-surface-variant);
}

/* ── 图片加载失败占位 ── */
[data-theme="dark"] .history-item-placeholder {
    background: var(--md-surface-container-high);
    color: var(--md-on-surface-variant);
}

/* ── 表单优化 ── */
[data-theme="dark"] .form-group label {
    color: var(--md-on-surface-variant);
}

[data-theme="dark"] .form-hint {
    color: var(--md-on-surface-dim);
}

[data-theme="dark"] .form-error {
    color: var(--md-error);
}

/* ── 标签和徽章优化 ── */
[data-theme="dark"] .badge {
    background: var(--md-primary);
    color: var(--md-on-primary);
}

[data-theme="dark"] .badge-success {
    background: var(--md-success-container);
    color: var(--md-on-success-container);
}

[data-theme="dark"] .badge-error {
    background: var(--md-error-container);
    color: var(--md-on-error-container);
}

[data-theme="dark"] .badge-warning {
    background: var(--md-warning-container);
    color: var(--md-on-warning-container);
}

/* ── 更新胶囊：深色模式维持蓝色 ── */
[data-theme="dark"] .badge-update {
    background: var(--md-primary);
    color: var(--md-on-primary);
}

/* ── 深色模式下内联 primary 按钮 — 维持蓝色搭配 ── */
[data-theme="dark"] button[style*="background:var(--md-primary)"],
[data-theme="dark"] button[style*="background: var(--md-primary)"] {
    background: var(--md-primary) !important;
    color: var(--md-on-primary) !important;
}
[data-theme="dark"] button[style*="background:var(--md-primary)"]:hover,
[data-theme="dark"] button[style*="background: var(--md-primary)"]:hover {
    background: var(--md-primary-hover) !important;
    color: var(--md-on-primary) !important;
}
/* accountSubOverlay 中 "已激活" 标签深色模式 */
[data-theme="dark"] #accountSubOverlay [style*="background:var(--md-primary)"][style*="color: var(--md-on-primary)"] {
    background: var(--md-primary) !important;
    color: var(--md-on-primary) !important;
}
/* accountSubOverlay 中余额数字 */
[data-theme="dark"] #accountSubOverlay [style*="color:var(--md-primary)"] {
    color: var(--md-primary) !important;
}

/* ── 分隔线优化 ── */
[data-theme="dark"] .divider {
    background: var(--md-outline-variant);
}

/* ── 链接优化 ── */
[data-theme="dark"] a {
    color: var(--md-primary);
}

[data-theme="dark"] a:hover {
    color: var(--md-primary-hover);
}

/* ── 选择文本优化 ── */
[data-theme="dark"] ::selection {
    background: rgba(168, 199, 250, 0.3);
    color: var(--md-on-surface);
}

/* ── 自动填充优化 ── */
[data-theme="dark"] input:-webkit-autofill,
[data-theme="dark"] input:-webkit-autofill:hover,
[data-theme="dark"] input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--md-on-surface);
    -webkit-box-shadow: 0 0 0 1000px var(--md-surface-container) inset;
    border-color: var(--md-primary);
}

/* ── 禁用状态优化 ── */
[data-theme="dark"] .btn:disabled,
[data-theme="dark"] .input-field:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

[data-theme="dark"] .btn:disabled {
    background: var(--md-surface-container-high);
    color: var(--md-on-surface-dim);
}

/* ── 聚焦环优化 ── */
[data-theme="dark"] *:focus-visible {
    outline: 2px solid var(--md-primary);
    outline-offset: 2px;
}

/* ── 工具提示优化 ── */
[data-theme="dark"] .tooltip {
    background: var(--md-surface-container-highest);
    color: var(--md-on-surface);
    border: 1px solid var(--md-outline-variant);
    box-shadow: var(--elevation-2);
}

/* ── 模态框优化 ── */
[data-theme="dark"] .modal-overlay {
    background: var(--md-scrim);
}

[data-theme="dark"] .modal {
    background: var(--md-surface-container);
    border: 1px solid var(--md-outline-variant);
    box-shadow: var(--elevation-4);
}

/* ── 下拉菜单优化 ── */
[data-theme="dark"] .dropdown {
    background: var(--md-surface-container-high);
    border: 1px solid var(--md-outline-variant);
    box-shadow: var(--elevation-3);
}

[data-theme="dark"] .dropdown-item {
    color: var(--md-on-surface);
}

[data-theme="dark"] .dropdown-item:hover {
    background: var(--md-surface-container-highest);
}

/* ── 标签页优化 ── */
[data-theme="dark"] .tab {
    color: var(--md-on-surface-variant);
}

[data-theme="dark"] .tab:hover {
    color: var(--md-on-surface);
    background: var(--md-surface-container-high);
}

[data-theme="dark"] .tab.active {
    color: var(--md-primary);
    border-bottom: 2px solid var(--md-primary);
}

/* ── 进度条优化 ── */
[data-theme="dark"] .progress-bar {
    background: var(--md-surface-container-high);
}

[data-theme="dark"] .progress-fill {
    background: var(--md-primary);
}

/* ── 开关优化 ── */
[data-theme="dark"] .switch {
    background: var(--md-surface-container-highest);
}

[data-theme="dark"] .switch.active {
    background: var(--md-primary);
}

/* ── 头像优化 ── */
[data-theme="dark"] .avatar {
    border: 2px solid var(--md-outline-variant);
}

[data-theme="dark"] .avatar.online::after {
    background: var(--md-success);
    border-color: var(--md-surface-container);
}

/* ── 代码块优化 ── */
[data-theme="dark"] code {
    background: var(--md-surface-container-high);
    color: var(--md-error);
    border: 1px solid var(--md-outline-variant);
}

[data-theme="dark"] pre {
    background: var(--md-surface-container-low);
    border: 1px solid var(--md-outline-variant);
}

[data-theme="dark"] pre code {
    background: transparent;
    border: none;
    color: var(--md-on-surface);
}

/* ── Hero区域优化 — 基础值已用 CSS 变量，仅保留深色特有覆盖 ── */
[data-theme="dark"] .hero-tag {
    background: var(--md-primary);
    color: var(--md-on-primary);
}

[data-theme="dark"] .hero-tag-dot {
    background: var(--md-primary);
}

[data-theme="dark"] .hero-btn-primary:hover {
    box-shadow: var(--elevation-2);
}

[data-theme="dark"] .hero-btn-secondary:hover {
    background: var(--md-surface-container-high);
    border-color: var(--md-primary);
}

/* ── 账户页面优化 ── */
[data-theme="dark"] .account-hero {
    background: var(--md-surface);
}

[data-theme="dark"] .account-avatar {
    border: 3px solid var(--md-outline-variant);
}

[data-theme="dark"] .account-name {
    color: var(--md-on-surface);
}

[data-theme="dark"] .account-email {
    color: var(--md-on-surface-variant);
}

[data-theme="dark"] .account-section-label {
    color: var(--md-on-surface-variant);
}

[data-theme="dark"] .account-card {
    background: var(--md-surface-container);
    border: 1px solid var(--md-outline-variant);
}

[data-theme="dark"] .account-row {
    border-bottom: 1px solid var(--md-outline-variant);
}

[data-theme="dark"] .account-row:hover {
    background: var(--md-surface-container-high);
}

[data-theme="dark"] .row-icon {
    color: var(--md-on-surface-variant);
}

[data-theme="dark"] .row-label {
    color: var(--md-on-surface);
}

[data-theme="dark"] .row-value {
    color: var(--md-on-surface-variant);
}

[data-theme="dark"] .row-arrow {
    color: var(--md-on-surface-variant);
}

/* ── 弹窗优化 ── */
[data-theme="dark"] .overlay {
    background: var(--md-scrim);
}

[data-theme="dark"] .dialog {
    background: var(--md-surface-container);
    border: 1px solid var(--md-outline-variant);
    box-shadow: var(--elevation-4);
}

[data-theme="dark"] .dialog-header {
    border-bottom: 1px solid var(--md-outline-variant);
}

[data-theme="dark"] .dialog-title {
    color: var(--md-on-surface);
}

[data-theme="dark"] .dialog-close {
    color: var(--md-on-surface-variant);
}

[data-theme="dark"] .dialog-close:hover {
    background: var(--md-surface-container-high);
}

[data-theme="dark"] .dialog-body {
    color: var(--md-on-surface);
}

/* ── 历史记录优化（已由 pages.css 内联 [data-theme="dark"] 规则覆盖，此处仅保留 pages.css 未定义的） ── */

[data-theme="dark"] .history-status.done {
    color: var(--md-success);
}

[data-theme="dark"] .history-status.error {
    color: var(--md-error);
}

[data-theme="dark"] .history-status.running {
    color: var(--md-primary);
}

[data-theme="dark"] .history-status.pending {
    color: var(--md-on-surface-variant);
}

[data-theme="dark"] .history-item-expired {
    opacity: var(--expired-opacity);
}

[data-theme="dark"] .history-menu {
    background: var(--md-surface-container-high);
    border: 1px solid var(--md-outline-variant);
    box-shadow: var(--elevation-3);
}

[data-theme="dark"] .history-menu-item {
    color: var(--md-on-surface);
}

[data-theme="dark"] .history-menu-item:hover {
    background: var(--md-surface-container-highest);
}

[data-theme="dark"] .history-menu-item-danger {
    color: var(--md-error);
}

[data-theme="dark"] .history-menu-item-danger svg {
    color: var(--md-error);
}

/* ── 工具栏优化 ── */
[data-theme="dark"] .toolbar-btn {
    background: var(--md-surface-container);
    color: var(--md-on-surface-variant);
    border: 1px solid var(--md-outline-variant);
}

[data-theme="dark"] .toolbar-btn:hover {
    background: var(--md-surface-container-high);
    border-color: var(--md-primary);
    color: var(--md-primary);
}

/* ── 排名优化 ── */
[data-theme="dark"] .rank-no.gold {
    color: var(--md-warning);
}

[data-theme="dark"] .rank-no.silver {
    color: var(--md-on-surface-variant);
}

[data-theme="dark"] .rank-no.bronze {
    color: var(--google-red);
}

[data-theme="dark"] .rank-name {
    color: var(--md-on-surface);
}

/* ── Canvas加载优化 ── */
[data-theme="dark"] .canvas-loading {
    background: var(--md-surface-container);
}

[data-theme="dark"] .canvas-loading-text {
    color: var(--md-on-surface-variant);
}

/* ── 空状态优化 ── */
[data-theme="dark"] .empty-state {
    color: var(--md-on-surface-variant);
}

[data-theme="dark"] .empty-state-icon {
    color: var(--md-outline);
}

/* ── 搜索框优化 ── */
[data-theme="dark"] .search-box {
    background: var(--md-surface-container);
    border: 1px solid var(--md-outline);
}

[data-theme="dark"] .search-box:focus-within {
    border-color: var(--md-primary);
    box-shadow: 0 0 0 1px var(--md-primary);
}

[data-theme="dark"] .search-icon {
    color: var(--md-on-surface-variant);
}

/* ── 标签Chip优化 ── */
[data-theme="dark"] .chip {
    background: var(--md-surface-container);
    border: 1px solid var(--md-outline-variant);
    color: var(--md-on-surface);
}

[data-theme="dark"] .chip:hover {
    background: var(--md-surface-container-high);
    border-color: var(--md-outline);
}

[data-theme="dark"] .chip.active {
    background: var(--md-primary);
    border-color: var(--md-primary);
    color: var(--md-on-primary);
}

/* ── 步骤指示器优化 ── */
[data-theme="dark"] .step-indicator {
    color: var(--md-on-surface-variant);
}

[data-theme="dark"] .step-indicator.active {
    color: var(--md-primary);
}

[data-theme="dark"] .step-indicator.completed {
    color: var(--md-success);
}

/* ── 时间线优化 ── */
[data-theme="dark"] .timeline-line {
    background: var(--md-outline-variant);
}

[data-theme="dark"] .timeline-dot {
    background: var(--md-primary);
    border: 2px solid var(--md-surface-container);
}

/* ── 骨架屏优化 ── */
[data-theme="dark"] .skeleton {
    background: var(--md-surface-container-high);
}

[data-theme="dark"] .skeleton::after {
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.08) 50%, 
        transparent 100%);
}

/* ── 文件上传优化 ── */
[data-theme="dark"] .upload-zone {
    background: var(--md-surface-container);
    border: 2px dashed var(--md-outline);
}

[data-theme="dark"] .upload-zone:hover {
    border-color: var(--md-primary);
    background: var(--md-surface-container-high);
}

[data-theme="dark"] .upload-zone.dragover {
    border-color: var(--md-primary);
    background: rgba(26, 115, 232, 0.15);
}

/* ── 价格标签优化 ── */
[data-theme="dark"] .price-tag {
    background: var(--md-primary);
    color: var(--md-on-primary);
}

[data-theme="dark"] .price-tag.discount {
    background: var(--md-success-container);
    color: var(--md-on-success-container);
}

/* ── 计数器优化 ── */
[data-theme="dark"] .counter {
    background: var(--md-surface-container-high);
    color: var(--md-on-surface);
}

/* ── 分页优化 ── */
[data-theme="dark"] .pagination-item {
    background: var(--md-surface-container);
    color: var(--md-on-surface);
    border: 1px solid var(--md-outline-variant);
}

[data-theme="dark"] .pagination-item:hover {
    background: var(--md-surface-container-high);
    border-color: var(--md-outline);
}

[data-theme="dark"] .pagination-item.active {
    background: var(--md-primary);
    color: var(--md-on-primary);
    border-color: var(--md-primary);
}

/* ── 日期选择器优化 ── */
[data-theme="dark"] .date-picker {
    background: var(--md-surface-container);
    border: 1px solid var(--md-outline-variant);
}

[data-theme="dark"] .date-picker-header {
    color: var(--md-on-surface);
}

[data-theme="dark"] .date-picker-day {
    color: var(--md-on-surface);
}

[data-theme="dark"] .date-picker-day:hover {
    background: var(--md-surface-container-high);
}

[data-theme="dark"] .date-picker-day.selected {
    background: var(--md-primary);
    color: var(--md-on-primary);
}

[data-theme="dark"] .date-picker-day.disabled {
    color: var(--md-on-surface-dim);
}

/* ── 评分优化 ── */
[data-theme="dark"] .rating-star {
    color: var(--md-outline);
}

[data-theme="dark"] .rating-star.active {
    color: var(--md-warning);
}

/* ── 折叠面板优化 ── */
[data-theme="dark"] .accordion {
    background: var(--md-surface-container);
    border: 1px solid var(--md-outline-variant);
}

[data-theme="dark"] .accordion-header {
    color: var(--md-on-surface);
}

[data-theme="dark"] .accordion-header:hover {
    background: var(--md-surface-container-high);
}

[data-theme="dark"] .accordion-content {
    color: var(--md-on-surface-variant);
}

/* ── 面包屑优化 ── */
[data-theme="dark"] .breadcrumb {
    color: var(--md-on-surface-variant);
}

[data-theme="dark"] .breadcrumb a {
    color: var(--md-primary);
}

[data-theme="dark"] .breadcrumb a:hover {
    color: var(--md-primary-hover);
}

[data-theme="dark"] .breadcrumb-separator {
    color: var(--md-outline);
}

/* ── 图片预览优化 ── */
[data-theme="dark"] .image-preview-overlay {
    background: rgba(0, 0, 0, 0.9);
}

[data-theme="dark"] .image-preview-close {
    color: var(--md-on-primary);
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .image-preview-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ── 视频播放器优化 ── */
[data-theme="dark"] .video-player {
    background: var(--md-surface-container-lowest);
}

[data-theme="dark"] .video-controls {
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
}

[data-theme="dark"] .video-progress {
    background: rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .video-progress-fill {
    background: var(--md-primary);
}

/* ── 音频播放器优化 ── */
[data-theme="dark"] .audio-player {
    background: var(--md-surface-container);
    border: 1px solid var(--md-outline-variant);
}

[data-theme="dark"] .audio-progress {
    background: var(--md-outline-variant);
}

[data-theme="dark"] .audio-progress-fill {
    background: var(--md-primary);
}

/* ── 地图优化 ── */
[data-theme="dark"] .map-container {
    background: var(--md-surface-container);
}

/* ── 图表优化 ── */
[data-theme="dark"] .chart-container {
    background: var(--md-surface-container);
    border: 1px solid var(--md-outline-variant);
}

[data-theme="dark"] .chart-title {
    color: var(--md-on-surface);
}

[data-theme="dark"] .chart-legend {
    color: var(--md-on-surface-variant);
}

/* ── 表格优化 ── */
[data-theme="dark"] .table {
    background: var(--md-surface-container);
    border: 1px solid var(--md-outline-variant);
}

[data-theme="dark"] .table th {
    background: var(--md-surface-container-high);
    color: var(--md-on-surface);
    border-bottom: 2px solid var(--md-outline);
}

[data-theme="dark"] .table td {
    color: var(--md-on-surface);
    border-bottom: 1px solid var(--md-outline-variant);
}

[data-theme="dark"] .table tr:hover td {
    background: var(--md-surface-container-high);
}

/* ── 列表优化 ── */
[data-theme="dark"] .list-item {
    color: var(--md-on-surface);
    border-bottom: 1px solid var(--md-outline-variant);
}

[data-theme="dark"] .list-item:hover {
    background: var(--md-surface-container-high);
}

/* ── 树形结构优化 ── */
[data-theme="dark"] .tree-node {
    color: var(--md-on-surface);
}

[data-theme="dark"] .tree-node:hover {
    background: var(--md-surface-container-high);
}

[data-theme="dark"] .tree-node.selected {
    background: var(--md-primary);
    color: var(--md-on-primary);
}

/* ── 日历优化 ── */
[data-theme="dark"] .calendar {
    background: var(--md-surface-container);
    border: 1px solid var(--md-outline-variant);
}

[data-theme="dark"] .calendar-header {
    color: var(--md-on-surface);
}

[data-theme="dark"] .calendar-day {
    color: var(--md-on-surface);
}

[data-theme="dark"] .calendar-day:hover {
    background: var(--md-surface-container-high);
}

[data-theme="dark"] .calendar-day.today {
    border: 2px solid var(--md-primary);
}

[data-theme="dark"] .calendar-day.selected {
    background: var(--md-primary);
    color: var(--md-on-primary);
}

/* ── 通知中心优化 ── */
[data-theme="dark"] .notification-center {
    background: var(--md-surface-container);
    border: 1px solid var(--md-outline-variant);
    box-shadow: var(--elevation-3);
}

[data-theme="dark"] .notification-item {
    color: var(--md-on-surface);
    border-bottom: 1px solid var(--md-outline-variant);
}

[data-theme="dark"] .notification-item:hover {
    background: var(--md-surface-container-high);
}

[data-theme="dark"] .notification-item.unread {
    background: rgba(168, 199, 250, 0.08);
}

/* ── 设置面板优化 ── */
[data-theme="dark"] .settings-panel {
    background: var(--md-surface-container);
    border: 1px solid var(--md-outline-variant);
}

[data-theme="dark"] .settings-section {
    border-bottom: 1px solid var(--md-outline-variant);
}

[data-theme="dark"] .settings-label {
    color: var(--md-on-surface);
}

[data-theme="dark"] .settings-description {
    color: var(--md-on-surface-variant);
}

/* ── 支付页面优化 ── */
[data-theme="dark"] .payment-card {
    background: var(--md-surface-container);
    border: 1px solid var(--md-outline-variant);
}

[data-theme="dark"] .payment-method {
    background: var(--md-surface-container-high);
    border: 1px solid var(--md-outline-variant);
}

[data-theme="dark"] .payment-method:hover {
    border-color: var(--md-primary);
}

[data-theme="dark"] .payment-method.selected {
    border-color: var(--md-primary);
    background: var(--md-primary);
}

/* ── 错误页面优化 ── */
[data-theme="dark"] .error-page {
    background: var(--md-surface);
    color: var(--md-on-surface);
}

[data-theme="dark"] .error-code {
    color: var(--md-error);
}

[data-theme="dark"] .error-message {
    color: var(--md-on-surface-variant);
}

/* ── 加载页面优化 ── */
[data-theme="dark"] .loading-page {
    background: var(--md-surface);
}

[data-theme="dark"] .loading-text {
    color: var(--md-on-surface-variant);
}

/* ── 维护页面优化 ── */
[data-theme="dark"] .maintenance-page {
    background: var(--md-surface);
    color: var(--md-on-surface);
}

/* ── 打印样式优化 ── */
@media print {
    [data-theme="dark"] {
        background: var(--md-surface-container) !important;
        color: var(--md-on-surface-inverse) !important;
    }
    
    [data-theme="dark"] * {
        background: transparent !important;
        color: var(--md-on-surface-inverse) !important;
        border-color: var(--md-on-surface-inverse) !important;
    }
}

/* ── 算力兑换弹窗优化 ── */
[data-theme="dark"] #redeemOverlay {
    background: var(--md-scrim);
}

[data-theme="dark"] #redeemOverlay .auth-card {
    background: var(--md-surface-container) !important;
    border: 1px solid var(--md-outline-variant) !important;
}

[data-theme="dark"] #redeemOverlay button[onclick*="RedeemModal.hide"] {
    color: var(--md-on-surface-variant) !important;
}

[data-theme="dark"] #redeemOverlay button[onclick*="RedeemModal.hide"]:hover {
    background: var(--md-surface-container-high) !important;
}

[data-theme="dark"] #redeemOverlay h2 {
    color: var(--md-on-surface) !important;
}

[data-theme="dark"] #redeemOverlay p {
    color: var(--md-on-surface-variant) !important;
}

[data-theme="dark"] #redeemOverlay label {
    color: var(--md-on-surface-variant) !important;
}

[data-theme="dark"] #redeemOverlay input {
    background: var(--md-surface-container-high) !important;
    border-color: var(--md-outline) !important;
    color: var(--md-on-surface) !important;
}

[data-theme="dark"] #redeemOverlay input::placeholder {
    color: var(--md-on-surface-dim) !important;
}

[data-theme="dark"] #redeemOverlay input:focus {
    border-color: var(--md-primary) !important;
    box-shadow: 0 0 0 2px rgba(168, 199, 250, 0.18) !important;
}

[data-theme="dark"] #redeemOverlay button[id="redeemSubmitBtn"] {
    background: var(--md-primary) !important;
    color: var(--md-on-primary) !important;
}

[data-theme="dark"] #redeemOverlay button[id="redeemSubmitBtn"]:hover {
    background: var(--md-primary-hover) !important;
}

[data-theme="dark"] #redeemOverlay #redeemErr {
    color: var(--md-error) !important;
}

[data-theme="dark"] #redeemOverlay svg[stroke="var(--md-on-surface-variant)"] {
    stroke: var(--md-on-surface-variant) !important;
}

[data-theme="dark"] #redeemOverlay span:not(.redeem-qr-badge) {
    color: var(--md-on-surface-variant) !important;
}

[data-theme="dark"] #redeemOverlay div[style*="background:var(--md-secondary-container)"] {
    background: var(--md-primary) !important;
}

[data-theme="dark"] #redeemOverlay svg[stroke="var(--md-primary)"] {
    stroke: var(--md-primary) !important;
}

/* ── 扫码购买卡片深色模式 ── */
[data-theme="dark"] .redeem-qr-card {
    background: rgba(26,115,232,0.1);
    border-color: rgba(26,115,232,0.2);
}
[data-theme="dark"] .redeem-qr-card:hover {
    background: rgba(26,115,232,0.15);
    border-color: rgba(168,199,250,0.3);
}
[data-theme="dark"] .redeem-qr-card-left {
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
[data-theme="dark"] .redeem-qr-title { color: var(--md-info); }
[data-theme="dark"] .redeem-qr-desc { color: var(--md-on-surface-dim); }
[data-theme="dark"] .redeem-qr-badge {
    background: var(--md-primary);
}

/* ── 通告弹窗优化 ── */
[data-theme="dark"] #noticeOverlay {
    background: var(--md-scrim);
}

[data-theme="dark"] #noticeOverlay .auth-card {
    background: var(--md-surface-container) !important;
    border: 1px solid var(--md-outline-variant) !important;
}

[data-theme="dark"] #noticeOverlay button[onclick*="NoticeModal.hide"] {
    color: var(--md-on-surface-variant) !important;
}

[data-theme="dark"] #noticeOverlay button[onclick*="NoticeModal.hide"]:hover {
    background: var(--md-surface-container-high) !important;
}

[data-theme="dark"] #noticeOverlay h2 {
    color: var(--md-on-surface) !important;
}

[data-theme="dark"] #noticeOverlay svg[stroke="var(--md-primary)"] {
    stroke: var(--md-primary) !important;
}

/* ── 分享弹窗优化 ── */
[data-theme="dark"] #shareOverlay {
    background: var(--md-scrim);
}

[data-theme="dark"] #shareOverlay .auth-card {
    background: var(--md-surface-container) !important;
    border: 1px solid var(--md-outline-variant) !important;
}

[data-theme="dark"] #shareOverlay button[onclick*="ShareModal.hide"] {
    color: var(--md-on-surface-variant) !important;
}

[data-theme="dark"] #shareOverlay button[onclick*="ShareModal.hide"]:hover {
    background: var(--md-surface-container-high) !important;
}

[data-theme="dark"] #shareOverlay h2 {
    color: var(--md-on-surface) !important;
}

[data-theme="dark"] #shareOverlay p {
    color: var(--md-on-surface-variant) !important;
}

[data-theme="dark"] #shareOverlay label {
    color: var(--md-on-surface-variant) !important;
}

[data-theme="dark"] #shareOverlay textarea {
    background: var(--md-surface-container-high) !important;
    border-color: var(--md-outline) !important;
    color: var(--md-on-surface) !important;
}

[data-theme="dark"] #shareOverlay textarea::placeholder {
    color: var(--md-on-surface-dim) !important;
}

[data-theme="dark"] #shareOverlay textarea:focus {
    border-color: var(--md-primary) !important;
    box-shadow: 0 0 0 2px rgba(168, 199, 250, 0.18) !important;
}

[data-theme="dark"] #shareOverlay button[id="shareSubmitBtn"] {
    background: var(--md-primary) !important;
    color: var(--md-on-primary) !important;
}

[data-theme="dark"] #shareOverlay button[id="shareSubmitBtn"]:hover {
    background: var(--md-primary-hover) !important;
}

[data-theme="dark"] #shareOverlay #shareErr {
    color: var(--md-error) !important;
}

/* ── 其他内联样式弹窗通用优化 ── */
[data-theme="dark"] [style*="color:#202124"] {
    color: var(--md-on-surface) !important;
}

[data-theme="dark"] [style*="color:var(--md-on-surface-variant)"] {
    color: var(--md-on-surface-variant) !important;
}

[data-theme="dark"] [style*="color:var(--md-primary)"] {
    color: var(--md-primary) !important;
}

[data-theme="dark"] [style*="background:#fff"] {
    background: var(--md-surface-container) !important;
}

[data-theme="dark"] [style*="background:#f8f9fa"] {
    background: var(--md-surface-container-high) !important;
}

[data-theme="dark"] [style*="background:#f1f3f4"] {
    background: var(--md-surface-container-high) !important;
}

[data-theme="dark"] [style*="background:var(--md-secondary-container)"] {
    background: var(--md-primary) !important;
}

/* ── 深色模式下蓝色背景非按钮元素 → 维持 var(--md-primary) 蓝色 ── */
[data-theme="dark"] [style*="background:var(--md-primary)"]:not(button):not([id="navLoginBtn"]) {
    background: var(--md-primary) !important;
    color: var(--md-on-primary) !important;
}

/* ── 深色模式下 var(--md-primary-hover) hover 背景 — 排除登录/注册/更新等操作按钮 ── */
[data-theme="dark"] [style*="background:var(--md-primary-hover)"]:not(#loginSubmitBtn):not(#regSubmitBtn):not(#wxVerifyBtn):not(#navLoginBtn):not(button[data-action="update-reload"]):not(button[data-action="auth-do-bind"]) {
    background: var(--md-primary) !important;
    color: var(--md-on-primary) !important;
}

[data-theme="dark"] [style*="background:var(--md-success-container)"] {
    background: var(--md-success-container) !important;
}

[data-theme="dark"] [style*="border-color:var(--md-outline)"] {
    border-color: var(--md-outline-variant) !important;
}

[data-theme="dark"] [style*="border:1px solid var(--md-outline)"] {
    border-color: var(--md-outline-variant) !important;
}

[data-theme="dark"] [style*="border:1px solid var(--md-surface-variant)"] {
    border-color: var(--md-outline-variant) !important;
}

/* ══════════════════════════════════════
   pages.css 硬编码颜色深色模式覆盖
══════════════════════════════════════ */

/* ── 登录/注册页背景渐变 ── */
[data-theme="dark"] .auth-page {
    background: radial-gradient(circle at 50% 0%, var(--md-primary) 0%, transparent 60%),
                var(--md-surface);
}

/* ── Hero 区域 — 基础值已用 CSS 变量，仅保留深色特有覆盖 ── */
    background: var(--md-surface-container-high);
    border-color: var(--md-primary);
}

/* ── 旧版 Hero 渐变 ── */
[data-theme="dark"] .hero {
    background: radial-gradient(circle at 50% 0%, var(--md-primary) 0%, transparent 70%);
}

/* ── 统计卡片 hover ── */
[data-theme="dark"] .stat-card:hover {
    background: var(--md-surface-container-high);
}

/* ── 作品缩略图占位 ── */
[data-theme="dark"] .work-thumb-placeholder {
    background: var(--md-primary);
    color: var(--md-on-primary);
}

/* ── Canvas 工具栏按钮 ── */
[data-theme="dark"] .toolbar-btn {
    background: rgba(32, 33, 36, 0.9);
}

[data-theme="dark"] .toolbar-btn:hover {
    background: var(--md-surface-container-high);
}

/* ── 历史记录状态颜色 ── */
/* ── 历史记录状态颜色 — 已由 pages.css 内联规则覆盖 ── */

/* ── 历史记录错误状态 ── */
[data-theme="dark"] .history-item-error {
    background: rgba(242, 184, 181, 0.08);
    border-color: rgba(242, 184, 181, 0.2);
}

[data-theme="dark"] .history-item-error:hover {
    background: rgba(242, 184, 181, 0.14);
    border-color: rgba(242, 184, 181, 0.3);
    box-shadow: none;
}

/* ── 历史记录过期状态 ── */
[data-theme="dark"] .history-item.history-item-expired {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .history-item.history-item-expired:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.16);
}

[data-theme="dark"] .history-item-expired .history-item-placeholder {
    background: linear-gradient(135deg, var(--md-surface-container-high), var(--md-surface-container));
}

[data-theme="dark"] .history-item-placeholder-error {
    background: var(--md-error-container);
    color: var(--md-on-error-container);
}

[data-theme="dark"] .history-item-error .history-item-placeholder {
    background: var(--md-error-container);
}

/* ── 历史记录菜单按钮 hover ── */
[data-theme="dark"] .history-menu-btn:hover {
    background: rgba(168, 199, 250, 0.08);
}

[data-theme="dark"] .history-menu-btn:active {
    background: rgba(168, 199, 250, 0.14);
}

/* ── 排行榜奖牌颜色 ── */
[data-theme="dark"] .rank-no.gold { color: var(--md-warning); }
[data-theme="dark"] .rank-no.silver { color: var(--md-on-surface-variant); }
[data-theme="dark"] .rank-no.bronze { color: var(--google-red); }

/* ── 社区页 cp-hero ── */
[data-theme="dark"] .cp-hero {
    background: linear-gradient(180deg, var(--md-primary) 0%, var(--md-surface) 100%);
}

/* ── 社区页统计行 — 基础值已用 CSS 变量，此处仅保留深色特有 ── */

/* ── 社区页 Chip ── */
[data-theme="dark"] .cp-chip:hover {
    background: var(--md-surface-container-high);
}

[data-theme="dark"] .cp-chip.active {
    background: var(--md-primary);
    border-color: var(--md-primary);
    color: var(--md-on-primary);
}

/* ── 社区页作品网格 — 基础值已用 CSS 变量 ── */

[data-theme="dark"] .cp-work-card:hover {
    background: var(--md-surface-container-high);
}

[data-theme="dark"] .cp-work-placeholder {
    background: var(--md-primary);
    color: var(--md-on-primary);
}

/* ── 社区页 Widget — 基础值已用 CSS 变量 ── */

[data-theme="dark"] .cp-widget-head {
    border-color: var(--md-outline-variant);
}

[data-theme="dark"] .cp-widget-title {
    color: var(--md-on-surface);
}

/* ── 社区页排行榜 ── */
[data-theme="dark"] .cp-rank-row:hover {
    background: var(--md-surface-container-high);
}

[data-theme="dark"] .cp-rank-name {
    color: var(--md-on-surface);
}

[data-theme="dark"] .cp-challenge-name {
    color: var(--md-on-surface);
}

[data-theme="dark"] .cp-divider {
    background: var(--md-outline-variant);
}

[data-theme="dark"] .cp-loading-row {
    background: var(--md-surface-container);
}

[data-theme="dark"] .cp-rank-no.gold { color: var(--md-warning); }
[data-theme="dark"] .cp-rank-no.silver { color: var(--md-on-surface-variant); }
[data-theme="dark"] .cp-rank-no.bronze { color: var(--google-red); }

/* ── 工作流分类悬浮 ── */
[data-theme="dark"] .wf-cat-item:hover {
    background: var(--md-surface-container-high);
    color: var(--md-on-surface);
}

/* ── 工作流功能卡片 ── */
[data-theme="dark"] .wf-card:hover {
    background: var(--md-surface-container-high);
}
[data-theme="dark"] .wf-card.active {
    background: var(--md-surface-container-high);
}
[data-theme="dark"] .wf-card-thumb {
    background: var(--md-surface-container);
    border-color: var(--md-outline-variant);
}
[data-theme="dark"] .wf-card-name {
    color: var(--md-on-surface);
}
[data-theme="dark"] .wf-card-cost {
    color: var(--md-primary);
}
[data-theme="dark"] .wf-card-desc {
    color: var(--md-on-surface-variant);
}
[data-theme="dark"] .wf-search {
    background: var(--md-surface-container);
    border-color: var(--md-outline);
    color: var(--md-on-surface);
}
[data-theme="dark"] .wf-search::placeholder {
    color: var(--md-on-surface-dim);
}
[data-theme="dark"] .wf-search:focus {
    background: var(--md-surface-container-high);
    border-color: var(--md-primary);
    box-shadow: 0 0 0 2px rgba(168, 199, 250, 0.25);
}
[data-theme="dark"] .wf-cat-label {
    color: var(--md-on-surface-dim);
}
[data-theme="dark"] .wf-close-btn:hover {
    background: var(--md-surface-container-high);
}
[data-theme="dark"] .wf-thumb-placeholder {
    color: var(--md-on-surface-dim);
}

/* ── 实验室页面（参数面板、画布、上传区） ── */
[data-theme="dark"] .panel {
    background: var(--md-surface-container);
}
[data-theme="dark"] .main-canvas {
    background: var(--md-surface-container);
}
[data-theme="dark"] .history-panel {
    background: var(--md-surface-container);
}
[data-theme="dark"] .workflow-select {
    background: var(--md-surface-container);
    border-color: var(--md-outline);
}
[data-theme="dark"] .workflow-select:hover {
    background: var(--md-surface-container-high);
}
[data-theme="dark"] .workflow-select.selected {
    background: var(--md-primary-container);
    border-color: var(--md-primary-container);
}
[data-theme="dark"] .wf-placeholder {
    color: var(--md-on-surface-variant);
}
[data-theme="dark"] .dropzone {
    background: var(--md-surface-container);
    border-color: var(--md-outline);
    color: var(--md-on-surface-variant);
}
[data-theme="dark"] .dropzone:hover {
    background: var(--md-primary-container);
    border-color: var(--md-primary);
    color: var(--md-primary);
}
[data-theme="dark"] .dropzone.dragover {
    background: var(--md-primary-container);
    border-color: var(--md-primary);
}
[data-theme="dark"] .canvas-text-result {
    background: var(--md-surface-container);
}
[data-theme="dark"] .canvas-text-header {
    border-bottom-color: var(--md-outline-variant);
    color: var(--md-on-surface);
}
[data-theme="dark"] .canvas-text-body {
    color: var(--md-on-surface);
}
[data-theme="dark"] .canvas-text-actions {
    border-top-color: var(--md-outline-variant);
}
[data-theme="dark"] .dz-preview-label {
    background: var(--md-primary-container);
    color: var(--md-primary);
}
[data-theme="dark"] .dz-preview-media {
    background: var(--md-surface-container);
}
[data-theme="dark"] .dz-preview-icon {
    background: var(--md-surface-container);
    color: var(--md-primary);
}
[data-theme="dark"] .canvas-placeholder {
    color: var(--md-on-surface-dim);
}
[data-theme="dark"] .canvas-placeholder p {
    color: var(--md-on-surface-variant);
}
[data-theme="dark"] .panel-title {
    color: var(--md-on-surface);
}
[data-theme="dark"] .input-label {
    color: var(--md-on-surface-variant);
}

/* ── 对话框 ── */
[data-theme="dark"] .dialog-header {
    border-bottom-color: var(--md-outline-variant);
}

/* ── 社区页 cp-hero-btn 深色模式 ── */
[data-theme="dark"] .cp-hero-btn {
    background: var(--md-primary) !important;
    color: var(--md-on-primary) !important;
}

/* ── 社区页 cp-stat-divider ── */
[data-theme="dark"] .cp-stat-divider {
    background: var(--md-outline-variant);
}

/* ── 账户页余额渐变 ── */
[data-theme="dark"] .balance-gradient {
    background: linear-gradient(135deg, var(--md-primary), var(--md-surface-container-high));
}

/* ── 错误文本颜色 ── */
[data-theme="dark"] .text-error,
[data-theme="dark"] .error-text {
    color: var(--md-error) !important;
}

/* ── 白色背景面板通用覆盖 ── */
[data-theme="dark"] .panel-white,
[data-theme="dark"] .bg-white {
    background: var(--md-surface-container);
}

/* ── 价格标签优化 ── */
[data-theme="dark"] .price-badge {
    background: var(--md-primary);
    color: var(--md-on-primary);
}

/* ── 算力余额显示 ── */
[data-theme="dark"] .balance-display {
    color: var(--md-on-surface);
}

/* ══════════════════════════════════════
   Google M3 暗夜模式 — 内联样式全局覆盖
══════════════════════════════════════ */

/* ── SVG 图标 fill/stroke 硬编码蓝色 ── */
[data-theme="dark"] svg [fill="var(--md-primary)"],
[data-theme="dark"] svg[fill="var(--md-primary)"] {
    fill: var(--md-primary) !important;
}
[data-theme="dark"] svg [stroke="var(--md-primary)"],
[data-theme="dark"] svg[stroke="var(--md-primary)"] {
    stroke: var(--md-primary) !important;
}
[data-theme="dark"] svg [fill="var(--md-on-surface-variant)"],
[data-theme="dark"] svg[fill="var(--md-on-surface-variant)"] {
    fill: var(--md-on-surface-variant) !important;
}
[data-theme="dark"] svg [stroke="var(--md-on-surface-variant)"],
[data-theme="dark"] svg[stroke="var(--md-on-surface-variant)"] {
    stroke: var(--md-on-surface-variant) !important;
}

/* ── 输入框聚焦蓝色边框 ── */
[data-theme="dark"] input[onfocus*="'var(--md-primary)'"],
[data-theme="dark"] input[onfocus*="borderColor='var(--md-primary)'"] {
    transition: border-color 0.15s, box-shadow 0.15s;
}

/* ── authOverlay 深色模式全面覆盖 ── */
[data-theme="dark"] #authOverlay .auth-card,
[data-theme="dark"] #authOverlay > div {
    background: var(--md-surface-container) !important;
}
/* auth 关闭按钮深色模式 */
[data-theme="dark"] #authOverlay button[data-action="auth-close"] {
    color: var(--md-on-surface-variant) !important;
}
[data-theme="dark"] #authOverlay button[data-action="auth-close"]:hover {
    background: var(--md-surface-container-high) !important;
}
/* auth Logo SVG */
[data-theme="dark"] #authOverlay svg [fill="var(--md-primary)"],
[data-theme="dark"] #authOverlay svg[fill="var(--md-primary)"] {
    fill: var(--md-primary) !important;
}
[data-theme="dark"] #authOverlay h3,
[data-theme="dark"] #authOverlay h2 {
    color: var(--md-on-surface) !important;
}
[data-theme="dark"] #authOverlay p,
[data-theme="dark"] #authOverlay span,
[data-theme="dark"] #authOverlay label {
    color: var(--md-on-surface-variant) !important;
}
[data-theme="dark"] #authOverlay input {
    background: var(--md-surface-container-high) !important;
    border-color: var(--md-outline) !important;
    color: var(--md-on-surface) !important;
}
[data-theme="dark"] #authOverlay input::placeholder {
    color: var(--md-on-surface-dim) !important;
}
[data-theme="dark"] #authOverlay input:focus {
    border-color: var(--md-primary) !important;
    box-shadow: 0 0 0 2px rgba(168, 199, 250, 0.18) !important;
}
[data-theme="dark"] #authOverlay button {
    border-color: var(--md-outline-variant) !important;
}
[data-theme="dark"] #authOverlay a,
[data-theme="dark"] #authOverlay [data-action] {
    color: var(--md-primary) !important;
}

/* ── updateOverlay 深色模式全面覆盖 ── */
[data-theme="dark"] #updateOverlay > div {
    background: var(--md-surface-container) !important;
}
/* 更新弹窗头部蓝色渐变 → 维持蓝色渐变 */
[data-theme="dark"] #updateOverlay > div > div:first-child {
    background: linear-gradient(135deg, var(--md-primary), var(--md-info-container)) !important;
}
[data-theme="dark"] #updateOverlay > div > div:first-child * {
    color: var(--md-on-primary) !important;
}
[data-theme="dark"] #updateOverlay > div > div:first-child svg {
    stroke: var(--md-on-primary) !important;
}
[data-theme="dark"] #updateOverlay > div > div:first-child div {
    background: rgba(255, 255, 255, 0.15) !important;
}
[data-theme="dark"] #updateOverlay h2 {
    color: var(--md-on-surface) !important;
}
[data-theme="dark"] #updateOverlay p {
    color: var(--md-on-surface-variant) !important;
}
[data-theme="dark"] #updateOverlay button[data-action="update-skip"] {
    background: var(--md-surface-container-high) !important;
    color: var(--md-on-surface) !important;
    border-color: var(--md-outline-variant) !important;
}
[data-theme="dark"] #updateOverlay button[data-action="update-skip"]:hover {
    background: var(--md-surface-container-highest) !important;
}
[data-theme="dark"] #updateOverlay button[data-action="update-reload"] {
    background: var(--md-primary) !important;
    color: var(--md-on-primary) !important;
}
[data-theme="dark"] #updateOverlay button[data-action="update-reload"]:hover {
    background: var(--md-primary-hover) !important;
    color: var(--md-on-primary) !important;
}

/* ── accountSubOverlay 深色模式全面覆盖 ── */
[data-theme="dark"] #accountSubOverlay > div {
    background: var(--md-surface-container) !important;
}
[data-theme="dark"] #accountSubOverlay h2,
[data-theme="dark"] #accountSubOverlay h3 {
    color: var(--md-on-surface) !important;
}
[data-theme="dark"] #accountSubOverlay p,
[data-theme="dark"] #accountSubOverlay span,
[data-theme="dark"] #accountSubOverlay label {
    color: var(--md-on-surface-variant) !important;
}
[data-theme="dark"] #accountSubOverlay input {
    background: var(--md-surface-container-high) !important;
    border-color: var(--md-outline) !important;
    color: var(--md-on-surface) !important;
}
[data-theme="dark"] #accountSubOverlay input::placeholder {
    color: var(--md-on-surface-dim) !important;
}
[data-theme="dark"] #accountSubOverlay input:focus {
    border-color: var(--md-primary) !important;
    box-shadow: 0 0 0 2px rgba(168, 199, 250, 0.18) !important;
}

/* ── navLoginBtn 深色模式 — 维持蓝色搭配 ── */
[data-theme="dark"] #navLoginBtn {
    background: var(--md-primary) !important;
    color: var(--md-on-primary) !important;
}
[data-theme="dark"] #navLoginBtn:hover {
    background: var(--md-primary-hover) !important;
    color: var(--md-on-primary) !important;
}
[data-theme="dark"] #navLoginBtn svg {
    fill: currentColor !important;
}

/* ── 算力加号按钮 深色模式 — 亮蓝色 ── */
[data-theme="dark"] .balance-add-btn {
    background: var(--md-primary) !important;
    color: var(--md-on-primary) !important;
}
[data-theme="dark"] .balance-add-btn:hover {
    background: var(--md-primary-hover) !important;
}

/* ── 步骤圆圈 fsc1 ── */
[data-theme="dark"] [id^="fsc"] {
    background: var(--md-primary) !important;
    color: var(--md-on-primary) !important;
}

/* ── "换一批" 按钮深色模式 ── */
[data-theme="dark"] #refreshWorksBtn {
    color: var(--md-primary) !important;
    background: transparent !important;
}
[data-theme="dark"] #refreshWorksBtn:hover {
    background: rgba(168, 199, 250, 0.08) !important;
}
[data-theme="dark"] #refreshWorksBtn svg {
    stroke: var(--md-primary) !important;
}

/* ── "最新" 标签深色模式 ── */
[data-theme="dark"] [style*="background:var(--md-secondary-container)"] span,
[data-theme="dark"] [style*="background:var(--md-secondary-container)"] svg {
    color: var(--md-on-primary) !important;
}
[data-theme="dark"] [style*="background:var(--md-secondary-container)"] svg [fill="var(--md-primary)"],
[data-theme="dark"] [style*="background:var(--md-secondary-container)"] svg[fill="var(--md-primary)"] {
    fill: var(--md-on-primary) !important;
}

/* ── 平台动态 "最新" badge 内 SVG ── */
[data-theme="dark"] #platform-news svg[fill="var(--md-primary)"] {
    fill: var(--md-on-primary) !important;
}
[data-theme="dark"] #platform-news [style*="color:var(--md-primary)"] {
    color: var(--md-on-primary) !important;
}

/* ── Landing 页 footer logo 深色模式 ── */
[data-theme="dark"] .sf-logo svg [fill="var(--md-primary)"],
[data-theme="dark"] .sf-logo svg[fill="var(--md-primary)"] {
    fill: var(--md-primary) !important;
}

/* ── 全局 box-shadow 硬编码蓝色适配 ── */
[data-theme="dark"] [style*="rgba(26,115,232"] {
    box-shadow: 0 0 0 2px rgba(168, 199, 250, 0.18) !important;
}

/* ── authOverlay 登录/注册按钮聚焦样式重写 ── */
[data-theme="dark"] #loginUser:focus,
[data-theme="dark"] #loginPassword:focus,
[data-theme="dark"] #regUser:focus,
[data-theme="dark"] #regEmail:focus,
[data-theme="dark"] #regPassword:focus,
[data-theme="dark"] #regConfirm:focus,
[data-theme="dark"] #fUser:focus,
[data-theme="dark"] #fCode:focus,
[data-theme="dark"] #fPwd:focus,
[data-theme="dark"] #fConfirm:focus,
[data-theme="dark"] #bindUser:focus,
[data-theme="dark"] #bindPwd:focus,
[data-theme="dark"] #wxCodeInput:focus {
    border-color: var(--md-primary) !important;
    box-shadow: 0 0 0 2px rgba(168, 199, 250, 0.18) !important;
}

/* ── authOverlay 所有填充按钮 — 维持白天模式蓝色搭配 ── */
[data-theme="dark"] #loginSubmitBtn,
[data-theme="dark"] #regSubmitBtn,
[data-theme="dark"] #wxVerifyBtn,
[data-theme="dark"] #fVerifyBtn,
[data-theme="dark"] #fResetBtn,
[data-theme="dark"] button[data-action="auth-do-bind"],
[data-theme="dark"] button[data-action="auth-show-login"][style*="background:var(--md-primary)"],
[data-theme="dark"] button[data-action="auth-show-login"][style*="前往登录"] {
    background: var(--md-primary) !important;
    color: var(--md-on-primary) !important;
}
[data-theme="dark"] #loginSubmitBtn:hover,
[data-theme="dark"] #regSubmitBtn:hover,
[data-theme="dark"] #wxVerifyBtn:hover,
[data-theme="dark"] #fVerifyBtn:hover,
[data-theme="dark"] #fResetBtn:hover,
[data-theme="dark"] button[data-action="auth-do-bind"]:hover {
    background: var(--md-primary-hover) !important;
    color: var(--md-on-primary) !important;
}

/* ── 密码重置成功页按钮 ── */
[data-theme="dark"] button[data-action="auth-show-login"][style*="background:var(--md-primary)"] {
    background: var(--md-primary) !important;
    color: var(--md-on-primary) !important;
}

/* ── authOverlay 重新扫码链接 ── */
[data-theme="dark"] button[data-action="auth-reset-wx"] {
    background: transparent !important;
    color: var(--md-primary) !important;
}

/* ── 滑块验证码深色模式 ── */
[data-theme="dark"] .captcha-box {
    background: var(--md-surface-container-high) !important;
    border-color: var(--md-outline) !important;
}
[data-theme="dark"] .captcha-box:hover {
    background: var(--md-primary) !important;
    border-color: var(--md-primary) !important;
}

/* ── 微信扫码区域深色模式 ── */
[data-theme="dark"] .wx-code-input {
    border-color: var(--md-outline) !important;
    color: var(--md-on-surface) !important;
    background: var(--md-surface-container-high) !important;
}
[data-theme="dark"] .wx-code-input:focus {
    border-color: var(--md-primary) !important;
    box-shadow: 0 0 0 2px rgba(168, 199, 250, 0.18) !important;
}

/* ── 社区对话框中"开始创作"按钮 ── */
[data-theme="dark"] button[style*="background:var(--md-primary)"] {
    background: var(--md-primary) !important;
    color: var(--md-on-primary) !important;
}
[data-theme="dark"] button[style*="background:var(--md-primary)"]:hover {
    background: var(--md-primary-hover) !important;
}

/* ── 内联 style 中 #202124 文字色覆盖 ── */
[data-theme="dark"] [style*="color:#202124"] {
    color: var(--md-on-surface) !important;
}

/* ── 内联 style 中 var(--md-on-surface-dim) 文字色覆盖 ── */
[data-theme="dark"] [style*="color:var(--md-on-surface-dim)"] {
    color: var(--md-on-surface-dim) !important;
}

/* ── 内联 style 中 var(--md-outline) 边框覆盖 ── */
[data-theme="dark"] input[style*="border:1px solid var(--md-outline)"],
[data-theme="dark"] input[style*="border-color:var(--md-outline)"] {
    border-color: var(--md-outline) !important;
}

/* ── 内联 style 中 #fff 背景输入框 ── */
[data-theme="dark"] input[style*="background:#fff"] {
    background: var(--md-surface-container-high) !important;
    color: var(--md-on-surface) !important;
}

/* ── 内联 style 中 rgba(26,115,232,0.08) 悬浮背景 ── */
[data-theme="dark"] [style*="rgba(26,115,232,0.08)"] {
    background: rgba(168, 199, 250, 0.08) !important;
}

/* ── 内联 style 中蓝色按钮 hover 时维持 var(--md-primary-hover) ── */
[data-theme="dark"] button[onmouseover*="'var(--md-primary-hover)'"] {
    transition: background 0.15s;
}
[data-theme="dark"] button[onmouseover*="'var(--md-primary-hover)'"]:hover {
    background: var(--md-primary-hover) !important;
    color: var(--md-on-primary) !important;
}

/* ── select 下拉框深色模式 ── */
[data-theme="dark"] select {
    background: var(--md-surface-container-high);
    color: var(--md-on-surface);
    border-color: var(--md-outline);
}

/* ── 密码强度指示器深色模式 ── */
[data-theme="dark"] #fPwdBar {
    background: var(--md-outline-variant) !important;
}

/* ── 社区 rank 头像深色模式 ── */
[data-theme="dark"] [style*="background:var(--md-primary-container)"][style*="color:var(--md-primary)"] {
    background: var(--md-primary) !important;
    color: var(--md-on-primary) !important;
}

/* ── 登录页 Google 按钮 ── */
[data-theme="dark"] .btn-google {
    background: var(--md-surface-container);
    border-color: var(--md-outline-variant);
    color: var(--md-on-surface);
}

[data-theme="dark"] .btn-google:hover {
    background: var(--md-surface-container-high);
}

/* ── 基础按钮类深色模式覆盖（components.css / pages.css / auth.css） ── */
[data-theme="dark"] .btn-filled {
    background: var(--md-primary) !important;
    color: var(--md-on-primary) !important;
}
[data-theme="dark"] .btn-filled:hover {
    background: var(--md-primary-hover) !important;
}
[data-theme="dark"] .btn-expressive-filled {
    background: var(--md-primary) !important;
    color: var(--md-on-primary) !important;
}
[data-theme="dark"] .scroll-top-btn {
    background: var(--md-primary) !important;
    color: var(--md-on-primary) !important;
}
[data-theme="dark"] .status-running {
    background: var(--md-primary) !important;
}
[data-theme="dark"] .step-circle.active {
    background: var(--md-primary) !important;
    color: var(--md-on-primary) !important;
}

