/* ================================================================
   教學中心 v2 — Kayden.hk
   Design system tokens + premium kid-friendly layouts
   基於 UI/UX Pro Max 指引:
     • 4/8dp spacing rhythm
     • WCAG AA contrast (4.5:1 body / 3:1 large)
     • SVG-only icons (no emojis)
     • prefers-reduced-motion respect
     • prefers-color-scheme dark mode
     • Focus rings + keyboard navigation
   ================================================================ */

/* ============================================================
   1. DESIGN TOKENS
   ============================================================ */

:root {
    /* —— Brand colors (per-topic accent 可覆寫 via --topic-color) —— */
    --color-brand-50:  #eef4ff;
    --color-brand-100: #dde8ff;
    --color-brand-200: #b8d0ff;
    --color-brand-300: #8db1ff;
    --color-brand-400: #6b95ff;
    --color-brand-500: #4f8cff;   /* primary brand */
    --color-brand-600: #3b7cef;
    --color-brand-700: #2c63c9;
    --color-brand-800: #1f4a9c;
    --color-brand-900: #163573;

    --color-accent-500: #6366f1;  /* indigo accent */
    --color-accent-600: #4f46e5;

    --color-success-500: #10b981;
    --color-success-600: #059669;
    --color-warning-500: #f59e0b;
    --color-warning-600: #d97706;
    --color-danger-500:  #ef4444;
    --color-danger-600:  #dc2626;
    --color-pink-500:    #ec4899;

    /* —— Semantic surface tokens —— */
    --bg-page:        linear-gradient(145deg, #fef8ee 0%, #eef4ff 100%);
    --bg-surface:     #ffffff;
    --bg-surface-2:   #f8fafc;
    --bg-surface-3:   #f1f5f9;
    --bg-overlay:     rgba(15, 23, 42, 0.55);

    --text-primary:   #0f172a;   /* slate-900: 17:1 on white */
    --text-secondary: #475569;   /* slate-600: 7:1 on white */
    --text-tertiary:  #64748b;   /* slate-500: 4.6:1 on white ✓ */
    --text-disabled:  #94a3b8;
    --text-on-accent: #ffffff;

    --border-subtle:  #e2e8f0;
    --border-default: #cbd5e1;
    --border-strong:  #94a3b8;

    /* —— Spacing (4dp rhythm) —— */
    --space-1:  4px;
    --space-2:  8px;
    --space-3:  12px;
    --space-4:  16px;
    --space-5:  20px;
    --space-6:  24px;
    --space-8:  32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;
    --space-20: 80px;

    /* —— Radius —— */
    --radius-sm:   8px;
    --radius-md:   12px;
    --radius-lg:   16px;
    --radius-xl:   20px;
    --radius-2xl:  24px;
    --radius-full: 9999px;

    /* —— Shadow / elevation —— */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 6px 18px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.10);
    --shadow-xl: 0 24px 56px rgba(15, 23, 42, 0.14);
    --shadow-focus: 0 0 0 3px rgba(79, 140, 255, 0.35);

    /* —— Typography —— */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI",
                 "PingFang TC", "Microsoft JhengHei", "Microsoft YaHei",
                 system-ui, sans-serif;
    --font-mono: 'SF Mono', 'Cascadia Code', 'Consolas',
                 'Liberation Mono', 'Courier New', monospace;
    --font-display: 'SF Pro Display', -apple-system, BlinkMacSystemFont,
                    'PingFang TC', system-ui, sans-serif;

    /* Type scale (1.25 ratio) */
    --text-xs:   12px;
    --text-sm:   14px;
    --text-base: 16px;
    --text-lg:   18px;
    --text-xl:   20px;
    --text-2xl:  24px;
    --text-3xl:  30px;
    --text-4xl:  36px;
    --text-5xl:  44px;

    --leading-tight:  1.25;
    --leading-snug:   1.4;
    --leading-normal: 1.55;
    --leading-relaxed: 1.7;

    /* —— Motion tokens —— */
    --duration-fast:   140ms;
    --duration-base:   220ms;
    --duration-slow:   360ms;
    --ease-out:        cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out:     cubic-bezier(0.65, 0, 0.35, 1);
    --ease-spring:     cubic-bezier(0.34, 1.56, 0.64, 1);

    /* —— Layout —— */
    --container-narrow: 640px;
    --container-base:   820px;
    --container-wide:   1080px;
    --topbar-height:    64px;
}

/* —— Dark theme (via system + data-theme override) —— */
:root:not([data-theme="light"]) {
    @media (prefers-color-scheme: dark) {
        --bg-page:        linear-gradient(145deg, #0b1220 0%, #14233d 100%);
        --bg-surface:     #1a2435;
        --bg-surface-2:   #232f44;
        --bg-surface-3:   #2d3a52;
        --bg-overlay:     rgba(0, 0, 0, 0.65);

        --text-primary:   #f1f5f9;
        --text-secondary: #cbd5e1;
        --text-tertiary:  #94a3b8;
        --text-disabled:  #64748b;

        --border-subtle:  #2d3a52;
        --border-default: #475569;
        --border-strong:  #64748b;

        --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.30);
        --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.35);
        --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.40);
    }
}

:root[data-theme="dark"] {
    --bg-page:        linear-gradient(145deg, #0b1220 0%, #14233d 100%);
    --bg-surface:     #1a2435;
    --bg-surface-2:   #232f44;
    --bg-surface-3:   #2d3a52;
    --bg-overlay:     rgba(0, 0, 0, 0.65);

    --text-primary:   #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary:  #94a3b8;
    --text-disabled:  #64748b;

    --border-subtle:  #2d3a52;
    --border-default: #475569;
    --border-strong:  #64748b;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.30);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.40);
}

/* ============================================================
   2. RESET + BASE
   ============================================================ */

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

html {
    font-size: var(--text-base);
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-page);
    background-attachment: fixed;
    min-height: 100vh;
    min-height: 100dvh;
    padding: var(--space-6) var(--space-4) var(--space-16);
    color: var(--text-primary);
    line-height: var(--leading-normal);
    font-feature-settings: "kern" 1, "liga" 1;
}

a {
    color: var(--color-brand-500);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-out);
}
a:hover { color: var(--color-brand-600); }

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

/* —— Accessible focus ring (WCAG 2.2 AA) —— */
:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
    border-radius: var(--radius-sm);
}

/* —— Reduce motion globally —— */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================================
   3. TOPBAR / NAVIGATION
   ============================================================ */

.topbar {
    max-width: var(--container-wide);
    margin: 0 auto var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    height: var(--topbar-height);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--color-brand-500);
    background: var(--bg-surface);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 600;
    box-shadow: var(--shadow-xs);
    transition: all var(--duration-fast) var(--ease-out);
    border: 1px solid var(--border-subtle);
    min-height: 44px;          /* touch target */
}
.back-link:hover {
    background: var(--color-brand-50);
    transform: translateX(-2px);
    box-shadow: var(--shadow-sm);
}
.back-link svg { width: 18px; height: 18px; }

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    transition: all var(--duration-fast) var(--ease-out);
}
.theme-toggle:hover {
    color: var(--color-brand-500);
    box-shadow: var(--shadow-sm);
}
.theme-toggle svg { width: 20px; height: 20px; }

/* ============================================================
   4. INDEX PAGE — TOPIC CARDS (BENTO LAYOUT)
   ============================================================ */

.page-header {
    max-width: var(--container-wide);
    margin: 0 auto var(--space-10);
    text-align: center;
    padding: var(--space-4) var(--space-2);
}

.page-eyebrow {
    display: inline-block;
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--color-brand-600);
    background: var(--color-brand-50);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: var(--space-3);
}

.page-title {
    font-size: clamp(var(--text-3xl), 6vw, var(--text-5xl));
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-3);
    letter-spacing: -0.02em;
    line-height: var(--leading-tight);
}

.page-lead {
    color: var(--text-secondary);
    font-size: var(--text-lg);
    max-width: 540px;
    margin: 0 auto;
}

.topics-grid {
    max-width: var(--container-wide);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: var(--space-6);
    justify-content: center;       /* center cards when few items */
}
.topic-card { max-width: 560px; width: 100%; }   /* cap single-card width */

/* —— Topic card —— */
.topic-card {
    position: relative;
    background: var(--bg-surface);
    border-radius: var(--radius-2xl);
    padding: 0;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--duration-base) var(--ease-out);
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
}

.topic-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--topic-color, var(--color-brand-500));
}

.topic-card__media {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, var(--topic-color, var(--color-brand-500)) 0%, var(--color-accent-500) 100%);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.topic-card__media::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 70% 30%, rgba(255,255,255,0.25), transparent 50%);
    pointer-events: none;
}
.topic-card__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}
.topic-card__placeholder-icon {
    width: 88px;
    height: 88px;
    color: rgba(255, 255, 255, 0.92);
    z-index: 2;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15));
}

.topic-card__badge {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    background: rgba(255, 255, 255, 0.92);
    color: var(--text-primary);
    font-size: var(--text-xs);
    font-weight: 700;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    z-index: 3;
    backdrop-filter: blur(8px);
}

.topic-card__body {
    padding: var(--space-5) var(--space-5) var(--space-6);
    display: flex;
    flex-direction: column;
    flex: 1;
}

.topic-card__crumb {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-tertiary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: var(--space-2);
}
.topic-card__crumb svg { width: 14px; height: 14px; }

.topic-card__title {
    font-size: var(--text-2xl);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
    letter-spacing: -0.01em;
}

.topic-card__subtitle {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
}

.topic-card__desc {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    line-height: var(--leading-normal);
    margin-bottom: var(--space-5);
    flex: 1;
}

.topic-card__parts {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-top: auto;
}

.part-link {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-surface-2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    transition: all var(--duration-fast) var(--ease-out);
    min-height: 64px;
}
.part-link:hover {
    background: var(--color-brand-50);
    border-color: var(--topic-color, var(--color-brand-500));
    transform: translateX(2px);
    color: var(--text-primary);
}
:root[data-theme="dark"] .part-link:hover { background: var(--bg-surface-3); }

.part-link__body { flex: 1; min-width: 0; align-self: center; }
.part-link__title {
    font-weight: 700;
    font-size: var(--text-sm);
    color: var(--text-primary);
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
}
.part-link__sub {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
    line-height: 1.45;
}
.part-link__arrow {
    width: 18px;
    height: 18px;
    color: var(--text-tertiary);
    flex-shrink: 0;
    transition: transform var(--duration-fast) var(--ease-out);
}
.part-link:hover .part-link__arrow { transform: translateX(2px); color: var(--topic-color, var(--color-brand-500)); }

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--space-16) var(--space-4);
    color: var(--text-tertiary);
    background: var(--bg-surface);
    border-radius: var(--radius-2xl);
    border: 2px dashed var(--border-default);
}
.empty-state svg { width: 64px; height: 64px; color: var(--text-disabled); margin-bottom: var(--space-3); }

/* ============================================================
   5. LESSON HERO
   ============================================================ */

.lesson-body {
    padding-top: var(--space-2);
}

.lesson-nav {
    max-width: var(--container-base);
    margin: 0 auto var(--space-4);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hero {
    position: relative;
    max-width: var(--container-base);
    margin: 0 auto var(--space-6);
    background: linear-gradient(135deg,
        var(--topic-color, var(--color-brand-500)) 0%,
        var(--color-accent-500) 100%);
    color: #fff;
    border-radius: var(--radius-2xl);
    padding: var(--space-10) var(--space-8);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 85% 20%, rgba(255,255,255,0.18), transparent 35%),
        radial-gradient(circle at 15% 85%, rgba(255,255,255,0.10), transparent 40%);
    pointer-events: none;
}

.hero__layout {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--space-6);
    align-items: center;
}

.hero__content { min-width: 0; }

.hero__crumb {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: rgba(255,255,255,0.85);
    margin-bottom: var(--space-3);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-weight: 700;
}
.hero__crumb svg { width: 14px; height: 14px; }
.hero__crumb .sep { opacity: 0.5; }
.hero__crumb .current { color: #fff; }

.hero__title {
    font-size: clamp(var(--text-3xl), 5vw, var(--text-4xl));
    font-weight: 900;
    color: #fff;
    margin-bottom: var(--space-2);
    letter-spacing: -0.02em;
    line-height: var(--leading-tight);
}

.hero__subtitle {
    font-size: var(--text-lg);
    color: rgba(255,255,255,0.94);
    font-weight: 600;
    margin-bottom: var(--space-4);
}

.hero__tagline {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    background: rgba(255,255,255,0.22);
    backdrop-filter: blur(8px);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 600;
    border: 1px solid rgba(255,255,255,0.20);
}

.hero__illustration {
    width: 180px;
    height: 180px;
    border-radius: var(--radius-2xl);
    overflow: hidden;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.20);
}
.hero__illustration img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.hero__illustration svg {
    width: 80px;
    height: 80px;
    color: rgba(255,255,255,0.92);
}

/* ============================================================
   6. INTRO + SECTION TITLES
   ============================================================ */

.intro {
    max-width: var(--container-base);
    margin: 0 auto var(--space-6);
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    padding: var(--space-4) var(--space-5);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--color-warning-500);
}
.intro__icon {
    width: 28px;
    height: 28px;
    color: var(--color-warning-500);
    flex-shrink: 0;
    margin-top: 2px;
}
.intro p {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    line-height: var(--leading-normal);
    margin: 0;
}

.section-title {
    max-width: var(--container-base);
    margin: 0 auto var(--space-4);
    font-size: var(--text-xl);
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    letter-spacing: -0.01em;
}
.section-title svg {
    width: 24px;
    height: 24px;
    color: var(--topic-color, var(--color-brand-500));
}

/* ============================================================
   7. CONCEPT GROUPS (Part 1)
   ============================================================ */

.concept-groups {
    max-width: var(--container-base);
    margin: 0 auto var(--space-8);
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
}

.concept-card {
    position: relative;
    background: var(--bg-surface);
    border-radius: var(--radius-2xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
    border-left: 6px solid var(--card-color, var(--color-brand-500));
    transition: all var(--duration-base) var(--ease-out);
    overflow: hidden;
}
.concept-card::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, var(--card-color, var(--color-brand-500)) 0%, transparent 70%);
    opacity: 0.06;
    pointer-events: none;
}
.concept-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.concept-card__header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-3);
    position: relative;
    z-index: 1;
}

.concept-card__icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    background: var(--card-color, var(--color-brand-500));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}
.concept-card__icon svg { width: 32px; height: 32px; }

.concept-card__title {
    font-size: var(--text-3xl);
    font-weight: 900;
    color: var(--card-color, var(--color-brand-500));
    text-transform: lowercase;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: var(--space-1);
}

.concept-card__forms {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    font-weight: 600;
}

.concept-card__use {
    background: var(--bg-surface-2);
    color: var(--text-secondary);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
    font-weight: 500;
    line-height: var(--leading-snug);
    position: relative;
    z-index: 1;
}

.concept-examples {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    position: relative;
    z-index: 1;
}

.concept-example {
    background: var(--bg-surface-2);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    border-left: 3px solid var(--card-color, var(--color-brand-500));
}

.ce-en {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
    line-height: var(--leading-snug);
}
.ce-en .hl {
    background: var(--card-color, var(--color-brand-500));
    color: #fff;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-weight: 800;
    font-size: 0.92em;
}

.ce-zh {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    line-height: var(--leading-snug);
}

/* ============================================================
   8. TRANSFORMATION (Part 2)
   ============================================================ */

.transformation {
    max-width: var(--container-base);
    margin: 0 auto var(--space-8);
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}

.rules-table-wrap {
    margin-bottom: var(--space-8);
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

.rules-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}
.rules-table thead {
    background: var(--topic-color, var(--color-warning-500));
    color: #fff;
}
.rules-table th {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-weight: 800;
    font-size: var(--text-xs);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.rules-table th:first-child { padding-left: var(--space-5); }
.rules-table th:last-child  { padding-right: var(--space-5); }
.rules-table tbody tr {
    border-top: 1px solid var(--border-subtle);
    transition: background var(--duration-fast) var(--ease-out);
}
.rules-table tbody tr:hover {
    background: var(--bg-surface-2);
}
.rules-table td {
    padding: var(--space-3) var(--space-4);
    color: var(--text-primary);
    vertical-align: middle;
}
.rules-table td:first-child { padding-left: var(--space-5); }
.rules-table td:last-child  { padding-right: var(--space-5); }
.rules-table code {
    background: var(--bg-surface-2);
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-weight: 700;
    font-size: var(--text-sm);
    color: var(--text-primary);
}
.rules-table__past {
    background: var(--topic-color, var(--color-warning-500)) !important;
    color: #fff !important;
}
.rules-table__arrow {
    color: var(--text-tertiary);
    text-align: center;
    width: 32px;
    font-size: var(--text-base);
}

.rule-card {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    box-shadow: var(--shadow-sm);
    border-top: 4px solid var(--color-warning-500);
    transition: all var(--duration-base) var(--ease-out);
}
.rule-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.rule-card__tag {
    display: inline-block;
    background: var(--color-warning-500);
    color: #fff;
    font-size: var(--text-xs);
    font-weight: 800;
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-3);
    letter-spacing: 0.06em;
}

.rule-card__title {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-3);
    line-height: var(--leading-snug);
}

.rule-examples { display: flex; flex-direction: column; gap: var(--space-2); }

.rule-ex {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-surface-2);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
}
.rule-ex__word {
    color: var(--text-disabled);
    text-decoration: line-through;
    text-decoration-color: var(--border-default);
}
.rule-ex__arrow { color: var(--border-default); font-weight: 700; }
.rule-ex__result {
    color: var(--color-warning-600);
    font-weight: 800;
}

.comparisons {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.cmp {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    border-left: 4px solid;
}
.cmp--ok {
    background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
    border-left-color: var(--color-success-500);
}
.cmp--no {
    background: linear-gradient(135deg, #fef2f2 0%, #fff5f5 100%);
    border-left-color: var(--color-danger-500);
}
:root[data-theme="dark"] .cmp--ok { background: linear-gradient(135deg, rgba(16,185,129,0.10) 0%, rgba(5,150,105,0.06) 100%); }
:root[data-theme="dark"] .cmp--no { background: linear-gradient(135deg, rgba(239,68,68,0.10) 0%, rgba(220,38,38,0.06) 100%); }

.cmp__status {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.cmp__status svg { width: 18px; height: 18px; }
.cmp--ok .cmp__status { background: var(--color-success-500); color: #fff; }
.cmp--no .cmp__status { background: var(--color-danger-500); color: #fff; }

.cmp__body { flex: 1; min-width: 0; }
.cmp__line {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    margin-bottom: 2px;
    flex-wrap: wrap;
}
.cmp__subject {
    background: var(--color-brand-500);
    color: #fff;
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
    font-weight: 800;
    font-size: var(--text-xs);
    flex-shrink: 0;
}
.cmp__verb {
    font-size: var(--text-base);
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
}
.cmp--no .cmp__verb { text-decoration: line-through; text-decoration-color: var(--color-danger-500); color: var(--color-danger-600); }
.cmp__note {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    line-height: var(--leading-snug);
}

/* ============================================================
   9. BUBBLES (Part 3)
   ============================================================ */

.bubbles {
    max-width: var(--container-base);
    margin: 0 auto var(--space-8);
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.qt-card {
    background: var(--bg-surface);
    border-radius: var(--radius-2xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
    border-top: 5px solid var(--qt-color, var(--color-warning-500));
}

.qt-card__header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}
.qt-card__icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    background: var(--qt-color, var(--color-warning-500));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.qt-card__icon svg { width: 28px; height: 28px; }
.qt-card__title {
    font-size: var(--text-xl);
    font-weight: 800;
    color: var(--qt-color, var(--color-warning-500));
}

.qt-formula {
    background: var(--bg-surface-2);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}
.qt-formula__label {
    font-size: var(--text-xs);
    font-weight: 800;
    color: var(--text-tertiary);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.qt-formula code {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-primary);
    font-weight: 700;
    word-break: break-word;
}

.qt-conversation { display: flex; flex-direction: column; gap: var(--space-3); }

.bubble {
    display: flex;
    gap: var(--space-2);
    align-items: flex-end;
    max-width: 85%;
}
.bubble--q { align-self: flex-start; }
.bubble--a { align-self: flex-end; flex-direction: row-reverse; }

.bubble__avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--bg-surface-3);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.bubble__avatar svg { width: 18px; height: 18px; }
.bubble--a .bubble__avatar { background: var(--qt-color, var(--color-warning-500)); color: #fff; }

.bubble__text {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    line-height: var(--leading-snug);
    font-weight: 600;
}
.bubble--q .bubble__text {
    background: var(--bg-surface-2);
    color: var(--text-primary);
    border-bottom-left-radius: var(--space-1);
}
.bubble--a .bubble__text {
    background: var(--qt-color, var(--color-warning-500));
    color: #fff;
    border-bottom-right-radius: var(--space-1);
}

/* ============================================================
   10. LEGACY (fallback)
   ============================================================ */

.legacy {
    max-width: var(--container-base);
    margin: 0 auto var(--space-8);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.theory-block {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
}
.theory-block h2 {
    font-size: var(--text-lg);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-3);
}
.theory-block h3 {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--color-brand-500);
    margin: var(--space-3) 0 var(--space-2);
}
.theory-block p {
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
    line-height: var(--leading-relaxed);
    font-size: var(--text-sm);
}
.theory-block strong {
    color: var(--color-brand-600);
    background: var(--color-brand-50);
    padding: 0 4px;
    border-radius: var(--radius-sm);
}
:root[data-theme="dark"] .theory-block strong { background: rgba(79,140,255,0.12); }

.legacy .rules { list-style: none; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.legacy .rules li {
    padding: var(--space-3) var(--space-4);
    background: var(--bg-surface-2);
    border-left: 3px solid var(--color-brand-500);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.legacy .examples { display: flex; flex-direction: column; gap: var(--space-2); }
.legacy .example {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--space-3) var(--space-4);
    background: linear-gradient(135deg, rgba(16,185,129,0.08) 0%, rgba(20,184,166,0.06) 100%);
    border-left: 3px solid var(--color-success-500);
    border-radius: var(--radius-sm);
}
.legacy .example .en {
    color: var(--text-primary);
    font-weight: 600;
    font-size: var(--text-base);
}
.legacy .example .zh { color: var(--text-tertiary); font-size: var(--text-sm); }

/* ============================================================
   11. START SECTION
   ============================================================ */

.start-section {
    max-width: var(--container-base);
    margin: 0 auto var(--space-8);
    text-align: center;
    padding: var(--space-10) var(--space-6);
    background: var(--bg-surface);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-subtle);
}

.start-section__title {
    font-size: var(--text-2xl);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}
.start-section__lead {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin-bottom: var(--space-6);
}

.start-btn {
    background: linear-gradient(135deg, var(--topic-color, var(--color-brand-500)) 0%, var(--color-accent-500) 100%);
    color: #fff;
    border: none;
    padding: var(--space-4) var(--space-10);
    font-size: var(--text-lg);
    font-weight: 800;
    border-radius: var(--radius-full);
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(99,102,241,0.30);
    transition: all var(--duration-base) var(--ease-out);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 56px;       /* touch target */
}
.start-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(99,102,241,0.40);
}
.start-btn:active:not(:disabled) { transform: translateY(0); }
.start-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}
.start-btn svg { width: 20px; height: 20px; }

.start-btn__spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.start-section__hint {
    color: var(--text-tertiary);
    font-size: var(--text-sm);
    margin-top: var(--space-3);
}
.start-section__remaining {
    color: var(--color-brand-600);
    font-size: var(--text-sm);
    font-weight: 600;
    margin-top: var(--space-2);
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}
.start-section__remaining svg { width: 14px; height: 14px; }

/* ============================================================
   12. QUIZ
   ============================================================ */

.quiz-section {
    max-width: var(--container-base);
    margin: 0 auto var(--space-8);
    background: var(--bg-surface);
    border-radius: var(--radius-2xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-subtle);
}

.quiz-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 600;
}
.quiz-progress__score {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    color: var(--color-success-600);
    font-weight: 700;
}
.quiz-progress__score svg { width: 14px; height: 14px; }

.progress-bar {
    height: 6px;
    background: var(--bg-surface-3);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--space-6);
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-brand-500) 0%, var(--color-accent-500) 100%);
    transition: width var(--duration-slow) var(--ease-out);
    border-radius: var(--radius-full);
}

.quiz-card { padding: var(--space-2) 0; }

.question-num {
    display: inline-block;
    background: var(--color-brand-50);
    color: var(--color-brand-700);
    font-weight: 700;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    margin-bottom: var(--space-3);
    letter-spacing: 0.05em;
}
:root[data-theme="dark"] .question-num { background: rgba(79,140,255,0.18); color: var(--color-brand-300); }

.question-text {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-5);
    line-height: var(--leading-snug);
}

.options { display: flex; flex-direction: column; gap: var(--space-3); }

.option {
    padding: var(--space-4) var(--space-5);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-size: var(--text-base);
    color: var(--text-primary);
    transition: all var(--duration-fast) var(--ease-out);
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 56px;       /* touch target */
}
.option:hover {
    border-color: var(--color-brand-500);
    background: var(--color-brand-50);
    transform: translateX(2px);
}
:root[data-theme="dark"] .option:hover { background: rgba(79,140,255,0.10); }
.option:focus-visible {
    border-color: var(--color-brand-500);
    box-shadow: var(--shadow-focus);
}

.option__letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--bg-surface-2);
    color: var(--text-secondary);
    font-weight: 800;
    font-size: var(--text-sm);
    flex-shrink: 0;
    transition: all var(--duration-fast) var(--ease-out);
}

.option.selected {
    border-color: var(--color-brand-500);
    background: var(--color-brand-50);
}
.option.selected .option__letter {
    background: var(--color-brand-500);
    color: #fff;
}
:root[data-theme="dark"] .option.selected { background: rgba(79,140,255,0.14); }

.quiz-nav {
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
    margin-top: var(--space-6);
}

.quiz-nav button {
    flex: 1;
    padding: var(--space-3) var(--space-5);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 48px;
}
.quiz-nav button svg { width: 16px; height: 16px; }

.btn-prev {
    background: var(--bg-surface-2);
    color: var(--text-secondary);
}
.btn-prev:hover:not(:disabled) { background: var(--bg-surface-3); }
.btn-prev:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-next {
    background: var(--color-brand-500);
    color: #fff;
}
.btn-next:hover { background: var(--color-brand-600); }

.btn-submit {
    background: linear-gradient(135deg, var(--color-success-500) 0%, var(--color-success-600) 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(16,185,129,0.30);
}
.btn-submit:hover { box-shadow: 0 6px 18px rgba(16,185,129,0.40); transform: translateY(-1px); }

/* ============================================================
   13. RESULT
   ============================================================ */

.result-section {
    max-width: var(--container-base);
    margin: 0 auto var(--space-8);
    background: var(--bg-surface);
    border-radius: var(--radius-2xl);
    padding: var(--space-10) var(--space-6);
    box-shadow: var(--shadow-md);
    text-align: center;
    border: 1px solid var(--border-subtle);
}

.result-emoji {
    width: 96px;
    height: 96px;
    margin: 0 auto var(--space-4);
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--color-brand-500) 0%, var(--color-accent-500) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pop var(--duration-slow) var(--ease-spring);
}
.result-emoji svg { width: 56px; height: 56px; }
@keyframes pop {
    from { transform: scale(0.4); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.result-section h2 {
    font-size: var(--text-2xl);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-3);
}

.score {
    font-size: var(--text-5xl);
    font-weight: 900;
    color: var(--color-brand-500);
    margin: var(--space-3) 0;
    letter-spacing: -0.03em;
    line-height: 1;
}
.result-pct {
    color: var(--text-secondary);
    font-size: var(--text-base);
    font-weight: 600;
    margin-bottom: var(--space-1);
}
.source-info {
    color: var(--text-tertiary);
    font-size: var(--text-xs);
    margin-bottom: var(--space-6);
}

.review-section { text-align: left; margin-top: var(--space-6); }
.review-section h3 {
    text-align: center;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
    font-size: var(--text-lg);
    font-weight: 800;
}

.review-item {
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    background: var(--bg-surface);
    transition: all var(--duration-fast) var(--ease-out);
}
.review-item.correct {
    border-color: var(--color-success-500);
    background: linear-gradient(135deg, rgba(16,185,129,0.06) 0%, rgba(16,185,129,0.02) 100%);
}
.review-item.wrong {
    border-color: var(--color-danger-500);
    background: linear-gradient(135deg, rgba(239,68,68,0.06) 0%, rgba(239,68,68,0.02) 100%);
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2);
}
.review-num {
    background: var(--color-brand-500);
    color: #fff;
    font-weight: 700;
    padding: 2px var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
}
.review-item.correct .review-num { background: var(--color-success-500); }
.review-item.wrong .review-num { background: var(--color-danger-500); }

.review-status {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}
.review-status svg { width: 14px; height: 14px; }
.review-item.correct .review-status { background: var(--color-success-500); }
.review-item.wrong .review-status { background: var(--color-danger-500); }

.review-question {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    line-height: var(--leading-snug);
}
.review-your, .review-correct {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-1);
}
.review-correct strong { color: var(--color-success-600); }

.review-explain {
    margin-top: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: rgba(245,158,11,0.10);
    border-left: 3px solid var(--color-warning-500);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    color: var(--text-primary);
    line-height: var(--leading-snug);
    display: flex;
    gap: var(--space-2);
    align-items: flex-start;
}
.review-explain svg {
    width: 16px;
    height: 16px;
    color: var(--color-warning-600);
    flex-shrink: 0;
    margin-top: 2px;
}

.result-actions {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
    margin-top: var(--space-6);
    flex-wrap: wrap;
}

.btn-action {
    background: linear-gradient(135deg, var(--color-brand-500) 0%, var(--color-accent-500) 100%);
    color: #fff;
    border: none;
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: var(--text-sm);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--duration-fast) var(--ease-out);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 48px;
}
.btn-action svg { width: 16px; height: 16px; }
.btn-action:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); color: #fff; }

.btn-action--secondary {
    background: var(--bg-surface-2);
    color: var(--text-secondary);
}
.btn-action--secondary:hover {
    background: var(--bg-surface-3);
    box-shadow: var(--shadow-sm);
}

/* ============================================================
   14. UTILITIES
   ============================================================ */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.footer {
    max-width: var(--container-base);
    margin: var(--space-12) auto 0;
    text-align: center;
    color: var(--text-tertiary);
    font-size: var(--text-xs);
    padding-top: var(--space-6);
    border-top: 1px solid var(--border-subtle);
}

/* Skeleton loader */
.skeleton {
    background: linear-gradient(90deg, var(--bg-surface-2) 0%, var(--bg-surface-3) 50%, var(--bg-surface-2) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: var(--radius-sm);
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================================
   14b. ENRICHED CONTENT BLOCKS
   (新增 v3:subject table / time expressions / 5W1H grid /
    common mistakes / answer tips)
   ============================================================ */

/* —— Concept tips (Part 1 開頭小提示) —— */
.concept-tips {
    width: 100%;
    max-width: var(--container-base);   /* match inner content width (820px) */
    margin: 0 auto var(--space-5);
    background: linear-gradient(135deg, var(--color-brand-50) 0%, #e0eaff 100%);
    border: 1px solid var(--color-brand-200);
    border-radius: var(--radius-xl);
    padding: var(--space-4) var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    overflow-wrap: anywhere;            /* 防長字 overflow */
}
:root[data-theme="dark"] .concept-tips {
    background: linear-gradient(135deg, rgba(79,140,255,0.10) 0%, rgba(99,102,241,0.06) 100%);
    border-color: rgba(79,140,255,0.30);
}
.concept-tip {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-primary);
    font-weight: 500;
}
.concept-tip__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
    background: var(--color-warning-500);
    color: #fff;
    flex-shrink: 0;
}
.concept-tip__icon svg { width: 16px; height: 16px; }

/* —— Subject × Form table (concept card 入面) —— */
.subject-table {
    margin: var(--space-3) 0;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    font-size: var(--text-sm);
}
.subject-table__head, .subject-table__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    align-items: center;
}
.subject-table__head {
    background: var(--card-color, var(--color-brand-500));
    color: #fff;
    font-weight: 700;
    font-size: var(--text-xs);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.subject-table__row + .subject-table__row {
    border-top: 1px solid var(--border-subtle);
}
.subject-table__subject {
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
}
.subject-table__form {
    color: var(--card-color, var(--color-brand-500));
    font-weight: 800;
    font-family: var(--font-mono);
    font-size: var(--text-base);
}

/* —— Concept card section titles —— */
.concept-card__section-title {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-sm);
    font-weight: 800;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: var(--space-4) 0 var(--space-2);
}
.concept-card__section-title--neg { color: var(--color-danger-500); }
.concept-card__section-title--q { color: var(--color-brand-600); }
.section-title-icon {
    display: inline-flex;
    color: currentColor;
    margin-right: var(--space-1);
}
.section-title-icon svg { width: 16px; height: 16px; }

/* —— Concept example variants (neg / q) —— */
.concept-example--neg {
    background: linear-gradient(135deg, rgba(239,68,68,0.06) 0%, rgba(239,68,68,0.02) 100%);
    border-left-color: var(--color-danger-500);
}
.concept-example--q {
    background: linear-gradient(135deg, rgba(79,140,255,0.06) 0%, rgba(99,102,241,0.02) 100%);
    border-left-color: var(--color-brand-500);
}

/* —— Common mistake callout —— */
.common-mistake {
    margin-top: var(--space-4);
    background: rgba(245,158,11,0.10);
    border-left: 4px solid var(--color-warning-500);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
    font-size: var(--text-sm);
    color: var(--text-primary);
    line-height: var(--leading-snug);
}
.common-mistake__icon {
    width: 28px;
    height: 28px;
    background: var(--color-warning-500);
    color: #fff;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.common-mistake__icon svg { width: 16px; height: 16px; }
.common-mistake strong { color: var(--color-warning-600); display: block; margin-bottom: 2px; }
:root[data-theme="dark"] .common-mistake strong { color: var(--color-warning-500); }

/* ============================================================
   Transformation-specific blocks
   ============================================================ */

/* —— Subject reminder banner (Part 2 開頭) —— */
.subject-reminder {
    width: 100%;
    max-width: var(--container-base);   /* match inner content width (820px) */
    margin: 0 auto var(--space-6);
    background: linear-gradient(135deg, var(--color-brand-500) 0%, var(--color-accent-500) 100%);
    color: #fff;
    border-radius: var(--radius-2xl);
    padding: var(--space-5) var(--space-6);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;                  /* 防 gradient overflow */
    overflow-wrap: anywhere;
}
.subject-reminder::before {
    content: "";
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: rgba(255,255,255,0.10);
    border-radius: 50%;
    pointer-events: none;
}
.subject-reminder__title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-lg);
    font-weight: 800;
    margin-bottom: var(--space-4);
    position: relative;
    z-index: 1;
}
.subject-reminder__icon {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.22);
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.subject-reminder__icon svg { width: 20px; height: 20px; }

.subject-reminder__grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    position: relative;
    z-index: 1;
}
.subject-reminder__item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: rgba(255,255,255,0.18);
    backdrop-filter: blur(8px);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    border: 1px solid rgba(255,255,255,0.20);
    min-width: 0;
    overflow-wrap: anywhere;
}
.subject-reminder__subject {
    font-weight: 800;
    color: #fff;
    background: rgba(0,0,0,0.18);
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    flex-shrink: 0;
    white-space: nowrap;
}
.subject-reminder__arrow {
    color: rgba(255,255,255,0.8);
    font-weight: 700;
    flex-shrink: 0;
}
.subject-reminder__rule {
    color: #fff;
    font-weight: 500;
    line-height: var(--leading-snug);
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

/* —— Pronunciation tip per rule card —— */
.rule-pron-tip {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px dashed var(--border-subtle);
    display: flex;
    gap: var(--space-2);
    align-items: flex-start;
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    line-height: var(--leading-snug);
}
.rule-pron-tip__icon {
    color: var(--color-brand-500);
    flex-shrink: 0;
    margin-top: 1px;
}
.rule-pron-tip__icon svg { width: 14px; height: 14px; }

/* —— Time expressions chips (Part 2) —— */
.time-expressions {
    width: 100%;
    max-width: var(--container-base);   /* match inner content width (820px) */
    margin: 0 auto var(--space-8);
    background: var(--bg-surface);
    border-radius: var(--radius-2xl);
    padding: var(--space-5) var(--space-6);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-subtle);
    overflow-wrap: anywhere;
}
.time-expressions__title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-lg);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}
.time-expressions__icon {
    width: 32px;
    height: 32px;
    background: var(--color-accent-500);
    color: #fff;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.time-expressions__icon svg { width: 20px; height: 20px; }
.time-expressions__lead {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
}
.time-expressions__chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}
.time-chip {
    display: inline-flex;
    align-items: center;
    background: var(--bg-surface-2);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 600;
    font-family: var(--font-mono);
    transition: all var(--duration-fast) var(--ease-out);
    overflow-wrap: anywhere;
    white-space: normal;
}
.time-chip:hover {
    background: var(--color-brand-50);
    border-color: var(--color-brand-500);
    color: var(--color-brand-700);
}
:root[data-theme="dark"] .time-chip:hover {
    background: rgba(79,140,255,0.16);
    color: var(--color-brand-300);
}

/* —— Common mistakes list (Part 2) —— */
.common-mistakes {
    width: 100%;
    max-width: var(--container-base);   /* match inner content width (820px) */
    margin: var(--space-6) auto 0;
    background: var(--bg-surface);
    border-radius: var(--radius-2xl);
    padding: var(--space-5) var(--space-6);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-subtle);
    overflow-wrap: anywhere;
}
.common-mistakes__title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-lg);
    font-weight: 800;
    color: var(--color-warning-600);
    margin-bottom: var(--space-4);
}
.common-mistakes__icon {
    width: 32px;
    height: 32px;
    background: var(--color-warning-500);
    color: #fff;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.common-mistakes__icon svg { width: 20px; height: 20px; }
.common-mistakes__list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.common-mistake-item {
    padding: var(--space-3) var(--space-4);
    background: rgba(245,158,11,0.06);
    border-left: 3px solid var(--color-warning-500);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    line-height: var(--leading-snug);
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* ============================================================
   Bubbles-specific blocks
   ============================================================ */

/* —— 5W1H question words grid (Part 3) —— */
.qw-table {
    width: 100%;
    max-width: var(--container-base);   /* match inner content width (820px) */
    margin: 0 auto var(--space-6);
    background: var(--bg-surface);
    border-radius: var(--radius-2xl);
    padding: var(--space-5) var(--space-6);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-subtle);
    overflow-wrap: anywhere;
}
.qw-table__title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-lg);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}
.qw-table__icon {
    width: 32px;
    height: 32px;
    background: var(--color-brand-500);
    color: #fff;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.qw-table__icon svg { width: 20px; height: 20px; }
.qw-table__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-3);
}
.qw-card {
    background: var(--bg-surface-2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-4);
    transition: all var(--duration-fast) var(--ease-out);
    min-width: 0;            /* allow flex/grid child to shrink below content size */
    overflow-wrap: anywhere;
}
.qw-card:hover {
    border-color: var(--color-brand-500);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}
.qw-card__word {
    font-size: var(--text-xl);
    font-weight: 900;
    color: var(--color-brand-600);
    font-family: var(--font-mono);
    margin-bottom: var(--space-1);
    line-height: 1;
}
.qw-card__use {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: var(--space-2);
}
.qw-card__example {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    line-height: var(--leading-snug);
    font-style: italic;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* —— Short answer box inside qt-card —— */
.qt-short-answer {
    background: var(--bg-surface-2);
    border-left: 3px solid var(--qt-color, var(--color-warning-500));
    border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-4);
    margin-bottom: var(--space-4);
    display: flex;
    gap: var(--space-2);
    align-items: flex-start;
    font-size: var(--text-sm);
}
.qt-short-answer__label {
    font-size: var(--text-xs);
    font-weight: 800;
    color: var(--qt-color, var(--color-warning-500));
    letter-spacing: 0.05em;
    text-transform: uppercase;
    flex-shrink: 0;
    margin-top: 2px;
}
.qt-short-answer__text {
    color: var(--text-secondary);
    line-height: var(--leading-snug);
}

/* —— Answer tips box (Part 3 結尾) —— */
.answer-tips {
    width: 100%;
    max-width: var(--container-base);   /* match inner content width (820px) */
    margin: var(--space-6) auto 0;
    background: var(--bg-surface);
    border-radius: var(--radius-2xl);
    padding: var(--space-5) var(--space-6);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-subtle);
    overflow-wrap: anywhere;
}
.answer-tips__title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-lg);
    font-weight: 800;
    color: var(--color-success-600);
    margin-bottom: var(--space-4);
}
.answer-tips__icon {
    width: 32px;
    height: 32px;
    background: var(--color-success-500);
    color: #fff;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.answer-tips__icon svg { width: 20px; height: 20px; }
.answer-tips__list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.answer-tips__list li {
    padding: var(--space-3) var(--space-4);
    background: var(--bg-surface-2);
    border-left: 3px solid var(--color-success-500);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    color: var(--text-primary);
    line-height: var(--leading-snug);
    font-family: var(--font-mono);
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* ============================================================
   Responsive overrides for new blocks
   ============================================================ */
@media (max-width: 540px) {
    .subject-reminder { padding: var(--space-4); }
    .subject-reminder__grid { grid-template-columns: 1fr; }
    .qw-table__grid { grid-template-columns: repeat(2, 1fr); }
    .time-expressions, .common-mistakes, .answer-tips,
    .qw-table, .subject-reminder { padding: var(--space-4); }
    .subject-table__head, .subject-table__row { font-size: var(--text-xs); }
    .common-mistake { font-size: var(--text-xs); }
}

/* ============================================================
   15. RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    body { padding: var(--space-4) var(--space-3) var(--space-12); }
    .topics-grid { grid-template-columns: 1fr; gap: var(--space-4); }
    .hero { padding: var(--space-8) var(--space-5); }
    .hero__layout { grid-template-columns: 1fr; }
    .hero__illustration {
        width: 100%;
        height: 160px;
        order: -1;
    }
    .lesson-nav { flex-wrap: wrap; gap: var(--space-2); }
}

@media (max-width: 540px) {
    body { padding: var(--space-3) var(--space-2) var(--space-10); }
    .hero { padding: var(--space-6) var(--space-4); border-radius: var(--radius-xl); }
    .hero__title { font-size: var(--text-2xl); }
    .hero__subtitle { font-size: var(--text-base); }
    .concept-card { padding: var(--space-4); }
    .concept-card__title { font-size: var(--text-2xl); }
    .concept-card__icon { width: 52px; height: 52px; }
    .concept-card__icon svg { width: 26px; height: 26px; }
    .rules-grid { grid-template-columns: 1fr; }
    .bubble { max-width: 95%; }
    .qt-card { padding: var(--space-4); }
    .start-section { padding: var(--space-8) var(--space-4); }
    .start-btn { width: 100%; justify-content: center; }
    .quiz-section { padding: var(--space-4); }
    .result-section { padding: var(--space-6) var(--space-4); }
    .result-emoji { width: 72px; height: 72px; }
    .result-emoji svg { width: 40px; height: 40px; }
    .score { font-size: var(--text-4xl); }
    .page-title { font-size: var(--text-3xl); }
}