/* RepeatLang — one stylesheet for the app and the legal pages. Dark by default; light via data-theme. */
:root {
  --bg: #09090b;
  --surface: #131317;
  --surface-2: #1b1b21;
  --surface-3: #26262e;
  --card: linear-gradient(180deg, rgb(255 255 255 / 4.6%), rgb(255 255 255 / 1.9%));
  --card-shadow: inset 0 0 0 1px rgb(255 255 255 / 6.5%), inset 0 1px 0 rgb(255 255 255 / 5%);
  --hover: rgb(255 255 255 / 4%);
  --line: rgb(255 255 255 / 7%);
  --line-2: rgb(255 255 255 / 11%);
  --track: rgb(255 255 255 / 9%);
  --ink: #f4f4f6;
  --ink-2: #c9c9d2;
  --muted: #8b8b97;
  --faint: #5a5a65;
  --accent: #6e5ff7;
  --accent-ink: #b3abff;
  --accent-soft: rgb(124 112 255 / 14%);
  --accent-glow: rgb(110 95 247 / 50%);
  --iris: linear-gradient(180deg, #8476ff, #5f4ef2);
  --grad: linear-gradient(100deg, #c9c2ff 0%, #8f80ff 45%, #67c3ff 100%);
  --iris-hover: linear-gradient(180deg, #8f82ff, #6857f6);
  --on-accent: #ffffff;
  --good: #34d399;
  --good-ink: #5fe3b0;
  --good-soft: rgb(52 211 153 / 14%);
  --on-good: #03140c;
  --danger: #ff6369;
  --scrim: rgb(0 0 0 / 62%);
  --shadow-lg: 0 30px 80px rgb(0 0 0 / 60%), 0 0 0 1px var(--line);
  --aurora-1: rgb(110 95 247 / 19%);
  --aurora-2: rgb(56 132 255 / 8%);
  --radius: 22px;
  --radius-md: 15px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --spring: cubic-bezier(.3, 1.4, .6, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f6f6f8;
  --surface: #ffffff;
  --surface-2: #f0f0f4;
  --surface-3: #e5e5ec;
  --card: linear-gradient(180deg, #ffffff, #fdfdff);
  --card-shadow: inset 0 0 0 1px rgb(20 20 50 / 7%), 0 1px 2px rgb(20 20 50 / 4%), 0 10px 30px -18px rgb(20 20 50 / 16%);
  --hover: rgb(20 20 50 / 3.5%);
  --line: rgb(16 16 40 / 8%);
  --line-2: rgb(16 16 40 / 12%);
  --track: rgb(16 16 40 / 8%);
  --ink: #0c0c12;
  --ink-2: #33333d;
  --muted: #6a6a76;
  --faint: #a4a4ae;
  --accent: #5b4cf0;
  --accent-ink: #4a3ad8;
  --accent-soft: rgb(91 76 240 / 10%);
  --accent-glow: rgb(91 76 240 / 38%);
  --iris: linear-gradient(180deg, #6f60fa, #5241ea);
  --grad: linear-gradient(100deg, #4a3ad8 0%, #6b4ff0 50%, #1f7fd6 100%);
  --iris-hover: linear-gradient(180deg, #7a6cff, #5b4bf0);
  --good: #10a971;
  --good-ink: #0b8a5c;
  --good-soft: rgb(16 169 113 / 11%);
  --on-good: #ffffff;
  --danger: #dc3c43;
  --scrim: rgb(20 20 40 / 32%);
  --shadow-lg: 0 30px 80px rgb(20 20 50 / 18%), 0 0 0 1px var(--line);
  --aurora-1: rgb(91 76 240 / 11%);
  --aurora-2: rgb(56 132 255 / 7%);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --bg: #f6f6f8;
    --surface: #ffffff;
    --surface-2: #f0f0f4;
    --surface-3: #e5e5ec;
    --card: linear-gradient(180deg, #ffffff, #fdfdff);
    --card-shadow: inset 0 0 0 1px rgb(20 20 50 / 7%), 0 1px 2px rgb(20 20 50 / 4%), 0 10px 30px -18px rgb(20 20 50 / 16%);
    --hover: rgb(20 20 50 / 3.5%);
    --line: rgb(16 16 40 / 8%);
    --line-2: rgb(16 16 40 / 12%);
    --track: rgb(16 16 40 / 8%);
    --ink: #0c0c12;
    --ink-2: #33333d;
    --muted: #6a6a76;
    --faint: #a4a4ae;
    --accent: #5b4cf0;
    --accent-ink: #4a3ad8;
    --accent-soft: rgb(91 76 240 / 10%);
    --accent-glow: rgb(91 76 240 / 38%);
    --iris: linear-gradient(180deg, #6f60fa, #5241ea);
    --grad: linear-gradient(100deg, #4a3ad8 0%, #6b4ff0 50%, #1f7fd6 100%);
    --iris-hover: linear-gradient(180deg, #7a6cff, #5b4bf0);
    --good: #10a971;
    --good-ink: #0b8a5c;
    --good-soft: rgb(16 169 113 / 11%);
    --on-good: #ffffff;
    --danger: #dc3c43;
    --scrim: rgb(20 20 40 / 32%);
    --shadow-lg: 0 30px 80px rgb(20 20 50 / 18%), 0 0 0 1px var(--line);
    --aurora-1: rgb(91 76 240 / 11%);
    --aurora-2: rgb(56 132 255 / 7%);
    color-scheme: light;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); transition: background-color .3s; }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
/* Ambient light behind everything: two soft gradients drifting slowly. Transform-only, so it costs no repaints. */
body::before {
  content: ""; position: fixed; z-index: -1; left: -15%; right: -15%; top: -20%; height: 75vh; pointer-events: none;
  background:
    radial-gradient(38% 48% at 28% 30%, var(--aurora-1), transparent 70%),
    radial-gradient(34% 42% at 78% 18%, var(--aurora-2), transparent 70%);
  animation: drift 26s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: translate3d(4%, 3%, 0) scale(1.08); } }
::selection { background: var(--accent-soft); color: var(--ink); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
button:disabled { cursor: default; }
a { color: inherit; }
img, svg { display: block; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 3px; border-radius: 10px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.i { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.i-fill { fill: currentColor; stroke: none; }
.eyebrow { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
/* Keyboard hints only where there is a keyboard and a mouse. */
kbd {
  display: none; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 6px;
  font: 600 11px/1 var(--font); color: var(--faint); box-shadow: inset 0 0 0 1px var(--line-2);
}
@media (hover: hover) and (pointer: fine) { kbd { display: inline-grid; } }

/* ---------- Buttons ---------- */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px;
  border-radius: var(--radius-md);
  background: var(--card); color: var(--ink);
  box-shadow: var(--card-shadow);
  font-weight: 600; font-size: 16px; letter-spacing: -.012em;
  text-decoration: none; user-select: none; -webkit-user-select: none;
  transition: transform .18s var(--ease), background .2s, box-shadow .25s, color .2s, opacity .2s, filter .2s;
}
.btn .i { width: 20px; height: 20px; }
@media (hover: hover) { .btn:hover:not([aria-disabled="true"]) { background: var(--hover); } }
.btn:active:not([aria-disabled="true"]), .btn.is-pressed { transform: scale(.97); }
.btn[aria-disabled="true"]:not(.is-pressed), .btn:disabled { opacity: .5; cursor: default; }
.btn-primary {
  background: var(--iris); color: var(--on-accent);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 22%), inset 0 0 0 1px rgb(255 255 255 / 6%), 0 12px 30px -12px var(--accent-glow);
}
@media (hover: hover) { .btn-primary:hover:not([aria-disabled="true"]) { background: var(--iris-hover); } }
.btn-primary kbd { color: rgb(255 255 255 / 70%); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 28%); }
.btn-plain { background: transparent; box-shadow: none; }
.btn-danger { background: var(--danger); color: #fff; box-shadow: none; }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 14px; border-radius: 12px; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px; color: var(--muted);
  transition: background-color .2s, color .2s, transform .15s var(--ease);
}
@media (hover: hover) { .icon-btn:hover { background: var(--hover); color: var(--ink); } }
.icon-btn:active { transform: scale(.92); }
.link-btn { color: var(--muted); font-weight: 500; font-size: 15px; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--line-2); }
.link-btn:hover { color: var(--ink); }

/* ---------- App frame ---------- */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.view { flex: 1; display: flex; flex-direction: column; animation: view-in .45s var(--ease-out) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }
.boot { flex: 1; display: grid; place-items: center; }
.boot .logo-mark { width: 52px; height: 52px; animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(.94); opacity: .6; } }

.topbar {
  display: flex; align-items: center; gap: 6px;
  width: 100%; max-width: 600px; margin: 0 auto;
  padding: calc(14px + var(--top)) 20px 6px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; margin-right: auto; text-decoration: none; font-family: var(--display); font-weight: 650; font-size: 17px; letter-spacing: -.03em; }
.brand .logo-mark { width: 28px; height: 28px; box-shadow: 0 6px 18px -6px var(--accent-glow); }
.brand b { font-weight: inherit; color: var(--muted); }
.logo-mark { border-radius: 30%; }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 99px; font-size: 10px; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; }
.pill-preview { color: var(--accent-ink); background: var(--accent-soft); }
/* A longer translation must never push the header buttons off a narrow phone. */
.topbar .pill { flex: 0 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; display: block; line-height: 22px; }
.streak { display: inline-flex; align-items: center; gap: 4px; height: 32px; margin: 0 2px; padding: 0 11px 0 8px; border-radius: 99px; font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.streak .i { width: 17px; height: 17px; color: var(--faint); }
.streak.is-lit { color: var(--ink); }
.streak.is-lit .i { color: var(--accent-ink); filter: drop-shadow(0 0 6px var(--accent-glow)); }
.streak.is-bump .i { animation: flame-bump .9s var(--spring); }
@keyframes flame-bump { 35% { transform: scale(1.4) rotate(-6deg); } 70% { transform: scale(.96); } }

/* ---------- Home ---------- */
.home { width: 100%; max-width: 600px; margin: 0 auto; padding: 0 20px 20px; }
.hero { padding: clamp(10px, 3.5vh, 64px) 2px clamp(18px, 3vh, 34px); }
.hero h1 { margin: 0; font-family: var(--display); font-size: clamp(44px, 12vw, 68px); line-height: .96; letter-spacing: -.055em; font-weight: 600; }
.hero p { margin: 10px 0 0; color: var(--muted); font-size: 17px; letter-spacing: -.012em; max-width: 32ch; }

.feature {
  position: relative; overflow: hidden; isolation: isolate;
  padding: 18px 18px 16px; border-radius: 24px;
  background: var(--card); box-shadow: var(--card-shadow), 0 30px 70px -40px var(--accent-glow);
  animation: rise .6s var(--ease-out) both;
}
.feature::before {
  content: ""; position: absolute; z-index: -1; top: -60%; right: -30%; width: 80%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 68%);
}
.feature-top { display: flex; align-items: center; justify-content: space-between; }
.feature-top .eyebrow { color: var(--accent-ink); }
.feature-pct { font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.feature-title { margin: 6px 0 1px; font-family: var(--display); font-size: 30px; line-height: 1.1; letter-spacing: -.04em; font-weight: 600; }
.feature-sub { margin: 0; color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }
.meter { position: relative; height: 4px; margin: 14px 0 16px; border-radius: 99px; background: var(--track); }
.meter > i, .bar > i {
  position: absolute; inset: 0 auto 0 0; width: calc(var(--p, 0) * 100%);
  border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-ink));
  transition: width .9s var(--ease-out);
}
/* A glowing head on the progress line, hidden at zero. */
.meter > i::after, .bar > i::after {
  content: ""; position: absolute; right: -3px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 2px var(--accent-soft), 0 0 12px 2px var(--accent-glow);
  opacity: clamp(0, calc(var(--p, 0) * 1000), 1);
}
.levels-head { margin: 24px 4px 8px; }
.levels { margin: 0; padding: 0; list-style: none; border-radius: var(--radius); background: var(--card); box-shadow: var(--card-shadow); overflow: hidden; }
.levels > li + li { box-shadow: inset 0 1px 0 var(--line); }
.level {
  position: relative;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px;
  width: 100%; min-height: 60px; padding: 8px 16px 8px 10px; text-align: left;
  transition: background-color .2s;
  animation: rise .6s var(--ease-out) both;
  animation-delay: calc(80ms + var(--n, 0) * 40ms);
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.is-quiet .level, .is-quiet .feature { animation: none; }
@media (hover: hover) { button.level:hover { background: var(--hover); } }
button.level:active { background: var(--hover); }
.level-body { min-width: 0; }
.level-title { display: block; font-weight: 600; font-size: 16px; letter-spacing: -.015em; }
.level-sub { display: block; margin-top: 1px; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.level-go { color: var(--faint); transition: transform .2s var(--ease), color .2s; }
.level-go .i { width: 18px; height: 18px; }
@media (hover: hover) { button.level:hover .level-go { transform: translateX(2px); color: var(--muted); } }
.level.is-current .level-title { color: var(--accent-ink); }
.level.is-soon .level-title { color: var(--muted); }
.level.is-soon .level-sub { color: var(--faint); }

/* Progress ring around the level code */
.ring { position: relative; display: grid; place-items: center; width: 42px; height: 42px; flex: none; }
.ring .ring-svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-svg circle { fill: none; stroke-width: 2.5; }
.ring .track { stroke: var(--track); }
.ring .arc { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 125.66; stroke-dashoffset: calc(125.66 * (1 - var(--p, 0))); transition: stroke-dashoffset 1s var(--ease-out); }
.ring.is-empty .arc { opacity: 0; }
.ring b { font-size: 13px; font-weight: 650; letter-spacing: -.01em; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.is-current .ring b { color: var(--accent-ink); }
.ring.is-done .arc { stroke: var(--good); }
.ring .i { width: 19px; height: 19px; stroke-width: 2.4; color: var(--good-ink); }
.is-soon .ring b { color: var(--faint); }

.foot { margin-top: auto; padding: 20px 20px calc(18px + var(--bottom)); display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; color: var(--faint); font-size: 13px; }
.foot a { text-decoration: none; color: var(--muted); }
.foot a:hover { color: var(--ink); }

/* ---------- Study ---------- */
.study {
  width: 100%; max-width: 640px; margin: 0 auto;
  height: 100dvh; display: flex; flex-direction: column;
  padding: 0 16px;
}
.study-top { display: flex; align-items: center; gap: 12px; height: calc(60px + var(--top)); padding-top: var(--top); flex: none; }
.study-top .icon-btn { margin-left: -8px; }
.study-top .icon-btn:last-child:not(:first-child) { margin: 0 -8px 0 -4px; }
.flag-button { flex: none; min-height: 38px; padding: 0 10px; gap: 6px; font-size: 13px; }
.flag-button .i { width: 17px; height: 17px; }
.study-head { flex: 1; min-width: 0; display: grid; gap: 8px; }
.study-label { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.study-label > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.study-label .pill { height: 17px; padding: 0 6px; font-size: 9px; }
.bar { position: relative; height: 3px; border-radius: 99px; background: var(--track); }
.bar.is-glow > i { animation: glow 1s var(--ease); }
@keyframes glow { 30% { filter: brightness(1.4); box-shadow: 0 0 14px var(--accent-glow); } }
.count { margin-left: auto; padding-left: 8px; font-size: 12px; font-weight: 600; letter-spacing: 0; font-variant-numeric: tabular-nums; color: var(--muted); }
.count.is-bump { animation: bump .5s var(--spring); color: var(--ink); }
@keyframes bump { 40% { transform: translateY(-2px) scale(1.12); } }

.stage { flex: none; display: grid; gap: 12px; }
.screen {
  /* YouTube requires an embedded player viewport of at least 200 × 200 px. */
  position: relative; aspect-ratio: 16 / 9; width: 100%; min-width: 200px; min-height: 200px; margin: 0 auto;
  border-radius: 18px; overflow: hidden; isolation: isolate;
  background: #000; box-shadow: 0 0 0 1px var(--line), 0 26px 60px -32px rgb(0 0 0 / 80%);
  transition: box-shadow .6s var(--ease);
}
/* While the clip plays, a little of its light spills under the frame. */
.study:has(.ctrl-main.is-playing) .screen { box-shadow: 0 0 0 1px var(--line-2), 0 30px 80px -34px var(--accent-glow); }
.screen > iframe, .screen > .yt { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.screen.needs-tap { box-shadow: 0 0 0 2px var(--accent), 0 0 40px -6px var(--accent-glow); animation: tap-pulse 1.6s ease-in-out infinite; }
@keyframes tap-pulse { 50% { box-shadow: 0 0 0 2px var(--accent-ink), 0 0 50px -2px var(--accent-glow); } }
.screen-cover {
  position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 14px;
  color: #fff; text-align: center; padding: 20px;
  background: radial-gradient(90% 80% at 50% 0%, rgb(110 95 247 / 26%), transparent 70%), #0b0b10;
}
.play-big {
  display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%;
  background: #fff; color: #0b0b10;
  box-shadow: 0 0 0 10px rgb(255 255 255 / 7%), 0 16px 40px rgb(0 0 0 / 50%);
  transition: transform .25s var(--spring), box-shadow .3s;
}
.play-big .i { width: 28px; height: 28px; margin-left: 3px; }
@media (hover: hover) { .screen-cover:hover .play-big { transform: scale(1.06); box-shadow: 0 0 0 14px rgb(255 255 255 / 9%), 0 16px 40px rgb(0 0 0 / 50%); } }
.screen-cover:active .play-big { transform: scale(.95); }
.screen-cover small { font-size: 13px; color: rgb(255 255 255 / 60%); }
.screen-cover h3 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.015em; }
.screen-cover .row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.screen-cover .btn { background: rgb(255 255 255 / 12%); color: #fff; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 14%); }
.screen-cover .btn-primary { background: #fff; color: #0b0b10; }
.skeleton { position: absolute; inset: 0; background: linear-gradient(100deg, #0e0e12 30%, #1a1a21 50%, #0e0e12 70%); background-size: 300% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.screen-loading {
  position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; align-content: center; gap: 14px;
  color: rgb(255 255 255 / 72%); text-align: center; padding: 20px;
  background: radial-gradient(90% 80% at 50% 0%, rgb(110 95 247 / 22%), transparent 70%), #0b0b10;
  transition: opacity .35s var(--ease);
}
.screen-loading.is-out { opacity: 0; pointer-events: none; }
.screen-loading small { font-size: 13px; letter-spacing: -.005em; }
.screen-loading small.is-new { animation: view-in .4s var(--ease-out); }
.spinner { width: 32px; height: 32px; border-radius: 50%; border: 2.5px solid rgb(255 255 255 / 12%); border-top-color: #b3abff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tap-hint { flex: 1; text-align: center; color: var(--accent-ink); font-weight: 600; font-size: 14px; animation: view-in .3s var(--ease-out); }
.meta.has-hint > :not(.tap-hint) { display: none; }

.meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 28px; color: var(--muted); font-size: 13px; }
.meta a { display: inline-flex; align-items: center; gap: 6px; min-width: 0; text-decoration: none; transition: color .2s; }
.meta a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta a:hover { color: var(--ink); }
.meta .i { width: 15px; height: 15px; }
.meta-src { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.pace { flex: none; display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px 0 7px; border-radius: 99px; font-size: 11px; font-weight: 600; letter-spacing: .02em; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.pace::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--good); box-shadow: 0 0 6px var(--good); }
.pace-normal::before { background: var(--accent-ink); box-shadow: 0 0 6px var(--accent-glow); }
.pace-fast { color: var(--accent-ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent); }
.pace-fast::before { background: #ff8fb1; box-shadow: 0 0 6px #ff8fb1; }
/* Transport: loop · replay · play · another voice · speed. Captions hang below without moving the buttons. */
.controls { display: flex; align-items: center; justify-content: center; gap: 22px; padding: 0 0 20px; }
.ctrl-item { position: relative; display: grid; place-items: center; }
/* Every caption on one line, whatever the size of its button. */
.ctrl-cap { position: absolute; top: calc(50% + 30px); left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 500; letter-spacing: .01em; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; pointer-events: none; }
.ctrl {
  position: relative; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
  color: var(--ink-2); background: var(--card); box-shadow: var(--card-shadow);
  transition: transform .18s var(--ease), color .2s, background .2s, box-shadow .2s, opacity .2s;
}
.ctrl .i { width: 20px; height: 20px; }
.ctrl-sm { width: 40px; height: 40px; }
.ctrl-sm .i { width: 18px; height: 18px; }
.ctrl-text { font-size: 12px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ctrl.is-on { color: var(--accent-ink); background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }
.ctrl-badge { position: absolute; bottom: -4px; right: -8px; display: none; place-items: center; height: 16px; padding: 0 5px; border-radius: 99px; font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); background: var(--surface-3); box-shadow: 0 0 0 2px var(--bg); }
@media (hover: hover) { .ctrl:hover:not([aria-disabled="true"]) { color: var(--ink); background: var(--hover); } }
.ctrl:active:not([aria-disabled="true"]) { transform: scale(.92); }
.ctrl[aria-disabled="true"] { opacity: .4; cursor: default; }
.ctrl[aria-disabled="true"] + .ctrl-cap { opacity: .6; }
.ctrl.is-flip .i { animation: flip .45s var(--ease-out); }
@keyframes flip { 40% { transform: scale(.82) rotate(-8deg); } }
.ctrl-main {
  width: 68px; height: 68px; color: var(--on-accent); background: var(--iris);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 24%), inset 0 0 0 1px rgb(255 255 255 / 7%), 0 14px 34px -12px var(--accent-glow);
}
@media (hover: hover) { .ctrl-main:hover:not([aria-disabled="true"]) { color: var(--on-accent); background: var(--iris-hover); } }
.ctrl-main .i { width: 26px; height: 26px; }
.ctrl-main .i-play { margin-left: 3px; }
.ctrl-icon { display: grid; place-items: center; transition: opacity .2s, transform .3s var(--spring); }
.ctrl-ring { position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); transform: rotate(-90deg); pointer-events: none; }
.ctrl-ring circle { fill: none; stroke: var(--accent-ink); stroke-width: 1.6; stroke-linecap: round; stroke-dasharray: 113.1; stroke-dashoffset: 113.1; opacity: 0; transition: opacity .3s; }
.ctrl-main.is-playing .ctrl-ring circle { opacity: .85; }
/* Waiting for a clip: the icon gives way to a spinner. */
.ctrl-main::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid rgb(255 255 255 / 28%); border-top-color: #fff;
  opacity: 0; transform: scale(.6); transition: opacity .2s, transform .3s var(--ease-out);
  animation: spin .75s linear infinite; pointer-events: none;
}
.ctrl-main.is-loading::after, .ctrl-main.is-buffering::after { opacity: 1; transform: scale(1); }
.ctrl-main.is-loading .ctrl-icon, .ctrl-main.is-buffering .ctrl-icon { opacity: 0; transform: scale(.5); }
.ctrl-main.is-loading .ctrl-ring circle, .ctrl-main.is-buffering .ctrl-ring circle { opacity: 0; }

/* Sentence panel: fills the remaining height, scrolls inside only if a long explanation needs it. */
.side { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding-top: 12px; }
.panel { flex: 1; min-height: 112px; display: flex; flex-direction: column; border-radius: var(--radius); background: var(--card); box-shadow: var(--card-shadow); overflow: hidden; }
.panel-body {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 16px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 16px), transparent);
  padding: 18px 20px 14px; display: flex; flex-direction: column;
}
/* Centred while it fits (auto margins fall to zero if it ever has to scroll). */
.panel-content { margin: auto 0; display: flex; flex-direction: column; gap: calc(12px * var(--fit, 1)); }
.reveal-bar { flex: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 6px; border-top: 1px solid var(--line); }
.chip {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  height: 44px; padding: 0 6px; border-radius: 13px;
  font-weight: 500; font-size: 14px; letter-spacing: -.01em; color: var(--ink-2); white-space: nowrap;
  transition: background-color .2s, color .2s, transform .15s var(--ease);
}
.chip .i { width: 18px; height: 18px; color: var(--muted); transition: color .2s; }
.chip kbd { margin-left: 1px; }
@media (hover: hover) { .chip:hover:not([aria-disabled="true"]) { background: var(--hover); color: var(--ink); } }
.chip:active:not([aria-disabled="true"]) { transform: scale(.96); }
.chip[aria-disabled="true"] { cursor: default; opacity: .45; }
/* Shown now: tinted. Opened before but not shown: only its icon keeps the accent. */
.chip.is-done .i { color: var(--accent-ink); }
.chip.is-active { color: var(--accent-ink); background: color-mix(in srgb, var(--accent) 10%, transparent); }

/* Each word is a bar until the words are shown. The bars and words fill along with the speech:
   --a is where a word starts in the sentence (0–1), --k is 1 / its length, --sweep is the spoken part. */
.es .w { --f: clamp(0, (var(--sweep, 0) - var(--a, 0)) * var(--k, 1), 1); }
.shapes { margin: 0; display: flex; flex-wrap: wrap; gap: .5em .28em; padding: .12em 0; font-size: calc(clamp(22px, 6vw, 28px) * var(--fit, 1)); }
.shapes i {
  --f: clamp(0, (var(--sweep, 0) - var(--a, 0)) * var(--k, 1), 1);
  display: block; width: calc(var(--n, 3) * .44em + .5em); height: .34em; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent-ink) calc(var(--f) * 112% - 12%), var(--track) calc(var(--f) * 112%));
  animation: shape-in .5s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 26ms);
}
.panel.is-playing .shapes i { box-shadow: 0 0 calc(var(--f) * 14px) calc(var(--f) * -2px) var(--accent-glow); }
@keyframes shape-in { from { opacity: 0; transform: scaleX(.4); } }

.reveal { animation: reveal-in .5s var(--ease-out) both; }
@keyframes reveal-in { from { opacity: 0; transform: translateY(6px); filter: blur(4px); } }
.es { margin: 0; font-family: var(--display); font-size: calc(clamp(22px, 6vw, 28px) * var(--fit, 1)); line-height: 1.22; font-weight: 600; letter-spacing: -.028em; }
.es .w { display: inline-block; animation: word-in .5s var(--ease-out) both; animation-delay: calc(var(--i) * 32ms); }
/* While it plays, the words light up as they are (about to be) spoken. */
.panel.is-playing .es .w {
  background: linear-gradient(90deg, var(--ink) calc(var(--f) * 112% - 12%), var(--muted) calc(var(--f) * 112%));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
@keyframes word-in { from { opacity: 0; transform: translateY(5px); filter: blur(3px); } }
.en { margin: 0; font-size: calc(17px * var(--fit, 1)); line-height: 1.42; color: var(--muted); letter-spacing: -.012em; }
.es:not([hidden]) + .en { padding-top: calc(12px * var(--fit, 1)); border-top: 1px solid var(--line); }
.why { margin: 0; font-size: calc(16.5px * var(--fit, 1)); line-height: 1.55; color: var(--ink-2); letter-spacing: -.01em; }

.answer-bar { flex: none; display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; padding: 0 0 calc(14px + var(--bottom)); }
.answer-bar .btn { min-height: 54px; padding: 0 14px; white-space: nowrap; }
.answer-bar kbd { margin-left: 2px; }
.ask { grid-column: 1 / -1; margin: 2px 0 -2px; text-align: center; font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: -.005em; }
.btn-later .i { color: var(--muted); }
.btn-good .label { display: inline-flex; align-items: center; gap: 8px; transition: opacity .15s; }
.btn-good.is-success { background: var(--good); color: var(--on-good); box-shadow: 0 0 0 6px var(--good-soft), 0 14px 34px -12px var(--good); }
.btn-good .ok { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; }
.btn-good .ok .i { width: 26px; height: 26px; stroke-width: 2.6; }
.btn-good .ok .i path { stroke-dasharray: 24; stroke-dashoffset: 24; }
.btn-good.is-success .label { opacity: 0; }
.btn-good.is-success .ok { opacity: 1; }
.btn-good.is-success .ok .i path { animation: draw .35s .05s var(--ease-out) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.slide-out { animation: slide-out .2s var(--ease) forwards; }
.slide-in { animation: slide-in .42s var(--ease-out) both; }
@keyframes slide-out { to { opacity: 0; transform: translateX(-14px); } }
@keyframes slide-in { from { opacity: 0; transform: translateX(14px); } }

/* ---------- Completion ---------- */
.done { position: relative; flex: 1; display: grid; place-items: center; padding: 40px 24px calc(40px + var(--bottom)); text-align: center; overflow: hidden; }
.done-inner { position: relative; z-index: 1; width: 100%; max-width: 380px; display: grid; justify-items: center; gap: 10px; }
.done-ring { position: relative; width: 132px; height: 132px; margin-bottom: 14px; display: grid; place-items: center; }
.done-ring svg.track { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.done-ring circle { fill: none; stroke-width: 4; }
.done-ring .t { stroke: var(--track); }
.done-ring .a { stroke: var(--good); stroke-linecap: round; stroke-dasharray: 389.6; stroke-dashoffset: 389.6; animation: ring-fill 1.1s .15s var(--ease-out) forwards; filter: drop-shadow(0 0 10px var(--good-soft)); }
@keyframes ring-fill { to { stroke-dashoffset: 0; } }
.done-ring > b { font-family: var(--display); font-size: 34px; font-weight: 600; letter-spacing: -.04em; animation: pop-in .6s .9s var(--spring) both; }
@keyframes pop-in { from { opacity: 0; transform: scale(.6); } }
.done h1 { margin: 6px 0 0; font-family: var(--display); font-size: clamp(30px, 8vw, 40px); line-height: 1.05; letter-spacing: -.045em; font-weight: 600; animation: rise .6s .3s var(--ease-out) both; }
.done p { margin: 0 0 18px; color: var(--muted); font-size: 17px; animation: rise .6s .4s var(--ease-out) both; }
.done .btn { width: 100%; animation: rise .6s .5s var(--ease-out) both; }
.done .link-btn { margin-top: 10px; animation: rise .6s .6s var(--ease-out) both; }
.done-glow { position: absolute; top: 18%; left: 50%; width: 420px; height: 420px; margin-left: -210px; border-radius: 50%; background: radial-gradient(circle, var(--good-soft), transparent 65%); animation: halo 4s ease-in-out infinite; pointer-events: none; }
@keyframes halo { 50% { transform: scale(1.12); opacity: .7; } }
.sparks { position: fixed; inset: 0; z-index: 50; pointer-events: none; width: 100%; height: 100%; }

/* ---------- Dialogs ---------- */
dialog {
  width: min(420px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  padding: 0; border: 0; border-radius: 26px;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: var(--scrim); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
dialog[open] { animation: pop .35s var(--ease-out); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.sheet { padding: 20px; display: grid; gap: 16px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin: -4px -6px -4px 0; }
.sheet h2 { margin: 0; font-family: var(--display); font-size: 22px; letter-spacing: -.035em; font-weight: 600; }
.sheet p { margin: 0; color: var(--muted); }
.rows { display: grid; border-radius: 16px; background: var(--surface-2); overflow: hidden; }
.row-item { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 14px; font-weight: 500; text-align: left; width: 100%; }
.rows > .row-item + .row-item { box-shadow: inset 0 1px 0 var(--line); }
@media (hover: hover) { button.row-item:hover { background: var(--surface-3); } }
.row-item .i { width: 20px; height: 20px; color: var(--muted); }
.row-item > span { flex: 1; }
.row-item.is-danger, .row-item.is-danger .i { color: var(--danger); }
.row-item .nowrap { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item .btn-sm { flex: none; min-height: 34px; padding: 0 12px; gap: 6px; font-size: 13px; }
.row-item .btn-sm .i { width: 16px; height: 16px; }
.row-item .btn-sm + .btn-sm { margin-left: -6px; }
.toggle { position: relative; width: 46px; height: 28px; flex: none; border-radius: 99px; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line); transition: background .25s; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgb(0 0 0 / 30%); transition: transform .3s var(--spring); }
[aria-checked="true"] > .toggle { background: var(--iris); }
[aria-checked="true"] > .toggle::after { transform: translateX(18px); }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 3px; border-radius: 14px; background: var(--surface-2); }
.segmented button { height: 38px; border-radius: 11px; font-size: 14px; font-weight: 500; color: var(--muted); transition: background-color .2s, color .2s; }
.segmented button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 20%), inset 0 0 0 1px var(--line); }
.label-sm { margin: 0 0 -8px 4px; font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.reasons { display: flex; flex-wrap: wrap; gap: 8px; }
.flag-reasons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.flag-reasons .flag-reason { min-height: 46px; height: auto; padding: 8px 10px; border-radius: 12px; font-size: 13px; line-height: 1.25; }
.flag-review-list { max-height: 35vh; overflow: auto; padding: 12px; display: grid; gap: 16px; }
.flag-review-entry { display: grid; gap: 8px; overflow-wrap: anywhere; font-size: 12px; user-select: text; }
.flag-review-entry .btn { justify-self: start; }
.reason { height: 36px; padding: 0 14px; border-radius: 99px; font-size: 14px; font-weight: 500; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-2); transition: background-color .2s, color .2s, box-shadow .2s; }
.reason[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent); }
.note { width: 100%; height: 46px; padding: 0 14px; border: 0; border-radius: 12px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); font-size: 16px; }
.note:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.sheet p b { color: var(--ink); font-weight: 600; }
.sheet-links { display: flex; gap: 18px; justify-content: center; font-size: 13px; color: var(--faint); }
.sheet-links a { color: var(--muted); text-decoration: none; }
.sheet-actions { display: grid; gap: 8px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(92px + var(--bottom)); z-index: 70; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { max-width: 420px; padding: 10px 16px; border-radius: 99px; background: var(--surface-3); color: var(--ink); font-weight: 500; font-size: 14px; box-shadow: 0 12px 30px rgb(0 0 0 / 30%), inset 0 0 0 1px var(--line-2); animation: toast-in .4s var(--ease-out); }
.toast.is-out { animation: fade-down .3s ease forwards; }
.toast-action { pointer-events: auto; margin-left: 12px; color: var(--accent-ink); text-decoration: underline; font-weight: 700; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes fade-down { to { opacity: 0; transform: translateY(6px); } }

/* ---------- Message screens ---------- */
.message { flex: 1; display: grid; place-items: center; padding: 40px 24px; text-align: center; }
.message-inner { max-width: 360px; display: grid; justify-items: center; gap: 10px; }
.message h1 { margin: 10px 0 0; font-family: var(--display); font-size: 26px; letter-spacing: -.035em; font-weight: 600; }
.message p { margin: 0 0 14px; color: var(--muted); font-size: 16px; }
.message .logo-mark { width: 52px; height: 52px; }

/* ---------- Legal pages ---------- */
.doc { width: 100%; max-width: 640px; margin: 0 auto; padding: 8px 22px 56px; }
.doc h1 { font-family: var(--display); font-size: clamp(34px, 8vw, 46px); line-height: 1.04; letter-spacing: -.05em; font-weight: 600; margin: 28px 0 8px; }
.doc .updated { color: var(--faint); font-size: 14px; margin: 0 0 32px; }
.doc h2 { font-size: 17px; letter-spacing: -.015em; font-weight: 600; margin: 32px 0 6px; }
.doc p, .doc li { color: var(--ink-2); font-size: 16px; line-height: 1.7; }
.doc ul { padding-left: 22px; }
.doc a { color: var(--accent-ink); text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--accent-ink) 40%, transparent); }

/* Home: what the course holds, and one obvious way in. The tap on Start also starts the sound. */
.hero-stats { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 0; padding: 0; list-style: none; animation: rise .6s .08s var(--ease-out) both; }
.hero-stats li { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 11px; border-radius: 99px; font-size: 13px; font-weight: 500; color: var(--muted); background: var(--card); box-shadow: inset 0 0 0 1px var(--line-2); }
.hero-stats b { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.btn-start { min-height: 56px; font-size: 17px; overflow: hidden; }
.btn-start .i { width: 17px; height: 17px; }
/* A slow light passing over the main button, now and then. */
.btn-start::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(110deg, transparent 38%, rgb(255 255 255 / 20%) 50%, transparent 62%) no-repeat;
  background-size: 260% 100%; background-position: 130% 0;
  animation: sheen 4.2s ease-in-out 1.4s infinite;
}
@keyframes sheen { 0%, 62% { background-position: 130% 0; } 100% { background-position: -30% 0; } }
.feature-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 10px 0 -2px; font-size: 12.5px; color: var(--muted); }
.feature-note .i { width: 15px; height: 15px; color: var(--faint); }

/* ---------- Layout variants ---------- */
/* Short phones: the whole home screen still fits without scrolling. */
@media (max-height: 740px) {
  .topbar { padding-top: calc(10px + var(--top)); }
  .hero { padding: 4px 2px 16px; }
  .hero p { display: none; }
  .feature-title { font-size: 26px; }
  .meter { margin: 12px 0 14px; }
  .feature .btn { min-height: 48px; }
  .levels-head { margin: 18px 4px 6px; }
  .level { min-height: 52px; padding-top: 6px; padding-bottom: 6px; }
  .level-title, .level-sub { line-height: 1.3; }
  .feature-sub { display: none; }
  .ring { width: 38px; height: 38px; }
  .foot { padding: 12px 20px calc(10px + var(--bottom)); }
}
/* Shorter screens: no captions; the voice count moves onto its button. */
@media (max-height: 780px) {
  .ctrl-cap { display: none; }
  .ctrl-badge { display: grid; }
  .controls { padding-bottom: 0; }
}
/* Compact mode, set by the lesson only when the text would not fit otherwise. */
.study.is-dense .stage { gap: 8px; }
.study.is-dense .meta:not(.has-hint) { display: none; }
.study.is-dense .ask { font-size: 12px; margin-bottom: -4px; }
.study.is-dense .ctrl-cap { display: none; }
.study.is-dense .ctrl-badge { display: grid; }
.study.is-dense .controls { padding-bottom: 0; gap: 18px; }
.study.is-dense .ctrl { width: 42px; height: 42px; }
.study.is-dense .ctrl-sm { width: 36px; height: 36px; }
.study.is-dense .ctrl-main { width: 54px; height: 54px; }
.study.is-dense .side { padding-top: 8px; gap: 8px; }
.study.is-dense .panel-body { padding: 14px 16px 10px; }
.study.is-dense .reveal-bar .chip { height: 40px; }
@media (max-height: 640px) {
  .study-top { height: calc(52px + var(--top)); }
  .stage { gap: 8px; }
  .controls { gap: 18px; padding: 0; }
  .ctrl { width: 44px; height: 44px; }
  .ctrl-sm { width: 38px; height: 38px; }
  .ctrl-main { width: 58px; height: 58px; }
  .side { padding-top: 8px; gap: 8px; }
  .panel-body { padding: 14px 16px 10px; gap: 8px; }
  .reveal-bar .chip { height: 40px; }
  .answer-bar .btn { min-height: 48px; }
  .answer-bar { gap: 8px; }
  .es, .shapes { font-size: calc(21px * var(--fit, 1)); }
}
@media (max-height: 600px) {
  .study-top { height: calc(46px + var(--top)); }
  .panel { min-height: 100px; }
  .ask { font-size: 12px; margin-bottom: -4px; }
}
/* Keep all three reveal labels readable in narrow windows, including laptops with a mouse. */
@media (max-width: 480px) { .reveal-bar kbd { display: none; } }
@media (max-width: 360px) {
  .hero-stats { gap: 5px; }
  .hero-stats li { height: 26px; padding: 0 8px; font-size: 12px; }
  .study-label .pill { display: none; }
  .answer-bar .btn:not(.btn-good) .i { display: none; }
  .chip { font-size: 13px; gap: 5px; }
  .chip .i { width: 16px; height: 16px; }
  .controls { gap: 13px; }
  .ctrl { width: 44px; height: 44px; }
  .ctrl-sm { width: 38px; height: 38px; }
  .ctrl-main { width: 60px; height: 60px; }
}
/* Wide screens: video on the left, the sentence and answers on the right, all in one view. */
@media (min-width: 960px) and (min-height: 560px) {
  .study {
    max-width: 1200px; padding: 0 32px;
    display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(360px, 1fr); grid-template-rows: auto minmax(0, 1fr);
    column-gap: 40px;
  }
  .study-top { grid-column: 1 / -1; height: calc(76px + var(--top)); }
  .stage { align-self: center; gap: 14px; padding-bottom: 40px; }
  .side { padding: 0 0 32px; align-self: stretch; max-height: 640px; margin: auto 0; height: 100%; }
  .panel-body { padding: 26px 26px 18px; }
  .es, .shapes { font-size: calc(32px * var(--fit, 1)); }
  .en { font-size: calc(18px * var(--fit, 1)); }
  .why { font-size: calc(17.5px * var(--fit, 1)); }
  .answer-bar { padding-bottom: 0; }
}
@media (min-width: 720px) {
  .topbar { padding-left: 24px; padding-right: 24px; }
}
/* Wide screens: the level to continue on the left, every level on the right. */
@media (min-width: 960px) and (min-height: 600px) {
  .topbar { max-width: 1040px; padding-left: 32px; padding-right: 32px; }
  .home {
    max-width: 1040px; flex: 1; padding: 0 32px 24px;
    display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); grid-template-areas: "hero head" "feature list";
    column-gap: 64px; align-content: center;
  }
  .hero { grid-area: hero; align-self: end; padding: 0 2px 28px; }
  .hero h1 { font-size: 76px; }
  .hero p { display: block; }
  .feature-slot { grid-area: feature; align-self: start; }
  .levels-head { grid-area: head; align-self: end; margin: 0 4px 10px; }
  .levels { grid-area: list; align-self: start; }
  .feature { padding: 24px 24px 22px; }
  .feature-title { font-size: 34px; }
  .feature-sub { display: block; }
}

/* Phones: the lesson header keeps the level name readable; Flag becomes an icon. */
@media (max-width: 480px) {
  .study-label .pill { display: none; }
  .flag-button { width: 40px; padding: 0; }
  .flag-button .flag-label { display: none; }
}
/* Phones on their side: video on the left, sentence and answers on the right, nothing scrolls. */
@media (orientation: landscape) and (max-height: 520px) and (min-width: 560px) {
  .study {
    max-width: none; height: 100dvh;
    padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
    display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(300px, 1fr); grid-template-rows: auto minmax(0, 1fr); column-gap: 20px;
  }
  .study-top { grid-column: 1 / -1; height: calc(46px + var(--top)); }
  .stage { align-self: center; gap: 8px; padding-bottom: calc(8px + var(--bottom)); }
  .screen { width: min(100%, calc((100dvh - 46px - var(--top) - 84px) * 16 / 9)); }
  .meta { display: none; }
  .ctrl-cap { display: none; }
  .ctrl-badge { display: grid; }
  .controls { gap: 14px; padding: 0; }
  .ctrl { width: 42px; height: 42px; }
  .ctrl-sm { width: 36px; height: 36px; }
  .ctrl-main { width: 54px; height: 54px; }
  .side { padding: 0 0 calc(8px + var(--bottom)); gap: 6px; }
  .panel { min-height: 0; }
  .panel-body { padding: 12px 16px 8px; }
  .reveal-bar .chip { height: 38px; }
  .answer-bar { padding-bottom: 0; gap: 8px; }
  .answer-bar .btn { min-height: 44px; }
  .ask { font-size: 12px; margin: 0 0 -4px; }
  .es, .shapes { font-size: calc(21px * var(--fit, 1)); }
}

/* ---------- First visit: what this is, how a lesson works, one button ---------- */
.landing { padding: clamp(6px, 3vh, 44px) 2px 0; }
/* The language switch sits right above Start free and spans its width. */
.landing .course-picker { display: flex; width: 100%; margin: 28px 0 12px; }
.landing .course-picker button { flex: 1; height: 40px; font-size: 15px; }
.landing .course-picker + .btn-hero { margin-top: 0; }
.title-rest { display: inline-block; text-wrap: balance; }
.landing-kicker { display: inline-flex; align-items: center; gap: 6px; height: 30px; margin: 0 0 18px; padding: 0 12px 0 10px; border-radius: 99px; background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgb(124 112 255 / 22%); color: var(--accent-ink); font-size: 13px; font-weight: 600; animation: rise .6s var(--ease-out) both; }
.landing-kicker .i { width: 14px; height: 14px; }
.landing-title { margin: 0; font-family: var(--display); font-size: calc(clamp(40px, 11vw, 68px) * var(--title-scale, 1)); line-height: .98; letter-spacing: -.055em; font-weight: 650; text-wrap: balance; animation: rise .7s .05s var(--ease-out) both; }
/* The course name: with several courses it flips to the next language, the new word rolling up into place. */
.flip { display: inline-grid; vertical-align: bottom; perspective: 600px; white-space: nowrap; transition: width .5s var(--ease-out); }
.flip > .flip-word { grid-area: 1 / 1; padding-bottom: .12em; margin-bottom: -.12em; filter: drop-shadow(0 6px 26px rgb(124 112 255 / 35%)); }
/* Each letter carries its slice of one gradient; letters rise in one after another and lift away the same way. */
.flip-ch { display: inline-block; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; backface-visibility: hidden; transform-origin: 50% 80%; }
.flip-word.is-in .flip-ch { animation: ch-in .75s var(--ease-out) both; animation-delay: calc(var(--i) * 38ms); }
.flip-word.is-out .flip-ch { animation: ch-out .42s var(--ease) forwards; animation-delay: calc(var(--i) * 22ms); }
@keyframes ch-in { from { opacity: 0; transform: translateY(.6em) rotateX(-85deg) scale(.9); filter: blur(7px); } 60% { filter: blur(0); } }
@keyframes ch-out { to { opacity: 0; transform: translateY(-.45em) rotateX(70deg) scale(.95); filter: blur(6px); } }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.landing-sub { margin: 18px 0 26px; max-width: 36ch; color: var(--muted); font-size: 18px; line-height: 1.5; letter-spacing: -.01em; text-wrap: pretty; animation: rise .7s .1s var(--ease-out) both; }
.btn-hero { min-height: 60px; font-size: 18px; border-radius: 18px; animation: rise .7s .15s var(--ease-out) both; }
.landing .btn-hero { margin-top: 30px; }
.landing .feature-note { margin-top: 12px; animation: rise .7s .2s var(--ease-out) both; }
/* Every level one tap away under the main button; the little meter shows how hard each one is. */
.level-pick { margin-top: 18px; container-type: inline-size; animation: rise .7s .18s var(--ease-out) both; }
.level-pick-head { margin: 0 2px 10px; color: var(--muted); font-size: 14px; font-weight: 600; text-align: center; }
/* Phones: A1 A2 B1 on top, B2 C1 below and wider so "Upper intermediate" fits; wide screens: one row. */
.level-pick-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; max-width: 560px; margin-inline: auto; }
.level-chip { grid-column: span 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 60px; padding: 9px 8px; border-radius: 16px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); text-align: center; transition: background-color .2s, transform .15s var(--ease); }
.level-chip:nth-child(n+4) { grid-column: span 3; }
.level-chip-top { display: flex; align-items: center; justify-content: center; gap: 8px; }
.level-chip b { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.level-chip-name { color: var(--muted); font-size: 12.5px; font-weight: 600; line-height: 1.2; }
.level-chip:active { transform: scale(.96); }
.level-chip.is-soon { opacity: .45; }
@media (hover: hover) { button.level-chip:hover { background: var(--hover); } }
@container (min-width: 520px) {
  .level-pick-row { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .level-chip, .level-chip:nth-child(n+4) { grid-column: auto; }
}
.level-chip-meter { display: inline-flex; align-items: flex-end; gap: 2px; height: 15px; }
.level-chip-meter i { width: 4px; border-radius: 1px; background: var(--line); }
.level-chip-meter i:nth-child(1) { height: 30%; }
.level-chip-meter i:nth-child(2) { height: 47%; }
.level-chip-meter i:nth-child(3) { height: 64%; }
.level-chip-meter i:nth-child(4) { height: 82%; }
.level-chip-meter i:nth-child(5) { height: 100%; }
.level-chip-meter i.on { background: var(--accent-ink); }
/* Short phones (and Safari's toolbars): keep the levels above the fold. */
@media (max-height: 720px) {
  .landing-kicker { margin-bottom: 12px; }
  .landing-sub { margin: 12px 0 18px; font-size: 16.5px; }
  .landing .btn-hero { margin-top: 22px; }
  .landing .course-picker { margin: 20px 0 10px; }
  .level-pick { margin-top: 14px; }
  .level-pick-head { margin-bottom: 8px; }
  .level-chip { min-height: 52px; padding: 7px 11px; gap: 3px; }
}

/* The lesson in one picture: a clip plays, the words light up, the meaning appears, Yes. Loops every 6 s. */
.demo { display: grid; place-items: center; margin: 34px 0 0; animation: rise .8s .25s var(--ease-out) both; }
.demo-phone { position: relative; width: min(100%, 330px); padding: 12px 12px 14px; border-radius: 30px; background: var(--card); box-shadow: var(--card-shadow), 0 40px 90px -40px var(--accent-glow); animation: demo-float 7s ease-in-out infinite; }
@keyframes demo-float { 50% { transform: translateY(-6px); } }
.demo-video { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 19px;
  background: radial-gradient(120% 90% at 25% 15%, rgb(124 112 255 / 60%), transparent 60%), radial-gradient(90% 80% at 85% 95%, rgb(56 132 255 / 40%), transparent 60%), #0e0d1a; }
.demo-eq { display: flex; align-items: center; gap: 5px; height: 38%; }
.demo-eq i { width: 6px; height: 100%; border-radius: 3px; background: rgb(255 255 255 / 88%); animation: demo-eq .9s ease-in-out infinite alternate; }
.demo-eq i:nth-child(2) { animation-delay: -.35s; } .demo-eq i:nth-child(3) { animation-delay: -.7s; }
.demo-eq i:nth-child(4) { animation-delay: -.2s; } .demo-eq i:nth-child(5) { animation-delay: -.55s; }
@keyframes demo-eq { from { transform: scaleY(.22); } to { transform: scaleY(1); } }
.demo-bar { position: absolute; left: 12px; right: 12px; bottom: 10px; height: 3px; overflow: hidden; border-radius: 3px; background: rgb(255 255 255 / 22%); }
.demo-bar i { display: block; height: 100%; background: #fff; transform-origin: left; animation: demo-progress 6s linear infinite; }
@keyframes demo-progress { 0% { transform: scaleX(0); } 55%, 100% { transform: scaleX(1); } }
.demo-es { min-height: 1.2em; margin: 16px 4px 2px; font-family: var(--display); font-size: 25px; font-weight: 600; line-height: 1.2; letter-spacing: -.035em; }
.demo-es span { opacity: .2; animation: demo-word 6s var(--ease) infinite; animation-delay: calc(.4s + var(--i) * .3s); }
@keyframes demo-word { 0% { opacity: .2; } 4%, 90% { opacity: 1; } 100% { opacity: .2; } }
.demo-en { min-height: 1.5em; margin: 2px 4px 14px; color: var(--muted); font-size: 16px; opacity: 0; animation: demo-reveal 6s var(--ease-out) infinite; }
@keyframes demo-reveal { 0%, 38% { opacity: 0; transform: translateY(5px); filter: blur(3px); } 46%, 92% { opacity: 1; transform: none; filter: none; } 100% { opacity: 0; } }
.demo-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.demo-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 46px; border-radius: 14px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-2); font-size: 15px; font-weight: 600; }
.demo-btn .i { width: 17px; height: 17px; }
.demo-yes { background: var(--iris); color: var(--on-accent); box-shadow: none; animation: demo-yes 6s var(--ease) infinite; }
@keyframes demo-yes { 0%, 68% { transform: none; } 71% { transform: scale(.94); } 74%, 92% { transform: none; background: var(--good); color: var(--on-good); } }
.demo-tap { position: absolute; right: calc(25% - 18px); bottom: 20px; width: 36px; height: 36px; border-radius: 50%; background: rgb(255 255 255 / 55%); opacity: 0; pointer-events: none; animation: demo-tap 6s ease-out infinite; }
@keyframes demo-tap { 0%, 64% { opacity: 0; transform: scale(.4); } 68% { opacity: .9; transform: scale(.7); } 76%, 100% { opacity: 0; transform: scale(1.5); } }

/* Why it is easy: three plain reasons. */
.perks { display: grid; gap: 10px; margin: 34px 0 0; padding: 0; list-style: none; }
.perk { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 14px; align-items: start; padding: 16px; border-radius: var(--radius-md); background: var(--card); box-shadow: var(--card-shadow); }
.perk-icon { grid-row: span 2; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--accent-soft); color: var(--accent-ink); }
.perk-icon .i { width: 21px; height: 21px; }
.perk b { font-size: 16px; letter-spacing: -.015em; }
.perk > span:last-child { color: var(--muted); font-size: 14.5px; line-height: 1.45; }
@media (min-width: 720px) {
  .perks { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .perk { grid-template-columns: 1fr; padding: 20px; }
  .perk-icon { grid-row: auto; margin-bottom: 10px; }
}

/* Move progress: two clear choices, then numbered steps. */
.transfer .sheet-head h2 { flex: 1; }
.transfer .back-btn { margin-left: -10px; }
.choice { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; width: 100%; padding: 16px; border-radius: var(--radius-md); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); text-align: left; transition: background-color .2s, transform .15s var(--ease); }
@media (hover: hover) { .choice:hover { background: var(--surface-3); } }
.choice:active { transform: scale(.98); }
.choice-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: var(--accent-soft); color: var(--accent-ink); }
.choice b { display: block; font-size: 16.5px; letter-spacing: -.015em; }
.choice small { display: block; color: var(--muted); font-size: 14px; }
.choice > .i { width: 18px; height: 18px; color: var(--faint); }
.steps-big { gap: 18px; padding-left: 24px; }
.steps-big li { padding-left: 4px; }
.steps-big li::marker { color: var(--accent-ink); font-weight: 700; }
.steps-big b { display: block; margin-bottom: 8px; color: var(--ink); }
.steps-big span { display: block; color: var(--muted); }
.steps-big .step-or { margin-top: 6px; font-size: 14px; }
.code-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.code-actions .btn { gap: 6px; }
.code-actions .btn .i { width: 17px; height: 17px; }
.sheet .fine { font-size: 13.5px; }
.done-mark { display: grid; place-items: center; width: 64px; height: 64px; margin: 6px auto 0; border-radius: 50%; background: var(--good-soft); color: var(--good-ink); animation: pop-in .5s var(--spring) both; }
.done-mark .i { width: 30px; height: 30px; stroke-width: 2.4; }
.sheet .done-text { text-align: center; color: var(--ink-2); font-size: 17px; }

/* Usage statistics: one small card on Home until the learner answers. "No" is as easy as "Yes". */
.consent { margin: 22px 0 0; padding: 14px 16px; display: grid; gap: 12px; border-radius: var(--radius-md); background: var(--card); box-shadow: var(--card-shadow); font-size: 14px; color: var(--ink-2); transition: opacity .25s, transform .25s var(--ease); }
.consent p { margin: 0; }
.consent a { color: var(--muted); text-underline-offset: 3px; }
.consent-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.consent.is-out { opacity: 0; transform: translateY(6px); }
.home-link { display: block; margin: 18px auto 0; font-size: 14px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }

/* Language to learn, shown only when there is more than one course. */
.course-picker { display: inline-flex; flex-wrap: wrap; gap: 2px; margin: 0 0 14px; padding: 3px; border-radius: 14px; background: var(--surface-2); }
.course-picker button { height: 34px; padding: 0 14px; border-radius: 11px; font-size: 14px; font-weight: 500; color: var(--muted); transition: background-color .2s, color .2s; }
.course-picker button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 20%), inset 0 0 0 1px var(--line); }

/* Settings: app language, and the small note when sentence translations are not in that language yet. */
.select-wrap { position: relative; flex: none; max-width: 55%; }
.select-wrap::after { content: ""; position: absolute; top: 50%; right: 12px; width: 7px; height: 7px; border-right: 1.8px solid var(--muted); border-bottom: 1.8px solid var(--muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.row-select { max-width: 100%; height: 34px; padding: 0 32px 0 12px; border: 0; border-radius: 10px; background: var(--surface-3); color: var(--ink); font: inherit; font-size: 14px; -webkit-appearance: none; appearance: none; }
.row-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.row-note { padding: 0 14px 12px 46px; font-size: 13px; }
.row-item .i-chevronRight { width: 16px; height: 16px; color: var(--faint); }

/* Move progress: a code made here, entered on the other device. */
.transfer-result { display: grid; gap: 12px; }
.sheet .code-big { padding: 14px; border-radius: var(--radius-md); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); text-align: center; font: 650 clamp(22px, 7vw, 28px)/1.2 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .06em; -webkit-user-select: all; user-select: all; }
.code-input { text-align: center; text-transform: uppercase; letter-spacing: .08em; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.code-input::placeholder { color: var(--faint); letter-spacing: .08em; }
.sheet .transfer-status { font-size: 14px; color: var(--ink-2); }
.transfer-status:empty { display: none; }
.steps { margin: 0; padding: 0 0 0 22px; display: grid; gap: 10px; color: var(--ink-2); }
.steps .i { width: 18px; height: 18px; vertical-align: -3px; color: var(--accent-ink); }

/* Owner stats page (/admin). Same tokens as the app; numbers in tabular figures. */
.adm { width: 100%; max-width: 1120px; margin: 0 auto; padding: 4px 20px 48px; display: grid; gap: 16px; }
.adm-body { display: grid; gap: 16px; transition: opacity .2s; }
.adm.is-loading .adm-body { opacity: .55; }
.adm-gate { width: 100%; max-width: 360px; margin: 12vh auto 0; display: grid; gap: 12px; }
.adm-gate h1, .adm-hero b { font-family: var(--font); }
.adm-gate h1 { margin: 0 0 4px; font-size: 28px; letter-spacing: -.03em; }
.adm-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.adm-ranges { grid-template-columns: repeat(5, auto); }
.adm-ranges button { padding: 0 12px; }
.adm-bar .btn-sm { gap: 6px; }
.adm-bar .btn-sm .i { width: 16px; height: 16px; }
.adm-status, .adm-note, .adm-empty { margin: 0; font-size: 13px; color: var(--muted); }
.adm-hero { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.adm-hero b { font-size: 56px; font-weight: 650; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.adm-hero > span { font-size: 18px; color: var(--ink-2); }
.adm-hero p { flex-basis: 100%; }
.adm-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.adm-tile { display: grid; gap: 4px; padding: 14px; border-radius: var(--radius-md); background: var(--card); box-shadow: var(--card-shadow); }
.adm-tile span { font-size: 13px; color: var(--muted); }
.adm-tile b { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.adm-card { min-width: 0; display: grid; gap: 12px; align-content: start; padding: 16px; border-radius: var(--radius); background: var(--card); box-shadow: var(--card-shadow); }
.adm-card h2 { margin: 0; font-size: 15px; font-weight: 600; }
.adm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 16px; align-items: start; }
.adm-chart { position: relative; min-height: 200px; }
.adm-chart svg { display: block; width: 100%; height: auto; border-radius: 8px; }
.adm-chart svg:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.adm-chart .bar { fill: var(--accent); }
.adm-chart .bar.is-hot { filter: brightness(1.2); }
.adm-chart .grid { stroke: var(--line); stroke-width: 1; }
.adm-chart text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.adm-tip { position: absolute; z-index: 2; display: grid; gap: 2px; padding: 8px 10px; border-radius: 10px; background: var(--surface-3); box-shadow: var(--shadow-lg); font-size: 12.5px; color: var(--muted); white-space: nowrap; pointer-events: none; transform: translate(-50%, calc(-100% - 10px)); }
.adm-tip b { font-size: 15px; color: var(--ink); }
.adm-details summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.adm-details[open] summary { margin-bottom: 8px; }
.adm-table-wrap { overflow-x: auto; }
.adm table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.adm th { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.adm td { padding: 7px 8px; border-bottom: 1px solid var(--line); color: var(--ink-2); vertical-align: top; }
.adm .num { text-align: right; white-space: nowrap; }
.adm-sub { display: block; color: var(--muted); font-size: 12px; }
.adm td a { color: var(--accent-ink); }
.adm-list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; font-size: 13.5px; }
.adm-list li { position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(0, 1fr) auto 3.2em; gap: 10px; align-items: center; padding: 5px 8px; }
.adm-list li::before { content: ""; position: absolute; inset: 0 auto 0 0; z-index: -1; width: calc(var(--w, 0) * 100%); border-radius: 6px; background: var(--accent-soft); }
.adm-list .name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--ink-2); }
.adm-list b { font-weight: 600; }
.adm-list .share { text-align: right; color: var(--muted); }

@media (min-width: 960px) and (min-height: 600px) {
  .home.is-landing {
    grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr);
    grid-template-areas: "copy demo" "perks perks" "head head" "list list" "consent consent" "link link";
    align-content: start; padding-top: 4vh;
  }
  .is-landing .landing { grid-area: copy; align-self: center; padding: 0 2px; }
  .is-landing .demo { grid-area: demo; margin: 0; }
  .is-landing .demo-phone { width: 350px; }
  .is-landing .perks { grid-area: perks; margin-top: 64px; }
  .is-landing .levels-head { grid-area: head; width: 100%; max-width: 680px; justify-self: center; margin: 56px 0 10px; padding: 0 4px; }
  .is-landing .levels { grid-area: list; width: 100%; max-width: 680px; justify-self: center; }
  .is-landing .consent { grid-area: consent; width: 100%; max-width: 680px; justify-self: center; }
  .is-landing .home-link { grid-area: link; }
}

/* ---------- Finish: texture, light and depth. Quiet by design: nothing moves on its own except the ambient light. ---------- */
/* Each level has its own colour, used wherever the level appears. */
[data-level="A1"] { --tone: #5fe3b0; }
[data-level="A2"] { --tone: #4fd3e6; }
[data-level="B1"] { --tone: #6aa8ff; }
[data-level="B2"] { --tone: #a193ff; }
[data-level="C1"] { --tone: #e98af7; }
:root[data-theme="light"] [data-level="A1"] { --tone: #0f9f6e; }
:root[data-theme="light"] [data-level="A2"] { --tone: #0b8ca6; }
:root[data-theme="light"] [data-level="B1"] { --tone: #2f6fe0; }
:root[data-theme="light"] [data-level="B2"] { --tone: #5b4cf0; }
:root[data-theme="light"] [data-level="C1"] { --tone: #b33aa2; }
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] [data-level="A1"] { --tone: #0f9f6e; }
  :root[data-theme="auto"] [data-level="A2"] { --tone: #0b8ca6; }
  :root[data-theme="auto"] [data-level="B1"] { --tone: #2f6fe0; }
  :root[data-theme="auto"] [data-level="B2"] { --tone: #5b4cf0; }
  :root[data-theme="auto"] [data-level="C1"] { --tone: #b33aa2; }
}

/* Film grain over the ambient light: fixed, static, a few percent. */
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
:root[data-theme="light"] body::after { opacity: .035; mix-blend-mode: multiply; }
/* A third, warmer light low on the page. */
body::before {
  background:
    radial-gradient(38% 48% at 28% 30%, var(--aurora-1), transparent 70%),
    radial-gradient(34% 42% at 78% 18%, var(--aurora-2), transparent 70%),
    radial-gradient(30% 38% at 62% 78%, rgb(233 138 247 / 6%), transparent 70%);
}

/* The course name glows a little, like the light it is lit by. */
.landing-kicker { background: linear-gradient(90deg, var(--accent-soft), rgb(103 195 255 / 10%)); }

/* Main button: deeper light, and a single soft sheen when you point at it. */
.btn-hero { overflow: hidden; isolation: isolate;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 26%), inset 0 0 0 1px rgb(255 255 255 / 8%), 0 18px 46px -16px var(--accent-glow), 0 2px 6px -2px rgb(0 0 0 / 40%); }
.btn-hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgb(255 255 255 / 26%) 48%, transparent 66%);
  transform: translateX(-120%); transition: transform .9s var(--ease-out);
}
@media (hover: hover) {
  .btn-hero:hover:not([aria-disabled="true"]) { transform: translateY(-1px); box-shadow: inset 0 1px 0 rgb(255 255 255 / 30%), inset 0 0 0 1px rgb(255 255 255 / 10%), 0 24px 56px -16px var(--accent-glow), 0 2px 6px -2px rgb(0 0 0 / 40%); }
  .btn-hero:hover::after { transform: translateX(120%); }
}

/* Level tiles: each lit in its level's colour. */
.level-chip {
  background: linear-gradient(180deg, color-mix(in srgb, var(--tone, var(--accent)) 12%, transparent), transparent 75%), var(--surface-2);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone, var(--accent)) 18%, var(--line)), inset 0 1px 0 rgb(255 255 255 / 5%);
  transition: background-color .2s, transform .2s var(--ease), box-shadow .25s;
}
.level-chip-meter i.on { background: var(--tone, var(--accent-ink)); }
.level-chip b { background: linear-gradient(180deg, var(--ink), color-mix(in srgb, var(--ink) 70%, var(--tone, var(--accent)))); -webkit-background-clip: text; background-clip: text; color: transparent; }
@media (hover: hover) {
  button.level-chip:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone, var(--accent)) 55%, transparent), 0 14px 34px -16px color-mix(in srgb, var(--tone, var(--accent)) 70%, transparent); }
}
button.level-chip:active { transform: scale(.96); }

/* The demo phone gets a thin lit edge. */
.demo-phone::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(160deg, rgb(255 255 255 / 22%), transparent 38%, transparent 62%, rgb(124 112 255 / 45%));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.perk-icon { background: linear-gradient(135deg, var(--accent-soft), rgb(103 195 255 / 12%)); box-shadow: inset 0 0 0 1px rgb(124 112 255 / 18%); }
@media (hover: hover) {
  .perk { transition: transform .25s var(--ease), box-shadow .25s; }
  .perk:hover { transform: translateY(-2px); box-shadow: var(--card-shadow), 0 18px 40px -24px var(--accent-glow); }
}

/* Home: progress rings and the next-level card in the level's colour. */
.level .ring .arc { stroke: var(--tone, var(--accent)); }
.feature[data-level] { box-shadow: var(--card-shadow), 0 30px 70px -40px color-mix(in srgb, var(--tone) 70%, transparent); }
.feature[data-level]::before { background: radial-gradient(circle, color-mix(in srgb, var(--tone) 16%, transparent), transparent 68%); }
.feature[data-level] .feature-top .eyebrow { color: var(--tone); }
.feature[data-level] .meter > i { background: linear-gradient(90deg, color-mix(in srgb, var(--tone) 70%, var(--accent)), var(--tone)); }

/* Encouragement: how close the next level is, in the level's colour; a streak nudge only when it would break. */
.meter.has-steps {
  background:
    radial-gradient(circle, var(--line-2) 0 1.6px, transparent 2px) 25% 50% / 6px 6px no-repeat,
    radial-gradient(circle, var(--line-2) 0 1.6px, transparent 2px) 50% 50% / 6px 6px no-repeat,
    radial-gradient(circle, var(--line-2) 0 1.6px, transparent 2px) 75% 50% / 6px 6px no-repeat,
    var(--track);
}
.feature .meter.has-steps { margin-bottom: 12px; }
.feature-goal { display: flex; align-items: center; gap: 7px; margin: 0 0 14px; font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; color: var(--ink-2); }
.feature-goal .i { width: 15px; height: 15px; color: var(--tone, var(--accent-ink)); filter: drop-shadow(0 0 6px color-mix(in srgb, var(--tone, var(--accent)) 60%, transparent)); }
.feature-streak { display: flex; align-items: center; gap: 7px; margin: -6px 0 14px; color: var(--muted); font-size: 13.5px; font-weight: 500; }
.feature-streak .i { width: 15px; height: 15px; color: #ff9f43; }
.toast-milestone { display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px 11px 14px; font-weight: 600;
  background: linear-gradient(var(--surface-3), var(--surface-3)) padding-box, var(--grad) border-box; border: 1px solid transparent;
  box-shadow: 0 16px 40px -12px var(--accent-glow), 0 12px 30px rgb(0 0 0 / 30%); }
.toast-milestone .i { width: 16px; height: 16px; flex: none; color: var(--accent-ink); }

/* One-time tip above the speaker button. */
/* Below the button, never over the official player. */
.coach { position: absolute; z-index: 5; top: calc(100% + 12px); left: 50%; transform: translateX(-72%); width: max-content; max-width: min(230px, 70vw);
  display: grid; gap: 8px; padding: 12px 14px; border-radius: 16px; text-align: left; font-size: 14px; font-weight: 500; line-height: 1.35; color: var(--ink);
  background: linear-gradient(var(--surface-3), var(--surface-3)) padding-box, var(--grad) border-box; border: 1px solid transparent;
  box-shadow: 0 18px 40px -12px var(--accent-glow), 0 10px 26px rgb(0 0 0 / 35%); animation: coach-in .45s var(--ease-out) both; }
.coach::after { content: ""; position: absolute; bottom: 100%; left: 72%; margin-left: -7px; border: 7px solid transparent; border-bottom-color: var(--surface-3); }
.coach-ok { justify-self: end; height: 30px; padding: 0 12px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; font-weight: 700; }
@keyframes coach-in { from { opacity: 0; transform: translateX(-72%) translateY(-6px); } }

/* Lesson: a lit edge on the player while it waits, a stronger one while it plays. */
.screen { box-shadow: 0 0 0 1px var(--line-2), 0 26px 60px -32px rgb(0 0 0 / 80%), 0 20px 60px -40px var(--accent-glow); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .demo-es span, .demo-en { opacity: 1; }
  .ctrl-main::after, .spinner { animation: spin .75s linear infinite !important; }
}
