    /* ─── SAKURA THEME TOKENS ───────────────────────────────────── */
    :root {
      --bg: #FDF6F0;
      --bg-2: #F5EDE5;
      --surface: rgba(255, 252, 248, 0.82);
      --surface-hover: rgba(212, 114, 138, 0.08);
      --surface-strong: rgba(255, 255, 255, 0.95);
      --glass-border: rgba(212, 114, 138, 0.22);
      --glass-border-hover: rgba(212, 114, 138, 0.50);
      --text: #2C1810;
      --text-muted: rgba(44, 24, 16, 0.58);
      --text-dim: rgba(44, 24, 16, 0.32);
      /* Sakura pink — primary */
      --red: #D4728A;
      --red-dark: #B85570;
      --red-glow: rgba(212, 114, 138, 0.45);
      --red-glow-sm: rgba(212, 114, 138, 0.22);
      /* Indigo — secondary */
      --sakura: #3B4A6B;
      --sakura-dim: rgba(59, 74, 107, 0.10);
      /* Palette extras */
      --gold: #C4963A;
      --purple: #8B7DB5;
      --blue-glow: rgba(59, 74, 107, 0.20);
      --success: #5A8F4A;
      --success-glow: rgba(90, 143, 74, 0.30);
      --warn: #C4963A;
      --danger: #D4728A;
      --shadow: 0 4px 24px rgba(44, 24, 16, 0.10);
      --shadow-sm: 0 2px 10px rgba(44, 24, 16, 0.07);
      --shadow-glow: 0 4px 32px rgba(212, 114, 138, 0.18);
      --r: 12px;
      --r-lg: 16px;
      --r-xl: 20px;
      --ease: cubic-bezier(0.4, 0, 0.2, 1);
      --blur: blur(16px) saturate(180%);
      /* Named palette */
      --clr-sakura: #D4728A;
      --clr-indigo: #3B4A6B;
      --clr-matcha: #7FA86E;
      --clr-cream: #FDF6F0;
      /* Alias tokens */
      --neon-pink: #D4728A;
      --neon-cyan: #3B4A6B;
    }

    /* ─── DARK MODE TOKENS (Neo-Tokyo) ───────────────────────────── */
    html[data-theme="dark"] {
      --bg: #000008;
      --bg-2: #05000f;
      --surface: rgba(255, 0, 128, 0.04);
      --surface-hover: rgba(0, 245, 255, 0.07);
      --surface-strong: rgba(255, 255, 255, 0.06);
      --glass-border: rgba(255, 0, 128, 0.28);
      --glass-border-hover: rgba(0, 245, 255, 0.55);
      --text: #f0f0ff;
      --text-muted: rgba(240, 240, 255, 0.55);
      --text-dim: rgba(240, 240, 255, 0.30);
      --red: #ff0080;
      --red-dark: #cc0066;
      --red-glow: rgba(255, 0, 128, 0.55);
      --red-glow-sm: rgba(255, 0, 128, 0.28);
      --sakura: #00f5ff;
      --sakura-dim: rgba(0, 245, 255, 0.12);
      --gold: #f0ff00;
      --purple: #bf5fff;
      --blue-glow: rgba(0, 245, 255, 0.28);
      --success: #39ff14;
      --success-glow: rgba(57, 255, 20, 0.32);
      --warn: #ff6400;
      --danger: #ff0080;
      --shadow: 0 8px 32px rgba(0, 0, 0, 0.70);
      --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.55);
      --shadow-glow: 0 0 40px rgba(255, 0, 128, 0.55);
      --r: 4px;
      --r-lg: 8px;
      --r-xl: 12px;
      --blur: blur(20px) saturate(200%);
      --neon-pink: #ff0080;
      --neon-cyan: #00f5ff;
    }

    /* Dark mode: restore Neo-Tokyo background */
    html[data-theme="dark"] body {
      background: #000008;
    }
    html[data-theme="dark"] body::before {
      background:
        radial-gradient(ellipse 60% 50% at 15% 25%, rgba(255, 0, 128, 0.22) 0%, transparent 55%),
        radial-gradient(ellipse 55% 65% at 85% 70%, rgba(0, 245, 255, 0.16) 0%, transparent 55%),
        radial-gradient(ellipse 70% 40% at 50% 100%, rgba(191, 95, 255, 0.14) 0%, transparent 55%),
        radial-gradient(ellipse 35% 35% at 88% 8%, rgba(240, 255, 0, 0.09) 0%, transparent 50%),
        #000008 !important;
      animation: bgNeon 14s ease-in-out infinite alternate !important;
    }
    html[data-theme="dark"] body::after {
      background-image:
        linear-gradient(rgba(255, 0, 128, 0.028) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 0, 128, 0.028) 1px, transparent 1px) !important;
    }
    html[data-theme="dark"] .deco-char {
      color: rgba(255, 0, 128, 0.03) !important;
      opacity: 1 !important;
    }
    html[data-theme="dark"] .sakura-petal { display: none !important; }
    /* Dark mode: restore neon heading */
    html[data-theme="dark"] h1 {
      background: linear-gradient(135deg, #ff0080 0%, #00f5ff 55%, #f0ff00 100%) !important;
      -webkit-background-clip: text !important;
      background-clip: text !important;
      -webkit-text-fill-color: transparent !important;
      filter: drop-shadow(0 0 12px rgba(255, 0, 128, 0.35)) !important;
      animation: glitch 10s linear infinite !important;
    }
    html[data-theme="dark"] .section-title {
      color: #00f5ff !important;
      text-shadow: 0 0 8px rgba(0, 245, 255, 0.5) !important;
    }
    html[data-theme="dark"] .stat-num {
      background: linear-gradient(135deg, #ff0080, #00f5ff) !important;
      -webkit-background-clip: text !important;
      background-clip: text !important;
      -webkit-text-fill-color: transparent !important;
      filter: drop-shadow(0 0 8px rgba(255, 0, 128, 0.5)) !important;
    }
    html[data-theme="dark"] .btn-primary {
      background: rgba(255, 0, 128, 0.12) !important;
      color: #ff0080 !important;
      border-color: #ff0080 !important;
      box-shadow: 0 0 12px rgba(255, 0, 128, 0.35), inset 0 0 12px rgba(255, 0, 128, 0.06) !important;
      text-shadow: 0 0 8px rgba(255, 0, 128, 0.6) !important;
      border-radius: 4px !important;
    }
    html[data-theme="dark"] .btn-secondary {
      background: rgba(255, 255, 255, 0.04) !important;
      border-color: rgba(255, 255, 255, 0.18) !important;
      color: rgba(240, 240, 255, 0.55) !important;
      border-radius: 4px !important;
    }
    html[data-theme="dark"] .stat-card {
      background: rgba(255, 0, 128, 0.04) !important;
      border-color: rgba(255, 0, 128, 0.28) !important;
      box-shadow: 0 8px 32px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,0,128,0.05) !important;
    }
    html[data-theme="dark"] .stat-card::before {
      background: linear-gradient(90deg, transparent, #ff0080, #00f5ff, transparent) !important;
    }
    html[data-theme="dark"] .lesson-card,
    html[data-theme="dark"] .roadmap-chapter {
      background: rgba(0, 0, 8, 0.60) !important;
      border-color: rgba(255, 0, 128, 0.28) !important;
    }
    html[data-theme="dark"] .roadmap-card {
      background: rgba(255,255,255,0.03) !important;
      border-color: rgba(255,255,255,0.09) !important;
    }
    html[data-theme="dark"] .roadmap-chapter[data-state="active"] { border-color: rgba(0,245,255,0.25) !important; }
    html[data-theme="dark"] .roadmap-chapter[data-state="done"] { border-color: rgba(57,255,20,0.2) !important; }
    html[data-theme="dark"] .roadmap-chapter[data-state="available"] { border-color: rgba(255,0,128,0.2) !important; }
    html[data-theme="dark"] .roadmap-chapter-badge.done { border-color: #39ff14 !important; color: #39ff14 !important; background: rgba(57,255,20,0.1) !important; }
    html[data-theme="dark"] .roadmap-chapter-badge.active { border-color: #00f5ff !important; color: #00f5ff !important; background: rgba(0,245,255,0.1) !important; animation: none !important; box-shadow: 0 0 12px rgba(0,245,255,0.35) !important; }
    html[data-theme="dark"] .roadmap-chapter-badge.available { border-color: #ff0080 !important; color: #ff0080 !important; background: rgba(255,0,128,0.08) !important; }
    html[data-theme="dark"] .done-tag { background: rgba(57,255,20,0.12) !important; color: #39ff14 !important; border-color: rgba(57,255,20,0.3) !important; }
    html[data-theme="dark"] .active-tag { background: rgba(0,245,255,0.1) !important; color: #00f5ff !important; border-color: rgba(0,245,255,0.3) !important; }
    html[data-theme="dark"] .roadmap-card.completed { border-color: rgba(57,255,20,0.3) !important; background: rgba(57,255,20,0.04) !important; }
    html[data-theme="dark"] .roadmap-card-check { background: #39ff14 !important; color: #000 !important; }
    html[data-theme="dark"] .roadmap-connector-line { background: linear-gradient(to bottom, rgba(255,255,255,0.1), rgba(255,255,255,0.04)) !important; }
    html[data-theme="dark"] .progress-bar-fill {
      background: linear-gradient(90deg, #ff0080, #00f5ff, #f0ff00) !important;
      box-shadow: 0 0 12px rgba(255, 0, 128, 0.5), 0 0 24px rgba(0, 245, 255, 0.2) !important;
    }
    html[data-theme="dark"] .toast-notification { background: rgba(0,0,8,0.92) !important; }
    html[data-theme="dark"] .badge-card { background: rgba(0,0,8,0.60) !important; border-color: rgba(255,0,128,0.18) !important; }
    html[data-theme="dark"] .badge-card.unlocked { border-color: rgba(240,255,0,0.4) !important; background: rgba(240,255,0,0.04) !important; }
    html[data-theme="dark"] .match-btn { background: rgba(0,0,8,0.60) !important; border-color: rgba(255,0,128,0.22) !important; }
    html[data-theme="dark"] .typing-input { background: rgba(0,0,8,0.70) !important; }
    html[data-theme="dark"] .back-btn { background: rgba(0,0,0,0.4) !important; border-color: rgba(255,255,255,0.14) !important; }
    html[data-theme="dark"] .premium-cta { background: rgba(0,0,0,0.4) !important; border-color: rgba(240,255,0,0.25) !important; }
    html[data-theme="dark"] .feat-lock-badge { background: rgba(255,255,255,0.1) !important; color: rgba(240,240,255,0.6) !important; border-color: rgba(255,255,255,0.15) !important; }

    /* ── Dark mode: badges, matching, confusing pairs ── */
    html[data-theme="dark"] .badge-green { background: rgba(57,255,20,0.10) !important; color: #39ff14 !important; border-color: rgba(57,255,20,0.3) !important; text-shadow: 0 0 6px rgba(57,255,20,0.4) !important; }
    html[data-theme="dark"] .badge-blue { background: rgba(0,245,255,0.10) !important; color: #00f5ff !important; border-color: rgba(0,245,255,0.3) !important; text-shadow: 0 0 6px rgba(0,245,255,0.4) !important; }
    html[data-theme="dark"] .match-col-label { text-shadow: 0 0 6px rgba(0,245,255,0.4) !important; }
    html[data-theme="dark"] .pair-vs { font-family: 'Orbitron', sans-serif !important; }

    /* ── Dark mode: flashcard ── */
    html[data-theme="dark"] .fc-front { background: rgba(0,0,8,0.85) !important; border-color: rgba(255,0,128,0.35) !important; box-shadow: 0 0 20px rgba(255,0,128,0.12), 0 4px 24px rgba(0,0,0,0.5) !important; }
    html[data-theme="dark"] .fc-back { background: linear-gradient(135deg, rgba(0,0,8,0.90), rgba(20,0,30,0.90)) !important; border-color: rgba(0,245,255,0.30) !important; box-shadow: 0 0 20px rgba(0,245,255,0.10), 0 4px 24px rgba(0,0,0,0.5) !important; }
    html[data-theme="dark"] .fc-char { color: #ff0080 !important; text-shadow: 0 0 20px rgba(255,0,128,0.4) !important; }
    html[data-theme="dark"] .fc-strokes { background: rgba(0,245,255,0.12) !important; color: #00f5ff !important; border-color: rgba(0,245,255,0.3) !important; }
    html[data-theme="dark"] .fc-hint { color: rgba(255,255,255,0.35) !important; }
    html[data-theme="dark"] .fc-romaji { background: linear-gradient(135deg, #ff0080, #00f5ff) !important; -webkit-background-clip: text !important; background-clip: text !important; -webkit-text-fill-color: transparent !important; }
    html[data-theme="dark"] .fc-pronunciation { color: rgba(255,255,255,0.5) !important; }
    html[data-theme="dark"] .fc-example { background: rgba(0,0,0,0.4) !important; border-color: rgba(255,255,255,0.10) !important; }
    html[data-theme="dark"] .fc-example-romaji { color: rgba(255,255,255,0.45) !important; }
    html[data-theme="dark"] .fc-example-eng { color: rgba(255,255,255,0.9) !important; }
    html[data-theme="dark"] .fc-example-word { color: rgba(255,255,255,0.9) !important; }
    /* ── Dark mode: arrow buttons ── */
    html[data-theme="dark"] .arrow-btn { background: rgba(255,0,128,0.08) !important; border-color: rgba(255,0,128,0.40) !important; color: #ff0080 !important; box-shadow: 0 0 10px rgba(255,0,128,0.15) !important; backdrop-filter: none !important; }
    html[data-theme="dark"] .arrow-btn:hover { background: rgba(255,0,128,0.18) !important; border-color: #ff0080 !important; box-shadow: 0 0 18px rgba(255,0,128,0.35) !important; }
    html[data-theme="dark"] .char-dot { background: rgba(255,0,128,0.25) !important; }
    html[data-theme="dark"] .char-dot.active { background: #ff0080 !important; box-shadow: 0 0 8px rgba(255,0,128,0.5) !important; }
    html[data-theme="dark"] .char-dot.seen { background: rgba(255,0,128,0.55) !important; }
    html[data-theme="dark"] .flip-hint { color: rgba(255,255,255,0.35) !important; }

    /* ── Dark mode: restore neon for audio/info/practice components ── */
    html[data-theme="dark"] .audio-btn { background: rgba(255,0,128,0.12) !important; color: #ff0080 !important; border-color: #ff0080 !important; box-shadow: 0 0 12px rgba(255,0,128,0.3) !important; text-shadow: 0 0 8px rgba(255,0,128,0.6) !important; }
    html[data-theme="dark"] .audio-btn:hover { background: rgba(255,0,128,0.22) !important; box-shadow: 0 0 24px rgba(255,0,128,0.55) !important; }
    html[data-theme="dark"] .intro-box { background: rgba(255,0,128,0.06) !important; border-color: rgba(255,0,128,0.22) !important; border-left-color: #ff0080 !important; }
    html[data-theme="dark"] .intro-box strong { color: #00f5ff !important; text-shadow: 0 0 8px rgba(0,245,255,0.4) !important; }
    html[data-theme="dark"] .tip-box { background: rgba(240,255,0,0.06) !important; border-color: rgba(240,255,0,0.22) !important; border-left-color: #f0ff00 !important; color: rgba(240,255,0,0.9) !important; font-family: 'Space Mono', monospace !important; }
    html[data-theme="dark"] .mnemonic-box { background: rgba(0,245,255,0.05) !important; border-color: rgba(0,245,255,0.18) !important; color: rgba(0,245,255,0.9) !important; }
    html[data-theme="dark"] .mnemonic-box::before { color: #00f5ff !important; }

    /* ── Dark mode: practice/writing ── */
    html[data-theme="dark"] .demo-anim-box { background: rgba(0,0,8,0.70) !important; border-color: var(--glass-border) !important; }
    html[data-theme="dark"] .stroke-badge { background: #ff0080 !important; box-shadow: 0 0 16px rgba(255,0,128,0.7) !important; }
    html[data-theme="dark"] .stroke-counter { color: var(--sakura) !important; text-shadow: 0 0 6px rgba(0,245,255,0.4) !important; }
    html[data-theme="dark"] .demo-info { background: rgba(0,0,8,0.60) !important; border-color: var(--glass-border) !important; }
    html[data-theme="dark"] .demo-info-romaji { font-family: 'Orbitron', sans-serif !important; background: linear-gradient(135deg, #ff0080, #00f5ff) !important; -webkit-background-clip: text !important; background-clip: text !important; -webkit-text-fill-color: transparent !important; filter: drop-shadow(0 0 12px rgba(255,0,128,0.5)) !important; }
    html[data-theme="dark"] .demo-info-pron { font-family: 'Space Mono', monospace !important; }
    html[data-theme="dark"] .demo-info-row .lbl { color: var(--sakura) !important; text-shadow: 0 0 6px rgba(0,245,255,0.4) !important; }
    html[data-theme="dark"] .canvas-wrap { background: rgba(0,0,5,0.80) !important; border-color: var(--glass-border) !important; box-shadow: var(--shadow), 0 0 20px rgba(255,0,128,0.1) !important; }
    html[data-theme="dark"] .writing-ref { background: rgba(0,0,8,0.60) !important; border-color: var(--glass-border) !important; }
    html[data-theme="dark"] .writing-ref h3 { color: var(--sakura) !important; text-shadow: 0 0 6px rgba(0,245,255,0.4) !important; }
    html[data-theme="dark"] .score-display { background: rgba(0,0,8,0.70) !important; border-color: var(--glass-border) !important; }
    html[data-theme="dark"] .score-number { font-family: 'Orbitron', sans-serif !important; -webkit-text-fill-color: unset !important; background: none !important; color: #fff !important; }
    html[data-theme="dark"] .score-great { color: #39ff14 !important; text-shadow: 0 0 14px var(--success-glow) !important; }
    html[data-theme="dark"] .score-good { color: #ff6400 !important; text-shadow: 0 0 10px rgba(255,100,0,0.5) !important; }
    html[data-theme="dark"] .score-retry { color: #ff0080 !important; text-shadow: 0 0 10px rgba(255,0,128,0.5) !important; }

    /* ── Dark mode: char pills ── */
    html[data-theme="dark"] .char-pill { background: rgba(0,0,8,0.60) !important; border-color: rgba(255,0,128,0.22) !important; }
    html[data-theme="dark"] .char-pill:hover { border-color: rgba(0,245,255,0.5) !important; color: var(--sakura) !important; box-shadow: 0 0 12px rgba(0,245,255,0.18) !important; }
    html[data-theme="dark"] .char-pill.active { background: rgba(255,0,128,0.14) !important; color: #ff0080 !important; border-color: #ff0080 !important; box-shadow: 0 0 16px rgba(255,0,128,0.35) !important; text-shadow: 0 0 8px rgba(255,0,128,0.5) !important; }

    /* ── Dark mode: quiz ── */
    html[data-theme="dark"] .quiz-pip { background: rgba(255,255,255,0.08) !important; }
    html[data-theme="dark"] .quiz-pip.correct { background: #39ff14 !important; box-shadow: 0 0 6px var(--success-glow) !important; }
    html[data-theme="dark"] .quiz-pip.wrong { background: #ff0080 !important; box-shadow: 0 0 6px rgba(255,0,128,0.4) !important; }
    html[data-theme="dark"] .quiz-pip.current { background: #ff6400 !important; box-shadow: 0 0 8px rgba(255,100,0,0.6) !important; }
    html[data-theme="dark"] .quiz-card { background: rgba(0,0,8,0.70) !important; border-color: var(--glass-border) !important; box-shadow: var(--shadow), 0 0 40px rgba(255,0,128,0.06) !important; }
    html[data-theme="dark"] .quiz-question-type { color: var(--sakura) !important; text-shadow: 0 0 6px rgba(0,245,255,0.4) !important; }
    html[data-theme="dark"] .quiz-prompt { text-shadow: 0 0 30px rgba(255,0,128,0.25) !important; }
    html[data-theme="dark"] .quiz-prompt-romaji { font-family: 'Orbitron', sans-serif !important; background: linear-gradient(135deg, #ff0080, #00f5ff) !important; -webkit-background-clip: text !important; background-clip: text !important; -webkit-text-fill-color: transparent !important; }
    html[data-theme="dark"] .quiz-option { background: rgba(0,0,8,0.60) !important; border-color: rgba(255,0,128,0.20) !important; }
    html[data-theme="dark"] .quiz-option:hover:not(:disabled) { border-color: rgba(255,0,128,0.6) !important; background: rgba(255,0,128,0.08) !important; color: #ff0080 !important; box-shadow: 0 0 20px rgba(255,0,128,0.2) !important; text-shadow: 0 0 8px rgba(255,0,128,0.5) !important; }
    html[data-theme="dark"] .quiz-option.correct { border-color: #39ff14 !important; background: rgba(57,255,20,0.08) !important; color: #39ff14 !important; box-shadow: 0 0 18px var(--success-glow) !important; text-shadow: 0 0 10px rgba(57,255,20,0.6) !important; }
    html[data-theme="dark"] .quiz-option.wrong { border-color: #ff0080 !important; background: rgba(255,0,128,0.08) !important; color: #ff0080 !important; text-shadow: 0 0 8px rgba(255,0,128,0.5) !important; }
    html[data-theme="dark"] .quiz-score-big { font-family: 'Orbitron', sans-serif !important; background: linear-gradient(135deg, #ff0080, #00f5ff, #f0ff00) !important; -webkit-background-clip: text !important; background-clip: text !important; -webkit-text-fill-color: transparent !important; filter: drop-shadow(0 0 20px rgba(255,0,128,0.6)) !important; }

    /* ── Dark mode: progress ── */
    html[data-theme="dark"] .progress-section { background: rgba(0,0,8,0.60) !important; border-color: var(--glass-border) !important; }
    html[data-theme="dark"] .char-cell { background: rgba(255,0,128,0.03) !important; border-color: rgba(255,0,128,0.14) !important; }
    html[data-theme="dark"] .char-cell:hover { border-color: rgba(0,245,255,0.5) !important; box-shadow: 0 0 14px rgba(0,245,255,0.18) !important; }
    html[data-theme="dark"] .char-cell.learned { background: rgba(57,255,20,0.06) !important; border-color: rgba(57,255,20,0.28) !important; }

    /* ── Dark mode: auth gate ── */
    html[data-theme="dark"] #auth-gate::before { background: radial-gradient(ellipse 60% 50% at 20% 30%, rgba(255,0,128,0.18) 0%, transparent 55%), radial-gradient(ellipse 55% 65% at 80% 70%, rgba(0,245,255,0.12) 0%, transparent 55%), radial-gradient(ellipse 70% 40% at 50% 100%, rgba(191,95,255,0.10) 0%, transparent 55%) !important; animation: bgNeon 14s ease-in-out infinite alternate !important; }
    html[data-theme="dark"] .auth-gate-inner { background: rgba(10,0,20,0.85) !important; border-color: var(--glass-border) !important; box-shadow: var(--shadow), 0 0 60px rgba(255,0,128,0.15) !important; }
    html[data-theme="dark"] .auth-gate-ja { color: unset !important; background: linear-gradient(135deg, #ff0080, #00f5ff) !important; -webkit-background-clip: text !important; background-clip: text !important; -webkit-text-fill-color: transparent !important; filter: drop-shadow(0 0 12px rgba(255,0,128,0.5)) !important; }
    html[data-theme="dark"] .auth-gate-title { font-family: 'Orbitron', sans-serif !important; color: unset !important; background: linear-gradient(90deg, #ff0080, #bf5fff, #00f5ff) !important; -webkit-background-clip: text !important; background-clip: text !important; -webkit-text-fill-color: transparent !important; }
    html[data-theme="dark"] .auth-gate-sub { font-family: 'Space Mono', monospace !important; }

    /* ── Dark mode: profile ── */
    html[data-theme="dark"] .profile-avatar-img { border-color: var(--red) !important; box-shadow: 0 0 20px var(--red-glow-sm) !important; }
    html[data-theme="dark"] .profile-avatar-placeholder { background: linear-gradient(135deg, var(--red), var(--purple)) !important; box-shadow: 0 0 20px var(--red-glow-sm) !important; }
    html[data-theme="dark"] .profile-name { font-family: 'Orbitron', sans-serif !important; }
    html[data-theme="dark"] .profile-email { font-family: 'Space Mono', monospace !important; }
    html[data-theme="dark"] .profile-stat-icon { background: linear-gradient(135deg, #ff0080, #00f5ff) !important; -webkit-background-clip: text !important; background-clip: text !important; -webkit-text-fill-color: transparent !important; }
    html[data-theme="dark"] .profile-stat-row { border-bottom-color: rgba(255,255,255,0.04) !important; }
    html[data-theme="dark"] .profile-stat-row span:last-child { font-family: 'Space Mono', monospace !important; color: var(--sakura) !important; }
    html[data-theme="dark"] .profile-progress-bar { background: rgba(255,255,255,0.06) !important; }
    html[data-theme="dark"] .profile-progress-fill { background: linear-gradient(90deg, #ff0080, #00f5ff) !important; box-shadow: 0 0 8px rgba(0,245,255,0.4) !important; }
    html[data-theme="dark"] .profile-premium-status { font-family: 'Orbitron', sans-serif !important; background: rgba(240,255,0,0.05) !important; border-color: rgba(240,255,0,0.2) !important; color: var(--gold) !important; }
    html[data-theme="dark"] .profile-danger-btn { border-color: rgba(255,0,128,0.3) !important; color: var(--danger) !important; }
    html[data-theme="dark"] .profile-danger-btn:hover { background: rgba(255,0,128,0.1) !important; }

    /* ── Dark mode: friends/leaderboard ── */
    html[data-theme="dark"] .friends-tabs { background: rgba(255,255,255,0.03) !important; border: none !important; }
    html[data-theme="dark"] .friends-tab { font-family: 'Space Mono', monospace !important; }
    html[data-theme="dark"] .friends-tab.active { background: rgba(255,0,128,0.15) !important; color: var(--neon-pink) !important; }
    html[data-theme="dark"] .friends-tab:hover:not(.active) { background: rgba(255,255,255,0.05) !important; color: #fff !important; }
    html[data-theme="dark"] .friend-code-value { font-family: 'Orbitron', monospace !important; color: var(--neon-cyan) !important; background: rgba(0,245,255,0.08) !important; border-color: rgba(0,245,255,0.2) !important; text-shadow: 0 0 12px rgba(0,245,255,0.4) !important; letter-spacing: .15em !important; }
    html[data-theme="dark"] .friend-code-value:hover { background: rgba(0,245,255,0.15) !important; border-color: var(--neon-cyan) !important; }
    html[data-theme="dark"] .friend-code-input input { background: rgba(255,255,255,0.06) !important; border-color: var(--glass-border) !important; color: #fff !important; font-family: 'Orbitron', monospace !important; letter-spacing: .1em !important; }
    html[data-theme="dark"] .friend-code-input input:focus { border-color: var(--neon-pink) !important; }
    html[data-theme="dark"] .friend-card:hover { border-color: rgba(255,0,128,0.3) !important; }
    html[data-theme="dark"] .friend-request { border-color: rgba(0,245,255,0.25) !important; background: rgba(0,245,255,0.03) !important; }
    html[data-theme="dark"] .friend-avatar { background: linear-gradient(135deg, var(--neon-pink), var(--neon-cyan)) !important; }
    html[data-theme="dark"] .leaderboard-me { border-color: rgba(255,0,128,0.35) !important; background: rgba(255,0,128,0.06) !important; }
    html[data-theme="dark"] .leaderboard-rank { font-family: 'Orbitron', monospace !important; }
    html[data-theme="dark"] .leaderboard-score { font-family: 'Orbitron', monospace !important; color: var(--neon-cyan) !important; text-shadow: 0 0 8px rgba(0,245,255,0.3) !important; }
    html[data-theme="dark"] .challenge-bar { background: rgba(255,255,255,0.08) !important; }
    html[data-theme="dark"] .challenge-bar-fill { background: linear-gradient(90deg, var(--neon-pink), var(--neon-cyan)) !important; box-shadow: 0 0 8px rgba(0,245,255,0.3) !important; }
    html[data-theme="dark"] .challenge-complete { color: #00ff88 !important; text-shadow: 0 0 12px rgba(0,255,136,0.5) !important; }
    html[data-theme="dark"] .challenge-done { border-color: rgba(0,255,136,0.25) !important; background: rgba(0,255,136,0.04) !important; }
    html[data-theme="dark"] .challenge-done .challenge-title::after { color: #00ff88 !important; }
    html[data-theme="dark"] .guest-banner-inner { background: linear-gradient(135deg, rgba(255,0,128,0.15), rgba(0,200,255,0.12)) !important; border-bottom-color: rgba(255,0,128,0.25) !important; }
    html[data-theme="dark"] .site-footer { border-top-color: rgba(255,255,255,0.06) !important; }
    html[data-theme="dark"] .site-footer a, html[data-theme="dark"] .site-footer .footer-legal button { color: var(--red) !important; }
    html[data-theme="dark"] .site-footer a:hover, html[data-theme="dark"] .site-footer .footer-legal button:hover { color: var(--sakura) !important; }
    html[data-theme="dark"] .site-footer .footer-update-notice { color: var(--neon-cyan) !important; font-family: 'Nunito', sans-serif !important; }
    html[data-theme="dark"] .script-toggle { background: rgba(255,0,128,0.10) !important; border-color: rgba(255,0,128,0.45) !important; color: #ff0080 !important; box-shadow: 0 0 10px rgba(255,0,128,0.15) !important; }
    html[data-theme="dark"] .script-toggle:hover { background: rgba(255,0,128,0.18) !important; border-color: #ff0080 !important; color: #ff0080 !important; box-shadow: 0 0 18px rgba(255,0,128,0.30) !important; }
    html[data-theme="dark"] .stat-label { font-family: 'Space Mono', monospace !important; }
    html[data-theme="dark"] .btn-indigo { background: rgba(0,245,255,0.12) !important; color: #00f5ff !important; border-color: rgba(0,245,255,0.6) !important; box-shadow: 0 0 12px rgba(0,245,255,0.2) !important; text-shadow: 0 0 8px rgba(0,245,255,0.5) !important; }
    html[data-theme="dark"] .btn-indigo:hover { background: rgba(0,245,255,0.18) !important; border-color: #00f5ff !important; box-shadow: 0 0 18px rgba(0,245,255,0.35) !important; }
    html[data-theme="dark"] .btn-success { background: rgba(57,255,20,0.10) !important; color: #39ff14 !important; border-color: rgba(57,255,20,0.55) !important; box-shadow: 0 0 12px rgba(57,255,20,0.18) !important; text-shadow: 0 0 8px rgba(57,255,20,0.45) !important; }
    html[data-theme="dark"] .btn-success:hover { background: rgba(57,255,20,0.16) !important; border-color: #39ff14 !important; }

    /* ── Dark mode: header ── */
    html[data-theme="dark"] header {
      background: rgba(0, 0, 8, 0.92) !important;
      border-bottom: 1px solid rgba(255, 0, 128, 0.35) !important;
      box-shadow: 0 0 24px rgba(255, 0, 128, 0.10) !important;
      color: #f0f0ff !important;
    }
    html[data-theme="dark"] .logo-ja {
      color: #00f5ff !important;
      text-shadow: 0 0 14px rgba(0, 245, 255, 0.7) !important;
      font-family: 'Noto Sans JP', sans-serif !important;
    }
    html[data-theme="dark"] .logo-title {
      font-family: 'Orbitron', sans-serif !important;
      font-size: 1.05rem !important;
      background: linear-gradient(135deg, #ff0080, #00f5ff) !important;
      -webkit-background-clip: text !important;
      background-clip: text !important;
      -webkit-text-fill-color: transparent !important;
      filter: drop-shadow(0 0 8px rgba(255, 0, 128, 0.4)) !important;
    }
    html[data-theme="dark"] .logo-sub {
      font-family: 'Space Mono', monospace !important;
      color: rgba(240, 240, 255, 0.35) !important;
      letter-spacing: .14em !important;
    }
    html[data-theme="dark"] .nav-group {
      background: transparent !important;
      border: none !important;
      gap: .5rem !important;
    }
    html[data-theme="dark"] .nav-btn {
      background: transparent !important;
      color: rgba(240, 240, 255, 0.60) !important;
      border: 1px solid rgba(255, 255, 255, 0.12) !important;
      border-radius: 4px !important;
      font-family: 'Orbitron', sans-serif !important;
      font-size: .62rem !important;
      font-weight: 700 !important;
      letter-spacing: .05em !important;
    }
    html[data-theme="dark"] .nav-btn:hover {
      background: rgba(255, 0, 128, 0.08) !important;
      color: #ff0080 !important;
      border-color: rgba(255, 0, 128, 0.55) !important;
      text-shadow: 0 0 8px rgba(255, 0, 128, 0.5) !important;
      box-shadow: none !important;
    }
    html[data-theme="dark"] .nav-btn.active {
      background: rgba(255, 0, 128, 0.08) !important;
      color: #ff0080 !important;
      border-color: #ff0080 !important;
      box-shadow: 0 0 14px rgba(255, 0, 128, 0.40), inset 0 0 14px rgba(255, 0, 128, 0.05) !important;
      text-shadow: 0 0 10px rgba(255, 0, 128, 0.65) !important;
      font-weight: 700 !important;
    }

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

    body {
      font-family: 'Nunito', 'Noto Sans JP', system-ui, sans-serif;
      background: var(--bg);
      color: var(--text);
      min-height: 100dvh;
      line-height: 1.6;
      overflow-x: hidden;
    }

    /* ─── SAKURA BACKGROUND ──────────────────────────────────── */
    body::before {
      content: '';
      position: fixed;
      inset: 0;
      z-index: -2;
      background:
        radial-gradient(ellipse 90% 55% at 10% -5%, rgba(255, 192, 208, 0.55) 0%, transparent 55%),
        radial-gradient(ellipse 70% 50% at 90% 15%, rgba(230, 195, 240, 0.38) 0%, transparent 55%),
        radial-gradient(ellipse 80% 60% at 50% 110%, rgba(255, 215, 195, 0.40) 0%, transparent 60%),
        radial-gradient(ellipse 55% 45% at 5% 85%, rgba(195, 220, 175, 0.22) 0%, transparent 50%),
        radial-gradient(ellipse 45% 40% at 95% 90%, rgba(212, 175, 225, 0.22) 0%, transparent 50%),
        #FDF6F0;
      animation: sakuraBg 22s ease-in-out infinite alternate;
    }

    body::after {
      content: '';
      position: fixed;
      inset: 0;
      z-index: -1;
      /* Seigaiha (overlapping wave/scale) pattern — traditional Japanese motif */
      background-image:
        radial-gradient(circle at 50% 100%, rgba(212, 114, 138, 0.055) 30%, transparent 31%),
        radial-gradient(circle at 0% 100%, rgba(212, 114, 138, 0.055) 30%, transparent 31%),
        radial-gradient(circle at 100% 100%, rgba(212, 114, 138, 0.055) 30%, transparent 31%);
      background-size: 32px 18px;
      background-position: 0 0, -16px 0, 16px 0;
      pointer-events: none;
    }

    @keyframes sakuraBg {
      0% {
        background-position: 0% 0%;
        filter: hue-rotate(0deg) brightness(1);
      }
      50% {
        filter: hue-rotate(6deg) brightness(1.03);
      }
      100% {
        background-position: 2% 3%;
        filter: hue-rotate(-4deg) brightness(0.98);
      }
    }

    /* Keep bgNeon defined for dark mode */
    @keyframes bgNeon {
      0%  { filter: hue-rotate(0deg) brightness(1); }
      50% { filter: hue-rotate(18deg) brightness(1.08); }
      100%{ filter: hue-rotate(-12deg) brightness(0.94); }
    }

    /* ─── HEADER ────────────────────────────────────────────── */
    header {
      background: rgba(255, 255, 255, 0.97);
      backdrop-filter: blur(20px) saturate(180%);
      -webkit-backdrop-filter: blur(20px) saturate(180%);
      border-bottom: 1px solid rgba(0, 0, 0, 0.07);
      color: #1A1410;
      padding: .65rem 1.75rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 1rem;
      position: sticky;
      top: 0;
      z-index: 200;
      box-shadow: 0 1px 12px rgba(0, 0, 0, 0.06);
    }

    .logo {
      display: flex;
      align-items: center;
      cursor: pointer;
      color: inherit;
      text-decoration: none;
      flex-shrink: 0;
    }

    .logo-title {
      font-family: 'Nunito', sans-serif;
      font-size: 1.35rem;
      font-weight: 900;
      line-height: 1;
      letter-spacing: -.01em;
      color: #1A1410;
    }
    .logo-daily {
      color: #D4728A;
    }

    .logo-text {
      display: flex;
      flex-direction: column;
      gap: .05rem;
    }

    .logo-ja {
      font-family: 'Noto Sans JP', sans-serif;
      font-size: 1.6rem;
      line-height: 1;
      margin-right: .5rem;
      color: #D4728A;
    }

    .logo-sub {
      font-size: .58rem;
      color: rgba(26, 20, 16, 0.45);
      letter-spacing: .1em;
      text-transform: uppercase;
      font-family: 'Nunito', sans-serif;
    }

    /* Hiragana rain canvas — visible only in dark mode */
    #rain-canvas { display: block; }
    html:not([data-theme="dark"]) #rain-canvas { display: none !important; }

    nav {
      display: flex;
      align-items: center;
      gap: .65rem;
      flex: 1;
      justify-content: center;
    }

    /* ─── NAV GROUP (bordered pill container) ─────────────── */
    .nav-group {
      display: flex;
      align-items: center;
      background: rgba(247, 243, 238, 0.90);
      border: 1.5px solid rgba(0, 0, 0, 0.09);
      border-radius: 2rem;
      padding: .22rem;
      gap: .1rem;
    }

    .nav-btn {
      background: transparent;
      color: rgba(26, 20, 16, 0.55);
      border: none;
      padding: .38rem .9rem;
      border-radius: 2rem;
      cursor: pointer;
      font-size: .78rem;
      font-weight: 600;
      transition: all .18s var(--ease);
      font-family: 'Nunito', sans-serif;
      letter-spacing: .01em;
      touch-action: manipulation;
      white-space: nowrap;
    }

    .nav-btn:hover {
      background: rgba(255, 255, 255, 0.75);
      color: #1A1410;
    }

    .nav-btn.active {
      background: #fff;
      color: #1A1410;
      font-weight: 800;
      box-shadow: 0 1px 6px rgba(0, 0, 0, 0.10);
    }


    main {
      max-width: 1100px;
      margin: 0 auto;
      padding: 2rem 1.5rem;
    }

    /* ─── ANIMATIONS ─────────────────────────────────────────── */
    @keyframes fadeInUp {
      from {
        opacity: 0;
        transform: translateY(24px);
      }

      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    @keyframes staggerIn {
      from {
        opacity: 0;
        transform: translateY(16px) scale(.96);
      }

      to {
        opacity: 1;
        transform: translateY(0) scale(1);
      }
    }

    @keyframes float {

      0%,
      100% {
        transform: translateY(0) rotate(-2deg);
      }

      50% {
        transform: translateY(-6px) rotate(2deg);
      }
    }

    @keyframes pulse {
      from {
        box-shadow: 0 0 0 0 var(--red-glow);
      }

      to {
        box-shadow: 0 0 24px 4px var(--red-glow);
      }
    }

    @keyframes pulseSpeaking {
      from {
        transform: scale(1);
        box-shadow: 0 0 0 0 var(--red-glow);
      }

      to {
        transform: scale(1.14);
        box-shadow: 0 0 20px 4px var(--red-glow);
      }
    }

    @keyframes shake {

      0%,
      100% {
        transform: translateX(0);
      }

      25% {
        transform: translateX(-7px);
      }

      75% {
        transform: translateX(7px);
      }
    }

    @keyframes bounceIn {
      0% {
        transform: scale(.78);
        opacity: 0;
      }

      65% {
        transform: scale(1.06);
        opacity: 1;
      }

      100% {
        transform: scale(1);
      }
    }

    @keyframes progressFill {
      from {
        width: 0;
      }
    }

    @keyframes glowPulse {
      from {
        opacity: .4;
      }

      to {
        opacity: 1;
      }
    }

    @keyframes slideInLeft {
      from {
        opacity: 0;
        transform: translateX(-30px);
      }

      to {
        opacity: 1;
        transform: translateX(0);
      }
    }

    @keyframes slideInRight {
      from {
        opacity: 0;
        transform: translateX(30px);
      }

      to {
        opacity: 1;
        transform: translateX(0);
      }
    }

    @keyframes scaleIn {
      from {
        opacity: 0;
        transform: scale(0.85);
      }

      to {
        opacity: 1;
        transform: scale(1);
      }
    }

    @keyframes popIn {
      0% {
        opacity: 0;
        transform: scale(0.3) rotate(-8deg);
      }

      60% {
        transform: scale(1.1) rotate(2deg);
      }

      100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
      }
    }

    @keyframes scoreReveal {
      0% {
        opacity: 0;
        transform: scale(0.4) translateY(20px);
        filter: blur(8px);
      }

      60% {
        transform: scale(1.15) translateY(-4px);
        filter: blur(0);
      }

      100% {
        opacity: 1;
        transform: scale(1) translateY(0);
      }
    }

    @keyframes cardStagger {
      from {
        opacity: 0;
        transform: translateY(18px) scale(0.96);
      }

      to {
        opacity: 1;
        transform: translateY(0) scale(1);
      }
    }

    @keyframes neonBorder {

      0%,
      100% {
        border-color: rgba(255, 0, 128, 0.28);
      }

      50% {
        border-color: rgba(0, 245, 255, 0.55);
      }
    }

    /* ─── VIEW TRANSITION ───────────────────────────────────────── */
    main {
      animation: fadeInUp .35s var(--ease) both;
    }

    .quiz-card {
      animation: bounceIn .35s var(--ease) both;
    }

    .match-layout {
      animation: fadeInUp .3s var(--ease) both;
    }

    .match-btn {
      transition: all .2s var(--ease), transform .15s var(--ease);
    }

    .score-display {
      animation: scoreReveal .45s var(--ease) both;
    }

    .demo-anim-box {
      animation: scaleIn .4s var(--ease) both;
    }

    .demo-info {
      animation: slideInRight .35s var(--ease) both;
      animation-delay: 100ms;
    }

    .writing-ref {
      animation: slideInRight .35s var(--ease) both;
      animation-delay: 80ms;
    }

    .btn:active {
      transform: scale(0.94);
    }

    @keyframes cardFloat {

      0%,
      100% {
        transform: translateY(0);
      }

      50% {
        transform: translateY(-3px);
      }
    }

    @keyframes shimmer {
      0% {
        background-position: -200% center;
      }

      100% {
        background-position: 200% center;
      }
    }

    @keyframes glitch {

      0%,
      86%,
      100% {
        transform: translate(0);
        filter: none;
      }

      88% {
        transform: translate(-3px, 1px);
        filter: hue-rotate(90deg);
      }

      90% {
        transform: translate(3px, -1px);
        filter: hue-rotate(-90deg);
      }

      92% {
        transform: translate(-2px, 0);
      }

      94% {
        transform: translate(2px, 1px);
      }
    }

    @keyframes neonFlicker {

      0%,
      95%,
      100% {
        opacity: 1;
      }

      96% {
        opacity: 0.85;
      }

      97% {
        opacity: 1;
      }

      98% {
        opacity: 0.7;
      }

      99% {
        opacity: 1;
      }
    }

    @keyframes neonPulse {
      from {
        box-shadow: 0 0 8px var(--red-glow), 0 0 0 1px var(--glass-border);
      }

      to {
        box-shadow: 0 0 24px var(--red-glow), 0 0 48px rgba(255, 0, 128, 0.12), 0 0 0 1px rgba(255, 0, 128, 0.5);
      }
    }

    @keyframes scanMove {
      from {
        background-position: 0 0;
      }

      to {
        background-position: 0 100px;
      }
    }

    #app {
      animation: fadeInUp .4s var(--ease) both;
    }

    /* ─── TYPOGRAPHY ─────────────────────────────────────────── */
    h1 {
      font-family: 'Noto Serif JP', serif;
      font-size: 2.2rem;
      font-weight: 700;
      letter-spacing: -.02em;
      line-height: 1.15;
      background: linear-gradient(135deg, #D4728A 0%, #8B7DB5 50%, #3B4A6B 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
      filter: drop-shadow(0 2px 8px rgba(212, 114, 138, 0.25));
    }

    h2 {
      font-size: 1.4rem;
      font-weight: 700;
      letter-spacing: -.01em;
      margin-bottom: 1rem;
      color: var(--text);
    }

    h3 {
      font-size: .95rem;
      font-weight: 700;
      color: var(--text);
    }

    .subtitle {
      color: var(--text-muted);
      font-size: .94rem;
      margin-bottom: 1.5rem;
      line-height: 1.55;
    }

    .script-toggle {
      display: flex;
      align-items: center;
      gap: .5rem;
      padding: .45rem 1rem;
      background: rgba(255, 255, 255, 0.70);
      border: 1.5px solid rgba(212, 114, 138, 0.22);
      border-radius: 2rem;
      cursor: pointer;
      transition: all .25s var(--ease);
      font-family: 'Nunito', sans-serif;
      font-size: .8rem;
      color: var(--text-muted);
      user-select: none;
    }
    .script-toggle:hover {
      border-color: rgba(212, 114, 138, 0.55);
      background: rgba(212, 114, 138, 0.08);
      color: #D4728A;
    }

    .section-title {
      font-size: .66rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: .12em;
      color: var(--clr-sakura, #D4728A);
      margin-bottom: .5rem;
      font-family: 'Space Mono', monospace;
      text-shadow: 0 1px 6px rgba(212, 114, 138, 0.3);
    }

    /* ─── GLASS UTILITY ──────────────────────────────────────── */
    .glass {
      background: var(--surface);
      backdrop-filter: var(--blur);
      -webkit-backdrop-filter: var(--blur);
      border: 1px solid var(--glass-border);
      border-radius: var(--r-lg);
      box-shadow: var(--shadow), 0 0 0 1px rgba(255, 0, 128, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    }

    /* ─── BUTTONS ────────────────────────────────────────────── */
    .btn {
      display: inline-flex;
      align-items: center;
      gap: .38rem;
      padding: .62rem 1.4rem;
      border-radius: 2rem;
      cursor: pointer;
      font-size: .88rem;
      font-weight: 700;
      font-family: 'Nunito', 'Noto Sans JP', system-ui, sans-serif;
      transition: all .2s var(--ease);
      touch-action: manipulation;
      white-space: nowrap;
      letter-spacing: .02em;
      border: 1.5px solid transparent;
    }

    .btn:active {
      transform: scale(.96) !important;
    }

    /* Primary: Sakura pink pill */
    .btn-primary {
      background: var(--red);
      color: #fff;
      border-color: var(--red);
      box-shadow: 0 3px 14px var(--red-glow-sm);
    }

    .btn-primary:hover {
      background: var(--red-dark);
      border-color: var(--red-dark);
      box-shadow: 0 5px 20px var(--red-glow);
      transform: translateY(-2px);
    }

    /* Secondary: Indigo pill */
    .btn-secondary {
      background: rgba(59, 74, 107, 0.08);
      border-color: rgba(59, 74, 107, 0.35);
      color: var(--clr-indigo, #3B4A6B);
    }

    .btn-secondary:hover {
      background: rgba(59, 74, 107, 0.14);
      border-color: rgba(59, 74, 107, 0.65);
      color: #2C3858;
      box-shadow: 0 3px 12px rgba(59, 74, 107, 0.15);
      transform: translateY(-1px);
    }

    /* Solid indigo variant */
    .btn-indigo {
      background: var(--clr-indigo);
      color: #fff;
      border-color: var(--clr-indigo);
      box-shadow: 0 3px 14px var(--blue-glow);
    }
    .btn-indigo:hover {
      background: color-mix(in srgb, var(--clr-indigo) 80%, #000);
      border-color: color-mix(in srgb, var(--clr-indigo) 80%, #000);
      box-shadow: 0 5px 20px var(--blue-glow);
      transform: translateY(-1px);
    }

    /* Matcha green variant */
    .btn-success {
      background: var(--clr-matcha);
      color: #fff;
      border-color: var(--clr-matcha);
      box-shadow: 0 3px 12px var(--success-glow);
    }

    .btn-success:hover {
      background: color-mix(in srgb, var(--clr-matcha) 80%, #000);
      border-color: color-mix(in srgb, var(--clr-matcha) 80%, #000);
      box-shadow: 0 5px 18px var(--success-glow);
      transform: translateY(-1px);
    }

    .btn-warn {
      background: rgba(196, 150, 58, 0.10);
      color: #C4963A;
      border-color: rgba(196, 150, 58, 0.55);
      box-shadow: 0 2px 8px rgba(196, 150, 58, 0.18);
    }

    .btn-warn:hover {
      background: rgba(196, 150, 58, 0.18);
      box-shadow: 0 4px 14px rgba(196, 150, 58, 0.30);
      transform: translateY(-1px);
    }

    .back-btn {
      display: inline-flex;
      align-items: center;
      gap: .4rem;
      background: rgba(255, 255, 255, 0.7);
      backdrop-filter: blur(12px);
      border: 1.5px solid rgba(59, 74, 107, 0.25);
      padding: .48rem 1.1rem;
      border-radius: 2rem;
      cursor: pointer;
      font-size: .76rem;
      font-weight: 700;
      font-family: 'Nunito', sans-serif;
      color: var(--clr-indigo, #3B4A6B);
      letter-spacing: .03em;
      transition: all .2s var(--ease);
    }

    .back-btn:hover {
      border-color: rgba(212, 114, 138, 0.5);
      color: #D4728A;
      box-shadow: 0 3px 10px rgba(212, 114, 138, 0.15);
      transform: translateX(-2px);
    }

    /* ─── STAT CARDS ──────────────────────────────────────────── */
    .stats-row {
      display: flex;
      gap: 1rem;
      margin-bottom: 2.5rem;
      flex-wrap: wrap;
    }

    .stat-card {
      background: rgba(255, 255, 255, 0.82);
      backdrop-filter: var(--blur);
      -webkit-backdrop-filter: var(--blur);
      border: 1.5px solid rgba(212, 114, 138, 0.18);
      border-radius: var(--r-lg);
      padding: 1.3rem 1.6rem 1.6rem;
      flex: 1;
      min-width: 110px;
      text-align: center;
      box-shadow: 0 3px 16px rgba(44, 24, 16, 0.08), 0 1px 4px rgba(212, 114, 138, 0.08);
      transition: all .22s var(--ease);
      animation: staggerIn .45s ease both;
      position: relative;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      align-items: center;
    }

    .stat-card::before {
      display: none;
    }

    .stat-card:hover {
      transform: translateY(-4px);
      border-color: rgba(212, 114, 138, 0.42);
      box-shadow: 0 8px 28px rgba(44, 24, 16, 0.12), 0 2px 8px rgba(212, 114, 138, 0.14);
    }

    .stat-card:nth-child(1) {
      animation-delay: .06s;
    }

    .stat-card:nth-child(2) {
      animation-delay: .12s;
    }

    .stat-card:nth-child(3) {
      animation-delay: .18s;
    }

    .stat-card:nth-child(4) {
      animation-delay: .24s;
    }

    .stat-num {
      font-size: 2.4rem;
      font-weight: 800;
      line-height: 1.1;
      font-family: 'Noto Serif JP', serif;
      background: linear-gradient(135deg, #D4728A, #3B4A6B);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
      filter: drop-shadow(0 1px 4px rgba(212, 114, 138, 0.25));
    }

    .stat-label {
      font-size: .63rem;
      color: var(--text-dim);
      margin-bottom: .2rem;
      text-transform: uppercase;
      letter-spacing: .1em;
      font-weight: 700;
      font-family: 'Nunito', sans-serif;
    }

    /* ─── PROGRESS BAR ───────────────────────────────────────── */
    .progress-bar-wrap {
      background: rgba(212, 114, 138, 0.08);
      border: 1.5px solid rgba(212, 114, 138, 0.18);
      border-radius: var(--r-xl);
      height: 8px;
      margin-bottom: 2rem;
      overflow: hidden;
    }

    .progress-bar-fill {
      background: linear-gradient(90deg, #D4728A, #8B7DB5, #7FA86E);
      background-size: 200% 100%;
      height: 100%;
      border-radius: var(--r-xl);
      animation: progressFill 1.2s var(--ease) both, shimmer 4s linear infinite;
      box-shadow: 0 2px 8px rgba(212, 114, 138, 0.35);
    }

    /* ─── LESSON GRID ────────────────────────────────────────── */
    .lesson-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
      gap: 1rem;
    }

    .lesson-card {
      background: rgba(255, 255, 255, 0.80);
      backdrop-filter: var(--blur);
      -webkit-backdrop-filter: var(--blur);
      border: 1.5px solid var(--glass-border);
      border-radius: var(--r-lg);
      padding: 1.3rem;
      cursor: pointer;
      position: relative;
      overflow: hidden;
      box-shadow: var(--shadow);
      transition: all .22s var(--ease);
      animation: staggerIn .45s ease both;
    }

    .lesson-card::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      bottom: 0;
      width: 2px;
      background: var(--card-accent, rgba(255, 0, 128, 0.5));
      border-radius: var(--r-lg) 0 0 var(--r-lg);
    }

    .lesson-card::after {
      display: none;
    }

    .lesson-card.completed::after {
      content: '✓';
      display: flex;
      position: absolute;
      top: .8rem;
      right: .8rem;
      background: rgba(127, 168, 110, 0.15);
      color: #5A8044;
      font-size: .68rem;
      font-weight: 800;
      width: 22px;
      height: 22px;
      border-radius: 50%;
      align-items: center;
      justify-content: center;
      border: 1px solid rgba(127, 168, 110, 0.55);
      box-shadow: 0 2px 8px rgba(127, 168, 110, 0.25);
    }

    .lesson-card:hover:not(.locked) {
      transform: translateY(-5px) scale(1.01);
      border-color: rgba(212, 114, 138, 0.5);
      box-shadow: var(--shadow), 0 4px 20px rgba(212, 114, 138, 0.14);
    }

    .lesson-card.locked {
      opacity: .28;
      cursor: not-allowed;
    }

    .lesson-card.completed {
      background: rgba(127, 168, 110, 0.08);
      border-color: rgba(127, 168, 110, 0.35);
    }

    .lesson-day {
      font-size: .62rem;
      text-transform: uppercase;
      letter-spacing: .1em;
      color: var(--clr-sakura, #D4728A);
      margin-bottom: .25rem;
      font-weight: 700;
      font-family: 'Space Mono', monospace;
    }

    .lesson-title {
      font-size: .98rem;
      font-weight: 800;
      margin-bottom: .2rem;
      line-height: 1.2;
      color: var(--text);
    }

    .lesson-sub {
      font-size: .78rem;
      color: var(--text-muted);
    }

    .lesson-emoji {
      font-size: 1.9rem;
      margin-bottom: .5rem;
      display: block;
      line-height: 1;
    }

    .lock-icon {
      position: absolute;
      top: .8rem;
      right: .8rem;
      font-size: .9rem;
      opacity: .3;
    }

    /* ─── LESSON HEADER ──────────────────────────────────────── */
    .lesson-header {
      display: flex;
      align-items: center;
      gap: 1rem;
      margin-bottom: 2rem;
      flex-wrap: wrap;
    }

    /* ─── FLASHCARD ──────────────────────────────────────────── */
    .char-nav {
      display: flex;
      align-items: center;
      gap: 1rem;
      justify-content: center;
      margin-bottom: 1.25rem;
      flex-wrap: wrap;
    }

    .char-dots {
      display: flex;
      gap: .42rem;
      align-items: center;
    }

    .char-dot {
      width: 10px;
      height: 10px;
      border-radius: 50%;
      background: rgba(212, 114, 138, 0.15);
      cursor: pointer;
      transition: all .2s var(--ease);
    }

    .char-dot.active {
      background: #D4728A;
      transform: scale(1.35);
      box-shadow: 0 0 8px rgba(212, 114, 138, 0.4);
    }

    .char-dot.seen {
      background: #3B4A6B;
      opacity: .6;
      box-shadow: 0 0 4px rgba(59, 74, 107, 0.25);
    }

    .arrow-btn {
      background: rgba(255, 255, 255, 0.80);
      backdrop-filter: blur(12px);
      border: 1.5px solid rgba(212, 114, 138, 0.22);
      padding: .5rem .9rem;
      border-radius: var(--r-lg);
      cursor: pointer;
      font-size: 1rem;
      color: var(--text);
      transition: all .2s var(--ease);
      font-family: inherit;
      min-width: 44px;
      min-height: 44px;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .arrow-btn:hover {
      border-color: rgba(212, 114, 138, 0.5);
      color: #D4728A;
      box-shadow: 0 3px 12px rgba(212, 114, 138, 0.15);
      transform: scale(1.08);
    }

    .arrow-btn:disabled {
      opacity: .20;
      cursor: not-allowed;
      transform: none;
    }

    .flashcard-scene {
      perspective: 1200px;
      margin: 0 auto 1.5rem;
      width: min(340px, 100%);
      height: 420px;
      animation: scaleIn .45s var(--ease) both;
    }

    .flashcard {
      width: 100%;
      height: 100%;
      transform-style: preserve-3d;
      transition: transform .65s cubic-bezier(.4, 0, .2, 1);
      cursor: pointer;
      position: relative;
    }

    .flashcard.flipped {
      transform: rotateY(180deg);
    }

    .fc-side {
      position: absolute;
      width: 100%;
      height: 100%;
      backface-visibility: hidden;
      border-radius: var(--r-xl);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 1.75rem;
      text-align: center;
    }

    .fc-front {
      background: rgba(255, 255, 255, 0.92);
      backdrop-filter: var(--blur);
      -webkit-backdrop-filter: var(--blur);
      border: 1.5px solid rgba(212, 114, 138, 0.22);
      box-shadow: 0 4px 24px rgba(44, 24, 16, 0.08), 0 1px 4px rgba(212, 114, 138, 0.08);
    }

    .fc-back {
      background: linear-gradient(150deg, rgba(253, 246, 240, 0.98) 0%, rgba(255, 255, 255, 0.96) 50%, rgba(245, 237, 229, 0.98) 100%);
      backdrop-filter: var(--blur);
      -webkit-backdrop-filter: var(--blur);
      border: 1.5px solid rgba(212, 114, 138, 0.35);
      color: var(--text);
      transform: rotateY(180deg);
      box-shadow: 0 8px 32px rgba(44, 24, 16, 0.10), 0 2px 8px rgba(212, 114, 138, 0.10);
    }

    .fc-char {
      font-size: 9rem;
      line-height: 1;
      font-family: 'Noto Serif JP', serif;
      color: var(--text);
      text-shadow: none;
      max-width: 100%;
      overflow-wrap: break-word;
      white-space: normal;
    }

    .fc-strokes {
      font-size: .72rem;
      color: var(--clr-indigo);
      background: rgba(59, 74, 107, 0.06);
      border: 1px solid rgba(59, 74, 107, 0.20);
      border-radius: 2rem;
      padding: .18rem .72rem;
      font-weight: 700;
      margin-top: .35rem;
      font-family: 'Space Mono', monospace;
      text-transform: uppercase;
      letter-spacing: .05em;
    }

    .fc-hint {
      font-size: .79rem;
      color: var(--text-muted);
      margin-top: .5rem;
    }

    .fc-romaji {
      font-size: 3.8rem;
      font-weight: 900;
      letter-spacing: -2px;
      margin-bottom: .4rem;
      font-family: 'Nunito', sans-serif;
      background: linear-gradient(135deg, #D4728A 30%, #3B4A6B 80%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
      filter: drop-shadow(0 1px 4px rgba(212, 114, 138, 0.25));
    }

    .fc-pronunciation {
      font-size: .94rem;
      color: var(--text-muted);
      margin-bottom: 1rem;
      font-family: 'Space Mono', monospace;
    }

    .fc-example {
      background: rgba(59, 74, 107, 0.06);
      border: 1px solid rgba(59, 74, 107, 0.18);
      border-radius: var(--r);
      padding: .8rem 1.2rem;
      width: 100%;
    }

    .fc-example-word {
      font-size: 1.5rem;
      margin-bottom: .2rem;
      font-family: 'Noto Sans JP', serif;
      color: var(--text);
    }

    .fc-example-romaji {
      font-size: .8rem;
      color: var(--text-muted);
      font-family: 'Space Mono', monospace;
    }

    .fc-example-eng {
      font-size: .94rem;
      color: var(--text);
      font-weight: 700;
    }

    .flip-hint {
      text-align: center;
      color: var(--text-dim);
      font-size: .75rem;
      margin-bottom: .75rem;
      font-family: 'Space Mono', monospace;
      letter-spacing: .05em;
      text-transform: uppercase;
    }

    /* ─── AUDIO BUTTON ───────────────────────────────────────── */
    .audio-btn {
      background: rgba(212, 114, 138, 0.10);
      color: #D4728A;
      border: 1px solid rgba(212, 114, 138, 0.40);
      border-radius: 50%;
      width: 48px;
      height: 48px;
      font-size: 1.2rem;
      cursor: pointer;
      box-shadow: 0 2px 10px rgba(212, 114, 138, 0.18);
      transition: all .2s var(--ease);
      margin-top: .5rem;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }

    .audio-btn:hover {
      transform: scale(1.12);
      box-shadow: 0 4px 18px rgba(212, 114, 138, 0.32);
      background: rgba(212, 114, 138, 0.18);
    }

    .audio-btn.speaking {
      animation: pulseSpeaking .55s ease-in-out infinite alternate;
    }

    /* ─── LESSON ACTIONS ─────────────────────────────────────── */
    .lesson-actions {
      display: flex;
      gap: .75rem;
      justify-content: center;
      margin-top: 1.75rem;
      flex-wrap: wrap;
    }

    /* ─── INFO BOXES ─────────────────────────────────────────── */
    .intro-box {
      background: rgba(255, 252, 248, 0.95);
      border: 1px solid rgba(212, 114, 138, 0.20);
      border-left: 3px solid #D4728A;
      border-radius: var(--r-lg);
      padding: 1.1rem 1.4rem;
      margin-bottom: 1.5rem;
      font-size: .91rem;
      color: var(--text);
      line-height: 1.65;
    }

    .intro-box strong {
      color: #3B4A6B;
    }

    .tip-box {
      background: rgba(196, 150, 58, 0.07);
      border: 1px solid rgba(196, 150, 58, 0.25);
      border-left: 2px solid #C4963A;
      border-radius: var(--r);
      padding: .75rem 1rem;
      font-size: .84rem;
      margin-top: .8rem;
      color: #8B6A1E;
      line-height: 1.55;
    }

    .mnemonic-box {
      background: rgba(127, 168, 110, 0.08);
      border: 1px solid rgba(127, 168, 110, 0.28);
      border-radius: var(--r);
      padding: .6rem 1rem;
      font-size: .84rem;
      color: #3D6B2E;
      margin-top: .6rem;
      line-height: 1.5;
    }

    .mnemonic-box::before {
      content: '◆ ';
      color: #7FA86E;
    }

    /* ─── PRACTICE / DEMO ────────────────────────────────────── */
    .demo-layout {
      display: flex;
      gap: 2rem;
      flex-wrap: wrap;
      align-items: flex-start;
    }

    .demo-left {
      flex: 0 0 320px;
    }

    .demo-right {
      flex: 1;
      min-width: 250px;
    }

    .demo-anim-box {
      background: rgba(255, 255, 255, 0.92);
      border: 1.5px solid rgba(212, 114, 138, 0.18);
      border-radius: var(--r-lg);
      padding: 1.25rem;
      box-shadow: var(--shadow);
      text-align: center;
      position: relative;
    }

    .demo-anim-box svg {
      display: block;
      margin: 0 auto;
    }

    .demo-anim-label {
      font-size: .72rem;
      color: var(--text-muted);
      margin-top: .5rem;
      font-family: 'Space Mono', monospace;
      text-transform: uppercase;
      letter-spacing: .05em;
    }

    .stroke-counter {
      font-size: .78rem;
      color: #D4728A;
      margin-top: .4rem;
      font-weight: 700;
      font-family: 'Space Mono', monospace;
    }

    .demo-controls {
      display: flex;
      gap: .65rem;
      margin-top: .8rem;
      flex-wrap: wrap;
      justify-content: center;
    }

    .stroke-badge {
      position: absolute;
      background: #D4728A;
      color: #fff;
      font-size: .65rem;
      font-weight: 700;
      border-radius: 50%;
      width: 20px;
      height: 20px;
      display: flex;
      align-items: center;
      justify-content: center;
      transform: translate(-50%, -50%);
      pointer-events: none;
      box-shadow: 0 2px 8px rgba(212, 114, 138, 0.45);
    }

    .demo-info {
      background: rgba(255, 255, 255, 0.92);
      border: 1.5px solid rgba(212, 114, 138, 0.18);
      border-radius: var(--r-lg);
      padding: 1.4rem;
      box-shadow: var(--shadow);
    }

    .demo-info-romaji {
      font-size: 2.8rem;
      font-weight: 900;
      letter-spacing: -1px;
      line-height: 1.1;
      margin-bottom: .2rem;
      font-family: 'Nunito', sans-serif;
      background: linear-gradient(135deg, #D4728A, #3B4A6B);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
      filter: drop-shadow(0 1px 4px rgba(212, 114, 138, 0.25));
    }

    .demo-info-pron {
      font-size: .88rem;
      color: var(--text-muted);
      margin-bottom: 1rem;
      font-family: 'Nunito', sans-serif;
    }

    .demo-info-row {
      display: flex;
      gap: .5rem;
      align-items: flex-start;
      margin-bottom: .5rem;
      font-size: .9rem;
      color: var(--text);
    }

    .demo-info-row .lbl {
      font-weight: 700;
      color: #D4728A;
      font-size: .65rem;
      text-transform: uppercase;
      letter-spacing: .08em;
      min-width: 64px;
      padding-top: .2rem;
      font-family: 'Space Mono', monospace;
    }

    /* ─── WRITING CANVAS ─────────────────────────────────────── */
    .writing-layout {
      display: flex;
      gap: 2rem;
      flex-wrap: wrap;
      align-items: flex-start;
    }

    .writing-left {
      flex: 0 0 340px;
    }

    .writing-right {
      flex: 1;
      min-width: 250px;
    }

    .canvas-wrap {
      position: relative;
      width: 320px;
      height: 320px;
      border-radius: var(--r);
      overflow: hidden;
      box-shadow: var(--shadow);
      border: 1.5px solid rgba(212, 114, 138, 0.20);
      background: #FFF9F5;
    }

    #guide-canvas {
      position: absolute;
      top: 0;
      left: 0;
      pointer-events: none;
    }

    #draw-canvas {
      position: absolute;
      top: 0;
      left: 0;
      cursor: crosshair;
      touch-action: none;
    }

    .canvas-controls {
      display: flex;
      gap: .65rem;
      margin-top: .75rem;
      flex-wrap: wrap;
    }

    .writing-ref {
      background: rgba(255, 255, 255, 0.92);
      border: 1.5px solid rgba(212, 114, 138, 0.18);
      border-radius: var(--r);
      padding: 1.2rem;
      box-shadow: var(--shadow);
    }

    .writing-ref h3 {
      font-size: .65rem;
      text-transform: uppercase;
      letter-spacing: .1em;
      color: #D4728A;
      margin-bottom: .5rem;
      font-family: 'Space Mono', monospace;
    }

    .score-display {
      margin-top: 1rem;
      padding: 1.3rem;
      border-radius: var(--r-lg);
      text-align: center;
      background: rgba(255, 255, 255, 0.92);
      border: 1.5px solid rgba(212, 114, 138, 0.18);
      box-shadow: var(--shadow);
      animation: bounceIn .35s ease both;
    }

    .score-number {
      font-size: 3.2rem;
      font-weight: 800;
      line-height: 1;
      font-family: 'Noto Serif JP', serif;
      background: linear-gradient(135deg, #D4728A, #3B4A6B);
      -webkit-background-clip: text;
      background-clip: text;
      -webkit-text-fill-color: transparent;
    }

    .score-label {
      font-size: .78rem;
      color: var(--text-muted);
      margin-top: .2rem;
      font-family: 'Space Mono', monospace;
      text-transform: uppercase;
      letter-spacing: .08em;
    }

    .score-feedback {
      font-size: 1rem;
      font-weight: 700;
      margin-top: .5rem;
    }

    .score-great {
      color: #5A8F4A;
    }

    .score-good {
      color: #C4963A;
    }

    .score-retry {
      color: #D4728A;
    }

    /* ─── CHAR SELECTORS ─────────────────────────────────────── */
    .char-selector {
      display: flex;
      gap: .4rem;
      flex-wrap: wrap;
      margin-bottom: .75rem;
    }

    .char-pill {
      background: rgba(255, 255, 255, 0.85);
      border: 1.5px solid rgba(212, 114, 138, 0.20);
      border-radius: var(--r);
      padding: .3rem .65rem;
      cursor: pointer;
      font-size: 1.1rem;
      font-family: 'Noto Sans JP', serif;
      color: var(--text);
      transition: all .2s var(--ease);
      min-height: 44px;
      display: flex;
      align-items: center;
    }

    .char-pill:hover {
      border-color: rgba(212, 114, 138, 0.55);
      color: #D4728A;
      box-shadow: 0 3px 12px rgba(212, 114, 138, 0.18);
      transform: scale(1.07);
    }

    .char-pill.active {
      background: rgba(212, 114, 138, 0.12);
      color: #D4728A;
      border-color: #D4728A;
      box-shadow: 0 3px 12px rgba(212, 114, 138, 0.25);
    }

    /* ─── QUIZ ───────────────────────────────────────────────── */
    .quiz-progress {
      display: flex;
      gap: .3rem;
      margin-bottom: 1.5rem;
    }

    .quiz-pip {
      height: 4px;
      flex: 1;
      border-radius: 2px;
      background: rgba(212, 114, 138, 0.15);
      transition: background .3s ease;
    }

    .quiz-pip.correct {
      background: #7FA86E;
    }

    .quiz-pip.wrong {
      background: #D4728A;
    }

    .quiz-pip.current {
      background: #C4963A;
      animation: glowPulse .8s ease-in-out infinite alternate;
    }

    .quiz-card {
      background: rgba(255, 255, 255, 0.92);
      border: 1.5px solid rgba(212, 114, 138, 0.18);
      border-radius: var(--r-xl);
      padding: 2rem;
      box-shadow: var(--shadow);
      max-width: 560px;
      margin: 0 auto;
    }

    .quiz-question-type {
      font-size: .66rem;
      text-transform: uppercase;
      letter-spacing: .12em;
      color: #D4728A;
      margin-bottom: .5rem;
      font-weight: 700;
      font-family: 'Space Mono', monospace;
    }

    .quiz-prompt {
      font-size: 5.5rem;
      text-align: center;
      margin: 1rem 0;
      line-height: 1;
      font-family: 'Noto Serif JP', serif;
      color: var(--text);
      animation: bounceIn .3s ease both;
    }

    .quiz-prompt-romaji {
      font-size: 2.8rem;
      font-weight: 900;
      text-align: center;
      margin: 1rem 0;
      font-family: 'Nunito', sans-serif;
      animation: bounceIn .3s ease both;
      background: linear-gradient(135deg, #D4728A, #3B4A6B);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
    }

    .quiz-options {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: .65rem;
      margin-top: 1.5rem;
    }

    .quiz-option {
      background: rgba(255, 255, 255, 0.85);
      border: 1.5px solid rgba(212, 114, 138, 0.18);
      border-radius: var(--r);
      padding: 1rem;
      cursor: pointer;
      font-size: 1.15rem;
      text-align: center;
      transition: all .2s var(--ease);
      font-weight: 700;
      font-family: inherit;
      color: var(--text);
      min-height: 56px;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .quiz-option:hover:not(:disabled) {
      border-color: rgba(212, 114, 138, 0.55);
      background: rgba(212, 114, 138, 0.08);
      color: #D4728A;
      transform: scale(1.03);
      box-shadow: 0 4px 16px rgba(212, 114, 138, 0.18);
    }

    .quiz-option.correct {
      border-color: #7FA86E;
      background: rgba(127, 168, 110, 0.12);
      color: #3D6B2E;
      animation: bounceIn .25s ease both;
      box-shadow: 0 3px 12px rgba(127, 168, 110, 0.25);
    }

    .quiz-option.wrong {
      border-color: #D4728A;
      background: rgba(212, 114, 138, 0.10);
      color: #A8526A;
      animation: shake .35s ease-in-out;
    }

    .quiz-option:disabled {
      cursor: not-allowed;
    }

    .quiz-result {
      text-align: center;
      padding: 1.5rem;
    }

    .quiz-score-big {
      font-size: 4.5rem;
      font-weight: 900;
      line-height: 1;
      font-family: 'Noto Serif JP', serif;
      background: linear-gradient(135deg, #D4728A, #8B7DB5, #3B4A6B);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
      animation: bounceIn .4s ease both;
      filter: drop-shadow(0 2px 8px rgba(212, 114, 138, 0.25));
    }

    /* ─── PROGRESS VIEW ──────────────────────────────────────── */
    .progress-section {
      background: rgba(255, 255, 255, 0.88);
      border: 1.5px solid rgba(212, 114, 138, 0.16);
      border-radius: var(--r-lg);
      padding: 1.5rem;
      box-shadow: var(--shadow);
      margin-bottom: 1rem;
    }

    .char-table {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
      gap: .5rem;
    }

    .char-cell {
      background: rgba(255, 255, 255, 0.75);
      border: 1.5px solid rgba(212, 114, 138, 0.14);
      border-radius: var(--r);
      padding: .6rem;
      text-align: center;
      transition: all .2s var(--ease);
    }

    .char-cell:hover {
      transform: scale(1.1);
      border-color: rgba(212, 114, 138, 0.55);
      box-shadow: 0 4px 14px rgba(212, 114, 138, 0.18);
    }

    .char-cell.learned {
      background: rgba(127, 168, 110, 0.10);
      border-color: rgba(127, 168, 110, 0.35);
    }

    .char-cell .cj {
      font-size: 1.5rem;
      display: block;
      font-family: 'Noto Sans JP', serif;
      color: var(--text);
    }

    .char-cell .cr {
      font-size: .68rem;
      color: var(--text-muted);
      font-weight: 600;
      font-family: 'Space Mono', monospace;
    }

    /* ─── MATCHING GAME ──────────────────────────────────────── */
    .match-layout {
      max-width: 640px;
      margin: 0 auto;
    }

    .match-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 1rem;
      margin: 1.5rem 0;
    }

    .match-col {
      display: flex;
      flex-direction: column;
      gap: .5rem;
    }

    .match-col-label {
      font-size: .65rem;
      text-transform: uppercase;
      letter-spacing: .1em;
      color: var(--sakura);
      font-weight: 700;
      margin-bottom: .2rem;
      text-align: center;
      font-family: 'Space Mono', monospace;
    }

    .match-btn {
      background: rgba(255, 255, 255, 0.80);
      backdrop-filter: blur(12px);
      border: 1.5px solid rgba(212, 114, 138, 0.22);
      border-radius: var(--r-lg);
      padding: .9rem .5rem;
      cursor: pointer;
      font-size: 1.65rem;
      text-align: center;
      transition: all .2s var(--ease);
      font-family: inherit;
      color: var(--text);
      position: relative;
      min-height: 56px;
    }

    .match-btn:hover:not(:disabled) {
      border-color: rgba(212, 114, 138, 0.58);
      background: rgba(255, 255, 255, 0.95);
      transform: scale(1.05);
      box-shadow: 0 4px 16px rgba(212, 114, 138, 0.20);
    }

    .match-btn.selected {
      border-color: #D4728A;
      background: rgba(212, 114, 138, 0.10);
      box-shadow: 0 4px 18px rgba(212, 114, 138, 0.28);
    }

    .match-btn.matched {
      border-color: #7FA86E;
      background: rgba(127, 168, 110, 0.10);
      color: #5A8044;
      cursor: default;
      animation: bounceIn .25s ease both;
      box-shadow: 0 3px 12px rgba(127, 168, 110, 0.3);
    }

    .match-btn.wrong {
      animation: shake .35s ease-in-out;
      border-color: #D4728A;
      background: rgba(212, 114, 138, 0.10);
    }

    .match-btn:disabled {
      opacity: 1;
    }

    .match-btn .match-sub {
      display: block;
      font-size: .68rem;
      color: var(--text-muted);
      margin-top: .2rem;
      font-family: 'Space Mono', monospace;
    }

    .match-btn.matched .match-sub {
      color: #5A8044;
    }

    .match-score {
      text-align: center;
      padding: 2rem;
    }

    .match-score-big {
      font-size: 3.5rem;
      font-weight: 800;
      color: #7FA86E;
      text-shadow: 0 2px 12px rgba(127, 168, 110, 0.35);
      font-family: 'Noto Serif JP', serif;
    }

    .match-progress {
      display: flex;
      gap: .4rem;
      justify-content: center;
      margin-bottom: 1.5rem;
    }

    .match-pip {
      width: 28px;
      height: 5px;
      border-radius: 3px;
      background: rgba(212, 114, 138, 0.12);
      transition: background .3s ease;
    }

    .match-pip.done {
      background: linear-gradient(90deg, #7FA86E, #5A8044);
      box-shadow: 0 2px 6px rgba(127, 168, 110, 0.30);
    }

    /* ─── BADGES ─────────────────────────────────────────────── */
    .badge {
      display: inline-flex;
      align-items: center;
      gap: .25rem;
      padding: .2rem .65rem;
      border-radius: var(--r);
      font-size: .66rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: .06em;
      font-family: 'Space Mono', monospace;
    }

    .badge-green {
      background: rgba(90, 143, 74, 0.10);
      color: #3D6B2E;
      border: 1px solid rgba(90, 143, 74, 0.35);
    }

    .badge-blue {
      background: rgba(59, 74, 107, 0.10);
      color: #3B4A6B;
      border: 1px solid rgba(59, 74, 107, 0.30);
    }


    /* ─── DECORATIVE BG CHARS — hidden ──────────────────────── */
    .deco-bg {
      display: none;
    }

    .deco-char {
      display: none;
    }

    /* ─── ACTIVITIES SECTION ────────────────────────────────── */
    .activities-section {
      position: relative;
      background: linear-gradient(135deg, rgba(155, 195, 135, 0.20) 0%, rgba(155, 195, 135, 0.07) 100%);
      border: none;
      border-radius: 24px;
      padding: 1.5rem 1.8rem;
      overflow: hidden;
      min-height: 130px;
      display: flex;
      align-items: center;
    }
    .activities-section::before {
      content: '';
      position: absolute;
      top: -30%;
      right: -5%;
      width: 50%;
      height: 160%;
      background: rgba(155, 195, 135, 0.13);
      border-radius: 50%;
      pointer-events: none;
    }
    .activities-section.activities-mixed {
      background: linear-gradient(135deg, rgba(110, 145, 200, 0.18) 0%, rgba(110, 145, 200, 0.06) 100%);
    }
    .activities-section.activities-mixed::before {
      background: rgba(110, 145, 200, 0.12);
    }

    /* ─── GLASS CARD (used in various views) ────────────────── */
    .glass-card {
      background: rgba(255, 255, 255, 0.78);
      border: 1.5px solid rgba(212, 114, 138, 0.18);
      border-radius: var(--r-lg);
      box-shadow: 0 3px 16px rgba(44, 24, 16, 0.08);
    }

    /* ─── RESPONSIVE ─────────────────────────────────────────── */

    /* Tablet */
    @media (max-width: 1024px) {
      main { padding: 1.5rem; }
      .demo-layout, .writing-layout { flex-wrap: wrap; }
      .demo-left, .writing-left { flex: 0 0 100%; }
      .demo-right, .writing-right { flex: 0 0 100%; }
    }

    @media (max-width: 768px) {
      .stats-row { flex-wrap: wrap; }
      .stat-card { min-width: 45%; }
      .lesson-grid { grid-template-columns: 1fr; }
      .badge-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
      .typing-input { width: 100%; max-width: 400px; }
    }

    @media (max-width: 640px) {
      header {
        padding: .55rem 1rem;
      }

      .logo-title {
        font-size: .88rem;
      }

      .logo-sub {
        display: none;
      }

      .nav-btn {
        padding: .32rem .68rem;
        font-size: .68rem;
      }

      main {
        padding: 1.25rem 1rem;
      }

      h1 {
        font-size: 1.6rem;
      }

      .flashcard-scene {
        height: 380px;
      }

      .fc-char {
        font-size: 7.5rem;
      }

      .demo-left,
      .writing-left {
        flex: 0 0 100%;
      }

      .demo-anim-box svg {
        width: 260px !important;
        height: 260px !important;
      }

      .canvas-wrap {
        width: 280px;
        height: 280px;
      }

      .stats-row {
        gap: .6rem;
      }

      .stat-card {
        padding: .9rem 1rem;
        min-width: 90px;
      }

      .stat-num {
        font-size: 1.9rem;
      }

      .quiz-prompt {
        font-size: 4.5rem;
      }
    }

    /* ─── TOAST NOTIFICATION ─────────────────────────────────── */
    .toast-notification {
      position: fixed; bottom: 2rem; right: 2rem; z-index: 9999;
      background: rgba(255, 250, 247, 0.97); backdrop-filter: var(--blur);
      border: 1.5px solid rgba(212, 114, 138, 0.30); border-radius: var(--r-lg);
      padding: 1rem 1.5rem; max-width: 340px;
      box-shadow: 0 8px 30px rgba(44, 24, 16, 0.14), 0 2px 8px rgba(212, 114, 138, 0.12);
      animation: toastIn .4s var(--ease) both;
      display: flex; align-items: center; gap: .75rem;
    }
    .toast-notification.toast-out { animation: toastOut .3s var(--ease) both; }
    .toast-icon { font-size: 2rem; flex-shrink: 0; }
    .toast-text { font-size: .85rem; font-weight: 700; color: #D4728A; font-family: 'Nunito', sans-serif; text-transform: none; letter-spacing: .01em; }
    .toast-sub { font-size: .75rem; color: var(--text-muted); font-weight: 400; text-transform: none; letter-spacing: 0; margin-top: .15rem; }
    @keyframes toastIn { from { opacity: 0; transform: translateX(40px) scale(.9); } to { opacity: 1; transform: translateX(0) scale(1); } }
    @keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(40px); } }

    /* ─── BADGE CARDS ──────────────────────────────────────────── */
    .badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .75rem; }
    .badge-card {
      background: rgba(255, 255, 255, 0.72); backdrop-filter: blur(12px);
      border: 1.5px solid rgba(212, 114, 138, 0.16); border-radius: var(--r-lg);
      padding: 1.1rem; text-align: center; transition: all .22s var(--ease);
      animation: cardStagger .4s var(--ease) both;
    }
    .badge-card.unlocked { border-color: rgba(196,150,58,0.45); background: rgba(255,248,235,0.82); }
    .badge-card.unlocked:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(196,150,58,0.18); }
    .badge-card.locked { opacity: .38; }
    .badge-card .badge-icon { font-size: 2rem; display: block; margin-bottom: .4rem; }
    .badge-card .badge-name { font-size: .72rem; font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: .05em; font-family: 'Space Mono', monospace; }
    .badge-card .badge-desc { font-size: .68rem; color: var(--text-muted); margin-top: .2rem; }
    .badge-card.unlocked .badge-name { color: #C4963A; }

    /* ─── SPEED ROUND TIMER BAR ────────────────────────────────── */
    .speed-timer-wrap {
      height: 6px; background: rgba(212,114,138,0.10); border-radius: 3px; margin-bottom: 1.5rem; overflow: hidden;
      border: 1px solid rgba(212,114,138,0.18);
    }
    .speed-timer-fill {
      height: 100%; border-radius: 3px; transition: none;
      background: linear-gradient(90deg, #7FA86E, #C4963A, #D4728A, #8B7DB5);
      box-shadow: 0 0 8px rgba(212,114,138,0.30);
    }

    /* ─── TYPING INPUT ─────────────────────────────────────────── */
    .typing-input {
      background: rgba(255, 255, 255, 0.90); border: 2px solid rgba(212, 114, 138, 0.30);
      color: var(--text); font-size: 2.8rem; font-weight: 700; text-align: center;
      padding: 1.2rem 2.5rem; border-radius: var(--r-lg); width: 400px; max-width: 80vw;
      font-family: 'Noto Serif JP', serif;
      transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
    }
    .typing-input:focus { border-color: #D4728A; box-shadow: 0 0 16px rgba(212,114,138,0.22); outline: 2px solid transparent; }
    .typing-input:focus-visible { outline: 2px solid #D4728A; outline-offset: 2px; }
    .typing-input.correct-flash { border-color: #7FA86E; box-shadow: 0 0 18px rgba(127,168,110,0.30); background: rgba(127,168,110,0.06); }
    .typing-input.wrong-flash { border-color: #D4728A; box-shadow: 0 0 18px rgba(212,114,138,0.35); background: rgba(212,114,138,0.06); animation: shake .35s ease-in-out; }

    /* ─── VISUAL DIFF CANVAS ───────────────────────────────────── */
    .diff-canvas-wrap {
      margin-top: .75rem; text-align: center;
    }
    .diff-canvas-wrap canvas {
      border: 1px solid var(--glass-border); border-radius: var(--r);
      box-shadow: var(--shadow-sm);
    }
    .diff-legend { display: flex; gap: 1rem; justify-content: center; margin-top: .5rem; font-size: .68rem; font-family: 'Space Mono', monospace; color: var(--text-muted); }
    .diff-legend span { display: flex; align-items: center; gap: .3rem; }
    .diff-legend .dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

    /* ─── CONFUSING PAIRS ──────────────────────────────────────── */
    .pair-display {
      display: flex; gap: 1.5rem; justify-content: center; align-items: center;
      margin: 1.5rem 0;
    }
    .pair-char {
      font-family: 'Noto Serif JP', serif; font-size: 5rem; text-align: center;
      color: var(--text); text-shadow: 0 0 20px rgba(255,0,128,0.2);
      animation: bounceIn .35s var(--ease) both;
    }
    .pair-char .pair-romaji { font-size: .85rem; font-family: 'Space Mono', monospace; color: var(--clr-indigo, #3B4A6B); margin-top: .3rem; }
    .pair-vs { font-size: 1.2rem; color: var(--text-dim); font-weight: 700; font-family: 'Noto Serif JP', serif; }

    /* ─── LISTENING QUIZ ───────────────────────────────────────── */
    .listening-prompt {
      text-align: center; margin: 1.5rem 0;
    }
    .listening-prompt .big-speaker {
      font-size: 5rem; cursor: pointer; display: inline-block;
      transition: transform .2s var(--ease);
      filter: drop-shadow(0 0 20px rgba(255,0,128,0.4));
      animation: bounceIn .4s var(--ease) both;
    }
    .listening-prompt .big-speaker:hover { transform: scale(1.15); }
    .listening-prompt .big-speaker.speaking { animation: pulseSpeaking .55s ease-in-out infinite alternate; }

    /* ─── STREAK FIRE ──────────────────────────────────────────── */
    .streak-fire { display: inline-flex; align-items: center; gap: .25rem; }

    @media (prefers-reduced-motion: reduce) {

      *,
      *::before,
      *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
      }
    }

    /* ─── FEATURE LOCKED (dashboard gating) ───────────────────── */
    .feature-locked {
      opacity: 0.45;
      filter: grayscale(0.6);
      cursor: not-allowed !important;
      position: relative;
    }
    .feature-locked:hover { opacity: 0.55; }
    .feat-lock-icon {
      font-size: .8em;
      margin-right: .2rem;
    }
    .feat-lock-badge {
      display: inline-block;
      margin-left: .5rem;
      font-size: .65rem;
      font-weight: 700;
      padding: .1rem .4rem;
      border-radius: 2rem;
      background: rgba(212, 114, 138, 0.10);
      color: rgba(212, 114, 138, 0.75);
      border: 1px solid rgba(212, 114, 138, 0.25);
      letter-spacing: .02em;
      vertical-align: middle;
    }
    .dash-activities {
      display: flex;
      gap: .65rem;
      flex-wrap: wrap;
      align-items: center;
      position: relative;
      z-index: 1;
    }
    .dash-act-btn { font-size: .9rem; }

    /* ─── STAT CARD ICON & BAR ───────────────────────────────── */
    .stat-icon {
      color: rgba(212, 114, 138, 0.75);
      margin-bottom: .55rem;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .stat-icon svg {
      width: 2rem;
      height: 2rem;
    }
    .stat-num { margin-top: .1rem; }
    .stat-bar {
      position: absolute;
      bottom: 0; left: 0; right: 0;
      height: 4px;
      background: rgba(212, 114, 138, 0.10);
      border-radius: 0;
      overflow: hidden;
    }
    .stat-bar-fill {
      height: 100%;
      background: linear-gradient(90deg, #D4728A, #8B7DB5);
      border-radius: 0;
      animation: progressFill .9s var(--ease) both;
      animation-delay: .3s;
    }

    /* ─── ROADMAP ──────────────────────────────────────────────── */
    .roadmap { display: flex; flex-direction: column; gap: 0; margin-bottom: 2rem; }

    .roadmap-chapter {
      background: rgba(255, 255, 255, 0.72);
      border: 1.5px solid rgba(212, 114, 138, 0.16);
      border-radius: 18px;
      padding: 1.2rem 1.4rem 1.4rem;
      transition: border-color .2s;
      box-shadow: 0 2px 12px rgba(44, 24, 16, 0.06);
    }
    .roadmap-chapter[data-state="active"] { border-color: rgba(59, 74, 107, 0.4); }
    .roadmap-chapter[data-state="done"] { border-color: rgba(127, 168, 110, 0.40); }
    .roadmap-chapter[data-state="available"] { border-color: rgba(212, 114, 138, 0.35); }

    .roadmap-chapter-header {
      display: flex;
      align-items: center;
      gap: .85rem;
      margin-bottom: 1rem;
    }
    .roadmap-chapter-badge {
      width: 2.2rem; height: 2.2rem;
      border-radius: 50%;
      display: flex; align-items: center; justify-content: center;
      font-size: .95rem; font-weight: 700;
      flex-shrink: 0;
      border: 2px solid rgba(212, 114, 138, 0.22);
      background: rgba(212, 114, 138, 0.06);
      color: var(--text-muted);
    }
    .roadmap-chapter-badge.done { border-color: #7FA86E; color: #5A8044; background: rgba(127,168,110,0.12); }
    .roadmap-chapter-badge.active { border-color: #3B4A6B; color: #3B4A6B; background: rgba(59,74,107,0.10); animation: glowPulse 2.5s ease-in-out infinite; }
    .roadmap-chapter-badge.available { border-color: #D4728A; color: #D4728A; background: rgba(212,114,138,0.08); }

    .roadmap-chapter-info { flex: 1; }
    .roadmap-chapter-name { font-weight: 700; font-size: .95rem; color: var(--text); }
    .roadmap-chapter-meta { font-size: .75rem; color: var(--text-muted); font-family: 'Space Mono', monospace; }

    .roadmap-chapter-tag {
      font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
      padding: .22rem .6rem; border-radius: 2rem;
    }
    .done-tag { background: rgba(127,168,110,0.14); color: #5A8044; border: 1.5px solid rgba(127,168,110,0.35); }
    .active-tag { background: rgba(59,74,107,0.10); color: #3B4A6B; border: 1.5px solid rgba(59,74,107,0.35); }

    .roadmap-cards-row {
      display: flex;
      gap: .65rem;
      flex-wrap: wrap;
    }
    .roadmap-card {
      position: relative;
      flex: 0 0 auto;
      width: 90px;
      background: rgba(255, 255, 255, 0.75);
      border: 1.5px solid rgba(212, 114, 138, 0.14);
      border-radius: 14px;
      padding: .75rem .5rem .6rem;
      text-align: center;
      transition: transform .15s, border-color .15s, background .15s, box-shadow .15s;
      cursor: pointer;
    }
    .roadmap-card.unlocked:hover { transform: translateY(-3px); border-color: var(--card-accent, #D4728A); background: rgba(255,255,255,0.95); box-shadow: 0 5px 16px rgba(212,114,138,0.18); }
    .roadmap-card.completed { border-color: rgba(127,168,110,0.42); background: rgba(127,168,110,0.07); }
    .roadmap-card.locked { opacity: 0.42; cursor: not-allowed; filter: grayscale(0.5); }
    .roadmap-card-day { font-size: .62rem; font-family: 'Space Mono', monospace; color: var(--text-muted); margin-bottom: .2rem; }
    .roadmap-card-emoji { font-size: 1.4rem; line-height: 1; margin-bottom: .25rem; }
    .roadmap-card-title { font-size: .7rem; font-weight: 700; color: var(--text); line-height: 1.2; }
    .roadmap-card-sub { font-size: .6rem; color: var(--text-muted); margin-top: .2rem; font-family: 'Space Mono', monospace; }
    .roadmap-card-check {
      position: absolute; top: -6px; right: -6px;
      width: 18px; height: 18px; border-radius: 50%;
      background: #7FA86E; color: #fff;
      font-size: .65rem; font-weight: 900;
      display: flex; align-items: center; justify-content: center;
      box-shadow: 0 2px 6px rgba(127,168,110,0.4);
    }
    .roadmap-card-lock {
      position: absolute; bottom: 4px; right: 4px;
      font-size: .65rem; opacity: .5;
    }

    .roadmap-connector {
      display: flex; flex-direction: column; align-items: center;
      gap: .15rem; padding: .4rem 0; color: var(--text-muted);
    }
    .roadmap-connector-line {
      width: 2px; height: 20px;
      background: linear-gradient(to bottom, rgba(212,114,138,0.3), rgba(212,114,138,0.08));
      border-radius: 2px;
    }
    .roadmap-connector-arrow { font-size: .7rem; opacity: .4; color: #D4728A; }

    @media (max-width: 520px) {
      .roadmap-card { width: 76px; }
      .roadmap-card-emoji { font-size: 1.2rem; }
    }

    /* ─── ONBOARDING OVERLAY ───────────────────────────────────── */
    #onboarding-overlay {
      position: fixed; inset: 0; z-index: 9000;
      background: rgba(253, 246, 240, 0.90);
      display: flex; align-items: center; justify-content: center;
      padding: 1rem;
      backdrop-filter: blur(6px);
      animation: obFadeIn .3s ease both;
    }
    #onboarding-overlay.ob-fade-out { animation: obFadeOut .35s ease forwards; }

    @keyframes obFadeIn { from { opacity: 0; } to { opacity: 1; } }
    @keyframes obFadeOut { from { opacity: 1; } to { opacity: 0; } }

    .ob-modal {
      background: linear-gradient(145deg, #FFF9F5, #FDF0EC);
      border: 1.5px solid rgba(212, 114, 138, 0.28);
      border-radius: 20px;
      padding: 2.5rem 2rem 2rem;
      max-width: 440px;
      width: 100%;
      box-shadow: 0 12px 48px rgba(44, 24, 16, 0.14), 0 4px 16px rgba(212, 114, 138, 0.12);
      position: relative;
    }

    .ob-slides { position: relative; min-height: 280px; }
    .ob-slide { display: none; animation: obSlideIn .25s ease both; }
    .ob-slide.ob-slide-active { display: block; }
    @keyframes obSlideIn { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

    .ob-icon {
      font-size: 3rem; text-align: center; margin-bottom: 1rem;
      font-family: 'Noto Serif JP', serif;
      color: #D4728A;
    }
    .ob-title {
      font-size: 1.5rem; font-weight: 900; text-align: center;
      color: var(--text); margin-bottom: .65rem; line-height: 1.25;
    }
    .ob-desc {
      text-align: center; color: var(--text-muted);
      font-size: .9rem; line-height: 1.65; margin-bottom: 1.2rem;
    }
    .ob-features-row {
      display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap;
    }
    .ob-feat {
      display: flex; flex-direction: column; align-items: center; gap: .3rem;
      background: rgba(212, 114, 138, 0.06); border: 1.5px solid rgba(212, 114, 138, 0.18);
      border-radius: 10px; padding: .75rem .9rem; font-size: .78rem;
      color: var(--text-muted); text-align: center; min-width: 80px;
    }
    .ob-feat span:first-child { font-size: 1.5rem; }

    .ob-steps { display: flex; flex-direction: column; gap: .55rem; }
    .ob-step {
      display: flex; align-items: flex-start; gap: .75rem;
      font-size: .88rem; color: var(--text-muted);
    }
    .ob-step-num {
      min-width: 1.5rem; height: 1.5rem; border-radius: 50%;
      background: rgba(212, 114, 138, 0.12); border: 1.5px solid rgba(212, 114, 138, 0.35);
      display: flex; align-items: center; justify-content: center;
      font-size: .72rem; font-weight: 700; color: #D4728A; flex-shrink: 0;
    }

    .ob-feature-grid {
      display: grid; grid-template-columns: repeat(2, 1fr); gap: .45rem;
      margin-bottom: .75rem;
    }
    .ob-feature-item {
      display: flex; align-items: center; gap: .5rem;
      background: rgba(255,255,255,0.65); border: 1.5px solid rgba(212,114,138,0.14);
      border-radius: 8px; padding: .45rem .65rem; font-size: .82rem;
      color: var(--text-muted);
    }
    .ob-feature-item span { font-size: 1.1rem; }
    .ob-locked-feat { opacity: .45; filter: grayscale(.5); }
    .ob-unlock-note {
      text-align: center; font-size: .75rem; color: var(--text-muted);
    }

    .ob-dots {
      display: flex; justify-content: center; gap: .5rem;
      margin: 1.2rem 0 1rem;
    }
    .ob-dot {
      width: 8px; height: 8px; border-radius: 50%; border: none;
      background: rgba(212, 114, 138, 0.22); cursor: pointer; padding: 0;
      transition: background .2s, transform .2s;
    }
    .ob-dot.ob-dot-active { background: #D4728A; transform: scale(1.3); }

    .ob-actions {
      display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    }
    .ob-btn-skip {
      background: none; border: none; color: var(--text-muted);
      font-size: .85rem; cursor: pointer; padding: .4rem .5rem;
      transition: color .2s;
    }
    .ob-btn-skip:hover { color: var(--text); }
    .ob-btn-next {
      background: #D4728A;
      border: none; color: #fff; font-weight: 800; font-size: .95rem;
      padding: .65rem 1.6rem; border-radius: 2rem; cursor: pointer;
      transition: opacity .2s, transform .15s, box-shadow .2s;
      box-shadow: 0 4px 16px rgba(212, 114, 138, 0.38);
    }
    .ob-btn-next:hover { opacity: .88; transform: translateY(-1px); box-shadow: 0 6px 22px rgba(212,114,138,0.50); }
    .ob-btn-final { background: #7FA86E; box-shadow: 0 4px 16px rgba(127,168,110,0.38); }

    /* ─── ONBOARDING DARK MODE ─────────────────────────────────── */
    html[data-theme="dark"] #onboarding-overlay {
      background: rgba(0, 0, 8, 0.92) !important;
    }
    html[data-theme="dark"] .ob-modal {
      background: linear-gradient(145deg, #0a0a1a, #0d0d22) !important;
      border-color: rgba(255, 0, 128, 0.3) !important;
      box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6), 0 0 30px rgba(255, 0, 128, 0.12) !important;
    }
    html[data-theme="dark"] .ob-icon { color: #ff0080 !important; }
    html[data-theme="dark"] .ob-title { color: #f0f0f0 !important; }
    html[data-theme="dark"] .ob-desc { color: #999 !important; }
    html[data-theme="dark"] .ob-feat {
      background: rgba(255, 0, 128, 0.08) !important;
      border-color: rgba(255, 0, 128, 0.25) !important;
      color: #ccc !important;
    }
    html[data-theme="dark"] .ob-step { color: #ccc !important; }
    html[data-theme="dark"] .ob-step-num {
      background: rgba(255, 0, 128, 0.15) !important;
      border-color: rgba(255, 0, 128, 0.4) !important;
      color: #ff0080 !important;
    }
    html[data-theme="dark"] .ob-feature-item {
      background: rgba(255, 255, 255, 0.05) !important;
      border-color: rgba(255, 0, 128, 0.2) !important;
      color: #ccc !important;
    }
    html[data-theme="dark"] .ob-unlock-note { color: #888 !important; }
    html[data-theme="dark"] .ob-dot { background: rgba(255, 0, 128, 0.25) !important; }
    html[data-theme="dark"] .ob-dot.ob-dot-active { background: #ff0080 !important; }
    html[data-theme="dark"] .ob-btn-skip { color: #888 !important; }
    html[data-theme="dark"] .ob-btn-skip:hover { color: #f0f0f0 !important; }
    html[data-theme="dark"] .ob-btn-next {
      background: #ff0080 !important;
      box-shadow: 0 4px 16px rgba(255, 0, 128, 0.4) !important;
    }
    html[data-theme="dark"] .ob-btn-final {
      background: #00f5ff !important;
      color: #000 !important;
      box-shadow: 0 4px 16px rgba(0, 245, 255, 0.35) !important;
    }

    /* ─── HELP VIEW ────────────────────────────────────────────── */
    .help-container { max-width: 820px; margin: 0 auto; padding-bottom: 4rem; }

    .help-hero {
      text-align: center; padding: 1.5rem 0 2.5rem;
      border-bottom: 1.5px solid rgba(212, 114, 138, 0.18); margin-bottom: 2.5rem;
    }
    .help-hero-icon { font-size: 3rem; margin-bottom: .75rem; display: block; }
    .help-hero-title {
      font-size: 2rem; font-weight: 900; color: #D4728A;
      margin-bottom: .4rem;
    }
    .help-hero-sub { color: var(--text-muted); font-size: .95rem; }

    .help-section-label {
      font-size: .7rem; font-weight: 700; letter-spacing: .15em; text-transform: uppercase;
      color: #D4728A; margin: 2rem 0 1rem;
      display: flex; align-items: center; gap: .6rem;
    }
    .help-section-label::after { content: ''; flex: 1; height: 1.5px; background: rgba(212, 114, 138, 0.22); }

    .help-path { display: flex; flex-direction: column; gap: 0; }
    .help-path-step { display: flex; align-items: flex-start; gap: 1rem; position: relative; }
    .help-path-step:not(:last-child)::after {
      content: ''; position: absolute; left: 1.1rem; top: 2.5rem; bottom: 0;
      width: 2px; background: rgba(212, 114, 138, 0.15);
    }
    .help-path-dot {
      width: 2.2rem; height: 2.2rem; border-radius: 50%;
      background: rgba(212, 114, 138, 0.08); border: 2px solid rgba(212, 114, 138, 0.30);
      display: flex; align-items: center; justify-content: center;
      font-size: 1rem; flex-shrink: 0; z-index: 1;
    }
    .help-path-content { padding: .2rem 0 1.4rem; }
    .help-path-title { font-weight: 700; font-size: .95rem; color: var(--text); margin-bottom: .25rem; }
    .help-path-desc { font-size: .85rem; color: var(--text-muted); line-height: 1.65; }

    .help-feature-grid {
      display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .9rem;
    }
    .help-feat-card {
      background: rgba(255, 255, 255, 0.78); border: 1.5px solid rgba(212, 114, 138, 0.14);
      border-radius: 14px; padding: 1.1rem 1.2rem;
      box-shadow: 0 2px 10px rgba(44, 24, 16, 0.06);
    }
    .help-feat-card p { font-size: .83rem; color: var(--text-muted); line-height: 1.6; margin-top: .5rem; }
    .help-feat-head { display: flex; align-items: center; gap: .5rem; }
    .help-feat-icon { font-size: 1.3rem; }
    .help-feat-title { font-weight: 700; font-size: .9rem; flex: 1; }
    .help-feat-badge {
      font-size: .65rem; font-weight: 700; padding: .15rem .45rem; border-radius: 2rem;
      letter-spacing: .04em; white-space: nowrap;
    }
    .help-feat-badge.free { background: rgba(127,168,110,0.12); color: #5A8044; border: 1.5px solid rgba(127,168,110,0.35); }
    .help-feat-badge.unlock { background: rgba(59,74,107,0.08); color: #3B4A6B; border: 1.5px solid rgba(59,74,107,0.28); }
    .help-feat-badge.unlock2 { background: rgba(212,114,138,0.10); color: #D4728A; border: 1.5px solid rgba(212,114,138,0.28); }
    .help-feat-badge.unlock3 { background: rgba(196,150,58,0.10); color: #C4963A; border: 1.5px solid rgba(196,150,58,0.30); }

    .help-tips { display: flex; flex-direction: column; gap: .6rem; }
    .help-tip {
      display: flex; align-items: flex-start; gap: .75rem;
      font-size: .88rem; color: var(--text-muted); line-height: 1.55;
      padding: .65rem .9rem;
      background: rgba(255, 255, 255, 0.70); border-radius: 10px;
      border: 1.5px solid rgba(212, 114, 138, 0.12);
    }
    .help-tip strong { color: var(--text); }
    .help-tip-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: .05rem; }

/* ─── AUTH GATE ─────────────────────────────────────────── */
#auth-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  opacity: 0;
  transition: opacity .4s var(--ease);
}
#auth-gate::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 30%, rgba(212, 114, 138, 0.15) 0%, transparent 55%),
    radial-gradient(ellipse 55% 65% at 80% 70%, rgba(59, 74, 107, 0.10) 0%, transparent 55%),
    radial-gradient(ellipse 70% 40% at 50% 100%, rgba(127, 168, 110, 0.08) 0%, transparent 55%);
  animation: sakuraBg 22s ease-in-out infinite alternate;
}
#auth-gate.active { opacity: 1; }

.auth-gate-inner {
  position: relative;
  max-width: 420px;
  width: 90%;
  padding: 2.5rem 2rem;
  background: rgba(255, 252, 248, 0.97);
  border: 1.5px solid rgba(212, 114, 138, 0.22);
  border-radius: var(--r-xl);
  box-shadow: 0 8px 40px rgba(44, 24, 16, 0.12), 0 4px 16px rgba(212, 114, 138, 0.10);
  animation: slideUp .5s var(--ease) both;
  animation-delay: .15s;
}

.auth-gate-logo {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  justify-content: center;
}

.auth-gate-ja {
  font-family: 'Noto Serif JP', serif;
  font-size: 3rem;
  color: #D4728A;
}

.auth-gate-title {
  font-family: 'Noto Serif JP', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: #2C1810;
}

.auth-gate-sub {
  font-size: .85rem;
  color: var(--text-muted);
  font-family: 'Nunito', sans-serif;
}

.auth-gate-desc {
  text-align: center;
  color: var(--text-muted);
  font-size: .88rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.auth-gate-buttons {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.auth-gate-email-form {
  display: flex;
  flex-direction: column;
}

/* ─── PROFILE VIEW ─────────────────────────────────────── */
.profile-container {
  max-width: 700px;
  margin: 0 auto;
  animation: fadeInUp .4s var(--ease) both;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-xl);
  backdrop-filter: var(--blur);
  margin-bottom: 2rem;
}

.profile-avatar {
  flex-shrink: 0;
}

.profile-avatar-img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid #D4728A;
  box-shadow: 0 2px 12px rgba(212, 114, 138, 0.25);
}

.profile-avatar-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #D4728A, #8B7DB5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 2px 12px rgba(212, 114, 138, 0.25);
}

.profile-name {
  font-family: 'Noto Serif JP', serif;
  font-size: 1.3rem;
  margin-bottom: .25rem;
}

.profile-email {
  color: var(--text-muted);
  font-size: .85rem;
  font-family: 'Nunito', sans-serif;
}

.profile-meta {
  display: flex;
  gap: .5rem;
  align-items: center;
  margin-top: .5rem;
  font-size: .75rem;
  color: var(--text-dim);
}

.profile-premium-badge {
  color: var(--gold);
  font-weight: 700;
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.profile-stat-card {
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  backdrop-filter: var(--blur);
}

.profile-stat-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
  font-size: 1rem;
}

.profile-stat-icon {
  font-family: 'Noto Serif JP', serif;
  font-size: 1.5rem;
  background: linear-gradient(135deg, #D4728A, #3B4A6B);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.profile-stat-row {
  display: flex;
  justify-content: space-between;
  padding: .35rem 0;
  font-size: .85rem;
  border-bottom: 1px solid rgba(212, 114, 138, 0.10);
}

.profile-stat-row span:first-child {
  color: var(--text-muted);
}

.profile-stat-row span:last-child {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  color: #D4728A;
}

.profile-progress-bar {
  height: 6px;
  background: rgba(212, 114, 138, 0.10);
  border-radius: 3px;
  margin-top: .75rem;
  overflow: hidden;
}

.profile-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #D4728A, #3B4A6B);
  border-radius: 3px;
  transition: width .6s var(--ease);
}

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  margin-bottom: 2rem;
}

.profile-action-btn {
  width: 100%;
  text-align: center;
}

.profile-danger-btn {
  background: transparent;
  border: 1px solid rgba(212, 114, 138, 0.35);
  color: #D4728A;
}
.profile-danger-btn:hover {
  background: rgba(212, 114, 138, 0.08);
  border-color: #D4728A;
}

.profile-premium-status {
  text-align: center;
  color: #C4963A;
  font-family: 'Nunito', sans-serif;
  font-size: .95rem;
  font-weight: 700;
  padding: .75rem;
  background: rgba(196, 150, 58, 0.08);
  border: 1.5px solid rgba(196, 150, 58, 0.30);
  border-radius: var(--r);
}

@media (max-width: 500px) {
  .profile-header { flex-direction: column; text-align: center; }
  .profile-meta { justify-content: center; flex-wrap: wrap; }
}

/* ─── FRIENDS & LEADERBOARD ──────────────────────────────── */
.friends-tabs {
  display: flex;
  gap: .25rem;
  margin-bottom: 1.5rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1.5px solid rgba(212, 114, 138, 0.18);
  border-radius: .75rem;
  padding: .25rem;
}
.friends-tab {
  flex: 1;
  padding: .6rem .5rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: 'Nunito', sans-serif;
  font-size: .82rem;
  cursor: pointer;
  border-radius: .5rem;
  transition: all .25s var(--ease);
}
.friends-tab.active {
  background: rgba(212, 114, 138, 0.12);
  color: #D4728A;
  font-weight: 700;
}
.friends-tab:hover:not(.active) {
  background: rgba(212, 114, 138, 0.06);
  color: var(--text);
}

.add-friend-box {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding: 1rem 1.2rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r);
  backdrop-filter: blur(12px);
}
.friend-code-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
}
.friend-code-value {
  font-family: 'Noto Serif JP', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: #3B4A6B;
  cursor: pointer;
  letter-spacing: .05em;
  padding: .3rem .8rem;
  background: rgba(59, 74, 107, 0.08);
  border-radius: .5rem;
  border: 1.5px solid rgba(59, 74, 107, 0.25);
  transition: all .2s var(--ease);
}
.friend-code-value:hover {
  background: rgba(59, 74, 107, 0.14);
  border-color: #3B4A6B;
}
.friend-code-input {
  display: flex;
  gap: .5rem;
  flex: 1;
  min-width: 200px;
}
.friend-code-input input {
  flex: 1;
  padding: .55rem .75rem;
  background: rgba(255, 255, 255, 0.90);
  border: 1.5px solid rgba(212, 114, 138, 0.25);
  border-radius: .5rem;
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  font-size: .95rem;
  transition: border-color .2s var(--ease);
}
.friend-code-input input:focus {
  border-color: #D4728A;
  outline: 2px solid transparent;
}
.friend-code-input input:focus-visible {
  outline: 2px solid #D4728A;
  outline-offset: 2px;
}
.friend-code-input input::placeholder {
  color: var(--text-muted);
  font-family: 'Nunito', sans-serif;
  font-size: .88rem;
}

.friends-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.friend-card {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r);
  backdrop-filter: blur(12px);
  transition: border-color .2s var(--ease);
  animation: fadeSlideIn .3s var(--ease) both;
}
.friend-card:hover {
  border-color: rgba(212, 114, 138, 0.38);
}
.friend-request {
  border-color: rgba(59, 74, 107, 0.28);
  background: rgba(59, 74, 107, 0.04);
}
.friend-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #D4728A, #3B4A6B);
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}
.friend-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.friend-info {
  flex: 1;
  min-width: 0;
}
.friend-name {
  font-weight: 600;
  font-size: .9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.friend-sub {
  font-size: .75rem;
  color: var(--text-muted);
  font-family: 'Space Mono', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.friend-actions {
  display: flex;
  gap: .4rem;
  flex-shrink: 0;
}

/* Leaderboard */
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.leaderboard-entry {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .7rem 1rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r);
  backdrop-filter: blur(12px);
  transition: all .2s var(--ease);
  animation: fadeSlideIn .3s var(--ease) both;
}
.leaderboard-me {
  border-color: rgba(212, 114, 138, 0.38);
  background: rgba(212, 114, 138, 0.06);
}
.leaderboard-rank {
  font-size: 1.2rem;
  font-weight: 900;
  min-width: 2rem;
  text-align: center;
  font-family: 'Nunito', sans-serif;
  color: var(--text-muted);
}
.leaderboard-score {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: #3B4A6B;
  text-align: center;
  min-width: 3rem;
}

/* Challenge Card */
.challenge-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r);
  backdrop-filter: blur(12px);
  position: relative;
}
.challenge-icon {
  font-size: 2.5rem;
  flex-shrink: 0;
}
.challenge-info {
  flex: 1;
}
.challenge-title {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: .25rem;
}
.challenge-desc {
  font-size: .82rem;
  color: var(--text-muted);
  margin-bottom: .65rem;
}
.challenge-progress {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.challenge-bar {
  flex: 1;
  height: 6px;
  background: rgba(212, 114, 138, 0.12);
  border-radius: 3px;
  overflow: hidden;
}
.challenge-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #D4728A, #3B4A6B);
  border-radius: 3px;
  transition: width .5s var(--ease);
}
.challenge-pct {
  font-family: 'Nunito', sans-serif;
  font-size: .8rem;
  color: var(--text-muted);
  min-width: 3rem;
  text-align: right;
}
.challenge-complete {
  font-size: 1.5rem;
  color: #5A8F4A;
  font-weight: 700;
}
.challenge-done {
  border-color: rgba(90, 143, 74, 0.30);
  background: rgba(90, 143, 74, 0.05);
}
.challenge-done .challenge-title::after {
  content: ' ✓';
  color: #5A8F4A;
}

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

/* ─── Guest Banner ──────────────────────────────────────────────── */
#guest-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  transform: translateY(-100%);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
}
#guest-banner.active {
  transform: translateY(0);
}
.guest-banner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem 1.2rem;
  background: rgba(255, 248, 242, 0.97);
  border-bottom: 1px solid rgba(212, 114, 138, 0.25);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.guest-banner-text {
  font-size: .85rem;
  color: var(--text);
  line-height: 1.4;
  font-family: 'Nunito', sans-serif;
}
.guest-banner-text strong {
  color: var(--sakura);
}
.guest-banner-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
}
.guest-banner-dismiss {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  padding: .2rem .4rem;
  line-height: 1;
  transition: color .2s;
}
.guest-banner-dismiss:hover {
  color: var(--text);
}

/* ─── Site Footer ───────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 2rem 1rem 1.5rem;
  margin-top: 3rem;
  border-top: 1px solid var(--red-glow-sm);
  color: var(--text-muted);
  font-size: .78rem;
  letter-spacing: .02em;
}
.site-footer a {
  color: var(--red);
  text-decoration: none;
  transition: color .2s;
}
.site-footer a:hover {
  color: var(--sakura);
}
.site-footer .footer-update-notice {
  color: var(--red);
  margin-bottom: .6rem;
  font-size: .82rem;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
}
.site-footer .footer-legal {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.25rem;
  justify-content: center;
}
.site-footer .footer-legal button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--red);
  font-size: .78rem;
  font-family: inherit;
  transition: color .2s;
}
.site-footer .footer-legal button:hover {
  color: var(--sakura);
}
.site-footer p {
  line-height: 1.8;
}

@media (max-width: 500px) {
  .add-friend-box { flex-direction: column; align-items: stretch; gap: 1rem; }
  .friend-code-display { flex-direction: row; gap: .5rem; flex-wrap: wrap; justify-content: center; }
  .friend-code-input { min-width: 0; }
  .friend-actions { flex-direction: column; }
  .leaderboard-entry { padding: .6rem .7rem; gap: .5rem; }
  .guest-banner-inner { flex-direction: column; text-align: center; gap: .6rem; }
  .guest-banner-text { font-size: .8rem; }
}

/* ─── Count Picker Modal ───────────────────────────────────────────── */
.count-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity .2s ease;
  backdrop-filter: blur(4px);
}
.count-picker-overlay.show { opacity: 1; }
.count-picker-modal {
  background: var(--card-bg, rgba(255,255,255,0.95));
  border: 1.5px solid var(--red-glow-sm);
  border-radius: 20px;
  padding: 1.8rem 2rem;
  text-align: center;
  min-width: 280px;
  max-width: 360px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
}
.count-picker-title {
  font-size: 1.3rem;
  font-weight: 800;
  font-family: 'Nunito', sans-serif;
  color: var(--text);
  margin-bottom: .3rem;
}
.count-picker-subtitle {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: .75rem;
  font-family: 'Space Mono', monospace;
}
.count-picker-options {
  display: flex;
  gap: .6rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.count-picker-btn {
  padding: .55rem 1.2rem;
  border-radius: 2rem;
  border: 1.5px solid var(--red);
  background: transparent;
  color: var(--red);
  font-size: .9rem;
  font-weight: 700;
  font-family: 'Nunito', sans-serif;
  cursor: pointer;
  transition: all .18s ease;
  min-width: 50px;
}
.count-picker-btn:hover {
  background: var(--red);
  color: #fff;
  box-shadow: 0 0 14px var(--red-glow);
  transform: translateY(-1px);
}
.count-picker-cancel {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: .8rem;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  padding: .3rem .8rem;
  transition: color .18s;
}
.count-picker-cancel:hover { color: var(--text); }

/* Dark mode overrides */
html[data-theme="dark"] .count-picker-modal {
  background: rgba(0, 0, 8, 0.92) !important;
  border-color: rgba(255, 0, 128, 0.35) !important;
  box-shadow: 0 0 30px rgba(255, 0, 128, 0.12), 0 8px 40px rgba(0, 0, 0, 0.6) !important;
}
html[data-theme="dark"] .count-picker-btn {
  border-color: #ff0080 !important;
  color: #ff0080 !important;
}
html[data-theme="dark"] .count-picker-btn:hover {
  background: #ff0080 !important;
  color: #fff !important;
  box-shadow: 0 0 18px rgba(255, 0, 128, 0.5) !important;
}
