        /* ============================================================
           DESIGN TOKENS
           ============================================================ */
        :root {
            --primary: #0e7490;
            --primary-dk: #0c5b72;
            --grad-main: linear-gradient(135deg, #0891b2 0%, #0f766e 100%);
            --grad-main-dk: #155e75;
            --grad-teal: linear-gradient(135deg, #115e59 0%, #164e63 100%);
            --grad-teal-dk: #042f2e;
            --grad-gold: linear-gradient(135deg, #0e7490 0%, #0369a1 100%);
            --grad-gold-dk: #075985;
            --secondary: #38bdf8;
            --accent: #fb923c;
            --success: #22c55e;
            --success-dk: #16a34a;
            --danger: #ef4444;
            --danger-dk: #dc2626;
            --muted: #64748b;
            --surface: #f8fafc;
            --border: #e2e8f0;

            --opt-a-bg: #e7fdf8;
            --opt-a-bd: #9df1dc;
            --opt-a-tx: #157960;
            --opt-b-bg: #e7fdfc;
            --opt-b-bd: #9df1ee;
            --opt-b-tx: #157976;
            --opt-c-bg: #e7f9fd;
            --opt-c-bd: #9de0f1;
            --opt-c-tx: #156579;
            --opt-d-bg: #e7f4fd;
            --opt-d-bd: #9dcef1;
            --opt-d-tx: #185b8b;

            --fs-xs: clamp(0.62rem, 1.5vw, 0.78rem);
            --fs-sm: clamp(0.75rem, 1.8vw, 0.90rem);
            --fs-base: clamp(0.88rem, 2.0vw, 1.05rem);
            --fs-md: clamp(0.95rem, 2.2vw, 1.12rem);
            --fs-lg: clamp(1.05rem, 2.5vw, 1.30rem);
            --fs-xl: clamp(1.20rem, 3.0vw, 1.60rem);
            --fs-2xl: clamp(1.35rem, 3.8vw, 1.90rem);
            --fs-q: clamp(1.5rem, min(8vw, 8vh), 3.6rem);
        }

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

        html,
        body {
            height: 100%;
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            background: linear-gradient(135deg, #0d9488 0%, #14b8a6 50%, #38bdf8 100%);
            color: #1e293b;
            font-size: var(--fs-base);
            overflow-x: hidden;
            transition: background 0.6s ease;
        }

        /* ── Theme palettes ── */
        body.theme-teal {
            background: linear-gradient(135deg, #0d9488 0%, #14b8a6 50%, #38bdf8 100%);
            --primary: #0e7490;
            --accent: #fb923c;
            --grad-teal: linear-gradient(135deg, #115e59 0%, #164e63 100%);
            --grad-teal-dk: #042f2e;
            --grad-gold: linear-gradient(135deg, #0e7490 0%, #0369a1 100%);
            --grad-gold-dk: #075985;
            --grad-main: linear-gradient(135deg, #0891b2 0%, #0f766e 100%);
            --grad-main-dk: #155e75;
            --opt-a-bg: #e7fdf8;
            --opt-a-bd: #9df1dc;
            --opt-a-tx: #157960;
            --opt-b-bg: #e7fdfc;
            --opt-b-bd: #9df1ee;
            --opt-b-tx: #157976;
            --opt-c-bg: #e7f9fd;
            --opt-c-bd: #9de0f1;
            --opt-c-tx: #156579;
            --opt-d-bg: #e7f4fd;
            --opt-d-bd: #9dcef1;
            --opt-d-tx: #185b8b;
        }
        body.theme-sunset {
            background: linear-gradient(135deg, #fb923c 0%, #ec4899 55%, #a855f7 100%);
            --primary: #be185d;
            --accent: #fbbf24;
            --grad-teal: linear-gradient(135deg, #9f1239 0%, #581c87 100%);
            --grad-teal-dk: #3b0764;
            --grad-gold: linear-gradient(135deg, #ea580c 0%, #db2777 100%);
            --grad-gold-dk: #9d174d;
            --grad-main: linear-gradient(135deg, #f97316 0%, #e11d48 100%);
            --grad-main-dk: #9f1239;
            --opt-a-bg: #fdefe7;
            --opt-a-bd: #f1b99d;
            --opt-a-tx: #823b17;
            --opt-b-bg: #fde7eb;
            --opt-b-bd: #f19dab;
            --opt-b-tx: #821729;
            --opt-c-bg: #fde7f6;
            --opt-c-bd: #f19dd5;
            --opt-c-tx: #8b1865;
            --opt-d-bg: #f6e7fd;
            --opt-d-bd: #d59df1;
            --opt-d-tx: #741ca0;
        }
        body.theme-meadow {
            background: linear-gradient(135deg, #84cc16 0%, #22c55e 50%, #06b6d4 100%);
            --primary: #15803d;
            --accent: #fb923c;
            --grad-teal: linear-gradient(135deg, #166534 0%, #134e4a 100%);
            --grad-teal-dk: #022c22;
            --grad-gold: linear-gradient(135deg, #4d7c0f 0%, #15803d 100%);
            --grad-gold-dk: #14532d;
            --grad-main: linear-gradient(135deg, #16a34a 0%, #0d9488 100%);
            --grad-main-dk: #115e59;
            --opt-a-bg: #f7fde7;
            --opt-a-bd: #d8f19d;
            --opt-a-tx: #4e6812;
            --opt-b-bg: #eafde7;
            --opt-b-bd: #a8f19d;
            --opt-b-tx: #1e6812;
            --opt-c-bg: #e7fdf0;
            --opt-c-bd: #9df1c0;
            --opt-c-tx: #126836;
            --opt-d-bg: #e7fbfd;
            --opt-d-bd: #9deaf1;
            --opt-d-tx: #157179;
        }
        body.theme-candy {
            background: linear-gradient(135deg, #f472b6 0%, #c084fc 50%, #818cf8 100%);
            --primary: #7e22ce;
            --accent: #facc15;
            --grad-teal: linear-gradient(135deg, #6b21a8 0%, #312e81 100%);
            --grad-teal-dk: #1e1b4b;
            --grad-gold: linear-gradient(135deg, #db2777 0%, #9333ea 100%);
            --grad-gold-dk: #6b21a8;
            --grad-main: linear-gradient(135deg, #a855f7 0%, #4f46e5 100%);
            --grad-main-dk: #3730a3;
            --opt-a-bg: #fde7f0;
            --opt-a-bd: #f19dc0;
            --opt-a-tx: #821744;
            --opt-b-bg: #fde7fb;
            --opt-b-bd: #f19dea;
            --opt-b-tx: #8b1881;
            --opt-c-bg: #f4e7fd;
            --opt-c-bd: #ce9df1;
            --opt-c-tx: #691ca0;
            --opt-d-bg: #e7e7fd;
            --opt-d-bd: #9d9df1;
            --opt-d-tx: #18188b;
        }
        body.theme-sky {
            background: linear-gradient(135deg, #38bdf8 0%, #a78bfa 55%, #f472b6 100%);
            --primary: #4338ca;
            --accent: #fb7185;
            --grad-teal: linear-gradient(135deg, #3730a3 0%, #4c1d95 100%);
            --grad-teal-dk: #2e1065;
            --grad-gold: linear-gradient(135deg, #0369a1 0%, #4f46e5 100%);
            --grad-gold-dk: #312e81;
            --grad-main: linear-gradient(135deg, #7c3aed 0%, #db2777 100%);
            --grad-main-dk: #9d174d;
            --opt-a-bg: #e7f6fd;
            --opt-a-bd: #9dd5f1;
            --opt-a-tx: #155879;
            --opt-b-bg: #e7ebfd;
            --opt-b-bd: #9dabf1;
            --opt-b-tx: #182c8b;
            --opt-c-bg: #f0e7fd;
            --opt-c-bd: #c09df1;
            --opt-c-tx: #531ca0;
            --opt-d-bg: #fde7f6;
            --opt-d-bd: #f19dd5;
            --opt-d-tx: #8b1865;
        }
        body.theme-citrus {
            background: linear-gradient(135deg, #fde047 0%, #fb923c 50%, #f472b6 100%);
            --primary: #c2410c;
            --accent: #a855f7;
            --grad-teal: linear-gradient(135deg, #9a3412 0%, #9d174d 100%);
            --grad-teal-dk: #831843;
            --grad-gold: linear-gradient(135deg, #d97706 0%, #ea580c 100%);
            --grad-gold-dk: #9a3412;
            --grad-main: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
            --grad-main-dk: #c2410c;
            --opt-a-bg: #fdf9e7;
            --opt-a-bd: #f1e39d;
            --opt-a-tx: #685a12;
            --opt-b-bg: #fdf2e7;
            --opt-b-bd: #f1c49d;
            --opt-b-tx: #824917;
            --opt-c-bg: #fdeae7;
            --opt-c-bd: #f1a89d;
            --opt-c-tx: #822517;
            --opt-d-bg: #fde7ed;
            --opt-d-bd: #f19db2;
            --opt-d-tx: #821732;
        }

        /* ── NEW THEMES ── */
        body.theme-ocean {
            background: linear-gradient(135deg, #1e3a5f 0%, #0ea5e9 50%, #7dd3fc 100%);
            --primary: #1e3a5f;
            --accent: #38bdf8;
            --grad-teal: linear-gradient(135deg, #1e40af 0%, #1e3a5f 100%);
            --grad-teal-dk: #172554;
            --grad-gold: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
            --grad-gold-dk: #1e40af;
            --grad-main: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
            --grad-main-dk: #1d4ed8;
            --opt-a-bg: #e7effd;
            --opt-a-bd: #9dbcf1;
            --opt-a-tx: #153779;
            --opt-b-bg: #e7f2fd;
            --opt-b-bd: #9dc8f1;
            --opt-b-tx: #155879;
            --opt-c-bg: #e7f6fd;
            --opt-c-bd: #9dd5f1;
            --opt-c-tx: #157179;
            --opt-d-bg: #e7fafd;
            --opt-d-bd: #9de8f1;
            --opt-d-tx: #157979;
        }
        body.theme-lavender {
            background: linear-gradient(135deg, #7c3aed 0%, #a78bfa 50%, #c4b5fd 100%);
            --primary: #4c1d95;
            --accent: #a78bfa;
            --grad-teal: linear-gradient(135deg, #6d28d9 0%, #4c1d95 100%);
            --grad-teal-dk: #2e1065;
            --grad-gold: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
            --grad-gold-dk: #6d28d9;
            --grad-main: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
            --grad-main-dk: #7c3aed;
            --opt-a-bg: #f2e7fd;
            --opt-a-bd: #c89df1;
            --opt-a-tx: #5c1ca0;
            --opt-b-bg: #f0e7fd;
            --opt-b-bd: #c09df1;
            --opt-b-tx: #531ca0;
            --opt-c-bg: #ede7fd;
            --opt-c-bd: #b89df1;
            --opt-c-tx: #4a1ca0;
            --opt-d-bg: #eae7fd;
            --opt-d-bd: #b09df1;
            --opt-d-tx: #411ca0;
        }
        body.theme-forest {
            background: linear-gradient(135deg, #14532d 0%, #22c55e 50%, #86efac 100%);
            --primary: #14532d;
            --accent: #4ade80;
            --grad-teal: linear-gradient(135deg, #166534 0%, #14532d 100%);
            --grad-teal-dk: #0a2e1a;
            --grad-gold: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
            --grad-gold-dk: #15803d;
            --grad-main: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
            --grad-main-dk: #16a34a;
            --opt-a-bg: #e7fdee;
            --opt-a-bd: #9df1b3;
            --opt-a-tx: #126836;
            --opt-b-bg: #e7fdf2;
            --opt-b-bd: #9df1c0;
            --opt-b-tx: #126845;
            --opt-c-bg: #e7fdf6;
            --opt-c-bd: #9df1cd;
            --opt-c-tx: #126854;
            --opt-d-bg: #e7fdfa;
            --opt-d-bd: #9df1da;
            --opt-d-tx: #126863;
        }
        body.theme-sakura {
            background: linear-gradient(135deg, #db2777 0%, #f472b6 50%, #fbcfe8 100%);
            --primary: #831843;
            --accent: #f472b6;
            --grad-teal: linear-gradient(135deg, #be185d 0%, #831843 100%);
            --grad-teal-dk: #4c0519;
            --grad-gold: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
            --grad-gold-dk: #be185d;
            --grad-main: linear-gradient(135deg, #f472b6 0%, #ec4899 100%);
            --grad-main-dk: #db2777;
            --opt-a-bg: #fde7f0;
            --opt-a-bd: #f19dc0;
            --opt-a-tx: #821744;
            --opt-b-bg: #fde7f4;
            --opt-b-bd: #f19dcd;
            --opt-b-tx: #821757;
            --opt-c-bg: #fde7f8;
            --opt-c-bd: #f19dda;
            --opt-c-tx: #82176a;
            --opt-d-bg: #fde7fc;
            --opt-d-bd: #f19de7;
            --opt-d-tx: #82177d;
        }
        body.theme-midnight {
            background: linear-gradient(135deg, #1e1b4b 0%, #4338ca 50%, #818cf8 100%);
            --primary: #0f0a3a;
            --accent: #818cf8;
            --grad-teal: linear-gradient(135deg, #1e1b4b 0%, #0f0a3a 100%);
            --grad-teal-dk: #08051f;
            --grad-gold: linear-gradient(135deg, #3730a3 0%, #312e81 100%);
            --grad-gold-dk: #1e1b4b;
            --grad-main: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
            --grad-main-dk: #3730a3;
            --opt-a-bg: #e7e7fd;
            --opt-a-bd: #9d9df1;
            --opt-a-tx: #18188b;
            --opt-b-bg: #e7ebfd;
            --opt-b-bd: #9dabf1;
            --opt-b-tx: #182c8b;
            --opt-c-bg: #e7effd;
            --opt-c-bd: #9dbcf1;
            --opt-c-tx: #183f8b;
            --opt-d-bg: #e7f2fd;
            --opt-d-bd: #9dc8f1;
            --opt-d-tx: #18518b;
        }
        body.theme-coral {
            background: linear-gradient(135deg, #7c2d12 0%, #f97316 50%, #fdba74 100%);
            --primary: #7c2d12;
            --accent: #fb923c;
            --grad-teal: linear-gradient(135deg, #9a3412 0%, #7c2d12 100%);
            --grad-teal-dk: #431407;
            --grad-gold: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
            --grad-gold-dk: #9a3412;
            --grad-main: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
            --grad-main-dk: #c2410c;
            --opt-a-bg: #fdf2e7;
            --opt-a-bd: #f1c49d;
            --opt-a-tx: #824917;
            --opt-b-bg: #fdeee7;
            --opt-b-bd: #f1b99d;
            --opt-b-tx: #823b17;
            --opt-c-bg: #fdeae7;
            --opt-c-bd: #f1a89d;
            --opt-c-tx: #822517;
            --opt-d-bg: #fde6e7;
            --opt-d-bd: #f1979d;
            --opt-d-tx: #821017;
        }

        /* ── Shell ── */
        .app-shell {
            display: flex;
            flex-direction: column;
            height: 100vh;
            height: 100dvh;
            min-height: 100vh;
            min-height: 100dvh;
            max-width: 900px;
            margin: 0 auto;
            padding: clamp(6px, 1.5vh, 12px) 16px 0;
        }

        /* ── Title bar ── */
        .app-title {
            flex-shrink: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 12px;
            background: rgba(255, 255, 255, 0.18);
            backdrop-filter: blur(12px);
            border-radius: 14px 14px 0 0;
            padding: clamp(8px, 2.4vh, 20px) 18px;
            color: #fff;
            letter-spacing: -0.01em;
            text-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
            user-select: none;
        }
        .app-title .title-text {
            font-size: clamp(1.5rem, 5vw, 2.2rem);
            font-weight: 900;
            background: linear-gradient(135deg, #ffffff 0%, #ffe9b0 100%);
            -webkit-background-clip: text;
            background-clip: text;
            -webkit-text-fill-color: transparent;
            letter-spacing: 0.02em;
            text-align: center;
        }
        .app-title .icon-wrap {
            width: 32px;
            height: 32px;
            background: rgba(255, 255, 255, 0.25);
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.1rem;
        }

        /* ── Control bar ── */
        .ctrl-bar {
            flex-shrink: 0;
            background: #fff;
            padding: clamp(4px, 1vh, 8px) 14px;
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 8px;
            border-bottom: 1px solid var(--border);
        }
        .ctrl-left {
            flex: 1;
        }
        .ctrl-right {
            display: flex;
            gap: 8px;
            align-items: center;
        }

        .lang-toggle {
            display: inline-flex;
            align-items: center;
            background: var(--border);
            border-radius: 999px;
            padding: 3px;
            gap: 2px;
        }
        .lang-toggle-opt {
            border: none;
            background: transparent;
            padding: 6px 14px;
            border-radius: 999px;
            color: var(--muted);
            font-size: var(--fs-sm);
            font-weight: 700;
            line-height: 1;
            white-space: nowrap;
            cursor: pointer;
            transition: all 0.2s;
        }
        .lang-toggle-opt.active {
            background: var(--primary);
            color: #fff;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
        }
        .lang-toggle-opt:not(.active):hover {
            color: var(--primary);
        }

        .theme-cycle-btn {
            width: 38px;
            height: 38px;
            border-radius: 50%;
            border: 2px solid var(--border);
            background: #fff;
            color: var(--muted);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 0.9rem;
            transition: all 0.18s;
        }
        .theme-cycle-btn:hover {
            border-color: var(--primary);
            color: var(--primary);
            transform: scale(1.08);
        }

        /* ── Quick-switch icons to sibling operation apps ── */
        .quick-nav {
            display: flex;
            gap: 6px;
            align-items: center;
        }
        .quick-nav-btn {
            width: 38px;
            height: 38px;
            border-radius: 50%;
            border: 2px solid var(--border);
            background: #fff;
            color: var(--muted);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 0.95rem;
            text-decoration: none;
            transition: all 0.18s;
        }
        .quick-nav-btn:hover {
            border-color: var(--primary);
            color: var(--primary);
            transform: scale(1.08);
        }

        /* ── Settings bar ── */
        .settings-bar {
            flex-shrink: 0;
            display: flex;
            flex-wrap: wrap;
            gap: clamp(6px, 1.5vh, 12px);
            align-items: center;
            justify-content: center;
            background: rgba(255, 255, 255, 0.18);
            backdrop-filter: blur(12px);
            border-radius: 18px;
            padding: clamp(8px, 2vh, 14px) 18px;
            margin-bottom: clamp(6px, 1.2vh, 10px);
        }
        .settings-select {
            padding: 10px 18px;
            border: none;
            border-radius: 36px;
            background: var(--grad-gold);
            color: #fff;
            font-size: 1.2rem;
            font-weight: 700;
            cursor: pointer;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
            box-shadow: 0 3px 0 var(--grad-gold-dk), 0 5px 10px rgba(0, 0, 0, 0.18);
            transition: transform 0.15s, box-shadow 0.15s;
        }
        .settings-select option {
            background: var(--grad-gold-dk);
            color: #fff;
        }
        .settings-select:hover,
        .settings-select:focus {
            transform: translateY(-1px);
            box-shadow: 0 4px 0 var(--grad-gold-dk), 0 7px 14px rgba(0, 0, 0, 0.22);
            outline: none;
        }
        .settings-select:active {
            transform: translateY(2px);
            box-shadow: 0 1px 0 var(--grad-gold-dk);
        }
        .settings-select:disabled {
            opacity: 0.6;
            cursor: not-allowed;
            transform: none;
        }

        /* Difficulty select keeps square corners (no pill / rounded edge) */
        #diffSelect,
        #tableRange {
            border-radius: 0;
        }

        /* Row that groups duration + negatives toggle */
        .settings-row2 {
            display: flex;
            align-items: center;
            gap: 12px;
            flex-wrap: wrap;
            justify-content: center;
        }

        .neg-toggle {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 10px 18px;
            border: none;
            border-radius: 36px;
            background: var(--grad-gold);
            color: #fff;
            font-size: 1.2rem;
            font-weight: 700;
            cursor: pointer;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
            box-shadow: 0 3px 0 var(--grad-gold-dk), 0 5px 10px rgba(0, 0, 0, 0.18);
            transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
            white-space: nowrap;
            user-select: none;
        }
        .neg-toggle:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 0 var(--grad-gold-dk), 0 7px 14px rgba(0, 0, 0, 0.22);
        }
        .neg-toggle:active {
            transform: translateY(2px);
            box-shadow: 0 1px 0 var(--grad-gold-dk);
        }
        .neg-toggle input {
            width: 20px;
            height: 20px;
            cursor: pointer;
            accent-color: var(--grad-gold-dk);
        }
        .neg-toggle.active {
            background: var(--grad-gold-dk);
            box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3) inset;
            color: #fff;
        }

        @media (max-width: 600px) {
            .settings-bar {
                padding: 10px 12px;
                gap: 8px;
                border-radius: 14px;
            }
            .settings-select,
            .neg-toggle {
                font-size: 0.95rem;
                padding: 8px 12px;
                border-radius: 24px;
            }
            .neg-toggle input {
                width: 16px;
                height: 16px;
            }
        }

        /* ── Main area ── */
        .main-area {
            flex: 1;
            overflow-y: auto;
            background: #fff;
            border-left: 1px solid var(--border);
            border-right: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: clamp(8px, 2.5vh, 20px) 16px;
            -webkit-overflow-scrolling: touch;
        }

        /* ── Footer ── */
        .app-footer {
            flex-shrink: 0;
            background: #fff;
            border-radius: 0 0 14px 14px;
            border-top: 1px solid var(--border);
            box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.07);
            padding: clamp(6px, 1.5vh, 10px) 18px;
            text-align: center;
            margin-bottom: clamp(6px, 1.5vh, 12px);
        }
        .footer-text {
            font-size: var(--fs-xs);
            color: var(--muted);
            line-height: 1.5;
            margin-bottom: 6px;
        }
        .whatsapp-btn {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            background: #25D366;
            color: #fff;
            padding: 6px 14px;
            border-radius: 8px;
            text-decoration: none;
            font-size: var(--fs-xs);
            font-weight: 600;
            transition: transform 0.2s, box-shadow 0.2s;
        }
        .whatsapp-btn:hover {
            color: #fff;
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(37, 211, 102, .35);
        }

        /* ── Icon buttons ── */
        .icon-btn {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 6px 12px;
            border: 2px solid var(--border);
            border-radius: 8px;
            background: #fff;
            color: var(--muted);
            font-size: var(--fs-sm);
            font-weight: 600;
            cursor: pointer;
            transition: all 0.18s;
            white-space: nowrap;
        }
        .icon-btn:hover {
            border-color: var(--primary);
            color: var(--primary);
        }

        /* ============================================================
           GAME CARD
           ============================================================ */
        .game-card {
            width: 100%;
            max-width: 520px;
            display: flex;
            flex-direction: column;
            gap: clamp(8px, 2vh, 16px);
            animation: fadeUp 0.35s ease;
        }

        /* ── Stats bar ── */
        .stats-bar {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 0;
            border: 2px solid var(--border);
            border-radius: 12px;
            overflow: hidden;
            background: var(--surface);
        }
        .stat-cell {
            text-align: center;
            padding: clamp(6px, 1.5vh, 10px) 6px;
            position: relative;
        }
        .stat-cell+.stat-cell::before {
            content: '';
            position: absolute;
            left: 0;
            top: 20%;
            height: 60%;
            width: 1px;
            background: var(--border);
        }
        .stat-label {
            font-size: var(--fs-xs);
            color: var(--muted);
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            display: block;
            margin-bottom: 2px;
        }
        .stat-value {
            font-size: var(--fs-xl);
            font-weight: 800;
            color: var(--primary);
            display: block;
            line-height: 1.1;
        }

        /* ── Timer ring (保留原环形进度条) ── */
        .timer-ring-wrap {
            display: flex;
            justify-content: center;
            margin: -4px 0;
        }
        .timer-ring-wrap svg {
            overflow: visible;
        }
        .ring-track {
            fill: none;
            stroke: var(--border);
            stroke-width: 7;
        }
        .ring-fill {
            fill: none;
            stroke: var(--primary);
            stroke-width: 7;
            stroke-linecap: round;
            stroke-dasharray: 220;
            stroke-dashoffset: 0;
            transform: rotate(-90deg);
            transform-origin: 50% 50%;
            transition: stroke-dashoffset 0.9s linear, stroke 0.5s;
        }
        .ring-fill.warning {
            stroke: var(--danger);
        }
        .ring-label {
            font-size: 1.4rem;
            font-weight: 800;
            fill: var(--primary);
            text-anchor: middle;
            dominant-baseline: central;
        }
        .ring-label.warning {
            fill: var(--danger);
        }

        /* ── 右侧旋转圆环计时器 ── */
        .question-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            width: 100%;
        }
        .question-wrap {
            flex: 1;
            text-align: center;
            min-height: clamp(40px, 9vh, 80px);
            display: flex;
            align-items: center;
            justify-content: center;
            padding: clamp(4px, 1.2vh, 12px) 0;
        }
        .timer-circle-wrap {
            flex-shrink: 0;
            width: 72px;
            height: 72px;
            display: none;
            position: relative;
        }
        .timer-circle-wrap.visible {
            display: block;
        }

        .timer-circle {
            width: 100%;
            height: 100%;
            border-radius: 50%;
            background: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        }

        .timer-ring {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            border-radius: 50%;
            background: conic-gradient(from 0deg, #f472b6, #818cf8, #f472b6);
            animation: spin 2s linear infinite;
            z-index: 0;
        }

        .timer-circle-inner {
            position: relative;
            width: calc(100% - 10px);
            height: calc(100% - 10px);
            border-radius: 50%;
            background: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.5rem;
            font-weight: 800;
            color: var(--primary);
            z-index: 1;
            transition: color 0.3s;
            box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.04);
        }
        .timer-circle-inner.warning {
            color: var(--danger);
            animation: pulseText 0.8s ease-in-out infinite;
        }

        @keyframes spin {
            to {
                transform: rotate(360deg);
            }
        }
        @keyframes pulseText {
            0%,
            100% {
                opacity: 1;
                transform: scale(1);
            }
            50% {
                opacity: 0.5;
                transform: scale(0.92);
            }
        }

        /* ── 移动端适配 ── */
        @media (max-width: 480px) {
            .timer-circle-wrap {
                width: 60px;
                height: 60px;
            }
            .timer-circle-inner {
                font-size: 1.2rem;
            }
        }
        @media (max-height: 700px) {
            .timer-circle-wrap {
                width: 56px;
                height: 56px;
            }
            .timer-circle-inner {
                font-size: 1.0rem;
            }
        }
        @media (max-height: 560px) {
            .timer-circle-wrap {
                width: 48px;
                height: 48px;
            }
            .timer-circle-inner {
                font-size: 0.9rem;
            }
        }

        /* ── Question display ── */
        .question-idle {
            color: var(--muted);
            font-size: var(--fs-lg);
            font-weight: 500;
        }
        .question-number {
            font-size: var(--fs-q);
            font-weight: 900;
            color: #1e293b;
            letter-spacing: -0.02em;
            line-height: 1;
        }
        .question-number .op {
            color: var(--primary);
            font-weight: 700;
            font-size: 0.72em;
            margin: 0 6px;
        }
        .question-number .eq {
            color: var(--muted);
            font-weight: 600;
            font-size: 0.65em;
            margin-left: 6px;
        }
        .question-number .blank {
            color: var(--accent);
            font-weight: 900;
        }
        .countdown-display {
            font-size: var(--fs-q);
            font-weight: 900;
            color: var(--primary);
        }

        /* ============================================================
           ANSWER OPTIONS  — 1 column on mobile portrait, 2×2 on wider
           ============================================================ */
        .options-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 14px;
        }
        @media (min-width: 480px) {
            .options-grid {
                grid-template-columns: 1fr 1fr;
                gap: 14px;
            }
        }
        .opt-btn {
            position: relative;
            padding: 0;
            height: clamp(40px, min(14vw, 10vh), 80px);
            border-radius: 14px;
            font-size: var(--fs-xl);
            font-weight: 800;
            cursor: pointer;
            transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
            overflow: hidden;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            user-select: none;
            -webkit-tap-highlight-color: transparent;
        }
        .opt-btn .opt-label {
            position: absolute;
            top: 7px;
            left: 10px;
            font-size: var(--fs-xs);
            font-weight: 700;
            opacity: 0.75;
            letter-spacing: 0.04em;
        }
        .opt-btn:nth-child(1) {
            background: var(--opt-a-bg);
            border: 2px solid var(--opt-a-bd);
            color: var(--opt-a-tx);
            box-shadow: 0 4px 0 var(--opt-a-bd);
        }
        .opt-btn:nth-child(2) {
            background: var(--opt-b-bg);
            border: 2px solid var(--opt-b-bd);
            color: var(--opt-b-tx);
            box-shadow: 0 4px 0 var(--opt-b-bd);
        }
        .opt-btn:nth-child(3) {
            background: var(--opt-c-bg);
            border: 2px solid var(--opt-c-bd);
            color: var(--opt-c-tx);
            box-shadow: 0 4px 0 var(--opt-c-bd);
        }
        .opt-btn:nth-child(4) {
            background: var(--opt-d-bg);
            border: 2px solid var(--opt-d-bd);
            color: var(--opt-d-tx);
            box-shadow: 0 4px 0 var(--opt-d-bd);
        }
        .opt-btn:hover {
            transform: translateY(-3px);
            filter: brightness(1.06);
        }
        .opt-btn:active {
            transform: translateY(2px);
            box-shadow: none !important;
            filter: brightness(0.92);
        }
        .opt-btn:disabled {
            cursor: default;
        }
        .opt-btn.flash-correct {
            background: var(--success) !important;
            border-color: var(--success-dk) !important;
            color: #fff !important;
            box-shadow: 0 4px 0 var(--success-dk) !important;
            animation: popIn 0.25s ease;
        }
        .opt-btn.flash-wrong {
            background: var(--danger) !important;
            border-color: var(--danger-dk) !important;
            color: #fff !important;
            box-shadow: 0 4px 0 var(--danger-dk) !important;
            animation: shake 0.30s ease;
        }
        .opt-btn.flash-reveal {
            background: var(--success) !important;
            border-color: var(--success-dk) !important;
            color: #fff !important;
            box-shadow: 0 4px 0 var(--success-dk) !important;
        }

        /* ── Primary action button ── */
        .btn-primary {
            width: 100%;
            padding: 15px;
            background: var(--grad-teal);
            color: #fff;
            border: none;
            border-radius: 12px;
            font-size: var(--fs-md);
            font-weight: 700;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
            transition: transform 0.2s, box-shadow 0.2s;
            box-shadow: 0 5px 0 var(--grad-teal-dk), 0 8px 16px rgba(0, 0, 0, 0.22);
        }
        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 7px 0 var(--grad-teal-dk), 0 11px 18px rgba(0, 0, 0, 0.26);
        }
        .btn-primary:active {
            transform: translateY(3px);
            box-shadow: 0 2px 0 var(--grad-teal-dk);
        }

        /* ── Start + History row ── */
        .start-row {
            display: flex;
            gap: 10px;
            align-items: stretch;
            width: 100%;
        }
        .start-row .btn-primary {
            flex: 1;
        }
        .history-inline-btn {
            flex-shrink: 0;
            white-space: nowrap;
        }

        /* ── Quit bar ── */
        .quit-bar {
            display: none;
            justify-content: center;
        }
        .quit-bar.visible {
            display: flex;
        }
        .btn-quit {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 10px 22px;
            background: #fff;
            color: var(--danger);
            border: 2px solid var(--danger);
            border-radius: 10px;
            font-size: var(--fs-sm);
            font-weight: 700;
            cursor: pointer;
            transition: all 0.18s;
        }
        .btn-quit:hover {
            background: var(--danger);
            color: #fff;
        }

        /* ── Quit confirm strip ── */
        .quit-confirm {
            display: none;
            flex-direction: column;
            align-items: center;
            gap: 10px;
            padding: 14px 18px;
            background: #fff7ed;
            border: 2px solid #fed7aa;
            border-radius: 12px;
            text-align: center;
            animation: fadeUp 0.2s ease;
        }
        .quit-confirm.visible {
            display: flex;
        }
        .quit-confirm p {
            font-size: var(--fs-sm);
            color: #92400e;
            font-weight: 600;
        }
        .quit-confirm-btns {
            display: flex;
            gap: 10px;
        }
        .btn-confirm-yes {
            padding: 8px 20px;
            background: var(--grad-main);
            color: #fff;
            border: none;
            border-radius: 8px;
            font-weight: 700;
            font-size: var(--fs-sm);
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
            box-shadow: 0 3px 0 var(--grad-main-dk);
            cursor: pointer;
            transition: filter 0.15s;
        }
        .btn-confirm-yes:hover {
            filter: brightness(1.1);
        }
        .btn-confirm-no {
            padding: 8px 20px;
            background: #fff;
            color: var(--muted);
            border: 2px solid var(--border);
            border-radius: 8px;
            font-weight: 700;
            font-size: var(--fs-sm);
            cursor: pointer;
            transition: border-color 0.15s, color 0.15s;
        }
        .btn-confirm-no:hover {
            border-color: var(--primary);
            color: var(--primary);
        }

        /* ============================================================
           MODAL
           ============================================================ */
        .modal-overlay {
            position: fixed;
            inset: 0;
            background: rgba(15, 23, 42, 0.55);
            backdrop-filter: blur(4px);
            display: none;
            align-items: center;
            justify-content: center;
            padding: 20px;
            z-index: 2000;
        }
        .modal-overlay.show {
            display: flex;
        }
        .modal-box {
            background: #fff;
            border-radius: 16px;
            max-width: 480px;
            width: 100%;
            max-height: 88vh;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
            animation: popIn 0.28s ease;
        }
        .modal-hd {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 16px 20px;
            border-bottom: 1px solid var(--border);
            background: var(--surface);
            border-radius: 16px 16px 0 0;
        }
        .modal-hd h5 {
            margin: 0;
            font-size: var(--fs-lg);
            font-weight: 800;
            color: var(--primary);
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .btn-close-modal {
            background: none;
            border: none;
            font-size: 1.3rem;
            cursor: pointer;
            color: var(--muted);
            width: 30px;
            height: 30px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 6px;
            transition: background 0.15s, color 0.15s;
        }
        .btn-close-modal:hover {
            background: #fee2e2;
            color: var(--danger);
        }
        .modal-bd {
            flex: 1;
            overflow-y: auto;
            padding: 20px;
            -webkit-overflow-scrolling: touch;
        }
        .modal-ft {
            flex-shrink: 0;
            padding: 14px 20px;
            border-top: 1px solid var(--border);
            background: var(--surface);
            border-radius: 0 0 16px 16px;
        }
        .modal-footer-info {
            font-size: var(--fs-xs);
            color: var(--muted);
            line-height: 1.5;
            margin-bottom: 8px;
            text-align: center;
        }
        .modal-actions {
            display: flex;
            gap: 8px;
            justify-content: flex-end;
            flex-wrap: wrap;
            margin-top: 10px;
        }
        .btn-modal {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 9px 18px;
            border-radius: 9px;
            border: none;
            font-size: var(--fs-sm);
            font-weight: 700;
            cursor: pointer;
            transition: all 0.18s;
        }
        .btn-modal.outline {
            background: #fff;
            color: var(--muted);
            border: 2px solid var(--border);
        }
        .btn-modal.outline:hover {
            border-color: var(--primary);
            color: var(--primary);
        }
        .btn-modal.filled {
            background: var(--grad-teal);
            color: #fff;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
            box-shadow: 0 3px 0 var(--grad-teal-dk);
        }
        .btn-modal.filled:hover {
            filter: brightness(1.10);
            transform: translateY(-1px);
        }
        .btn-modal.danger {
            background: var(--danger);
            color: #fff;
        }
        .btn-modal.danger:hover {
            filter: brightness(1.08);
        }

        /* ── Result modal ── */
        .result-hero {
            text-align: center;
            padding: 10px 0 16px;
        }
        .result-grade-ring {
            width: 96px;
            height: 96px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--primary), var(--accent));
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 14px;
            box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
        }
        .result-grade-text {
            font-size: 2.4rem;
            font-weight: 900;
            color: #fff;
        }
        .result-score-big {
            font-size: var(--fs-2xl);
            font-weight: 800;
            color: #1e293b;
            margin-bottom: 6px;
        }
        .result-score-big span {
            color: var(--primary);
        }
        .result-msg {
            color: var(--muted);
            font-size: var(--fs-md);
            margin-bottom: 16px;
        }
        .result-stats-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 8px;
            margin-top: 10px;
        }
        .rsg-cell {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 10px 6px;
            text-align: center;
        }
        .rsg-val {
            font-size: var(--fs-lg);
            font-weight: 800;
            color: var(--primary);
        }
        .rsg-lbl {
            font-size: var(--fs-xs);
            color: var(--muted);
            font-weight: 600;
            margin-top: 2px;
        }
        .grade-ss .result-grade-ring {
            background: linear-gradient(135deg, #f59e0b, #ef4444);
        }
        .grade-s .result-grade-ring {
            background: linear-gradient(135deg, #8b5cf6, #6366f1);
        }
        .grade-a .result-grade-ring {
            background: linear-gradient(135deg, #6366f1, #22d3ee);
        }
        .grade-b .result-grade-ring {
            background: linear-gradient(135deg, #22c55e, #06b6d4);
        }

        /* ── History modal ── */
        .history-summary {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 8px;
            margin-bottom: 16px;
        }
        .hs-cell {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 10px 6px;
            text-align: center;
        }
        .hs-val {
            font-size: var(--fs-lg);
            font-weight: 800;
            color: var(--primary);
        }
        .hs-lbl {
            font-size: var(--fs-xs);
            color: var(--muted);
            font-weight: 600;
            margin-top: 2px;
        }
        .history-list {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }
        .history-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px 14px;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 10px;
        }
        .hi-badge {
            width: 42px;
            height: 42px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--primary), var(--accent));
            color: #fff;
            font-weight: 900;
            font-size: var(--fs-md);
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }
        .hi-score {
            font-weight: 700;
            font-size: var(--fs-md);
            color: #1e293b;
        }
        .hi-meta {
            font-size: var(--fs-xs);
            color: var(--muted);
            margin-top: 2px;
        }
        .hi-rank {
            margin-left: auto;
            font-size: var(--fs-xs);
            color: var(--muted);
            font-weight: 600;
        }
        .no-history {
            text-align: center;
            padding: 36px 20px;
            color: var(--muted);
        }
        .no-history i {
            font-size: 2.4rem;
            display: block;
            margin-bottom: 10px;
            opacity: 0.4;
        }

        /* ============================================================
           ANIMATIONS
           ============================================================ */
        @keyframes fadeUp {
            from {
                opacity: 0;
                transform: translateY(14px)
            }
            to {
                opacity: 1;
                transform: translateY(0)
            }
        }
        @keyframes popIn {
            0% {
                transform: scale(0.8);
                opacity: 0
            }
            60% {
                transform: scale(1.06)
            }
            100% {
                transform: scale(1);
                opacity: 1
            }
        }
        @keyframes shake {
            0%,
            100% {
                transform: translateX(0)
            }
            25% {
                transform: translateX(-6px)
            }
            75% {
                transform: translateX(6px)
            }
        }
        @keyframes countBounce {
            0% {
                transform: scale(0.6);
                opacity: 0
            }
            60% {
                transform: scale(1.15)
            }
            100% {
                transform: scale(1);
                opacity: 1
            }
        }
        .anim-count {
            animation: countBounce 0.35s ease forwards;
        }

        /* ============================================================
           RESPONSIVE
           ============================================================ */
        @media (max-width: 480px) {
            .app-shell {
                padding: 6px 8px 0;
            }
            .app-title {
                border-radius: 10px 10px 0 0;
                gap: 8px;
                padding: 14px 10px;
            }
            .app-title .title-text {
                font-size: clamp(1.1rem, 5vw, 1.5rem);
            }
            .ctrl-bar {
                padding: 6px 10px;
            }
            .main-area {
                padding: 12px 10px;
                justify-content: flex-start;
            }
            .game-card {
                gap: 12px;
            }
            .opt-btn {
                height: clamp(40px, min(15vw, 10vh), 76px);
                border-radius: 12px;
                font-size: var(--fs-2xl);
            }
            .options-grid {
                gap: 12px;
            }
            .app-footer {
                padding: 8px 12px;
                margin-bottom: 6px;
                border-radius: 0 0 10px 10px;
            }
            .timer-ring-wrap {
                display: none;
            }
            .stats-bar {
                margin-bottom: 0;
            }
            .start-row {
                flex-wrap: wrap;
            }
            .history-inline-btn {
                flex: 1;
                justify-content: center;
            }
        }
        @media (min-width: 481px) and (max-width: 768px) {
            .main-area {
                justify-content: flex-start;
                padding-top: 24px;
            }
        }
        @media (min-width: 900px) {
            .app-title .title-text {
                font-size: clamp(1.6rem, 2.4vw, 2.1rem);
            }
        }

        /* ── Portrait mode: difficulty on its own row; duration + negatives on next row ── */
        @media (orientation: portrait) {
            .settings-bar {
                flex-direction: column;
            }
            .settings-row2 {
                width: 100%;
            }
            .neg-toggle {
                background: none;
                border: none;
                box-shadow: none;
                padding: 6px 4px;
                color: #fff;
                text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
            }
            .neg-toggle.active {
                background: none;
                color: #fff;
            }
        }

        /* ============================================================
           SHORT-VIEWPORT MODE
           ============================================================ */
        @media (max-height: 700px) {
            .timer-ring-wrap {
                display: none;
            }
            .options-grid {
                grid-template-columns: 1fr 1fr;
                gap: 10px;
            }
            .opt-btn {
                height: clamp(40px, 9vh, 64px);
            }
            .quit-confirm {
                padding: 10px 14px;
                gap: 8px;
            }
            .quit-confirm p {
                font-size: var(--fs-xs);
            }
        }

        @media (max-height: 560px) {
            .app-title {
                padding: 6px 12px;
                gap: 8px;
            }
            .app-title .icon-wrap {
                width: 26px;
                height: 26px;
                font-size: 0.95rem;
            }
            .app-title .title-text {
                font-size: clamp(1.05rem, 4.5vw, 1.3rem);
            }
            .ctrl-bar {
                padding: 3px 10px;
            }
            .theme-cycle-btn {
                width: 30px;
                height: 30px;
            }
            .quick-nav-btn {
                width: 30px;
                height: 30px;
                font-size: 0.8rem;
            }
            .quick-nav {
                gap: 4px;
            }
            .lang-toggle-opt {
                padding: 4px 10px;
                font-size: 0.75rem;
            }
            .settings-bar {
                padding: 6px 10px;
                gap: 6px;
                margin-bottom: 4px;
            }
            .settings-select,
            .neg-toggle {
                padding: 6px 10px;
                font-size: 0.85rem;
            }
            .stat-cell {
                padding: 4px 4px;
            }
            .stat-value {
                font-size: var(--fs-lg);
            }
            .app-footer {
                display: flex;
                align-items: center;
                justify-content: center;
                gap: 8px;
                flex-wrap: wrap;
                padding: 4px 10px;
                margin-bottom: 4px;
            }
            .footer-text {
                margin-bottom: 0;
                font-size: 0.58rem;
            }
            .whatsapp-btn {
                padding: 3px 8px;
                font-size: 0.62rem;
            }
        }

        .d-none {
            display: none !important;
        }

        /* ── SEO section ── */
        .seo-content {
            max-width: 900px;
            margin: 18px auto 0;
            padding: 18px 20px 24px;
            background: rgba(255, 255, 255, 0.10);
            backdrop-filter: blur(6px);
            border-radius: 12px;
            color: rgba(255, 255, 255, 0.85);
            font-size: var(--fs-xs);
            line-height: 1.7;
        }
        .seo-content h1 {
            font-size: var(--fs-md);
            font-weight: 700;
            color: #fff;
            margin-bottom: 10px;
        }
        .seo-content p {
            margin-bottom: 10px;
        }
        .seo-content p:last-child {
            margin-bottom: 0;
        }
