/* Lingua — professional course platform: white surfaces, navy ink, one brand blue, single type family */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #1b1f2a;
  --ink-2: #434a5a;
  --mute: #646b7b;
  --line: #e2e5eb;
  --line-2: #cfd4dd;
  --brand: #2346d0;
  --brand-dark: #1a36a6;
  --brand-soft: #edf1fe;
  --ok: #12754a;
  --ok-soft: #e7f5ee;
  --bad: #c0362c;
  --bad-soft: #fcedeb;
  --badge: #f5c518;
  --badge-ink: #3a2c00;

  --fill-brand: #2346d0;
  --fill-brand-hover: #1a36a6;
  --on-fill: #ffffff;
  --inverse: #1b1f2a;
  --on-inverse: #ffffff;
  --on-ok: #ffffff;
  --ok-ink: #0c5134;
  --bad-ink: #8a2119;
  --badge-soft: #fff8dc;
  --badge-line: #f1df9a;
  --dev: #a35f00;
  --dev-soft: #fff4e0;
  --xp: #f5c518;

  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --scale: 1;
  --r-s: 6px; --r-m: 10px; --r-l: 14px;
  --shadow: 0 1px 2px rgba(27,31,42,.06), 0 4px 16px rgba(27,31,42,.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1117;
    --surface: #161a22;
    --ink: #e7eaf0;
    --ink-2: #b4bbc9;
    --mute: #8b93a4;
    --line: #262c37;
    --line-2: #384050;
    --brand: #8aa2ff;
    --brand-dark: #b3c2ff;
    --brand-soft: #1c2546;
    --ok: #44d18f;
    --ok-soft: #0f2a1d;
    --bad: #ff7f73;
    --bad-soft: #2e1614;
    --badge: #f5c518;
    --badge-ink: #3a2c00;
    --fill-brand: #3d5df0;
    --fill-brand-hover: #5573ff;
    --on-fill: #ffffff;
    --inverse: #e7eaf0;
    --on-inverse: #12151b;
    --on-ok: #0e1117;
    --ok-ink: #8fe8bd;
    --bad-ink: #ffb8b0;
    --badge-soft: #2b250f;
    --badge-line: #5a4a14;
    --dev: #f0a440;
    --dev-soft: #2e2210;
    --xp: #8a6a00;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1117;
  --surface: #161a22;
  --ink: #e7eaf0;
  --ink-2: #b4bbc9;
  --mute: #8b93a4;
  --line: #262c37;
  --line-2: #384050;
  --brand: #8aa2ff;
  --brand-dark: #b3c2ff;
  --brand-soft: #1c2546;
  --ok: #44d18f;
  --ok-soft: #0f2a1d;
  --bad: #ff7f73;
  --bad-soft: #2e1614;
  --badge: #f5c518;
  --badge-ink: #3a2c00;
  --fill-brand: #3d5df0;
  --fill-brand-hover: #5573ff;
  --on-fill: #ffffff;
  --inverse: #e7eaf0;
  --on-inverse: #12151b;
  --on-ok: #0e1117;
  --ok-ink: #8fe8bd;
  --bad-ink: #ffb8b0;
  --badge-soft: #2b250f;
  --badge-line: #5a4a14;
  --dev: #f0a440;
  --dev-soft: #2e2210;
  --xp: #8a6a00;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: calc(15px * var(--scale)); line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; text-wrap: balance; letter-spacing: -.015em; }
p { margin: 0; }
a { color: var(--brand); }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.gutter { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.container { max-width: 1180px; margin: 0 auto; width: 100%; }
.muted { color: var(--mute); }
.eyebrow { font-size: .78em; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.num { font-variant-numeric: tabular-nums; }

/* ── Nav ─────────────────────────────── */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 40; background: var(--surface); }
.nav { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; background: var(--surface); border-bottom: 1px solid var(--line); }
.nav-in { display: flex; align-items: center; gap: 24px; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 1.25em; letter-spacing: -.03em; }
.logo-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; }
.nav-links { display: flex; gap: 4px; }
.nav-links a { text-decoration: none; color: var(--ink-2); font-weight: 600; padding: 8px 12px; border-radius: var(--r-s); }
.nav-links a:hover { background: var(--bg); }
.nav-links a.on { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); border-radius: 0; }
.nav .spacer { flex: 1; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--inverse); color: var(--on-inverse); display: grid; place-items: center; }
@media (max-width: 720px) { .nav-links { display: none; } }

/* ── Buttons, chips ───────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700; font-size: .95em; padding: 11px 18px; border-radius: var(--r-s);
  border: 1px solid var(--ink); background: var(--surface); color: var(--ink); text-decoration: none;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--fill-brand); border-color: var(--fill-brand); color: var(--on-fill); }
.btn.primary:hover { background: var(--fill-brand-hover); border-color: var(--fill-brand-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--bg); }
.btn.sm { padding: 7px 12px; font-size: .85em; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: .78em; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--bg); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.chip.new { background: var(--badge); color: var(--badge-ink); border-color: var(--badge); }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.brand { background: var(--brand-soft); color: var(--brand-dark); border-color: transparent; }
.kbd { font-size: .78em; font-weight: 700; padding: 1px 6px; border-radius: 4px; border: 1px solid currentColor; opacity: .65; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9em; background: none; border: 0; color: var(--ink-2); padding: 6px 8px; border-radius: var(--r-s); }
.toggle .sw { width: 34px; height: 20px; border-radius: 999px; background: var(--line-2); position: relative; transition: background .15s; }
.toggle .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle.on .sw { background: var(--fill-brand); }
.toggle.on .sw::after { transform: translateX(14px); }

/* ── Cards, progress ─────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); }
.bar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
/* Lesson cover: one series — color field, fine diagonal texture, title set inside, icon cropped off the corner */
.thumb {
  position: relative; aspect-ratio: 16 / 9; max-width: 100%; border-radius: var(--r-m); overflow: hidden;
  container-type: inline-size; color: #fff;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,.07) 0 1px, transparent 1px 9px),
    linear-gradient(160deg, color-mix(in srgb, var(--c) 82%, #fff) 0%, var(--c) 55%, color-mix(in srgb, var(--c) 78%, #000) 100%);
  background-color: var(--c);
}
.thumb .ico-bg { position: absolute; right: -8%; bottom: -18%; width: 58%; height: auto; opacity: .22; stroke-width: 2.4; }
.thumb .lno { position: absolute; left: 7%; top: 9%; font-weight: 800; font-size: clamp(10px, 4cqw, 13px); letter-spacing: .12em; color: rgba(255,255,255,.82); }
.thumb .tt { position: absolute; left: 7%; right: 30%; bottom: 11%; font-weight: 800; font-size: clamp(16px, 8.4cqw, 34px); line-height: 1.02; letter-spacing: -.03em; text-wrap: balance; }
.thumb .lv { position: absolute; right: 6%; top: 8%; font-weight: 700; font-size: clamp(10px, 3.6cqw, 12px); padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.18); }
.thumb .lno::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--badge); margin-right: 7px; vertical-align: 1px; }

/* Brand marks */
.logo .wordmark { font-weight: 800; font-size: 1.12em; letter-spacing: -.045em; }
.mark { flex: 0 0 auto; display: block; }
.dots-bg {
  background-image: radial-gradient(color-mix(in srgb, var(--brand) 16%, transparent) 1.2px, transparent 1.4px);
  background-size: 16px 16px;
}
.instructor { display: flex; align-items: center; gap: 10px; }
.instructor .in { width: 34px; height: 34px; border-radius: 50%; background: var(--inverse); color: var(--on-inverse); display: grid; place-items: center; font-weight: 800; font-size: .85em; }

/* ── Quiz ────────────────────────────── */
.q { display: grid; gap: 18px; }
.q-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.q-title { font-size: 1.6em; font-weight: 700; line-height: 1.3; }
.q-title .gap { display: inline-block; min-width: 3.2em; border-bottom: 2px solid var(--ink); }
.opts { display: grid; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 14px; text-align: left; width: 100%;
  padding: 14px 16px; border-radius: var(--r-m); border: 1px solid var(--line-2); background: var(--surface);
  font-size: 1.02em; transition: border-color .12s, background .12s;
}
.opt:hover:not([disabled]) { border-color: var(--ink); }
.opt .radio { flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; }
.opt .letter { margin-left: auto; font-size: .8em; font-weight: 700; color: var(--mute); }
.opt.sel { border-color: var(--brand); background: var(--brand-soft); }
.opt.sel .radio { border-color: var(--brand); }
.opt.sel .radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.opt.ok { border-color: var(--ok); background: var(--ok-soft); }
.opt.ok .radio { border-color: var(--ok); background: var(--ok); }
.opt.ok .radio::after { content: ""; width: 8px; height: 4px; border: 2px solid var(--on-ok); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.opt.bad { border-color: var(--bad); background: var(--bad-soft); }
.opt.bad .radio { border-color: var(--bad); }
.opt[disabled] { cursor: default; }
.feedback { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-m); }
.feedback.ok { background: var(--ok-soft); color: var(--ok-ink); }
.feedback.bad { background: var(--bad-soft); color: var(--bad-ink); }
.feedback b { display: block; }
.steps { display: flex; gap: 4px; }
.steps span { width: 22px; height: 4px; border-radius: 2px; background: var(--line); }
.steps span.cur { background: var(--ink); }
.steps span.ok { background: var(--ok); }
.steps span.bad { background: var(--bad); }
.steps span.flag { box-shadow: 0 -3px 0 var(--badge); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.hint { color: var(--mute); font-size: .85em; display: flex; gap: 14px; flex-wrap: wrap; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--inverse); color: var(--on-inverse); padding: 10px 16px; border-radius: var(--r-m); z-index: 60; font-weight: 600; font-size: .9em; box-shadow: var(--shadow); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Theme switch */
.theme-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); display: grid; place-items: center; flex: 0 0 auto; }
.theme-btn:hover { color: var(--ink); border-color: var(--line-2); }
.nav-in .theme-btn { margin-right: -12px; }
@media (prefers-reduced-motion: no-preference) { body, .nav, .card, .panel, .opt { transition: background-color .2s, border-color .2s, color .2s; } }

/* Accounts */
html.auth-pending body { visibility: hidden; }
a.avatar { text-decoration: none; color: var(--on-inverse); font-weight: 800; font-size: .95em; }
a.avatar:hover { box-shadow: 0 0 0 3px var(--brand-soft); }
.field { display: grid; gap: 6px; }
.field label { font-weight: 700; font-size: .9em; }
.field input, .field select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-s); padding: 11px 12px; width: 100%; }
.field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field .help { font-size: .82em; color: var(--mute); }
.alert { padding: 11px 14px; border-radius: var(--r-m); font-size: .92em; }
.alert.bad { background: var(--bad-soft); color: var(--bad-ink); }
.alert.ok { background: var(--ok-soft); color: var(--ok-ink); }
.alert.info { background: var(--brand-soft); color: var(--brand-dark); }
.avatar .av-svg { width: 100%; height: 100%; }
a.avatar.has-avatar { background: transparent; }

/* Side menu */
.menu-btn { width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; color: var(--ink); display: grid; place-items: center; margin-left: -8px; margin-right: -10px; flex: 0 0 auto; }
.menu-btn:hover { background: var(--bg); }
html.lg-lock { overflow: hidden; }
.lg-menu { position: fixed; inset: 0; z-index: 80; }
.lg-scrim { position: absolute; inset: 0; background: rgba(10, 12, 18, .45); opacity: 0; transition: opacity .2s; }
.lg-drawer { position: absolute; top: 0; bottom: 0; left: 0; width: min(320px, 88vw); background: var(--surface); border-right: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; transform: translateX(-100%); transition: transform .22s ease; padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); overflow-y: auto; }
.lg-menu.open .lg-scrim { opacity: 1; }
.lg-menu.open .lg-drawer { transform: none; }
.lg-top { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px 20px; }
.lg-x { width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; color: var(--ink-2); display: grid; place-items: center; }
.lg-x:hover { background: var(--bg); color: var(--ink); }
.lg-me { display: flex; align-items: center; gap: 12px; margin: 4px 12px 8px; padding: 12px; border-radius: 12px; background: var(--bg); text-decoration: none; color: var(--ink); }
.lg-me b { display: block; font-size: .98em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lg-me .muted { font-size: .82em; }
.lg-me .av-svg { width: 48px; height: 48px; flex: 0 0 auto; }
.lg-nav { display: grid; gap: 4px; padding: 4px 12px 12px; }
.lg-sec { display: grid; gap: 2px; padding-top: 10px; }
.lg-sec .eyebrow { padding: 0 10px 4px; font-size: .7em; }
.lg-nav a, .lg-row { display: flex; align-items: center; gap: 12px; padding: 10px 10px; border-radius: 10px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: .95em; border: 0; background: transparent; width: 100%; text-align: left; }
.lg-nav a:hover, .lg-row:hover { background: var(--bg); color: var(--ink); }
.lg-nav a.on { background: var(--brand-soft); color: var(--brand-dark); }
.lg-nav a span:nth-child(2), .lg-row span:nth-child(2) { flex: 1; }
.lg-badge { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--badge); color: var(--badge-ink); font-size: .75em; font-weight: 800; display: grid; place-items: center; }
.lg-row .sw { width: 34px; height: 20px; border-radius: 999px; background: var(--line-2); position: relative; transition: background .15s; flex: 0 0 auto !important; }
.lg-row .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; }
.lg-row.on .sw { background: var(--fill-brand); }
.lg-row.on .sw::after { transform: translateX(14px); }
.lg-foot { margin-top: auto; padding: 16px 22px; font-size: .8em; border-top: 1px solid var(--line); }
@media (prefers-reduced-motion: reduce) { .lg-drawer, .lg-scrim { transition: none; } }

/* Listen button */
.say { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); color: var(--brand); display: inline-grid; place-items: center; padding: 0; }
.say:hover { border-color: var(--brand); background: var(--brand-soft); }
.say.talk { animation: say-pulse .6s ease; }
.say.sm { width: 28px; height: 28px; }
@keyframes say-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 45%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }

/* Toasts: XP, level up */
.toast { display: grid; gap: 2px; text-align: center; max-width: min(92vw, 420px); }
.toast span { font-weight: 500; opacity: .85; font-size: .92em; }
.toast.xp b { color: var(--xp); }
.toast.big { padding: 14px 20px; font-size: 1em; }
.toast.pop { animation: toast-in .35s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes toast-in { from { transform: translate(-50%, 16px) scale(.92); opacity: 0; } to { transform: translate(-50%, 0) scale(1); opacity: 1; } }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 90; }

/* Streak / XP strip */
.flame { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.week span { display: grid; place-items: center; gap: 4px; font-size: .72em; font-weight: 700; color: var(--mute); }
.week i { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; font-style: normal; }
.week .on i { background: var(--ok); border-color: var(--ok); color: var(--on-ok); }
.week .on i::after { content: "✓"; font-size: 12px; font-weight: 800; }
.week .today i { border-color: var(--brand); }
.xpbar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.xpbar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--fill-brand), #6d8bff); }

/* Loading: page skeleton while we check the session */
html.auth-pending body::after {
  content: ""; visibility: visible; position: fixed; inset: 0; z-index: 100; pointer-events: none;
  --x: max(16px, calc(50vw - 574px));
  background:
    linear-gradient(var(--fill-brand), var(--fill-brand)) var(--x) 17px / 30px 30px no-repeat,
    linear-gradient(var(--line), var(--line)) calc(var(--x) + 40px) 26px / 72px 12px no-repeat,
    linear-gradient(var(--surface), var(--surface)) 0 0 / 100% 64px no-repeat,
    linear-gradient(var(--line), var(--line)) 0 64px / 100% 1px no-repeat,
    linear-gradient(var(--line), var(--line)) var(--x) 112px / min(380px, 70vw) 30px no-repeat,
    linear-gradient(var(--line), var(--line)) var(--x) 160px / min(560px, 86vw) 14px no-repeat,
    linear-gradient(var(--line), var(--line)) var(--x) 186px / min(460px, 76vw) 14px no-repeat,
    linear-gradient(var(--surface), var(--surface)) var(--x) 236px / min(1148px, calc(100vw - 32px)) 190px no-repeat,
    var(--bg);
  animation: skel 1s ease-in-out infinite alternate;
}
@keyframes skel { from { opacity: 1; } to { opacity: .55; } }

/* Say it (microphone) sheet */
.say.mic { color: #c0362c; }
.say.mic:hover { border-color: #c0362c; background: var(--bad-soft); }
.sheet { position: fixed; inset: 0; z-index: 85; display: grid; align-items: end; justify-items: center; }
@media (min-width: 640px) { .sheet { align-items: center; } }
.sheet-scrim { position: absolute; inset: 0; background: rgba(10, 12, 18, .45); }
.sheet-card { position: relative; width: min(560px, 100%); background: var(--surface); border-radius: 18px 18px 0 0; padding: 22px 22px calc(22px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 14px; box-shadow: var(--shadow); animation: sheet-in .25s ease; }
@media (min-width: 640px) { .sheet-card { border-radius: 18px; } }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
.sheet-target { font-size: 1.35em; font-weight: 800; line-height: 1.35; display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.sheet-heard { min-height: 48px; display: grid; gap: 6px; }
.sheet-words { font-size: 1.2em; font-weight: 700; line-height: 1.7; }
.sheet-words .ok { color: var(--ok-ink); background: var(--ok-soft); border-radius: 5px; padding: 1px 5px; }
.sheet-words .miss { color: var(--bad-ink); background: var(--bad-soft); border-radius: 5px; padding: 1px 5px; }
.sheet-score b { font-size: 1.4em; margin-right: 6px; }
.sheet-score.good b { color: var(--ok); }
.sheet-bad { color: var(--bad-ink); }
.sheet-act { display: flex; justify-content: space-between; gap: 10px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #ff5a4f; display: inline-block; animation: rec 1s infinite; }
@keyframes rec { 50% { opacity: .3; } }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.bdg { display: grid; justify-items: center; text-align: center; gap: 4px; padding: 14px 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.bdg .e { color: var(--ink); line-height: 1; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--badge-soft); border: 2px solid var(--badge-line); }
.bdg b { font-size: .9em; }
.bdg small { color: var(--mute); font-size: .76em; line-height: 1.35; }
.bdg.off { opacity: .55; }
.bdg.off .e { color: var(--mute); background: var(--bg); border-color: var(--line); }

/* Class mode: the teacher is running a class on a student's account */
.classbar { position: relative; z-index: 60; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 9px max(16px, env(safe-area-inset-left));
  background: var(--badge-soft); color: var(--badge-ink); border-bottom: 1px solid var(--badge-line); font-size: .9em; }
.classbar > span:nth-child(2) { flex: 1; min-width: 200px; }
.classbar .dot { width: 9px; height: 9px; border-radius: 50%; background: #d7263d; box-shadow: 0 0 0 4px rgba(215,38,61,.18); animation: rec 1.6s ease-in-out infinite; }
@keyframes rec { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .classbar .dot { animation: none; } }
.classbar .btn { background: var(--surface); }
@media print { .classbar { display: none !important; } }

/* ── Effects ── */
.btn.shimmer { position: relative; overflow: hidden; isolation: isolate; }
.btn.shimmer::after { content: ""; position: absolute; inset: -2px; z-index: -1; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.38) 48%, transparent 66%); transform: translateX(-120%); animation: shimmer 3.2s ease-in-out 1s infinite; pointer-events: none; }
.btn.shimmer > * { position: relative; }
@keyframes shimmer { 0% { transform: translateX(-120%); } 45%, 100% { transform: translateX(120%); } }
.scr-zone { position: relative; }
.scr-cover { position: absolute; inset: 0; z-index: 2; border: 0; padding: 0; margin: 0; background: transparent; border-radius: inherit; overflow: hidden; cursor: grab; touch-action: none; transition: opacity .35s ease; }
.scr-cover canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.scr-cover .scr-hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px; color: #fff; font-weight: 800; font-size: .9em; letter-spacing: .01em; pointer-events: none; transition: opacity .2s; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.scr-cover .scr-hint svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.scr-cover:focus-visible { outline: 3px solid var(--badge); outline-offset: 2px; }
.scr-cover.gone { opacity: 0; pointer-events: none; }
.morph { display: inline-block; transition: opacity .38s ease, filter .38s ease, transform .38s ease; }
.morph.out { opacity: 0; filter: blur(6px); transform: translateY(4px); }
.fx-in { animation: fxIn .45s cubic-bezier(.2,.7,.3,1) both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes fxIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .btn.shimmer::after, .fx-in { animation: none; } .morph, .scr-cover { transition: none; } }

/* ── Sheet (bottom panel on phones, dialog on wide screens) ── */
.lsheet-wrap { position: fixed; inset: 0; z-index: 90; }
.lsheet-scrim { position: absolute; inset: 0; background: rgba(8,10,16,.5); opacity: 0; transition: opacity .2s; }
.lsheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto; background: var(--surface); color: var(--ink); border-radius: 20px 20px 0 0; padding: 10px 18px max(18px, env(safe-area-inset-bottom, 0px)); transform: translateY(100%); transition: transform .25s cubic-bezier(.2,.8,.3,1); box-shadow: 0 -10px 40px rgba(0,0,0,.25); }
.lsheet-wrap.in .lsheet-scrim { opacity: 1; } .lsheet-wrap.in .lsheet { transform: none; }
@media (min-width: 761px) { .lsheet { left: 50%; right: auto; bottom: auto; top: 50%; width: min(480px, 92vw); border-radius: 16px; padding: 22px 24px; transform: translate(-50%, -46%); opacity: 0; transition: transform .2s, opacity .2s; } .lsheet-wrap.in .lsheet { transform: translate(-50%, -50%); opacity: 1; } .lsheet-grab { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .lsheet, .lsheet-scrim { transition: none; } }
.lsheet-grab { display: block; margin: 0 auto 10px; width: 40px; height: 4px; border-radius: 99px; background: var(--line-2); }
.lsheet-x { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--bg); color: var(--ink-2); display: grid; place-items: center; cursor: pointer; }
.lsheet-x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.lsheet-body { display: grid; gap: 14px; }
.lsheet-t { font-size: 1.2em; font-weight: 800; letter-spacing: -.01em; padding-right: 44px; }
.lsheet-acts { display: grid; gap: 8px; } .lsheet-acts .btn { min-height: 48px; justify-content: center; }
body.lsheet-open { overflow: hidden; }
/* ── Recorder ── */
.rec { display: inline-flex; align-items: center; gap: 8px; }
.rec svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rec.on { border-color: var(--bad); color: var(--bad); }
.rdot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); animation: rpulse 1s ease-in-out infinite; }
@keyframes rpulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .rdot { animation: none; } }
.rec-done { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .rec-done audio { height: 40px; max-width: 100%; }
.rec-note { display: block; font-size: .85em; color: var(--mute); margin-top: 4px; } .rec-note:empty { display: none; }
.voice-box { display: grid; gap: 4px; }
.lsheet textarea, .lsheet input[type=text] { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-s, 8px); padding: 11px 12px; width: 100%; resize: vertical; }
.lsheet textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

/* Class notes drawer (class mode) */
.cnotes { position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 100vw); z-index: 80; background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: -12px 0 40px rgba(16,20,34,.14); display: grid; grid-template-rows: auto 1fr; animation: cnIn .22s ease-out; }
.cnotes[hidden] { display: none; }
@keyframes cnIn { from { transform: translateX(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cnotes { animation: none; } }
.cn-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.cn-head b { display: block; font-size: 1.05em; } .cn-head small { color: var(--mute); font-size: .85em; }
.cn-x { font: inherit; font-size: 24px; line-height: 1; border: 0; background: none; color: var(--mute); cursor: pointer; width: 40px; height: 40px; border-radius: 8px; }
.cn-x:hover { background: var(--bg); color: var(--ink); }
.cn-body { padding: 16px 18px 18px; display: grid; grid-template-rows: 1fr auto; gap: 10px; min-height: 0; align-content: start; }
.cn-body textarea { width: 100%; height: 100%; min-height: 240px; box-sizing: border-box; resize: none; font: inherit; font-size: 1em; line-height: 1.6; color: var(--ink);
  background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; padding: 14px; }
.cn-body textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.cn-hint { margin: 0; font-size: .86em; color: var(--mute); line-height: 1.5; }
@media (min-width: 1180px) { body.cn-open { padding-right: 380px; } }
@media print { .cnotes { display: none !important; } }

/* New version notice (assets/cloud.js · checkVersion) */
#newVersion { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 9999;
  display: flex; align-items: center; gap: 10px; width: max-content; max-width: calc(100vw - 32px); padding: 10px 10px 10px 16px;
  background: var(--ink); color: var(--bg, #fff); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .22); font-size: .9rem; line-height: 1.35; }
#newVersion span { min-width: 0; }
#newVersion button { font: inherit; font-weight: 700; border: 0; border-radius: 8px; padding: 7px 14px; cursor: pointer; background: var(--brand); color: #fff; flex: none; }
#newVersion button:disabled { opacity: .6; }
#newVersion .nv-x { background: transparent; color: inherit; opacity: .7; padding: 4px 8px; font-size: 1.15rem; }
@media print { #newVersion { display: none; } }

/* Big line icon at the top of a result or empty state */
.pr-ico { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--bg); border: 1px solid var(--line); color: var(--ink); justify-self: center; }
