/* Lory: a red lory on wing blue. Light by default, dark when the phone is dark.
   Every colour comes from these tokens; semantic colours (ok / warn / danger) stay separate from the brand. */
@import url("/static/fonts/fonts.css");
:root {
  --lory-red: #D7263D;
  --wing: #1F3C88;
  --beak: #F28C28;
  --flame: #F2701D;

  --bg: #F5F6FA;
  --bg-glow: #FFE3E6;
  --surface: #FFFFFF;
  --surface-2: #EEF0F6;
  --surface-hi: #FFFFFF;
  --well: #F3F4F9;
  --line: #E1E4EE;
  --card: var(--surface);
  --card-border: var(--line);
  --text: #171A2B;
  --text-2: #33384F;
  --muted: #5B6178;
  --faint: #8A90A8;
  --accent: var(--lory-red);
  --accent-strong: #B51D32;
  --accent-soft: #FFE5E8;
  --accent-ink: #5E0C18;
  --on-soft: #5E0C18;
  --accent-wash: #FFF0F2;
  --accent-text: #B51D32;
  --on-accent: #FFFFFF;
  --ink-fixed: #141A33;
  --on-ok: #FFFFFF;
  --ok: #15803D;
  --warn: #B45309;
  --danger: #C81E3A;
  --info: #1D4ED8;
  --focus: #1F3C88;
  --shadow: 0 10px 30px rgba(23, 26, 43, .08);
  --caption-shadow: none;

  --font-display: "Gabarito", "Bricolage Grotesque", ui-rounded, system-ui, sans-serif;
  --font-body: "Figtree", ui-sans-serif, system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121316;
    --bg-glow: #2A1519;
    --surface: #1C1D22;
    --surface-2: #24262C;
    --surface-hi: #2B2D34;
    --well: #17181C;
    --line: #30323A;
    --text: #F4F5F7;
    --text-2: #D7D9DF;
    --muted: #A3A7B2;
    --faint: #767B87;
    --accent: #E23047;
    --accent-strong: #C5213A;
    --accent-soft: #3A1B21;
    --accent-ink: #FFD4DA;
    --on-soft: #FFD4DA;
    --accent-wash: #22171A;
    --accent-text: #FF8E9C;
    --ok: #3DBE6C;
    --on-ok: #FFFFFF;
    --warn: #F0B23A;
    --danger: #FF7D8E;
    --info: #8DB8FF;
    --focus: #8DB8FF;
    --shadow: 0 14px 40px rgba(0, 0, 0, .45);
    --caption-shadow: 0 2px 12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #121316;
    --bg-glow: #2A1519;
    --surface: #1C1D22;
    --surface-2: #24262C;
    --surface-hi: #2B2D34;
    --well: #17181C;
    --line: #30323A;
    --text: #F4F5F7;
    --text-2: #D7D9DF;
    --muted: #A3A7B2;
    --faint: #767B87;
    --accent: #E23047;
    --accent-strong: #C5213A;
    --accent-soft: #3A1B21;
    --accent-ink: #FFD4DA;
    --on-soft: #FFD4DA;
    --accent-wash: #22171A;
    --accent-text: #FF8E9C;
    --ok: #3DBE6C;
    --on-ok: #FFFFFF;
    --warn: #F0B23A;
    --danger: #FF7D8E;
    --info: #8DB8FF;
    --focus: #8DB8FF;
    --shadow: 0 14px 40px rgba(0, 0, 0, .45);
    --caption-shadow: 0 2px 12px rgba(0, 0, 0, .6);
    color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--font-body);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  padding: env(safe-area-inset-top) 18px calc(env(safe-area-inset-bottom) + 16px);
  background: radial-gradient(120% 60% at 50% -10%, var(--bg-glow) 0, var(--bg) 38%, var(--bg) 72%) fixed;
}

.view { max-width: 520px; margin: 0 auto; padding-top: 12px; }
.view[hidden] { display: none !important; }
/* the hidden attribute always wins over a component's display: grid/flex */
[hidden] { display: none !important; }
h1 { font-size: 1.6rem; margin: 8px 0; letter-spacing: -.04em; }
h2 { font-size: 1rem; margin: 0 0 10px; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.error { color: var(--danger); font-size: 0.9rem; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 42px; margin-bottom: 14px; }
.topbar h1 { font-size: 1.1rem; margin: 0; }
.brand { font-size: 14px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.chip { border: 1px solid var(--card-border); border-radius: 999px; padding: 4px 12px; font-size: 13px; color: var(--text); }
.card {
  background: linear-gradient(180deg, var(--surface), var(--surface)); border: 1px solid var(--line); border-radius: 20px;
  padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow), inset 0 1px 0 color-mix(in srgb, var(--text) 5%, transparent); backdrop-filter: blur(20px);
}
.row { display: flex; gap: 8px; }
.wrap { flex-wrap: wrap; }

label { display: block; margin-bottom: 12px; color: var(--muted); font-size: 0.85rem; }
select, input, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 11px;
  border-radius: 10px; border: 1px solid var(--card-border); background: var(--well); color: var(--text);
  font: inherit;
}
textarea { resize: vertical; margin: 12px 0; }

button { font: inherit; border: 0; border-radius: 12px; padding: 12px 16px; cursor: pointer; }
button:disabled { opacity: 0.4; cursor: default; }
button:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
button.big { display: block; width: 100%; padding: 15px; font-weight: 700; margin-top: 12px; }
button.small { padding: 8px 12px; font-size: 0.85rem; }
.primary { background: var(--surface-hi); color: var(--on-soft); font-weight: 700; }
.secondary { background: transparent; border: 1px solid var(--card-border); color: var(--text); }
.secondary:not(:disabled):hover { background: color-mix(in srgb, var(--text) 7%, transparent); }
.danger { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); border: 1px solid var(--danger); color: var(--danger); }
.link { background: none; color: var(--accent); padding: 8px 0; }

/* Pill voice buttons (Start / Stop voice in Hermes). */
.voice-action { min-width: 160px; height: 54px; padding: 0 26px; border: 1px solid var(--accent); border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.voice-action.big { height: auto; padding: 15px 26px; }
.voice-action:not(:disabled):hover { background: var(--surface-hi); }
.voice-stop { background: var(--accent-ink); color: var(--accent-text); }
.voice-stop:not(:disabled):hover { background: var(--accent-strong); }
/* Two backgrounds keep the animated highlight confined to the border. */
.voice-start { border: 2px solid transparent; background: linear-gradient(var(--accent-soft), var(--accent-soft)) padding-box, linear-gradient(110deg, var(--faint) 15%, var(--accent-soft) 35%, var(--surface-hi) 50%, var(--accent-soft) 65%, var(--faint) 85%) border-box; background-size: 100% 100%, 300% 100%; animation: border-shimmer 4s linear infinite; }
.voice-start:disabled { animation: none; }
@keyframes border-shimmer { from { background-position: 0 0, 150% 0; } to { background-position: 0 0, -150% 0; } }

.meter { height: 8px; border-radius: 999px; background: var(--well); border: 1px solid var(--line); overflow: hidden; margin-bottom: 8px; }
#budget-bar { height: 100%; width: 0; background: var(--ok); transition: width 0.4s; }

.tabs { display: flex; gap: 10px; }
.tabs button { flex: 1; background: transparent; border: 1px solid var(--card-border); color: var(--text); border-radius: 999px; }

.timer { width: 38px; text-align: right; font: 12px ui-monospace, monospace; color: var(--faint); }

/* ---- Sign in ---- */
.auth-screen { min-height: 92vh; min-height: 92dvh; display: grid; place-items: center; }
.auth-card { width: min(440px, 100%); padding: 36px 26px 30px; text-align: center; border: 1px solid var(--line); border-radius: 30px; background: linear-gradient(180deg, var(--surface), var(--surface)); box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--text) 3%, transparent) inset; backdrop-filter: blur(24px); }
.auth-logo { display: block; margin: 0 auto 18px; border-radius: 24px; box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 8%, transparent), 0 12px 50px color-mix(in srgb, var(--accent-strong) 40%, transparent); }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .24em; }
.auth-card h1 { margin: 0 0 10px; font-size: 30px; }
.auth-copy { margin: 0 auto 24px; max-width: 330px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.auth-form { text-align: left; }
.auth-form .big { margin-top: 18px; }
.auth-form .link { display: block; margin: 10px auto 0; }
.field { margin-bottom: 12px; }
.field span { display: block; margin: 0 0 4px 2px; font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--muted); }
.field input { margin: 0; padding: 14px; border-radius: 14px; background: var(--well); font-size: 16px; }
.field input:focus { outline: 2px solid var(--accent-strong); outline-offset: 0; border-color: transparent; }
.auth-error { margin: 16px 0 0; color: var(--danger); font-size: 14px; }
.consent { margin: 6px 0 4px; padding: 14px; border-radius: 16px; background: var(--well); border: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.consent p { margin: 0 0 6px; }
.consent ul { margin: 0 0 10px; padding-left: 18px; color: var(--muted); }
.consent li { margin-bottom: 4px; }

/* ---- Live session (Hermes voice surface) ---- */
.app { height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px); height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px); max-width: none; display: flex; flex-direction: column; padding-top: 0; overflow: clip; }
.app header { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 2px 4px; }
.header-spacer { width: 38px; height: 38px; }
.presence { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: clamp(6px, 2dvh, 18px); padding-bottom: clamp(24px, 6dvh, 48px); }
.voice-visualizer { position: relative; flex: 0 1 190px; min-height: 32px; width: min(320px, 100%); display: flex; align-items: center; justify-content: center; }
.voice-wave { position: relative; z-index: 1; width: 100%; height: 100%; overflow: hidden; }
.wave-line { fill: none; stroke: url(#google-wave); stroke-linecap: butt; stroke-linejoin: round; stroke-width: 1.5; opacity: .65; }
.wave-line-1 { opacity: .72; } .wave-line-2 { opacity: .9; } .wave-line-3 { opacity: .55; } .wave-line-4 { opacity: .38; } .wave-line-5 { opacity: .66; } .wave-line-6 { opacity: .48; } .wave-line-7 { opacity: .62; }
.wave-fill { fill: url(#google-wave); fill-opacity: .09; stroke: none; }
.voice-idle .wave-line { stroke: var(--muted); opacity: .32; }
.voice-idle .wave-fill, .voice-idle .wave-aura { display: none; }
/* Diffuse shared clouds sit behind the entire SVG, never follow its paths. */
.wave-aura { position: absolute; inset: 12% 3%; pointer-events: none; --energy: 0; filter: blur(19px); opacity: calc(.22 + var(--energy) * .5); transform: scale(calc(.9 + var(--energy) * .2)); }
.wave-aura i { position: absolute; inset: 12% 18%; border-radius: 50%; background: radial-gradient(ellipse, color-mix(in srgb, var(--wing) 67%, transparent), transparent 70%); }
.wave-aura i:nth-child(2) { inset: 25% 0 5% 40%; background: radial-gradient(ellipse, color-mix(in srgb, var(--accent) 60%, transparent), transparent 70%); }
.wave-aura i:nth-child(3) { inset: 0 36% 20% 0; background: radial-gradient(ellipse, color-mix(in srgb, var(--beak) 53%, transparent), transparent 70%); }

.caption-stage { flex: 0 1 180px; min-height: 32px; width: min(760px, 100%); display: flex; flex-direction: column; align-items: center; justify-content: safe flex-end; gap: 2px; overflow: auto; overscroll-behavior: contain; scrollbar-width: none; }
.caption-stage::-webkit-scrollbar { display: none; }
.caption { flex: 0 0 auto; max-width: 100%; padding: .18em .22em; text-align: center; font-size: clamp(28px, 9vw, 58px); font-weight: 900; line-height: 1.3; letter-spacing: -.04em; text-transform: uppercase; overflow-wrap: anywhere; color: var(--text); text-shadow: var(--caption-shadow); }
.caption-trail { flex: 0 0 auto; max-width: 100%; line-height: 1.5; overflow-wrap: anywhere; color: var(--text-2); font-size: 12px; font-weight: 700; letter-spacing: -.02em; text-transform: uppercase; opacity: .16; }
.caption-trail:nth-last-child(3) { font-size: 14px; opacity: .34; }
.caption-trail:nth-last-child(2) { font-size: 16px; opacity: .65; }

.voice-action-slot { flex: 0 0 54px; width: 100%; display: flex; align-items: center; justify-content: center; gap: 14px; }
.round-action { flex: 0 0 auto; width: 48px; height: 48px; padding: 0; display: grid; place-items: center; border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); border-radius: 50%; background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--accent-text); }
.round-action svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.round-action .slash, .round-action .i-play { display: none; }
.round-action[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-soft); }
.round-action[aria-pressed="true"] .slash, #btn-pause[aria-pressed="true"] .i-play { display: inline; }
#btn-pause[aria-pressed="true"] .i-pause { display: none; }
#btn-pause[aria-pressed="true"] .i-play { fill: currentColor; stroke: none; }
#btn-mute[aria-pressed="true"] { background: var(--danger); border-color: var(--danger); color: var(--on-soft); }
/* live translation: an icon everybody knows, and the word, so it is clear what it does */
.translate-toggle { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px 0 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text-2); font: 500 13px/1 var(--font-body); }
.translate-toggle svg { width: 18px; height: 18px; fill: currentColor; }
.translate-toggle[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
/* Pinyin under Chinese characters (captions, word cards, word list, transcripts) */
ruby { -webkit-ruby-position: after; ruby-position: under; ruby-align: center; }
rt { font-size: .5em; font-weight: 500; letter-spacing: 0; text-transform: none; line-height: 1.15; color: inherit; opacity: .85; }
.caption rt { font-size: .34em; font-weight: 600; color: var(--accent-text); opacity: 1; }
.caption-translation { flex: 0 0 auto; min-height: 2.6em; width: min(560px, 100%); padding: 0 12px; text-align: center; font-size: 15px; font-weight: 300; line-height: 1.3; letter-spacing: .01em; color: color-mix(in srgb, var(--accent) 80%, transparent); overflow-wrap: anywhere; }
.view.paused .voice-visualizer, .view.paused .caption-stage { opacity: .35; transition: opacity .3s; }

/* Fixed geometry: the status text changes all the time ("Tutor speaking" ↔ "Listening to you…"), so it gets its
   own one-line row and the stats never wrap; otherwise the row height changes and the centred stage jumps. */
.talk-stats { flex: 0 0 auto; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 12px; color: var(--faint); font-size: 11px; letter-spacing: .02em; }
.talk-stats > span:not(.session-indicator) { white-space: nowrap; }
.talk-stats b { font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
#m-first, #m-reply { display: inline-block; min-width: 5ch; text-align: left; }
.session-indicator { flex: 0 0 100%; height: 16px; display: flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; overflow: hidden; }
.indicator-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.indicator-idle { color: var(--faint); }
.indicator-idle .indicator-dot { background: var(--faint); }
.indicator-active { color: var(--ok); }
.indicator-active .indicator-dot { background: var(--ok); box-shadow: 0 0 12px var(--ok); animation: active-dot 1.2s ease-in-out infinite alternate; }
@keyframes active-dot { from { transform: scale(.8); opacity: .65; } to { transform: scale(1.25); opacity: 1; } }

/* ---- Feedback, vocab, status ---- */
.rating { display: flex; gap: 8px; margin: 16px 0; }
.rating button { flex: 1; background: transparent; border: 1px solid var(--card-border); color: var(--text); font-size: 1.2rem; font-weight: 700; border-radius: 14px; }
.rating button.selected { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }

.list { list-style: none; padding: 0; margin: 0 0 16px; }
.list li { background: var(--card); border: 1px solid var(--card-border); border-radius: 14px; padding: 12px; margin-bottom: 8px; }
.list li .word { font-weight: 700; }
.list li .actions { display: flex; gap: 8px; margin-top: 8px; }

table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
td, th { padding: 5px 2px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--faint); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .voice-start, .indicator-active .indicator-dot { animation: none; }
  .wave-aura { transform: none; opacity: .25; }
}

/* ---- Home refresh: flame + bell, today's goal, segmented pickers ---- */
.top-actions { display: flex; align-items: center; gap: 8px; }
.flame-btn { display: flex; align-items: center; gap: 4px; height: 38px; padding: 0 12px 0 8px; border: 1px solid var(--card-border); border-radius: 999px; background: color-mix(in srgb, var(--text) 3%, transparent); color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.flame { --flame-scale: 1; display: inline-block; width: 24px; text-align: center; font-size: 22px; line-height: 1; transform: scale(var(--flame-scale)); transform-origin: 50% 80%; transition: transform .4s, filter .4s; filter: drop-shadow(0 0 8px color-mix(in srgb, var(--flame) 66%, transparent)); }
.flame-dim { filter: saturate(.55) brightness(.8); }
.flame-out { filter: grayscale(1) brightness(.6); }
.icon-btn { position: relative; width: 38px; height: 38px; padding: 0; display: grid; place-items: center; border: 1px solid var(--card-border); border-radius: 50%; background: color-mix(in srgb, var(--text) 3%, transparent); color: var(--muted); }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn[data-state="on"] { color: var(--accent); border-color: var(--accent-strong); }
.icon-btn[data-state="on"] svg { fill: color-mix(in srgb, var(--accent) 20%, transparent); }
.bell-dot { position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 8px var(--warn); }

.today { margin: 0 2px 16px; }
.today-bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-bottom: 6px; }
#today-bar { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--flame), var(--warn)); transition: width .5s; }

.field-label { margin: 2px 0 6px; color: var(--muted); font-size: 0.85rem; }
.segmented { display: flex; gap: 4px; padding: 4px; margin-bottom: 14px; border: 1px solid var(--card-border); border-radius: 14px; background: var(--well); }
.segmented button { flex: 1; padding: 9px 6px; border-radius: 10px; background: transparent; color: var(--muted); font-size: 0.92rem; }
.segmented button small { display: block; font-size: 11px; color: var(--faint); }
.segmented button[aria-checked="true"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.segmented button[aria-checked="true"] small { color: var(--accent-strong); }
.segmented.small button { font-size: 0.82rem; padding: 7px 4px; }
.row.two > label { flex: 1; }
label.check { display: flex; align-items: center; gap: 10px; margin: 4px 0 4px; }
label.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.center { text-align: center; }
.tabs { margin-bottom: 10px; }

/* ---- Proposals ---- */
.proposal-list { list-style: none; padding: 0; margin: 0; }
.proposal { padding: 12px 0; border-top: 1px solid var(--line); }
.proposal:first-child { border-top: 0; }
.proposal > span { display: block; margin-bottom: 2px; }
.proposal p { margin: 4px 0 8px; white-space: pre-line; }
.proposal .actions { display: flex; gap: 8px; align-items: center; }
.voice-action.small { min-width: 0; height: auto; padding: 8px 14px; font-size: 0.85rem; }
#admin-proposals details { margin-top: 8px; }
.proposals-nudge { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; width: 100%; text-align: left;
  color: inherit; font: inherit; cursor: pointer; }
.proposals-nudge .chev { grid-row: 1 / span 2; grid-column: 2; align-self: center; }

/* ---- Lessons ---- */
.lesson-row { cursor: pointer; }
.lesson-row > div:first-child { display: flex; justify-content: space-between; gap: 8px; }
.lesson-word { padding: 3px 0; }
.transcript { display: flex; flex-direction: column; gap: 8px; padding-bottom: 24px; }
.bubble { max-width: 86%; padding: 9px 12px; border-radius: 16px; line-height: 1.4; background: var(--card); border: 1px solid var(--card-border); }
.bubble.tutor { align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.me { align-self: flex-end; background: var(--accent-wash); border-color: var(--accent-strong); border-bottom-right-radius: 4px; }
.check { align-self: center; text-align: center; padding: 2px 8px; }
.bubble .who { display: block; font-size: 11px; color: var(--faint); margin-bottom: 2px; }
audio { width: 100%; }

/* ---- Bottom sheet (calendar, reminders) + toasts ---- */
.sheet { position: fixed; inset: 0; z-index: 20; }
.sheet[hidden] { display: none; }
.sheet-backdrop { position: absolute; inset: 0; background: #000a; backdrop-filter: blur(4px); }
.sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; max-width: 520px; margin: 0 auto; max-height: 88dvh; overflow: auto; padding: 22px 18px calc(env(safe-area-inset-bottom) + 22px); border: 1px solid var(--card-border); border-bottom: 0; border-radius: 24px 24px 0 0; background: var(--surface); }
.sheet-close { position: absolute; top: 10px; right: 16px; font-size: 18px; color: var(--muted); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin: 10px 0; }
.cal-head .link { font-size: 22px; padding: 4px 12px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 16px; }
.cal-dow { text-align: center; font-size: 11px; color: var(--faint); }
.cal-day { position: relative; min-width: 0; aspect-ratio: 1; display: grid; place-items: center; border-radius: 10px; background: var(--surface-2); font-size: 12px; color: var(--faint); }
.cal-day.empty { background: none; }
.cal-day b { position: relative; z-index: 1; font-weight: 600; }
.cal-flame { position: absolute; inset: 0; display: grid; place-items: center; font-style: normal; }
.cal-day.met { background: color-mix(in srgb, var(--flame) 22%, var(--surface)); color: var(--text); }
.cal-day.met .cal-flame { font-size: 26px; opacity: .9; filter: drop-shadow(0 0 6px var(--flame)); }
.cal-day.met b { text-shadow: 0 1px 4px #000; }
.cal-day.partial .cal-flame { font-size: 13px; opacity: .75; filter: saturate(.6); place-items: start end; padding: 3px; }
.cal-day.is-today { outline: 2px solid var(--accent); outline-offset: -2px; }
.toast, .word-toast { position: fixed; left: 50%; transform: translateX(-50%); z-index: 30; max-width: min(460px, 90vw); padding: 10px 16px; border-radius: 14px; border: 1px solid var(--card-border); background: var(--surface); color: var(--text); font-size: 0.9rem; box-shadow: 0 12px 40px #000a; }
.toast { bottom: calc(env(safe-area-inset-bottom) + 24px); }
.word-toast { top: calc(env(safe-area-inset-top) + 56px); border-color: var(--accent-strong); color: var(--accent-text); }
.toast[hidden], .word-toast[hidden] { display: none; }
.word-cues { position: fixed; top: calc(env(safe-area-inset-top) + 56px); left: 50%; transform: translateX(-50%); z-index: 29; width: min(420px, 90vw); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.word-cue { padding: 10px 14px; border-radius: 14px; border: 1px solid var(--accent-strong); background: var(--surface); box-shadow: 0 12px 40px #000a; transition: opacity .9s ease; }
.word-cue + .word-cue { opacity: .55; }
.word-cue.fade { opacity: 0; }
.wc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.wc-head b { font-size: 1.15rem; color: var(--text); }
.wc-label { font-size: .75rem; color: var(--accent-text); white-space: nowrap; }
.wc-tr { color: var(--accent-text); }
.wc-hint:empty, .wc-ex:empty, .wc-tr:empty { display: none; }
.wc-ex { margin-top: 2px; color: var(--text-2); font-style: italic; }
td.nowrap { white-space: nowrap; vertical-align: top; }

/* ---- Talk share (who talked how much) ---- */
.talk-bar { position: relative; display: flex; height: 14px; border-radius: 999px; overflow: visible; background: var(--line); }
.talk-bar .talk-me { height: 100%; border-radius: 999px 0 0 999px; background: linear-gradient(90deg, var(--accent-strong), var(--accent)); transition: width .6s; }
.talk-bar .talk-tutor { flex: 1; height: 100%; border-radius: 0 999px 999px 0; background: var(--line); }
.talk-bar .talk-me[style*="width:100%"] { border-radius: 999px; }
.talk-target { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--text); border-radius: 2px; box-shadow: 0 0 6px #000; }
.talk-bar.slim { height: 6px; flex: 1; }
.talk-legend { display: flex; justify-content: space-between; margin: 8px 0 4px; font-size: 0.85rem; color: var(--muted); }
.talk-legend b { color: var(--text); font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin: 0 6px; vertical-align: 0; }
.dot.me { background: var(--accent); margin-left: 0; }
.dot.tutor { background: var(--faint); margin-right: 0; }
.talk-mini { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.talk-mini span { flex: 0 0 64px; text-align: right; }
.up { color: var(--ok); }
.down { color: var(--warn); }
.live-talk { width: min(320px, 100%); }
.live-talk .talk-bar { height: 8px; }
.live-talk .talk-legend { font-size: 11px; letter-spacing: .04em; margin-top: 6px; }
.talk-trend { position: relative; display: flex; align-items: flex-end; gap: 6px; height: 72px; padding: 0 2px; margin-bottom: 10px; border-bottom: 1px solid var(--line); }
.tt-col { flex: 1; max-width: 34px; height: 100%; display: flex; align-items: flex-end; }
.tt-col i { display: block; width: 100%; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, var(--accent), var(--accent-strong)); }
.tt-col:last-of-type i { box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 40%, transparent); }
.tt-goal { position: absolute; left: 0; right: 0; bottom: var(--target); border-top: 1px dashed color-mix(in srgb, var(--text) 60%, transparent); pointer-events: none; }

/* ---- Vocabulary browser ---- */
.vs-head { display: flex; justify-content: space-between; align-items: baseline; }
.dist { display: flex; gap: 2px; height: 10px; border-radius: 999px; overflow: hidden; background: var(--line); margin-bottom: 10px; }
.dist i { display: block; min-width: 4px; }
.dist-legend { display: flex; flex-wrap: wrap; gap: 6px; }
.dist-legend button { display: flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--card-border); border-radius: 999px; background: transparent; color: var(--muted); font-size: 0.8rem; }
.dist-legend button b { color: var(--text); font-weight: 600; }
.dist-legend button i { width: 8px; height: 8px; border-radius: 50%; }
.dist-legend button.active { border-color: var(--accent); color: var(--text); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.prof-bg-new { background: var(--faint); }
.prof-bg-learning { background: var(--accent-strong); }
.prof-bg-familiar { background: var(--accent-strong); }
.prof-bg-good { background: var(--accent); }
.prof-bg-mastered { background: var(--accent-soft); }
.vocab-tools { margin: 4px 0 10px; }
.vocab-tools input[type="search"] { margin: 0 0 10px; }
.vocab-tools .row { align-items: stretch; }
.vocab-tools .segmented { flex: 1; margin: 0; }
.vocab-tools select { width: auto; margin: 0; padding: 0 10px; border-radius: 14px; }
.vocab-count { display: flex; justify-content: space-between; align-items: center; min-height: 32px; }
.vocab-list { list-style: none; padding: 0; margin: 0 0 24px; border: 1px solid var(--card-border); border-radius: 16px; background: var(--card); overflow: hidden; }
.card .vocab-list { border: 0; background: none; margin: 0 -6px; }
.vocab-list:empty { display: none; }
.vocab-list > li { padding: 11px 14px; border-top: 1px solid var(--line); }
.vocab-list > li:first-child { border-top: 0; }
.vocab-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.vocab-row:active { background: color-mix(in srgb, var(--text) 4%, transparent); }
.vr-main { min-width: 0; display: flex; flex-direction: column; }
.vr-main b, .vr-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prof { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.prof-segs { display: flex; gap: 3px; }
.prof-segs i { width: 12px; height: 6px; border-radius: 2px; background: var(--line); }
.prof-label { font-size: 11px; color: var(--faint); letter-spacing: .02em; }
.prof-learning .prof-segs i.on { background: var(--accent-strong); }
.prof-familiar .prof-segs i.on { background: var(--accent); }
.prof-good .prof-segs i.on { background: var(--accent); }
.prof-mastered .prof-segs i.on { background: var(--accent-soft); }
.prof-mastered .prof-label, .prof-good .prof-label { color: var(--accent); }
.list li.flash { margin-bottom: 8px; }

/* ---- Word detail sheet ---- */
.wd-nav { display: flex; justify-content: center; align-items: center; gap: 18px; margin: -8px 0 4px; }
.wd-nav .link { font-size: 26px; padding: 0 14px; line-height: 1; }
.wd-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wd-head h1 { margin: 4px 0; font-size: 2rem; overflow-wrap: anywhere; }
.wd-flag { font-size: 1.4rem; }
.wd-translation { margin: 0 0 16px; font-size: 1.1rem; color: var(--text-2); }
.wd-prof { padding: 14px; border: 1px solid var(--card-border); border-radius: 16px; background: var(--well); margin-bottom: 14px; }
.wd-prof p { margin: 8px 0 0; }
.wd-prof-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.wd-meter { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.wd-meter i { display: block; height: 100%; border-radius: 999px; background: var(--faint); }
.wd-prof.prof-learning .wd-meter i { background: var(--accent-strong); }
.wd-prof.prof-familiar .wd-meter i { background: var(--accent); }
.wd-prof.prof-good .wd-meter i { background: var(--accent); }
.wd-prof.prof-mastered .wd-meter i { background: linear-gradient(90deg, var(--accent), var(--accent-soft)); }
.wd-example { margin: 0 0 16px; padding-left: 12px; border-left: 2px solid var(--accent-strong); color: var(--text-2); font-style: italic; }
mark { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--text); border-radius: 3px; padding: 0 2px; }
.wd-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.wd-stats div { padding: 10px 6px; border-radius: 12px; background: var(--surface-2); text-align: center; }
.wd-stats b { display: block; font-variant-numeric: tabular-nums; }
.wd-stats span { font-size: 11px; color: var(--faint); }
.wd-history { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 18px; }
.wd-history i { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; font-style: normal; font-size: 12px; font-weight: 700; }
.wd-history i.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.wd-history i.miss { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.wd-occ { list-style: none; padding: 0; margin: 0 0 18px; }
.wd-occ li { padding: 9px 12px; margin-bottom: 6px; border-radius: 12px; background: var(--surface-2); font-size: 0.9rem; cursor: pointer; }
.wd-occ .who { display: block; font-size: 11px; color: var(--faint); margin-bottom: 2px; }
.wd-actions { display: flex; align-items: center; gap: 8px; }
.wd-actions .danger-link { margin-left: auto; color: var(--danger); }

/* ---- Round 3: tab bar, home hero, levels, people, me, admin ---- */
.view.tabbed { padding-bottom: calc(env(safe-area-inset-bottom) + 84px); }
.tabbar { position: fixed; z-index: 15; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 4px; padding: 8px 10px calc(env(safe-area-inset-bottom) + 8px); background: color-mix(in srgb, var(--well) 90%, transparent); border-top: 1px solid color-mix(in srgb, var(--text) 7%, transparent); backdrop-filter: blur(22px) saturate(1.4); }
.tabbar[hidden] { display: none; }
.tabbar button { flex: 1; max-width: 120px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; background: none; color: var(--faint); font-size: 11px; font-weight: 600; border-radius: 12px; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button.active { color: var(--accent-text); }
.tabbar button.active svg { stroke: var(--accent); fill: color-mix(in srgb, var(--accent) 13%, transparent); }

.home-top { height: auto; margin: 6px 0 12px; }
.hello { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hello > div { display: flex; flex-direction: column; min-width: 0; }
.hello b { font-size: 1.15rem; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hello .muted { font-size: 12px; }
.mini-logo { border-radius: 10px; box-shadow: 0 4px 18px color-mix(in srgb, var(--accent-strong) 33%, transparent); }
.hero { padding: 18px 16px 16px; border-color: var(--line); background: radial-gradient(120% 90% at 50% 0, var(--accent-wash), var(--surface) 60%); }
.hero .field-label { font-weight: 600; color: var(--text); margin-bottom: 10px; }
.lang-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.lang-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px; text-align: left; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); color: var(--text); min-width: 0; transition: border-color .2s, transform .2s, background .2s; }
.lang-card .lc-flag { font-size: 26px; line-height: 1; }
.lang-card b { font-size: 1.05rem; max-width: 100%; overflow-wrap: anywhere; hyphens: auto; }
.lang-card .lc-level { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; min-height: 22px; max-width: 100%; }
.lang-card .lc-variant { margin-top: -3px; color: var(--muted); font-size: 12px; max-width: 100%; overflow-wrap: anywhere; }
.lang-card .lvl-steps { margin-left: 0; }
.lang-card .lc-level small { color: var(--faint); font-size: 11px; line-height: 1.25; }
.lang-card[aria-checked="true"] { border-color: var(--accent); background: linear-gradient(160deg, var(--accent-wash), var(--surface)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent), 0 10px 30px color-mix(in srgb, var(--accent-strong) 20%, transparent); }
.lang-card[aria-checked="true"] .lc-level small { color: var(--accent-text); }
.lang-card:active { transform: scale(.98); }
.prep-line { margin: 12px 2px 0; min-height: 1.2em; }

.lvl { display: inline-grid; place-items: center; min-width: 30px; height: 20px; padding: 0 6px; border-radius: 7px; font-size: 11px; font-weight: 800; letter-spacing: .03em; vertical-align: 1px; color: var(--ink-fixed); }
.lvl-A { background: var(--ok); }
.lvl-B { background: var(--info); }
.lvl-C { background: var(--warn); }
.lvl.big { min-width: 48px; height: 40px; font-size: 17px; border-radius: 12px; }

.people, .users { list-style: none; padding: 0; margin: 0; }
.person, .user-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); cursor: pointer; }
.person:first-child, .user-row:first-child { border-top: 0; }
.person-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.person-main .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-levels { display: flex; gap: 6px; white-space: nowrap; font-size: 13px; }
.chev { font-style: normal; color: var(--faint); font-size: 20px; }
.avatar { flex: 0 0 auto; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(140deg, var(--lory-red), var(--wing)); color: var(--on-accent); font-weight: 800; font-size: 22px; box-shadow: 0 6px 20px color-mix(in srgb, var(--accent-strong) 27%, transparent); }
.avatar.small { width: 36px; height: 36px; font-size: 15px; }
.pill { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 999px; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); vertical-align: 2px; }
.pill.warn { background: color-mix(in srgb, var(--warn) 13%, transparent); color: var(--warn); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 4px; }
.card-head h2 { margin: 0; }

.viewing-banner { position: sticky; top: env(safe-area-inset-top); z-index: 12; max-width: 520px; margin: 8px auto 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 14px; background: var(--accent-wash); border: 1px solid var(--accent-strong); color: var(--accent-text); font-size: .88rem; backdrop-filter: blur(12px); }
.viewing-banner[hidden] { display: none; }
.viewing-banner .link { color: var(--text); padding: 2px 0; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.stat-grid.three { grid-template-columns: repeat(3, 1fr); margin: 12px 0; }
.stat-grid div { padding: 12px 6px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); text-align: center; }
.stat-grid b { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.stat-grid span { font-size: 11px; color: var(--faint); }
.level-rows { display: flex; flex-direction: column; gap: 16px; }
.lr-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 600; }
.lr-head small { font-weight: 400; }
.cefr-scale { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.cefr-scale i { padding: 5px 0; border-radius: 8px; background: var(--surface-2); color: var(--faint); font-style: normal; font-size: 11px; font-weight: 700; text-align: center; }
.cefr-scale i.on { background: linear-gradient(180deg, var(--accent), var(--accent-strong)); color: var(--on-accent); }
.lr-hist { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.lr-hist span { padding: 2px 6px; border-radius: 6px; background: var(--surface-2); font-size: 11px; color: var(--muted); }
.lr-hist span:last-child { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--text); }
.row > .big { flex: 1; }

.lesson-summary { margin: 6px 0 4px; font-size: .9rem; color: var(--text-2); }
.lesson-level-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.lesson-level-head p { margin: 2px 0 0; }
.list li.empty { text-align: center; padding: 24px 12px; }

.me-head { display: flex; align-items: center; gap: 14px; }
.me-head b { display: block; font-size: 1.2rem; }
.facts { margin: 0 0 8px; padding-left: 18px; }
.facts li { margin-bottom: 4px; font-size: .92rem; }
.menu { padding: 4px 0; }
.menu button { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; background: none; color: var(--text); border-radius: 0; border-top: 1px solid var(--line); }
.menu button:first-child { border-top: 0; }
.menu button[hidden] { display: none; }
.menu i { font-style: normal; color: var(--faint); font-size: 20px; }
.menu button span { text-align: left; }
.menu button b { display: block; font-weight: 600; }
.menu button small { display: block; color: var(--faint); font-size: 12px; margin-top: 2px; }
.menu button small:empty { display: none; }
/* Collapsible admin sections */
.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 10px; padding: 2px 0; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary b { font-size: 1.02rem; color: var(--text); }
.fold > summary small { flex: 1; text-align: right; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fold > summary::after { content: "›"; color: var(--faint); font-size: 20px; line-height: 1; transition: transform .2s; }
.fold[open] > summary::after { transform: rotate(90deg); }
.fold[open] > summary { margin-bottom: 14px; }
#admin-cost h2 { display: none; }
.tabbar button[hidden] { display: none; }
.danger-link { color: var(--danger) !important; }
#btn-logout { display: block; margin: 8px auto; }

label.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; color: var(--text); font-size: .95rem; }
label.switch small { display: block; color: var(--faint); font-size: 12px; margin-top: 2px; }
label.switch input { appearance: none; -webkit-appearance: none; flex: 0 0 auto; width: 50px; height: 30px; margin: 0; padding: 0; border-radius: 999px; background: var(--line); border: 0; position: relative; transition: background .2s; }
label.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-hi); transition: transform .2s; }
label.switch input:checked { background: var(--accent-strong); }
label.switch input:checked::after { transform: translateX(20px); }
#admin-settings select, #admin-settings input[type="number"] { margin-top: 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { display: inline-flex; align-items: center; gap: 4px; }
.chip .link { padding: 0 2px; color: var(--muted); }
.checks { margin-bottom: 8px; }
.sheet-actions { display: flex; flex-direction: column; gap: 0; margin-top: 8px; }
.sheet-actions .link { margin-top: 10px; }
.invite-link { margin: 12px 0; padding: 12px; border-radius: 12px; background: var(--well); border: 1px dashed var(--accent-strong); word-break: break-all; }
.invite-link code { font-size: 13px; color: var(--accent-text); }
.sheet .row { align-items: center; }
.sheet select { margin: 0; }

/* Round 5: core words (live chips during a lesson, level lists on the Words screen) */
.core-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 440px; margin: 4px auto 10px; }
.core-chip { padding: 3px 9px; border: 1px solid var(--card-border); border-radius: 999px; color: var(--faint); font-size: 0.78rem; transition: all .3s; }
.core-chip.heard { color: var(--muted); border-color: color-mix(in srgb, var(--accent-strong) 53%, transparent); }
.core-chip.used { color: var(--on-ok); background: var(--ok); border-color: var(--ok); font-weight: 600; }
#core-lists .card-head .segmented { margin: 0; flex: 0 0 auto; }
.core-levels { list-style: none; margin: 8px 0 4px; padding: 0; }
.core-levels li { display: grid; grid-template-columns: 9.5rem 1fr auto 1ch; align-items: center; gap: 10px; padding: 9px 2px; border-top: 1px solid color-mix(in srgb, var(--text) 6%, transparent); cursor: pointer; }
.core-levels li:first-child { border-top: 0; }
.core-levels li.current .cl-name .muted { color: var(--accent); }
.cl-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--line); }
.cl-bar i.used, .legend .dot.used { background: var(--ok); }
.cl-bar i.heard, .legend .dot.heard { background: var(--accent-strong); }
.cl-count { color: var(--muted); min-width: 4.5em; text-align: right; }
.cl-count b { color: var(--text); }
.legend .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 4px 0 10px; }
.legend .dot:first-child { margin-left: 0; }
.core-filter { margin: 6px 0 10px; }
.core-words { list-style: none; margin: 0; padding: 0; max-height: 62vh; overflow-y: auto; }
.core-words li { display: flex; align-items: flex-start; gap: 10px; padding: 8px 2px; border-top: 1px solid color-mix(in srgb, var(--text) 6%, transparent); cursor: pointer; }
.cw-icon { width: 1.2em; text-align: center; color: var(--faint); }
.cw-used .cw-icon { color: var(--ok); }
.cw-heard .cw-icon { color: var(--accent); }
.cw-main { flex: 1; }
.cw-more { display: block; margin-top: 4px; }
#admin-settings h3 { margin: 18px 0 6px; font-size: 0.95rem; color: var(--muted); }
#admin-settings [hidden], .cw-more[hidden] { display: none !important; }

/* Lesson plan (admin) */
.plan-row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; margin-bottom: 14px; padding: 12px 14px; border: 1px solid var(--card-border); border-radius: 14px; background: transparent; color: inherit; }
.plan-row > span { display: flex; flex-direction: column; gap: 2px; }
.plan-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.plan-card { border: 1px solid var(--card-border); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.plan-card.next { border-color: color-mix(in srgb, var(--accent) 50%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 19%, transparent) inset; }
.plan-card p { margin: 0; }
.plan-card.eval { border-style: dashed; }
.eval-line { margin: 0; color: var(--accent); font-weight: 600; }
.eval-form { display: flex; gap: 8px; align-items: center; }
.eval-form select { flex: 1; min-width: 0; }
.plan-head { display: flex; align-items: flex-start; gap: 10px; }
.plan-head > div { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.plan-no { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--accent-soft); color: var(--accent-ink); }
.plan-goals { margin: 0; padding-left: 18px; }
.plan-vocab { display: flex; flex-wrap: wrap; gap: 4px; }
.plan-vocab .chip { font-size: 12px; padding: 2px 8px; }
.plan-card details summary { color: var(--accent); cursor: pointer; }
.plan-card details ol { margin: 4px 0 0; padding-left: 18px; }
.plan-actions { display: flex; align-items: center; gap: 6px; }
.plan-actions .grow { flex: 1; }
.plan-actions .secondary.small { padding: 5px 10px; }
.plan-busy { color: var(--accent); animation: plan-pulse 1.6s ease-in-out infinite; }
@keyframes plan-pulse { 50% { opacity: .45; } }
.plan-past-list { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 8px; }
.plan-past { border-left: 2px solid var(--card-border); padding: 2px 0 2px 10px; display: flex; flex-direction: column; gap: 2px; }
.pill.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }

/* Release (git revision) at the bottom of each page */
.release { display: block; margin: 28px auto 8px; text-align: center; font-size: 11px; letter-spacing: .04em;
  color: var(--muted); opacity: .55; font-variant-numeric: tabular-nums; user-select: text; }
.release[hidden] { display: none; }

/* ---- Round 14: feedback stars + difficulty, other-language share, Users tab, overview tutor ---- */
.stars { display: flex; justify-content: center; gap: 6px; margin: 4px 0 18px; }
.stars button { width: 52px; height: 52px; padding: 0; background: transparent; border: 0; font-size: 2.3rem; line-height: 1; color: var(--line); transition: transform .12s, color .12s; }
.stars button.on { color: var(--warn); text-shadow: 0 0 14px color-mix(in srgb, var(--warn) 33%, transparent); }
.stars button:active { transform: scale(.9); }
.segmented.difficulty button[data-d="easy"][aria-checked="true"] { background: var(--ok); color: var(--on-ok); }
.segmented.difficulty button[data-d="medium"][aria-checked="true"] { background: var(--warn); color: var(--on-ok); }
.segmented.difficulty button[data-d="hard"][aria-checked="true"] { background: var(--danger); color: var(--on-ok); }
.stars-inline { color: var(--warn); letter-spacing: 1px; }
.stars-inline .off { color: var(--line); }
.talk-bar .talk-other { height: 100%; background: repeating-linear-gradient(135deg, var(--warn), var(--warn) 4px, var(--warn) 4px, var(--warn) 8px); }
.dot.other { background: var(--warn); margin-left: 8px; margin-right: 4px; }

.danger-text { color: var(--danger); }
#lessons-delete, #lesson-delete { gap: 18px; margin: 18px 0 8px; justify-content: center; }

.user-cards { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.user-card { cursor: pointer; margin: 0; }
.uc-head { display: flex; align-items: center; gap: 12px; }
.uc-today { display: flex; align-items: center; gap: 10px; margin: 12px 0 10px; }
.uc-today .today-bar { flex: 1; margin: 0; }
.uc-today .today-bar > div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--flame), var(--warn)); }
.uc-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.uc-stats div { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border-radius: 12px; background: var(--well); border: 1px solid var(--line); }
.uc-stats b { font-size: 1rem; font-variant-numeric: tabular-nums; }
.uc-stats span { font-size: 11px; color: var(--faint); }
.overview-cta { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; width: 100%; text-align: left; color: inherit; font: inherit; cursor: pointer;
  background: linear-gradient(135deg, var(--accent-wash), var(--surface) 60%); border-color: var(--accent-strong); }
.overview-cta b { display: block; }
.ov-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); font-size: 1.3rem; }

.mini-lessons { list-style: none; padding: 0; margin: 0; }
.mini-lessons li { display: flex; flex-direction: column; gap: 3px; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.mini-lessons li:first-child { border-top: 0; }

.chat { display: flex; flex-direction: column; gap: 10px; padding-bottom: 12px; min-height: 30vh; }
.chat .bubble p { margin: 0 0 8px; }
.chat .bubble p:last-child { margin-bottom: 0; }
.chat .bubble ul { margin: 4px 0 8px; padding-left: 18px; }
.chat .bubble.typing { color: var(--muted); font-style: italic; }
.chips.suggest .chip { background: transparent; cursor: pointer; text-align: left; }
.chat-form { position: sticky; bottom: calc(env(safe-area-inset-bottom) + 78px); display: flex; gap: 8px; align-items: flex-end; padding: 8px; border-radius: 18px; background: color-mix(in srgb, var(--well) 95%, transparent); border: 1px solid var(--card-border); }
.chat-form textarea { flex: 1; margin: 0; min-height: 44px; resize: none; }
.tabbar button { min-width: 0; }
.chips[hidden] { display: none; }
#progress-admin { margin-top: 14px; }
.other-note { margin: 2px 0 6px; font-size: 0.8rem; color: var(--warn); }
.other-note .dot.other { margin-left: 0; }

/* Round 17/18: points, all-words celebration, per-user languages, spend tables */
.points-pill { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; color: var(--warn); }
.points-pill b { color: var(--text, var(--text)); font-variant-numeric: tabular-nums; }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 1000; }
.lesson-reward { margin: 4px 0 10px; }
.all-words-badge { margin: 0 0 4px; padding: 8px 12px; border-radius: 12px; background: linear-gradient(90deg, rgba(167,139,250,.25), rgba(253,230,138,.18)); border: 1px solid rgba(196,181,253,.45); font-weight: 600; }
.lang-pick { margin: 4px 0 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--well); }
.lang-pick summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; cursor: pointer; list-style: none; }
.lang-pick summary::-webkit-details-marker { display: none; }
.lang-pick[open] summary .chev { transform: rotate(180deg); }
.lang-pick .checks { padding: 0 12px; max-height: 300px; overflow-y: auto; }
.lang-pick > button { margin: 4px 12px 12px; }
.lp-flag { font-size: 1.15em; }
.lang-status { list-style: none; margin: 0 0 8px; padding: 0; }
.lang-status li { display: grid; grid-template-columns: auto auto 1fr; align-items: baseline; gap: 6px; padding: 4px 0; }
.error-text { color: var(--danger, var(--danger)); }
table.spend td, table.spend th { font-size: 12px; }
.today-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.today-line .points-pill { flex: none; padding: 3px 9px; font-size: 12px; }
.vocab-delete-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.caption-translation.placeholder { opacity: .45; font-style: italic; }
.name-flag { font-weight: 400; }

/* Admin → API keys: one row per provider, status dot, field with Save on its right */
.key-row { position: relative; margin: 10px 0 14px; }
.key-row > .link { position: absolute; right: 0; top: -2px; padding: 0; margin: 0; }
.key-input { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.key-input input { flex: 1; min-width: 0; margin: 0; }
.key-input button { flex: none; white-space: nowrap; }
.key-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; vertical-align: 0; background: var(--faint); }
.key-dot.ok { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.key-dot.invalid { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.key-dot.limited { background: var(--warn); box-shadow: 0 0 6px var(--warn); }
.key-dot.checking { background: var(--faint); opacity: .5; }
.key-chip { margin-left: 10px; white-space: nowrap; }
.key-chip .key-dot { width: 8px; height: 8px; margin-right: 4px; box-shadow: none; }
/* Sub-level progress inside a CEFR band toward the next one (A1.2 → ▰▰▱ A2) */
.lvl-steps { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; vertical-align: 1px; }
.lvl-steps i { width: 12px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .14); }
.lvl-steps i.on { background: var(--ok); }
.lvl-steps small { font-size: 10px; opacity: .6; margin-left: 2px; }
.lvl-A0 { background: var(--text-2); }
.cur-tag { color: var(--accent); }
.cur-levels { display: flex; flex-direction: column; gap: 6px; }
.cur-level { border: 1px solid var(--card-border); border-radius: 12px; padding: 6px 10px; }
.cur-level summary { cursor: pointer; display: flex; gap: 8px; align-items: baseline; }
.cur-list { list-style: none; margin: 6px 0 2px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.cur-row { display: flex; align-items: center; gap: 8px; }
.cur-row .grow { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.cur-row.done .grow > .small:first-child { opacity: .7; }
.cur-check { width: 22px; height: 22px; min-width: 22px; padding: 0; border-radius: 6px; border: 1px solid var(--card-border); background: transparent; color: var(--ok); font-weight: 700; line-height: 1; }
.cur-row.done .cur-check { border-color: color-mix(in srgb, var(--ok) 50%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.proposal-note { margin: 2px 0 0; font-style: italic; }

/* ---- Lory type: the display face for headings, names and big numbers ---- */
h1, h2, .auth-card h1, .topbar h1, .hello b, .stat-grid b, .flame-btn b, .points-pill b { font-family: var(--font-display); letter-spacing: -.02em; }
h1 { font-weight: 700; }

/* ---- Lory primary action: a solid red pill; the shimmer runs along its border ---- */
.voice-action { border: 0; background: var(--accent); color: var(--on-accent); box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 30%, transparent); }
.voice-action:not(:disabled):hover { background: var(--accent-strong); }
.voice-start { border: 2px solid transparent; background: linear-gradient(var(--accent), var(--accent)) padding-box, linear-gradient(110deg, var(--accent-strong) 15%, var(--beak) 40%, #FFE2B8 50%, var(--beak) 60%, var(--accent-strong) 85%) border-box; background-size: 100% 100%, 300% 100%; color: var(--on-accent); }
.voice-stop { background: var(--surface-2); color: var(--text); box-shadow: none; }
.secondary { color: var(--text); }
.tabbar button.active { color: var(--accent-text); }

/* ---- Weekly vouchers (rewards.js) ---- */
.reward-card { padding: 16px 16px 12px; background: linear-gradient(160deg, var(--accent-wash), var(--surface) 70%); border-color: color-mix(in srgb, var(--accent) 25%, var(--line)); }
.rw-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.rw-head h2 { margin: 0; font-family: var(--font-display); font-size: 1.15rem; }
.rw-mins { color: var(--muted); font-variant-numeric: tabular-nums; }
.rw-mins b { font-family: var(--font-display); font-size: 1.3rem; color: var(--text); }
.rw-bar { position: relative; height: 10px; margin: 14px 0 30px; border-radius: 999px; background: var(--surface-2); }
.rw-bar > i { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: linear-gradient(90deg, var(--beak), var(--lory-red)); transition: width .6s; }
.rw-mark { position: absolute; top: -4px; width: 2px; height: 18px; margin-left: -1px; background: var(--line); }
.rw-mark em { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 11px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.rw-mark:last-child em { transform: translateX(-100%); }
.rw-mark.secured, .rw-mark.reached { background: var(--ok); }
.rw-mark.secured em, .rw-mark.reached em { color: var(--ok); }
.rw-days { margin: 0 0 8px; }
.rw-tiers { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rw-tier { display: grid; grid-template-columns: 86px 1fr; gap: 8px; align-items: baseline; font-size: .9rem; }
.rw-tier b { font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.rw-tier span { color: var(--muted); }
.rw-tier.secured b, .rw-tier.reached b { color: var(--ok); }
.rw-tier.lost { opacity: .55; }
.rw-lost { margin: 6px 0; color: var(--muted); }
.rw-mine { margin-top: 6px; font-weight: 600; }
.rw-announce, .rw-voucher { text-align: center; }
.rw-announce img { border-radius: 16px; margin: 4px auto 10px; display: block; }
.rw-announce h2, .rw-voucher h2 { font-family: var(--font-display); font-size: 1.5rem; margin: 0 0 8px; }
.rw-announce .rw-tiers { text-align: left; margin: 12px auto; max-width: 300px; padding: 12px 14px; border-radius: 14px; background: var(--well); }
.rw-code { width: 100%; margin: 16px 0 6px; padding: 22px 12px; border: 2px dashed color-mix(in srgb, var(--accent) 50%, var(--line)); border-radius: 16px; background: var(--accent-wash); color: var(--accent-text); font-weight: 700; }
.rw-code.revealed { border-style: solid; background: var(--surface); }
.rw-code code { font-size: 1.35rem; letter-spacing: .06em; color: var(--text); user-select: all; -webkit-user-select: all; }
.rw-actions { gap: 10px; }
.rw-actions > * { flex: 1; }
.rw-redeem { display: grid; place-items: center; text-decoration: none; }
.rw-item { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 0; background: none; color: var(--text); text-align: left; }
.rw-cheer { position: fixed; left: 50%; top: 38%; z-index: 40; width: 120px; height: 120px; margin-left: -60px; border-radius: 28px; box-shadow: var(--shadow); pointer-events: none; animation: rw-cheer 2.6s ease-out forwards; }
@keyframes rw-cheer { 0% { transform: scale(.3) translateY(40px); opacity: 0; } 18% { transform: scale(1.08); opacity: 1; } 30%, 50%, 70% { transform: translateY(-14px) rotate(-6deg); } 40%, 60% { transform: translateY(0) rotate(6deg); } 85% { opacity: 1; } 100% { transform: translateY(-40px); opacity: 0; } }
.flame-ice { filter: drop-shadow(0 0 8px #7FB8FF) !important; }
.flame-btn { position: relative; }
.rw-shatter .flame { animation: rw-thaw .9s ease-out; }
@keyframes rw-thaw { 0% { transform: scale(1.4); } 40% { transform: scale(.7); } 100% { transform: scale(var(--flame-scale, 1)); } }
.rw-shard { position: absolute; left: 22px; top: 16px; width: 6px; height: 6px; background: #BFE0FF; border-radius: 1px; pointer-events: none; animation: rw-shard .9s ease-out forwards; }
@keyframes rw-shard { to { transform: translate(var(--dx), var(--dy)) rotate(160deg); opacity: 0; } }
.rw-burst { animation: rw-burst 1.3s ease-out; }
@keyframes rw-burst { 0% { transform: scale(1); } 25% { transform: scale(1.9); filter: drop-shadow(0 0 16px var(--flame)); } 100% { transform: scale(var(--flame-scale, 1)); } }
.cal-day.frozen { background: color-mix(in srgb, #7FB8FF 18%, var(--surface)); }
@media (prefers-reduced-motion: reduce) { .rw-cheer, .rw-shard, .rw-burst, .rw-shatter .flame { animation: none; } }
.voucher-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.voucher-row .actions { margin: 0 0 0 auto; display: flex; gap: 12px; }
.voucher-row code, .voucher-learner code { font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.voucher-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.voucher-form .row > label { flex: 1; }
.voucher-learner + .voucher-learner { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.reward-amounts > label { flex: 1; }

/* ---- Talk: start first, everything else compact ---- */
.reward-strip { width: 100%; display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; align-items: center; gap: 2px 12px; margin: 0 0 14px; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line)); border-radius: 18px; background: linear-gradient(160deg, var(--accent-wash), var(--surface) 75%); color: var(--text); text-align: left; }
.reward-strip .rs-icon { grid-row: 1 / span 2; font-size: 24px; }
.reward-strip .rs-text { display: flex; flex-direction: column; min-width: 0; }
.reward-strip .rs-text b { font-family: var(--font-display); font-size: .98rem; }
.reward-strip .rs-text small { color: var(--muted); font-size: .8rem; }
.reward-strip .chev { grid-row: 1 / span 2; grid-column: 3; color: var(--muted); font-style: normal; }
.reward-strip .rs-bar { grid-column: 2; height: 5px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.reward-strip .rs-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--beak), var(--lory-red)); }
.reward-strip:active { transform: scale(.99); }
.rw-sub { margin: 16px 0 6px; font-size: .9rem; }
.rw-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rw-list .rw-item { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; padding: 10px 12px; border-radius: 12px; background: var(--well); }
.rw-list .rw-item .chev { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-style: normal; color: var(--muted); }

/* Language choice as one compact row of chips, so Start sits on the first screen */
.hero .lang-cards { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }
.hero .lang-card { flex-direction: row; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 14px; }
.hero .lang-card .lc-flag { font-size: 20px; }
.hero .lang-card b { font-size: .98rem; }
.hero .lang-card .lc-level { min-height: 0; margin-left: auto; }
.hero .lang-card .lc-level small, .hero .lang-card .lvl-steps, .hero .lang-card .lc-variant { display: none; }
.hero .prep-line { margin: 10px 2px 0; }
.hero #btn-start { margin-top: 12px; }
#progress-calendar .cal-grid { margin-bottom: 4px; }
.hero .lang-card b { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero .lang-card .lc-level .lvl { min-width: 0; padding: 0 5px; }
.cefr-scale { grid-template-columns: repeat(7, minmax(0, 1fr)) !important; }

.auth-new { margin: 14px 0 0; text-align: center; color: var(--muted); }
.auth-new .link { display: inline; padding: 0; margin: 0; font-weight: 600; }

/* ---- Teacher reviews (teacher.js) ---- */
.teacher-card h2 { font-family: var(--font-display); }
.tr-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.tr-row > div:first-child { display: flex; flex-direction: column; min-width: 0; }
.tr-row small { font-size: .78rem; }
.tr-pick { display: flex; gap: 4px; flex: 0 0 auto; }
.tr-pick button { width: 36px; height: 36px; padding: 0; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 600; }
.tr-pick button[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tr-label { display: block; margin: 16px 0 0; color: var(--text); font-weight: 600; font-size: .9rem; }
.teacher-card textarea { margin: 6px 0 4px; background: var(--well); color: var(--text); border: 1px solid var(--line); }
.tr-scores { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; }
.tr-scores li { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tr-meter { display: inline-flex; gap: 3px; }
.tr-meter i { width: 18px; height: 8px; border-radius: 4px; background: var(--surface-2); }
.tr-meter i.on { background: linear-gradient(90deg, var(--beak), var(--lory-red)); }
.tr-note { margin: 10px 0 4px; padding: 12px 14px; border-radius: 14px; background: var(--accent-wash); color: var(--text); white-space: normal; }
.tr-item + .tr-item, .tr-others { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }

.teacher-badge { display: inline-flex; align-items: center; gap: 6px; margin: 6px 0 2px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; background: var(--surface-2); color: var(--muted); }
.teacher-badge.is-reviewed { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); font-weight: 600; }
.teacher-seen { margin: 0; color: var(--muted); }
.activity-month { justify-content: space-between; align-items: center; margin-bottom: 8px; }
.table-wrap { overflow-x: auto; }
.act-log li { display: flex; flex-direction: column; gap: 2px; }
.role-row { gap: 8px; flex-wrap: wrap; } .role-row > * { flex: 1; }
.teacher-dot { margin-left: 6px; font-size: .72rem; color: var(--muted); }
.teacher-dot.is-reviewed { color: var(--ok); font-weight: 600; }

/* ---- Learner choices (onboarding.js) ---- */
.lang-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 14px 0 8px; max-height: 46vh; overflow: auto; }
.lang-opt { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 0 10px; align-items: center; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--text); text-align: left; }
.lang-opt .lo-flag { grid-row: 1 / span 2; font-size: 24px; }
.lang-opt small { color: var(--muted); font-size: .75rem; }
.lang-opt b, .lang-opt small { min-width: 0; overflow-wrap: normal; word-break: normal; hyphens: auto; }
.lang-opt[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-wash); box-shadow: 0 0 0 1px var(--accent) inset; }
.lang-count { margin: 4px 0 0; text-align: center; }
.voice-deck { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 14px 14% 18px; margin: 0 -4px; -webkit-overflow-scrolling: touch; } /* side room: the first and last card can sit in the middle too */
.voice-card { flex: 0 0 72%; scroll-snap-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 22px 16px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); }
.voice-card[aria-selected="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.voice-card img { border-radius: 20px; }
.voice-card b { font-family: var(--font-display); font-size: 1.4rem; }
.voice-play { padding: 10px 18px; border-radius: 999px; background: var(--accent-wash); color: var(--accent-text); font-weight: 700; }
.voice-choose { width: 100%; }
.theme-pick { margin-top: 12px; }
.mini-logo { width: 46px; height: 46px; border-radius: 14px; }
.lang-opt > * { min-width: 0; overflow-wrap: anywhere; } .lang-opt b { font-size: .95rem; line-height: 1.2; }
.hello { min-width: 0; } .hello b { font-size: 1.02rem; }
.install-hint { text-align: center; }
.install-hint img { border-radius: 22px; margin: 4px auto 12px; display: block; }
.install-hint h2 { font-family: var(--font-display); font-size: 1.45rem; }
.install-hint ol { text-align: left; margin: 14px auto; padding: 14px 14px 14px 34px; max-width: 320px; border-radius: 16px; background: var(--well); display: grid; gap: 8px; }
.avatar img { width: 100%; height: 100%; border-radius: inherit; display: block; }
.avatar:has(img) { background: none; padding: 0; overflow: hidden; }
.profile-head { display: flex; align-items: center; gap: 14px; margin: 8px 0 16px; }
.profile-head img { border-radius: 16px; }
.profile-head div { display: flex; flex-direction: column; }
#profile-form { margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.invite-user { font-size: 1.05rem; }
.signup-avatar { border-radius: 10px; }
.boot-error { max-width: 420px; margin: 30vh auto 0; text-align: center; }
.voice-card .tutor-bird { border-radius: 24px; }
.voice-card small { margin-top: -6px; }
/* Language chips on Talk: the same width and height whatever the name's length */
.hero .lang-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 1fr; }
.hero .lang-card { justify-content: flex-start; min-height: 48px; }
.hero .lang-card:only-child { grid-column: 1 / -1; }

/* R18: the tutor deck is dragged by its cards; no scrollbar under it */
.voice-deck { scrollbar-width: none; cursor: grab; user-select: none; }
.voice-deck::-webkit-scrollbar { display: none; }
.voice-deck.is-dragging { cursor: grabbing; scroll-snap-type: none; }
.voice-deck img { -webkit-user-drag: none; pointer-events: none; }

/* R18: first-use appearance question */
.theme-ask h2 { margin-top: 4px; }
.theme-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 16px 0 20px; }
.theme-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px 14px; border-radius: 18px; border: 1.5px solid var(--line); background: var(--surface); color: var(--text); font: inherit; }
.theme-card[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.theme-card small { color: var(--muted); font-size: 12px; text-align: center; }
.theme-card__swatch { display: grid; gap: 4px; width: 100%; aspect-ratio: 4 / 5; padding: 8px; border-radius: 12px; background: #F5F6FA; border: 1px solid #E3E5EE; }
.theme-card__swatch i { display: block; border-radius: 6px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.theme-card__swatch i:last-child { background: #D9232D; height: 12px; align-self: end; }
.theme-card--dark .theme-card__swatch { background: #121316; border-color: #30323A; }
.theme-card--dark .theme-card__swatch i { background: #1C1D22; }
.theme-card--auto .theme-card__swatch { background: linear-gradient(135deg, #F5F6FA 50%, #121316 50%); }

/* R19: nobody spoke for 15 s - ask once, then pause the lesson at 45 s */
.quiet-nudge { display: grid; gap: 4px; justify-items: center; text-align: center; margin: 10px auto 0; max-width: 320px; padding: 12px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(23, 26, 43, .08); font-size: 14px; color: var(--text-2); animation: nudge-in .3s ease-out; }
.quiet-nudge[hidden] { display: none; }
.quiet-nudge b { color: var(--text); font-size: 15px; }
@keyframes nudge-in { from { opacity: 0; transform: translateY(6px); } }

/* R20: admin - moving everyone to lory.chat */
.move-list { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 8px; }
.move-list li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 12px; border-radius: 14px; background: var(--well); }
.mv-who small { display: block; color: var(--muted); font-size: .8rem; }
.mv-who code { font-size: .8rem; color: var(--text-2); }
.mv-data { grid-column: 1; color: var(--muted); font-size: .8rem; }
.mv-state { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-size: .8rem; color: var(--muted); }
.mv-state.ok { color: var(--ok); font-weight: 600; }
.mv-state.seen { color: var(--accent-text); }
.move-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* R21/R22: two birds on a branch at the top of a lesson. The stage keeps its shape (440 x 150 units at most);
   the branch's top is at y 114 of 150 under both birds; a bird's feet are 87.5% down its box (22% of the stage
   wide). Both birds are drawn facing right; the learner's is mirrored. */
/* The branch comes in from a tree off the right edge of the screen, so the stage is pinned to that edge
   (440 x 190 units, never stretched). Branch top: (150, 116) under the tutor, (330, 106) under the learner.
   A sitting bird is 18% of the stage wide (viewBox 64 x 100) and grips at 56.25%, 67% of its box. */
.perch { position: relative; width: min(100vw, 560px); margin: 0 calc(50% - 50vw) 0 auto; pointer-events: none; }
.perch[hidden] { display: none; }
.view.app { overflow-x: visible; overflow-y: clip; }
.perch-stage { position: relative; width: 100%; aspect-ratio: 440 / 190; --bird: 18%; --bird-h: calc(18% * 440 / 190 * 100 / 64); }
.perch .branch { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; z-index: 2; }
.perch-stage.thud .branch { animation: pb-branch .42s ease-out; transform-origin: 100% 55%; }
.pb { position: absolute; z-index: 1; width: var(--bird); aspect-ratio: 64 / 100; --shift: 0px; --level: 0; }
.pb--tutor { left: calc(150 / 440 * 100% - .5625 * var(--bird)); top: calc(116 / 190 * 100% - .67 * var(--bird-h)); }
.pb--learner { left: calc(330 / 440 * 100% - .4375 * var(--bird)); top: calc(106 / 190 * 100% - .67 * var(--bird-h)); transform: scaleX(-1); }
.pb-toes { position: absolute; z-index: 3; width: 6.2%; aspect-ratio: 24 / 14; opacity: 0; transition: opacity .15s; translate: var(--shift, 0px) 0; transition: opacity .15s, translate .6s cubic-bezier(.3, .7, .3, 1); }
.pb-toes.on { opacity: 1; }
.pb-toes svg { width: 100%; height: 100%; display: block; }
.pb-toes--tutor { left: calc(150 / 440 * 100% - 3.1%); top: calc(116 / 190 * 100% - 1%); }
.pb-toes--learner { left: calc(330 / 440 * 100% - 3.1%); top: calc(106 / 190 * 100% - 1%); transform: scaleX(-1); }
.pb svg { width: 100%; height: 100%; display: block; overflow: visible; }
.pb-fly { position: relative; width: 100%; height: 100%; transform-origin: 55% 45%; }
/* in flight the sitting bird is swapped for the flying one (body flat, head first, tail trailing), centred on it */
.pb-flier { position: absolute; left: -18%; top: 12%; width: 140%; display: none; }
.pb-flier svg { width: 100%; height: auto; display: block; overflow: visible; }
.pb.flying .pb-flier { display: block; }
.pb.flying .pb-shift { visibility: hidden; }
.pb-flier .wing-near, .pb-flier .wing-far, .flap-wings .wing-near, .flap-wings .wing-far { transform-box: view-box; transform-origin: 66px 40px; }
.pb-flier .wing-near { animation: fly-flap .24s linear infinite; }
.pb-flier .wing-far { animation: fly-flap .24s linear infinite; animation-delay: -.03s; }
.pb-flier svg { animation: fly-bob .24s linear infinite; }
.pb.flare .pb-flier .wing-near, .pb.flare .pb-flier .wing-far { animation-duration: .16s; }
@keyframes fly-flap { 0% { transform: scaleY(1) rotate(-4deg); } 45% { transform: scaleY(-.9) rotate(7deg); } 100% { transform: scaleY(1) rotate(-4deg); } }
@keyframes fly-bob { 0%, 100% { translate: 0 0; } 45% { translate: 0 -4%; } }
.pb-shift { width: 100%; height: 100%; transform: translateX(var(--shift)); transition: transform .6s cubic-bezier(.3, .7, .3, 1); }
.pb-body { width: 100%; height: 100%; transform-origin: 56% 67%; animation: pb-breathe 3.4s ease-in-out infinite; }
.pb--learner .pb-body { animation-delay: -1.3s; }
.pb.hop .pb-body { animation: pb-hop .38s ease-out; }
.pb.landed .pb-body { animation: pb-land .42s cubic-bezier(.3, 1.4, .5, 1); }
.pb-body .beak { transform-box: view-box; transform-origin: 49px 22px; }
.pb-body .head { transform-box: view-box; transform-origin: 39px 31px; transition: transform .5s ease; }
.pb-body .tail { transform-box: view-box; transform-origin: 31px 60px; }
.pb.listening .pb-body .head { animation: pb-listen 5.5s ease-in-out infinite; }
.pb--learner.listening .pb-body .head { animation-delay: -2.2s; }
.pb.speaking .pb-body .beak { animation: pb-chatter .17s ease-in-out infinite alternate; }
.pb.speaking .pb-body .head { animation: pb-talk .55s ease-in-out infinite alternate; }
.pb.speaking .pb-body .tail { animation: pb-tail 1.1s ease-in-out infinite alternate; }
/* sound waves out of the beak, as loud as the voice */
.pb-waves { position: absolute; left: 88%; top: 12%; width: 70%; height: 24%; opacity: calc(.35 + var(--level) * .8); transition: opacity .25s; }
.pb:not(.speaking) .pb-waves { opacity: 0; }
.pb-waves i { position: absolute; left: 0; top: 50%; width: 36%; aspect-ratio: 1; transform-origin: 0 50%; translate: 0 -50%; border: 3px solid var(--accent); border-color: transparent var(--accent) transparent transparent; border-radius: 50%; opacity: 0; }
.pb.speaking .pb-waves i { animation: pb-wave 1.05s linear infinite; }
.pb.speaking .pb-waves i:nth-child(2) { animation-delay: .35s; }
.pb.speaking .pb-waves i:nth-child(3) { animation-delay: .7s; }
.perch.paused .pb { filter: saturate(.6); opacity: .75; transition: opacity .4s, filter .4s; }
.perch.fading .pb { opacity: 0; transition: opacity .25s; }
/* in flight: wings beating, a whoosh trailing behind the tail */

.pb-trail { position: absolute; right: 92%; top: 40%; width: 60%; height: 30%; opacity: 0; }
.pb.flying .pb-trail { opacity: 1; }
.pb-trail i { position: absolute; right: 0; height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--muted) 70%, transparent)); animation: pb-whoosh .5s linear infinite; }
.pb-trail i:nth-child(1) { top: 10%; width: 70%; }
.pb-trail i:nth-child(2) { top: 45%; width: 100%; animation-delay: .15s; }
.pb-trail i:nth-child(3) { top: 80%; width: 55%; animation-delay: .3s; }
@keyframes pb-breathe { 0%, 100% { transform: translateY(0) scaleY(1); } 50% { transform: translateY(-1px) scaleY(1.025); } }
@keyframes pb-hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-7px) rotate(-3deg); } }
@keyframes pb-land { 0% { transform: scaleY(.86) scaleX(1.06); } 60% { transform: scaleY(1.04); } 100% { transform: none; } }
@keyframes pb-branch { 0% { transform: translateY(0); } 30% { transform: translateY(2.5px); } 65% { transform: translateY(-1px); } 100% { transform: none; } }
@keyframes pb-listen { 0%, 30%, 100% { transform: rotate(0); } 40%, 62% { transform: rotate(10deg); } 72%, 85% { transform: rotate(-4deg); } }
@keyframes pb-chatter { from { transform: rotate(0); } to { transform: rotate(9deg); } }
@keyframes pb-talk { from { transform: rotate(-3deg); } to { transform: rotate(4deg) translateY(-1px); } }
@keyframes pb-tail { from { transform: rotate(-2deg); } to { transform: rotate(3deg); } }
@keyframes pb-wave { 0% { transform: translateX(0) scale(.6); opacity: 1; } 100% { transform: translateX(150%) scale(2.2); opacity: 0; } }
@keyframes pb-flap { from { transform: rotate(10deg); } to { transform: rotate(-70deg) scaleY(1.2); } }
@keyframes pb-whoosh { from { transform: translateX(30%) scaleX(.4); opacity: 0; } 30% { opacity: 1; } to { transform: translateX(-40%) scaleX(1); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .pb-body, .pb .head, .pb .beak, .pb .tail, .pb .wing, .pb-waves i, .pb-trail, .pb-flier svg, .pb-flier .wing-near, .pb-flier .wing-far { animation: none !important; }
  .pb-trail { display: none; }
  .pb-waves { opacity: calc(var(--level) * .8); }
}

/* R22: the word list, ten at a time */
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 10px 0 4px; }
.pager[hidden] { display: none; }
.pager-btn { width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 20px; line-height: 1; }
.pager-btn:disabled { opacity: .35; }

/* R22: scrollbars in Lory's style - thin, rounded, the ink at low strength, no arrows */
/* Chrome and Safari draw the ::-webkit-scrollbar ones below; the standard properties would switch those off in
   Chrome (it then draws its own), so they are only for Firefox, which has no ::-webkit-scrollbar. */
@supports not selector(::-webkit-scrollbar) {
  html, * { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--text) 22%, transparent) transparent; }
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text) 20%, transparent); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--accent) 55%, transparent); }
::-webkit-scrollbar-corner { background: transparent; }

/* ==== R22 design layer: the app in the landing page's style =====================================
   Hairline panels, light type, calm surfaces, red only for the one main action and for state.
   One button system for the whole app:
     primary   .voice-action, button.primary  - solid red pill (the one main action on a screen)
     secondary .secondary                     - outlined pill on the surface
     link      .link                          - red text
     round     .round-action, .icon-btn       - calm outlined circle; red when on
   Every button steps on hover and presses on click. */
:root { --r-panel: 16px; --r-control: 999px; --hair: color-mix(in srgb, var(--text) 10%, transparent);
        --panel-shadow: 0 1px 2px rgba(23, 26, 43, .04), 0 8px 24px rgba(23, 26, 43, .04); }
:root[data-theme="dark"] { --panel-shadow: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --panel-shadow: none; } }

body { font-family: var(--font-body); font-weight: 400; letter-spacing: -.005em; }
h1, h2, h3, .topbar h1 { font-family: var(--font-display); font-weight: 500; letter-spacing: -.025em; }
h1 { font-size: 1.75rem; }
.topbar { height: auto; padding-top: 6px; margin-bottom: 16px; }
.topbar h1 { font-size: 1.5rem; }
h2 { font-size: 1.05rem; }

/* panels */
.card { border-radius: var(--r-panel); border: 1px solid var(--hair); background: var(--surface); box-shadow: var(--panel-shadow); }
.hero { background: var(--surface); }
.list li, .vocab-row { border-color: var(--hair); }

/* buttons */
button, .voice-action, .secondary, .primary { transition: background-color .18s, border-color .18s, color .18s, transform .12s, box-shadow .18s; }
.voice-action, button.primary, .voice-start {
  height: 48px; min-width: 0; padding: 0 22px; border: 1px solid var(--accent); border-radius: var(--r-control);
  background: var(--accent); color: var(--on-accent); font: 600 15px/1 var(--font-body); letter-spacing: 0;
  box-shadow: none; animation: none; background-size: auto; }
.voice-action.big, button.primary.big { height: 52px; padding: 0 24px; }
.voice-action.small, button.primary.small { height: 36px; padding: 0 14px; font-size: 13.5px; }
.voice-action:not(:disabled):hover, button.primary:not(:disabled):hover, .voice-start:not(:disabled):hover {
  background: var(--accent-strong); border-color: var(--accent-strong); transform: translateY(-1px); }
.secondary, button.secondary {
  height: 48px; padding: 0 20px; border: 1px solid var(--line); border-radius: var(--r-control);
  background: var(--surface); color: var(--text); font: 500 15px/1 var(--font-body); box-shadow: none; }
.secondary.big, button.secondary.big { height: 52px; }
.secondary.small, button.secondary.small { height: 36px; padding: 0 14px; font-size: 13.5px; }
.secondary:not(:disabled):hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--text) 18%, transparent); transform: translateY(-1px); }
button.big { margin-top: 10px; }
.voice-action:not(:disabled):active, .secondary:not(:disabled):active, button.primary:not(:disabled):active,
.round-action:active, .icon-btn:active, .pager-btn:not(:disabled):active { transform: scale(.97); }
.link { font-weight: 500; text-underline-offset: 3px; }
.link:hover { text-decoration: underline; }
.danger { border-radius: var(--r-control); background: var(--surface); border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); }
/* the lesson's own buttons: End is the quiet secondary, the round ones calm until they are on */
.voice-stop { background: var(--surface); border-color: var(--line); color: var(--text); }
.voice-stop:not(:disabled):hover { background: var(--surface-2); border-color: var(--line); }
.round-action, .icon-btn { border: 1px solid var(--line); background: var(--surface); color: var(--text-2); }
.round-action:hover, .icon-btn:hover { border-color: color-mix(in srgb, var(--text) 20%, transparent); }
.round-action[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* controls */
.segmented { border: 1px solid var(--hair); border-radius: 12px; background: var(--surface-2); padding: 3px; }
.segmented button { border-radius: 9px; color: var(--muted); font-weight: 500; }
.segmented button[aria-checked="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(23, 26, 43, .08), 0 0 0 1px var(--hair); }
.segmented button[aria-checked="true"] small { color: var(--muted); }
select, input, textarea { border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 0; }
.chip { border-color: var(--hair); color: var(--text-2); font-weight: 500; }

/* the start card's language choice: quiet tiles, the chosen one outlined in red */
.lang-card { border-radius: 14px; border: 1px solid var(--line); box-shadow: none; }
.lang-card[aria-pressed="true"], .lang-card.active, .lang-card[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: var(--surface); }

/* level badges like the landing's "● B1" */
/* the level colour (A green, B blue, C orange) stays, as the dot */
.lvl { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface) !important; color: var(--text-2); font: 600 11.5px/1 var(--font-body); letter-spacing: .01em; }
.lvl::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--lvl-dot, var(--muted)); }
.lvl-A { --lvl-dot: var(--ok); } .lvl-B { --lvl-dot: var(--info); } .lvl-C { --lvl-dot: var(--warn); } .lvl-A0 { --lvl-dot: var(--faint); }

/* the lesson transcript, as on the landing page: the tutor's lines plain beside a dark disc, the learner's in a grey bubble on the right */
.bubble { border-radius: 14px; border: 0; background: transparent; padding: 6px 2px; }
.bubble.tutor { position: relative; padding-left: 34px; }
.bubble.tutor::before { content: "✦"; position: absolute; left: 0; top: 6px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--text); color: var(--bg); font-size: 11px; }
.bubble.me { background: var(--surface-2); border: 1px solid var(--hair); padding: 9px 12px; border-bottom-right-radius: 14px; }

/* tab bar */
.tabbar { background: color-mix(in srgb, var(--surface) 88%, transparent); border-top: 1px solid var(--hair); }
.tabbar button { font-weight: 500; }
.tabbar button.active { color: var(--text); }
.tabbar button.active svg { stroke: var(--accent); fill: none; }

/* desktop: the tabs become a sidebar, the content a calm column beside it (like the landing's app window) */
@media (min-width: 1024px) {
  .tabbar { top: 0; bottom: 0; right: auto; width: 220px; flex-direction: column; justify-content: flex-start; gap: 2px; padding: 28px 14px; border-top: 0; border-right: 1px solid var(--hair); background: var(--surface); backdrop-filter: none; }
  .tabbar::before { content: "Lory"; display: block; padding: 0 12px 18px; font: 600 1.25rem/1 var(--font-display); letter-spacing: -.02em; color: var(--text); }
  .tabbar button { flex: 0 0 auto; max-width: none; flex-direction: row; gap: 12px; padding: 10px 12px; font-size: 14px; justify-content: flex-start; }
  .tabbar button svg { width: 20px; height: 20px; }
  .tabbar button.active { background: var(--surface-2); }
  .view.tabbed { max-width: 760px; padding: 28px 40px calc(env(safe-area-inset-bottom) + 40px); margin-left: max(220px, calc(50% - 380px + 110px)); }
}
/* the start card's language tiles: the name always whole; on a narrow phone the level badge goes under it */
.hero .lang-card b { min-width: 0; white-space: nowrap; }
@media (max-width: 420px) {
  .hero .lang-card { flex-wrap: wrap; row-gap: 4px; }
  .hero .lang-card .lc-level { margin-left: 28px; flex-basis: 100%; }
}

/* R22: who is practising now */
.live-pill { display: flex; align-items: center; gap: 8px; margin: 12px auto 0; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font: 500 13.5px/1 var(--font-body); }
.live-pill[hidden] { display: none; }
.live-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); animation: live-dot 1.8s ease-out infinite; }
@keyframes live-dot { to { box-shadow: 0 0 0 8px transparent; } }
.live-sky { padding: 0; height: min(52vh, 420px); overflow: hidden; }
.live-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; }
.live-list li { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--hair); }
.live-list .ll-flag { font-size: 18px; }
.live-list b { flex: 1; font-weight: 500; }
@media (prefers-reduced-motion: reduce) { .live-pill i { animation: none; } }

/* R23: the admin on a computer - the Users page is a workspace: people on the left, the selected person's
   settings and lesson plan beside them (no submenus); the other admin pages use the width too. */
.users-work { display: block; }
.user-panes { display: none; }
.user-pane [data-back] { display: none; }
@media (min-width: 1024px) {
  #view-users.view.tabbed, #view-admin.view.tabbed, #view-vouchers.view.tabbed, #view-activity.view.tabbed {
    max-width: 1480px; margin-left: 220px; margin-right: 0; padding: 28px 32px 40px; }
  .users-work { display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); gap: 20px; align-items: start; }
  .users-work .user-cards { position: sticky; top: 16px; max-height: calc(100dvh - 120px); overflow: auto; padding-right: 4px; margin: 0; }
  .users-work .user-cards > li { cursor: pointer; }
  .users-work .user-cards > li .uc-stats { display: none; }
  .users-work .user-cards > li.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
  .user-panes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
  .user-pane { padding: 22px; max-height: calc(100dvh - 120px); overflow: auto; }
  .user-pane:empty { display: none; }
  .user-pane .sheet-actions { position: static; }
  #view-admin.view.tabbed { columns: 2 460px; column-gap: 20px; }
  #view-admin > * { break-inside: avoid; }
  #view-admin > .topbar { column-span: all; }
}
@media (min-width: 1440px) { .user-panes { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.reward-amounts select { display: block; width: 100%; margin-top: 4px; }
.live-pill.quiet i { background: var(--faint); animation: none; }

/* R24: a teacher's own view - students, reviews, activity, their profile; no lessons */
.teacher-mode .users-work { display: block; }
.teacher-mode .user-panes, .teacher-mode .overview-cta[data-view="overview"] { display: none; }
body.is-teacher #me-choices, body.is-teacher [data-view="memory"], body.is-teacher #reward-strip { display: none !important; }

/* R24: the voucher code box copies on tap; a small copy icon says so */
.rw-code.revealed { display: flex; align-items: center; justify-content: center; gap: 12px; cursor: copy; }
.rw-copy { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); }
.rw-copy svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rw-code.copied .rw-copy { background: var(--ok); border-color: var(--ok); color: #fff; }

/* R24: the admin's language choice is a dropdown (its own class: the onboarding grid is .lang-pick) */
.lang-dd { position: relative; margin: 4px 0 10px; }
.lang-dd > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); cursor: pointer; list-style: none; }
.lang-dd > summary::-webkit-details-marker { display: none; }
.lang-dd > summary span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang-dd[open] > summary { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.lang-dd[open] > summary .chev { transform: rotate(180deg); }
.lang-dd__panel { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 6px); padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 12px 32px rgba(23, 26, 43, .14); }
.lang-dd .checks { display: grid; grid-template-columns: 1fr; gap: 2px; max-height: 280px; overflow: auto; }
.lang-dd .check { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 8px; border-radius: 9px; }
.lang-dd .check:hover { background: var(--surface-2); }
.lang-dd [data-save-langs] { width: 100%; margin-top: 8px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 18px; height: 18px; }
.lang-dd .check { justify-content: flex-start; text-align: left; }
body.is-teacher .tabbar [data-tab="me"] { order: 9; }

/* R26: the captions keep their room; when the translation line appears, the voice line in the middle gives way
   (and the rest moves down), so the translation never covers the newest words */
.voice-visualizer { flex: 1 1 190px; max-height: 190px; min-height: 24px; }
.caption-stage { flex: 0 0 auto; min-height: 150px; max-height: 230px; }
.caption-translation { margin-top: 6px; }

/* R27: the lesson header is its own layer above the glow and the birds; the Translate button stays crisp on it */
.view.app > header { position: relative; z-index: 8; isolation: isolate; }
.translate-toggle { position: relative; z-index: 1; box-shadow: 0 0 0 3px var(--bg); }
