/* 防止首次加载时出现非目标语言（中文兜底）的闪烁 */
html.i18n-loading body { visibility: hidden; }

:root {
    --bg: #f4f7fb;
    --bg-gradient:
        radial-gradient(1100px 520px at 78% -12%, rgba(14, 165, 233, 0.10), transparent 60%),
        radial-gradient(900px 480px at 8% -8%, rgba(99, 102, 241, 0.09), transparent 55%),
        linear-gradient(180deg, #f4f7fb 0%, #eef2f8 100%);
    --surface: #ffffff;
    --surface-alt: #f6f8fc;
    --surface-hover: #eef2f8;
    --border: rgba(15, 23, 42, 0.10);
    --border-strong: rgba(15, 23, 42, 0.20);
    --text: #17233b;
    --text-muted: #46536b;
    --text-faint: #6d7b94;
    --brand: #0891b2;
    --brand-hover: #0e7490;
    --brand-soft: rgba(34, 211, 238, 0.12);
    --brand-gradient: linear-gradient(135deg, #0ea5e9 0%, #0891b2 100%);
    --brand-glow: 0 0 0 4px rgba(14, 165, 233, 0.12);
    --brand-icon: #0891b2;
    --correct: #059669;
    --correct-bg: #d1fae5;
    --incorrect: #d63355;
    --incorrect-bg: #fee2e2;
    --current: #0891b2;
    --current-bg: rgba(34, 211, 238, 0.14);
    --cursor: #0891b2;
    --success: #059669;
    --warning: #b45309;
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.10), 0 2px 6px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 18px 50px rgba(15, 23, 42, 0.16), 0 6px 16px rgba(15, 23, 42, 0.07);
    --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.03);
    --header-h: 60px;
    --footer-h: 38px;
    --radius-sm: 9px;
    --radius: 14px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    /* 文艺风标题字体（优先使用系统宋体 / 衬线字体） */
    --font-serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", "Iowan Old Style", Georgia, "Times New Roman", serif;
    /* 主题派生变量（供硬编码品牌色处统一引用） */
    --header-bg: rgba(255, 255, 255, 0.82);
    --header-accent-line: linear-gradient(90deg, transparent, rgba(14, 165, 233, 0.18) 30%, rgba(14, 165, 233, 0.30) 50%, rgba(14, 165, 233, 0.18) 70%, transparent);
    --nav-hover: rgba(15, 23, 42, 0.05);
    --brand-alt: #4ee0c8;
    --brand-border: rgba(34, 211, 238, 0.35);
    --brand-glow-strong: 0 4px 18px rgba(34, 211, 238, 0.35);
    --brand-icon-bg: linear-gradient(145deg, rgba(34, 211, 238, 0.22), rgba(14, 165, 233, 0.08));
    --brand-icon-border: rgba(34, 211, 238, 0.35);
    --brand-icon-glow: 0 0 16px rgba(34, 211, 238, 0.22);
    --btn-primary-shadow: 0 4px 16px rgba(14, 165, 233, 0.30);
    --btn-primary-shadow-hover: 0 6px 20px rgba(14, 165, 233, 0.45);
    --btn-primary-fg: #ffffff;
    --overlay: rgba(15, 23, 42, 0.55);
}

[data-theme="dark"] {
    --bg: #070b12;
    --bg-gradient:
        radial-gradient(1100px 520px at 78% -12%, rgba(34, 211, 238, 0.10), transparent 60%),
        radial-gradient(900px 480px at 8% -8%, rgba(99, 102, 241, 0.10), transparent 55%),
        linear-gradient(180deg, #070b12 0%, #0b111c 100%);
    --surface: #101827;
    --surface-alt: #151f31;
    --surface-hover: #1b2740;
    --border: rgba(148, 178, 255, 0.12);
    --border-strong: rgba(148, 178, 255, 0.24);
    --text: #e8eefb;
    --text-muted: #aebbd4;
    --text-faint: #74829e;
    --brand: #22d3ee;
    --brand-hover: #67e8f9;
    --brand-soft: rgba(34, 211, 238, 0.14);
    --brand-gradient: linear-gradient(135deg, #22d3ee 0%, #0ea5e9 100%);
    --brand-glow: 0 0 0 4px rgba(34, 211, 238, 0.16);
    --brand-icon: #22d3ee;
    --correct: #34d399;
    --correct-bg: #064e3b;
    --incorrect: #fb5d75;
    --incorrect-bg: #450a0a;
    --current: #22d3ee;
    --current-bg: rgba(34, 211, 238, 0.16);
    --cursor: #22d3ee;
    --success: #34d399;
    --warning: #fbbf24;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 20px 55px rgba(0, 0, 0, 0.6), 0 6px 16px rgba(0, 0, 0, 0.35);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.2);
    --header-bg: rgba(9, 13, 22, 0.82);
    --header-accent-line: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.18) 30%, rgba(34, 211, 238, 0.30) 50%, rgba(34, 211, 238, 0.18) 70%, transparent);
    --nav-hover: rgba(148, 178, 255, 0.08);
    --brand-alt: #67e8f9;
    --brand-border: rgba(34, 211, 238, 0.45);
    --brand-glow-strong: 0 4px 18px rgba(34, 211, 238, 0.35);
    --brand-icon-bg: linear-gradient(145deg, rgba(34, 211, 238, 0.22), rgba(14, 165, 233, 0.08));
    --brand-icon-border: rgba(34, 211, 238, 0.35);
    --brand-icon-glow: 0 0 16px rgba(34, 211, 238, 0.22);
    --btn-primary-shadow: 0 4px 16px rgba(34, 211, 238, 0.28);
    --btn-primary-shadow-hover: 0 6px 20px rgba(34, 211, 238, 0.42);
    --btn-primary-fg: #04161c;
    --overlay: rgba(0, 0, 0, 0.65);
}

/* ============================================================
 * 主题配色 · 面向文字工作者 / 职场用户的六套预设
 *  light 青瓷 · 清透（默认）  ink 墨韵 · 书香
 *  rose  桃笺 · 温婉        biz 商务 · 沉稳
 *  mono  极简 · 素白        dark 夜色 · 专注
 * ============================================================ */

/* 墨韵 · 书香 —— 宣纸暖白 + 朱砂 */
[data-theme="ink"] {
    --bg: #f4efe4;
    --bg-gradient:
        radial-gradient(1100px 520px at 78% -12%, rgba(168, 69, 47, 0.07), transparent 60%),
        radial-gradient(900px 480px at 8% -8%, rgba(120, 96, 62, 0.09), transparent 55%),
        linear-gradient(180deg, #f8f4ec 0%, #f0e9da 100%);
    --surface: #fdfaf4;
    --surface-alt: #f7f1e6;
    --surface-hover: #f0e7d7;
    --border: rgba(72, 58, 40, 0.14);
    --border-strong: rgba(72, 58, 40, 0.26);
    --text: #2c2823;
    --text-muted: #5a5145;
    --text-faint: #8a7e6c;
    --brand: #a8452f;
    --brand-hover: #8c3623;
    --brand-soft: rgba(168, 69, 47, 0.10);
    --brand-gradient: linear-gradient(135deg, #c25c3f 0%, #98361f 100%);
    --brand-glow: 0 0 0 4px rgba(168, 69, 47, 0.12);
    --brand-icon: #a8452f;
    --brand-alt: #b06f38;
    --brand-border: rgba(168, 69, 47, 0.32);
    --brand-glow-strong: 0 4px 18px rgba(168, 69, 47, 0.28);
    --brand-icon-bg: linear-gradient(145deg, rgba(217, 161, 92, 0.28), rgba(168, 69, 47, 0.10));
    --brand-icon-border: rgba(168, 69, 47, 0.30);
    --brand-icon-glow: 0 0 16px rgba(168, 69, 47, 0.18);
    --header-bg: rgba(250, 246, 236, 0.86);
    --header-accent-line: linear-gradient(90deg, transparent, rgba(168, 69, 47, 0.14) 30%, rgba(168, 69, 47, 0.28) 50%, rgba(168, 69, 47, 0.14) 70%, transparent);
    --nav-hover: rgba(72, 58, 40, 0.06);
    --btn-primary-shadow: 0 4px 16px rgba(168, 69, 47, 0.24);
    --btn-primary-shadow-hover: 0 6px 20px rgba(168, 69, 47, 0.38);
    --correct: #4f7a3d;
    --correct-bg: #e4eed7;
    --incorrect: #b83b32;
    --incorrect-bg: #f7e2dd;
    --current: #a8452f;
    --current-bg: rgba(168, 69, 47, 0.12);
    --cursor: #a8452f;
    --success: #4f7a3d;
    --warning: #96651b;
    --shadow-xs: 0 1px 2px rgba(72, 58, 40, 0.05);
    --shadow: 0 1px 3px rgba(72, 58, 40, 0.08), 0 1px 2px rgba(72, 58, 40, 0.05);
    --shadow-md: 0 4px 14px rgba(72, 58, 40, 0.10), 0 2px 6px rgba(72, 58, 40, 0.06);
    --shadow-lg: 0 18px 50px rgba(72, 58, 40, 0.16), 0 6px 16px rgba(72, 58, 40, 0.08);
    --shadow-card: 0 1px 3px rgba(72, 58, 40, 0.07), 0 1px 2px rgba(72, 58, 40, 0.04);
    --overlay: rgba(52, 42, 30, 0.55);
}

/* 桃笺 · 温婉 —— 柔粉暖调 */
[data-theme="rose"] {
    --bg: #fdf5f6;
    --bg-gradient:
        radial-gradient(1100px 520px at 78% -12%, rgba(219, 108, 139, 0.10), transparent 60%),
        radial-gradient(900px 480px at 8% -8%, rgba(214, 168, 190, 0.12), transparent 55%),
        linear-gradient(180deg, #fdf6f7 0%, #f8edf1 100%);
    --surface: #fffdfd;
    --surface-alt: #fdf2f4;
    --surface-hover: #f9e6eb;
    --border: rgba(92, 48, 62, 0.12);
    --border-strong: rgba(92, 48, 62, 0.22);
    --text: #3a2830;
    --text-muted: #6b5560;
    --text-faint: #9a818c;
    --brand: #c0556f;
    --brand-hover: #a3425b;
    --brand-soft: rgba(192, 85, 111, 0.11);
    --brand-gradient: linear-gradient(135deg, #e17b98 0%, #b5496b 100%);
    --brand-glow: 0 0 0 4px rgba(192, 85, 111, 0.12);
    --brand-icon: #c0556f;
    --brand-alt: #cf6382;
    --brand-border: rgba(192, 85, 111, 0.32);
    --brand-glow-strong: 0 4px 18px rgba(192, 85, 111, 0.26);
    --brand-icon-bg: linear-gradient(145deg, rgba(239, 179, 194, 0.35), rgba(192, 85, 111, 0.10));
    --brand-icon-border: rgba(192, 85, 111, 0.30);
    --brand-icon-glow: 0 0 16px rgba(192, 85, 111, 0.20);
    --header-bg: rgba(255, 250, 251, 0.84);
    --header-accent-line: linear-gradient(90deg, transparent, rgba(192, 85, 111, 0.14) 30%, rgba(192, 85, 111, 0.26) 50%, rgba(192, 85, 111, 0.14) 70%, transparent);
    --nav-hover: rgba(92, 48, 62, 0.06);
    --btn-primary-shadow: 0 4px 16px rgba(192, 85, 111, 0.24);
    --btn-primary-shadow-hover: 0 6px 20px rgba(192, 85, 111, 0.36);
    --correct: #4f8267;
    --correct-bg: #e3f0e7;
    --incorrect: #bf3f57;
    --incorrect-bg: #fae3e8;
    --current: #c0556f;
    --current-bg: rgba(192, 85, 111, 0.12);
    --cursor: #c0556f;
    --success: #4f8267;
    --warning: #a3741f;
    --shadow-xs: 0 1px 2px rgba(92, 48, 62, 0.05);
    --shadow: 0 1px 3px rgba(92, 48, 62, 0.07), 0 1px 2px rgba(92, 48, 62, 0.04);
    --shadow-md: 0 4px 14px rgba(92, 48, 62, 0.09), 0 2px 6px rgba(92, 48, 62, 0.05);
    --shadow-lg: 0 18px 50px rgba(92, 48, 62, 0.15), 0 6px 16px rgba(92, 48, 62, 0.07);
    --shadow-card: 0 1px 3px rgba(92, 48, 62, 0.06), 0 1px 2px rgba(92, 48, 62, 0.04);
    --overlay: rgba(58, 40, 48, 0.55);
}

/* 商务 · 沉稳 —— 藏蓝专业 */
[data-theme="biz"] {
    --bg: #eef2f7;
    --bg-gradient:
        radial-gradient(1100px 520px at 78% -12%, rgba(37, 99, 235, 0.09), transparent 60%),
        radial-gradient(900px 480px at 8% -8%, rgba(15, 23, 42, 0.06), transparent 55%),
        linear-gradient(180deg, #f2f6fb 0%, #e9eef6 100%);
    --surface: #ffffff;
    --surface-alt: #f4f7fb;
    --surface-hover: #e9eef7;
    --border: rgba(23, 42, 72, 0.11);
    --border-strong: rgba(23, 42, 72, 0.22);
    --text: #17253a;
    --text-muted: #47566e;
    --text-faint: #74829a;
    --brand: #1d4ed8;
    --brand-hover: #1e40af;
    --brand-soft: rgba(37, 99, 235, 0.10);
    --brand-gradient: linear-gradient(135deg, #2563eb 0%, #1e3a8a 100%);
    --brand-glow: 0 0 0 4px rgba(37, 99, 235, 0.12);
    --brand-icon: #1d4ed8;
    --brand-alt: #2563eb;
    --brand-border: rgba(37, 99, 235, 0.32);
    --brand-glow-strong: 0 4px 18px rgba(37, 99, 235, 0.28);
    --brand-icon-bg: linear-gradient(145deg, rgba(96, 165, 250, 0.28), rgba(37, 99, 235, 0.10));
    --brand-icon-border: rgba(37, 99, 235, 0.30);
    --brand-icon-glow: 0 0 16px rgba(37, 99, 235, 0.20);
    --header-bg: rgba(255, 255, 255, 0.84);
    --header-accent-line: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.12) 30%, rgba(37, 99, 235, 0.24) 50%, rgba(37, 99, 235, 0.12) 70%, transparent);
    --nav-hover: rgba(23, 42, 72, 0.05);
    --btn-primary-shadow: 0 4px 16px rgba(37, 99, 235, 0.26);
    --btn-primary-shadow-hover: 0 6px 20px rgba(37, 99, 235, 0.40);
    --correct: #0f7b57;
    --correct-bg: #d9f2e7;
    --incorrect: #c0392b;
    --incorrect-bg: #fbe4e1;
    --current: #1d4ed8;
    --current-bg: rgba(37, 99, 235, 0.12);
    --cursor: #1d4ed8;
    --success: #0f7b57;
    --warning: #a86a12;
    --shadow-xs: 0 1px 2px rgba(23, 42, 72, 0.04);
    --shadow: 0 1px 3px rgba(23, 42, 72, 0.08), 0 1px 2px rgba(23, 42, 72, 0.04);
    --shadow-md: 0 4px 14px rgba(23, 42, 72, 0.10), 0 2px 6px rgba(23, 42, 72, 0.05);
    --shadow-lg: 0 18px 50px rgba(23, 42, 72, 0.16), 0 6px 16px rgba(23, 42, 72, 0.07);
    --shadow-card: 0 1px 3px rgba(23, 42, 72, 0.06), 0 1px 2px rgba(23, 42, 72, 0.03);
    --overlay: rgba(15, 23, 42, 0.55);
}

/* 极简 · 素白 —— 中性灰白 */
[data-theme="mono"] {
    --bg: #f5f5f4;
    --bg-gradient:
        radial-gradient(1100px 520px at 78% -12%, rgba(63, 63, 70, 0.05), transparent 60%),
        radial-gradient(900px 480px at 8% -8%, rgba(120, 120, 128, 0.06), transparent 55%),
        linear-gradient(180deg, #f8f8f7 0%, #f1f1ef 100%);
    --surface: #ffffff;
    --surface-alt: #f7f7f6;
    --surface-hover: #ededeb;
    --border: rgba(28, 28, 30, 0.11);
    --border-strong: rgba(28, 28, 30, 0.22);
    --text: #1c1c1e;
    --text-muted: #57575c;
    --text-faint: #8e8e93;
    --brand: #3f3f46;
    --brand-hover: #27272a;
    --brand-soft: rgba(63, 63, 70, 0.08);
    --brand-gradient: linear-gradient(135deg, #52525b 0%, #27272a 100%);
    --brand-glow: 0 0 0 4px rgba(63, 63, 70, 0.10);
    --brand-icon: #3f3f46;
    --brand-alt: #71717a;
    --brand-border: rgba(63, 63, 70, 0.26);
    --brand-glow-strong: 0 4px 18px rgba(28, 28, 30, 0.20);
    --brand-icon-bg: linear-gradient(145deg, rgba(161, 161, 170, 0.24), rgba(63, 63, 70, 0.08));
    --brand-icon-border: rgba(63, 63, 70, 0.24);
    --brand-icon-glow: 0 0 16px rgba(63, 63, 70, 0.14);
    --header-bg: rgba(252, 252, 251, 0.84);
    --header-accent-line: linear-gradient(90deg, transparent, rgba(63, 63, 70, 0.10) 30%, rgba(63, 63, 70, 0.20) 50%, rgba(63, 63, 70, 0.10) 70%, transparent);
    --nav-hover: rgba(28, 28, 30, 0.05);
    --btn-primary-shadow: 0 4px 16px rgba(28, 28, 30, 0.18);
    --btn-primary-shadow-hover: 0 6px 20px rgba(28, 28, 30, 0.28);
    --correct: #2f6f4f;
    --correct-bg: #e0eee6;
    --incorrect: #b33939;
    --incorrect-bg: #f6e2e2;
    --current: #3f3f46;
    --current-bg: rgba(63, 63, 70, 0.10);
    --cursor: #3f3f46;
    --success: #2f6f4f;
    --warning: #91661a;
    --shadow-xs: 0 1px 2px rgba(28, 28, 30, 0.04);
    --shadow: 0 1px 3px rgba(28, 28, 30, 0.07), 0 1px 2px rgba(28, 28, 30, 0.04);
    --shadow-md: 0 4px 14px rgba(28, 28, 30, 0.09), 0 2px 6px rgba(28, 28, 30, 0.05);
    --shadow-lg: 0 18px 50px rgba(28, 28, 30, 0.15), 0 6px 16px rgba(28, 28, 30, 0.07);
    --shadow-card: 0 1px 3px rgba(28, 28, 30, 0.06), 0 1px 2px rgba(28, 28, 30, 0.03);
    --overlay: rgba(28, 28, 30, 0.55);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button { font-family: inherit; cursor: pointer; }

.app-header {
    position: sticky;
    top: 0;
    height: var(--header-h);
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
}

.app-header::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 1px;
    background: var(--header-accent-line);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    gap: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    flex-shrink: 0;
}

.brand-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: var(--brand-icon-bg);
    border: 1px solid var(--brand-icon-border);
    box-shadow: var(--brand-icon-glow);
    color: var(--brand-icon);
}

.brand-icon svg {
    width: 20px;
    height: 20px;
    display: block;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-name {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: 0.5px;
}

.brand-name em {
    font-style: normal;
    color: var(--brand);
    font-weight: 900;
}

.brand-domain {
    font-size: 11px;
    color: var(--text-faint);
    display: block;
    line-height: 1;
    margin-top: 2px;
    letter-spacing: 0.3px;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    margin-left: 12px;
    overflow-x: auto;
    scrollbar-width: none;
}
.header-nav::-webkit-scrollbar { display: none; }

/* 主导航菜单项：标准文字链接，激活态渐变药丸+发光 */
.nav-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.16s ease;
    white-space: nowrap;
}

.nav-item:hover {
    color: var(--text);
    background: var(--nav-hover);
}

.nav-item.active {
    color: var(--btn-primary-fg);
    background: linear-gradient(135deg, var(--brand), var(--brand-hover));
    box-shadow: var(--brand-glow-strong);
    font-weight: 700;
}

.nav-ico {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
}

/* 右侧工具区（语言、主题） */
.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.nav-util {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-size: 13.5px;
    transition: all 0.15s;
}

.nav-util:hover {
    background: var(--surface-alt);
    border-color: var(--border);
    color: var(--text);
}

.nav-util .nav-ico { width: 16px; height: 16px; }

/* 主题切换器 */
.theme-switch { position: relative; }
.theme-switch .nav-util { cursor: pointer; }
.theme-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    max-width: calc(100vw - 24px);
    max-height: min(72vh, 520px);
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 10px;
    z-index: 1000;
}
.theme-menu.open { display: block; animation: modalIn 0.15s ease-out; }
.theme-menu-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 8px 10px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.theme-menu-head strong { font-size: 13px; font-weight: 700; color: var(--text); }
.theme-menu-head small { font-size: 11px; color: var(--text-faint); }
.theme-list { display: grid; gap: 3px; }
.theme-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: transparent;
    text-align: left;
    transition: background-color 0.14s ease, border-color 0.14s ease;
}
.theme-option:hover { background: var(--surface-hover); }
.theme-option.is-active { background: var(--brand-soft); border-color: var(--brand-border); }
.theme-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex: none;
    width: 62px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
    overflow: hidden;
}
.theme-preview i { display: block; border-radius: 50%; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.55); }
.theme-preview i:nth-child(1) { width: 13px; height: 13px; }
.theme-preview i:nth-child(2) { width: 9px; height: 9px; }
.theme-preview i:nth-child(3) { width: 18px; height: 6px; border-radius: 999px; }
.theme-text { flex: 1; min-width: 0; }
.theme-text strong {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.theme-text small {
    display: block;
    margin-top: 1px;
    font-size: 11px;
    line-height: 1.4;
    color: var(--text-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.theme-check { flex: none; width: 18px; height: 18px; color: var(--brand); opacity: 0; }
.theme-option.is-active .theme-check { opacity: 1; }

.app-main {
    flex: 1;
    min-height: calc(100vh - var(--header-h) - var(--footer-h));
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.app-footer {
    height: var(--footer-h);
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    font-size: 12.5px;
    color: var(--text-faint);
    box-shadow: 0 -1px 0 rgba(0,0,0,0.02);
}

.footer-inner {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-sep { opacity: 0.4; }
.footer-inner a { color: var(--text-muted); text-decoration: none; transition: color 0.15s; }
.footer-inner a:hover { color: var(--brand); }

/* 法律/内容页面卡片（宽度与首页内容区统一） */
.legal-card {
    background: linear-gradient(180deg, var(--surface), var(--surface-alt));
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 36px 40px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 40px;
    line-height: 1.8;
    color: var(--text);
    box-shadow: var(--shadow-md);
}
.legal-card h2 {
    font-size: 18px;
    font-weight: 800;
    margin: 28px 0 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.legal-card h2:first-child { margin-top: 0; }
.legal-card p { margin: 10px 0; color: var(--text-muted); }
.legal-card ul { margin: 10px 0; padding-left: 22px; }
.legal-card li { margin: 6px 0; color: var(--text-muted); }
.legal-card a { color: var(--brand); text-decoration: none; font-weight: 500; }
.legal-card a:hover { text-decoration: underline; }

.stats-bar {
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 12px 22px;
    background: linear-gradient(180deg, var(--surface), var(--surface-alt));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: baseline;
    gap: 7px;
}

.stat-label {
    font-size: 11.5px;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 600;
}

.stat-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--brand);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.stat-value.good { color: var(--correct); }
.stat-value.warn { color: var(--warning); }
.stat-value.bad { color: var(--incorrect); }

.stat-sep { width: 1px; height: 26px; background: var(--border); margin: 0 4px; }

.stats-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* 首页统计工具栏：指标一行 + 操作一行，避免按钮被挤压换行 */
#statsBar {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 10px 18px;
    flex-wrap: wrap;
}

#statsBar .stats-metrics {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: center;
    row-gap: 12px;
    flex: 1 1 100%;
    min-width: 0;
}

#statsBar .stat-item {
    padding: 0 14px;
    border-left: 1px solid var(--border);
    white-space: nowrap;
}

#statsBar .stat-item:first-child {
    border-left: 0;
    padding-left: 2px;
}

#statsBar .stat-value {
    font-size: 20px;
}

#statsBar .progress-mini {
    width: 92px;
}

#statsBar .stats-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 100%;
    margin-top: 10px;
    padding: 10px 0 0;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    justify-content: flex-start;
}

#statsBar .stats-actions .btn {
    padding: 7px 12px;
    font-size: 13px;
    border-radius: 9px;
    white-space: nowrap;
}

/* 打字进行中：操作按钮弱化，悬停或聚焦时恢复（收起按钮始终可见） */
body.is-typing #statsBar .stats-actions > *:not(.stats-toggle) {
    opacity: 0.3;
    filter: saturate(0.5);
    transition: opacity 0.25s ease, filter 0.25s ease;
}

body.is-typing #statsBar .stats-actions:hover > *:not(.stats-toggle),
body.is-typing #statsBar .stats-actions:focus-within > *:not(.stats-toggle) {
    opacity: 1;
    filter: none;
}

/* 操作栏收起 / 展开 */
#statsBar .stats-actions .btn.stats-toggle {
    margin-left: auto;
    padding: 7px 9px;
}

.stats-toggle svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

#statsBar.is-collapsed .stats-toggle svg {
    transform: rotate(180deg);
}

#statsBar.is-collapsed {
    gap: 0 14px;
    flex-wrap: nowrap;
}

#statsBar.is-collapsed .stats-metrics {
    flex: 1 1 auto;
}

#statsBar.is-collapsed .stats-actions {
    flex: 0 0 auto;
    width: auto;
    margin-top: 0;
    padding: 0 0 0 14px;
    border-left: 1px solid var(--border);
    border-top: 0;
    flex-wrap: nowrap;
    justify-content: flex-end;
}

#statsBar.is-collapsed .stats-actions > *:not(.stats-toggle) {
    display: none;
}

@media (max-width: 960px) {
    #statsBar .stats-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        row-gap: 14px;
    }
    #statsBar .stat-item {
        padding: 0 12px;
    }
    #statsBar .stat-item:nth-child(3n + 1) {
        border-left: 0;
    }
    #statsBar .progress-mini {
        width: 72px;
    }
}

@media (max-width: 480px) {
    #statsBar {
        padding: 10px 12px;
    }
    #statsBar .stats-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    #statsBar .stat-item {
        padding: 0;
        border-left: 0;
    }
    #statsBar .stat-item:nth-child(even) {
        padding-left: 10px;
        border-left: 1px solid var(--border);
    }
    #statsBar .stat-value {
        font-size: 18px;
    }
    #statsBar .progress-mini {
        width: 56px;
    }
    #statsBar .stats-actions .btn {
        font-size: 12.5px;
        padding: 6px 10px;
    }
}

/* 全屏专注模式下保持单行工具条，避免遮挡打字区 */
body.zen-mode #statsBar {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 0 14px;
}

body.zen-mode #statsBar .stats-metrics {
    display: flex;
    flex: 0 0 auto;
    grid-template-columns: none;
}

body.zen-mode #statsBar .stat-item {
    padding: 2px 18px;
    border-left: 1px solid var(--border);
}

body.zen-mode #statsBar .stat-item:first-child {
    border-left: 0;
    padding-left: 2px;
}

body.zen-mode #statsBar .stats-actions {
    flex: 0 0 auto;
    margin-top: 0;
    padding: 0 0 0 18px;
    border-top: 0;
    border-left: 1px solid var(--border);
    flex-wrap: nowrap;
    justify-content: flex-start;
}

body.zen-mode #statsBar .stats-actions .btn span:last-child {
    display: none;
}

/* 全屏下收起时保留指标，仅隐藏操作按钮 */
body.zen-mode #statsBar.is-collapsed .stats-actions {
    flex: 0 0 auto;
    width: auto;
    margin: 0 0 0 auto;
    padding: 0 0 0 14px;
    border-left: 1px solid var(--border);
    justify-content: flex-end;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: var(--surface-alt);
    color: var(--text);
    font-size: 13.5px;
    font-weight: 600;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-xs);
}

.btn:hover {
    border-color: var(--brand);
    color: #0f1c30;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}
[data-theme="dark"] .btn:not(.btn-primary):hover { color: #fff; }
.btn:active { transform: translateY(0); }
.btn-primary {
    background: var(--brand);
    color: var(--btn-primary-fg);
    border-color: var(--brand);
    box-shadow: var(--btn-primary-shadow);
}
.btn-primary:hover {
    background: var(--brand-hover);
    border-color: var(--brand-hover);
    color: var(--btn-primary-fg);
    box-shadow: var(--btn-primary-shadow-hover);
}
.btn-danger { background: rgba(251, 93, 117, 0.12); color: var(--incorrect); border-color: rgba(251, 93, 117, 0.4); }
.btn-danger:hover { background: rgba(251, 93, 117, 0.22); color: var(--incorrect); border-color: var(--incorrect); }

.typing-workspace {
    flex: 1;
    display: flex;
    min-height: 480px;
    scroll-margin-top: var(--header-h);
    background: linear-gradient(180deg, var(--surface), var(--surface-alt));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 200px;
}

.panel-header {
    padding: 11px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-alt);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}

.panel-title {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.panel-title .count {
    margin-left: 8px;
    color: var(--text-faint);
    font-weight: 400;
    text-transform: none;
    font-size: 12px;
}

.panel-body {
    flex: 1;
    padding: 28px 32px;
    overflow: auto;
}

.panel-ref {
    flex: 0 0 50%;
    border-right: 1px solid var(--border);
    background: var(--surface);
}

.panel-ref .panel-body {
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px);
    background-size: 100% 32px;
    background-position: 0 28px;
    padding-top: 28px;
    line-height: 32px;
}

.article-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    /* 32px 行盒 + 32px 间距 = 64px，保持与 #refBody 32px 背景线网格对齐 */
    margin: 0 0 32px 0;
    letter-spacing: 0.5px;
}

.article-author {
    font-size: 13px;
    color: var(--text-faint);
    /* 32px 行盒 + 0 间距 = 32px，保证正文行落在背景线上 */
    margin-bottom: 0;
    font-style: italic;
}

.article-content {
    font-size: 16px;
    line-height: 2;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
    text-align: justify;
}

.article-content.code-font {
    font-family: "Cascadia Code", "Fira Code", "Consolas", "Monaco", monospace;
    font-size: 14px;
    line-height: 1.7;
    text-align: left;
    background: var(--surface-alt);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.panel-type {
    flex: 0 0 50%;
    background: var(--surface);
    position: relative;
}

.panel-type .panel-body {
    position: relative;
    padding: 28px 32px;
    line-height: 32px;
    min-height: 100%;
}

.typing-overlay {
    font-size: 16px;
    line-height: 32px;
    white-space: pre-wrap;
    word-break: break-word;
    text-align: justify;
    user-select: none;
    pointer-events: none;
    font-family: inherit;
}

.typing-overlay.code-font {
    font-family: "Cascadia Code", "Fira Code", "Consolas", "Monaco", monospace;
    font-size: 14px;
    line-height: 28px;
}

.char {
    display: inline;
    position: relative;
    padding: 0 1px;
    border-radius: 3px;
    transition: background 0.08s, color 0.08s;
}

.char-pending { color: var(--text-muted); }

.char-correct { color: var(--correct); background: transparent; }

.char-incorrect {
    color: var(--incorrect);
    background: var(--incorrect-bg);
    text-decoration: underline wavy var(--incorrect);
    text-underline-offset: 2px;
}

.char-current {
    background: var(--current-bg);
    color: var(--current);
    border-radius: 3px;
    animation: blink 1s infinite;
}

.char-space-ok { background: transparent; }
.char-space-wrong { background: var(--incorrect-bg); }

@keyframes blink {
    0%, 100% { background-color: var(--current-bg); }
    50% { background-color: transparent; box-shadow: inset 0 0 0 2px var(--cursor); }
}

.typing-input-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    left: 0;
    top: 0;
}

.typing-workspace.waiting .panel-type::before {
    content: attr(data-start-hint);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-faint);
    background: var(--surface);
    cursor: pointer;
    z-index: 5;
}

.typing-workspace.empty .panel-type::before {
    content: attr(data-empty-hint);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-faint);
    background: var(--surface);
    cursor: pointer;
    z-index: 5;
}

.resize-handle {
    flex: 0 0 6px;
    position: relative;
    cursor: col-resize;
    background: var(--border);
    transition: background 0.15s;
    z-index: 10;
}

.resize-handle:hover,
.resize-handle.active {
    background: var(--brand);
}

.resize-handle::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 40px;
    border-radius: 1px;
    background: rgba(255,255,255,0.5);
    opacity: 0;
    transition: opacity 0.15s;
}

.resize-handle:hover::before,
.resize-handle.active::before {
    opacity: 1;
}

body.resizing {
    cursor: col-resize !important;
    user-select: none !important;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop.show { display: flex; }

.modal {
    background: linear-gradient(180deg, var(--surface), var(--surface-alt));
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    overflow: auto;
    border: 1px solid var(--border);
    animation: modalIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 练习完成弹窗：内容固定，不显示滚动条 */
.modal-result {
    max-height: none;
    overflow: visible;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-alt);
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-faint);
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s;
    line-height: 1;
}

.modal-close:hover { background: var(--border); color: var(--text); }

.modal-body { padding: 22px; }

.modal-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: var(--surface-alt);
}

/* 文章选择弹窗 */
.article-picker-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}
.article-picker-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    text-align: left;
    font: inherit;
    transition: all 0.15s;
}
.article-picker-item:hover {
    border-color: var(--brand);
    background: var(--brand-soft);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}
.picker-item-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}
.picker-item-meta {
    font-size: 12.5px;
    color: var(--text-faint);
}
.article-picker-empty {
    text-align: center;
    padding: 24px 0;
}

/* 文库挑选弹窗 */
.page-head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* 文库弹窗：整体不出现垂直滚动条，仅文章列表内部滚动 */
#modalLibrary .modal {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
#modalLibrary .modal-body {
    flex: 1 1 auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.library-search {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
    flex: 0 0 auto;
}
.library-search .form-control { flex: 1 1 180px; }
.lib-lang-select {
    flex: 0 0 140px;
    min-width: 120px;
}
#modalLibrary .article-picker-list {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
}
.lib-lang-tag {
    display: inline-block;
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 10px;
    background: var(--brand-soft);
    color: var(--brand);
    margin-right: 6px;
    vertical-align: middle;
}
.library-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    flex: 0 0 auto;
}
.lib-page-info { font-size: 13px; color: var(--text-muted); min-width: 90px; text-align: center; }
.lib-item-badge {
    display: inline-block;
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 10px;
    background: var(--brand-soft);
    color: var(--brand);
    margin-left: 6px;
    vertical-align: middle;
}
.lib-item-badge.added { background: rgba(34, 197, 94, 0.12); color: #16a34a; }
.lib-item-add { white-space: nowrap; }
.lib-item-loading { text-align: center; padding: 24px 0; color: var(--text-muted); }

/* Toast 提示 */
.toast-container {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast {
    padding: 10px 22px;
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: auto;
}
.toast.show {
    opacity: 1;
    transform: translateY(0);
}
.toast-success { border-left: 3px solid #16a34a; }
.toast-error { border-left: 3px solid var(--incorrect); }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-control, .form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:hover, .form-textarea:hover { border-color: var(--border-strong); }

.form-control:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: var(--brand-glow);
}

.form-textarea {
    min-height: 200px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.7;
}

.form-group { margin-bottom: 16px; }

.result-score {
    text-align: center;
    padding: 10px 0 18px;
}

.result-score .big-num {
    font-size: 60px;
    font-weight: 900;
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
    letter-spacing: -2px;
}

.result-score .big-label {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 6px;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 14px;
}

.result-cell {
    padding: 16px 14px;
    background: var(--surface-alt);
    border-radius: var(--radius);
    text-align: center;
    border: 1px solid var(--border);
    transition: transform 0.15s, box-shadow 0.15s;
}

.result-cell:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.result-cell .num {
    font-size: 28px;
    font-weight: 800;
    color: var(--brand);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.result-cell .lbl {
    font-size: 11.5px;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-top: 4px;
    font-weight: 600;
}

.result-cell.good .num { color: var(--correct); }
.result-cell.bad .num { color: var(--incorrect); }

.grade-badge {
    display: inline-block;
    padding: 5px 18px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 13px;
    margin-top: 12px;
    letter-spacing: 1px;
    box-shadow: var(--shadow-xs);
}

.grade-S { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #4a2c00; }
.grade-A { background: linear-gradient(135deg, #34d399, #059669); color: #04321f; }
.grade-B { background: linear-gradient(135deg, var(--brand), var(--brand-hover)); color: var(--btn-primary-fg); }
.grade-C { background: var(--surface-alt); color: var(--text-muted); border: 1px solid var(--border); }
.grade-D { background: var(--incorrect-bg); color: var(--incorrect); }

.list-group {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 380px;
    overflow-y: auto;
}

.list-item {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: background 0.12s;
}

.list-item:hover { background: var(--surface-hover); }
.list-item:last-child { border-bottom: none; }

.list-item .item-main { flex: 1; min-width: 0; }
.list-item .item-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.list-item .item-sub {
    font-size: 12px;
    color: var(--text-faint);
    margin-top: 2px;
}
.list-item .item-actions { display: flex; gap: 6px; flex-shrink: 0; }

.btn-icon {
    width: 30px; height: 30px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    transition: all 0.15s;
}

.btn-icon:hover { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); }
.btn-icon.danger:hover { background: var(--incorrect-bg); color: var(--incorrect); border-color: var(--incorrect); }

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-faint);
}

.empty-state .emoji {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.85;
    filter: grayscale(0.2);
}
.empty-state .msg { font-size: 14px; }

.progress-mini {
    display: inline-block;
    width: 100px;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    vertical-align: middle;
    margin-left: 4px;
}

.progress-mini .bar {
    height: 100%;
    background: var(--brand);
    border-radius: 3px;
    transition: width 0.2s;
}

@media (max-width: 900px) {
    .typing-workspace { flex-direction: column; }
    .panel-ref, .panel-type { flex: 0 0 auto !important; width: 100%; }
    .panel-ref { border-right: none; border-bottom: 1px solid var(--border); }
    .resize-handle { flex: 0 0 6px; cursor: row-resize; }
    .header-inner { padding: 0 12px; gap: 10px; }
    .nav-item span:not(.nav-ico), .nav-util .theme-label, .nav-util .lang-label { display: none; }
    .brand-domain { display: none; }
    .stats-bar { gap: 12px; padding: 8px 12px; }
    .stat-item { gap: 3px; }
    .stat-value { font-size: 17px; }
    .panel-body { padding: 16px 18px; }
    .result-grid { grid-template-columns: repeat(2, 1fr); }
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: content-box; border: 2px solid transparent; }

/* 语言切换器 */
.lang-switch { position: relative; }
.lang-switch .nav-util { cursor: pointer; }
.lang-caret { font-size: 10px; color: var(--text-faint); margin-left: -2px; }
.lang-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 150px;
    max-height: min(70vh, 420px);
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 1000;
}
.lang-menu.open { display: block; animation: modalIn 0.15s ease-out; }
.lang-menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 13.5px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.12s;
}
.lang-menu button:hover { background: var(--surface-hover); }
.lang-menu button.active {
    background: var(--brand-soft);
    color: var(--brand);
    font-weight: 600;
}

.page-wrap {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 25px;
    font-weight: 800;
    margin: 0 0 4px 0;
    letter-spacing: -0.3px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.page-sub {
    margin: 0;
    font-size: 13.5px;
    color: var(--text-muted);
}

.head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.history-filter { width: auto; min-width: 150px; font-size: 13px; padding: 8px 10px; }

/* 历史记录页：文案较长的语言（如英文）下保持标题与操作区同一行 */
.page-head.history-head { flex-wrap: nowrap; align-items: center; }
.page-head.history-head > div:first-child { flex: 1 1 auto; min-width: 0; }
.page-head.history-head .head-actions { flex: 0 0 auto; }
@media (max-width: 1000px) {
    .page-head.history-head { flex-wrap: wrap; }
}

.editor-card {
    background: linear-gradient(180deg, var(--surface), var(--surface-alt));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 22px 24px;
    margin-bottom: 20px;
}

.editor-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.editor-title { margin: 0; font-size: 17px; font-weight: 700; }
.editor-actions { display: flex; justify-content: flex-end; gap: 10px; }
.char-count { color: var(--text-faint); font-weight: 400; margin-left: 6px; }

.art-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
}

.art-card {
    background: linear-gradient(180deg, var(--surface), var(--surface-alt));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.18s ease;
}

.art-card:hover { border-color: var(--brand); transform: translateY(-3px); box-shadow: var(--shadow-md); }

.art-card-head { min-width: 0; }
.art-card-title {
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.art-card-sub { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

.art-stats { display: flex; flex-wrap: wrap; gap: 6px; }

.stat-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    font-size: 11.5px;
    color: var(--text-muted);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 3px 10px;
}

.stat-chip b { color: var(--text); font-size: 13px; }
.stat-chip.best b { color: var(--brand); }
.stat-chip.good b { color: var(--correct); }
.stat-chip.muted { border-style: dashed; }

.art-spark-wrap {
    position: relative;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 10px 4px;
}

.spark-canvas { display: block; width: 100%; height: 36px; }
.spark-label {
    position: absolute;
    right: 10px;
    top: 4px;
    font-size: 10px;
    color: var(--text-faint);
}

.art-card-actions { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.art-card-actions .btn { font-size: 12.5px; padding: 6px 12px; }
.art-card-actions a.btn { text-decoration: none; }

.summary-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.chart-card {
    background: linear-gradient(180deg, var(--surface), var(--surface-alt));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 16px 18px 10px;
    margin-bottom: 16px;
}

.chart-legend {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.legend-item .dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.legend-item .dot.bar { background: var(--brand-soft); border: 1px solid var(--brand); }
.legend-item .dot.line { background: var(--brand); border-radius: 50%; width: 8px; height: 8px; }
.legend-item .dot.dash { background: transparent; border-top: 2px dashed var(--correct); width: 14px; height: 0; border-radius: 0; }

.chart-tip {
    margin-left: auto;
    font-size: 12px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

#mainChart { display: block; width: 100%; cursor: crosshair; }

.table-card {
    background: linear-gradient(180deg, var(--surface), var(--surface-alt));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.table-head {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-alt);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.table-head .count { font-weight: 400; text-transform: none; color: var(--text-faint); font-size: 12px; }

.table-wrap { overflow-x: auto; max-height: 460px; overflow-y: auto; }

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.history-table th {
    text-align: left;
    padding: 11px 14px;
    font-size: 11.5px;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    background: var(--surface-alt);
    position: sticky;
    top: 0;
    z-index: 1;
}

.history-table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    white-space: nowrap;
}

.history-table tbody tr:last-child td { border-bottom: none; }
.history-table tbody tr:hover { background: var(--surface-hover); }
.history-table .num-col { text-align: right; font-variant-numeric: tabular-nums; }
.history-table th.num-col { text-align: right; }
.history-table .title-cell {
    max-width: 460px;
    min-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.good-text { color: var(--correct); font-weight: 600; }
.warn-text { color: var(--warning); font-weight: 600; }
.bad-text { color: var(--incorrect); font-weight: 600; }

/* ===== 伪全屏（Zen Mode） ===== */
.typing-workspace.zen-mode {
    position: fixed;
    top: var(--zen-bar-height, 52px);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    border-radius: 0;
    border: none;
    margin: 0;
}

/* 全屏时锁定 html / body 滚动，仅保留打字区内部一条滚动条 */
html.zen-mode,
html.zen-mode body { overflow: hidden; }

body.zen-mode .app-header,
body.zen-mode .app-footer { display: none; }

body.zen-mode .app-main {
    margin-top: 0;
    padding: 0;
}

/* 首页伪全屏时 stats-bar 置顶（只针对首页打字区，不作用键位练习） */
body.zen-mode .stats-bar:not(.kp-stats) {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 201;
    margin: 0;
    border-radius: 0;
    border-top: none;
    border-left: none;
    border-right: none;
}

.zen-mode .article-content { font-size: 17px; }
.zen-mode .typing-overlay { font-size: 17px; }
.zen-mode .panel-body { padding: 32px 40px; }
.zen-mode .panel-ref .panel-body { background-size: 100% 34px; }

/* ===== 全屏专注模式：A3/A4 纸张排版（参考 EditorRich.cshtml） ===== */
/* 纸张尺寸切换控件：默认隐藏，仅在全屏模式下显示 */
.paper-size-switch {
    display: none;
    align-items: center;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
    background: var(--surface);
}
.paper-size-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    padding: 5px 12px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.paper-size-btn:hover { color: var(--brand); }
.paper-size-btn.is-active {
    background: var(--brand);
    color: #fff;
}
body.zen-mode .paper-size-switch { display: inline-flex; }

/* 纸张容器：默认状态（非全屏）不生效，保持原有打字区样式 */
.zen-paper {
    width: 100%;
    min-height: 100%;
}

/* 全屏模式下：打字区以 A4 纸张居中呈现，背景为浅灰（仿 Word 编辑界面） */
.typing-workspace.zen-mode #panelType .panel-body {
    background: #e9ecef;
    padding: 32px 16px 48px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: auto;
}

/* 全屏模式下隐藏打字区面板头，让纸张成为唯一视觉焦点 */
.typing-workspace.zen-mode #panelType .panel-header { display: none; }

.typing-workspace.zen-mode .zen-paper {
    background: #ffffff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
    /* 让 typing-overlay 撑满纸张内容区 */
    display: flex;
    flex-direction: column;
}

/* A4: 210mm x 297mm，Word 窄边距 12.7mm */
.typing-workspace.zen-mode .zen-paper.paper-A4 {
    width: 210mm;
    min-height: 297mm;
    padding: 12.7mm 12.7mm;
}

/* A3: 297mm x 420mm，Word 窄边距 12.7mm */
.typing-workspace.zen-mode .zen-paper.paper-A3 {
    width: 297mm;
    min-height: 420mm;
    padding: 12.7mm 12.7mm;
}

/* 纸张内的打字层：撑满纸张内容区，保持原有字符高亮样式 */
.typing-workspace.zen-mode .zen-paper .typing-overlay {
    flex: 1 1 auto;
    width: 100%;
    line-height: 2;
}

/* 响应式：小屏幕下纸张宽度自适应，避免横向溢出 */
@media (max-width: 900px) {
    .typing-workspace.zen-mode .zen-paper.paper-A4 {
        width: 100%;
        min-height: auto;
        padding: 18px;
    }
    .typing-workspace.zen-mode .zen-paper.paper-A3 {
        width: 100%;
        min-height: auto;
        padding: 18px;
    }
    .typing-workspace.zen-mode #panelType .panel-body { padding: 16px 12px 32px; }
}

/* 全屏专注模式：隐藏参考文章与拖拽分隔条，打字区占满整个工作区 */
/* !important 用于覆盖拖拽逻辑写入的内联 flex 比例（app.js） */
.typing-workspace.zen-mode #panelRef,
.typing-workspace.zen-mode #resizeHandle { display: none; }
.typing-workspace.zen-mode #panelType { flex: 1 1 100% !important; }

.btn-zen.is-on {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

/* 打字音效开关按钮 */
.btn-sound {
    cursor: pointer;
}
.btn-sound.is-off {
    opacity: 0.55;
    color: var(--text-faint);
}
.btn-sound.is-off:hover {
    opacity: 1;
    border-color: var(--brand);
}

.zen-exit-hint {
    position: fixed;
    right: 14px;
    bottom: 12px;
    z-index: 202;
    font-size: 12px;
    color: var(--text-faint);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 5px 12px;
    box-shadow: var(--shadow);
    display: none;
}

body.zen-mode .zen-exit-hint { display: block; }

@media (max-width: 900px) {
    .summary-grid { grid-template-columns: repeat(2, 1fr); }
    .page-head { flex-direction: column; }
    .typing-workspace.zen-mode { top: var(--zen-bar-height, 48px); }
    .zen-mode .panel-body { padding: 18px; }
}

@media (min-width: 901px) and (max-width: 1200px) {
    .summary-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ===== 对战房间 ===== */
.room-lobby {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 24px;
    align-items: stretch;
}

.lobby-card {
    background: linear-gradient(180deg, var(--surface), var(--surface-alt));
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    padding: 32px 36px;
    display: flex;
    flex-direction: column;
}

.lobby-icon { font-size: 40px; text-align: center; margin-bottom: 8px; }
.lobby-title { margin: 0 0 4px; font-size: 20px; font-weight: 700; text-align: center; }
.lobby-desc { margin: 0 0 20px; font-size: 13px; color: var(--text-muted); text-align: center; }

.lobby-sep {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-faint);
    font-size: 13px;
    padding: 0 8px;
}
.lobby-sep::before, .lobby-sep::after {
    content: "";
    width: 1px;
    height: 60px;
    background: var(--border);
    margin: 0 10px;
}
.lobby-sep span { background: var(--bg); padding: 4px 10px; border-radius: 12px; border: 1px solid var(--border); }

.btn-block { width: 100%; justify-content: center; padding: 11px; font-size: 14.5px; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }

.nickname-row { display: flex; gap: 8px; align-items: center; }
.nickname-row .form-control { flex: 1; }
.nickname-row .btn { flex-shrink: 0; padding: 8px 12px; }

.game-status {
    font-size: 13px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
}
.game-status.waiting { color: var(--warning); }
.game-status.playing { color: var(--correct); background: var(--correct-bg); border-color: var(--correct); }
.game-status.finished { color: var(--text-muted); }

/* 等待状态下打字区遮罩提示 */
.room-workspace.waiting .panel-type::after {
    content: attr(data-room-wait-hint);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--text-faint);
    background: var(--surface);
    z-index: 6;
    pointer-events: none;
}

/* 房间对战页 */
.room-play { display: flex; flex-direction: column; width: 100%; max-width: 1200px; height: calc(100vh - var(--header-h) - var(--footer-h) - 32px); margin: 0 auto; gap: 12px; }

.room-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 18px;
    background: linear-gradient(180deg, var(--surface), var(--surface-alt));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    flex-wrap: wrap;
}

.room-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.room-code-badge {
    background: var(--brand-soft);
    color: var(--brand);
    padding: 5px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
}
.room-code-badge b { font-size: 17px; letter-spacing: 1px; }

.room-status { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-ok { background: var(--correct); box-shadow: 0 0 0 3px rgba(5,150,105,0.15); }
.dot-bad { background: var(--incorrect); }

.room-actions { display: flex; gap: 8px; }

.room-body {
    flex: 1;
    display: flex;
    gap: 12px;
    min-height: 0;
}

.room-main { flex: 1; min-width: 0; display: flex; }
.room-workspace { flex: 1; min-height: 0; }

.room-sidebar {
    width: 300px;
    flex-shrink: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-head {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-alt);
}

.player-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-row {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    transition: all 0.15s;
}
.player-row.me { border-color: var(--brand); background: var(--brand-soft); }
.player-row.finished { border-color: var(--correct); }
.player-head {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    margin-bottom: 5px;
}
.player-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.creator-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #7c2d12;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(245, 158, 11, 0.35);
}
.player-wpm { font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.player-wpm b { color: var(--text); }

.player-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}
.player-bar span {
    display: block;
    height: 100%;
    background: var(--brand);
    border-radius: 3px;
    transition: width 0.25s;
}
.player-row.finished .player-bar span { background: var(--correct); }

/* 最终排名弹窗 */
.modal-wide { max-width: 640px; }
.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ranking-row {
    display: grid;
    grid-template-columns: 48px 1fr auto auto auto auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-alt);
    font-size: 13px;
    transition: all 0.15s;
}
.ranking-row.me {
    border-color: var(--brand);
    background: var(--brand-soft);
    box-shadow: 0 0 0 1px var(--brand);
}
.ranking-row.rank-1 {
    border-color: #f59e0b;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.12), var(--surface-alt));
}
.ranking-row.rank-2 {
    border-color: #94a3b8;
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.12), var(--surface-alt));
}
.ranking-row.rank-3 {
    border-color: #d97706;
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.1), var(--surface-alt));
}
.ranking-rank {
    font-size: 18px;
    font-weight: 800;
    text-align: center;
    flex-shrink: 0;
}
.ranking-name {
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}
.ranking-wpm { font-variant-numeric: tabular-nums; color: var(--text-muted); }
.ranking-wpm b { color: var(--text); font-size: 15px; }
.ranking-acc { color: var(--correct); font-variant-numeric: tabular-nums; min-width: 48px; text-align: right; }
.ranking-time { color: var(--text-faint); font-variant-numeric: tabular-nums; min-width: 56px; text-align: right; }
.ranking-grade {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    padding: 2px 8px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 12px;
}

.rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px; height: 18px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.rank-1 { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.rank-2 { background: linear-gradient(135deg, #cbd5e1, #94a3b8); color: #475569; }
.rank-3 { background: linear-gradient(135deg, #fb923c, #ea580c); }

.mini-grade {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
}

.sidebar-chat {
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    max-height: 200px;
}
.chat-msgs {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    font-size: 12.5px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.chat-msg .chat-name { color: var(--brand); font-weight: 600; }
.chat-msg .chat-text { color: var(--text); }
.chat-msg.system .chat-text { color: var(--text-faint); font-style: italic; font-size: 11.5px; }
.chat-input-row {
    display: flex;
    gap: 6px;
    padding: 8px;
    border-top: 1px solid var(--border);
}
.chat-input-row .form-control { padding: 7px 10px; font-size: 12.5px; }

/* ===== 大屏看板 ===== */
.dashboard {
    min-height: calc(100vh - var(--header-h) - var(--footer-h) - 32px);
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px 22px;
    background: linear-gradient(180deg, var(--surface), var(--surface-alt));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}
.dash-title { display: flex; align-items: center; gap: 16px; }
.dash-title h1 { margin: 0; font-size: 22px; font-weight: 800; }
.dash-article { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.dash-article-label { color: var(--text-faint); font-size: 12px; }
.dash-article-title { font-weight: 600; }
.dash-article-count { color: var(--text-muted); font-size: 12px; }

.dash-podium {
    background: linear-gradient(180deg, var(--surface), var(--surface-alt));
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    padding: 28px 20px 20px;
}
.podium-empty { text-align: center; color: var(--text-faint); padding: 24px 0; }
.podium-stage {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 16px;
    max-width: 600px;
    margin: 0 auto;
}
.podium-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 1;
    max-width: 160px;
}
.podium-avatar { font-size: 15px; font-weight: 700; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-wpm { font-size: 13px; color: var(--brand); font-weight: 700; }
.podium-block {
    width: 100%;
    background: linear-gradient(180deg, var(--brand-soft), var(--brand));
    color: #fff;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 8px;
    font-size: 20px;
    font-weight: 800;
}
.podium-col:nth-child(2) .podium-block { background: linear-gradient(180deg, #fde68a, #f59e0b); }
.podium-col:nth-child(1) .podium-block { background: linear-gradient(180deg, #e2e8f0, #94a3b8); }
.podium-col:nth-child(3) .podium-block { background: linear-gradient(180deg, #fed7aa, #ea580c); }

.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

.player-card {
    background: linear-gradient(180deg, var(--surface), var(--surface-alt));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: all 0.2s;
}
.player-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.player-card.finished { border-color: var(--correct); }
.card-head { display: flex; align-items: center; gap: 8px; }
.card-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}
.card-rank.medal { font-size: 20px; background: transparent; }
.card-rank.provisional {
    background: var(--surface-alt);
    color: var(--text-muted);
    border: 1px solid var(--border);
    font-size: 13px;
}
.card-name { font-weight: 700; font-size: 15px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-big { font-size: 40px; font-weight: 900; color: var(--brand); line-height: 1; letter-spacing: -1px; }
.card-big small { font-size: 13px; color: var(--text-muted); font-weight: 600; letter-spacing: 0; margin-left: 4px; }
.card-acc { font-size: 13px; color: var(--text-muted); }
.card-acc.good { color: var(--correct); }
.card-acc.warn { color: var(--warning); }
.card-acc.bad { color: var(--incorrect); }
.card-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.card-bar span { display: block; height: 100%; background: var(--brand); border-radius: 4px; transition: width 0.3s; }
.player-card.finished .card-bar span { background: var(--correct); }
.card-progress { font-size: 12px; color: var(--text-faint); text-align: right; }
.card-status { font-size: 12px; font-weight: 600; }
.card-status.done { color: var(--correct); }
.card-status.typing { color: var(--brand); }

/* Dashboard 成绩列表 */
.dash-list-card {
    background: linear-gradient(180deg, var(--surface), var(--surface-alt));
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}
.dash-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-alt);
    flex-wrap: wrap;
}
.dash-list-title { margin: 0; font-size: 16px; font-weight: 700; }
.dash-list-wrap { overflow-x: auto; max-height: 420px; overflow-y: auto; }
.dash-list-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
.dash-list-table th {
    text-align: left;
    padding: 10px 16px;
    font-size: 11.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-alt);
    position: sticky;
    top: 0;
    z-index: 1;
}
.dash-list-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    white-space: nowrap;
}
.dash-list-table tbody tr:last-child td { border-bottom: none; }
.dash-list-table tbody tr:hover { background: var(--surface-alt); }
.dash-list-table .num-col { text-align: right; font-variant-numeric: tabular-nums; }
.dash-list-table th.num-col { text-align: right; }
.cell-rank { font-weight: 700; min-width: 48px; }
.cell-name { font-weight: 600; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.row-finished { background: var(--surface-alt); }
.row-finished td:first-child { color: var(--correct); }
.list-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.list-status.st-finished { color: var(--correct); background: var(--correct-bg); }
.list-status.st-typing { color: var(--brand); background: var(--brand-soft); }
.list-status.st-waiting { color: var(--warning); background: #fef3c7; }

.dash-footer {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-faint);
    padding: 0 4px;
}

@media (max-width: 900px) {
    .room-lobby { grid-template-columns: 1fr; }
    .lobby-sep { flex-direction: row; }
    .lobby-sep::before, .lobby-sep::after { width: 60px; height: 1px; }
    .room-body { flex-direction: column; }
    .room-sidebar { width: 100%; max-height: 280px; }
    .room-play { height: auto; }
}

/* ============ 键位练习 ============ */
.kp-layout {
    display: flex;
    gap: 16px;
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    min-height: 0;
}

.kp-sidebar {
    width: 220px;
    background: linear-gradient(180deg, var(--surface), var(--surface-alt));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.kp-sidebar-header {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-alt);
    flex-shrink: 0;
}

.kp-lesson-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kp-lesson-item {
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
}

.kp-lesson-item:hover {
    background: var(--brand-soft);
}

.kp-lesson-item.active {
    background: var(--brand-soft);
    border-color: var(--brand);
}

.kp-lesson-item.completed .kp-lesson-name::after {
    content: " ✓";
    color: var(--correct);
    font-weight: 700;
}

.kp-lesson-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.kp-lesson-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.kp-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.kp-stats { margin-bottom: 0; }

.kp-finger-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.kp-hand {
    display: flex;
    gap: 5px;
}

.kp-finger {
    width: 30px;
    height: 36px;
    border-radius: 6px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.15s;
}

.kp-finger.active {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
    transform: translateY(-2px);
}

.kp-thumb { margin-top: 8px; }

/* 键位练习伪全屏（与首页 zen-mode 同一套机制） */
.kp-main.zen-mode {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    border-radius: 0;
    border: none;
    margin: 0;
    padding: 16px;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* zen-mode 下隐藏页头页脚（与首页一致） */
body.zen-mode .app-header,
body.zen-mode .app-footer { display: none; }

body.zen-mode .app-main {
    margin-top: 0;
    padding: 0;
    min-height: 100vh;
}

@media (max-width: 900px) {
    .kp-main.zen-mode { padding: 12px; }
}

.kp-next-key {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 90px;
}

.kp-next-label {
    font-size: 11px;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kp-next-char {
    font-size: 24px;
    font-weight: 700;
    color: var(--brand);
    min-height: 30px;
    line-height: 1;
}

.kp-next-finger {
    font-size: 11px;
    color: var(--text-muted);
}

.kp-practice-area {
    position: relative;
    flex: 1;
    min-height: 100px;
    background: linear-gradient(180deg, var(--surface), var(--surface-alt));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 16px;
    overflow: hidden;
    cursor: text;
}

.kp-practice-area.focused {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

.kp-target-text {
    font-size: 20px;
    line-height: 1.8;
    font-family: "Cascadia Code", "Fira Code", Consolas, Monaco, monospace;
    letter-spacing: 0.5px;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 110px;
    overflow: hidden;
}

.kp-char {
    position: relative;
    padding: 0 1px;
    border-radius: 3px;
    transition: background 0.1s, color 0.1s;
}

.kp-char-pending { color: var(--text-muted); }
.kp-char-correct { color: var(--correct); }
.kp-char-current {
    background: var(--current-bg);
    color: var(--current);
    animation: blink 1s infinite;
}

.kp-char-wrong-flash {
    background: var(--incorrect-bg);
    color: var(--incorrect);
}

.kp-focus-hint {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--text-faint);
    background: var(--surface);
    z-index: 2;
}

.kp-keyboard-wrap {
    background: linear-gradient(180deg, var(--surface), var(--surface-alt));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 10px;
    overflow-x: auto;
}

.kp-keyboard {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 640px;
}

.kp-kb-row {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.kp-key {
    height: 34px;
    border-radius: 5px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.12s;
    min-width: 34px;
}

.kp-key.active {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
    transform: translateY(-1px);
}

.kp-key-space {
    min-width: 220px;
}

.kp-complete-mask {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 12px;
}

.kp-complete-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    min-width: 280px;
}

.kp-complete-emoji { font-size: 42px; margin-bottom: 8px; }
.kp-complete-title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 12px; }

.kp-complete-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
    font-size: 12px;
    color: var(--text-muted);
}

.kp-complete-stats div span { display: block; font-size: 11px; margin-bottom: 2px; }
.kp-complete-stats div strong { font-size: 18px; color: var(--text); }

.kp-complete-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

@media (max-width: 900px) {
    .kp-layout { flex-direction: column; }
    .kp-sidebar { width: 100%; max-height: 160px; }
    .kp-finger-hint { gap: 12px; }
    .kp-finger { width: 28px; height: 36px; font-size: 10px; }
    .kp-target-text { font-size: 18px; }
}

/* 历史记录类型徽章 */
.type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.type-kp { background: #ede9fe; color: #7c3aed; }
.type-article { background: var(--brand-soft); color: var(--brand); }
.type-fun { background: #fef3c7; color: #d97706; }
[data-theme="dark"] .type-kp { background: #3b2f6b; color: #c4b5fd; }
[data-theme="dark"] .type-fun { background: #4a3410; color: #fcd34d; }



/* ===== 首页 Hero 区（文艺气质 · 素笺练习） ===== */
.home-hero {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto 12px;
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
    align-items: center;
    gap: 44px;
    padding: 24px 0 6px;
}

.hero-copy { min-width: 0; }

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.24em;
    color: var(--brand);
}

.hero-rule {
    width: 34px;
    height: 1px;
    background: linear-gradient(90deg, var(--brand), transparent);
}

@property --hero-flow {
    syntax: "<length>";
    inherits: false;
    initial-value: 0px;
}

.hero-title {
    margin: 0 0 16px;
    font-family: var(--font-serif);
    font-size: clamp(30px, 3.4vw, 44px);
    font-weight: 700;
    line-height: 1.28;
    letter-spacing: 0.02em;
    color: var(--text);
}

/* 标题逐字入场 + 渐变循环流动 + 悬停微动 */
.hero-title .hero-char,
.hero-title .hero-word {
    display: inline-block;
    opacity: 1;
    transform: none;
    background-image: linear-gradient(100deg, var(--text) 0%, var(--brand) 18%, var(--text) 36%, var(--brand) 54%, var(--text) 72%, var(--brand) 88%, var(--text) 100%);
    background-size: 1400px 100%;
    background-repeat: repeat-x;
    background-position-x: calc(var(--hero-flow) + var(--i, 0) * -1.2em);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation:
        heroCharIn 0.95s cubic-bezier(0.22, 0.68, 0.32, 1) backwards,
        heroTitleFlow 9s ease-in-out infinite;
    animation-delay: calc(var(--i, 0) * 85ms), 0s;
    transition: transform 0.3s ease, color 0.3s ease, -webkit-text-fill-color 0.3s ease;
    will-change: transform, opacity;
}

.hero-title:hover .hero-char,
.hero-title:hover .hero-word {
    transform: translateY(-3px);
    color: var(--brand);
    -webkit-text-fill-color: var(--brand);
}

@keyframes heroTitleFlow {
    0%,
    100% {
        --hero-flow: 0px;
    }
    50% {
        --hero-flow: -1400px;
    }
}

@keyframes heroCharIn {
    from {
        opacity: 0;
        transform: translateY(0.34em) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .hero-title .hero-char,
    .hero-title .hero-word {
        animation: none;
        transition: none;
        background: none;
        -webkit-text-fill-color: var(--text);
    }
}

.hero-lead {
    margin: 0 0 26px;
    max-width: 540px;
    font-size: 14.5px;
    line-height: 2;
    color: var(--text-muted);
}

.hero-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.hero-cta {
    font-size: 15px;
    padding: 11px 26px;
    border-radius: 11px;
    font-weight: 700;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.hero-cta:hover {
    transform: translateY(-2px);
    box-shadow: var(--btn-primary-shadow-hover);
}

.hero-ghost {
    font-size: 14.5px;
    padding: 10px 20px;
    border-radius: 11px;
    background: transparent;
    box-shadow: none;
}

.hero-ghost:hover {
    color: var(--brand);
    border-color: var(--brand);
    background: var(--brand-soft);
}

.hero-badges {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--text-faint);
}

.hero-badge svg {
    width: 13px;
    height: 13px;
    color: var(--brand);
    stroke-width: 2.6;
}

/* 素笺摘抄卡片：右对齐，与下方工具栏/打字区右边界保持一致 */
.hero-poem {
    position: relative;
    display: flex;
    justify-content: flex-end;
}

.poem-sheet {
    position: relative;
    width: 100%;
    max-width: 372px;
    padding: 32px 34px 30px;
    background: linear-gradient(180deg, var(--surface), var(--surface-alt));
    border: 1px solid var(--border);
    border-radius: 6px 20px 20px 6px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.poem-sheet::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    background: linear-gradient(180deg, var(--brand), var(--brand-alt));
    opacity: 0.85;
}

.poem-sheet::after {
    content: "\201C";
    position: absolute;
    right: 14px;
    top: -20px;
    font-family: var(--font-serif);
    font-size: 120px;
    line-height: 1;
    color: var(--brand);
    opacity: 0.10;
    pointer-events: none;
}

.poem-sheet > * { position: relative; z-index: 1; }

.poem-label {
    display: inline-block;
    font-size: 11px;
    letter-spacing: 0.28em;
    color: var(--brand);
    margin-bottom: 12px;
}

.poem-rule {
    display: block;
    width: 100%;
    height: 1px;
    background: var(--border);
    margin-bottom: 18px;
}

.poem-title {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 12px;
    letter-spacing: 0.08em;
}

.poem-text {
    font-family: var(--font-serif);
    font-size: 17px;
    line-height: 2.1;
    color: var(--text-muted);
    margin: 0 0 18px;
    letter-spacing: 0.04em;
}

.poem-author {
    margin: 0 0 38px;
    font-size: 12.5px;
    color: var(--text-faint);
    text-align: right;
    letter-spacing: 0.08em;
}

.poem-seal {
    position: absolute;
    right: 26px;
    bottom: 22px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-size: 19px;
    color: var(--btn-primary-fg);
    background: var(--brand);
    border-radius: 6px;
    transform: rotate(-4deg);
    box-shadow: var(--shadow-xs);
    opacity: 0.88;
}

/* 练习台分隔标识 */
.practice-rail {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 6px 0 14px;
}

.practice-eyebrow {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.26em;
    color: var(--brand);
    white-space: nowrap;
}

.practice-rule {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border-strong), transparent);
}

/* ===== 首页内容区（SEO / 平台介绍） ===== */
.home-content {
    max-width: 1200px;
    width: 100%;
    margin: 36px auto 0;
    padding: 0;
}

.content-section {
    background: linear-gradient(180deg, var(--surface), var(--surface-alt));
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 30px 34px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    position: relative;
}

.content-section::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--brand), var(--brand-alt));
    opacity: 0.7;
}

.section-head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin: 0 0 22px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.section-no {
    font-family: var(--font-serif);
    font-size: 13px;
    font-weight: 700;
    color: var(--brand);
    letter-spacing: 0.08em;
}

.section-title {
    margin: 0;
    font-family: var(--font-serif);
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.04em;
}

.content-section p {
    font-size: 14px;
    line-height: 1.9;
    color: var(--text-muted);
    margin: 0;
}

.about-section p { max-width: 1000px; }

.feature-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.feature-item {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 22px 24px;
    transition: all 0.18s ease;
}

.feature-item:hover {
    border-color: var(--brand);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    background: var(--surface);
}

.feature-ico {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-bottom: 14px;
    border-radius: 10px;
    background: var(--brand-soft);
    border: 1px solid var(--brand-border);
    color: var(--brand);
}

.feature-ico svg { width: 20px; height: 20px; }

.feature-item h3 {
    font-family: var(--font-serif);
    font-size: 15.5px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 8px;
    letter-spacing: 0.03em;
}

.feature-item p {
    font-size: 13px;
    line-height: 1.8;
    color: var(--text-muted);
    margin: 0;
}

.guide-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    align-items: start;
    margin-bottom: 24px;
}

.guide-grid .content-section { margin-bottom: 0; }

.steps-list {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: step;
}

.steps-list li {
    position: relative;
    padding: 0 0 18px 40px;
    margin: 0;
    font-size: 14px;
    line-height: 1.9;
    color: var(--text-muted);
    counter-increment: step;
}

.steps-list li:last-child { padding-bottom: 0; }

.steps-list li::before {
    content: counter(step, decimal-leading-zero);
    position: absolute;
    left: 0;
    top: 0;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-size: 11px;
    font-weight: 700;
    color: var(--brand);
    background: var(--brand-soft);
    border: 1px solid var(--brand-border);
    border-radius: 50%;
}

.steps-list li::after {
    content: "";
    position: absolute;
    left: 13px;
    top: 32px;
    bottom: 8px;
    width: 1px;
    background: var(--border);
}

.steps-list li:last-child::after { display: none; }

.steps-list li strong {
    color: var(--text);
    font-weight: 700;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.faq-item {
    position: relative;
    padding: 14px 0 14px 34px;
    border-bottom: 1px dashed var(--border);
    background: transparent;
    border-radius: 0;
}

.faq-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.faq-item::before {
    content: "Q";
    position: absolute;
    left: 0;
    top: 14px;
    font-family: var(--font-serif);
    font-size: 14px;
    font-weight: 700;
    color: var(--brand);
}

.faq-item h3 {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 6px;
}

.faq-item p {
    font-size: 13px;
    line-height: 1.8;
    color: var(--text-muted);
    margin: 0;
}

@media (max-width: 1200px) {
    .feature-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
    .guide-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .home-hero {
        grid-template-columns: 1fr;
        gap: 26px;
        padding: 18px 0 4px;
    }
    .hero-lead { max-width: none; }
    .hero-poem { justify-content: flex-start; }
    .poem-sheet { max-width: 460px; }
}

@media (max-width: 768px) {
    .hero-title { font-size: 30px; }
    .hero-badges { gap: 12px; margin-top: 18px; }
    .hero-cta { font-size: 14.5px; padding: 10px 22px; }
    .content-section { padding: 22px 18px; }
    .feature-grid { grid-template-columns: 1fr; }
    .poem-sheet { padding: 24px 24px 26px; }
    .poem-text { font-size: 16px; }
    .poem-author { margin-bottom: 34px; }
}

/* 键位练习页强制整屏：消除 stats-bar 底部 margin 等额外高度 */
.kp-stats { margin-bottom: 0; }

/* ============ 趣味键位练习（打字小游戏 · 宽屏双栏） ============ */
.fp-layout {
    display: flex;
    gap: 16px;
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    min-height: 0;
    align-items: stretch;
}

/* ---------- 左侧：游戏大厅 ---------- */
.fp-side {
    width: 300px;
    flex-shrink: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.fp-side-head {
    padding: 18px 18px 14px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(165deg, var(--brand-soft), transparent 78%);
    flex-shrink: 0;
}

.fp-logo { font-size: 40px; line-height: 1; animation: fpLogoFloat 2.6s ease-in-out infinite; }
@keyframes fpLogoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.fp-side-title {
    font-size: 19px;
    font-weight: 800;
    margin: 9px 0 4px;
    color: var(--text);
    letter-spacing: 0.5px;
}

.fp-side-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

.fp-side-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
}

.fp-section-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 14px 0 8px;
}
.fp-section-label:first-child { margin-top: 0; }

.fp-mode-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fp-mode-card {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 11px;
    text-align: left;
    border: 2px solid var(--border);
    background: var(--surface-alt);
    border-radius: 12px;
    padding: 10px 12px;
    transition: all 0.15s;
    font-family: inherit;
    cursor: pointer;
}

.fp-mode-card:hover:not(:disabled) {
    border-color: var(--brand);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.fp-mode-card.active {
    border-color: var(--brand);
    background: var(--brand-soft);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

.fp-mode-icon { font-size: 26px; line-height: 1; flex-shrink: 0; }
.fp-mode-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fp-mode-name { font-size: 14px; font-weight: 800; color: var(--text); }
.fp-mode-desc { font-size: 11.5px; color: var(--text-muted); line-height: 1.4; }

.fp-diff-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.fp-diff-btn {
    border: 2px solid var(--border);
    background: var(--surface-alt);
    border-radius: 10px;
    padding: 8px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    transition: all 0.15s;
    font-family: inherit;
    cursor: pointer;
}

.fp-diff-btn:hover:not(:disabled) { border-color: var(--brand); }
.fp-diff-btn.active {
    border-color: var(--brand);
    background: var(--brand-soft);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

.fp-diff-name { font-size: 13px; font-weight: 800; color: var(--text); }
.fp-diff-desc { font-size: 10.5px; color: var(--text-muted); }

.fp-mode-card:disabled,
.fp-diff-btn:disabled { cursor: not-allowed; }
.fp-mode-card:not(.active):disabled,
.fp-diff-btn:not(.active):disabled { opacity: 0.5; }

/* 最高分榜：行=玩法，列=难度 */
.fp-best-grid {
    display: grid;
    grid-template-columns: 58px repeat(3, 1fr);
    gap: 6px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    background: var(--surface-alt);
}
.fp-best-th {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-faint);
    text-align: center;
    align-self: center;
}
.fp-best-rowh {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
}
.fp-best-cell {
    text-align: center;
    font-size: 14px;
    font-weight: 800;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 3px 0;
    line-height: 1.2;
}
.fp-best-cell.zero { color: var(--text-faint); font-weight: 600; }
.fp-best-cell.hot {
    color: #b45309;
    border-color: #fbbf24;
    background: #fffbeb;
}
[data-theme="dark"] .fp-best-cell.hot { color: #fcd34d; border-color: #b45309; background: rgba(245,158,11,.14); }

.fp-start-btn {
    width: 100%;
    justify-content: center;
    margin-top: 16px;
    padding: 12px;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 2px;
    border-radius: 10px;
}

.fp-howto {
    list-style: none;
    margin: 14px 0 0;
    padding: 12px 4px 0;
    border-top: 1px dashed var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.fp-howto li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--text-muted);
}

.fp-howto li span:first-child { font-size: 13px; line-height: 1.6; }
.fp-touch-warn { color: var(--warning) !important; }

/* ---------- 右侧：HUD + 舞台 ---------- */
.fp-play {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.fp-hud { margin-bottom: 0; gap: 16px; }
.fp-hud .btn:disabled { opacity: 0.45; cursor: not-allowed; }
.fp-sound-btn { padding: 7px 11px; font-size: 16px; line-height: 1; }
.fp-sound-btn.muted {
    background: var(--surface-alt);
    color: var(--text-faint);
    opacity: 0.75;
}
[data-theme="dark"] .fp-sound-btn.muted { opacity: 0.7; }
.fp-hud .fp-hud-label {
    display: block;
    font-size: 11px;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1px;
}
.fp-hud .fp-hud-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}
.fp-hud-combo { display: flex; align-items: baseline; gap: 6px; position: relative; }
.fp-hearts { font-size: 16px; letter-spacing: 2px; }

.fp-mult {
    font-size: 12px;
    font-weight: 800;
    color: var(--text-faint);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 1px 8px;
    transition: all 0.2s;
}
.fp-hud-combo.hot .fp-mult {
    color: #fff;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    border-color: transparent;
    animation: fpMultPulse 0.9s ease-in-out infinite;
}
@keyframes fpMultPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}

.fp-stage {
    position: relative;
    flex: 1;
    min-height: 460px;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid #1e2d52;
    box-shadow: var(--shadow-lg);
    outline: none;
    background-color: #0b1226;
    background-image:
        radial-gradient(2px 2px at 18% 28%, rgba(255,255,255,.7), transparent),
        radial-gradient(1px 1px at 72% 18%, rgba(255,255,255,.5), transparent),
        radial-gradient(1.5px 1.5px at 41% 66%, rgba(255,255,255,.55), transparent),
        radial-gradient(1px 1px at 86% 58%, rgba(255,255,255,.45), transparent),
        radial-gradient(1.5px 1.5px at 9% 82%, rgba(255,255,255,.5), transparent),
        radial-gradient(1px 1px at 56% 42%, rgba(255,255,255,.4), transparent),
        radial-gradient(1px 1px at 32% 12%, rgba(255,255,255,.4), transparent),
        radial-gradient(1.5px 1.5px at 92% 86%, rgba(255,255,255,.4), transparent),
        radial-gradient(ellipse at 50% 125%, rgba(37,99,235,.4), transparent 62%),
        linear-gradient(160deg, #0b1226, #101d3d 55%, #0a1024);
    will-change: transform;
}

/* 待机欢迎层 */
.fp-idle {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    padding: 24px;
    background: rgba(8, 13, 30, 0.38);
}
/* display:flex/inline-block 的作者样式会覆盖 UA 的 [hidden]{display:none}，需显式声明 */
.fp-idle[hidden],
.fp-countdown[hidden],
.fp-mask[hidden],
.fp-new-record[hidden] { display: none; }
.fp-idle-emoji {
    font-size: 52px;
    line-height: 1;
    letter-spacing: 4px;
    animation: fpLogoFloat 2.8s ease-in-out infinite;
}
.fp-idle-title {
    font-size: 27px;
    font-weight: 900;
    color: #fff;
    letter-spacing: 2px;
    text-shadow: 0 0 22px rgba(96, 165, 250, .8), 0 3px 10px rgba(0,0,0,.55);
}
.fp-idle-sub {
    margin: 0 0 8px;
    font-size: 14px;
    color: #bfdbfe;
}
.fp-idle-btn {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 2px;
    border-radius: 12px;
}
.fp-idle-hint {
    margin: 8px 0 0;
    font-size: 12px;
    color: #93a6c9;
}

/* 下落字符块 */
.fp-tile {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    will-change: transform;
    transform: translate3d(var(--tx, 0px), var(--ty, 0px), 0);
}

.fp-tile-char {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    font-family: "Cascadia Code", "Fira Code", Consolas, Monaco, monospace;
    font-size: 21px;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(150deg, #3b82f6, #1d4ed8);
    border: 1px solid rgba(147, 197, 253, .8);
    box-shadow: 0 4px 14px rgba(37, 99, 235, .55), inset 0 1px 0 rgba(255,255,255,.35);
    text-shadow: 0 1px 2px rgba(0,0,0,.35);
}

.fp-tile-char.danger {
    background: linear-gradient(150deg, #ef4444, #b91c1c);
    border-color: #fca5a5;
    box-shadow: 0 4px 16px rgba(239, 68, 68, .7), inset 0 1px 0 rgba(255,255,255,.3);
    animation: fpDangerPulse 0.55s ease-in-out infinite;
}

.fp-tile-word {
    padding: 8px 14px;
    border-radius: 10px;
    font-family: "Cascadia Code", "Fira Code", Consolas, Monaco, monospace;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #cbd5e1;
    background: rgba(15, 23, 42, .78);
    border: 1px solid rgba(148, 163, 184, .5);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .45);
    backdrop-filter: blur(2px);
}

.fp-tile-word.danger {
    border-color: #f87171;
    box-shadow: 0 4px 16px rgba(239, 68, 68, .55);
    animation: fpDangerPulse 0.55s ease-in-out infinite;
}

.fp-tile-word.locked {
    border-color: #60a5fa;
    background: rgba(30, 58, 95, .92);
    box-shadow: 0 0 0 2px rgba(96, 165, 250, .45), 0 4px 16px rgba(37, 99, 235, .55);
}

/* 单词打错判废：标红、倾斜加速下坠（位移仍由 --tx/--ty 驱动） */
.fp-tile-word.rejected {
    border-color: #ef4444;
    color: #fca5a5;
    background: rgba(69, 10, 10, .82);
    box-shadow: 0 4px 14px rgba(239, 68, 68, .5);
    opacity: .95;
    animation: fpRejectWobble 0.36s ease-in-out infinite;
}
.fp-tile-word.rejected .fp-tl-ok { color: #fca5a5; }
@keyframes fpRejectWobble {
    0%, 100% { transform: translate3d(var(--tx, 0px), var(--ty, 0px), 0) rotate(-11deg); }
    50% { transform: translate3d(var(--tx, 0px), var(--ty, 0px), 0) rotate(-5deg); }
}

.fp-tl { padding: 0 1px; border-radius: 3px; }
.fp-tl-ok { color: #34d399; }
.fp-tl-cur {
    color: #fff;
    background: rgba(96, 165, 250, .45);
    box-shadow: 0 0 8px rgba(96, 165, 250, .8);
}

@keyframes fpDangerPulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.35) drop-shadow(0 0 10px rgba(239, 68, 68, .85)); }
}

.fp-tile.hit { animation: fpTileHit 0.16s ease-out forwards; }
@keyframes fpTileHit {
    to {
        transform: translate3d(var(--tx, 0px), var(--ty, 0px), 0) scale(1.45) rotate(8deg);
        opacity: 0;
    }
}
.fp-tile.escape { animation: fpTileEscape 0.26s ease-in forwards; }
@keyframes fpTileEscape {
    to {
        transform: translate3d(var(--tx, 0px), calc(var(--ty, 0px) + 26px), 0) rotate(-14deg) scale(.7);
        opacity: 0;
    }
}

/* 粒子 / 飘分 / 提示 */
.fp-particle {
    position: absolute;
    z-index: 4;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--c, #60a5fa);
    box-shadow: 0 0 8px var(--c, #60a5fa);
    pointer-events: none;
    animation: fpBurst 0.5s ease-out forwards;
}
@keyframes fpBurst {
    to {
        transform: translate(var(--dx, 0), var(--dy, 0)) scale(0.2);
        opacity: 0;
    }
}

.fp-float {
    position: absolute;
    z-index: 6;
    font-size: 17px;
    font-weight: 800;
    pointer-events: none;
    transform: translate(-50%, -50%);
    text-shadow: 0 2px 6px rgba(0,0,0,.6);
    animation: fpFloatUp 0.8s ease-out forwards;
}
@keyframes fpFloatUp {
    to { transform: translate(-50%, calc(-50% - 46px)); opacity: 0; }
}

.fp-toast {
    position: absolute;
    z-index: 9;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.6);
    font-size: 26px;
    font-weight: 900;
    color: #fbbf24;
    text-shadow: 0 0 18px rgba(251, 191, 36, .8), 0 3px 8px rgba(0,0,0,.6);
    pointer-events: none;
    opacity: 0;
    transition: all 0.25s ease-out;
    white-space: nowrap;
}
.fp-toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

.fp-level-banner {
    position: absolute;
    z-index: 8;
    top: 18px;
    left: 50%;
    transform: translateX(-50%) translateY(-30px);
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 2px;
    color: #fde68a;
    text-shadow: 0 0 16px rgba(251, 191, 36, .9), 0 3px 8px rgba(0,0,0,.6);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease-out;
}
.fp-level-banner.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* 屏幕震动 */
.fp-stage.shake { animation: fpShake 0.32s ease-in-out; }
.fp-stage.shake-light { animation: fpShakeLight 0.22s ease-in-out; }
@keyframes fpShake {
    0%, 100% { transform: translate(0, 0); }
    20% { transform: translate(-8px, 4px); }
    40% { transform: translate(7px, -5px); }
    60% { transform: translate(-6px, -3px); }
    80% { transform: translate(5px, 4px); }
}
@keyframes fpShakeLight {
    0%, 100% { transform: translate(0, 0); }
    35% { transform: translate(-4px, 2px); }
    70% { transform: translate(4px, -2px); }
}

/* 倒计时 */
.fp-countdown {
    position: absolute;
    inset: 0;
    z-index: 15;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(8, 13, 30, .55);
    backdrop-filter: blur(2px);
    pointer-events: none;
}
.fp-countdown-num {
    font-size: 96px;
    font-weight: 900;
    color: #fff;
    line-height: 1;
    text-shadow: 0 0 30px rgba(96, 165, 250, .95), 0 6px 18px rgba(0,0,0,.5);
}
.fp-countdown-num.pop { animation: fpCountPop 0.72s ease-out; }
@keyframes fpCountPop {
    0% { transform: scale(1.7); opacity: 0.2; }
    35% { transform: scale(1); opacity: 1; }
    80% { transform: scale(0.92); opacity: 1; }
    100% { transform: scale(0.7); opacity: 0.3; }
}
.fp-countdown-tip {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 2px;
    color: #93c5fd;
}

/* 遮罩卡片（暂停 / 结算） */
.fp-mask {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(8, 13, 30, .68);
    backdrop-filter: blur(3px);
    padding: 16px;
}

.fp-mask-card,
.fp-over-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 26px 30px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    min-width: 280px;
    max-width: 420px;
    width: 100%;
}

.fp-mask-emoji { font-size: 42px; margin-bottom: 8px; }
.fp-mask-title { font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 16px; }
.fp-mask-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.fp-over-emoji { font-size: 52px; margin-bottom: 4px; }
.fp-new-record {
    display: inline-block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 800;
    color: #b45309;
    background: #fef3c7;
    border-radius: 999px;
    padding: 3px 14px;
}
[data-theme="dark"] .fp-new-record { color: #fde68a; background: rgba(245,158,11,.18); }

.fp-final-score { margin: 4px 0 10px; }
.fp-final-num {
    display: block;
    font-size: 56px;
    font-weight: 900;
    line-height: 1;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.fp-final-label { font-size: 12px; color: var(--text-muted); letter-spacing: 1px; }
.fp-grade-row { margin-bottom: 16px; }

.fp-over-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}
.fp-over-stats div {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 9px 6px;
}
.fp-over-stats span {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 3px;
}
.fp-over-stats strong {
    font-size: 17px;
    font-weight: 800;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

/* 宽屏以下：双栏改为上下堆叠 */
@media (max-width: 1024px) {
    .fp-layout { flex-direction: column; }
    .fp-side { width: 100%; flex-shrink: 1; }
    .fp-side-body { overflow-y: visible; }
    .fp-stage { min-height: 56vh; }
}

@media (max-width: 640px) {
    .fp-side-head { padding: 14px 14px 10px; }
    .fp-side-body { padding: 12px; }
    .fp-over-stats { grid-template-columns: 1fr 1fr; }
    .fp-tile-char { width: 40px; height: 40px; font-size: 18px; }
    .fp-tile-word { font-size: 16px; padding: 7px 11px; }
    .fp-countdown-num { font-size: 72px; }
    .fp-hud { gap: 10px; padding: 8px 12px; }
    .fp-hud .fp-hud-value { font-size: 17px; }
    .fp-play { gap: 8px; }
    .fp-idle-title { font-size: 22px; }
    .fp-idle-emoji { font-size: 42px; }
}

/* 超宽屏：限制舞台最大宽度，避免字符落点过散 */
@media (min-width: 1700px) {
    .fp-play { max-width: 1500px; }
}
