/* =====================================================================
   Bayan Room — design system
   Calm, premium, focused. One surface at a time. Motion only with meaning.
   ===================================================================== */
/* Notes for Innovation identity: night black, warm paper ink and gold (default); a paper theme for daylight. */
:root {
  --bg: #000000; --bg-tint: #050505;
  --surface: #0b0b0e; --surface-2: #121216; --surface-3: #1b1b21;
  --line: rgba(232, 225, 213, .12); --line-strong: rgba(232, 225, 213, .24);
  --ink: #e8e1d5; --ink-2: #c9c2b5; --muted: #8f897e;
  --accent: #eabf4b; --accent-hover: #f3cf6c; --accent-ink: #111111; --accent-soft: rgba(234, 191, 75, .12); --accent-line: rgba(234, 191, 75, .38);
  --cta: #eabf4b; --cta-hover: #f3cf6c; --cta-ink: #111111;
  --gold: #eabf4b; --gold-soft: rgba(234, 191, 75, .12);
  --indigo: #797ef6; --indigo-soft: rgba(121, 126, 246, .14);
  --teal: #2dd4bf; --teal-soft: rgba(45, 212, 191, .12);
  --ok: #2dd4bf; --ok-soft: rgba(45, 212, 191, .12);
  --bad: #f2786d; --bad-soft: rgba(242, 120, 109, .13);
  --c0: #2dd4bf; --c1: #eabf4b; --c2: #797ef6; --c3: #e8e1d5;
  --board: #07070a; --board-dot: rgba(232, 225, 213, .05);
  --shadow-sm: none;
  --shadow: 0 0 0 1px rgba(232, 225, 213, .03), 0 24px 60px -36px rgba(0, 0, 0, .9);
  --shadow-lg: 0 30px 80px -30px rgba(0, 0, 0, .95);
  --r-sm: 6px; --r: 8px; --r-lg: 12px; --r-xl: 16px;
  /* Arabic and Latin each keep their own typefaces: they never share a font. */
  --font: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Noto Naskh Arabic', 'IBM Plex Sans Arabic', serif;
  --font-latin: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-latin-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: dark;
}
:root[data-theme='light'] {
  --bg: #f2ede3; --bg-tint: #ebe4d6;
  --surface: #fbf9f4; --surface-2: #f4efe5; --surface-3: #e7e0d1;
  --line: rgba(17, 17, 17, .12); --line-strong: rgba(17, 17, 17, .24);
  --ink: #171614; --ink-2: #3e3b36; --muted: #6f6a61;
  --accent: #7d6322; --accent-hover: #6a5418; --accent-ink: #ffffff; --accent-soft: rgba(157, 126, 47, .12); --accent-line: rgba(157, 126, 47, .4);
  --gold: #8a6d1f; --gold-soft: rgba(234, 191, 75, .2);
  --indigo: #4f54d6; --indigo-soft: rgba(121, 126, 246, .14);
  --teal: #0e8f7e; --teal-soft: rgba(45, 212, 191, .16);
  --ok: #0e8f7e; --ok-soft: rgba(45, 212, 191, .16);
  --bad: #c8463d; --bad-soft: rgba(200, 70, 61, .1);
  --c0: #0e8f7e; --c1: #8a6d1f; --c2: #4f54d6; --c3: #171614;
  --board: #fbf9f4; --board-dot: rgba(17, 17, 17, .06);
  --shadow-sm: 0 1px 2px rgba(60, 48, 20, .05);
  --shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 1px 2px rgba(60, 48, 20, .06), 0 22px 50px -32px rgba(60, 48, 20, .32);
  --shadow-lg: 0 30px 70px -30px rgba(60, 48, 20, .4);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.65; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); }
.muted { color: var(--muted); }
.latin, [lang='es'], [lang='es-ES'], [lang='en'] { font-family: var(--font-latin); }
.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.boot { flex: 1; display: grid; place-items: center; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ------------------------------------------------------------------ buttons */
.btn { --h: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--h); padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font-weight: 500; font-size: .94rem; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, transform .12s var(--ease), box-shadow .15s; box-shadow: var(--shadow-sm); }
.btn:hover { border-color: var(--line-strong); background: var(--surface-2); }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--ink); color: var(--bg); border-color: transparent; }
.btn-primary:hover { background: var(--ink); opacity: .88; }
.btn-accent { background: var(--cta); color: var(--cta-ink); border-color: transparent; font-weight: 600; }
.btn-accent:hover { background: var(--cta-hover); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-lg { --h: 52px; padding: 0 26px; font-size: 1rem; }
.btn-icon { width: var(--h); padding: 0; }
.btn-ghost.on { color: var(--accent); background: var(--accent-soft); }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; background: transparent; border: 0; color: var(--muted); cursor: pointer; border-radius: 8px; }
.icon-btn:hover { color: var(--ink); background: var(--surface-2); }
.ico { display: inline-flex; flex: none; }
.input, select.input { width: 100%; height: 46px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; transition: border-color .15s, box-shadow .15s; }
.input:focus, select.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
textarea.input { height: auto; padding: 12px 14px; line-height: 1.6; resize: vertical; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.kbd { font-family: var(--font-latin); font-size: .75rem; padding: 1px 6px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); }

.toast { position: fixed; inset-inline: 0; bottom: 28px; margin: 0 auto; width: max-content; max-width: calc(100% - 32px); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; box-shadow: var(--shadow-lg); z-index: 90; font-size: .92rem; animation: toast-in .35s var(--spring); }
.toast.bad { background: var(--bad); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); transition: .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.96); } }

/* ------------------------------------------------------------------ the teacher orb */
.orb { --s: 44px; position: relative; width: var(--s); height: var(--s); flex: none; }
.orb .core { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(120% 120% at 30% 25%, #fff3c9 0%, #eabf4b 34%, #9d7e2f 72%, #4a3a12 100%); box-shadow: inset 0 -6px 14px rgba(0, 0, 0, .22), 0 6px 22px -6px rgba(234, 191, 75, .45); transition: transform .4s var(--spring), filter .4s; }
.orb .core::after { content: ''; position: absolute; inset: 14% 22% 52% 26%; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 255, 255, .75), transparent); filter: blur(1px); }
.orb .halo { position: absolute; inset: -6px; border-radius: 50%; border: 1.5px solid var(--accent); opacity: 0; }
.orb[data-state='speaking'] .core { animation: orb-talk .42s ease-in-out infinite alternate; }
.orb[data-state='speaking'] .halo { animation: orb-halo 1.8s var(--ease) infinite; }
.orb[data-state='speaking'] .halo.h2 { animation-delay: .9s; }
.orb[data-state='thinking'] .core { animation: orb-think 2.2s ease-in-out infinite; background: radial-gradient(120% 120% at 30% 25%, #e4e5ff 0%, #797ef6 38%, #3d41a8 78%, #1e2060 100%); box-shadow: inset 0 -6px 14px rgba(0, 0, 0, .22), 0 6px 22px -6px rgba(121, 126, 246, .5); }
.orb[data-state='listening'] .core { background: radial-gradient(120% 120% at 30% 25%, #ffe1dc 0%, #f08a7f 34%, #c8463d 72%, #8a2a23 100%); box-shadow: inset 0 -6px 14px rgba(0, 0, 0, .18), 0 6px 20px -6px rgba(200, 70, 61, .55); }
.orb[data-state='listening'] .halo { border-color: var(--bad); animation: orb-halo 1.3s var(--ease) infinite; }
.orb[data-state='live'] .halo { animation: orb-halo 2.6s var(--ease) infinite; }
@keyframes orb-talk { from { transform: scale(.94); } to { transform: scale(1.06); } }
@keyframes orb-halo { 0% { transform: scale(.85); opacity: .55; } 100% { transform: scale(1.55); opacity: 0; } }
@keyframes orb-think { 0%, 100% { transform: scale(.96) rotate(0); } 50% { transform: scale(1.02) rotate(14deg); } }

/* ------------------------------------------------------------------ welcome */
.welcome { position: relative; flex: 1; display: grid; place-items: center; padding: 40px 16px; overflow: hidden; }
.welcome::before { content: ''; position: absolute; inset: -20% -10% auto; height: 70%; background: radial-gradient(50% 60% at 50% 40%, var(--accent-soft), transparent 70%); pointer-events: none; }
.hero { position: relative; width: 100%; max-width: 560px; text-align: center; display: grid; justify-items: center; gap: 18px; }
.hero .orb { --s: 104px; margin-bottom: 10px; }
.hero .orb .core { animation: orb-breathe 5s ease-in-out infinite; }
.hero .orb .halo { animation: orb-halo 3.2s var(--ease) infinite; }
.hero .orb .halo.h2 { animation-delay: 1.6s; }
@keyframes orb-breathe { 50% { transform: scale(1.05); } }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--ink-2); padding: 4px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.eyebrow::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.hero h1 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: clamp(2rem, 5.4vw, 3.2rem); line-height: 1.2; letter-spacing: -.01em; }
.hero .lead { margin: 0; color: var(--ink-2); font-size: 1.12rem; max-width: 30em; }
.hero-actions { display: grid; gap: 10px; width: 100%; max-width: 380px; margin-top: 8px; }
.hero-actions .btn { width: 100%; }
.guest-row { display: flex; gap: 8px; }
.guest-row .input { height: 52px; border-radius: 999px; padding: 0 20px; }
.guest-row .btn { width: auto; flex: none; }
.features { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.feature { display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--ink-2); padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.feature .ico { color: var(--accent); }
.lang-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface-2); margin-top: 14px; }
.lang-switch button { background: none; border: 0; border-radius: 999px; padding: 4px 14px; color: var(--muted); cursor: pointer; font-size: .85rem; }
.lang-switch button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* setup */
.setup { width: 100%; max-width: 640px; display: grid; gap: 22px; position: relative; }
.setup h1 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 2rem; }
.setup .lead { margin: 0; color: var(--ink-2); }
.profile-form { display: grid; gap: 18px; }
.field { display: grid; gap: 8px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field > legend { font-size: .88rem; font-weight: 500; color: var(--ink-2); padding: 0; }
.stage-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stage-opt { position: relative; }
.stage-opt input { position: absolute; opacity: 0; inset: 0; }
.stage-opt span { display: grid; gap: 2px; height: 100%; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s, background .15s; font-weight: 500; font-size: .94rem; }
.stage-opt span small { color: var(--muted); font-weight: 400; font-size: .78rem; }
.stage-opt span:hover { border-color: var(--line-strong); }
.stage-opt input:checked + span { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
.stage-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ------------------------------------------------------------------ app header */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 20px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.topbar.scrolled { border-bottom-color: var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; background: none; border: 0; cursor: pointer; padding: 6px 4px; color: var(--ink); }
.brand .orb { --s: 24px; }
.topbar-mid { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; }
.topbar-end { display: flex; align-items: center; gap: 4px; }
.avatar-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); display: grid; place-items: center; font-weight: 600; font-size: .85rem; cursor: pointer; color: var(--ink-2); }

/* ------------------------------------------------------------------ home */
.home { width: 100%; max-width: 1120px; margin: 0 auto; padding: 28px 20px 64px; display: grid; gap: 36px; }
.greet h1 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: clamp(1.7rem, 3.6vw, 2.4rem); letter-spacing: -.01em; }
.greet p { margin: 4px 0 0; color: var(--ink-2); }
.continue { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; padding: 28px; border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; }
.continue::after { content: ''; position: absolute; inset-inline-end: -80px; top: -80px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(closest-side, var(--accent-soft), transparent); pointer-events: none; }
.continue small { color: var(--accent); font-weight: 600; font-size: .8rem; letter-spacing: .02em; }
.continue h2 { margin: 6px 0 4px; font-family: var(--font-display); font-weight: 600; font-size: 1.45rem; line-height: 1.4; }
.continue p { margin: 0; color: var(--ink-2); }
.continue .meter { margin-top: 16px; max-width: 420px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.course-card { display: flex; flex-direction: column; text-align: start; padding: 0; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); overflow: hidden; cursor: pointer; transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .2s; }
.course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--line-strong); }
.cover { position: relative; height: 128px; display: grid; place-items: center; overflow: hidden; }
.cover .glyph { font-family: var(--font-display); font-size: 3.4rem; font-weight: 600; color: rgba(255, 255, 255, .92); letter-spacing: -.02em; text-shadow: 0 6px 24px rgba(0, 0, 0, .18); }
.cover::after { content: ''; position: absolute; inset: 0; background: radial-gradient(60% 80% at 80% 0%, rgba(255, 255, 255, .25), transparent 60%), radial-gradient(1px 1px at 20% 30%, rgba(255, 255, 255, .5), transparent), radial-gradient(1px 1px at 70% 70%, rgba(255, 255, 255, .4), transparent); }
.cover .tag { position: absolute; top: 12px; inset-inline-start: 12px; font-size: .74rem; font-weight: 600; color: #fff; background: rgba(0, 0, 0, .22); backdrop-filter: blur(6px); padding: 3px 10px; border-radius: 999px; }
.cc-body { padding: 16px 18px 18px; display: grid; gap: 8px; flex: 1; }
.cc-body h3 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 1.08rem; line-height: 1.45; }
.cc-body p { margin: 0; font-size: .9rem; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cc-meta { display: flex; justify-content: space-between; align-items: center; font-size: .82rem; color: var(--muted); margin-top: auto; padding-top: 6px; }
.meter { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .8s var(--ease); }
.empty { padding: 48px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--r-lg); }

/* sheet & modal */
.scrim { position: fixed; inset: 0; background: rgba(10, 11, 12, .32); backdrop-filter: blur(2px); z-index: 60; animation: fade-in .2s; }
@keyframes fade-in { from { opacity: 0; } }
.sheet { position: fixed; top: 8px; bottom: 8px; inset-inline-end: 8px; width: min(380px, calc(100vw - 16px)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); z-index: 61; display: flex; flex-direction: column; animation: sheet-in .32s var(--ease); }
[dir='rtl'] .sheet { animation-name: sheet-in-rtl; }
@keyframes sheet-in { from { transform: translateX(24px); opacity: 0; } }
@keyframes sheet-in-rtl { from { transform: translateX(-24px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 8px; }
.sheet-head h3 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; }
.sheet-body { padding: 8px 18px 20px; overflow-y: auto; display: grid; gap: 22px; align-content: start; }
.modal { position: fixed; inset: 0; z-index: 61; display: grid; place-items: center; padding: 16px; pointer-events: none; }
.modal-card { pointer-events: auto; width: min(620px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 24px; animation: pop .3s var(--spring); }
.modal-card h3 { margin: 0 0 16px; font-family: var(--font-display); font-weight: 600; }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px); } }

/* ------------------------------------------------------------------ room */
.room-top { gap: 10px; }
.room-title { min-width: 0; display: grid; line-height: 1.3; }
.room-title b { font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-title span { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.steps { display: flex; gap: 4px; flex: 1; max-width: 360px; margin-inline: auto; }
.steps i { flex: 1; height: 5px; border-radius: 999px; background: var(--surface-3); position: relative; overflow: hidden; }
.steps i.done { background: var(--accent); }
.steps i.now { background: var(--accent-line); }
.steps i.now::after { content: ''; position: absolute; inset: 0; background: var(--accent); transform-origin: right; animation: step-fill 1.6s var(--ease) infinite alternate; }
[dir='ltr'] .steps i.now::after { transform-origin: left; }
@keyframes step-fill { from { transform: scaleX(.15); } to { transform: scaleX(.6); } }

.room { flex: 1; width: 100%; max-width: 1000px; margin: 0 auto; padding: 12px 20px 0; display: flex; flex-direction: column; gap: 16px; }
.teacher { display: flex; align-items: flex-start; gap: 14px; padding: 4px 2px; }
.teacher-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.teacher-label { display: flex; align-items: center; gap: 8px; font-size: .78rem; color: var(--muted); font-weight: 500; letter-spacing: .01em; }
.teacher-label .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.teacher-label[data-state='speaking'] .dot { background: var(--accent); animation: blink 1s infinite; }
.teacher-label[data-state='thinking'] .dot { background: var(--gold); animation: blink .8s infinite; }
.teacher-label[data-state='listening'] .dot { background: var(--bad); animation: blink .6s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.caption { margin: 0; font-size: 1.24rem; line-height: 1.85; font-weight: 450; min-height: 2.2em; text-wrap: pretty; }
.caption .w { color: var(--muted); transition: color .18s; opacity: .55; }
.caption .w.said { color: var(--ink); opacity: 1; }
.shimmer { display: inline-block; color: transparent; background: linear-gradient(90deg, var(--muted) 0%, var(--ink) 40%, var(--muted) 80%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.board { position: relative; background: var(--board); background-image: radial-gradient(var(--board-dot) 1px, transparent 1.2px); background-size: 22px 22px; border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow); padding: 22px 26px 28px; display: flex; flex-direction: column; gap: 14px; min-height: 340px; transition: box-shadow .4s var(--ease), border-color .4s; }
.board[data-v='correct'] { border-color: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft), var(--shadow); }
.board[data-v='partial'] { border-color: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft), var(--shadow); }
.board[data-v='incorrect'] { border-color: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft), var(--shadow); }
.board-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.board-title { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 1.5rem; line-height: 1.4; letter-spacing: -.005em; text-wrap: balance; }
.board-meta { display: flex; gap: 6px; flex: none; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; font-size: .76rem; font-weight: 600; padding: 0 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.pill:empty { display: none; }
.pill[data-phase='practice'] { background: var(--gold-soft); color: var(--gold); border-color: transparent; }
.pill[data-phase='transfer'] { background: color-mix(in srgb, var(--c2) 14%, transparent); color: var(--c2); border-color: transparent; }
.pill[data-phase='teach'], .pill[data-phase='warmup'] { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.verdict { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; animation: pop .35s var(--spring); }
.verdict[data-v='correct'] { background: var(--ok-soft); color: var(--ok); }
.verdict[data-v='partial'] { background: var(--gold-soft); color: var(--gold); }
.verdict[data-v='incorrect'] { background: var(--bad-soft); color: var(--bad); }
.board-points { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.board-points li { display: flex; gap: 10px; color: var(--ink-2); }
.board-points li::before { content: ''; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-top: .7em; }
.board-points:empty, .board-note:empty, .board-body:empty { display: none; }
.board-body { margin: 0; color: var(--ink-2); }
.board-note { margin: 0; display: inline-flex; align-self: flex-start; gap: 8px; align-items: center; font-size: .9rem; color: var(--gold); background: var(--gold-soft); padding: 4px 12px; border-radius: 999px; animation: pop .3s var(--spring); }
.board-canvas { flex: 1; display: flex; flex-direction: column; justify-content: center; padding-top: 4px; }

/* composer */
.dock { position: sticky; bottom: 0; z-index: 20; padding: 14px 0 18px; background: linear-gradient(to top, var(--bg) 70%, transparent); display: grid; gap: 10px; }
.prompt { margin: 0; display: flex; gap: 10px; align-items: flex-start; font-weight: 600; font-size: 1.04rem; line-height: 1.6; }
.prompt .ico { color: var(--accent); margin-top: .25em; }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 8px; border-radius: 26px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow); }
.composer textarea { flex: 1; min-width: 0; border: 0; background: transparent; resize: none; padding: 9px 10px; min-height: 42px; max-height: 160px; line-height: 1.6; font-size: 1rem; }
.composer textarea:focus { outline: none; }
.composer .btn { --h: 42px; }
.mic { position: relative; }
.mic.recording { background: var(--bad); color: #fff; border-color: transparent; }
.mic.recording::before { content: ''; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--bad); animation: orb-halo 1.2s var(--ease) infinite; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: .84rem; cursor: pointer; transition: all .15s; }
.chip-btn:hover { color: var(--ink); border-color: var(--line-strong); background: var(--surface-2); }
.chip-btn .ico svg { width: 15px; height: 15px; }
.local-note { margin: 0; text-align: center; font-size: .76rem; color: var(--muted); }
.next-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.next-card b { font-family: var(--font-display); font-weight: 600; }
.next-card small { display: block; color: var(--muted); }
.live-bar { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 500; }
[dir='rtl'] .live-bar { padding: 10px 16px 10px 10px; }
.live-bar > span:nth-child(2) { flex: 1; }
.wave { display: inline-flex; align-items: center; gap: 3px; height: 18px; }
.wave i { width: 3px; border-radius: 3px; background: currentColor; animation: wave 1s ease-in-out infinite; }
.wave i:nth-child(2) { animation-delay: .15s; } .wave i:nth-child(3) { animation-delay: .3s; } .wave i:nth-child(4) { animation-delay: .45s; }
@keyframes wave { 0%, 100% { height: 4px; } 50% { height: 18px; } }

.start-overlay { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(10px); animation: fade-in .3s; }
.start-card { display: grid; justify-items: center; gap: 14px; text-align: center; padding: 32px; }
.start-card .orb { --s: 84px; }
.start-card .orb .halo { animation: orb-halo 2.4s var(--ease) infinite; }
.start-card h2 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 1.5rem; max-width: 22em; }
.start-card p { margin: 0; color: var(--ink-2); }

/* outline sheet contents */
.ring-row { display: flex; align-items: center; gap: 16px; padding: 14px; border-radius: var(--r); background: var(--surface-2); }
.ring { width: 64px; height: 64px; flex: none; }
.ring circle { fill: none; stroke-width: 6; }
.ring .track { stroke: var(--surface-3); }
.ring .val { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1s var(--ease); }
.ring text { font-family: var(--font-latin); font-size: 15px; font-weight: 600; fill: var(--ink); }
.ring-row b { display: block; font-weight: 600; }
.ring-row small { color: var(--muted); }
.plan-steps { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; counter-reset: s; }
.plan-steps li { counter-increment: s; display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; color: var(--ink-2); padding: 6px 0; }
.plan-steps li::before { content: counter(s); flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .72rem; font-weight: 600; background: var(--surface-2); color: var(--muted); font-family: var(--font-latin); }
.plan-steps li.past { color: var(--muted); }
.plan-steps li.past::before { content: '✓'; background: var(--accent-soft); color: var(--accent); }
.plan-steps li.now { color: var(--ink); font-weight: 600; }
.plan-steps li.now::before { background: var(--accent); color: var(--accent-ink); }
.sheet h4 { margin: 0 0 8px; font-size: .78rem; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.ol-unit ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.ol-lesson { width: 100%; display: flex; align-items: center; gap: 12px; text-align: start; padding: 10px 10px; border-radius: 12px; background: none; border: 0; cursor: pointer; font-size: .92rem; color: var(--ink); }
.ol-lesson:hover { background: var(--surface-2); }
.ol-lesson.current { background: var(--accent-soft); }
.ol-dot { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; }
.st-learning .ol-dot { border-color: var(--gold); }
.st-mastered .ol-dot { background: var(--ok); border-color: var(--ok); }
.st-mastered .ol-dot::after { content: '✓'; color: #fff; font-size: .62rem; font-weight: 700; }
.st-review .ol-dot { border-color: var(--bad); }
.ol-title { flex: 1; line-height: 1.45; }
.ol-status { font-size: .74rem; color: var(--muted); }
.transcript { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: .88rem; }
.transcript li { padding: 8px 12px; border-radius: 14px; background: var(--surface-2); max-width: 92%; justify-self: start; }
.transcript .tx-learner { background: var(--accent-soft); justify-self: end; }

/* ------------------------------------------------------------------ board visuals */
.viz { display: grid; gap: 16px; animation: viz-in .5s var(--ease) both; }
@keyframes viz-in { from { opacity: 0; transform: translateY(10px); } }
.viz-hint { margin: 0; color: var(--muted); font-size: .88rem; }
.viz [data-step] { transition: opacity .5s var(--ease), transform .5s var(--ease), filter .3s, box-shadow .3s, background .3s; }
.viz .pending { opacity: 0; transform: translateY(8px) scale(.98); }
.viz .hl { box-shadow: 0 0 0 2px var(--gold), 0 8px 24px -6px color-mix(in srgb, var(--gold) 50%, transparent); border-radius: 12px; }
.viz .pulse { animation: pulse-el .9s var(--spring) 2; }
@keyframes pulse-el { 50% { transform: scale(1.05); } }
.viz .dim { opacity: .28; filter: grayscale(.5); }
.viz .ok { animation: good .7s var(--ease); } .viz .bad { animation: shake .45s; }
@keyframes good { 40% { box-shadow: 0 0 0 4px var(--ok-soft), 0 0 0 1px var(--ok); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.viz-check { justify-self: start; --h: 42px; background: var(--ink); color: var(--bg); border-color: transparent; }
.viz-check:hover { background: var(--ink); opacity: .88; }

.concept-label { font-family: var(--font-display); font-size: 1.9rem; font-weight: 600; text-align: center; line-height: 1.35; padding: 8px 0; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.chip { padding: 10px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); font-weight: 500; }
.cmp { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: stretch; }
.cmp-col { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.cmp-col::before { content: ''; position: absolute; inset: 0 0 auto; height: 4px; background: var(--c0); }
.cmp-b::before { background: var(--c1); }
.cmp-col h4 { margin: 4px 0 8px; font-family: var(--font-display); font-weight: 600; }
.cmp-col ul { margin: 0; padding-inline-start: 1.1em; color: var(--ink-2); display: grid; gap: 4px; }
.cmp-vs { align-self: center; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-size: .9rem; }
.seq { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; position: relative; }
.seq-step { display: flex; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); padding: 12px 16px; border-radius: 14px; }
.seq-n { flex: none; width: 30px; height: 30px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: .88rem; font-family: var(--font-latin); }
.flow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; }
.flow-node { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); padding: 14px 18px; border-radius: 16px; max-width: 220px; text-align: center; font-weight: 500; }
.flow-arrow { color: var(--accent); font-size: 1.3rem; }
[dir='rtl'] .flow-arrow { transform: scaleX(-1); }
.flow-loop { text-align: center; color: var(--accent); font-size: 1.5rem; }
.eq { display: grid; gap: 10px; justify-items: center; font-family: var(--font-latin); font-size: 1.45rem; font-weight: 500; }
.eq-line { padding: 6px 18px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.viz table { border-collapse: collapse; width: 100%; min-width: 320px; font-size: .95rem; }
.viz th, .viz td { border-bottom: 1px solid var(--line); padding: 10px 14px; text-align: start; }
.viz tr:last-child td { border-bottom: 0; }
.viz th { color: var(--ink-2); font-weight: 600; background: var(--surface-2); font-size: .85rem; }
.tl { list-style: none; margin: 0; padding: 8px 0 0; display: flex; overflow-x: auto; }
.tl-ev { flex: 1 0 130px; display: grid; justify-items: center; gap: 8px; text-align: center; position: relative; padding: 0 6px; }
.tl-ev::before { content: ''; position: absolute; top: 46px; inset-inline: 0; height: 2px; background: var(--line-strong); }
.tl-date { font-family: var(--font-latin); font-weight: 700; color: var(--accent); min-height: 1.7em; }
.tl-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); z-index: 1; margin-top: 4px; }
.tl-label { font-size: .9rem; color: var(--ink-2); }
.mx { display: flex; align-items: center; justify-content: center; gap: 12px; direction: ltr; font-family: var(--font-latin); font-size: 1.25rem; }
.mx-br { border-inline: 2px solid var(--ink); border-radius: 10px; padding: 8px 14px; }
.mx-grid { display: grid; gap: 8px 22px; text-align: center; }

.viz svg { width: 100%; height: auto; max-height: 420px; overflow: visible; }
.viz svg .axis { stroke: var(--ink-2); stroke-width: 1.5; }
.viz svg .grid { stroke: var(--line); }
.viz svg .tick { stroke: var(--ink-2); stroke-width: 1.5; }
.viz svg text { fill: var(--ink); font-family: var(--font-latin); font-size: 14px; }
.viz svg .tick-label { fill: var(--muted); font-size: 12px; }
.viz svg .curve { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.viz svg .c0 { stroke: var(--c0); fill: var(--c0); } .viz svg .c1 { stroke: var(--c1); fill: var(--c1); } .viz svg .c2 { stroke: var(--c2); fill: var(--c2); } .viz svg .c3 { stroke: var(--c3); fill: var(--c3); }
.viz svg path.curve { fill: none; }
.viz svg .curve-label { stroke: none; font-size: 13px; font-weight: 600; }
.viz svg .pt { fill: var(--gold); stroke: var(--board); stroke-width: 2; }
.viz svg .mark circle { fill: var(--c2); }
.viz svg .placed { fill: var(--gold); stroke: var(--board); stroke-width: 3; transition: cx .3s var(--spring); }
.nl { cursor: crosshair; max-height: 150px; }
.plot { border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.vec { max-width: 360px; justify-self: center; }
.vec-g line { stroke-width: 3; }
.vec-g text { stroke: none; font-weight: 600; }
.arrowhead { fill: var(--ink); }
.cmap .edge { stroke: var(--line-strong); stroke-width: 2; }
.cmap .edge-label { fill: var(--muted); font-size: 12px; }
.cmap .node rect { fill: var(--surface); stroke: var(--line-strong); }
.cmap .node text { font-family: var(--font); font-weight: 500; }
.cmap .node.root rect { fill: var(--accent); stroke: none; }
.cmap .node.root text { fill: var(--accent-ink); font-weight: 600; }

.opts { display: grid; gap: 10px; }
.opt { display: flex; align-items: center; gap: 14px; text-align: start; padding: 14px 16px; min-height: 58px; border-radius: 16px; background: var(--surface); border: 1.5px solid var(--line); box-shadow: var(--shadow-sm); cursor: pointer; font-size: 1.02rem; font-weight: 500; transition: border-color .15s, background .15s, transform .12s; }
.opt:hover:not(:disabled) { border-color: var(--accent-line); background: var(--accent-soft); }
.opt:active:not(:disabled) { transform: scale(.99); }
.opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.opt:disabled { cursor: default; }
.opt-k { flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); font-weight: 700; font-size: .85rem; font-family: var(--font-latin); color: var(--ink-2); }
.opt.sel .opt-k { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

.sort { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sort-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); cursor: grab; font-weight: 500; transition: transform .2s var(--ease), box-shadow .2s; }
.sort-item:hover { box-shadow: var(--shadow); }
.sort-item.dragging { opacity: .5; transform: scale(.98); }
.sort-grip { color: var(--muted); letter-spacing: -3px; }
.sort-text { flex: 1; }
.sort-btns { display: flex; gap: 2px; }
.sort-btns .icon-btn { font-size: .7rem; }

.match { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.m-col { display: grid; gap: 8px; align-content: start; }
.m-item { position: relative; padding: 12px 16px; min-height: 50px; border-radius: 14px; background: var(--surface); border: 1.5px solid var(--line); box-shadow: var(--shadow-sm); cursor: pointer; text-align: start; font-weight: 500; transition: border-color .15s, background .15s; }
.m-item:hover { border-color: var(--line-strong); }
.m-item.sel { border-color: var(--accent); background: var(--accent-soft); }
.m-item.paired { padding-inline-end: 40px; }
.m-item.paired::after { content: attr(data-pair); position: absolute; inset-inline-end: 10px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: .72rem; display: grid; place-items: center; font-weight: 700; font-family: var(--font-latin); }
.m-item.ok { border-color: var(--ok); background: var(--ok-soft); } .m-item.bad { border-color: var(--bad); background: var(--bad-soft); }

.frac { display: flex; align-items: center; justify-content: center; gap: 28px; flex-wrap: wrap; }
.frac-bar { display: flex; width: min(520px, 100%); height: 72px; border: 2px solid var(--ink); border-radius: 14px; overflow: hidden; background: var(--surface); }
.frac-part { flex: 1; border: 0; border-inline-end: 2px solid var(--ink); background: transparent; cursor: pointer; transition: background .25s var(--ease); }
.frac-part:last-child { border-inline-end: 0; }
.frac-part:hover:not(:disabled) { background: var(--accent-soft); }
.frac-part.on { background: var(--accent); }
.frac-part:disabled { cursor: default; }
.frac-label { display: grid; justify-items: center; font-size: 2rem; font-weight: 700; font-family: var(--font-latin); line-height: 1.15; }
.frac-line { width: 44px; height: 3px; background: var(--ink); margin: 4px 0; border-radius: 2px; }

.ps-plot { display: grid; }
.ps-controls { display: grid; gap: 10px; padding: 14px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.ps-slider { display: grid; grid-template-columns: 36px 1fr 56px; gap: 12px; align-items: center; }
.ps-name { font-family: var(--font-latin); font-weight: 700; color: var(--accent); font-style: italic; }
.ps-slider input { accent-color: var(--accent); width: 100%; }
.ps-slider output { font-family: var(--font-latin); text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

.ann { font-size: 1.35rem; line-height: 2.3; margin: 0; padding: 16px 20px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.ann-w { padding: 3px 5px; border-radius: 8px; cursor: pointer; transition: background .15s; }
.ann-w:hover { background: var(--surface-2); }
.ann-w.on { background: var(--gold-soft); box-shadow: inset 0 -2px 0 var(--gold); }

.code-ed { width: 100%; font-family: var(--font-mono); font-size: .92rem; background: #101215; color: #e6edf3; border: 1px solid #22262b; border-radius: var(--r); padding: 16px; line-height: 1.65; resize: vertical; tab-size: 2; }
.code-ed:focus { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.code-out { margin: 0; min-height: 2.4em; background: var(--surface-2); border-radius: 12px; padding: 12px 14px; font-family: var(--font-mono); font-size: .86rem; white-space: pre-wrap; color: var(--ink-2); }
.code-out:empty { display: none; }

.pr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.pr-card { position: relative; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); border-radius: 20px; padding: 18px 16px 14px; display: grid; gap: 12px; justify-items: center; text-align: center; transition: border-color .3s, box-shadow .3s; }
.pr-card.done { border-color: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.pr-card.done::after { content: '✓'; position: absolute; top: 10px; inset-inline-end: 12px; width: 22px; height: 22px; border-radius: 50%; background: var(--ok); color: #fff; font-size: .72rem; display: grid; place-items: center; font-weight: 700; }
.pr-text { font-family: var(--font-latin); font-size: 1.85rem; font-weight: 600; letter-spacing: -.01em; line-height: 1.3; }
.pr-syl { display: flex; justify-content: center; gap: 4px; flex-wrap: wrap; }
.syl { padding: 3px 11px; border-radius: 999px; background: var(--surface-2); font-family: var(--font-latin); font-size: .92rem; color: var(--ink-2); transition: transform .18s var(--spring), background .18s, color .18s; }
.syl.stress { background: var(--gold-soft); color: var(--gold); font-weight: 700; }
.syl.beat { transform: scale(1.22); background: var(--accent); color: var(--accent-ink); }
.pr-tip { margin: 0; font-size: .84rem; color: var(--muted); line-height: 1.5; }
.pr-card .row { justify-content: center; gap: 6px; }
.pr-card .btn { --h: 36px; padding: 0 12px; font-size: .85rem; }
.pr-card .btn-rec { background: var(--ink); color: var(--bg); border-color: transparent; }
.pr-card .btn-rec.recording { background: var(--bad); color: #fff; }
.pr-heard { font-size: .9rem; min-height: 1.4em; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; }
.pr-score { font-size: .74rem; padding: 1px 8px; border-radius: 999px; font-family: var(--font-latin); font-weight: 700; }
.pr-score.good { background: var(--ok-soft); color: var(--ok); } .pr-score.mid { background: var(--gold-soft); color: var(--gold); } .pr-score.low { background: var(--bad-soft); color: var(--bad); }
figure { margin: 0; text-align: center; }
figure img { max-width: 100%; max-height: 380px; border-radius: var(--r); box-shadow: var(--shadow); }
figcaption { color: var(--muted); font-size: .88rem; margin-top: 8px; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 720px) {
  .topbar { padding: 0 12px; gap: 6px; height: 56px; }
  .steps { display: none; }
  .room { padding: 6px 16px 0; gap: 12px; }
  .caption { font-size: 1.06rem; }
  .teacher .orb { --s: 36px; }
  .board { padding: 16px 16px 20px; border-radius: var(--r-lg); min-height: 240px; background-size: 18px 18px; }
  .board-title { font-size: 1.2rem; }
  .board-head { flex-direction: column-reverse; gap: 8px; }
  .cmp { grid-template-columns: 1fr; } .cmp-vs { display: none; }
  .match { gap: 8px; } .m-item { padding: 10px 12px; font-size: .92rem; }
  .stage-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .continue { grid-template-columns: 1fr; padding: 22px; }
  .home { padding: 18px 16px 48px; gap: 28px; }
  .chip-btn span:last-child { display: none; }
  .chip-btn { width: 36px; padding: 0; justify-content: center; }
  .hide-sm { display: none !important; }
  .pr-text { font-size: 1.55rem; }
  .concept-label { font-size: 1.45rem; }
  .guest-row { flex-direction: column; }
  .guest-row .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.app.busy .chip-btn, .app.busy .composer .btn, .app.busy .viz button { opacity: .45; pointer-events: none; }
.continue > * { position: relative; z-index: 1; }
.continue::after { z-index: 0; }
/* overlay must fully own the screen; the dock only floats where there is room for it */
.start-overlay { background: var(--bg); backdrop-filter: none; }
.start-overlay::before { content: ''; position: absolute; inset: 0; background: radial-gradient(50% 45% at 50% 40%, var(--accent-soft), transparent 70%); pointer-events: none; }
.start-card { position: relative; }
.dock { position: static; background: none; padding: 4px 0 24px; }
@media (min-width: 721px) and (min-height: 860px) {
  .dock { position: sticky; background: linear-gradient(to top, var(--bg) 72%, transparent); padding: 18px 0 20px; }
}

/* ---------- dialogue: a real conversation on the board ---------- */
.btn-sm { min-height: 34px; padding: 4px 12px; font-size: .86rem; gap: 6px; }
.dl-toolbar { justify-content: flex-start; gap: 8px; margin-bottom: 10px; }
.dl-list { display: grid; gap: 10px; }
.dl-line { max-width: min(560px, 92%); justify-self: start; background: var(--surface); border: 1px solid var(--line); border-radius: 18px 18px 18px 6px; padding: 12px 14px 10px; display: grid; gap: 6px; box-shadow: var(--shadow-sm); transition: border-color .25s, box-shadow .25s, transform .25s; }
.dl-line.alt { justify-self: end; border-radius: 18px 18px 6px 18px; background: var(--surface-2); }
.dl-line.you { justify-self: end; background: var(--accent-soft); border-color: var(--accent-line, var(--accent)); border-radius: 18px 18px 6px 18px; }
.dl-line.speaking { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); transform: translateY(-1px); }
.dl-line.done { border-color: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dl-speaker { font-size: .78rem; font-weight: 600; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.dl-turn { font-size: .7rem; padding: 1px 8px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); }
.dl-text { font-family: Inter, var(--font-body, sans-serif); font-size: 1.12rem; font-weight: 500; text-align: left; color: var(--ink); line-height: 1.45; }
.dl-gloss { font-size: .92rem; color: var(--ink-2); }
.dl-list.no-gloss .dl-gloss { display: none; }
.dl-actions { justify-content: flex-start; gap: 6px; }
.dl-heard { font-size: .88rem; }
.dl-heard:empty { display: none; }
.dl-cando { background: var(--accent-soft); border-radius: 16px; padding: 14px 18px; margin-bottom: 14px; }
.dl-cando h4 { margin: 0 0 6px; font-size: .95rem; }
.dl-cando ul { margin: 0; padding-inline-start: 20px; display: grid; gap: 4px; }
.viz-dialogue .dl-line .pr-tip { margin: 0; }
@media (max-width: 720px) { .dl-line, .dl-line.alt, .dl-line.you { max-width: 100%; } }

/* Mixed Arabic/Spanish: each cell or option takes its direction from its own first strong letter,
   so Spanish punctuation (¿ … . ?) lands on the right side inside an RTL page. */
.viz td, .viz th, .viz .opt span:last-child, .viz .m-item, .viz .sort-text, .viz .chip, .viz li,
.viz .concept-label, .viz .cmp-col li, .viz .pr-tip, .viz .dl-gloss, .viz-hint, .prompt, .caption { unicode-bidi: plaintext; }
.viz td, .viz .m-item, .viz .sort-text, .viz .opt span:last-child { text-align: start; }
