@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800;900&family=Noto+Sans+SC:wght@300;400;500;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

    :root {
      --bg-base: #0B0D10;
      --bg-surface: #14171C;
      --bg-card: #181C24;
      --bg-hover: #202632;
      --border-subtle: rgba(255, 255, 255, 0.08);
      --border-focus: rgba(163, 255, 18, 0.5);
      
      --text-primary: #F5F7FA;
      --text-secondary: #8B93A1;
      --text-dim: #4B5565;
      
      --accent: #A3FF12;
      --accent-hover: #8ee600;
      --accent-glow: rgba(163, 255, 18, 0.25);
      --accent-soft: rgba(163, 255, 18, 0.12);
      
      --flame: #FF6B00;
      --flame-soft: rgba(255, 107, 0, 0.15);
      --cyan: #00F2FE;
      --cyan-soft: rgba(0, 242, 254, 0.12);
      
      --success: #34D399;
      --warning: #FBBF24;
      --danger: #F87171;
      
      --font-en: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
      --font-zh: 'Noto Sans SC', system-ui, sans-serif;
      --font-mono: 'JetBrains Mono', monospace;
    }

    [data-theme="light"] {
      --bg-base: #F7F8FA;
      --bg-surface: #FFFFFF;
      --bg-card: #FFFFFF;
      --bg-hover: #F1F3F7;
      --border-subtle: #E2E6EC;
      --border-focus: #059669;
      
      --text-primary: #0F172A;
      --text-secondary: #475569;
      --text-dim: #94A3B8;
      
      --accent: #059669;
      --accent-hover: #047857;
      --accent-glow: rgba(5, 150, 105, 0.2);
      --accent-soft: rgba(5, 150, 105, 0.1);
      
      --flame: #EA580C;
      --flame-soft: rgba(234, 88, 12, 0.12);
      --cyan: #0284C7;
      --cyan-soft: rgba(2, 132, 199, 0.12);
    }

    * { box-sizing: border-box; margin: 0; padding: 0; transition: background-color 0.2s ease, color 0.15s ease, opacity 0.2s ease, border-color 0.2s ease; }

    body {
      background-color: var(--bg-base);
      color: var(--text-primary);
      font-family: var(--font-en);
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      overflow-x: hidden;
      padding-bottom: 145px;
    }

    ::-webkit-scrollbar { width: 5px; height: 5px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 4px; }
    ::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

    /* Toast HUD */
    .hud-toast {
      position: fixed;
      top: 64px;
      left: 50%;
      transform: translateX(-50%) translateY(-20px);
      background: rgba(20, 23, 28, 0.95);
      border: 1px solid var(--border-subtle);
      box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
      backdrop-filter: blur(12px);
      color: var(--accent);
      padding: 6px 14px;
      border-radius: 20px;
      font-size: 0.8rem;
      font-weight: 700;
      font-family: var(--font-mono);
      opacity: 0;
      pointer-events: none;
      z-index: 2000;
      transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .hud-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

    /* Top Navbar */
    header {
      background: var(--bg-surface);
      border-bottom: 1px solid var(--border-subtle);
      padding: 10px 24px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      position: sticky;
      top: 0;
      z-index: 100;
      backdrop-filter: blur(16px);
      gap: 16px;
    }

    .brand-group { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
    .logo-badge {
      background: var(--accent);
      color: #000000;
      font-weight: 900;
      font-size: 0.85rem;
      padding: 3px 8px;
      border-radius: 6px;
      letter-spacing: -0.02em;
      text-decoration: none;
      display: inline-flex;
      align-items: center;
      gap: 4px;
    }
    .brand-title { font-size: 1.05rem; font-weight: 800; letter-spacing: -0.03em; color: var(--text-primary); text-decoration: none; }

    .course-scroll-container {
      flex: 1;
      overflow-x: auto;
      display: flex;
      align-items: center;
      scrollbar-width: none;
      padding: 2px 8px;
    }
    .course-scroll-container::-webkit-scrollbar { display: none; }

    .course-pills {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      background: rgba(255, 255, 255, 0.03);
      padding: 3px;
      border-radius: 10px;
      border: 1px solid var(--border-subtle);
      white-space: nowrap;
    }

    .course-pill {
      padding: 5px 12px;
      border-radius: 7px;
      font-size: 0.78rem;
      font-weight: 600;
      text-decoration: none;
      color: var(--text-secondary);
      background: transparent;
      display: inline-flex;
      align-items: center;
      gap: 4px;
      white-space: nowrap;
      flex-shrink: 0;
    }
    .course-pill:hover { color: var(--text-primary); background: var(--bg-hover); }
    .course-pill.active { background: var(--accent); color: #000000; font-weight: 700; box-shadow: 0 0 14px var(--accent-glow); }

    .nav-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
    .streak-badge {
      display: flex;
      align-items: center;
      gap: 5px;
      background: var(--flame-soft);
      color: var(--flame);
      border: 1px solid rgba(255, 107, 0, 0.25);
      padding: 4px 10px;
      border-radius: 16px;
      font-size: 0.76rem;
      font-weight: 700;
      font-family: var(--font-mono);
      white-space: nowrap;
    }

    .stat-timer-badge {
      display: flex;
      align-items: center;
      gap: 5px;
      background: var(--accent-soft);
      color: var(--accent);
      border: 1px solid var(--accent-glow);
      padding: 4px 10px;
      border-radius: 16px;
      font-size: 0.76rem;
      font-weight: 700;
      font-family: var(--font-mono);
      white-space: nowrap;
    }
    .stat-timer-badge.playing { animation: pulseGlow 2s infinite ease-in-out; }
    @keyframes pulseGlow { 0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); } 50% { box-shadow: 0 0 0 5px var(--accent-glow); } }

    .nav-icon-btn {
      background: var(--bg-surface);
      border: 1px solid var(--border-subtle);
      color: var(--text-secondary);
      padding: 5px 10px;
      border-radius: 8px;
      font-size: 0.8rem;
      font-weight: 600;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 5px;
      flex-shrink: 0;
      text-decoration: none;
    }
    .nav-icon-btn:hover { color: var(--text-primary); background: var(--bg-hover); border-color: var(--text-dim); }

    /* Content Stream */
    .content-wrapper {
      max-width: 860px;
      width: 100%;
      margin: 0 auto;
      padding: 30px 20px 40px;
      display: flex;
      flex-direction: column;
      gap: 24px;
    }

    .lesson-hero {
      text-align: center;
      padding: 10px 0 20px;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 8px;
      border-bottom: 1px solid var(--border-subtle);
    }
    .hero-speaker-tag {
      font-size: 0.8rem;
      font-weight: 700;
      color: var(--accent);
      text-transform: uppercase;
      letter-spacing: 0.12em;
      font-family: var(--font-mono);
    }
    .hero-title { font-size: 1.85rem; font-weight: 800; letter-spacing: -0.03em; color: var(--text-primary); line-height: 1.25; }
    .hero-subtitle { font-size: 0.95rem; color: var(--text-secondary); max-width: 600px; line-height: 1.5; }

    .cognitive-ladder-bar {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      background: rgba(255, 255, 255, 0.02);
      border: 1px solid var(--border-subtle);
      padding: 6px 12px;
      border-radius: 12px;
      width: fit-content;
      margin: 0 auto;
    }
    .ladder-btn {
      background: transparent;
      border: none;
      color: var(--text-secondary);
      padding: 6px 14px;
      border-radius: 8px;
      font-size: 0.8rem;
      font-weight: 700;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 5px;
    }
    .ladder-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
    .ladder-btn.active { background: var(--accent); color: #000000; box-shadow: 0 0 12px var(--accent-glow); }

    .transcript-stream { display: flex; flex-direction: column; gap: 20px; }

    .lyrics-row {
      cursor: pointer;
      position: relative;
      padding: 16px 20px;
      border-radius: 14px;
      opacity: 0.35;
      transform: scale(0.985);
      transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .lyrics-row:hover { opacity: 0.82; transform: scale(1); background: rgba(255, 255, 255, 0.02); }
    .lyrics-row.active {
      opacity: 1;
      transform: scale(1);
      background: var(--bg-card);
      border-left: 3.5px solid var(--accent);
      box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35), 0 0 1px 1px var(--border-subtle);
    }

    .row-meta-bar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 0.74rem;
      color: var(--text-dim);
      font-family: var(--font-mono);
    }

    .soundwave-anim { display: none; align-items: flex-end; gap: 2px; height: 12px; margin-left: 8px; }
    .lyrics-row.active.playing .soundwave-anim { display: inline-flex; }
    .soundwave-bar { width: 2.5px; background: var(--accent); border-radius: 1px; animation: waveBounce 0.8s infinite ease-in-out alternate; }
    .soundwave-bar:nth-child(1) { height: 4px; animation-delay: 0.1s; }
    .soundwave-bar:nth-child(2) { height: 10px; animation-delay: 0.3s; }
    .soundwave-bar:nth-child(3) { height: 7px; animation-delay: 0.2s; }
    .soundwave-bar:nth-child(4) { height: 12px; animation-delay: 0.4s; }
    @keyframes waveBounce { 0% { height: 3px; } 100% { height: 12px; } }

    .focus-badge { display: none; color: var(--accent); font-weight: 800; font-size: 0.72rem; margin-left: 6px; }
    .lyrics-row.active .focus-badge { display: inline-flex; align-items: center; gap: 4px; }

    /* Word-by-Word Karaoke Glowing Flow */
    .lyrics-en {
      font-size: 1.15rem;
      font-weight: 500;
      line-height: 1.65;
      color: var(--text-primary);
      letter-spacing: -0.01em;
      user-select: text;
    }
    .lyrics-row.active .lyrics-en { font-size: 1.35rem; font-weight: 700; color: #FFFFFF; line-height: 1.55; }

    .word-span {
      display: inline-block;
      cursor: pointer;
      border-radius: 4px;
      padding: 0 2px;
      transition: all 0.15s;
      position: relative;
    }
    .word-span:hover { background: var(--accent-soft); color: var(--accent); }
    .lyrics-row.active.playing .word-span.karaoke-active {
      color: var(--accent);
      text-shadow: 0 0 10px var(--accent-glow);
      transform: scale(1.05);
    }

    .lyrics-zh { font-size: 0.94rem; line-height: 1.55; color: var(--text-secondary); font-family: var(--font-zh); }
    .lyrics-row.active .lyrics-zh { font-size: 1.02rem; color: var(--text-secondary); }

    .tier-pure-listen .lyrics-en { filter: blur(8px); user-select: none; }
    .tier-pure-listen .lyrics-zh { display: none; }
    .tier-pure-listen .lyrics-row:hover .lyrics-en, .tier-pure-listen .lyrics-row.revealed .lyrics-en { filter: blur(0); user-select: text; }
    .tier-en-only .lyrics-zh { display: none; }
    .tier-bilingual .lyrics-en, .tier-bilingual .lyrics-zh { display: block; filter: blur(0); }

    /* Syntax Tree Decomposition */
    .syntax-box {
      display: none;
      padding: 8px 12px;
      background: rgba(251, 191, 36, 0.05);
      border: 1px dashed rgba(251, 191, 36, 0.3);
      border-radius: 8px;
      font-size: 0.8rem;
      color: var(--warning);
      line-height: 1.5;
    }
    .syntax-tag {
      background: rgba(251, 191, 36, 0.15);
      color: var(--warning);
      padding: 1px 6px;
      border-radius: 4px;
      font-weight: 700;
      margin-right: 6px;
    }

    .phonetic-insights-bar {
      display: none;
      padding: 8px 12px;
      background: rgba(0, 242, 254, 0.05);
      border: 1px dashed rgba(0, 242, 254, 0.3);
      border-radius: 8px;
      font-size: 0.8rem;
      color: var(--cyan);
      flex-direction: column;
      gap: 4px;
    }
    .lyrics-row.active .phonetic-insights-bar { display: flex; }

    .insight-tag {
      background: var(--cyan-soft);
      color: var(--cyan);
      padding: 1px 6px;
      border-radius: 4px;
      font-size: 0.72rem;
      font-weight: 700;
      margin-right: 6px;
    }

    .row-actions { display: flex; gap: 6px; align-items: center; opacity: 0.4; transition: opacity 0.2s; }
    .lyrics-row:hover .row-actions, .lyrics-row.active .row-actions { opacity: 1; }

    .action-btn-sm {
      background: transparent;
      border: 1px solid var(--border-subtle);
      color: var(--text-secondary);
      cursor: pointer;
      font-size: 0.78rem;
      width: 26px;
      height: 26px;
      border-radius: 6px;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .action-btn-sm:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--text-dim); }
    .action-btn-sm.fav-active { color: #E11D48; border-color: rgba(225, 29, 72, 0.4); background: rgba(225, 29, 72, 0.12); }

    .mastery-pill-select {
      font-size: 0.7rem;
      padding: 2px 6px;
      border-radius: 6px;
      border: 1px solid var(--border-subtle);
      background: var(--bg-base);
      color: var(--text-secondary);
      cursor: pointer;
      outline: none;
    }
    .mastery-pill-select[data-val="1"] { color: var(--danger); border-color: var(--danger); }
    .mastery-pill-select[data-val="2"] { color: var(--warning); border-color: var(--warning); }
    .mastery-pill-select[data-val="3"] { color: var(--success); border-color: var(--success); font-weight: 700; }

    .row-dictation-box {
      margin-top: 10px;
      padding: 12px;
      background: var(--bg-surface);
      border: 1px solid var(--border-subtle);
      border-radius: 10px;
      display: none;
      flex-direction: column;
      gap: 8px;
    }
    .dictation-input {
      width: 100%;
      background: var(--bg-base);
      border: 1px solid var(--border-subtle);
      border-radius: 8px;
      padding: 8px 12px;
      font-size: 0.95rem;
      font-family: var(--font-en);
      color: var(--text-primary);
      outline: none;
    }
    .dictation-input:focus { border-color: var(--accent); }

    .diff-result {
      padding: 10px 12px;
      background: var(--bg-base);
      border-radius: 8px;
      font-size: 0.92rem;
      line-height: 1.6;
      border: 1px solid var(--border-subtle);
    }
    .diff-token { display: inline-block; margin: 0 2px; padding: 1px 5px; border-radius: 4px; font-weight: 600; }
    .diff-correct { background: rgba(52, 211, 153, 0.15); color: var(--success); }
    .diff-wrong { background: rgba(248, 113, 113, 0.15); color: var(--danger); text-decoration: line-through; }
    .diff-missing { border: 1px dashed var(--warning); color: var(--warning); }

    .diagnosis-tag-row {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 6px;
      padding-top: 6px;
      border-top: 1px solid var(--border-subtle);
      font-size: 0.76rem;
    }
    .diag-pill { background: var(--flame-soft); color: var(--flame); padding: 2px 7px; border-radius: 4px; font-weight: 700; }

    /* Dual-Track Shadowing Box */
    .row-recorder-box {
      margin-top: 10px;
      padding: 12px;
      background: var(--bg-surface);
      border: 1px dashed var(--accent);
      border-radius: 10px;
      display: none;
      flex-direction: column;
      gap: 10px;
    }
    .dual-wave-container {
      display: flex;
      flex-direction: column;
      gap: 6px;
      background: var(--bg-base);
      padding: 8px 12px;
      border-radius: 8px;
      border: 1px solid var(--border-subtle);
    }

    /* FLOATING BOTTOM ISLAND PLAYER & DYNAMIC WAVEFORM CANVAS */
    .bottom-player-bar {
      position: fixed;
      bottom: 16px;
      left: 50%;
      transform: translateX(-50%);
      width: min(940px, calc(100% - 32px));
      background: rgba(20, 23, 28, 0.94);
      border: 1px solid var(--border-subtle);
      box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55), 0 0 1px 1px rgba(255, 255, 255, 0.06);
      backdrop-filter: blur(20px);
      border-radius: 16px;
      padding: 10px 18px;
      z-index: 500;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .waveform-canvas-container {
      width: 100%;
      height: 24px;
      cursor: pointer;
      position: relative;
    }
    #waveform-canvas {
      width: 100%;
      height: 100%;
      display: block;
    }
    .progress-tooltip {
      position: absolute;
      top: -26px;
      transform: translateX(-50%);
      background: #000;
      color: var(--accent);
      font-family: var(--font-mono);
      font-size: 0.72rem;
      font-weight: 700;
      padding: 2px 6px;
      border-radius: 4px;
      border: 1px solid var(--border-subtle);
      display: none;
      pointer-events: none;
    }

    .player-controls-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
    }

    .player-left-info { display: flex; align-items: center; gap: 10px; min-width: 180px; }
    .player-talk-speaker { font-size: 0.85rem; font-weight: 700; color: var(--text-primary); white-space: nowrap; }
    .player-time-text { font-size: 0.76rem; color: var(--text-dim); font-family: var(--font-mono); white-space: nowrap; }

    .player-center-btns { display: flex; align-items: center; gap: 8px; }
    .play-hero-btn {
      background: var(--accent);
      color: #000000;
      width: 42px;
      height: 42px;
      border-radius: 50%;
      border: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.1rem;
      font-weight: 800;
      box-shadow: 0 0 16px var(--accent-glow);
    }
    .play-hero-btn:hover { transform: scale(1.06); background: var(--accent-hover); }

    .player-sub-btn {
      background: transparent;
      border: 1px solid var(--border-subtle);
      color: var(--text-secondary);
      width: 32px;
      height: 32px;
      border-radius: 8px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.85rem;
    }
    .player-sub-btn:hover { color: var(--text-primary); background: var(--bg-hover); border-color: var(--text-dim); }

    .player-right-options { display: flex; align-items: center; gap: 6px; }
    .opt-select {
      background: var(--bg-card);
      border: 1px solid var(--border-subtle);
      color: var(--text-secondary);
      padding: 4px 8px;
      border-radius: 6px;
      font-size: 0.75rem;
      font-weight: 600;
      cursor: pointer;
      outline: none;
    }
    .opt-select:focus { border-color: var(--accent); }

    .mode-pill-group {
      display: inline-flex;
      background: var(--bg-card);
      border: 1px solid var(--border-subtle);
      padding: 2px;
      border-radius: 8px;
      gap: 2px;
    }
    .mode-pill {
      background: transparent;
      border: none;
      color: var(--text-secondary);
      padding: 4px 8px;
      font-size: 0.72rem;
      font-weight: 600;
      border-radius: 6px;
      cursor: pointer;
      white-space: nowrap;
    }
    .mode-pill.active { background: var(--accent); color: #000000; font-weight: 700; }

    .island-shadow-banner {
      display: none;
      background: var(--accent-soft);
      border: 1px solid var(--accent-glow);
      color: var(--accent);
      padding: 4px 10px;
      border-radius: 6px;
      font-size: 0.75rem;
      font-weight: 600;
      align-items: center;
      justify-content: space-between;
    }
    .island-shadow-banner.active { display: flex; }

    /* Quote Poster Modal */
    .quote-poster-modal {
      width: 500px;
      max-width: 90vw;
      background: var(--bg-surface);
      border-radius: 20px;
      padding: 22px;
      border: 1px solid var(--border-subtle);
      box-shadow: 0 25px 60px rgba(0,0,0,0.7);
      display: flex;
      flex-direction: column;
      gap: 14px;
    }

    .poster-preview-card {
      background: #0B0D10;
      border: 1px solid rgba(163, 255, 18, 0.3);
      box-shadow: inset 0 0 20px rgba(163, 255, 18, 0.05);
      border-radius: 16px;
      padding: 28px 24px;
      display: flex;
      flex-direction: column;
      gap: 14px;
    }
    .poster-brand-row { display: flex; justify-content: space-between; align-items: center; font-family: var(--font-mono); font-size: 0.75rem; color: var(--accent); font-weight: 800; }
    .poster-quote-en { font-size: 1.3rem; font-weight: 800; color: #FFFFFF; line-height: 1.5; letter-spacing: -0.02em; }
    .poster-quote-zh { font-size: 0.95rem; color: var(--text-secondary); font-family: var(--font-zh); line-height: 1.55; }
    .poster-footer-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.74rem; color: var(--text-dim); font-family: var(--font-mono); border-top: 1px solid var(--border-subtle); padding-top: 12px; }

    /* Word Popover Modal */
    .word-popover-overlay {
      position: fixed;
      top: 0; left: 0; right: 0; bottom: 0;
      background: rgba(0, 0, 0, 0.4);
      backdrop-filter: blur(4px);
      z-index: 1000;
      display: none;
      align-items: center;
      justify-content: center;
    }

    .word-popover {
      background: var(--bg-surface);
      border: 1px solid var(--border-subtle);
      box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6), 0 0 1px 1px rgba(255, 255, 255, 0.08);
      border-radius: 16px;
      width: 440px;
      max-width: 90vw;
      padding: 20px;
      display: flex;
      flex-direction: column;
      gap: 12px;
      animation: popIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    }
    @keyframes popIn { 0% { transform: scale(0.95); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

    .pop-header { display: flex; justify-content: space-between; align-items: flex-start; }
    .pop-title { font-size: 1.6rem; font-weight: 800; color: var(--accent); letter-spacing: -0.02em; }
    .pop-ipa-row { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
    .pop-ipa { font-family: var(--font-mono); font-size: 0.88rem; color: var(--text-secondary); }
    .pop-speak-btn {
      background: var(--accent-soft);
      color: var(--accent);
      border: none;
      border-radius: 6px;
      padding: 2px 7px;
      font-size: 0.74rem;
      font-weight: 700;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 3px;
    }
    .pop-speak-btn:hover { background: var(--accent); color: #000; }

    .pop-body { max-height: 200px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; font-size: 0.88rem; line-height: 1.5; }
    .pop-def-item { background: var(--bg-card); padding: 8px 10px; border-radius: 8px; border-left: 3px solid var(--accent); }
    .pop-pos { font-weight: 700; color: var(--accent); font-style: italic; margin-right: 5px; }

    .pop-footer { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border-subtle); padding-top: 10px; }
    .pop-btn-add { background: var(--accent); color: #000000; border: none; padding: 7px 14px; border-radius: 8px; font-size: 0.82rem; font-weight: 700; cursor: pointer; }
    .pop-btn-add:hover { background: var(--accent-hover); }

    /* Listening DNA Profile Modal */
    .dna-modal {
      width: 520px;
      max-width: 90vw;
      background: var(--bg-surface);
      border-radius: 16px;
      padding: 22px;
      border: 1px solid var(--border-subtle);
      box-shadow: 0 20px 45px rgba(0,0,0,0.6);
      display: flex;
      flex-direction: column;
      gap: 14px;
    }
    .dna-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
    .dna-card { background: var(--bg-card); border: 1px solid var(--border-subtle); padding: 12px; border-radius: 10px; display: flex; flex-direction: column; gap: 4px; }
    .dna-val { font-size: 1.4rem; font-weight: 800; font-family: var(--font-mono); color: var(--accent); }

    /* Slide-out Vocabulary Drawer */
    .vocab-drawer {
      position: fixed;
      top: 0;
      right: -420px;
      width: min(400px, 90vw);
      height: 100vh;
      background: var(--bg-surface);
      border-left: 1px solid var(--border-subtle);
      box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
      z-index: 800;
      transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
      display: flex;
      flex-direction: column;
    }
    .vocab-drawer.open { right: 0; }
    .drawer-header { padding: 16px 20px; border-bottom: 1px solid var(--border-subtle); display: flex; justify-content: space-between; align-items: center; }
    .drawer-title { font-size: 1.1rem; font-weight: 800; display: flex; align-items: center; gap: 6px; }
    .drawer-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }

    .vocab-chip { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; }
    .vocab-chip-word { font-size: 1rem; font-weight: 700; color: var(--accent); display: flex; justify-content: space-between; align-items: center; }
    .vocab-chip-meaning { font-size: 0.82rem; color: var(--text-secondary); background: var(--bg-base); padding: 5px 8px; border-radius: 6px; outline: none; border: 1px solid var(--border-subtle); }

    .drawer-footer { padding: 14px 18px; border-top: 1px solid var(--border-subtle); display: flex; flex-direction: column; gap: 8px; }
    .btn-fc-hero { background: var(--accent); color: #000000; border: none; padding: 10px; border-radius: 8px; font-size: 0.88rem; font-weight: 800; cursor: pointer; text-align: center; }

    /* 3D Flip Flashcard Modal */
    .flashcard-modal-overlay {
      position: fixed;
      top: 0; left: 0; right: 0; bottom: 0;
      background: rgba(0, 0, 0, 0.7);
      backdrop-filter: blur(8px);
      z-index: 1200;
      display: none;
      align-items: center;
      justify-content: center;
    }
    .flashcard-container { width: 480px; max-width: 90vw; display: flex; flex-direction: column; gap: 14px; perspective: 1000px; }
    .flashcard {
      background: var(--bg-surface);
      border: 1px solid var(--border-subtle);
      border-radius: 20px;
      min-height: 270px;
      padding: 26px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      text-align: center;
      cursor: pointer;
      box-shadow: 0 20px 50px rgba(0,0,0,0.6);
      transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .flashcard:hover { border-color: var(--accent); }
    .flashcard-word { font-size: 2.2rem; font-weight: 900; color: var(--accent); margin-bottom: 6px; }
    .flashcard-actions { display: flex; gap: 10px; }
    .flash-btn { flex: 1; padding: 10px; border-radius: 8px; font-weight: 800; font-size: 0.88rem; cursor: pointer; border: none; }
    .flash-forgot { background: rgba(248, 113, 113, 0.2); color: var(--danger); }
    .flash-hard { background: rgba(251, 191, 36, 0.2); color: var(--warning); }
    .flash-easy { background: rgba(52, 211, 153, 0.2); color: var(--success); }

    /* Shortcuts Modal */
    .shortcuts-modal {
      width: 480px;
      max-width: 90vw;
      background: var(--bg-surface);
      border-radius: 16px;
      padding: 20px;
      border: 1px solid var(--border-subtle);
      box-shadow: 0 20px 40px rgba(0,0,0,0.6);
    }
    .shortcuts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
    .shortcut-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; padding: 6px 9px; background: var(--bg-card); border-radius: 6px; }
    .key-badge { background: var(--bg-base); border: 1px solid var(--border-subtle); padding: 2px 6px; border-radius: 4px; font-family: var(--font-mono); font-size: 0.74rem; font-weight: 700; color: var(--accent); }

    @media print {
      body { background: #fff !important; color: #000 !important; padding-bottom: 0 !important; }
      header, .bottom-player-bar, .cognitive-ladder-bar, .row-actions, .phonetic-insights-bar { display: none !important; }
      .content-wrapper { max-width: 100% !important; padding: 0 !important; }
      .lyrics-row { opacity: 1 !important; filter: none !important; page-break-inside: avoid; border-bottom: 1px solid #ddd; }
      .lyrics-en { color: #000 !important; font-size: 1.1rem !important; }
      .lyrics-zh { color: #555 !important; display: block !important; }
    }

    @media (max-width: 860px) {
      .player-left-info { display: none; }
      .player-controls-row { justify-content: center; }
      .hero-title { font-size: 1.4rem; }
    }


/* ===== Immersive learn dock (shadowing + review CTAs) ===== */
.immersive-learn-dock {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 14px 10px;
  border-top: 1px solid var(--border-subtle);
  background: linear-gradient(180deg, rgba(20,23,28,0.4), rgba(11,13,16,0.92));
}
.dock-sent-meta {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dock-cta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.dock-cta {
  flex: 1 1 auto;
  min-width: 64px;
  min-height: 46px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.dock-cta span:first-child { font-size: 1rem; line-height: 1; }
.dock-cta:hover { border-color: var(--accent); transform: translateY(-1px); }
.dock-cta.dock-primary {
  flex: 1.4 1 auto;
  background: rgba(163,255,18,0.12);
  border-color: rgba(163,255,18,0.45);
  color: var(--accent);
  min-height: 52px;
  font-size: 0.8rem;
}
.dock-cta.dock-primary.recording {
  background: rgba(225,29,72,0.18);
  border-color: rgba(225,29,72,0.55);
  color: #fb7185;
  animation: dockPulse 1.1s ease-in-out infinite;
}
.dock-cta.dock-next {
  background: rgba(0,242,254,0.08);
  border-color: rgba(0,242,254,0.35);
  color: var(--cyan);
}
.dock-cta.active {
  border-color: rgba(225,29,72,0.5);
  color: #fb7185;
  background: rgba(225,29,72,0.12);
}
@keyframes dockPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(225,29,72,0.25); }
  50% { box-shadow: 0 0 0 6px rgba(225,29,72,0); }
}
.next-path-hint {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--text-dim);
}
.next-path-hint a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}
body.immersive-learn .lesson-hero .hero-subtitle { max-width: 52rem; }
body.immersive-learn header .nav-actions .nav-icon-btn#dna-profile-btn {
  opacity: 0.7;
}
@media (max-width: 720px) {
  body.immersive-learn header .nav-actions #dna-profile-btn,
  body.immersive-learn header .nav-actions #shortcuts-btn {
    display: none;
  }
  .dock-cta { min-width: 56px; padding: 8px 6px; }
  .immersive-learn-dock { padding: 8px 10px 12px; }
  .bottom-player-bar { padding-bottom: env(safe-area-inset-bottom, 0); }
}
.row-recorder-box .nav-icon-btn {
  min-height: 40px;
  padding: 8px 12px;
  font-weight: 700;
}
