/* 专属错题本 (Retest) 样式表（支持浅色 / 深色 / 跟随系统三态） */
:root {
    --primary: #2563eb;
    --primary-light: #eff6ff;
    --primary-hover: #1d4ed8;
    --primary-border: #bfdbfe;
    --accent-purple: #7c3aed;
    --accent-purple-soft: rgba(124, 58, 237, 0.08);
    --accent-purple-border: rgba(124, 58, 237, 0.25);
    --accent-amber: #b45309;
    --accent-emerald: #059669;

    --bg-page: #f8fafc;
    --surface-card: #ffffff;
    --surface-subtle: #f1f5f9;
    --surface-muted: #f8fafc;
    --surface-hover: #e2e8f0;
    --border-subtle: #e2e8f0;
    --border-strong: #cbd5e1;
    --border-card: rgba(226, 232, 240, 0.9);
    --text-main: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;

    --rt-warn-bg: #fffbeb;
    --rt-warn-border: #fde68a;
    --rt-warn-text: #92400e;
    --rt-warn-accent: #d97706;
    --rt-err-bg: #fef2f2;
    --rt-err-border: #fecaca;
    --rt-err-text: #b91c1c;
    --rt-ok-bg: #ecfdf5;
    --rt-ok-border: #a7f3d0;
    --rt-ok-text: #047857;
    --rt-info-bg: #dbeafe;
    --rt-info-text: #1d4ed8;

    --shadow-card: 0 8px 24px -6px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.03);
    --radius-xl: 16px;
    --radius-lg: 12px;
    --radius-md: 8px;
    --radius-sm: 6px;
    --scrollbar-track: rgba(0, 0, 0, 0.03);
    --scrollbar-thumb: rgba(0, 0, 0, 0.18);
    --scrollbar-thumb-hover: rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] {
    --primary: #3b82f6;
    --primary-light: rgba(59, 130, 246, 0.14);
    --primary-hover: #2563eb;
    --primary-border: rgba(59, 130, 246, 0.32);
    --accent-purple: #a78bfa;
    --accent-purple-soft: rgba(167, 139, 250, 0.12);
    --accent-purple-border: rgba(167, 139, 250, 0.30);
    --accent-amber: #fbbf24;
    --accent-emerald: #34d399;

    --bg-page: #141415;
    --surface-card: #19191b;
    --surface-subtle: #232325;
    --surface-muted: #1e1e21;
    --surface-hover: #2c2c30;
    --border-subtle: rgba(237, 237, 237, 0.10);
    --border-strong: rgba(237, 237, 237, 0.18);
    --border-card: rgba(237, 237, 237, 0.10);
    --text-main: #ededed;
    --text-secondary: #a1a1a6;
    --text-muted: #85858b;

    --rt-warn-bg: rgba(224, 164, 58, 0.12);
    --rt-warn-border: rgba(224, 164, 58, 0.28);
    --rt-warn-text: #fcd34d;
    --rt-warn-accent: #fbbf24;
    --rt-err-bg: rgba(229, 72, 77, 0.12);
    --rt-err-border: rgba(229, 72, 77, 0.30);
    --rt-err-text: #fca5a5;
    --rt-ok-bg: rgba(76, 195, 138, 0.12);
    --rt-ok-border: rgba(76, 195, 138, 0.28);
    --rt-ok-text: #6ee7b7;
    --rt-info-bg: rgba(37, 99, 235, 0.18);
    --rt-info-text: #93c5fd;

    --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.45);
    --scrollbar-track: rgba(255, 255, 255, 0.03);
    --scrollbar-thumb: rgba(255, 255, 255, 0.16);
    --scrollbar-thumb-hover: rgba(255, 255, 255, 0.32);
}

*, *::before, *::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body, h1, h2, h3, p, ul, ol {
    margin: 0;
}

html {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

        ::-webkit-scrollbar {
            width: 7px;
            height: 7px;
        }

        ::-webkit-scrollbar-track {
            background: var(--scrollbar-track);
            border-radius: 4px;
        }

        ::-webkit-scrollbar-thumb {
            background: var(--scrollbar-thumb);
            border-radius: 4px;
            transition: background 0.2s ease;
        }

        ::-webkit-scrollbar-thumb:hover {
            background: var(--scrollbar-thumb-hover);
        }

        body {
            font-family: 'Plus Jakarta Sans', 'Noto Sans SC', system-ui, -apple-system, sans-serif;
            background-color: var(--bg-page);
            color: var(--text-main);
            min-height: 100vh;
            min-height: 100dvh;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: flex-start;
            padding: max(16px, env(safe-area-inset-top)) 12px max(32px, env(safe-area-inset-bottom));
        }

        /* ===== WeChat Notification Bar ===== */
        .wechat-bar {
            width: 100%;
            max-width: 520px;
            background: var(--rt-warn-bg);
            border: 1px solid var(--rt-warn-border);
            border-radius: var(--radius-md);
            padding: 10px 14px;
            margin-bottom: 12px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
        }

        .retest-topbar {
            width: 100%;
            max-width: 520px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            margin-bottom: 10px;
        }

        .retest-brand-title {
            font-size: 0.86rem;
            font-weight: 500;
            color: var(--text-muted);
        }

        @keyframes slideDown {
            from { opacity: 0; transform: translateY(-8px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .wechat-bar-left {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 0.8rem;
            color: var(--rt-warn-text);
            font-weight: 500;
            line-height: 1.4;
        }

        .wechat-bar-left svg {
            flex-shrink: 0;
            width: 18px;
            height: 18px;
            color: var(--rt-warn-accent);
        }

        .btn-copy-link {
            flex-shrink: 0;
            background: var(--surface-card);
            color: var(--rt-warn-text);
            border: 1px solid var(--rt-warn-border);
            padding: 5px 10px;
            border-radius: 6px;
            font-size: 0.75rem;
            font-weight: 500;
            cursor: pointer;
            transition: background-color 0.15s ease, border-color 0.15s ease;
            white-space: nowrap;
        }

        .btn-copy-link:active {
            background: var(--surface-subtle);
        }

        /* ===== App Shell Container ===== */
        .shell {
            width: 100%;
            max-width: 520px;
            margin: 0 auto;
        }

        /* ===== Main Card ===== */
        .card {
            background: var(--surface-card);
            border-radius: var(--radius-xl);
            border: 1px solid var(--border-card);
            box-shadow: var(--shadow-card);
            padding: 24px 20px;
            position: relative;
            overflow: hidden;
            transition: background-color 0.2s ease, border-color 0.2s ease;
        }

        /* ===== Loading State ===== */
        .loading-box {
            text-align: center;
            padding: 48px 16px;
        }

        .spinner {
            width: 38px;
            height: 38px;
            border: 3.5px solid rgba(37, 99, 235, 0.12);
            border-top: 3.5px solid var(--primary);
            border-radius: 50%;
            animation: spin 0.9s cubic-bezier(0.6, 0.2, 0.4, 0.8) infinite;
            margin: 0 auto 18px;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        .loading-text {
            font-size: 0.95rem;
            color: var(--text-secondary);
            font-weight: 500;
        }

        /* ===== Error State ===== */
        .error-box {
            text-align: center;
            padding: 36px 16px;
            display: none;
        }

        .error-icon-wrap {
            width: 60px;
            height: 60px;
            background: var(--rt-err-bg);
            color: var(--rt-err-text);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 16px;
        }

        .error-title {
            font-size: 1.25rem;
            font-weight: 600;
            color: var(--rt-err-text);
            margin-bottom: 8px;
        }

        .error-desc {
            font-size: 0.9rem;
            color: var(--text-muted);
            line-height: 1.5;
        }

        /* ===== Security Gate Verification State ===== */
        .verify-box {
            display: none;
            animation: fadeIn 0.3s ease;
            padding-top: 8px;
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(6px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .verify-badge-icon {
            width: 48px;
            height: 48px;
            background: var(--primary-light);
            border: 1px solid var(--primary-border);
            color: var(--primary);
            border-radius: var(--radius-md);
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 14px;
            box-shadow: none;
        }

        .verify-header-title {
            font-size: 1.3rem;
            font-weight: 600;
            text-align: center;
            color: var(--text-main);
            margin-bottom: 22px;
        }

        .form-item {
            margin-bottom: 16px;
        }

        .form-label {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 0.85rem;
            font-weight: 600;
            color: var(--text-main);
            margin-bottom: 6px;
        }

        .form-input-wrap {
            position: relative;
            display: flex;
            align-items: center;
        }

        .form-input-icon {
            position: absolute;
            left: 14px;
            color: var(--text-muted);
            width: 18px;
            height: 18px;
            pointer-events: none;
        }

        .form-input {
            width: 100%;
            height: 48px;
            padding: 0 14px 0 42px;
            font-size: 0.95rem;
            font-family: inherit;
            border: 1.5px solid var(--border-subtle);
            border-radius: var(--radius-md);
            outline: none;
            background: var(--surface-card);
            color: var(--text-main);
            transition: border-color 0.15s ease, box-shadow 0.15s ease;
        }

        .form-input:focus {
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
        }

        .captcha-row {
            display: flex;
            gap: 10px;
            align-items: stretch;
        }

        .captcha-input {
            padding-left: 14px;
            text-transform: uppercase;
            font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
            font-size: 1.15rem;
            font-weight: 600;
            letter-spacing: 3px;
        }

        .captcha-img-box {
            flex-shrink: 0;
            width: 130px;
            height: 48px;
            border-radius: var(--radius-md);
            overflow: hidden;
            border: 1.5px solid var(--border-subtle);
            cursor: pointer;
            background: var(--surface-subtle);
            padding: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: border-color 0.15s ease;
            position: relative;
        }

        .captcha-img-box:hover,
        .captcha-img-box:focus-visible {
            border-color: var(--primary);
            outline: none;
        }

        .captcha-img-box img {
            width: 100%;
            height: 100%;
            object-fit: fill;
            display: block;
        }

        .captcha-hint-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 6px;
            font-size: 0.75rem;
            color: var(--text-muted);
        }

        .captcha-refresh-btn {
            color: var(--primary);
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            gap: 3px;
            font-weight: 500;
            background: none;
            border: none;
            font-size: 0.75rem;
        }

        .captcha-refresh-btn:hover {
            text-decoration: underline;
        }

        .verify-err-banner {
            background: var(--rt-err-bg);
            border: 1px solid var(--rt-err-border);
            color: var(--rt-err-text);
            padding: 10px 14px;
            border-radius: var(--radius-md);
            font-size: 0.82rem;
            margin-bottom: 16px;
            display: none;
            align-items: center;
            gap: 8px;
            animation: shake 0.4s ease;
        }

        @keyframes shake {
            0%, 100% { transform: translateX(0); }
            20%, 60% { transform: translateX(-4px); }
            40%, 80% { transform: translateX(4px); }
        }

        .btn-submit-verify {
            width: 100%;
            height: 50px;
            background: var(--brand-500, #2563eb);
            color: #ffffff;
            border: none;
            border-radius: var(--radius-md);
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            box-shadow: none;
            transition: background-color 0.15s ease;
            margin-top: 8px;
        }

        .btn-submit-verify:hover {
            background: var(--brand-600, #1d4ed8);
            transform: none;
            box-shadow: none;
        }

        .btn-submit-verify:active {
            transform: translateY(0);
        }

        .btn-submit-verify:disabled {
            background: #94a3b8;
            box-shadow: none;
            cursor: not-allowed;
            transform: none;
        }

        /* ===== Content State (Main Dashboard) ===== */
        .content-box {
            display: none;
            animation: fadeIn 0.35s ease;
        }

        /* ===== Student Profile Header ===== */
        .profile-bar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            margin-bottom: 14px;
            padding-bottom: 12px;
            border-bottom: 1px solid var(--border-subtle);
        }

        .profile-identity {
            display: flex;
            align-items: center;
            gap: 8px;
            min-width: 0;
            flex-wrap: wrap;
        }

        .subject-badge {
            background: var(--primary-light);
            color: var(--primary);
            border: 1px solid var(--primary-border);
            font-size: 0.8rem;
            font-weight: 600;
            padding: 3px 8px;
            border-radius: 6px;
            flex-shrink: 0;
            line-height: 1.2;
        }

        .student-name-text {
            font-size: 1.22rem;
            font-weight: 600;
            color: var(--text-main);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            letter-spacing: -0.01em;
        }

        .topic-current-pill {
            background: var(--surface-subtle);
            color: var(--text-secondary);
            font-size: 0.78rem;
            font-weight: 500;
            padding: 2px 8px;
            border-radius: 6px;
            flex-shrink: 0;
        }

        .spacing-control {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            background: var(--surface-card);
            border: 1px solid var(--border-subtle);
            border-radius: 8px;
            padding: 4px 10px;
            flex-shrink: 0;
            position: relative;
            transition: border-color 0.15s ease, box-shadow 0.15s ease;
        }

        .spacing-control:hover, .spacing-control:focus-within {
            border-color: var(--primary);
        }

        .spacing-label-prefix {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            font-size: 0.76rem;
            font-weight: 500;
            color: var(--text-muted);
            user-select: none;
            flex-shrink: 0;
        }

        .spacing-label-prefix svg {
            color: var(--primary);
            flex-shrink: 0;
        }

        .spacing-select-wrapper {
            position: relative;
            display: inline-flex;
            align-items: center;
        }

        .spacing-select-wrapper select {
            appearance: none;
            -webkit-appearance: none;
            -moz-appearance: none;
            background: transparent;
            border: none;
            font-size: 0.82rem;
            font-weight: 600;
            color: var(--text-main);
            outline: none;
            cursor: pointer;
            padding-right: 16px;
            line-height: 1.2;
            font-family: inherit;
        }

        .spacing-select-wrapper select option {
            background-color: var(--surface-card);
            color: var(--text-main);
            padding: 6px 10px;
        }

        .spacing-chevron-icon {
            position: absolute;
            right: 0;
            top: 50%;
            transform: translateY(-50%);
            pointer-events: none;
            color: var(--text-muted);
            transition: color 0.15s ease;
        }

        .spacing-control:hover .spacing-chevron-icon {
            color: var(--primary);
        }

        /* ===== 3-Column Metrics Dashboard ===== */
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 8px;
            background: var(--surface-muted);
            border: 1px solid var(--border-subtle);
            border-radius: var(--radius-md);
            padding: 12px 6px;
            margin-bottom: 14px;
        }

        .stat-card {
            text-align: center;
            position: relative;
        }

        .stat-card:not(:last-child)::after {
            content: '';
            position: absolute;
            right: 0;
            top: 15%;
            height: 70%;
            width: 1px;
            background: var(--border-subtle);
        }

        .stat-val {
            font-size: 1.35rem;
            font-weight: 600;
            line-height: 1.15;
            color: var(--text-main);
            font-family: inherit;
            font-variant-numeric: tabular-nums;
        }

        .stat-val small {
            font-size: 0.72rem;
            font-weight: 500;
            margin-left: 2px;
        }

        .stat-val.score {
            color: var(--primary);
        }

        .stat-val.avg {
            color: var(--text-muted);
        }

        .stat-val.error {
            color: var(--negative, #dc2626);
        }

        .stat-label {
            font-size: 0.75rem;
            font-weight: 500;
            color: var(--text-muted);
            margin-top: 4px;
        }

        /* ===== Topic Strip ===== */
        .topics-strip {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 16px;
        }

        .topics-scroll {
            flex: 1;
            display: flex;
            gap: 8px;
            overflow-x: auto;
            scrollbar-width: none;
            -webkit-overflow-scrolling: touch;
            padding: 8px 4px 6px;
        }

        .topics-scroll::-webkit-scrollbar {
            display: none;
        }

        /* 专题 tab 胶囊（本页自包含：retest.html 不加载 common.css，
           全局样式会污染本浅色页；此处仅保留横滑不压缩与“最新”角标之外的基座+选中态） */
        #week-tabs .ui-pill {
            flex-shrink: 0;
            position: relative;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 7px 15px;
            font-size: 0.8rem;
            font-weight: 500;
            font-family: inherit;
            color: var(--text-secondary);
            background: var(--surface-subtle);
            border: 1px solid var(--border-subtle);
            border-radius: 999px;
            cursor: pointer;
            white-space: nowrap;
            transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
        }

        #week-tabs .ui-pill:hover {
            border-color: var(--primary);
            color: var(--text-main);
            background: var(--primary-light);
        }

        #week-tabs .ui-pill.active {
            background: var(--brand-500, #2563eb);
            border-color: var(--brand-500, #2563eb);
            color: #ffffff;
            box-shadow: none;
        }

        .ui-pill.has-badge::after {
            content: '最新';
            position: absolute;
            top: -6px;
            right: -4px;
            background: var(--warning, #e0a43a);
            color: #ffffff;
            font-size: 10px;
            font-weight: 500;
            line-height: 1;
            padding: 2px 5px;
            border-radius: var(--radius-xs, 4px);
            border: 1px solid var(--surface-card);
            box-shadow: none;
            letter-spacing: 0.01em;
            white-space: nowrap;
            z-index: 5;
            pointer-events: none;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }

        .btn-all-topics {
            flex-shrink: 0;
            background: var(--surface-subtle);
            border: 1px solid var(--border-subtle);
            color: var(--text-secondary);
            font-size: 0.78rem;
            font-weight: 500;
            padding: 6px 10px;
            border-radius: 999px;
            cursor: pointer;
            transition: background-color 0.15s ease, color 0.15s ease;
        }

        .btn-all-topics:hover {
            background: var(--surface-hover);
            color: var(--text-main);
        }

        /* ===== Full Topic Grid Modal (For 1~20+ Topics) ===== */
        .topic-grid-card {
            background: var(--surface-card);
            border: 1px solid var(--border-subtle);
            border-radius: var(--radius-xl);
            padding: 22px 18px;
            width: 100%;
            max-width: 400px;
            box-shadow: var(--shadow-card);
            animation: zoomIn 0.2s cubic-bezier(0.22, 1, 0.36, 1);
            text-align: left;
        }

        .topic-grid-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 16px;
            padding-bottom: 12px;
            border-bottom: 1px solid var(--border-subtle);
        }

        .topic-grid-title {
            font-size: 1.08rem;
            font-weight: 600;
            color: var(--text-main);
        }

        .topic-grid-subtitle {
            font-size: 0.76rem;
            color: var(--text-muted);
            margin-top: 2px;
        }

        .topic-grid-close {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            background: var(--surface-subtle);
            border: none;
            color: var(--text-muted);
            font-size: 1rem;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: background-color 0.15s ease, color 0.15s ease;
        }

        .topic-grid-close:hover {
            background: var(--surface-hover);
            color: var(--text-main);
        }

        .topic-grid-list {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 8px;
            max-height: 52vh;
            overflow-y: auto;
            padding: 4px 2px 8px;
            scrollbar-width: thin;
        }

        .topic-grid-tile {
            background: var(--surface-muted);
            border: 1px solid var(--border-subtle);
            border-radius: var(--radius-md);
            padding: 10px 4px;
            text-align: center;
            cursor: pointer;
            transition: background-color 0.15s ease, border-color 0.15s ease;
            position: relative;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 3px;
            color: var(--text-main);
        }

        .topic-grid-tile:hover {
            border-color: var(--primary);
            background: var(--primary-light);
        }

        .topic-grid-tile.active {
            background: var(--brand-500, #2563eb);
            border-color: var(--brand-500, #2563eb);
            color: #ffffff;
            box-shadow: none;
        }

        .topic-tile-name {
            font-size: 0.82rem;
            font-weight: 600;
            color: inherit;
        }

        .topic-tile-count {
            font-size: 0.65rem;
            color: var(--text-muted);
            font-weight: 500;
        }

        .topic-grid-tile.active .topic-tile-count {
            color: rgba(255, 255, 255, 0.88);
        }

        .topic-tile-count.unsubmitted {
            color: var(--accent-amber);
            font-weight: 600;
        }

        .topic-tile-count.perfect {
            color: var(--accent-emerald);
            font-weight: 600;
        }

        .topic-grid-tile.active .topic-tile-count.unsubmitted,
        .topic-grid-tile.active .topic-tile-count.perfect {
            color: rgba(255, 255, 255, 0.92);
        }

        .topic-tile-badge {
            position: absolute;
            top: -6px;
            right: -4px;
            background: var(--warning, #e0a43a);
            color: #ffffff;
            font-size: 10px;
            font-weight: 500;
            line-height: 1;
            padding: 2px 5px;
            border-radius: var(--radius-xs, 4px);
            border: 1px solid var(--surface-card);
            box-shadow: none;
            letter-spacing: 0.01em;
            white-space: nowrap;
            z-index: 5;
            pointer-events: none;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }

        /* ===== Empty Notice Hint ===== */
        .empty-hint {
            background: var(--rt-warn-bg);
            border: 1px solid var(--rt-warn-border);
            color: var(--rt-warn-text);
            font-size: 0.82rem;
            font-weight: 500;
            padding: 10px;
            border-radius: var(--radius-md);
            text-align: center;
            margin-bottom: 12px;
        }

        .empty-hint.success-state {
            background: var(--rt-ok-bg) !important;
            border: 1px solid var(--rt-ok-border) !important;
            color: var(--rt-ok-text) !important;
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 12px 14px;
            border-radius: var(--radius-md);
            text-align: left;
        }

        .empty-hint.unsubmitted-state {
            background: var(--rt-warn-bg) !important;
            border: 1px solid var(--rt-warn-border) !important;
            color: var(--rt-warn-text) !important;
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 12px 14px;
            border-radius: var(--radius-md);
            text-align: left;
        }

        /* ===== Action Buttons Group ===== */
        .action-group {
            display: flex;
            flex-direction: column;
            gap: 10px;
            margin-top: 4px;
        }

        .btn-download-main {
            width: 100%;
            height: 48px;
            background: var(--brand-500, #2563eb);
            color: #ffffff;
            border: none;
            border-radius: var(--radius-md);
            font-size: 0.95rem;
            font-weight: 600;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            cursor: pointer;
            box-shadow: none;
            transition: background-color 0.15s ease;
        }

        .btn-download-main:hover {
            background: var(--brand-600, #1d4ed8);
        }

        .btn-download-main:disabled {
            background: var(--surface-subtle) !important;
            color: var(--text-muted) !important;
            box-shadow: none !important;
            cursor: not-allowed !important;
        }

        .btn-download-sub {
            width: 100%;
            height: 44px;
            background: var(--accent-purple-soft);
            color: var(--accent-purple);
            border: 1px solid var(--accent-purple-border);
            border-radius: var(--radius-md);
            font-size: 0.88rem;
            font-weight: 600;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            cursor: pointer;
            transition: background-color 0.15s ease, border-color 0.15s ease;
        }

        .btn-download-sub:hover {
            background: var(--surface-subtle);
            border-color: var(--accent-purple);
        }

        /* ===== Choice Modal (Action Sheet) ===== */
        .choice-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.52);
            z-index: 998;
            display: none;
            align-items: center;
            justify-content: center;
            padding: 20px;
            animation: fadeIn 0.18s ease-out;
        }

        .choice-card {
            background: var(--surface-card);
            border: 1px solid var(--border-subtle);
            border-radius: var(--radius-xl);
            padding: 24px 20px;
            width: 100%;
            max-width: 360px;
            max-height: calc(100dvh - 40px);
            overflow-y: auto;
            box-shadow: var(--shadow-card);
            animation: zoomIn 0.2s cubic-bezier(0.22, 1, 0.36, 1);
            text-align: left;
        }

        .choice-header {
            margin-bottom: 16px;
            text-align: center;
        }

        .choice-title {
            font-size: 1.12rem;
            font-weight: 600;
            color: var(--text-main);
            margin-bottom: 4px;
        }

        .choice-subtitle {
            font-size: 0.8rem;
            color: var(--primary);
            font-weight: 500;
        }

        /* 题头考点提示开关 */
        .choice-topic-hint-box {
            background: var(--surface-muted);
            border: 1px solid var(--border-subtle);
            border-radius: var(--radius-lg, 12px);
            padding: 12px;
            margin-bottom: 12px;
        }

        .choice-topic-hint-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 8px;
        }

        .choice-topic-hint-label {
            font-size: 0.82rem;
            font-weight: 600;
            color: var(--text-main);
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .choice-topic-hint-state {
            font-size: 12px;
            font-weight: 500;
            padding: 2px 8px;
            border-radius: var(--radius-sm, 6px);
            background: var(--rt-info-bg);
            color: var(--rt-info-text);
        }

        .choice-topic-hint-state.hidden {
            background: var(--surface-subtle);
            color: var(--text-muted);
        }

        .choice-topic-hint-state.scope-preview {
            background: var(--rt-warn-bg);
            color: var(--rt-warn-text);
        }

        .choice-topic-hint-state.scope-homework {
            background: var(--accent-purple-soft);
            color: var(--accent-purple);
        }

        .choice-topic-hint-segmented {
            display: flex;
            background: var(--surface-subtle);
            padding: 4px;
            border-radius: 8px;
            gap: 4px;
        }

        .topic-hint-seg-btn {
            flex: 1;
            padding: 8px;
            border: none;
            background: transparent;
            border-radius: var(--radius-sm, 6px);
            font-size: 0.78rem;
            font-weight: 500;
            color: var(--text-muted);
            cursor: pointer;
            transition: background-color 0.15s ease, color 0.15s ease;
            white-space: nowrap;
        }

        .topic-hint-seg-btn:focus-visible {
            outline: var(--focus-ring, 2px solid #2563eb);
            outline-offset: 1px;
        }

        .topic-hint-seg-btn.active {
            background: var(--surface-card);
            color: var(--brand-500, #2563eb);
            font-weight: 600;
            box-shadow: var(--shadow-xs, 0 1px 2px rgba(0, 0, 0, 0.06));
        }

        .choice-options {
            display: flex;
            flex-direction: column;
            gap: 10px;
            margin-bottom: 16px;
        }

        .choice-opt-btn {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 13px 14px;
            background: var(--surface-muted);
            border: 1px solid var(--border-subtle);
            border-radius: var(--radius-lg);
            cursor: pointer;
            transition: background-color 0.15s ease, border-color 0.15s ease;
            text-align: left;
            width: 100%;
        }

        .choice-opt-btn:hover {
            background: var(--primary-light);
            border-color: var(--primary);
        }

        .choice-opt-icon {
            width: 40px;
            height: 40px;
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            background: var(--rt-info-bg);
            color: var(--primary);
        }

        .choice-opt-icon.amber {
            background: var(--rt-warn-bg);
            color: var(--rt-warn-accent);
        }

        .choice-opt-text {
            flex: 1;
        }

        .choice-opt-title {
            font-size: 0.95rem;
            font-weight: 600;
            color: var(--text-main);
            margin-bottom: 2px;
        }

        .choice-opt-desc {
            font-size: 0.74rem;
            color: var(--text-muted);
            line-height: 1.35;
        }

        .choice-btn-cancel {
            width: 100%;
            height: 42px;
            background: var(--surface-subtle);
            color: var(--text-secondary);
            border: none;
            border-radius: var(--radius-md);
            font-size: 0.9rem;
            font-weight: 500;
            cursor: pointer;
            transition: background-color 0.15s ease;
        }

        .choice-btn-cancel:hover {
            background: var(--surface-hover);
        }

        /* ===== Synthesis Progress Modal Overlay ===== */
        .progress-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.52);
            z-index: 999;
            display: none;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }

        .progress-card {
            background: var(--surface-card);
            border: 1px solid var(--border-subtle);
            border-radius: var(--radius-lg);
            padding: 28px 24px;
            text-align: center;
            width: 100%;
            max-width: 320px;
            box-shadow: var(--shadow-card);
            animation: zoomIn 0.2s ease-out;
        }

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

        .progress-spinner {
            width: 44px;
            height: 44px;
            border: 4px solid var(--primary-light);
            border-top: 4px solid var(--primary);
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
            margin: 0 auto 16px;
        }

        .progress-title {
            font-size: 1rem;
            font-weight: 600;
            color: var(--text-main);
            margin-bottom: 6px;
        }

        .progress-status-desc {
            font-size: 0.82rem;
            color: var(--text-muted);
        }

        /* ===== Toast Notification (Unslop 规范) ===== */
        .toast-container {
            position: fixed;
            top: calc(16px + var(--safe-top, 0px));
            left: 16px;
            right: 16px;
            z-index: var(--z-toast, 1200);
            display: flex;
            flex-direction: column;
            gap: 8px;
            pointer-events: none;
            align-items: stretch;
        }

        .toast,
        .toast-item {
            position: relative;
            pointer-events: auto;
            width: 100%;
            max-width: 400px;
            margin: 0 auto;
            padding: 10px 14px;
            border-radius: var(--radius-md);
            background: var(--ui-toast-bg);
            color: var(--text-primary);
            border: 1px solid var(--ui-toast-border);
            font-size: var(--text-sm);
            font-weight: var(--weight-medium);
            box-shadow: var(--shadow-lg);
            opacity: 0;
            transform: translateY(-8px);
            transition: opacity var(--dur-normal) var(--ease), transform var(--dur-normal) var(--ease);
            display: flex;
            align-items: center;
            gap: 10px;
            box-sizing: border-box;
            white-space: normal;
            line-height: 1.45;
        }

        .toast.show,
        .toast-item.show {
            opacity: 1;
            transform: translateY(0);
        }

        .toast.success,
        .toast-item.success { border-left: 3px solid var(--positive); }

        .toast.error,
        .toast-item.error { border-left: 3px solid var(--negative); }

        .toast.warning,
        .toast-item.warning { border-left: 3px solid var(--warning); }

        .toast.info,
        .toast-item.info { border-left: 3px solid var(--brand-500); }

        /* ===== WeChat Guide Overlay & Mask ===== */
        .wechat-guide-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(15, 23, 42, 0.88);
            z-index: 10000;
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            padding: 16px 20px;
            animation: fadeIn 0.2s ease-out;
        }

        .wechat-guide-arrow {
            margin-right: 8px;
        }

        .wechat-guide-card {
            background: rgba(24, 24, 27, 0.9);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: var(--radius-lg);
            padding: 18px 20px;
            color: #ffffff;
            text-align: right;
            margin-top: 6px;
            max-width: 290px;
            box-shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
        }

        /* ===== WeChat Download Action Modal Styles ===== */
        .wechat-dl-icon-circle {
            width: 52px;
            height: 52px;
            border-radius: 50%;
            background: var(--rt-ok-bg);
            color: var(--rt-ok-text);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 12px;
        }

        .wechat-dl-filename {
            font-size: 0.82rem;
            font-weight: 600;
            color: var(--text-main);
            background: var(--surface-subtle);
            padding: 8px 12px;
            border-radius: var(--radius-sm);
            margin-bottom: 16px;
            word-break: break-all;
            overflow-wrap: anywhere;
            text-align: center;
            line-height: 1.4;
        }

        .wechat-dl-actions {
            display: flex;
            flex-direction: column;
            gap: 10px;
            width: 100%;
        }

        /* Fallback for old WeChat X5 kernel without flex gap support */
        .wechat-dl-actions .btn-card-action + .btn-card-action {
            margin-top: 10px;
        }

        @supports (gap: 10px) {
            .wechat-dl-actions .btn-card-action + .btn-card-action {
                margin-top: 0;
            }
        }

        .btn-card-action {
            appearance: none;
            -webkit-appearance: none;
            margin: 0;
            border: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            width: 100%;
            min-height: 48px;
            padding: 12px 16px;
            border-radius: var(--radius-md);
            font-size: 0.95rem;
            font-weight: 600;
            font-family: inherit;
            line-height: 1.3;
            cursor: pointer;
            transition: background-color 0.15s ease, border-color 0.15s ease;
            box-sizing: border-box;
        }

        .btn-card-action svg {
            flex-shrink: 0;
        }

        .btn-card-action.btn-blue {
            background: var(--brand-500, #2563eb);
            color: #ffffff;
            border: none;
            box-shadow: none;
        }

        .btn-card-action.btn-blue:hover {
            background: var(--brand-600, #1d4ed8);
        }

        .btn-card-action.btn-outline {
            background: var(--surface-muted);
            border: 1px solid var(--border-strong);
            color: var(--text-main);
        }

        .btn-card-action.btn-outline:hover {
            background: var(--surface-subtle);
            border-color: var(--primary);
        }

        .wechat-dl-notice {
            margin-top: 14px;
            padding: 10px 12px;
            background: var(--rt-warn-bg);
            border: 1px solid var(--rt-warn-border);
            border-radius: var(--radius-sm);
            font-size: 0.72rem;
            color: var(--rt-warn-text);
            text-align: left;
            line-height: 1.5;
        }

        /* ===== 极方教师联系方式专属入口按钮 ===== */
        .hero-contact-badge {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            font-size: 0.74rem;
            color: var(--primary);
            background: var(--primary-light);
            border: 1px solid var(--primary-border);
            border-radius: 9999px;
            padding: 3px 9px;
            text-decoration: none;
            font-weight: 600;
            white-space: nowrap;
            transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
            cursor: pointer;
        }

        .hero-contact-badge:hover {
            background: var(--primary);
            color: #ffffff;
            border-color: var(--primary);
        }

        .error-contact-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            margin-top: 14px;
            padding: 8px 16px;
            border-radius: 8px;
            background: var(--primary-light);
            border: 1px solid var(--primary-border);
            color: var(--primary);
            font-size: 0.84rem;
            font-weight: 600;
            text-decoration: none;
            transition: background-color 0.15s ease, border-color 0.15s ease;
        }

        .error-contact-btn:hover {
            background: var(--surface-subtle);
            border-color: var(--primary);
        }

        /* ===== Empty Hint States (Success & Warning) ===== */
        .empty-hint.success-state {
            background: var(--rt-ok-bg) !important;
            border: 1px solid var(--rt-ok-border) !important;
            color: var(--rt-ok-text) !important;
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 12px 14px;
            border-radius: var(--radius-md);
            text-align: left;
        }

        .empty-hint {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 12px 14px;
            border-radius: var(--radius-md);
            text-align: left;
        }

