@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&family=Barlow+Condensed:wght@400;500;600;700&family=Barlow:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap");

:root {
  /* ---- design tokens (PARA_visual_redesign_spec.md Part 1) - applied to
     Home/Range/Loading/Pool/Review below. The player screen (video chrome,
     captions, transport, gloss card) is explicitly OUT of scope here - it
     follows its own rules per the spec's Part 4 and is restyled together
     with the caption sweep in a later pass, using the legacy tokens
     further down this block in the meantime. */
  --green-500: #00A9B7;
  --green-600: #008C99;
  --green-50:  #E6F7F8;
  --amber-500: #F27A18;
  --orange:    #F27A18;
  --orange-600:#D96A10;
  --teal:      #00A9B7;
  --red-500:   #DC2626;
  --gold-400:  #F27A18;

  --ink:       #1B2144;
  --ink-soft:  #4A5168;
  --ink-faint: #8B90A3;
  --ink-faintest: #B4B8C5;
  --paper:     #FFF8EF;
  --card:      #FFFFFF;
  --line:      #F0E4D2;
  --line-soft: #F6EEE3;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-6: 24px;
  --sp-8: 32px;

  /* ---- legacy tokens - still used by the untouched player screen ---- */
  --white: #fff;
  --accent: #5980a6;
  --accent-strong: #416180;
  --accent-soft: #94bce3;
  --accent-tint: #eef6ff;
  --navy: #12212e;
  --navy-2: #1d2d3d;
  --card-blue: #b5d9fd;
  --karaoke-highlight: #ffcf5c;

  /* Karaoke overlay (mode A) subtitle restyle - user-requested follow-up
     to the Part 4 white/gold treatment: mid-to-dark blue text, orange
     active-word underline instead. Own tokens (not --accent or --gold-400)
     since neither existing family was actually asked for here. */
  --subtitle-blue: #1e3f78;
  --subtitle-orange: #ea580c;
}

* { box-sizing: border-box; }

/* Fluid root scale: barely moves for the viewports this app actually
   targets (phones cluster near vmin=390 regardless of orientation, desktop
   clamps at the max) but keeps every rem-based size below tied to a single
   knob, and degrades gracefully on a narrower phone than tested here.
   vmin (not vw) deliberately avoids the classic vw-based-type pitfall where
   a wide-but-short landscape phone would compute an oversized root purely
   from its width. */
html {
  font-size: clamp(15px, 2vmin + 8px, 16px);
  color-scheme: only light;
}

html, body {
  margin: 0;
  height: 100%;
  background: #E8DCC8;
  color: var(--ink);
  font-family: Nunito, system-ui, sans-serif;
  overflow-x: hidden;
}

/* Dark paper stays on the player only. Login / home / range / loading
   keep the cream splash paper so Android system dark-mode cannot turn
   the rest of the app into a black void. */
html.theme-dark #screen-player {
  color-scheme: dark;
  --ink: #E8DCC8;
  --ink-soft: #C4B49A;
  --ink-faint: #8F836F;
  --ink-faintest: #6A6154;
  --paper: #000000;
  --card: #161616;
  --line: #2A2A2A;
  --line-soft: #1C1C1C;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 0;
}

.mono { font-family: "IBM Plex Mono", monospace; }

/* #app-frame fills the real device viewport by default (this is what
   actually fixes "doesn't fit on a phone" - previously a fixed 860x400 box
   got shown zoomed out on any narrower screen). Desktop gets the original
   floating device-mockup look back above a width where that's meaningful. */
#app-frame {
  position: relative;
  width: 100%;
  height: 100dvh;
  background: var(--paper);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
@media (min-width: 56.25em) {
  body { padding: 1.5rem; }
  #app-frame {
    width: min(94vw, 860px);
    height: min(88vh, 520px);
    border-radius: var(--r-lg);
    box-shadow: 0 20px 50px rgba(20, 20, 22, 0.28);
  }
  /* The hub and pair step are vertical phone compositions. The short
     landscape mockup puts the glass pill on the bear's face and scrolls
     the pair step, so those two screens preview as a tall phone card. */
  #app-frame:has(#screen-language-hub.active),
  #app-frame:has(#screen-language.is-hub-pair.active) {
    width: min(94vw, 430px);
    height: min(94vh, 920px);
  }
}

.screen {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}
.screen.active { display: flex; }

/* Main-tab swipe peek. Library / Home / Study slide with the finger.
   Past the first or last tab the page only nudges, and the blocked edge
   lights a soft PARA orange valley (--tab-edge-glow: #f27a18): brightest
   at mid-height, gone toward the corners, stronger as the pull grows. */
#app-frame.tab-swipe-active {
  user-select: none;
  overscroll-behavior: none;
  background: var(--paper);
}
#app-frame.tab-swipe-active > .screen.tab-swipe-current,
#app-frame.tab-swipe-active > .screen.tab-swipe-incoming {
  display: flex;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: var(--paper);
  will-change: transform;
  transition: none;
  box-shadow: none;
  border: 0;
}
#app-frame.tab-swipe-active > .screen.tab-swipe-current {
  z-index: 7;
}
#app-frame.tab-swipe-active > .screen.tab-swipe-incoming {
  z-index: 6;
  pointer-events: none;
}
#app-frame.tab-swipe-settling > .screen.tab-swipe-current,
#app-frame.tab-swipe-settling > .screen.tab-swipe-incoming {
  transition: transform 340ms cubic-bezier(0.22, 0.82, 0.24, 1);
}
#app-frame.tab-swipe-settling.tab-swipe-rubber > .screen.tab-swipe-current {
  transition: transform 420ms cubic-bezier(0.22, 0.9, 0.3, 1);
}
.tab-edge-glow {
  --tab-edge-glow: #f27a18;
  position: absolute;
  top: 0;
  bottom: 0;
  width: min(22vw, 6.25rem);
  z-index: 15;
  pointer-events: none;
  opacity: 0;
  background-color: transparent;
  filter: blur(10px);
  transition: none;
}
#app-frame.tab-swipe-settling .tab-edge-glow {
  transition: opacity 460ms ease;
}
.tab-edge-glow[data-edge="left"] {
  left: 0;
  background:
    radial-gradient(ellipse 42% 22% at 0% 50%,
      rgba(242, 122, 24, 0.78) 0%,
      rgba(242, 122, 24, 0.2) 46%,
      transparent 74%),
    radial-gradient(ellipse 100% 38% at 0% 50%,
      rgba(242, 122, 24, 0.34) 0%,
      rgba(242, 122, 24, 0.08) 40%,
      transparent 68%);
}
.tab-edge-glow[data-edge="right"] {
  right: 0;
  background:
    radial-gradient(ellipse 42% 22% at 100% 50%,
      rgba(242, 122, 24, 0.78) 0%,
      rgba(242, 122, 24, 0.2) 46%,
      transparent 74%),
    radial-gradient(ellipse 100% 38% at 100% 50%,
      rgba(242, 122, 24, 0.34) 0%,
      rgba(242, 122, 24, 0.08) 40%,
      transparent 68%);
}
@media (prefers-reduced-motion: reduce) {
  #app-frame.tab-swipe-settling > .screen.tab-swipe-current,
  #app-frame.tab-swipe-settling > .screen.tab-swipe-incoming,
  #app-frame.tab-swipe-settling .tab-edge-glow {
    transition: none;
  }
}

.splash-screen {
  position: absolute; inset: 0; z-index: 20;
  background: #FFF8EF;
  align-items: center; justify-content: center;
  flex-direction: column; gap: 0.75rem;
  transition: opacity .4s ease;
}
.splash-screen.leaving { opacity: 0; pointer-events: none; }
.splash-mascot { width: min(42vw, 220px); height: auto; object-fit: contain; }
.splash-word {
  font: 800 2.75rem Nunito, sans-serif;
  letter-spacing: 0.08em;
  color: #1B2144;
}
.splash-dots { display: flex; gap: 0.45rem; }
.splash-dots span { width: 0.55rem; height: 0.55rem; border-radius: 50%; }
.splash-dots span:first-child { background: var(--orange); }
.splash-dots span:last-child { background: var(--teal); }

/* ---------- FIVE-SECOND PRODUCT DEMO ---------- */
.product-demo-screen {
  --demo-orange-ink: #B45309;
  --demo-teal-ink: #006C78;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(circle at 88% 18%, rgba(0, 169, 183, .14), transparent 30%),
    radial-gradient(circle at 8% 75%, rgba(242, 122, 24, .13), transparent 31%),
    #FFF8EF;
}
.product-demo-screen::before,
.product-demo-screen::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
}
.product-demo-screen::before {
  width: 11rem;
  height: 11rem;
  right: -5.8rem;
  top: 8.5rem;
  border: 1px solid rgba(0, 169, 183, .14);
  box-shadow: 0 0 0 1.4rem rgba(0, 169, 183, .035), 0 0 0 2.8rem rgba(0, 169, 183, .02);
}
.product-demo-screen::after {
  width: 8rem;
  height: 8rem;
  left: -4.5rem;
  bottom: 7rem;
  border: 1px solid rgba(242, 122, 24, .12);
  box-shadow: 0 0 0 1.2rem rgba(242, 122, 24, .03);
}
.product-demo-glow {
  position: absolute;
  z-index: -1;
  width: 10rem;
  height: 10rem;
  border-radius: 50%;
  filter: blur(2.7rem);
  opacity: .18;
  pointer-events: none;
}
.product-demo-glow-orange { left: -6rem; top: 38%; background: var(--orange); }
.product-demo-glow-teal { right: -6rem; bottom: 12%; background: var(--teal); }
.product-demo-body {
  width: min(100%, 34rem);
  min-height: 100%;
  margin: 0 auto;
  padding:
    calc(.85rem + var(--para-safe-top, env(safe-area-inset-top, 0px)))
    1.2rem
    calc(1rem + var(--para-safe-bottom, env(safe-area-inset-bottom, 0px)));
  display: flex;
  flex-direction: column;
  align-items: center;
}
.product-demo-brand {
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: .46rem;
  color: var(--ink);
}
.product-demo-brand > strong {
  font: 800 1.4rem/1 Nunito, sans-serif;
  letter-spacing: -.04em;
}
.product-demo-brand > span {
  color: var(--demo-teal-ink);
  font: 800 .58rem/1 Nunito, sans-serif;
  letter-spacing: .18em;
}
.product-demo-brand > em {
  margin-left: auto;
  padding: .38rem .55rem;
  border: 1px solid rgba(0, 108, 120, .18);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .72);
  color: var(--demo-teal-ink);
  font: normal 900 .58rem/1 Nunito, sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
  box-shadow: 0 .25rem .7rem rgba(27, 33, 68, .06);
}
.product-demo-brand > em i {
  display: inline-block;
  width: .42rem;
  height: .42rem;
  margin-right: .25rem;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 .18rem rgba(242, 122, 24, .16);
  vertical-align: -.02rem;
  animation: product-demo-live 1.2s infinite ease-in-out;
}
.product-demo-copy {
  flex: none;
  margin: clamp(.75rem, 2.4vh, 1.25rem) 0 .45rem;
  text-align: center;
}
.product-demo-kicker {
  margin-bottom: .32rem;
  color: var(--demo-orange-ink);
  font: 900 .62rem/1.15 Nunito, sans-serif;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.product-demo-copy h1 {
  margin: 0;
  color: var(--ink);
  font: 900 clamp(1.72rem, 7.2vw, 2.25rem)/1.04 Nunito, sans-serif;
  letter-spacing: -.04em;
  outline: none;
}
.product-demo-copy p {
  max-width: 20rem;
  margin: .4rem auto 0;
  color: var(--ink-soft);
  font: 700 .72rem/1.3 Nunito, sans-serif;
}
.product-demo-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  padding: .2rem 0;
  border: 0;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.product-demo-stage::before,
.product-demo-stage::after {
  content: "";
  position: absolute;
  z-index: 5;
  width: 2.55rem;
  height: 2.55rem;
  border: 2px solid rgba(255, 255, 255, .94);
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: 0 .55rem 1.15rem rgba(27, 33, 68, .16);
  font: 900 .68rem/1 Nunito, sans-serif;
  transition: transform .2s ease;
}
.product-demo-stage::before {
  content: "RU";
  left: calc(50% - min(31vw, 7.9rem));
  top: 18%;
  background: var(--orange);
  color: var(--ink);
  transform: rotate(-9deg);
}
.product-demo-stage::after {
  content: "Aa";
  right: calc(50% - min(32vw, 8.1rem));
  bottom: 20%;
  background: var(--demo-teal-ink);
  color: #fff;
  transform: rotate(8deg);
}
.product-demo-stage.did-beat::before { transform: rotate(-9deg) scale(1.08); }
.product-demo-stage.did-beat::after { transform: rotate(8deg) scale(.94); }
.product-demo-stage:focus-visible { outline: 3px solid var(--demo-orange-ink); outline-offset: 2px; }
.product-demo-phone {
  position: relative;
  display: block;
  width: min(57vw, 14rem);
  height: min(48vh, 25.5rem);
  min-height: 18rem;
  border: .34rem solid var(--ink);
  border-radius: 2.15rem;
  overflow: hidden;
  background: #fff;
  box-shadow:
    0 1.1rem 2.4rem rgba(27, 33, 68, .2),
    0 0 0 .18rem rgba(255, 255, 255, .92),
    0 0 0 .25rem rgba(27, 33, 68, .08);
  transform: rotate(-1.3deg);
  transition: transform .18s ease;
}
.product-demo-stage:active .product-demo-phone { transform: rotate(0) scale(.985); }
.product-demo-camera {
  position: absolute;
  z-index: 8;
  left: 50%;
  top: .28rem;
  width: 3.3rem;
  height: .82rem;
  border-radius: var(--r-pill);
  background: rgba(8, 10, 22, .92);
  transform: translateX(-50%);
  pointer-events: none;
}
.product-demo-shine {
  position: absolute;
  z-index: 7;
  inset: 0;
  background: linear-gradient(118deg, rgba(255,255,255,.22), transparent 24% 72%, rgba(255,255,255,.1));
  pointer-events: none;
}
.product-demo-frame {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transform: scale(1.055);
  transition: opacity .16s ease, transform .38s cubic-bezier(.2,.85,.25,1);
  pointer-events: none;
}
.product-demo-frame.is-active {
  z-index: 2;
  opacity: 1;
  transform: scale(1);
}
.product-demo-frame[data-demo-step="0"] { object-position: center 48%; }
.product-demo-frame[data-demo-step="1"] { object-position: center 43%; }
.product-demo-frame[data-demo-step="2"] { object-position: center 55%; }
.product-demo-frame[data-demo-step="3"] { object-position: center 39%; }
.product-demo-frame[data-demo-step="4"] { object-position: center 49%; }
.product-demo-frame[data-demo-step="5"] { object-position: center 43%; }
.product-demo-loading {
  padding: 3.3rem 1.15rem 2rem;
  background:
    radial-gradient(circle at 86% 12%, rgba(0,169,183,.11), transparent 28%),
    #FFF8EF;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  color: var(--ink);
  text-align: left;
}
.product-demo-loading-logo {
  align-self: center;
  font: 900 1.25rem/1 Nunito, sans-serif;
  letter-spacing: .18em;
}
.product-demo-loading-dots {
  align-self: center;
  margin: .6rem 0 1.35rem;
  display: flex;
  gap: .28rem;
}
.product-demo-loading-dots i {
  width: .42rem;
  height: .42rem;
  border-radius: 50%;
  background: var(--orange);
}
.product-demo-loading-dots i:last-child { background: var(--teal); }
.product-demo-loading-kicker {
  margin-bottom: .62rem;
  color: var(--ink-soft);
  font: 800 .55rem/1 Nunito, sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.product-demo-loading-row {
  min-height: 1.65rem;
  display: flex;
  align-items: center;
  gap: .45rem;
  color: rgba(27,33,68,.38);
  font: 800 .58rem/1.15 Nunito, sans-serif;
}
.product-demo-loading-row > i {
  flex: none;
  width: .85rem;
  height: .85rem;
  border: 1px solid rgba(27,33,68,.16);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: normal 900 .48rem/1 Nunito, sans-serif;
}
.product-demo-loading-row.is-done { color: var(--demo-teal-ink); }
.product-demo-loading-row.is-done > i { border: 0; background: var(--teal); color: #fff; }
.product-demo-loading-row.is-live { color: var(--ink); }
.product-demo-loading-row.is-live > i {
  border: .18rem solid rgba(0,169,183,.2);
  border-top-color: var(--teal);
  animation: product-demo-spin .72s linear infinite;
}
.product-demo-loading-track {
  height: .24rem;
  margin-top: .75rem;
  border-radius: var(--r-pill);
  overflow: hidden;
  background: rgba(27,33,68,.08);
}
.product-demo-loading-track i {
  display: block;
  width: 72%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), #45c5cc);
  transform-origin: left;
}
.product-demo-loading > strong {
  margin-top: .55rem;
  color: var(--demo-teal-ink);
  font: 900 .62rem/1 Nunito, sans-serif;
  text-align: right;
}
.product-demo-loading.is-active .product-demo-loading-track i {
  animation: product-demo-load .8s both cubic-bezier(.2,.8,.2,1);
}
.product-demo-tap {
  position: absolute;
  z-index: 9;
  left: 50%;
  bottom: .55rem;
  padding: .28rem .52rem;
  border-radius: var(--r-pill);
  background: rgba(27, 33, 68, .82);
  color: rgba(255,255,255,.82);
  font: 700 .53rem/1 Nunito, sans-serif;
  letter-spacing: .02em;
  transform: translateX(-50%);
  white-space: nowrap;
  backdrop-filter: blur(.4rem);
}
.product-demo-tap b { color: #fff; font-weight: 900; }
.product-demo-beat {
  position: absolute;
  z-index: 0;
  left: 50%;
  top: 50%;
  width: min(70vw, 17rem);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(0, 169, 183, .18);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 1.4rem rgba(0, 169, 183, .04), 0 0 0 2.8rem rgba(242, 122, 24, .025);
}
.product-demo-caption {
  flex: none;
  width: min(100%, 21rem);
  min-height: 3.25rem;
  margin-top: .2rem;
  display: grid;
  grid-template-columns: 2.7rem minmax(0, 1fr);
  align-items: center;
  gap: .65rem;
  text-align: left;
}
.product-demo-caption > span {
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 .3rem .8rem rgba(27, 33, 68, .15);
  font: 900 .78rem/1 "IBM Plex Mono", monospace;
}
.product-demo-caption div { min-width: 0; display: flex; flex-direction: column; }
.product-demo-caption strong {
  color: var(--ink);
  font: 900 .9rem/1.05 Nunito, sans-serif;
}
.product-demo-caption small {
  margin-top: .22rem;
  overflow: hidden;
  color: var(--ink-soft);
  font: 700 .64rem/1.15 Nunito, sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.product-demo-progress {
  flex: none;
  width: min(100%, 21rem);
  height: .22rem;
  margin: .45rem 0 .75rem;
  display: flex;
  gap: .28rem;
}
.product-demo-progress span {
  flex: 1;
  border-radius: var(--r-pill);
  background: rgba(27, 33, 68, .12);
  transition: background .14s ease, transform .14s ease;
}
.product-demo-progress span.is-past { background: rgba(0, 108, 120, .34); }
.product-demo-progress span.is-active { background: var(--orange); transform: scaleY(1.65); }
.product-demo-continue {
  flex: none;
  width: min(100%, 21rem);
  min-height: 3.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  box-shadow: 0 .6rem 1.25rem rgba(242, 122, 24, .2);
}
.product-demo-continue span { font-size: 1.05rem; transition: transform .16s ease; }
.product-demo-continue:active span { transform: translateX(.2rem); }
.product-demo-screen.active .product-demo-copy { animation: offer-rise-in .42s .04s both cubic-bezier(.2,.8,.2,1); }
.product-demo-screen.active .product-demo-stage { animation: offer-rise-in .48s .1s both cubic-bezier(.2,.8,.2,1); }
.product-demo-screen.active .product-demo-caption,
.product-demo-screen.active .product-demo-progress,
.product-demo-screen.active .product-demo-continue { animation: offer-rise-in .4s .17s both cubic-bezier(.2,.8,.2,1); }
@keyframes product-demo-live {
  50% { opacity: .5; transform: scale(.72); }
}
@keyframes product-demo-spin { to { transform: rotate(1turn); } }
@keyframes product-demo-load {
  from { transform: scaleX(.08); }
  to { transform: scaleX(1); }
}
@media (max-width: 22rem) {
  .product-demo-body { padding-inline: .85rem; }
  .product-demo-copy { margin-top: .55rem; }
  .product-demo-copy h1 { font-size: 1.55rem; }
  .product-demo-copy p { font-size: .66rem; }
  .product-demo-phone { width: min(54vw, 12rem); height: min(45vh, 21rem); min-height: 15rem; }
  .product-demo-stage::before { left: calc(50% - 6.55rem); }
  .product-demo-stage::after { right: calc(50% - 6.65rem); }
  .product-demo-caption { min-height: 2.9rem; }
  .product-demo-progress { margin-bottom: .55rem; }
  .product-demo-continue { min-height: 3.05rem; }
}
@media (max-height: 43.75rem) {
  .product-demo-copy { margin-top: .45rem; }
  .product-demo-copy p { display: none; }
  .product-demo-phone { height: min(43vh, 18rem); min-height: 13.5rem; width: min(49vw, 10.8rem); }
  .product-demo-caption { min-height: 2.65rem; }
  .product-demo-caption > span { width: 2.35rem; height: 2.35rem; }
  .product-demo-progress { margin-block: .25rem .5rem; }
  .product-demo-continue { min-height: 2.9rem; }
}
@media (prefers-reduced-motion: reduce) {
  .product-demo-brand > em i,
  .product-demo-screen.active .product-demo-copy,
  .product-demo-screen.active .product-demo-stage,
  .product-demo-screen.active .product-demo-caption,
  .product-demo-screen.active .product-demo-progress,
  .product-demo-screen.active .product-demo-continue { animation: none; }
  .product-demo-frame,
  .product-demo-progress span { transition: none; }
  .product-demo-loading-row.is-live > i,
  .product-demo-loading.is-active .product-demo-loading-track i { animation: none; }
}

/* Frameless feature reel. The live screens fill the width while cream fades on
   every edge dissolve each crop back into the onboarding background. */
.product-demo-stage {
  width: min(100vw, 38rem);
  min-height: clamp(15rem, 43vh, 24rem);
  margin-inline: calc(50% - min(50vw, 19rem));
  padding: 0;
  overflow: hidden;
  cursor: pointer;
}
.product-demo-stage::before,
.product-demo-stage::after,
.product-demo-beat { display: none; }
.product-demo-reel {
  position: relative;
  display: block;
  width: 100%;
  height: clamp(15rem, 43vh, 24rem);
  overflow: hidden;
  background: #FFF8EF;
  isolation: isolate;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 7%, #000 93%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 7%, #000 93%, transparent 100%);
}
.product-demo-reel::after {
  content: "";
  position: absolute;
  z-index: 10;
  inset: 0;
  background: linear-gradient(180deg,
    #FFF8EF 0,
    rgba(255, 248, 239, .9) 2%,
    transparent 12%,
    transparent 88%,
    rgba(255, 248, 239, .9) 98%,
    #FFF8EF 100%);
  pointer-events: none;
}
.product-demo-reel .product-demo-frame {
  inset: -10% 0;
  width: 100%;
  height: 120%;
  object-fit: cover;
  background: #FFF8EF;
  transform: scale(1.035);
  transition: opacity .12s ease, transform .3s cubic-bezier(.2,.85,.25,1);
}
.product-demo-reel .product-demo-frame.is-active {
  transform: scale(1);
}
.product-demo-reel .product-demo-loading {
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 2.4rem clamp(2.75rem, 14vw, 5.25rem) 2rem;
  background:
    radial-gradient(circle at 84% 13%, rgba(0,169,183,.13), transparent 34%),
    radial-gradient(circle at 12% 86%, rgba(242,122,24,.12), transparent 32%),
    #FFF8EF;
}
.product-demo-reel .product-demo-loading-logo { font-size: 1.55rem; }
.product-demo-reel .product-demo-loading-kicker { font-size: .63rem; }
.product-demo-reel .product-demo-loading-row { min-height: 1.9rem; font-size: .7rem; }
.product-demo-reel .product-demo-loading > strong { font-size: .72rem; }
.product-demo-stage[data-active-step="1"] .product-demo-frame[data-demo-step="1"] { object-position: center 43%; }
.product-demo-stage[data-active-step="3"] .product-demo-frame[data-demo-step="3"] { object-position: center 38%; }
.product-demo-stage[data-active-step="4"] .product-demo-frame[data-demo-step="4"] { object-position: center 47%; }
.product-demo-stage[data-active-step="5"] .product-demo-frame[data-demo-step="5"] { object-position: center 39%; }
.product-demo-stage:active .product-demo-reel { transform: scale(.995); }
.product-demo-reel { transition: transform .12s ease; }
.product-demo-screen.active .product-demo-reel {
  animation: product-demo-reel-in .44s .08s both ease-out;
}
.product-demo-caption {
  width: min(100%, 21rem);
  min-height: 3.05rem;
  margin-top: .1rem;
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  align-items: center;
  gap: .65rem;
  text-align: left;
}
.product-demo-caption > span {
  width: 2.5rem;
  height: 2.5rem;
}
.product-demo-caption strong {
  color: var(--ink);
  font: 900 .9rem/1.05 Nunito, sans-serif;
}
.product-demo-caption small {
  margin-top: .22rem;
  overflow: hidden;
  color: var(--ink-soft);
  font: 700 .64rem/1.15 Nunito, sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.product-demo-progress {
  width: min(100%, 21rem);
  height: .22rem;
  margin: .4rem 0 .72rem;
  display: flex;
  gap: .28rem;
  overflow: visible;
  background: transparent;
}
.product-demo-progress span {
  flex: 1;
  display: block;
  width: auto;
  height: 100%;
  border-radius: var(--r-pill);
  background: rgba(27,33,68,.12);
  transform: none;
  transition: background .12s ease, transform .12s ease;
}
.product-demo-progress span.is-past { background: rgba(0,108,120,.34); }
.product-demo-progress span.is-active { background: var(--orange); transform: scaleY(1.65); }
@keyframes product-demo-reel-in {
  from { opacity: 0; transform: scale(1.025); }
  to { opacity: 1; transform: scale(1); }
}
@media (max-height: 43.75rem) {
  .product-demo-stage { min-height: 12rem; }
  .product-demo-reel { height: 12rem; }
  .product-demo-caption { min-height: 2.35rem; }
  .product-demo-progress { margin-block: .25rem .5rem; }
}
@media (prefers-reduced-motion: reduce) {
  .product-demo-screen.active .product-demo-reel { animation: none; }
  .product-demo-progress span { transition: none; }
}

/* All three film/offer screens share one live logo and safe-area anchor. */
.onboarding-brand {
  position: absolute;
  z-index: 6;
  top: calc(.85rem + var(--para-safe-top, env(safe-area-inset-top, 0px)));
  left: max(1.2rem, calc((100% - 42rem) / 2 + 1.2rem));
  display: flex;
  align-items: baseline;
  gap: .48rem;
  width: max-content;
  color: var(--ink);
  pointer-events: none;
}
.onboarding-brand strong {
  font: 800 1.4rem/1 Nunito, sans-serif;
  letter-spacing: -.04em;
}
.onboarding-brand span {
  color: #006C78;
  font: 800 .58rem/1 Nunito, sans-serif;
  letter-spacing: .18em;
}
/* Play the supplied film once; the promo has no live controls. */
.product-demo-screen {
  background:
    radial-gradient(ellipse at 100% 85%, rgba(0,169,183,.08), transparent 48%),
    radial-gradient(ellipse at 0 85%, rgba(242,122,24,.06), transparent 48%),
    #FFF8EF;
}
.product-demo-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}
.product-demo-skip {
  position: absolute;
  z-index: 8;
  top: calc(.85rem + var(--para-safe-top, env(safe-area-inset-top, 0px)));
  right: max(1.2rem, calc((100% - 42rem) / 2 + 1.2rem));
  padding: .42rem .78rem;
  border: 1px solid rgba(0, 108, 120, .18);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .82);
  color: var(--demo-teal-ink);
  font: 800 .72rem/1 Nunito, sans-serif;
  letter-spacing: .04em;
  cursor: pointer;
  box-shadow: 0 .25rem .7rem rgba(27, 33, 68, .06);
}
.product-demo-skip:hover { border-color: var(--teal); }
.product-demo-fullpage-video {
  position: absolute;
  z-index: 0;
  top: var(--para-safe-top, env(safe-area-inset-top, 0px));
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: calc(100% - var(--para-safe-top, env(safe-area-inset-top, 0px)));
  border: 0;
  background: #FFF8EF;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
}
/* ---------- POST-SPLASH START OFFER ---------- */
.offer-screen {
  --offer-orange-ink: #B45309;
  --offer-teal-ink: #006C78;
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
  overflow-y: auto;
  background: #FFF8EF;
}
.offer-screen::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 5.4rem;
  right: -3.2rem;
  width: 8rem;
  height: 8rem;
  border: 1px solid rgba(0, 169, 183, .15);
  border-radius: 50%;
  box-shadow:
    0 0 0 1.25rem rgba(0, 169, 183, .035),
    0 0 0 2.5rem rgba(0, 169, 183, .025);
}
.offer-glow {
  position: absolute;
  z-index: -1;
  width: 11rem;
  height: 11rem;
  border-radius: 50%;
  filter: blur(2.8rem);
  opacity: .2;
  pointer-events: none;
}
.offer-glow-orange { left: -6rem; top: 31%; background: var(--orange); }
.offer-glow-teal { right: -6rem; bottom: 7%; background: var(--teal); }
.offer-body {
  position: relative;
  z-index: 1;
  width: min(100%, 42rem);
  min-height: 100%;
  margin: 0 auto;
  padding:
    calc(.85rem + var(--para-safe-top, env(safe-area-inset-top, 0px)))
    1.2rem
    calc(2.5rem + var(--para-safe-bottom, env(safe-area-inset-bottom, 0px)));
  display: flex;
  flex-direction: column;
}
.offer-body::before,
.welcome-body::before {
  content: "";
  flex: none;
  height: 1.4rem;
}
.offer-heading {
  width: min(100%, 23rem);
  margin: 0 auto;
  text-align: center;
}
.offer-bear-space {
  flex: 1 1 auto;
  min-height: 15rem;
  padding-top: clamp(1.5rem, 5vh, 3rem);
}
/* A static copy of the welcome layout sits underneath every offer control. */
.offer-welcome-backdrop {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background: #FFF8EF;
}
.offer-bear-layout > :not(.welcome-stage) { visibility: hidden; }
.offer-bear-layout .welcome-camera {
  transform: none;
}
/* Native screens already reserve the top safe area. Keep the backdrop's
   layout origin identical to the live welcome body and avoid padding the
   offer controls twice. */
html.para-ios-yt .offer-welcome-backdrop {
  top: var(--para-safe-top, env(safe-area-inset-top, 0px));
}
html.para-ios-yt .offer-body { padding-top: .85rem; }
.offer-choices {
  flex: none;
  display: grid;
  gap: 1rem;
  padding: .2rem 0;
}
.offer-choice {
  position: relative;
  width: 100%;
  min-height: 6.25rem;
  padding: .92rem 1rem;
  border-radius: 1.55rem;
  display: grid;
  grid-template-columns: 3.65rem minmax(0, 1fr) auto;
  align-items: center;
  gap: .9rem;
  color: var(--ink);
  font-family: Nunito, sans-serif;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform .16s ease, box-shadow .2s ease, opacity .18s ease;
}
.offer-choice-free {
  border: 1.5px solid rgba(0, 169, 183, .42);
  background: linear-gradient(105deg, rgba(230, 247, 248, .95), rgba(255, 255, 255, .96));
  box-shadow: 0 .6rem 1.4rem rgba(0, 140, 153, .1);
}
.offer-choice-plus {
  border: 1.5px solid rgba(242, 122, 24, .62);
  background:
    radial-gradient(circle at 92% -30%, rgba(242, 122, 24, .45), transparent 52%),
    linear-gradient(112deg, #1b2144, #282f61);
  box-shadow: 0 .7rem 1.55rem rgba(27, 33, 68, .2);
  color: #fff;
}
.offer-choice:hover { transform: translateY(-1px); }
.offer-choice:active { transform: scale(.985); }
.offer-choice:focus-visible {
  outline: 3px solid var(--offer-orange-ink);
  outline-offset: 3px;
}
.offer-choice:disabled { cursor: default; }
.offer-choice.is-selected {
  transform: scale(.975);
  box-shadow: 0 0 0 4px rgba(242, 122, 24, .18), 0 .35rem .8rem rgba(27, 33, 68, .14);
}
.offer-choice.is-waiting { opacity: .48; transform: scale(.985); }
.offer-choice-icon,
.offer-plus-spark {
  width: 3.65rem;
  height: 3.65rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.offer-choice-icon {
  background: var(--offer-teal-ink);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.36), 0 .35rem .75rem rgba(0, 140, 153, .2);
  color: #fff;
  font: 900 1.2rem/1 Nunito, sans-serif;
}
.offer-plus-spark {
  background: var(--orange);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.32), 0 .35rem .75rem rgba(0, 0, 0, .18);
  color: var(--ink);
  font-size: 1.35rem;
}
.offer-choice-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.offer-choice-badge {
  margin-bottom: .13rem;
  color: var(--offer-teal-ink);
  font: 900 .68rem/1 Nunito, sans-serif;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.offer-choice-plus .offer-choice-badge { color: #ffad66; }
.offer-choice-copy strong {
  font: 900 1.2rem/1.1 Nunito, sans-serif;
  letter-spacing: -.02em;
}
.offer-choice-copy small {
  margin-top: .32rem;
  color: var(--ink-soft);
  font: 700 .72rem/1.15 Nunito, sans-serif;
  white-space: nowrap;
}
.offer-choice-plus .offer-choice-copy small { color: rgba(255,255,255,.7); }
.offer-choice-arrow {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--offer-teal-ink);
  box-shadow: 0 .25rem .7rem rgba(27,33,68,.09);
  font: 900 1.15rem/1 Nunito, sans-serif;
}
.offer-price {
  min-width: 4.85rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1;
}
.offer-price strong { color: #fff; font: 900 1.12rem/1 Nunito, sans-serif; }
.offer-price small { margin-top: .17rem; color: rgba(255,255,255,.74); font: 700 .64rem/1 Nunito, sans-serif; }
.offer-price em {
  margin-top: .38rem;
  padding: .22rem .38rem;
  border-radius: var(--r-pill);
  background: rgba(255,255,255,.11);
  color: #fff;
  font: normal 800 .58rem/1 Nunito, sans-serif;
  white-space: nowrap;
}
.offer-screen.active .offer-choice-free { animation: offer-rise-in .42s .2s both cubic-bezier(.2,.8,.2,1); }
.offer-screen.active .offer-choice-plus { animation: offer-rise-in .42s .27s both cubic-bezier(.2,.8,.2,1); }
@keyframes offer-rise-in {
  from { opacity: 0; transform: translateY(.8rem) scale(.985); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 22rem) {
  .offer-body { padding-inline: .85rem; }
  .offer-choice { grid-template-columns: 2.8rem minmax(0, 1fr) auto; gap: .55rem; padding-inline: .65rem; }
  .offer-choice-icon,
  .offer-plus-spark { width: 2.8rem; height: 2.8rem; }
  .offer-choice-copy strong { font-size: 1rem; }
  .offer-choice-badge { font-size: .66rem; }
  .offer-choice-copy small { font-size: .68rem; }
  .offer-price { min-width: 4.25rem; }
  .offer-price strong { font-size: 1rem; }
  .offer-price em { font-size: .56rem; }
}
@media (max-height: 43.75rem) {
  .offer-body { padding-bottom: calc(2.3rem + var(--para-safe-bottom, env(safe-area-inset-bottom, 0px))); }
  .offer-bear-space { min-height: 12.2rem; }
  .offer-choice { min-height: 5.35rem; }
}

/* ---------- WELCOME HANDOFF ---------- */
.welcome-screen {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  /* Brand paper beige — same hex as --paper / home. */
  background: #FFF8EF;
}
.welcome-screen::before,
.welcome-screen::after {
  content: "";
  display: none;
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
}
.welcome-screen::before {
  width: 18rem;
  height: 18rem;
  right: -10rem;
  top: 13%;
  border: 1px solid rgba(0,169,183,.1);
  box-shadow: 0 0 0 2rem rgba(0,169,183,.02), 0 0 0 4rem rgba(0,169,183,.012);
}
.welcome-screen::after {
  width: 13rem;
  height: 13rem;
  left: -8rem;
  bottom: 8%;
  border: 1px solid rgba(242,122,24,.09);
  box-shadow: 0 0 0 1.7rem rgba(242,122,24,.018);
}
.welcome-glow {
  display: none;
  position: absolute;
  z-index: -1;
  width: 12rem;
  height: 12rem;
  border-radius: 50%;
  filter: blur(3rem);
  opacity: .07;
  pointer-events: none;
}
.welcome-glow-orange { left: -6rem; top: 34%; background: var(--orange); }
.welcome-glow-teal { right: -6rem; bottom: 11%; background: var(--teal); }
.welcome-body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.welcome-body::before { display: none; }
.welcome-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}
.welcome-stage {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}
.welcome-composition {
  position: relative;
  /* iPhone 17 Pro Max reference: the 480×682 film is 1.314× the phone
     width, bottom-aligned, so the bear matches that frame and the empty
     side margins crop off. */
  width: 131.4%;
  flex: none;
  aspect-ratio: 480 / 682;
  overflow: hidden;
}
.welcome-bear {
  position: absolute;
  z-index: 2;
  inset: 0;
  overflow: hidden;
}
.welcome-camera {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  transform-origin: 50% 100%;
}
.welcome-video,
.welcome-frame-cover {
  z-index: 2;
}
.welcome-portal {
  display: none;
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 50%;
  width: 82%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(from 215deg, rgba(242,122,24,.08), rgba(242,122,24,.015) 49%, rgba(0,169,183,.075) 51%, rgba(0,169,183,.012));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.45);
  transform: translate(-50%, -50%) scale(.82);
}
.welcome-mascot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: bottom center;
  transform-origin: 50% 100%;
  background: transparent;
}
.welcome-video {
  display: block;
  background: transparent;
  background-color: transparent;
  pointer-events: none;
}
.welcome-alpha-film { display: none; }
.welcome-screen.is-alpha-film #welcome-video { display: none; }
.welcome-screen.is-alpha-film .welcome-alpha-film { display: block; }
.welcome-gesture-arc {
  position: absolute;
  z-index: 3;
  right: -2%;
  top: 37%;
  width: 29%;
  height: 19%;
  border-top: .22rem solid rgba(0,108,120,.72);
  border-right: .22rem solid rgba(0,108,120,.72);
  border-radius: 0 100% 0 0;
  opacity: 0;
  transform: rotate(18deg) scale(.65);
}
.welcome-gesture-arc::after {
  content: "";
  position: absolute;
  right: -.34rem;
  bottom: -.05rem;
  width: .65rem;
  height: .65rem;
  border-right: .22rem solid var(--orange);
  border-bottom: .22rem solid var(--orange);
  transform: rotate(34deg);
}
.welcome-screen.is-playing .welcome-camera {
  transform: none;
}
.welcome-screen.is-playing .welcome-portal { animation: welcome-portal-open 2.35s .1s both ease-out; }
.welcome-screen.is-playing .welcome-gesture-arc { animation: welcome-gesture-swoop 1.35s .68s both ease-out; }
@keyframes welcome-camera-push {
  0% { transform: scale(.94); }
  100% { transform: scale(1); }
}
@keyframes welcome-host-gesture {
  0% { opacity: 0; transform: translateX(1.2rem) rotate(2.5deg); }
  34% { opacity: 1; transform: translateX(0) rotate(-1deg); }
  57% { transform: translateX(-.38rem) rotate(-2.2deg); }
  76% { transform: translateX(.18rem) rotate(.75deg); }
  100% { opacity: 1; transform: translateX(0) rotate(0); }
}
@keyframes welcome-portal-open {
  from { opacity: 0; transform: translate(-50%, -50%) scale(.45) rotate(-20deg); }
  55% { opacity: 1; }
  to { opacity: .92; transform: translate(-50%, -50%) scale(1.06) rotate(8deg); }
}
@keyframes welcome-gesture-swoop {
  0% { opacity: 0; transform: translate(1rem, -1rem) rotate(-18deg) scale(.55); }
  38% { opacity: .8; }
  100% { opacity: 0; transform: translate(-.7rem, 1.1rem) rotate(24deg) scale(1.08); }
}
@media (prefers-reduced-motion: reduce) {
  .welcome-screen.is-playing .welcome-camera,
  .welcome-screen.is-playing .welcome-mascot,
  .welcome-screen.is-playing .welcome-portal,
  .welcome-screen.is-playing .welcome-gesture-arc { animation: none; }
  .welcome-screen.is-playing .welcome-camera {
    transform: scale(1);
  }
}
@media (min-width: 37.5rem) {
  .offer-choices { grid-template-columns: 1fr 1fr; }
  .offer-choice { min-height: 6rem; }
}
@media (prefers-reduced-motion: reduce) {
  .offer-screen.active .offer-choice-free,
  .offer-screen.active .offer-choice-plus { animation: none; }
  .offer-choice { transition: none; }
}

/* ---------- POST-SPLASH LANGUAGE PAIR ---------- */
.language-screen {
  background: #FFF8EF;
  overflow-y: auto;
}
.language-picker-body {
  flex: 1;
  min-height: 100%;
  padding: calc(1rem + var(--para-safe-top, env(safe-area-inset-top, 0px))) 1.25rem calc(1.25rem + var(--para-safe-bottom, env(safe-area-inset-bottom, 0px)));
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
html.para-ios-yt .language-picker-body { padding-top: 1rem; }
.language-picker-copy {
  width: min(100%, 23rem);
  margin-top: clamp(1rem, 6vh, 3rem);
}
.offer-heading,
.language-picker-copy h1 {
  color: var(--ink);
  font: 800 clamp(2.4rem, 10.5vw, 3.25rem)/1.04 Nunito, sans-serif;
  letter-spacing: -.045em;
  outline: none;
}
.language-picker-copy h1 { margin: 0; }
.language-pair-stage {
  --wheel-hub-scale: 1.267;
  --wheel-mirror: 1;
  position: relative;
  flex: none;
  width: min(100%, 21.5rem);
  height: clamp(18rem, 43vh, 21.5rem);
  margin: auto 0;
  isolation: isolate;
}
.language-mascot {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: clamp(8.75rem, 43vw, 10.75rem);
  height: auto;
  object-fit: contain;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 8px 14px rgba(27, 33, 68, 0.07));
  transition: opacity .2s ease, transform .28s cubic-bezier(.2,.9,.25,1);
}
.language-source-choice,
.language-target-choice {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 4.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  transform: translateY(-2.375rem);
  transition: left .3s cubic-bezier(.2,.9,.25,1), opacity .18s ease, transform .3s cubic-bezier(.2,.9,.25,1);
}
.language-source-choice { left: 0; }
.language-target-choice { left: calc(100% - 4.75rem); }
.language-source-choice strong,
.language-target-choice strong {
  max-width: 7rem;
  color: var(--ink);
  font: 800 0.75rem Nunito, sans-serif;
  white-space: nowrap;
  transition: opacity .16s ease, transform .2s ease;
}
[data-language="ru"] { --language-flag-image: url("assets/flags/ru.svg"); }
[data-language="en"] { --language-flag-image: url("assets/flags/en.svg"); }
[data-language="es"] { --language-flag-image: url("assets/flags/es.svg"); }
[data-language="fr"] { --language-flag-image: url("assets/flags/fr.svg"); }
[data-language="de"] { --language-flag-image: url("assets/flags/de.svg"); }
[data-language="it"] { --language-flag-image: url("assets/flags/it.svg"); }
[data-language="pt"] { --language-flag-image: url("assets/flags/pt.svg"); }
[data-language="pl"] { --language-flag-image: url("assets/flags/pl.svg"); }
[data-language="tr"] { --language-flag-image: url("assets/flags/tr.svg"); }
[data-language="zh-Hans"] { --language-flag-image: url("assets/flags/zh-Hans.svg"); }
.language-flag-bubble {
  width: 4.75rem;
  height: 4.75rem;
  padding: 0;
  border-radius: 50%;
  background-color: var(--card);
  background-image: var(--language-flag-image);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  box-shadow: 0 6px 14px rgba(27, 33, 68, 0.07);
  display: flex;
  align-items: center;
  justify-content: center;
}
.language-source-bubble { border: 3px solid var(--orange); }
.language-target-bubble {
  position: relative;
  border: 3px solid var(--teal);
  background-color: transparent;
  background-image: none;
  color: var(--ink);
  cursor: pointer;
  overflow: visible;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.language-target-bubble .language-flag {
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  border-radius: 50%;
  background-color: var(--card);
  background-image: var(--language-flag-image);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  transition: opacity .14s ease, transform .18s ease;
}
/* Warm Echo radar: two rings on the selectable flag only, until it is opened. */
.language-screen[data-hint="on"] .language-target-bubble[aria-expanded="false"]::before,
.language-screen[data-hint="on"] .language-target-bubble[aria-expanded="false"]::after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 1.5px solid var(--pair-other-ring, var(--teal));
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  animation: para-warm-radar 2.8s ease-out infinite;
}
.language-screen[data-hint="on"] .language-target-bubble[aria-expanded="false"]::after {
  animation-delay: 1.4s;
}
@keyframes para-warm-radar {
  0% { opacity: .28; transform: scale(1); }
  72%, 100% { opacity: 0; transform: scale(1.55); }
}
@media (prefers-reduced-motion: reduce) {
  .language-screen[data-hint="on"] .language-target-bubble[aria-expanded="false"]::before,
  .language-screen[data-hint="on"] .language-target-bubble[aria-expanded="false"]::after { animation: none; }
}
.language-target-bubble:hover { border-color: var(--orange); }
.language-target-bubble:active { transform: scale(.95); }
.language-target-bubble:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 4px;
}
.language-flag {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-size: 0;
  line-height: 1;
}
.language-radial-menu {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  touch-action: none;
  overscroll-behavior: contain;
}
.language-radial-menu[hidden] { display: none; }
.language-pair-stage.language-menu-open .language-radial-menu { pointer-events: auto; }
.language-radial-menu::before {
  content: "";
  position: absolute;
  right: 2.375rem;
  top: 50%;
  z-index: 0;
  width: 8.6rem;
  height: 24rem;
  border: 2px solid rgba(0, 153, 168, 0.16);
  border-left: 0;
  border-radius: 0 9rem 9rem 0;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity .2s ease;
  pointer-events: none;
}
.language-pair-stage.language-menu-open .language-radial-menu::before { opacity: 1; }
.language-radial-option {
  position: absolute;
  left: calc(100% - 2.375rem);
  top: 50%;
  z-index: 1;
  width: 3.75rem;
  height: 3.75rem;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 50%;
  background-color: var(--card);
  background-image: var(--language-flag-image);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  box-shadow: 0 5px 12px rgba(27, 33, 68, 0.07);
  color: var(--ink);
  cursor: pointer;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  --wheel-x: 0rem;
  --wheel-y: 0rem;
  --wheel-scale: .3;
  --wheel-opacity: 0;
  --wheel-saturation: .2;
  --wheel-label-opacity: 0;
  opacity: 0;
  filter: saturate(.15);
  transform: translate(-50%, -50%) scale(.24);
  transition: transform .25s cubic-bezier(.2,.9,.25,1), opacity .2s ease, filter .2s ease, border-color .15s ease, box-shadow .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.language-pair-stage.language-menu-open .language-radial-option {
  opacity: var(--wheel-opacity);
  filter: saturate(var(--wheel-saturation));
  transform: translate(calc(-50% + (var(--wheel-x) * var(--wheel-mirror, 1))), calc(-50% + var(--wheel-y))) scale(calc(var(--wheel-scale) * var(--wheel-hub-scale)));
  transition-delay: var(--wheel-delay, 0ms);
}
.language-radial-option[data-slot="-1"] {
  --wheel-x: -1.152rem; --wheel-y: -6rem; --wheel-scale: .71; --wheel-opacity: .78; --wheel-saturation: .78; --wheel-label-opacity: 1;
}
.language-radial-option[data-slot="0"] {
  --wheel-x: 0rem; --wheel-y: 0rem; --wheel-scale: 1; --wheel-opacity: 1; --wheel-saturation: 1; --wheel-label-opacity: 1;
}
.language-radial-option[data-slot="1"] {
  --wheel-x: -1.152rem; --wheel-y: 6rem; --wheel-scale: .71; --wheel-opacity: .78; --wheel-saturation: .78; --wheel-label-opacity: 1;
}
.language-radial-option[data-slot="-2"] {
  --wheel-x: -4.3rem; --wheel-y: -10.392rem; --wheel-scale: .568; --wheel-opacity: .34; --wheel-saturation: .52;
}
.language-radial-option[data-slot="2"] {
  --wheel-x: -4.3rem; --wheel-y: 10.392rem; --wheel-scale: .568; --wheel-opacity: .34; --wheel-saturation: .52;
}
.language-radial-option[data-slot="-3"] {
  --wheel-x: -8.6rem; --wheel-y: -12rem; --wheel-scale: .426; --wheel-opacity: .08; --wheel-saturation: .2;
  pointer-events: none;
}
.language-radial-option[data-slot="3"] {
  --wheel-x: -8.6rem; --wheel-y: 12rem; --wheel-scale: .426; --wheel-opacity: .08; --wheel-saturation: .2;
  pointer-events: none;
}
.language-radial-option[data-slot="-4"] {
  --wheel-x: -12.9rem; --wheel-y: -10.392rem; --wheel-scale: .379; --wheel-opacity: 0; --wheel-saturation: .1;
  pointer-events: none;
}
.language-radial-option[data-slot="4"] {
  --wheel-x: -12.9rem; --wheel-y: 10.392rem; --wheel-scale: .379; --wheel-opacity: 0; --wheel-saturation: .1;
  pointer-events: none;
}
.language-pair-stage.language-menu-open .language-radial-option:hover,
.language-pair-stage.language-menu-open .language-radial-option:focus-visible {
  --wheel-opacity: 1;
  --wheel-saturation: 1;
  border-color: var(--orange);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(242, 122, 24, 0.2), 0 8px 20px rgba(27, 33, 68, 0.16);
}
.language-pair-stage.language-menu-open .language-radial-option:active {
  transform: translate(calc(-50% + (var(--wheel-x) * var(--wheel-mirror, 1))), calc(-50% + var(--wheel-y))) scale(calc(var(--wheel-scale) * var(--wheel-hub-scale) * .92));
}
.language-radial-flag {
  width: 100%;
  height: 100%;
  font-size: 0;
  line-height: 1;
}
.language-radial-label {
  position: absolute;
  top: calc(100% + 0.55rem);
  left: 50%;
  width: max-content;
  max-width: 6.6rem;
  transform: translateX(-50%) scale(calc(1 / (var(--wheel-scale, 1) * var(--wheel-hub-scale, 1))));
  transform-origin: 50% 0;
  color: var(--ink);
  font: 800 0.72rem/1.15 Nunito, sans-serif;
  text-align: center;
  text-shadow: 0 1px 0 var(--paper), 1px 0 0 var(--paper), -1px 0 0 var(--paper);
  white-space: nowrap;
  pointer-events: none;
  opacity: var(--wheel-label-opacity);
  transition: opacity .18s ease;
}
.language-radial-option[data-label-above="true"] .language-radial-label {
  top: auto;
  bottom: calc(100% + 0.55rem);
  transform-origin: 50% 100%;
}
.language-pair-stage.language-menu-open .language-radial-option[data-slot="0"] {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(242, 122, 24, 0.16);
}
.language-pair-stage.language-menu-open .language-target-choice {
  z-index: 4;
  pointer-events: none;
}
.language-pair-stage.language-menu-open .language-target-choice strong {
  opacity: 0;
  transform: translateY(-0.2rem);
}
.language-pair-stage.language-menu-open .language-target-bubble {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(242, 122, 24, 0.16);
}
.language-pair-stage.language-menu-open .language-target-bubble .language-flag {
  opacity: 0;
  transform: scale(.92);
  transition-delay: .06s;
}
.language-pair-stage.language-menu-open .language-target-bubble:active { transform: none; }
.language-pair-stage.language-menu-open { touch-action: none; }
.language-pair-stage.language-menu-open .language-radial-menu { cursor: grab; }
.language-pair-stage.language-wheel-dragging .language-radial-menu { cursor: grabbing; }
.language-pair-stage.language-wheel-dragging .language-radial-option,
.language-pair-stage.language-wheel-settling .language-radial-option {
  transition: none;
  transition-delay: 0s;
  will-change: transform, opacity, filter;
}
.language-pair-stage.language-wheel-dragging .language-radial-option:active,
.language-pair-stage.language-wheel-settling .language-radial-option:active {
  transform: translate(calc(-50% + (var(--wheel-x) * var(--wheel-mirror, 1))), calc(-50% + var(--wheel-y))) scale(calc(var(--wheel-scale) * var(--wheel-hub-scale)));
}
.language-pair-stage.language-wheel-dragging .language-radial-label,
.language-pair-stage.language-wheel-settling .language-radial-label { transition: none; }
.language-pair-stage.language-menu-closing .language-radial-menu { pointer-events: none; }
.language-pair-stage.language-menu-closing .language-radial-menu::before { opacity: 0; }
.language-pair-stage.language-menu-closing .language-radial-option {
  opacity: 0;
  transform: translate(-50%, -50%) scale(.24);
  transition-delay: 0s;
}
.language-selection-status {
  min-height: 1.15rem;
  margin-top: -0.35rem;
  color: var(--teal);
  font: 700 0.72rem/1.2 Nunito, sans-serif;
}
.language-continue {
  width: min(100%, 20rem);
  margin-top: 0.55rem;
}
@media (max-width: 22rem) {
  .language-picker-body { padding-inline: 0.8rem; }
  .language-pair-stage { --wheel-hub-scale: 1.133; width: 18rem; max-width: 100%; }
  .language-flag-bubble { width: 4.25rem; height: 4.25rem; }
  .language-source-choice,
  .language-target-choice { width: 4.25rem; }
  .language-source-choice,
  .language-target-choice { transform: translateY(-2.125rem); }
  .language-target-choice { left: calc(100% - 4.25rem); }
  .language-flag { font-size: 2.85rem; }
  .language-radial-option { left: calc(100% - 2.125rem); }
  .language-radial-menu::before { right: 2.125rem; }
  .language-screen.is-hub-pair.is-video-selectable .language-source-choice { left: calc(100% - 4.25rem); }
  .language-screen.is-hub-pair.is-video-selectable .language-target-choice { left: 0; }
  .language-screen.is-video-selectable .language-radial-option { left: 2.125rem; }
  .language-screen.is-video-selectable .language-radial-menu::before { left: 2.125rem; right: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .language-mascot,
  .language-source-choice,
  .language-target-choice,
  .language-target-bubble { transition: none; }
  .language-target-bubble .language-flag,
  .language-target-choice strong,
  .language-radial-menu::before,
  .language-radial-label { transition: none; }
  .language-radial-option { transition: none; }
}

/* The small pair indicator is filled edge-to-edge. Its divider rises from
   lower-left to upper-right so the two languages meet at a 45-degree seam. */
.language-pair-badge {
  --language-badge-size: 2.65rem;
  position: relative;
  display: block;
  flex: none;
  width: var(--language-badge-size);
  height: var(--language-badge-size);
  padding: 0;
  border: 2px solid rgba(0, 153, 168, .7);
  border-radius: 50%;
  overflow: hidden;
  isolation: isolate;
  background: transparent;
  box-shadow: 0 5px 14px rgba(27, 33, 68, .12);
  color: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.language-pair-badge:hover { border-color: var(--orange); }
.language-pair-badge:active { transform: scale(.94); }
.language-pair-badge:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
}
.language-pair-badge::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%; z-index: 2;
  width: 1px;
  height: 142%;
  background: rgba(255,255,255,.9);
  box-shadow: 0 0 0 1px rgba(27,33,68,.08);
  transform: translate(-50%, -50%) rotate(45deg);
}
.language-pair-badge-flag {
  position: absolute;
  inset: -1px;
  z-index: 1;
  background-color: var(--card);
  background-image: var(--language-flag-image);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  font-size: 0;
  pointer-events: none;
}
.language-pair-badge-flag.is-source { clip-path: polygon(0 0, 100% 0, 0 100%); }
.language-pair-badge-flag.is-target { clip-path: polygon(100% 0, 100% 100%, 0 100%); }
.language-pair-badge-page { --language-badge-size: 2.35rem; }
.home-header > .language-pair-badge { margin-left: auto; }

/* Keep the Home identity, language pair, and 44px account target on one
   line even on compact phones such as the 320pt iPhone SE. */
@media (max-width: 23rem) {
  .home-main { padding-inline: 1rem; }
  .home-header { gap: .45rem; }
  .home-header .brand { gap: .35rem; }
  .home-header .brand-mascot { width: 3.25rem; height: 3.25rem; }
  .home-header .brand-text { gap: .25rem; }
  .home-header .brand h1 { font-size: 1.55rem; }
  .home-header .brand span { font-size: .5rem; letter-spacing: .1em; }
  .home-header > .language-pair-badge { --language-badge-size: 2.2rem; }
}

.mascot-slot-img { width: 5.5rem; height: 5.5rem; object-fit: contain; }
.mascot-slot-img.mascot-slot-sm { width: 3rem; height: 3rem; }

/* ---------- shared bottom tab bar ---------- */
.tabbar {
  flex: none;
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 1rem 0.8rem;
  padding-bottom: calc(0.9rem + var(--para-safe-bottom, env(safe-area-inset-bottom, 0px)));
  border-top: 1px solid var(--line-soft);
  background: var(--paper);
}
.screen:not(#screen-review) > .tabbar {
  margin-top: auto;
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 8;
}
#native-api-block { display: none !important; }
.tabbar button {
  position: relative;
  flex: none;
  width: 78px;
  height: 74px;
  padding: 0;
  border: 1.5px solid var(--line);
  border-radius: 0.8rem;
  background: var(--paper);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
  transition: border-color .15s ease, color .15s ease;
}
.tabbar button:hover { border-color: var(--ink-faint); }
.tabbar button.active { color: var(--orange); border-color: var(--orange); }
.tabbar .icon {
  position: relative;
  z-index: 2;
  width: 58px;
  height: 58px;
  object-fit: contain;
  transition: transform .25s cubic-bezier(.2,.9,.25,1);
}
/* While the label shows below, the icon nudges up, then settles back. */
.tabbar button.show-label .icon { transform: translateY(-10px); }
/* The label hides behind the icon frame; on selection it pops down from
   behind it, waits, then slides back (app.js adds/removes .show-label).
   z-index keeps it under the frame so the icon never moves. */
.tabbar .tab-label {
  position: absolute;
  left: 50%;
  bottom: 5px;
  transform: translate(-50%, -12px);
  opacity: 0;
  z-index: 1; /* under the icon (z2), above the frame background */
  pointer-events: none;
  font: 700 0.5625rem Nunito, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--orange);
  white-space: nowrap;
  transition: transform .25s cubic-bezier(.2,.9,.25,1), opacity .2s ease;
}
.tabbar button.show-label .tab-label { transform: translate(-50%, 0); opacity: 1; }

/* ---------- Progress + streak header (visual redesign Part 3) ----------
   Shared across every screen except the player - #app-frame.player-active
   hides it entirely there rather than forcing this light/paper-themed bar
   onto the video's own dark overlay chrome (Part 4's territory). */
.progress-header { display: none !important; }

.auth-screen {
  background: #FFF8EF;
  overflow: auto;
}
.auth-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 1.75rem 1.625rem
    calc(1.25rem + var(--para-safe-bottom, env(safe-area-inset-bottom, 0px)));
}
.auth-lead {
  margin: 0 0 1.25rem;
  font: 500 0.9375rem Nunito, sans-serif;
  color: var(--ink-soft);
  line-height: 1.4;
  max-width: 22rem;
}
.auth-form { display: flex; flex-direction: column; }
.auth-email-panel[hidden] { display: none; }
.auth-email-panel {
  margin-top: 0.75rem;
  animation: auth-email-reveal .18s ease-out both;
}
@keyframes auth-email-reveal {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.auth-form .field-label {
  margin: 0.75rem 0 0.375rem;
  font: 700 0.6875rem Nunito, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.auth-form .field-label:first-child { margin-top: 0; }
.auth-input {
  width: 100%;
  min-height: 48px;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--card);
  outline: none;
  font: 400 0.9375rem Nunito, sans-serif;
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.auth-input::placeholder { color: var(--ink-faintest); }
.auth-input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 2px rgba(242, 122, 24, 0.22);
}
.auth-oauth { display: flex; flex-direction: column; gap: 0.625rem; }
.auth-oauth-btn {
  width: 100%;
  min-height: 48px;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  border-radius: var(--r-pill);
  cursor: pointer;
  font: 700 0.875rem Nunito, sans-serif;
}
.auth-oauth-icon { display: inline-flex; width: 18px; height: 18px; }
.auth-google {
  background: #fff;
  border: 1px solid var(--line);
  color: #1f1f1f;
}
.auth-google:hover { background: #f7f7f7; }
.auth-email-toggle {
  position: relative;
  flex: none;
  background: var(--orange);
  border: 0;
  color: #fff;
}
.auth-email-toggle:hover { background: var(--orange-600); }
.auth-email-toggle:active { transform: translateY(1px); }
.auth-email-chevron {
  position: absolute;
  right: 1rem;
  top: 50%;
  display: inline-flex;
  transform: translateY(-50%);
  transition: transform .18s ease;
}
.auth-email-toggle[aria-expanded="true"] .auth-email-chevron {
  transform: translateY(-50%) rotate(180deg);
}
.auth-oauth-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.auth-or { margin: 1.125rem 0 0.75rem; }
#screen-auth .error-line { min-height: 1.15rem; margin: 0.65rem 0 0; }
#screen-auth .error-line:empty { min-height: 0; margin: 0; }
#screen-auth .btn-primary { margin-top: 1rem; }
#screen-auth .btn-secondary { margin-top: 0.625rem; }
#screen-auth button:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}
.auth-server-row { margin-top: 0.875rem; }
.auth-server-line { display: flex; gap: 0.5rem; align-items: stretch; }
.auth-server-line .auth-input { flex: 1; }
.auth-server-line .btn-secondary { margin-top: 0; width: auto; padding: 0 1rem; }
.home-server-row { margin: 0.75rem 0 1rem; }
.home-server-hint { margin: 0.4rem 0 0; font: 400 0.75rem Nunito, sans-serif; color: var(--muted, #6b7280); }
.auth-skip {
  margin-top: auto;
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 1rem;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  font: 600 0.875rem Nunito, sans-serif;
}
.auth-skip:hover { color: var(--ink); }

.auth-standard-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.auth-standard-panel[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .auth-email-panel { animation: none; }
  .auth-email-chevron { transition: none; }
}

/* Account bubble: a round avatar chip at the top-right of the home header,
   horizontally aligned with the bear + ПАРА logo. Clicking it opens the
   account popover; any click outside closes it (see auth.js). */
.home-account-slot {
  position: relative;
  flex: none;
  width: 44px;
  height: 44px;
}
.home-plan-badge {
  position: absolute;
  z-index: 41;
  left: 50%;
  bottom: -0.42rem;
  transform: translateX(-50%);
  min-width: 2.35rem;
  padding: .14rem .4rem;
  border: 1px solid rgba(0, 108, 120, .22);
  border-radius: var(--r-pill);
  background: var(--card);
  color: var(--teal);
  font: 800 .52rem/1 Nunito, sans-serif;
  letter-spacing: .03em;
  white-space: nowrap;
  cursor: default;
  pointer-events: none;
  box-shadow: 0 .15rem .4rem rgba(27, 33, 68, .1);
}
.home-plan-badge[hidden] { display: none; }
/* App Store build: the Home plan badge is never shown. */
#home-plan-badge { display: none !important; }
.home-account {
  position: relative;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.home-account:hover { border-color: var(--teal); }
.home-account[hidden] { display: none; }
.home-account-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--line-soft);
  flex: none;
}
.home-account-initial {
  display: none;
  font: 800 1.125rem Nunito, sans-serif;
  color: #fff;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--teal);
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.home-account-avatar[hidden] { display: none; }
.home-account-avatar[hidden] + .home-account-initial,
.account-popover-avatar[hidden] + .home-account-initial { display: flex; }
/* The card is anchored so its top-right corner sits EXACTLY on the header
   chip (card top == chip top, card right == chip right); its own avatar
   bubble is pinned flush in that corner, covering the chip pixel-perfect.
   Opening morphs the card out of that circle: clip-path starts as the
   44px bubble circle and grows to the full rounded card; closing runs the
   same morph in reverse before the element is re-hidden (see auth.js). */
.account-popover {
  position: absolute;
  top: calc(50% - 32px);
  left: -1.15rem;
  right: -10px;
  z-index: 40;
  width: auto;
  min-width: 0;
  max-width: none;
  padding: 3.9rem 1rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: 0 14px 38px rgba(20, 20, 22, 0.18);
  text-align: left;
  clip-path: inset(10px 10px calc(100% - 54px) calc(100% - 54px) round 22px);
  transition: clip-path .3s cubic-bezier(.2, .9, .25, 1);
}
.account-popover.open {
  clip-path: inset(0 round var(--r-lg));
}
.account-popover[hidden] { display: none; }
.account-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.375rem;
}
.account-popover-head .home-account-name {
  position: absolute;
  top: 1.1rem;
  left: 1rem;
  right: calc(44px + 1.6rem);
}
.account-popover-bubble {
  position: absolute;
  top: 10px;
  right: 10px;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
}
.home-account-name {
  font: 700 0.9375rem Nunito, sans-serif;
  color: var(--ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-account-email {
  font: 500 0.75rem Nunito, sans-serif;
  color: var(--ink-soft);
  margin-bottom: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-language-section {
  padding: 0.75rem 0 0.875rem;
  border-top: 1px solid var(--line);
}
.account-language-title {
  margin-bottom: 0.625rem;
  color: var(--ink-soft);
  font: 800 0.6875rem Nunito, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.account-language-pairs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.95rem 0.65rem;
}
.account-language-pair {
  --account-pair-badge: 3.85rem;
  position: relative;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  font: 700 0.8rem Nunito, sans-serif;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.account-language-pair .account-language-pair-badge {
  --language-badge-size: var(--account-pair-badge);
  border-color: var(--line);
  box-shadow: 0 4px 10px rgba(27, 33, 68, .1);
}
.account-pair-delete {
  display: none;
  position: absolute;
  z-index: 3;
  top: -0.28rem;
  left: calc(50% + (var(--account-pair-badge) / 2) - 0.7rem);
  width: 1.4rem;
  height: 1.4rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #e23b32;
  color: #fff;
  box-shadow: 0 1px 3px rgba(20, 20, 22, .28);
  font: 800 1rem/1 Nunito, sans-serif;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.account-language-pairs.is-jiggling .account-pair-delete { display: flex; }
.account-language-pairs.is-jiggling .account-language-pair-badge {
  animation: account-pair-jiggle .16s linear infinite;
  transform-origin: 50% 55%;
}
@keyframes account-pair-jiggle {
  0%, 100% { transform: rotate(-2.2deg); }
  50% { transform: rotate(2.2deg); }
}
@media (prefers-reduced-motion: reduce) {
  .account-language-pairs.is-jiggling .account-language-pair-badge { animation: none; }
}
.account-language-pair-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-language-pair[aria-pressed="true"] {
  color: var(--ink);
}
.account-language-pair[aria-pressed="true"] .account-language-pair-badge {
  border-color: var(--orange);
  box-shadow: 0 0 0 2px rgba(249, 116, 21, .14), 0 5px 12px rgba(27, 33, 68, .12);
}
.account-language-pair:hover .account-language-pair-badge { border-color: var(--teal); }
.account-language-pair:active .account-language-pair-badge { transform: scale(.92); }
.account-language-pair:focus-visible { outline: none; }
.account-language-pair:focus-visible .account-language-pair-badge {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
}
.account-session-actions {
  display: flex;
  align-items: stretch;
  gap: 0.7rem;
}
.home-logout-btn {
  width: 100%;
  min-height: 40px;
  padding: 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font: 700 0.8125rem Nunito, sans-serif;
}
.account-session-actions .home-logout-btn {
  flex: 1;
  width: auto;
  min-width: 0;
  min-height: 3.35rem;
  padding: 0.7rem 0.55rem;
  border-radius: 1.65rem;
  font-size: 0.9rem;
  line-height: 1.15;
}
.home-logout-btn:hover { color: var(--ink); border-color: var(--ink-faint); }
.account-session-actions .account-delete-btn { margin-left: 0; }

.progress-steps { display: flex; align-items: center; gap: 0.75rem; flex: 1; min-width: 0; }
.progress-step { display: flex; align-items: center; gap: 0.3125rem; min-width: 0; }
.progress-step .step-dot {
  flex: none; width: 0.875rem; height: 0.875rem; border-radius: var(--r-pill);
  border: 2px solid var(--line); background: var(--card);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.5rem; line-height: 1; color: #fff;
}
.progress-step .step-label {
  font: 600 0.6875rem Nunito, sans-serif; color: var(--ink-faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.progress-step.current .step-dot { background: var(--green-500); border-color: var(--green-500); }
.progress-step.current .step-label { color: var(--ink); }
.progress-step.done .step-dot { background: var(--green-500); border-color: var(--green-500); }
.progress-step.done .step-dot::after { content: "\2713"; }
.progress-step.done .step-label { color: var(--green-600); }

.progress-bar-mobile { display: none; flex: 1; height: 4px; background: var(--line-soft); border-radius: var(--r-pill); overflow: hidden; }
.progress-bar-mobile-fill { height: 100%; background: var(--green-500); width: 20%; transition: width .3s ease; }

.streak-indicator { flex: none; display: flex; align-items: center; gap: 0.25rem; font: 700 0.8125rem Nunito, sans-serif; color: var(--amber-500); }
.streak-indicator .flame { font-size: 1rem; }

/* Mobile: 5 labeled dots don't fit a phone-width header - collapse to a
   single slim fill bar instead, per the spec ("On mobile it collapses to
   a slim progress bar"). */
@media (max-width: 37.5em) {
  .progress-steps { display: none; }
  .progress-bar-mobile { display: block; }
}

/* iOS long-press: never offer the system "Save Image / Share" sheet for
   the app's own artwork — icons, mascots, folder tiles, thumbnails are UI,
   not photos. Also stops the callout swallowing our own hold gestures
   (folder options, drag-to-folder). Inputs/textareas stay selectable. */
img,
svg,
button,
.tabbar,
.library-folder,
.player-dock,
.brand,
.page-brand,
.splash-screen {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  user-select: none;
}
input,
textarea {
  -webkit-user-select: auto;
  user-select: auto;
}

/* ---------- HOME ---------- */
/* Holding Main must not offer system text selection / the iOS callout. */
#screen-home,
#screen-home *:not(input):not(textarea) {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
#screen-home input,
#screen-home textarea {
  -webkit-user-select: auto;
  user-select: auto;
}
#screen-home .body { flex: 1; display: flex; min-height: 0; }
.home-main {
  flex: 1.3;
  padding: 1.375rem 1.625rem 0.875rem;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--line-soft);
  overflow-y: auto;
}
.home-main > * { flex-shrink: 0; }
/* Flexible spacers float the orange action group a bit above the centre
   of the screen (0.75 : 1 split of the free space); on a full desktop
   column there is no free space, so they collapse to nothing. */
.home-main > .home-flex-space { flex: 1 1 0; min-height: 0; }
.home-main > .home-flex-space-top { flex-grow: 0.75; }
/* The two main actions belong together: one orange-outlined bubble. */
.cta-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  border: 2px solid var(--orange);
  border-radius: var(--r-lg);
  background: transparent;
  margin-bottom: 0.5rem;
}
.cta-group > * { margin: 0; }
#screen-home .home-side { display: none; }
.home-side {
  flex: 1;
  padding: 1.375rem 1.375rem 0.875rem;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-y: auto;
}
.home-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.75rem;
}
.brand { display: flex; align-items: center; gap: 0.75rem; margin: 0; }
.brand-mascot { width: 4.25rem; height: 4.25rem; object-fit: contain; flex: none; }
.brand-text { display: flex; align-items: baseline; gap: 0.5rem; }
.brand h1 { margin: 0; font: 800 2rem Nunito, sans-serif; letter-spacing: -0.03em; color: var(--ink); }
.brand span { font: 700 0.625rem Nunito, sans-serif; letter-spacing: 0.16em; color: var(--teal); }
.tagline { margin: 0 0 1.125rem; font: 400 0.781rem Nunito, sans-serif; line-height: 1.45; color: var(--ink-faint); max-width: 27.5rem; }

.field-label {
  font: 600 0.75rem Nunito, sans-serif;
  color: var(--ink-soft);
  margin-bottom: 0.375rem;
}
.url-row {
  display: flex;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--card);
  align-items: center;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.home-main > .url-row:focus-within {
  border-color: var(--orange);
  box-shadow: 0 0 0 2px rgba(242, 122, 24, 0.22);
}
.url-row input {
  flex: 1;
  padding: 0.625rem 0.6875rem;
  border: 0;
  outline: none;
  font: 400 0.875rem Nunito, sans-serif;
  color: var(--ink);
  background: transparent;
  min-width: 0;
  min-height: 44px;
}
.url-row input::placeholder { color: var(--ink-faintest); }
.url-row button {
  flex: none;
  min-height: 44px;
  min-width: 44px;
  padding: 0 0.75rem;
  border: 0;
  border-left: 1px solid var(--line-soft);
  background: transparent;
  cursor: pointer;
  font: 600 0.75rem Nunito, sans-serif;
  color: var(--green-600);
}
.url-row button:hover { background: var(--green-50); }

.transcript-label { margin-top: 0.75rem; }
.transcript-label .dim {
  font-weight: 400;
  color: var(--ink-faint);
  text-transform: none;
}
.transcript-box {
  flex: none;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--card);
  overflow: hidden;
  min-height: 7.25rem;
}
.transcript-box textarea {
  display: block;
  width: 100%;
  height: 4.5rem;
  min-height: 4.5rem;
  padding: 0.625rem 0.6875rem;
  border: 0;
  outline: none;
  resize: vertical;
  font: 400 0.8125rem Nunito, sans-serif;
  color: var(--ink);
  background: transparent;
  line-height: 1.4;
}
.transcript-box textarea:disabled { opacity: 0.5; }
.transcript-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  border-top: 1px solid var(--line-soft);
  padding: 0 0.25rem;
}
.transcript-actions button {
  min-height: 44px;
  padding: 0 0.75rem;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: 600 0.75rem Nunito, sans-serif;
  color: var(--green-600);
}
.transcript-actions button:hover { background: var(--green-50); }
.transcript-actions button:disabled { opacity: 0.5; cursor: not-allowed; }
.transcript-status {
  margin-left: auto;
  padding-right: 0.5rem;
  font: 400 0.6875rem Nunito, sans-serif;
  color: var(--ink-faint);
}

.test-video-toggle {
  display: flex; align-items: center; gap: 0.4375rem; margin-top: 0.5rem;
  min-height: 44px; font-size: 0.844rem; color: var(--ink-soft); cursor: pointer; user-select: none;
}
.test-video-toggle input { margin: 0; width: 1.125rem; height: 1.125rem; flex: none; accent-color: var(--green-500); }
.test-video-toggle .dim { color: var(--ink-faint); font-size: 0.75rem; }

.error-line { min-height: 1rem; margin-top: 0.375rem; font-size: 0.6875rem; color: var(--red-500); }
.quota-note {
  margin-top: 0.5rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--green-500);
  border-radius: var(--r-sm);
  background: var(--green-50);
  color: var(--ink);
  font: 600 0.75rem Nunito, sans-serif;
  line-height: 1.4;
}
.quota-note[hidden] { display: none !important; }

.grab-captions-btn {
  margin-top: 0.625rem;
  border-color: var(--green-500);
  color: var(--green-600);
}
#gemini-captions-btn {
  display: block;
  width: 100%;
  margin-top: 0.625rem;
  border: 0;
  background: var(--orange);
  color: #fff;
}
#gemini-captions-btn:hover { background: var(--orange-600); color: #fff; }
#native-api-block { margin-top: 0.75rem; }
.native-api-note { margin: 0.35rem 0 0; font-size: 0.6875rem; line-height: 1.35; }
#gemini-captions-btn[hidden] + #gemini-caption-note { display: none; }

.grabber-panel {
  margin-top: 0.5rem;
  padding: 0.625rem 0.75rem 0.75rem;
  border: 1px solid var(--green-500);
  border-radius: var(--r-sm);
  background: var(--green-50);
}
.grabber-lead {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--ink);
}
.grabber-steps {
  margin: 0 0 0.5rem;
  padding-left: 1.125rem;
  font-size: 0.75rem;
  color: var(--ink-soft);
  line-height: 1.45;
}
.grabber-steps kbd {
  display: inline-block;
  padding: 0 0.3rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
  font: 600 0.6875rem "IBM Plex Mono", monospace;
}
.grabber-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}
.grabber-actions button,
.grabber-bookmark {
  min-height: 36px;
  padding: 0 0.625rem;
  border: 0;
  border-radius: 6px;
  background: var(--card);
  color: var(--green-600);
  cursor: pointer;
  font: 600 0.75rem Nunito, sans-serif;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.grabber-actions button:hover,
.grabber-bookmark:hover { background: #fff; }
.grabber-panel textarea {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
  min-height: 3.5rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  font: 400 0.625rem "IBM Plex Mono", monospace;
  color: var(--ink-soft);
  resize: vertical;
}
.grabber-status {
  margin-top: 0.375rem;
  font: 400 0.6875rem Nunito, sans-serif;
  color: var(--green-600);
}
.grabber-advanced {
  margin-top: 0.5rem;
  font-size: 0.6875rem;
  color: var(--ink-soft);
}
.grabber-advanced summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--green-600);
}
.grabber-advanced p { margin: 0.375rem 0; }
#app-frame.is-phone .grabber-advanced,
#auto-sync-btn,
#screen-read-btn,
#screen-stop-btn,
#app-frame.is-phone #screen-read-btn,
#app-frame.is-phone #screen-stop-btn,
#app-frame.is-phone .desktop-caption-tools { display: none !important; }
#app-frame:not(.is-phone) #phone-caption-help { display: none !important; }

.phone-help {
  margin-top: 0.5rem;
  padding: 0.625rem 0.75rem 0.75rem;
  border: 1px solid var(--green-500);
  border-radius: var(--r-sm);
  background: var(--green-50);
}
.phone-help-detail {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--ink-soft);
}
.transcript-box.drop-hover { outline: 2px dashed var(--green-500); background: var(--green-50); }

.btn-primary {
  margin-top: 0.75rem;
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 1rem;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--orange);
  color: #fff;
  cursor: pointer;
  font: 700 0.9375rem Nunito, sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: background .12s ease, transform .05s ease;
}
.btn-primary:hover { background: var(--orange-600); }
.btn-primary:active { background: var(--orange-600); transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.hint-row {
  display: flex;
  align-items: flex-start;
  gap: 0.375rem;
  margin-top: 0.625rem;
  font-size: 0.6875rem;
  color: var(--ink-faint);
  line-height: 1.4;
}
.hint-row .dot { flex: none; width: 0.3125rem; height: 0.3125rem; margin-top: 0.25rem; border-radius: var(--r-pill); background: var(--green-500); }

/* YouTube search is a confirmed dead end (see the HTML comment on
   #youtube-search-block) - hidden, not deleted. Remove this rule (not the
   markup/JS/backend) to bring it back if that ever changes. */
#youtube-search-block { display: none; }

.or-divider {
  display: flex; align-items: center; gap: 0.625rem; margin: 0.875rem 0 1.375rem;
  font: 600 0.6875rem Nunito, sans-serif; color: var(--ink-faint);
}
.or-divider::before, .or-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
/* No word in the middle → one continuous line. */
.or-divider:empty { gap: 0; }

/* Transparent capsule outlined in the app's blue. */
.upload-dropzone {
  display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 0.5rem;
  width: 100%; padding: 0.75rem 1rem; min-height: 48px;
  border: 2px solid var(--teal); border-radius: var(--r-pill); background: transparent;
  cursor: pointer; text-align: center;
  transition: border-color .12s ease, background .12s ease;
}
.upload-dropzone:hover { background: rgba(0, 169, 183, 0.08); }
.upload-dropzone:disabled { opacity: .6; cursor: default; }
.upload-icon { font-size: 1.125rem; color: var(--teal); line-height: 1; }
.upload-text { font: 700 0.875rem Nunito, sans-serif; color: var(--teal); }
.upload-policy {
  margin: 0.4rem 0 0;
  text-align: center;
  font: 600 0.6875rem/1.35 Nunito, sans-serif;
  color: var(--ink-faint);
}

.recent-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5625rem; }
.recent-title {
  font: 600 0.75rem Nunito, sans-serif;
  color: var(--ink-soft);
}
.results-clear {
  flex: none; border: 0; background: transparent; cursor: pointer; padding: 0;
  font: 600 0.6875rem Nunito, sans-serif; color: var(--green-600);
}
.results-clear:hover { color: var(--green-500); }
.search-result-thumb {
  flex: none; width: 3.75rem; height: 100%; object-fit: cover; background: var(--line-soft);
}
.recent-list { display: flex; flex-direction: column; gap: 0.5rem; }
.recent-swipe {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-md);
  touch-action: pan-y;
}
.recent-delete-banner {
  position: absolute;
  inset: 0 0 0 auto;
  width: 5.5rem;
  background: #DC2626;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 800 0.75rem Nunito, sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.recent-swipe.removing { transition: height .2s ease, opacity .2s ease, margin .2s ease; }
.recent-item {
  display: flex;
  gap: 0.625rem;
  align-items: stretch;
  padding: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--card);
  cursor: pointer;
  text-align: left;
  width: 100%;
  min-height: 44px;
  position: relative;
  z-index: 1;
  transition: transform .2s ease;
  user-select: none;
  -webkit-user-select: none;
}
.recent-item:hover { border-color: var(--green-500); }
.recent-thumb {
  flex: none;
  width: 3.75rem;
  object-fit: cover;
  background: repeating-linear-gradient(135deg, var(--green-600) 0 4px, var(--green-500) 4px 8px);
}
.recent-info { flex: 1; padding: 0.4375rem 0.5625rem 0.4375rem 0; min-width: 0; }
.recent-info .t {
  font: 600 0.8125rem Nunito, sans-serif;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-info .meta { font: 400 0.625rem "IBM Plex Mono", monospace; color: var(--ink-faintest); margin-top: 0.25rem; }
.empty-note { font-size: 0.719rem; color: var(--ink-faintest); }

/* Circular ring on each Recent card showing the share of THIS video's
   saved pool words that have reached the final SRS step ("mastered") -
   there's no tracked total-vocabulary-per-video (lemmas are only looked
   up lazily on tap, not for a whole transcript), so this deliberately
   measures "% of what you saved, not the whole video" rather than
   fabricating a vocabulary-coverage number the app can't actually back up.
   Omitted entirely (see renderRecents() in app.js) until at least one word
   from that video has been saved. */
.recent-progress { flex: none; align-self: center; margin-right: 0.625rem; }
.recent-progress circle { fill: none; stroke-width: 3; }
.recent-progress circle.track { stroke: var(--line); }
.recent-progress circle.fill {
  stroke: var(--green-500); stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: 50% 50%;
  transition: stroke-dashoffset .3s ease;
}

/* Narrow/portrait phone: side-by-side home columns become too cramped to
   read - stack them instead, main content first. */
@media (max-width: 37.5em), (orientation: portrait) {
  #screen-home .body {
    flex-direction: column;
    overflow-y: auto;
  }
  .home-main {
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
    flex: none;
    overflow: visible;
    /* Give the flex spacers real room on phones so the orange action
       group floats a little above the centre of the screen, with the
       upload capsule below it and Recent further down. */
    min-height: 64vh;
  }
  .home-main > .home-flex-space-top { flex-grow: 1.5; }
  .home-side {
    flex: none;
    overflow: visible;
    padding-bottom: 1.25rem;
  }
}

/* ---------- RANGE SELECT ---------- */
#screen-range { overflow-x: hidden; }
#screen-range .range-body {
  flex: 1; min-height: 0; min-width: 0; padding: 1.125rem 1.625rem; display: flex; flex-direction: column;
  gap: 0.625rem; max-width: 27.5rem; overflow-x: hidden; overflow-y: auto;
}
.range-head { display: flex; align-items: center; gap: 0.625rem; margin-bottom: 0.25rem; }
#screen-range .icon-btn {
  color: var(--ink);
  text-shadow: none;
  border: 1px solid var(--line);
  border-radius: 50%;
}
#screen-range .icon-btn:hover { background: var(--green-50); }
.range-title { min-width: 0; }
.range-title .t {
  font: 600 1rem Nunito, sans-serif;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.range-title .s { font: 400 0.625rem "IBM Plex Mono", monospace; color: var(--ink-faint); margin-top: 0.125rem; }
/* Part 3: "two large selectable option cards" - the whole label is the
   card (border+radius+tint), not just a radio+text row. :has() picks up
   the selected state straight off the native radio rather than needing a
   JS-toggled class, matching whichever native input is actually checked. */
.range-option {
  display: flex; align-items: center; gap: 0.75rem; cursor: pointer;
  font: 600 0.9375rem Nunito, sans-serif; padding: 0.875rem 1rem; min-height: 44px;
  border: 2px solid var(--line); border-radius: var(--r-lg); background: var(--card);
  margin-bottom: 0.625rem;
  transition: border-color .12s ease, background .12s ease;
}
.range-option:has(input:checked) { border-color: var(--green-500); background: var(--green-50); }
.range-option input[type="radio"] { accent-color: var(--green-500); width: 1.25rem; height: 1.25rem; flex: none; }
.range-option select {
  margin-left: auto; font: 400 0.8125rem Nunito, sans-serif; border-radius: var(--r-sm);
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
  padding: 0.5rem 0.375rem; min-height: 40px; max-width: 11rem;
}
.range-custom-fields { margin: 0 0 0.625rem; padding: 0; min-width: 0; max-width: 100%; }
.range-slider-block {
  min-width: 0;
  max-width: 100%;
  padding: 0 0.875rem;
  box-sizing: border-box;
}
.range-slider-block[hidden] { display: none !important; }
.range-custom-times {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
  min-width: 0;
  max-width: 100%;
}
.range-custom-times[hidden] { display: none !important; }
.range-custom-times label {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font: 600 0.75rem Nunito, sans-serif;
}
.range-custom-times input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  font: 400 0.9375rem "IBM Plex Mono", monospace;
  padding: 0.5rem 0.625rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--card);
  color: var(--ink);
  min-height: 44px;
}
.range-caption-hint { margin: 0.25rem 0 0; min-width: 0; }
.range-more {
  align-self: flex-start;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--green-600);
  font: 700 0.75rem Nunito, sans-serif;
  cursor: pointer;
  text-decoration: underline;
}
.range-more[hidden] { display: none !important; }
.range-caption-details {
  margin: 0;
  min-width: 0;
  font-size: 0.6875rem;
  line-height: 1.4;
  color: var(--ink-faint);
}
.range-caption-details[hidden] { display: none !important; }

/* Classic dual-range trick: two overlaid native <input type="range">s, each
   with a transparent track and pointer-events only on its own thumb, so
   either handle can be grabbed independently. The touch hit area (44px) is
   taller than the visible track, centered on it via negative margin on the
   thumb, so the slider stays visually slim but is comfortable to grab. */
.range-slider { position: relative; height: 44px; }
.range-slider-track {
  position: absolute; top: 50%; left: 0; right: 0; height: 3px;
  background: var(--line); transform: translateY(-50%);
}
.range-slider-fill {
  position: absolute; top: 50%; height: 3px; background: var(--green-500); transform: translateY(-50%);
}
.range-slider input[type="range"] {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; margin: 0;
  background: transparent; -webkit-appearance: none; appearance: none; pointer-events: none;
}
.range-slider input[type="range"]::-webkit-slider-runnable-track { background: transparent; }
.range-slider input[type="range"]::-moz-range-track { background: transparent; }
.range-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; pointer-events: auto;
  width: 1.75rem; height: 1.75rem; border-radius: 50%; margin-top: calc(1.5px - 0.875rem);
  background: var(--green-500); border: 2px solid #fff; cursor: pointer;
  box-shadow: 0 0 0 1px var(--green-500);
}
.range-slider input[type="range"]::-moz-range-thumb {
  pointer-events: auto; width: 1.75rem; height: 1.75rem; border-radius: 50%; border: none;
  background: var(--green-500); box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--green-500); cursor: pointer;
}
.range-slider-labels {
  display: flex; justify-content: space-between; margin-top: 0.25rem;
  font: 400 0.6875rem "IBM Plex Mono", monospace; color: var(--ink-faint);
}
#screen-range .btn-primary { margin-top: 0.375rem; }

/* ---------- LOADING ---------- */
#screen-loading .loading-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1.25rem 2rem;
  overflow-y: auto;
}
/* Decoder animation (matches the reference GIF): a spaced uppercase word
   churns through glitch glyphs in teal, then settles letter by letter into
   navy — ПАРА / WATCH / LEARN / IMPROVE on a loop (app.js drives it), with
   the two brand dots underneath. */
.loading-anim {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.75rem;
}
.scramble-word {
  font: 800 1.45rem Nunito, sans-serif;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-align: center;
  color: var(--ink);
  min-height: 1.4em;
  white-space: nowrap;
}
.scramble-word .sc-run {
  color: var(--teal);
  text-shadow: 0 0 12px rgba(0, 169, 183, 0.45);
}
.scramble-word .sc-set { color: var(--ink); }
/* The splash keeps its big wordmark size; only the churn colors change. */
.splash-word.scramble-word { font-size: 2.75rem; letter-spacing: 0.08em; }
.splash-word.typewriter {
  font: 600 2.3rem "IBM Plex Mono", monospace;
  letter-spacing: 0.06em;
  min-height: 1.3em;
  display: flex;
  align-items: center;
}
.typewriter .tw-ink { color: var(--ink, #1B2144); }
.typewriter .tw-o { color: var(--orange, #F27A18); }
.typewriter .tw-t { color: var(--teal, #00A9B7); }
.tw-cursor {
  display: inline-block;
  width: 3px;
  height: 1.05em;
  margin-left: 0.12em;
  background: #1B2144;
  animation: tw-blink 0.85s steps(1) infinite;
}
@keyframes tw-blink { 50% { opacity: 0; } }
}
.loading-frame {
  width: 100%;
  max-width: 20rem;
  aspect-ratio: 16/9;
  background: var(--card);
  border: 1px solid var(--line);
  display: flex;
  align-items: flex-end;
  padding: 0.5rem;
  margin-bottom: 1.375rem;
}
.loading-frame span { font: 400 0.5625rem "IBM Plex Mono", monospace; color: var(--ink-faint); letter-spacing: 0.1em; }
.steps-title { width: 100%; max-width: 20rem; font: 600 0.75rem Nunito, sans-serif; color: var(--ink-soft); margin-bottom: 0.75rem; }
.steps { width: 100%; max-width: 20rem; display: flex; flex-direction: column; gap: 0.6875rem; }
.step-row { display: flex; gap: 0.625rem; align-items: center; }
.step-mark {
  flex: none; width: 0.8125rem; height: 0.8125rem; border: 1px solid var(--line); border-radius: var(--r-pill);
  display: flex; align-items: center; justify-content: center;
  font: 400 0.5625rem monospace; color: #fff; background: transparent;
}
.step-mark.done { background: var(--green-500); border-color: var(--green-500); }
.step-label { flex: 1; font: 400 0.8125rem Nunito, sans-serif; color: var(--ink-faintest); }
.step-label.active { color: var(--ink); }
.step-label.done { color: var(--ink); }
.step-note { font: 400 0.625rem "IBM Plex Mono", monospace; color: var(--ink-faintest); }
.progress-row {
  width: 100%;
  max-width: 20rem;
  margin-top: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.progress-track { flex: 1; height: 4px; background: var(--line-soft); border-radius: var(--r-pill); overflow: hidden; }
.progress-fill { height: 100%; background: var(--green-500); width: 0%; transition: width 0.45s ease-out; }
.progress-pct { flex: none; min-width: 3.2rem; text-align: right; font: 700 0.95rem "IBM Plex Mono", monospace; color: var(--green-600); }

/* ---------- PLAYER ---------- */
#screen-player {
  position: relative;
  background: var(--paper);
  overflow: hidden;
  container-type: inline-size;
  container-name: para-player;
  --dock-safe-r: env(safe-area-inset-right, 0px);
  --dock-safe-b: var(--para-safe-bottom, env(safe-area-inset-bottom, 0px));
  --dock-safe-t: var(--para-safe-top, env(safe-area-inset-top, 0px));
  --dock-shift-x: -20px;
  --dock-shift-y: calc(-28px - var(--dock-safe-b));
  --pocket-top: 12px;
  --dock-opt-top: 16px;
  --pocket-w: 204px;
  --pocket-h: 286px;
  --pocket-radius: 30px;
  --pocket-right: 15px;
  --pocket-bottom: 25px;
  --pocket-divider: 80px;
  --dock-opt-w: 70px;
  --dock-opt-h: 77px;
  --dock-art: 49px;
  --dock-label: 12px;
  --dock-label-lh: 16px;
  --dock-opt-right: 20px;
  --dock-opt-bottom: 26px;
  --dock-label-gap: 5px;
}
@media (orientation: landscape) {
  #screen-player {
    --dock-shift-y: 20px;
    --pocket-top: 12px;
    --dock-opt-top: 16px;
    --pocket-w: 244px;
    --pocket-h: 178px;
    --pocket-radius: 27px;
    --pocket-divider: 87px;
    --dock-opt-w: 62px;
    --dock-opt-h: 69px;
    --dock-art: 44px;
  }
}
@container para-player (max-width: 460px) {
  @media (orientation: landscape) {
    .player-dock,
    .player-body {
      --dock-shift-x: -12px;
      --dock-shift-y: 8px;
      --pocket-top: 4px;
      --dock-opt-top: 6px;
      --pocket-w: 230px;
      --pocket-h: 132px;
      --pocket-radius: 21px;
      --pocket-right: 8px;
      --pocket-bottom: 5px;
      --pocket-divider: 65px;
      --dock-opt-w: 62px;
      --dock-opt-h: 50px;
      --dock-art: 32px;
      --dock-label: 11px;
      --dock-label-lh: 14px;
      --dock-opt-right: 12px;
      --dock-opt-bottom: 10px;
      --dock-label-gap: 3px;
    }
  }
}
.player-topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1rem;
  background: linear-gradient(180deg, rgba(0,0,0,.45) 0%, rgba(0,0,0,0) 100%);
  transition: opacity .35s ease;
}
/* A / Read / words stay up — only the bottom transport fades. */
.icon-btn {
  flex: none; width: 44px; height: 44px;
  border: 0;
  background: transparent; color: #fff;
  cursor: pointer; font: 500 1.125rem Nunito, sans-serif; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  text-shadow: 0 1px 8px rgba(0,0,0,.45);
}
.icon-btn:hover { background: rgba(255,255,255,.12); border-radius: 50%; }
.player-title { flex: 1; min-width: 0; }
.player-title .t { font: 600 0.875rem "Barlow Condensed", sans-serif; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-title .s { font: 400 0.594rem "IBM Plex Mono", monospace; color: rgba(214,235,255,.6); margin-top: 0.0625rem; }
.badge {
  flex: none; font: 500 0.5625rem "IBM Plex Mono", monospace; letter-spacing: 0.12em;
  padding: 0.1875rem 0.5rem; border: 1px solid rgba(148,188,227,.5); color: #b5d9fd; white-space: nowrap;
}
.lyrics-btn {
  flex: none; min-width: 44px; min-height: 36px;
  font: 700 0.75rem Nunito, sans-serif; letter-spacing: 0.08em;
  padding: 0.25rem 0.625rem; border: 0; background: transparent;
  color: #fff; cursor: pointer; text-transform: uppercase; text-align: center;
  text-shadow: 0 1px 8px rgba(0,0,0,.45);
}
.lyrics-btn:hover { background: rgba(255,255,255,.12); border-radius: var(--r-pill); }
.lyrics-btn.listening { color: #fff; background: var(--teal); border-radius: var(--r-pill); text-shadow: none; }

/* Corner pocket hub. Portrait anchors the lower-right curve. Landscape
   anchors a separate top-right disc. Idle opacity is only on the corner
   and PARA — never on the open frame or its labels. */
.player-dock {
  --dock-orb: clamp(54px, 16cqw, 62px);
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  overflow: visible;
}
.dock-corner {
  position: absolute;
  right: var(--dock-safe-r);
  bottom: 0;
  width: calc(var(--dock-orb) + 10px);
  height: calc(var(--dock-orb) + 12px);
  border-radius: 31px 0 0 0;
  background: linear-gradient(145deg, var(--card), var(--paper) 70%);
  box-shadow: inset 1px 1px 0 var(--line);
  opacity: 0.82;
  z-index: 0;
  transition: opacity .2s ease;
}
.player-dock.lifted .dock-corner { opacity: 0; }
.player-dock.idle:not(.lifted) .dock-corner {
  opacity: 0.5;
  transition: opacity .55s ease;
}
.dock-toggle {
  position: absolute;
  right: calc(4px + var(--dock-safe-r));
  bottom: 6px;
  width: var(--dock-orb);
  height: var(--dock-orb);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  opacity: 1;
  z-index: 4;
  transform: translate(0, 0);
  transition: transform .25s cubic-bezier(.22, 1, .36, 1);
  touch-action: manipulation;
}
.player-dock.lifted .dock-toggle {
  transform: translate(var(--dock-shift-x), var(--dock-shift-y));
}
/* Dim the artwork, not the button. A half-opaque hit target makes iOS
   spend the first tap "waking" the bubble and drop the click. */
.dock-toggle img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
  opacity: 1;
  transition: opacity .55s ease;
}
.player-dock.idle:not(.lifted) .dock-toggle img { opacity: 0.5; }
.player-dock.lifted .dock-toggle img {
  opacity: 1;
  transition: opacity 0s linear;
}
.dock-pocket {
  position: absolute;
  right: calc(var(--pocket-right) + var(--dock-safe-r));
  bottom: calc(var(--pocket-bottom) + var(--dock-safe-b));
  width: var(--pocket-w);
  height: var(--pocket-h);
  box-sizing: border-box;
  border-radius: var(--pocket-radius);
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(155deg, var(--card), var(--paper) 55%);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(27, 33, 68, 0.16), inset 0 1px 0 var(--card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transform: scale(0.16, 0.22);
  transform-origin: calc(100% - 40px) calc(100% - 38px);
  transition: transform .36s cubic-bezier(.22, 1, .36, 1), opacity .18s ease;
}
.player-dock.open .dock-pocket {
  opacity: 0.65;
  transform: scale(1);
}
.player-dock.lifted .dock-pocket { pointer-events: auto; }
.dock-pocket::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: var(--pocket-divider);
  height: 1px;
  background: var(--line);
  pointer-events: none;
}
.player-dock-menu { position: absolute; inset: 0; overflow: visible; pointer-events: none; z-index: 2; }
.dock-bubble {
  position: absolute;
  right: calc(var(--dock-opt-right) + var(--dock-safe-r));
  bottom: calc(var(--dock-opt-bottom) + var(--dock-safe-b));
  width: var(--dock-opt-w);
  height: var(--dock-opt-h);
  min-width: 44px;
  min-height: 44px;
  box-sizing: border-box;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  overflow: visible;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  transform: scale(0.18);
  transition: transform .36s cubic-bezier(.22, 1, .36, 1), opacity .18s ease, visibility .36s;
}
.player-dock.open .dock-bubble {
  opacity: 1;
  visibility: visible;
  pointer-events: none;
  transition-delay: calc(var(--dock-order, 0) * 18ms);
}
.player-dock.open.armed .dock-bubble { pointer-events: auto; }
.player-dock:not(.open) .dock-bubble { transition-delay: 0ms; }
.player-dock.open #caption-mode-btn { transform: translate(-111px, -186px); }
.player-dock.open #size-cycle-btn { transform: translate(-26px, -186px); }
.player-dock.open #speed-cycle-btn { transform: translate(-111px, -97px); }
.player-dock.open #theme-toggle-btn { transform: translate(-26px, -97px); }
.player-dock.open #goto-pool { transform: translate(-111px, -8px); }
@media (orientation: landscape) {
  /* Top-right hub. Landscape has no corner patch behind PARA — only the
     bubble. Portrait keeps the bottom-right wedge. The menu unfolds down. */
  .dock-corner { display: none; }
  .dock-toggle {
    top: calc(6px + var(--dock-safe-t));
    right: calc(4px + var(--dock-safe-r));
    bottom: auto;
  }
  .dock-pocket {
    top: calc(var(--pocket-top) + var(--dock-safe-t));
    right: calc(var(--pocket-right) + var(--dock-safe-r));
    bottom: auto;
    transform-origin: calc(100% - 34px) 28px;
  }
  .dock-bubble {
    top: calc(var(--dock-opt-top) + var(--dock-safe-t));
    right: calc(var(--dock-opt-right) + var(--dock-safe-r));
    bottom: auto;
  }
  .player-dock.open #caption-mode-btn { transform: translate(-151px, 93px); }
  .player-dock.open #size-cycle-btn { transform: translate(-77px, 93px); }
  .player-dock.open #speed-cycle-btn { transform: translate(-3px, 93px); }
  .player-dock.open #goto-pool { transform: translate(-151px, 9px); }
  .player-dock.open #theme-toggle-btn { transform: translate(-77px, 9px); }
}
@container para-player (max-width: 460px) {
  @media (orientation: landscape) {
    .player-dock.open #caption-mode-btn { transform: translate(-152px, 64px); }
    .player-dock.open #size-cycle-btn { transform: translate(-76px, 64px); }
    .player-dock.open #speed-cycle-btn { transform: translate(0, 64px); }
    .player-dock.open #goto-pool { transform: translate(-152px, 8px); }
    .player-dock.open #theme-toggle-btn { transform: translate(-76px, 8px); }
  }
}
.dock-art,
.dock-glyph {
  position: relative;
  width: var(--dock-art);
  height: var(--dock-art);
  flex: none;
}
.dock-art {
  display: block;
  border-radius: 50%;
  overflow: hidden;
}
/* Speed and Practice art is a clear glass sphere. A dark grey disc behind
   it keeps the white numeral and the book readable on the light pocket. */
#speed-cycle-btn .dock-art,
#goto-pool .dock-art {
  background: #3a3a3a;
}
/* The speed PNG is a glass sphere inset inside the chip. Scale it so the
   sphere edge meets the circular chip. The Speed label stays outside. */
#speed-cycle-btn .dock-face {
  transform-origin: center center;
  transform: translate(0.43%, 6.51%) scale(1.493);
}
.dock-glyph .dock-art { width: 100%; height: 100%; }
.dock-label {
  display: block;
  flex: none;
  margin: var(--dock-label-gap) 0 0;
  font: 500 var(--dock-label) / var(--dock-label-lh) Nunito, sans-serif;
  color: var(--ink);
  white-space: nowrap;
  pointer-events: none;
}
.dock-bubble img,
.dock-bubble .book-icon {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 0;
  pointer-events: none;
  mix-blend-mode: normal;
  object-fit: cover;
  object-position: center;
}
.dock-bubble .book-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: normal;
}
.dock-face,
.dock-spin {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transition: opacity .12s linear;
}
.dock-face.on { opacity: 1; }
#caption-mode-btn .dock-face:not(.on),
#caption-mode-btn:not(.spinning) .dock-spin {
  visibility: hidden;
}
#caption-mode-btn .dock-face.on { visibility: visible; }
#caption-mode-btn.spinning .dock-face { visibility: hidden; }
#caption-mode-btn.spinning .dock-spin { visibility: visible; }
.dock-hint {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  pointer-events: none;
}
/* Bubbles whose artwork IS the animation (theme sphere always; the mode-A
   bubble in portrait, where its only job is the rotate hint). They rest on
   a still first frame; JS swaps in a play-once file on tap. */
.dock-anim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 1;
  pointer-events: none;
  display: none;
}
.dock-theme .dock-anim { display: block; }
@media (orientation: portrait) {
  #caption-mode-btn .dock-face,
  #caption-mode-btn .dock-spin,
  #caption-mode-btn .dock-hint { display: none; }
  /* The original hint file has a transparent canvas with its sphere at
     ~57% of it. At rest, zoom 1.48x so the sphere matches the other
     bubble faces. While the hint plays, zoom smoothly down so the whole
     scene — phone AND red arrow — fits inside the bubble, then zoom back:
     nothing is ever cropped or hidden behind a neighbouring bubble. */
  #caption-mode-btn .dock-anim {
    display: block;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: scale(1.48);
    transition: transform .25s ease;
  }
  #caption-mode-btn.hinting .dock-anim { transform: scale(1.12); }
  /* And while playing, sit above the neighbouring bubbles. */
  #caption-mode-btn.hinting { z-index: 40; }
}
@media (orientation: landscape) {
  /* The portrait rotate-hint is a separate full-canvas image. Keeping it
     out of landscape prevents its A sphere from painting over the live
     A/B face or the liquid transition animation. */
  #caption-mode-btn .dock-anim {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
  }
}
.dock-bubble.spinning .dock-face { opacity: 0; }
.dock-bubble.spinning .dock-spin { opacity: 1; }
.dock-bubble.hinting .dock-face,
.dock-bubble.hinting .dock-spin { opacity: 0; transition: none; }
.dock-bubble.hinting .dock-hint { opacity: 1; }
#goto-pool .dock-count {
  min-width: 1.05rem;
  height: 1.05rem;
  font-size: 0.42rem;
}
/* Black sphere PNGs key out the core with the backdrop. Keep a solid
   inner disc on the artwork circle so the dark ball stays a ball, not a
   hollow glass rim, and the label stays outside that clip. */
.dock-theme .dock-art::before {
  content: "";
  position: absolute;
  inset: 16%;
  border-radius: 50%;
  z-index: 0;
  pointer-events: none;
  background: #111;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.16);
}
.dock-theme[data-theme="light"] .dock-art::before {
  background: #FFF8EF;
  box-shadow: none;
}
.dock-theme .dock-face,
.dock-theme .dock-spin,
.dock-theme .dock-anim {
  z-index: 1;
}
.dock-theme.spinning .dock-spin { opacity: 0; }
.dock-theme.spinning[data-spin-dir="to-dark"] .dock-spin[data-spin="to-dark"] { opacity: 1; }
.dock-theme.spinning[data-spin-dir="to-light"] .dock-spin[data-spin="to-light"] { opacity: 1; }
#theme-ripple {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: #000;
  overflow: hidden;
}
#theme-ripple.ripple-light {
  --ink: #1B2144;
  --ink-soft: #4A5168;
  --ink-faint: #8B90A3;
  --paper: #FFF8EF;
  --card: #FFFFFF;
  --line: #F0E4D2;
}
#theme-ripple.ripple-dark {
  --ink: #E8DCC8;
  --ink-soft: #C4B49A;
  --ink-faint: #8F836F;
  --paper: #000000;
  --card: #161616;
  --line: #2A2A2A;
}
#theme-ripple .theme-ripple-lyrics,
#theme-ripple .theme-ripple-karaoke {
  pointer-events: none;
}
.karaoke-overlay.theme-wipe-under { z-index: 2 !important; }
@media (prefers-reduced-motion: reduce) {
  .player-dock,
  .dock-corner,
  .dock-toggle,
  .dock-pocket,
  .dock-bubble {
    transition-duration: 0.01ms;
    transition-delay: 0ms;
  }
}
.dock-count {
  position: absolute;
  right: -0.15rem;
  bottom: -0.1rem;
  z-index: 1;
  min-width: 1.45rem;
  height: 1.45rem;
  padding: 0 0.22rem;
  border-radius: 999px;
  background: var(--orange);
  color: #fff;
  font: 800 0.55rem Nunito, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
  mix-blend-mode: normal;
}

.bubble-picker { position: relative; flex: none; }
.bubble-picker-options {
  display: none;
  position: absolute;
  bottom: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  gap: 0.35rem;
  z-index: 6;
}
.bubble-picker.open .bubble-picker-options { display: flex; }
.pick-bubble {
  width: 2.35rem;
  height: 2.35rem;
  border: 2px solid rgba(255,255,255,.5);
  border-radius: 50%;
  padding: 0;
  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,.65) 0 14%, transparent 38%),
    linear-gradient(165deg, #7fe4ec 0%, #00A9B7 50%, #007986 100%);
  color: #fff;
  cursor: pointer;
  font: 800 0.7rem Nunito, sans-serif;
  box-shadow: inset 0 -5px 8px rgba(0,0,0,.16), 0 2px 8px rgba(0,0,0,.25);
}
.pick-bubble-wide { width: 2.7rem; font-size: 0.62rem; }
.pick-bubble-main { box-shadow: inset 0 -5px 8px rgba(0,0,0,.16), 0 0 0 2px rgba(255,255,255,.2); }
.read-btn {
  flex: none;
  min-width: 6.25rem;
  min-height: 44px;
  padding: 0.45rem 1.15rem;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--orange);
  color: #fff;
  cursor: pointer;
  font: 800 0.95rem Nunito, sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  box-shadow: 0 2px 14px rgba(242, 122, 24, 0.5);
}
.read-btn:hover { background: var(--orange-600); }
.read-btn.listening {
  background: var(--teal);
  box-shadow: 0 2px 14px rgba(0, 169, 183, 0.45);
}
.watch-along-btn { font-size: 0.7rem; }
.tap-follow-hint {
  flex: none;
  margin: 0.35rem 0.75rem 0;
  padding: 0.55rem 0.75rem;
  border-radius: 0.75rem;
  background: var(--orange);
  color: #fff;
  font: 800 0.8rem Nunito, sans-serif;
  text-align: center;
  letter-spacing: 0.02em;
}
#app-frame.is-phone .lyrics-line { opacity: 0.72; }
.auto-sync-status {
  flex: none;
  max-width: 14rem;
  font: 400 0.5625rem "IBM Plex Mono", monospace;
  color: rgba(214,235,255,.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#screen-player.follow-script .sync-control { display: none; }
/* Never hide the A-mode overlay during Read. Hiding it on each grab
   is what made the captions flicker. */
#screen-player[data-caption-mode="a"] .side-lyrics,
#screen-player[data-caption-mode="a"] .side-split-handle {
  display: none !important;
  width: 0 !important;
}

/* player-body fills the screen below the topbar overlay; player-stage is
   full width in modes a/b, ~2/3 in mode c (side-lyrics is the other ~1/3,
   collapsed to 0 width otherwise). player-stage centers video-box, which
   is the actual 16:9 box (via aspect-ratio + max-width/max-height:100%,
   the standard "fit within available space, keep the ratio" combo) - the
   video and every overlay positioned relative to it (captions, tap-
   catcher, transport) stay aligned with the real rendered video no matter
   the surrounding screen's own shape (portrait phone, landscape phone,
   desktop, or stage's narrower mode-c width) - no media query needed,
   this responds to the actual box it's given rather than the viewport. */
.player-body { position: absolute; inset: 0; z-index: 1; display: flex; background: var(--paper); }
.player-stage {
  position: relative; flex: 1; min-width: 0; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: visible;
}
.video-box {
  position: relative;
  z-index: 4;
  aspect-ratio: 16 / 9;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  flex: 0 1 auto;
}

#yt-slot { position: absolute; inset: 0; z-index: 1; background: #000; }
#yt-target { width: 100%; height: 100%; }
#yt-slot iframe, #yt-slot video { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; }
/* iPhone: the native nocookie embed sits under PARA in landscape. Punch
   a hole through every ancestor of the video box so the picture shows.
   Captions and the П dock stay opaque and keep their taps. Portrait
   stacks the embed above — the hole still keeps the box from painting
   navy over it. */
html.para-ios-yt,
html.para-ios-yt body {
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
}
/* Landscape iPhone is wider than 56.25em, so the desktop mockup
   (rounded 860×520 card + beige padding) must never apply here. */
html.para-ios-yt #app-frame {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  margin: 0 !important;
}
/* iPhone: every page's header drops below the Dynamic Island, leaving the
   strip above as plain page background. --para-safe-top is mirrored from
   the native safe-area insets by player.js's lockIOSAppViewport (env()
   reads 0 inside Capacitor's webview); it is 0 in landscape. The player
   screen manages its own offset (player-body/topbar use the var directly)
   and the splash stays full-bleed. */
html.para-ios-yt .screen:not(#screen-player):not(#screen-splash) {
  padding-top: var(--para-safe-top, env(safe-area-inset-top, 0px));
}
/* Customers on iPhone never manage a server — the hosted one is baked in
   (see data.js apiBaseUrl). Android keeps this row for LAN captions dev. */
html.para-ios-yt #home-server-row {
  display: none !important;
}
/* Home header hugs the Dynamic Island: the .screen safe-area padding
   already clears the island, so drop most of home-main's own top padding
   to put the bear right under the clock line. */
html.para-ios-yt #screen-home .home-main,
html.para-ios-yt #screen-home .home-side {
  padding-top: 0.25rem;
}
html.para-ios-yt #app-frame.player-active:not(.ios-landscape) .player-stage,
html.para-ios-yt #app-frame.player-active:not(.ios-landscape) .video-box {
  width: 100%;
  max-width: 100%;
  border-radius: 0;
}
html.para-ios-yt,
html.para-ios-yt body,
html.para-ios-yt #app-frame.player-active,
html.para-ios-yt #app-frame.player-active #screen-player,
html.para-ios-yt #app-frame.player-active .player-body,
html.para-ios-yt #app-frame.player-active .player-stage,
html.para-ios-yt #app-frame.player-active .video-box,
html.para-ios-yt #app-frame.player-active #yt-slot,
html.para-ios-yt #app-frame.player-active #yt-target {
  background: transparent !important;
}
html.para-ios-yt #app-frame.player-active .side-lyrics {
  background: var(--paper) !important;
  /* Above the video-box flood shadows (video-box is z-index 4) — the
     giant box-shadow that paints paper/black around the video hole was
     also flooding OVER this column, hiding the mode B transcript text. */
  z-index: 5;
}
/* The theme wipe must still sweep over that raised transcript column
   (same z-index, later in the DOM wins). It can't cover the native
   video anyway: app.js maskRippleAroundVideo cuts the video-box rect
   out of the ripple, mirroring PC where the z-4 video-box sits above
   the z-3 ripple. */
html.para-ios-yt #app-frame.player-active #theme-ripple {
  z-index: 5;
  /* The player body starts below the Dynamic Island (top:
     --para-safe-top); pull the ripple back up over that strip so the
     wipe passes through it too and the strip doesn't pop to the new
     color only at the end. In landscape the inset is 0, so this is a
     no-op there. */
  top: calc(0px - var(--para-safe-top, 0px));
}
html.para-ios-yt #app-frame.player-active.ios-landscape .video-box {
  box-shadow: 0 0 0 200vmax #000;
  aspect-ratio: auto;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
}
html.para-ios-yt #app-frame.player-active.ios-landscape .player-stage {
  aspect-ratio: auto;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
}
html.para-ios-yt #app-frame.player-active.ios-landscape .player-stage {
  flex: 1;
}
html.para-ios-yt .review-mini-player #review-yt-target {
  background: transparent !important;
}
/* iPhone portrait: the Dynamic Island + status bar were sitting on top of
   the video. Push the whole player below the top safe area and paint the
   freed strip the same paper as the transcript. The native video view
   follows automatically - its frame is synced from the video box's
   getBoundingClientRect() (see player.js slotRect). Paper comes from the
   same flood-shadow trick landscape uses (paint everything EXCEPT the
   video hole) - an opaque #screen-player background here would cover the
   below-stacked native video, which is what previously forced the embed
   above PARA in portrait and made the dock bubbles vanish under it. */
html.para-ios-yt #app-frame.player-active:not(.ios-landscape) .video-box {
  box-shadow: 0 0 0 200vmax var(--paper);
}
html.para-ios-yt #app-frame.player-active:not(.ios-landscape) .player-body,
html.para-ios-yt #app-frame.player-active:not(.ios-landscape) .player-topbar {
  /* --para-safe-top is mirrored from the native safe-area insets by
     player.js (the ParaYoutube safeArea plugin call) because
     env(safe-area-inset-top) reads 0 inside Capacitor's webview here.
     The topbar moves down with the video so it keeps overlaying the
     picture, leaving the safe-area strip clean paper. */
  top: var(--para-safe-top, env(safe-area-inset-top, 0px));
}
/* iPhone landscape, caption mode b (video + transcript column): the black
   letterbox flood belongs to mode a's cinema look only. Mode b goes back
   to the portrait treatment - a contained 16:9 video on paper, matching
   the transcript column beside it. */
html.para-ios-yt #app-frame.player-active.ios-landscape #screen-player[data-caption-mode="b"] .video-box {
  box-shadow: 0 0 0 200vmax var(--paper);
  aspect-ratio: 16 / 9;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
}

/* Android WebView paints the YouTube iframe on a video surface. Keep PARA
   chrome in its own layer so the PC overlays stay on top of the picture. */
html.para-android #yt-slot {
  z-index: 0;
  overflow: hidden;
  isolation: isolate;
  transform: translateZ(0);
}
html.para-android .player-topbar,
html.para-android .player-dock,
html.para-android .karaoke-overlay,
html.para-android .transport,
html.para-android #video-tap-catcher,
html.para-android .side-lyrics,
html.para-android .gloss-overlay,
html.para-android .no-captions-notice,
html.para-android .center-play {
  transform: translateZ(0);
  isolation: isolate;
}

/* Sits above the video, below the caption/transport/topbar UI (z-index 4/5)
   so a tap anywhere on the open video area toggles play/pause without
   stealing clicks from caption words or the transport controls, which paint
   on top of it. */
#video-tap-catcher { position: absolute; inset: 0; z-index: 2; cursor: pointer; }

/* .ru-token is the shared tappable-word button, reused verbatim by the
   karaoke overlay and the side-by-side column so tap-to-gloss works
   identically in both; each context sizes it via font inheritance from
   its own container instead of repeating font rules. Real padding (not an
   invisible expanded overlay) pushes neighboring words/wrapped lines
   apart to grow the actual tappable box - words sit close together here,
   so an invisible 44px hit-box per word would overlap adjacent words and
   misdirect taps. This is the accepted trade-off for dense inline text
   (WCAG's target-size rules exempt inline text runs for exactly this
   reason): comfortable vertical hit-height and generous inter-word
   spacing, rather than a literal 44px box on every individual word. */
.ru-token {
  padding: 0.4375rem 0.3125rem; border: 0; border-bottom: 1.5px solid transparent;
  background: transparent; cursor: pointer; font: inherit; color: inherit; line-height: inherit;
  -webkit-touch-callout: none; touch-action: manipulation;
}
.ru-token.has-reading {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
  line-height: 1.05;
  vertical-align: baseline;
}
.ru-token-word { line-height: 1.15; }
/* Know-Russian zh-Hans: one pinyin syllable centred under each character. */
.ru-token.has-ruby {
  flex-direction: row;
  align-items: flex-start;
  gap: 0.04em;
}
.ru-ruby {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
  min-width: 1em;
}
.ru-ruby-char { line-height: 1.15; }
.ru-ruby-py {
  font: 600 0.62em/1 Nunito, sans-serif;
  letter-spacing: 0;
  opacity: 0.82;
  white-space: nowrap;
}
.ru-ruby-py.ru-ruby-missing { color: #9aa0a6; opacity: 0.7; }
.ru-token-reading {
  font: 600 0.62em/1 Nunito, sans-serif;
  letter-spacing: 0;
  opacity: 0.82;
}
.ru-token:hover { background: rgba(148,188,227,.28); }
/* Phase 4.4: pool-word highlight, distinct from the active-word amber
   sweep (.active-word below) so both can appear on the same word at once
   without fighting - a dotted underline in the chrome's existing blue
   accent (--card-blue, already used elsewhere in this dark video-overlay
   context) rather than a new color, plus a dot-stroke rather than solid
   so it doesn't read as literally the same "active now" signal. */
.ru-token.saved { border-bottom: 2px dotted var(--card-blue); filter: drop-shadow(0 1px 1px rgba(0,0,0,.85)); }

/* Mode a (karaoke overlay) is the only video-relative layer left; the
   active one is picked purely by the data-caption-mode attribute on
   #screen-player. A subtle white backing panel (15% opacity) keeps the
   now-dark-blue subtitle text legible over arbitrary video - transition
   on bottom (not just background) so it can also slide down when the
   transport auto-hides, see .controls-hidden below. */
.karaoke-overlay { display: none; }
#screen-player[data-caption-mode="a"] .karaoke-overlay {
  --ka-fit: 1;
  --ka-max-h: 42%;
  --ka-inset: 1.5%;
  display: flex; position: absolute; left: var(--ka-inset); right: var(--ka-inset); bottom: 6%; z-index: 4;
  flex-direction: column; justify-content: flex-end; max-height: var(--ka-max-h);
  overflow: hidden; pointer-events: auto;
  background: rgba(0,0,0,.50); border-radius: var(--r-lg); padding: 0.22rem 0.7rem;
  transition: bottom .3s ease, max-height .2s ease, left .2s ease, right .2s ease, transform .3s cubic-bezier(.22, 1, .36, 1);
}
#screen-player[data-caption-mode="a"] .karaoke-list {
  overflow-y: auto;
  max-height: 100%;
  scroll-snap-type: y mandatory;
  pointer-events: auto;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 16%, #000 84%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 16%, #000 84%, transparent 100%);
}
#screen-player[data-caption-mode="a"] .karaoke-list .lyrics-line {
  display: block;
  scroll-snap-align: center;
  pointer-events: auto;
  opacity: 0.34;
  transform: scale(0.9);
}
#screen-player[data-caption-mode="a"] .karaoke-list .lyrics-line.active {
  display: block;
  opacity: 1;
  transform: scale(1);
}
/* Landscape mode a only (see isAutoHideEligible() in app.js, same
   .controls-hidden class the transport below already reacts to) - the
   subtitles slide down into the space the transport vacates instead of
   just sitting there with empty video below them. Tapping the video
   (videoTapCatcherEl in app.js) already both pauses AND calls
   showControls() in one action, which removes .controls-hidden and lets
   this transition move the panel back up to its normal spot - no new JS
   needed, this rule just reacts to a class that already existed. */
#screen-player.controls-hidden[data-caption-mode="a"] .karaoke-overlay {
  bottom: 3.5%;
}

/* Phase 4.1: shown in place of captions for a YouTube video (no server-
   side caption fetch is possible - see server/app.py). Sits centered over
   the video, same treatment as the karaoke text (dark+glow shadow so it
   reads over arbitrary footage). The container stays click-through so
   taps on empty space still reach the video for play/pause - only the
   upload button inside opts back in to pointer events. */
.no-captions-notice {
  display: none; position: absolute; left: 8%; right: 8%; top: 50%; z-index: 4;
  transform: translateY(-50%); text-align: center; pointer-events: none;
  flex-direction: column; align-items: center; gap: 0.75rem;
}
.no-captions-notice.show { display: flex; }
.no-captions-text {
  margin: 0; font: 500 0.8125rem Barlow, sans-serif; line-height: 1.5; color: rgba(255,255,255,.92);
  text-shadow: 0 1px 3px rgba(0,0,0,.95), 0 0 10px rgba(0,0,0,.9);
}
.no-captions-upload-btn {
  pointer-events: auto; min-height: 44px; padding: 0 1.25rem;
  border: 1px solid #94bce3; background: rgba(89,128,166,.5); color: #fff; cursor: pointer;
  font: 600 0.75rem "Barlow Condensed", sans-serif; letter-spacing: 0.08em; text-transform: uppercase;
  text-shadow: 0 1px 3px rgba(0,0,0,.9);
}
.no-captions-upload-btn:hover { background: var(--accent); }
/* the overlay and its rows stay click-through (so taps on empty space
   reach #video-tap-catcher underneath for play/pause) - only the word
   buttons inside opt back in to pointer events for tap-to-gloss. */
.karaoke-list { pointer-events: none; }
.karaoke-list .lyrics-line { pointer-events: none; cursor: default; padding: 0.1875rem 0; text-align: center; }
.karaoke-list .ru-token { pointer-events: auto; }
/* Subtitle restyle: bolder + rounder (Nunito, not the condensed Barlow),
   mid-to-dark blue text throughout (active line just gets a size bump,
   same as before - the CURRENT WORD is distinguished by the orange
   underline below, not a color swap). A light panel behind this text
   (.karaoke-panel, see the portrait rule further down) is what actually
   keeps dark-on-video legible - the text-shadow here is a secondary
   safety net for wherever that panel doesn't fully cover. */
.karaoke-list .lyrics-ru {
  font: 700 calc(1rem * var(--ka-fit, 1)) Nunito, sans-serif; color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.85), 0 1px 8px rgba(0,0,0,.55);
}
/* Explicit color re-assertion, not just font-size: the shared (non-
   karaoke-scoped) ".lyrics-line.active .lyrics-ru" rule further down sets
   color:var(--ink) for the side-by-side column, and its 3-class
   specificity otherwise beats plain ".karaoke-list .lyrics-ru" (2
   classes) on the active line specifically - this rule needs to match or
   exceed that (karaoke-list + lyrics-line + active + lyrics-ru = 4
   classes) to keep the active line blue instead of falling through to ink. */
.karaoke-list .lyrics-line.active .lyrics-ru { font-size: calc(1.38rem * var(--ka-fit, 1)); color: #fff; }
.karaoke-list .lyrics-en {
  font: 600 calc(0.9rem * var(--ka-fit, 1)) Nunito, sans-serif; color: rgba(255,255,255,.78);
  text-shadow: 0 1px 3px rgba(0,0,0,.8); margin-top: 0.08rem;
  display: block;
}
.karaoke-list .lyrics-line.active .lyrics-en { color: rgba(255,255,255,.88); }
/* Mode A landscape S/M/L follows the side column: old M is S, old L is M,
   and L is one active-line step larger (1.38 / 1.08). The small line is
   larger than before and still under the main line of the same size.
   --ka-fit still shrinks a long pair so both stay on the video. */
#screen-player.cap-s .karaoke-list .lyrics-ru { font-size: calc(0.78rem * var(--ka-fit, 1)); }
#screen-player.cap-s .karaoke-list .lyrics-line.active .lyrics-ru { font-size: calc(1.08rem * var(--ka-fit, 1)); }
#screen-player.cap-s .karaoke-list .lyrics-en { font-size: calc(0.74rem * var(--ka-fit, 1)); }
#screen-player.cap-m .karaoke-list .lyrics-ru { font-size: calc(1rem * var(--ka-fit, 1)); }
#screen-player.cap-m .karaoke-list .lyrics-line.active .lyrics-ru { font-size: calc(1.38rem * var(--ka-fit, 1)); }
#screen-player.cap-m .karaoke-list .lyrics-en { font-size: calc(0.9rem * var(--ka-fit, 1)); }
#screen-player.cap-l .karaoke-list .lyrics-ru { font-size: calc(1.277rem * var(--ka-fit, 1)); }
#screen-player.cap-l .karaoke-list .lyrics-line.active .lyrics-ru { font-size: calc(1.763rem * var(--ka-fit, 1)); }
#screen-player.cap-l .karaoke-list .lyrics-en { font-size: calc(1.15rem * var(--ka-fit, 1)); }
/* Progressive per-word sweep as speech reaches it, shared by the karaoke
   overlay AND the side-by-side column (.lyrics-list, not .karaoke-list,
   so both get identical sweep timing/mechanics) - a real left-to-right
   fill over the word's duration rather than the whole word snapping on/
   off, driven by app.js setting --sweep (0%-100%) every tick from the
   token's real start/end timing. Part 4: "Active word: white text with a
   --gold-400 underline sweeping left to right... Green does not work over
   video" - a growing underline (::after, width:var(--sweep)) rather than
   the previous background-clip:text gradient fill, so the word's own text
   color can differ per context (white over the karaoke overlay's video,
   --ink over the side-by-side column's now-light background) while the
   sweep mechanism itself stays identical in both. Bold weight is a
   second, non-color signal that this is the active word. */
.lyrics-list .ru-token.active-word {
  --sweep: 0%;
  position: relative;
  font-weight: 700;
}
.lyrics-list .ru-token.active-word::after {
  content: "";
  position: absolute; left: 0.25rem; right: 0.25rem; bottom: 0.25rem;
  height: 2px; width: var(--sweep);
  background: var(--gold-400);
}
/* Karaoke overlay (mode A) only: orange instead of gold, and the word's
   own text stays the same mid-dark blue as the rest of the line (no
   color swap) - only the underline marks which word is active now. */
.karaoke-list .ru-token.active-word::after { background: var(--orange); }
.karaoke-list .ru-token.active-word {
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.85), 0 1px 8px rgba(0,0,0,.55);
}

.center-play { display: none; }

.transport {
  position: absolute; left: 4%; right: 4%; bottom: 4%; z-index: 4;
  display: flex; flex-direction: column; align-items: stretch; gap: 0.45rem;
  transition: opacity .35s ease;
}
.transport-times {
  display: flex; align-items: center; gap: 0.65rem;
}
.transport-tools {
  display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem;
}
/* Landscape mode a only (see isAutoHideEligible() in app.js) - the
   overlay transport slides fully off the bottom of video-box 3s after the
   last interaction, since it otherwise sits over the lower third of the
   video and crowds the karaoke overlay above it. pointer-events:none
   while hidden so it can't intercept a tap partway through the slide
   transition. Portrait already hides .transport outright regardless of
   this class (see the orientation query below), so no extra guard is
   needed here for that case. */
#screen-player.controls-hidden .transport {
  opacity: 0;
  pointer-events: none;
}
.chrome-back svg {
  width: 1.1rem;
  height: 1.1rem;
  display: block;
}
.transport .play-btn,
.transport .chrome-back {
  display: flex;
  border-color: rgba(255,255,255,.45);
  color: #fff;
  width: 40px;
  height: 40px;
  text-shadow: 0 1px 8px rgba(0,0,0,.45);
}
#screen-player[data-caption-mode="b"] .transport .play-btn,
#screen-player[data-caption-mode="b"] .transport .chrome-back {
  display: none;
}
.play-btn {
  flex: none; width: 44px; height: 44px; border: 1px solid var(--line);
  background: transparent; color: var(--ink); cursor: pointer;
  font: 600 0.75rem Nunito, sans-serif; display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
}
.time-text {
  font: 600 0.6875rem Nunito, sans-serif; color: #fff;
  text-shadow: 0 1px 6px rgba(0,0,0,.5); min-width: 2.4rem;
}
.time-left { text-align: right; }
.scrub {
  flex: 1;
  height: 6px;
  margin: 0;
  padding: 16px 0;
  background: rgba(255,255,255,.5);
  background-clip: content-box;
  position: relative;
  cursor: pointer;
  border-radius: 99px;
  touch-action: none;
}
.scrub.dragging { cursor: grabbing; }
.scrub-fill {
  position: absolute;
  left: 0;
  top: 16px;
  height: 6px;
  background: #fff;
  width: 0%;
  pointer-events: none;
  border-radius: 99px;
}
.scrub-fill::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(0,0,0,.25);
}
.speed-control { flex: none; display: flex; align-items: center; gap: 0.375rem; }
.speed-control input[type="range"] {
  width: 3.375rem; height: 44px; margin: 0; background: transparent;
  -webkit-appearance: none; appearance: none;
}
.speed-control input[type="range"]::-webkit-slider-runnable-track {
  height: 2px; background: rgba(214,235,255,.3);
}
.speed-control input[type="range"]::-moz-range-track { height: 2px; background: rgba(214,235,255,.3); }
.speed-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; margin-top: calc(1px - 0.75rem);
  width: 1.5rem; height: 1.5rem; border-radius: 50%;
  background: #d6ebff; border: 1px solid rgba(181,217,253,.8); cursor: pointer;
}
.speed-control input[type="range"]::-moz-range-thumb {
  width: 1.5rem; height: 1.5rem; border-radius: 50%; border: none;
  background: #d6ebff; box-shadow: 0 0 0 1px rgba(181,217,253,.8); cursor: pointer;
}
.speed-control span {
  font: 400 0.594rem "IBM Plex Mono", monospace; color: rgba(214,235,255,.75); min-width: 1.625rem;
}
.sync-control {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.15rem;
}
.sync-control button {
  min-width: 1.5rem;
  min-height: 1.5rem;
  padding: 0;
  border: 1px solid rgba(214,235,255,.35);
  border-radius: 4px;
  background: transparent;
  color: #d6ebff;
  cursor: pointer;
  font: 600 0.75rem Nunito, sans-serif;
}
.sync-control button:hover { background: rgba(214,235,255,.12); }
.sync-control span {
  min-width: 2.4rem;
  text-align: center;
  font: 500 0.625rem "IBM Plex Mono", monospace;
  color: rgba(214,235,255,.85);
}
.words-btn {
  flex: none; display: flex; align-items: center; gap: 0.375rem; padding: 0.25rem 0.5rem;
  min-height: 36px; border: 0; background: transparent; color: #fff; cursor: pointer;
  font: 700 0.75rem Nunito, sans-serif; letter-spacing: 0.04em;
  text-shadow: 0 1px 8px rgba(0,0,0,.45);
}
.words-btn:hover { background: rgba(255,255,255,.12); border-radius: var(--r-pill); }

.gloss-overlay {
  position: absolute; inset: 0; z-index: 12; background: rgba(27,33,68,.45);
  display: none; align-items: center; justify-content: center; padding: 1rem;
}
.gloss-overlay.open { display: flex; }
.translator-overlay { z-index: 40; }
.translator-card { width: min(22rem, 100%); }
.translator-heading {
  margin: 0 2rem 0.35rem;
  font: 800 1.15rem/1.2 Nunito, sans-serif;
  color: var(--ink);
}
.translator-lang {
  margin: 0.35rem 0 0;
  font: 700 0.68rem Nunito, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.translator-input {
  display: block;
  width: 100%;
  margin: 0.15rem 0 0;
  padding: 0.15rem 0.2rem;
  border: 0;
  resize: none;
  background: transparent;
  text-align: center;
  color: var(--ink);
  font: 800 1.6rem/1.2 Nunito, sans-serif;
}
.translator-input:focus { outline: none; }
.translator-swap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 36px;
  margin: 0.35rem auto 0;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font: 800 1rem Nunito, sans-serif;
}
.translator-swap:focus-visible { outline: 3px solid #c26510; outline-offset: 3px; }
.translator-output { min-height: 1.4em; }
.translator-card .gloss-actions .save:disabled { opacity: .42; cursor: default; }
.gloss-card {
  position: relative; width: min(20rem, 100%);
  padding: 1.25rem 1.25rem 1.125rem;
  background: var(--card);
  border: 0;
  border-radius: 1.25rem;
  box-shadow: 0 16px 40px rgba(27,33,68,.18);
  text-align: center;
}
.gloss-mascot { width: 3.5rem; height: 3.5rem; object-fit: contain; margin: 0 auto 0.5rem; display: block; }
.gloss-head { display: flex; align-items: center; justify-content: center; }
.gloss-head .ru { font: 800 2rem Nunito, sans-serif; line-height: 1.1; color: var(--ink); }
.gloss-en { font-size: 1.05rem; margin-top: 0.35rem; color: var(--ink-soft); font-weight: 600; }
.gloss-en.loading { color: var(--ink-faint); font-style: italic; font-weight: 400; }
.gloss-en.error { color: #b0453f; font-size: 0.8125rem; }
.gloss-tags { display: flex; gap: 0.375rem; margin-top: 0.75rem; flex-wrap: wrap; justify-content: center; }
.gloss-tags span { font-size: 0.6875rem; padding: 0.2rem 0.6rem; border-radius: var(--r-pill); }
.gloss-tags span:empty { display: none; }
.tag-pos { background: var(--green-50); color: var(--teal); font-weight: 700; }
.tag-lemma { background: #FFF1E0; color: var(--orange); font-weight: 700; }
.tag-note { background: var(--paper); color: var(--ink-faint); font-style: italic; }
.gloss-actions { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1rem; }
.gloss-actions .save {
  width: 100%; min-height: 48px; border: 0; border-radius: var(--r-pill);
  background: var(--orange); color: #fff;
  cursor: pointer; font: 700 0.875rem Nunito, sans-serif; letter-spacing: 0.06em; text-transform: uppercase;
}
.gloss-actions .save:hover { background: var(--orange-600); }
.gloss-actions .save.remove { background: var(--green-50); color: var(--teal); }
.gloss-actions .gloss-sentence[hidden] { display: none; }
.gloss-actions .resume {
  width: 100%; min-height: 40px; border: 0; background: transparent; cursor: pointer;
  font: 700 0.8125rem Nunito, sans-serif; color: var(--ink-soft);
}
.gloss-actions .resume:hover { color: var(--ink); }
.gloss-actions .more-mins {
  width: 100%; min-height: 48px; border: 0; border-radius: var(--r-pill);
  background: var(--green-500); color: #fff;
  cursor: pointer; font: 700 0.875rem Nunito, sans-serif; letter-spacing: 0.06em; text-transform: uppercase;
}
.gloss-actions .more-mins:hover { background: var(--green-600); }
.gloss-actions .rewatch {
  width: 100%; min-height: 48px; border: 2px solid var(--orange); border-radius: var(--r-pill);
  background: transparent; color: #111;
  cursor: pointer; font: 700 0.875rem Nunito, sans-serif; letter-spacing: 0.06em; text-transform: uppercase;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
}
.gloss-actions .rewatch .rewatch-arrows {
  color: var(--green-500); font-weight: 800; letter-spacing: -0.08em;
}

/* Shared base for mode a's karaoke list and mode b's side column - a
   vertical list of lines that dim/scale down when inactive and pop when
   the current line is reached. The colors below are effectively mode b's
   only (the karaoke overlay's own more specific .karaoke-list selectors
   further up override every one of them - see there for mode a). */
.lyrics-list { overflow-y: auto; padding: 0.375rem 0.75rem 1rem; }
.lyrics-line {
  padding: 0.6875rem 0; cursor: pointer; opacity: .4; transform: scale(.94);
  transform-origin: center; transition: opacity .25s, transform .25s;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.lyrics-line, .lyrics-line * { user-select: none; -webkit-user-select: none; }
.lyrics-line.active { opacity: 1; transform: scale(1); }
/* Part 4: "Lines are not boxed. The active line is full-strength --ink
   with its translation beneath; other lines fade toward --ink-faint." -
   the side-by-side column sits beside the video, not over it, so it's
   plain app chrome (Part 1's light palette), not the karaoke overlay's
   "must survive arbitrary video behind it" exception. */
.lyrics-ru { font: 600 1.125rem Nunito, sans-serif; line-height: 1.25; color: var(--ink-faint); transition: font-size .25s, color .25s; }
.lyrics-line.active .lyrics-ru { font-size: 1.4375rem; color: var(--ink); }
.lyrics-en { font: 400 1.02rem Nunito, sans-serif; line-height: 1.35; color: var(--ink-faint); margin-top: 0.1875rem; }
.lyrics-line.active .lyrics-en { color: var(--ink-soft); }
.side-lyrics .ru-token.active-word { color: var(--ink); }

/* Mode b: side-by-side column, collapsed to 0 width in mode a so it never
   takes layout space or shows scrollbars when hidden. Below the
   .player-body mobile breakpoint this becomes a full-width row stacked
   under the video instead (see there) - 34% of a narrow phone's width is
   too cramped for RU+EN text and its own playback bar. */
.side-lyrics {
  position: relative;
  z-index: auto;
  flex: none; width: 0; overflow: hidden; background: var(--paper);
  display: flex; flex-direction: column; border-left: 1px solid var(--line);
  transition: width .2s ease;
}
.side-lyrics .lyrics-list { position: relative; z-index: 2; flex: 1; min-height: 0; }
#screen-player[data-caption-mode="b"] .side-lyrics { width: 34%; }
/* No eased transition mid-drag (item 7) - the width needs to track the
   pointer 1:1, an easing lag here would feel like dragging through mud. */
.side-lyrics.dragging { transition: none; }

/* Landscape mode b only (hidden again in the portrait media query below) -
   drag to resize the video/transcript split. Text already reflows to fit
   (.lyrics-ru/.lyrics-en have no fixed-width assumptions), so no extra
   work is needed there once the width itself changes. */
.side-split-handle {
  display: none; flex: none; width: 8px; cursor: col-resize;
  position: relative; z-index: 5; touch-action: none;
}
.side-split-handle::after {
  content: ""; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 3px; height: 2rem; border-radius: var(--r-pill); background: var(--line);
}
.side-split-handle:hover::after, .side-split-handle.dragging::after { background: var(--green-500); }
#screen-player[data-caption-mode="b"] .side-split-handle { display: block; }
/* .player-topbar is position:absolute, full width, so in landscape (where
   side-lyrics sits beside the video at the same y:0 rather than below it
   like in portrait) it visually and functionally overlaps the top of this
   column - found via a real click landing on the topbar's title text
   instead of the transcript word underneath it. Pushes the WHOLE column
   (language toggle included, not just the list) down clear of the
   topbar's height instead of just visually - a click there needs to
   actually reach the word, not just look like it could. */
@media (orientation: landscape) {
  .side-lyrics { padding-top: 4rem; }
}
.side-lyrics .lyrics-ru { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.125rem 0.3125rem; }

/* Manual subtitle size control (S/M/L). Translation is always shown.
   The ladder shifted once: today's M is S, today's L is M, and L is
   1.15× today's L (the old active-line step, 1.4375 / 1.25). The small
   line under each caption is larger than that old ladder and still
   smaller than the main line of the same size. Base above is M. */
.size-toggle { flex: none; display: flex; gap: 0.375rem; padding: 0.5rem 0.75rem 0; }
.size-toggle-btn {
  flex: 1; min-height: 32px; border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--card); color: var(--ink-soft); font: 600 0.75rem Nunito, sans-serif; cursor: pointer;
}
.size-toggle-btn.active { background: var(--green-50); border-color: var(--green-500); color: var(--green-600); }

.side-lyrics.size-s .lyrics-line { padding: 0.5625rem 0; }
.side-lyrics.size-s .lyrics-ru { font-size: 1rem; line-height: 1.2; }
.side-lyrics.size-s .lyrics-line.active .lyrics-ru { font-size: 1.25rem; }
.side-lyrics.size-s .lyrics-en { font-size: 0.92rem; line-height: 1.3; }

.side-lyrics.size-m .lyrics-line { padding: 0.6875rem 0; }
.side-lyrics.size-m .lyrics-ru { font-size: 1.125rem; line-height: 1.25; }
.side-lyrics.size-m .lyrics-line.active .lyrics-ru { font-size: 1.4375rem; }
.side-lyrics.size-m .lyrics-en { font-size: 1.02rem; line-height: 1.35; }

.side-lyrics.size-l .lyrics-line { padding: 0.75rem 0; }
.side-lyrics.size-l .lyrics-ru { font-size: 1.294rem; line-height: 1.25; }
.side-lyrics.size-l .lyrics-line.active .lyrics-ru { font-size: 1.653rem; }
.side-lyrics.size-l .lyrics-en { font-size: 1.17rem; line-height: 1.35; }

/* Part 4: each side-by-side line gets a read-only "has a saved word" star
   and a per-line audio-replay button (see buildLyricsRow() in app.js) -
   hidden in the karaoke overlay via .karaoke-list below, since that
   context is pointer-events:none as a whole and these controls wouldn't
   be reachable there anyway. */
.lyrics-line-controls { display: none; }
.side-lyrics .lyrics-line { display: flex; align-items: center; }
.lyrics-text { min-width: 0; }
.side-lyrics .lyrics-text { flex: 1; }
.lyrics-line-signals {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  margin-left: 0.45rem;
  min-width: 1.35rem;
}
.line-signal {
  width: 1.2rem;
  height: 1.2rem;
  color: var(--orange);
  filter: drop-shadow(0 0 6px rgba(242, 122, 24, 0.55));
}
.line-signal svg { display: block; width: 100%; height: 100%; fill: currentColor; }
.karaoke-list .lyrics-line-signals { color: #fff; filter: drop-shadow(0 0 6px rgba(242, 122, 24, 0.7)); }
.lyrics-line.looping {
  outline: 2px solid var(--orange);
  outline-offset: 4px;
  border-radius: 0.7rem;
  box-shadow: 0 0 0 3px rgba(242, 122, 24, 0.18), 0 0 18px rgba(242, 122, 24, 0.35);
}

.side-lyrics-bar {
  position: relative;
  z-index: 5;
  flex: none; display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.625rem;
  border-top: 1px solid rgba(255,255,255,.12);
  background: transparent;
}
.side-lyrics-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: rgba(255,255,255,.10);
}
.side-lyrics-bar > * { position: relative; z-index: 1; }
.side-lyrics-bar .play-btn {
  width: 44px; height: 44px; border-color: var(--green-500); color: var(--green-600);
}
.side-lyrics-bar .play-btn:hover { background: var(--green-50); }
.side-lyrics-bar .time-text { color: var(--ink-soft); }
.side-lyrics-bar .scrub { background: var(--line); background-clip: content-box; }
.side-lyrics-bar .scrub-fill { background: var(--green-500); }
.side-lyrics-bar .scrub-fill::after { background: var(--green-500); box-shadow: 0 0 0 2px rgba(0,169,183,.25); }
.side-lyrics-bar .sync-control button {
  border-color: var(--line);
  color: var(--ink);
}
.side-lyrics-bar .sync-control button:hover { background: var(--green-50); }
.side-lyrics-bar .sync-control span { color: var(--ink-soft); }
.side-lyrics-bar .speed-control { display: none; }
.side-lyrics-bar .speed-control span { color: var(--ink-soft); }
.side-lyrics-bar .speed-control input[type="range"] { width: 2.5rem; }
.side-lyrics-bar .speed-control input[type="range"]::-webkit-slider-runnable-track { background: var(--line-soft); }
.side-lyrics-bar .speed-control input[type="range"]::-moz-range-track { background: var(--line-soft); }
.side-lyrics-bar .speed-control input[type="range"]::-webkit-slider-thumb { background: var(--green-500); border-color: var(--green-500); }
.side-lyrics-bar .speed-control input[type="range"]::-moz-range-thumb { background: var(--green-500); box-shadow: 0 0 0 1px var(--green-500); }
/* Only relevant in portrait, where this bar is the single consolidated
   transport and needs its own way back to the pool (the overlay
   .transport - and the words button inside it - is hidden there). Hidden
   by default so landscape's mode b doesn't show two words buttons. */
.side-lyrics-bar .portrait-only-btn { display: none; }
.side-lyrics-bar .words-btn { border-color: var(--green-500); background: var(--green-50); color: var(--green-600); }
.side-lyrics-bar .words-btn:hover { background: var(--green-500); color: #fff; }

/* Portrait: mode a (karaoke overlay) assumes a wide landscape video with
   room for a subtitle overlay - that doesn't work well on a tall narrow
   screen, so portrait always shows mode b (JS forces data-caption-mode to
   "b" regardless of the user's stored preference - see applyCaptionMode()
   in app.js) and the mode switcher is hidden rather than offering a mode
   that doesn't really apply here. Landscape (any width) is completely
   untouched by this block - rotating back restores the switcher and
   whichever mode was actually selected, with the overlay transport back
   in its normal spot. */
@media (orientation: portrait) {
  /* The video's own overlay transport is replaced by the single bar below
     the video instead (see .side-lyrics-bar here) - two transport bars
     for one video is confusing, and the overlay one sits awkwardly across
     the actual video content on a phone. */
  .transport { display: none; }

  /* player-stage drops its flex:1 grow (which split height evenly with
     side-lyrics, leaving genuine empty space above/below a video that
     doesn't actually need that much room) for an explicit 16:9 box - it
     now takes exactly the height the video needs, no more, which is what
     actually removes the empty black band rather than just moving
     something into it. side-lyrics then gets 100% of what's left. */
  .player-body { flex-direction: column; }
  .player-stage { flex: none; width: 100%; aspect-ratio: 16/9; }
  #screen-player[data-caption-mode="b"] .side-lyrics { width: 100%; flex: 1; min-height: 0; border-left: 0; }

  /* Moves the bar from the bottom of the scrolling transcript (its
     landscape position, unchanged) to directly under the video instead -
     order:-1 only changes visual position, not DOM order, so nothing else
     needs to know about this. */
  .side-lyrics-bar { order: -1; border-top: 0; border-bottom: 1px solid rgba(255,255,255,.12); }

  /* The draggable split (item 7) only makes sense in landscape, where the
     video and transcript sit side by side - portrait always stacks them
     full-width instead (see .player-body above), so there's nothing to
     drag here regardless of caption mode. */
  .side-split-handle { display: none; }
}

@keyframes book-bounce {
  0% { transform: scale(1); }
  35% { transform: scale(1.4) rotate(-8deg); }
  65% { transform: scale(.92) rotate(4deg); }
  100% { transform: scale(1) rotate(0); }
}
.book-icon { display: inline-block; }
.book-icon.bounce { animation: book-bounce .4s ease; }

/* Flying-paper save animation: spawned at the tapped word's on-screen
   rect, then transitioned (via a rAF-scheduled class flip in app.js) to
   the book icon's rect. Fixed + pointer-events:none so it never blocks
   input, and multiple can be in flight at once since each is its own node. */
.flying-paper {
  position: fixed; z-index: 1000; pointer-events: none;
  font-size: 0.9375rem; line-height: 1;
  transition: transform .42s cubic-bezier(.3,.7,.4,1), opacity .42s ease;
  will-change: transform, opacity;
}

/* ---------- Mascot / reward reserved slots (visual redesign Part 2) ----------
   Not built yet, on purpose - "reserve the space, don't build the mascot
   itself" per the spec. Kept visually intentional (a soft rounded card/
   pill with a low-opacity placeholder glyph) rather than an empty box, so
   it doesn't read as broken while nothing real occupies it yet. */
.reward-slot {
  /* max-height (not height) + min-height:0, paired with align-items:stretch
     on the flex row that holds this (see .pool-main/.review-main) - this
     app's desktop presentation is a small fixed-height device mockup (see
     the min-width:56.25em block near #app-frame), capped well under 200px
     regardless of the actual browser window size, so a hard 200px height
     here would silently overflow it on EVERY desktop viewport, not just
     narrow ones. This caps at 200px where there's room and shrinks below
     it otherwise, rather than overflowing. */
  flex: none; width: 200px; max-width: 100%; max-height: 200px; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-lg); background: var(--paper); border: 1px solid var(--line);
  font-size: 2.75rem; opacity: .4;
}
.mascot-slot {
  flex: none; width: 6rem; height: 6rem; margin-bottom: 0.25rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-pill); background: var(--paper); border: 1px solid var(--line);
  font-size: 2.5rem; opacity: .5;
}
.mascot-slot-sm { width: 2.25rem; height: 2.25rem; margin-bottom: 0; font-size: 1.125rem; }
.recent-empty-note { display: flex; align-items: center; gap: 0.5rem; }

/* ---------- POOL ---------- */
#screen-pool .pool-body { position: relative; flex: 1; padding: 1.125rem 1.375rem 0; display: flex; flex-direction: column; min-height: 0; }
.pool-toolbar {
  display: flex; align-items: center; justify-content: center; gap: 0.65rem 0.85rem; flex-wrap: wrap;
  margin-bottom: 0.55rem;
}
.pool-head { display: flex; align-items: center; gap: 0.45rem; flex: none; }
.pool-brand-mascot { width: 2.15rem; height: 2.15rem; object-fit: contain; flex: none; }
.pool-head h2,
.page-brand-title {
  margin: 0; font: 800 1.5rem Nunito, sans-serif; letter-spacing: 0.02em;
  color: var(--ink);
  text-transform: uppercase;
}
.page-brand { display: flex; align-items: center; gap: 0.45rem; }
.pool-head .count { font: 600 0.75rem "IBM Plex Mono", monospace; color: var(--green-600); }
.pool-toolbar .filters { margin: 0; flex: 1; min-width: 12rem; }
.pool-actions { display: flex; flex-direction: column; gap: 0.35rem; margin-left: auto; }
.pool-actions .btn-secondary {
  width: auto; min-height: 34px; padding: 0.3rem 0.75rem;
  border-radius: var(--r-pill); font-size: 0.72rem;
}
#start-review.start-review-btn,
.start-review-btn {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
}
#start-review.start-review-btn:hover,
.start-review-btn:hover {
  background: var(--orange-600);
  border-color: var(--orange-600);
  color: #fff;
}
#start-review.start-review-btn:active,
.start-review-btn:active {
  background: var(--orange-600);
  border-color: var(--orange-600);
  color: #fff;
}
.review-dir-btn {
  width: 14rem;
  max-width: 100%;
  min-height: 62px;
  padding: 0;
  border: 2px solid rgba(242, 122, 24, .78);
  border-radius: var(--r-pill);
  isolation: isolate;
  overflow: hidden;
  position: relative;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 7px 18px rgba(27, 33, 68, .1);
  display: block;
  transition: border-color .16s ease, box-shadow .16s ease, transform .14s ease;
}
.review-dir-btn::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: 1px;
  height: 116%;
  background: rgba(255,255,255,.88);
  box-shadow: 0 0 0 1px rgba(27,33,68,.08);
  transform: translate(-50%, -50%) rotate(24deg);
  pointer-events: none;
}
.review-dir-btn[data-dir="en-ru"] {
  border-color: rgba(0, 153, 168, .72);
}
.review-dir-btn:hover,
.review-dir-btn:focus-visible {
  border-color: var(--teal);
  outline: 0;
  box-shadow: 0 0 0 4px rgba(0, 169, 183, .13), 0 8px 20px rgba(27, 33, 68, .12);
}
.review-dir-btn:active { transform: scale(.97); }
.review-dir-side {
  position: absolute;
  inset: -1px;
  z-index: 1;
  background-color: var(--card);
  background-image: var(--language-flag-image);
  background-repeat: no-repeat;
  background-size: 56% 100%;
  pointer-events: none;
}
.review-dir-side.is-from {
  background-position: left center;
  clip-path: polygon(0 0, 56% 0, 44% 100%, 0 100%);
}
.review-dir-side.is-to {
  background-position: right center;
  clip-path: polygon(56% 0, 100% 0, 100% 100%, 44% 100%);
}
.review-dir-arrow {
  position: absolute;
  left: 50%;
  top: 45%;
  z-index: 4;
  width: 3.25rem;
  height: 2.55rem;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: var(--r-pill);
  background: rgba(255,250,243,.88);
  box-shadow: 0 3px 10px rgba(27,33,68,.14);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.review-dir-arrow svg {
  width: 2.5rem;
  height: 1.75rem;
  overflow: visible;
}
.review-dir-arrow path {
  fill: none;
  stroke: var(--teal);
  stroke-width: 3.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.review-dir-btn.switching .review-dir-arrow { animation: review-direction-spin .38s cubic-bezier(.2,.85,.25,1); }
@keyframes review-direction-spin {
  0% { transform: translate(-50%, -50%) rotate(0deg) scale(1); }
  55% { transform: translate(-50%, -50%) rotate(200deg) scale(.88); }
  100% { transform: translate(-50%, -50%) rotate(360deg) scale(1); }
}
.review-dir-code {
  position: absolute;
  bottom: .14rem;
  z-index: 5;
  min-width: 2.25rem;
  height: 27%;
  min-height: 1rem;
  padding: 0 .5rem .04rem;
  border-radius: var(--r-pill);
  background: rgba(12,18,42,.38);
  color: #fff;
  font: 900 clamp(.58rem, 2.8vw, .72rem)/1 Nunito, sans-serif;
  letter-spacing: .09em;
  text-shadow: 0 1px 2px rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  pointer-events: none;
}
.review-dir-code.is-from {
  left: .35rem;
  justify-content: center;
}
.review-dir-code.is-to {
  right: .35rem;
  justify-content: center;
}
.pool-watching {
  display: flex; gap: 0.75rem; align-items: stretch; margin-bottom: 0.75rem;
}
.pool-watching .library-card { flex: 1; max-width: 26rem; cursor: default; }
.pool-watching-stats { display: flex; flex-direction: column; gap: 0.4rem; min-width: 8.25rem; flex: none; }
.pool-stat {
  background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--r-md);
  padding: 0.35rem 0.6rem; min-width: 7.5rem;
}
.pool-stat .k { font: 700 0.6rem Nunito, sans-serif; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); }
.pool-stat .v { font: 800 1.05rem Nunito, sans-serif; color: var(--ink); margin-top: 0.1rem; }
.pool-stat .v-bar { height: 6px; background: var(--line-soft); border-radius: 99px; overflow: hidden; margin-top: 0.25rem; }
.pool-stat .v-bar > span { display: block; height: 100%; background: var(--green-500); width: 0; }
/* Part 3: "Filter chips as pills" - separate rounded chips with gaps
   between them (not a segmented/joined box) - each one gets the Part 1
   selected-state treatment (green border+tint) when active. */
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }
.filters button {
  min-height: 36px; padding: 0.28rem 0.8rem; border: 2px solid var(--line); border-radius: var(--r-pill);
  cursor: pointer; font: 600 0.8125rem Nunito, sans-serif;
  background: var(--card); color: var(--ink-soft);
  transition: border-color .12s ease, background .12s ease, color .12s ease;
}
.filters button.active { border-color: var(--green-500); background: var(--green-50); color: var(--green-600); }
.pool-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  margin: 0 0 0.9rem;
}
.pool-controls .start-review-btn {
  min-width: 14rem;
  min-height: 44px;
}

/* Study is intentionally a quiet launch screen. The data nodes below stay
   mounted because they feed the source picker, but no longer compete with
   the one action the customer came here to take. */
.study-data-reservoir { display: none !important; }
.pool-controls.study-launch {
  position: relative;
  flex: 1;
  min-height: 0;
  justify-content: center;
  margin: 0;
  overflow: hidden;
  isolation: isolate;
}
.study-graduate-bear {
  position: absolute;
  z-index: 0;
  left: 50%;
  top: 47%;
  width: min(24rem, 94vw);
  height: auto;
  object-fit: contain;
  transform: translate(-50%, -50%);
  opacity: .34;
  filter: saturate(.92);
  pointer-events: none;
}
.study-launch #start-review.start-review-btn {
  position: relative;
  z-index: 1;
  width: min(21rem, 88%);
  min-height: 56px;
  margin-top: clamp(9rem, 28vh, 14rem);
  border-radius: var(--r-pill);
  box-shadow: 0 11px 26px rgba(242,122,24,.25);
  font: 900 .95rem Nunito, sans-serif;
  letter-spacing: 0.02em;
}

/* Practice opens on type and video, then a 5-step count wheel, then direction. */
.review-setup-overlay {
  position: absolute; inset: 0; z-index: 140;
  display: none; align-items: flex-end; justify-content: center;
  padding: calc(0.75rem + var(--para-safe-top, env(safe-area-inset-top, 0px))) 0.55rem
    calc(0.55rem + var(--para-safe-bottom, env(safe-area-inset-bottom, 0px)));
  background: rgba(27,33,68,.52);
}
.review-setup-overlay.open { display: flex; }
.review-setup-card {
  position: relative; display: flex; flex-direction: column;
  width: min(25rem, 100%); max-height: 100%; overflow: hidden;
  padding: 1.15rem 1rem 1rem;
  border: 0; border-radius: 1.7rem; background: var(--card); color: var(--ink);
  box-shadow: 0 22px 55px rgba(27,33,68,.3); text-align: center;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  animation: review-sheet-in .2s cubic-bezier(.2,.8,.2,1);
}
@keyframes review-sheet-in {
  from { opacity: 0; transform: translateY(1.25rem) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.review-setup-sheet-handle {
  width: 2.25rem; height: 0.3rem; flex: none; margin: -0.55rem auto 0.35rem;
  border-radius: 99px; background: var(--line);
}
.review-setup-close {
  position: absolute; top: 0.6rem; right: 0.6rem; z-index: 2;
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: transparent; color: var(--ink-faint); cursor: pointer;
  font: 400 1.75rem/1 Nunito, sans-serif;
}
.review-setup-close:hover { background: var(--paper); color: var(--ink); }
.review-setup-mascot { width: 2.65rem; height: 2.65rem; object-fit: contain; display: block; flex: none; margin: 0 auto 0.2rem; }
.review-setup-kicker {
  font: 800 0.65rem Nunito, sans-serif; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--orange);
}
.review-setup-card h3 { margin: 0.2rem 2rem 0; font: 800 1.65rem/1.15 Nunito, sans-serif; color: var(--ink); }
.review-setup-step[hidden] { display: none; }
.review-setup-step:not([hidden]) { display: flex; flex-direction: column; min-height: 0; }
.review-setup-step > p {
  margin: 0.45rem auto 1rem; max-width: 18rem;
  font: 600 0.85rem/1.4 Nunito, sans-serif; color: var(--ink-soft);
}
.review-source-list {
  display: flex; flex-direction: column; gap: 0.6rem; min-height: 0;
  max-height: 44vh;
  max-height: min(44dvh, 22rem); overflow-y: auto;
  padding: 0.15rem 0.2rem 0.25rem; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.review-source-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 4.75rem;
  border: 2px solid #7C8295;
  border-radius: 1rem;
  overflow: hidden;
  background: var(--paper);
}
.review-source-half {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-height: 4.75rem;
  padding: 0.55rem 0.4rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: center;
}
.review-source-half + .review-source-half { border-left: 1px solid #7C8295; }
.review-source-half .t { font: 800 0.9rem/1.15 Nunito, sans-serif; }
.review-source-half .meta { color: var(--ink-soft); font: 600 0.75rem/1.2 Nunito, sans-serif; }
.review-source-half[aria-current="true"] { background: var(--green-50); }
.review-source-half:focus-visible { outline: 3px solid #c26510; outline-offset: -3px; }
.review-source-half:disabled { opacity: 0.42; cursor: default; }
.review-source-card.library-card {
  flex: none; min-height: 4.75rem; align-items: center; gap: 0.65rem;
  padding: 0.5rem; border: 2px solid #7C8295; border-radius: 1rem;
  background: var(--paper); color: var(--ink);
  transition: border-color .12s ease, background .12s ease, transform .05s ease;
}
.review-source-card.library-card:hover,
.review-source-card.library-card:focus-visible,
.review-source-card.library-card[aria-current="true"] { border-color: #006B75; background: var(--green-50); }
.review-source-card.library-card:active { transform: translateY(1px); }
.review-source-card.library-card img,
.review-source-all,
.review-source-placeholder {
  width: 6.4rem; height: 3.6rem; flex: none; display: flex; align-items: center; justify-content: center;
  border-radius: 0.55rem; overflow: hidden; object-fit: cover; background: #111;
}
.review-source-all {
  color: #fff; background: linear-gradient(145deg, var(--green-600), #006B75);
  font: 900 1.05rem/1 "IBM Plex Mono", monospace; letter-spacing: 0.12em;
}
.review-source-placeholder {
  color: #fff; background: repeating-linear-gradient(135deg, var(--green-600) 0 5px, var(--green-500) 5px 10px);
  font: 800 1rem/1 Nunito, sans-serif;
}
.review-source-card.library-card .info { gap: 0.3rem; }
.review-source-card.library-card .t {
  display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  font: 800 0.9rem/1.15 Nunito, sans-serif;
}
.review-source-card.library-card .meta { color: var(--ink-soft); }
.review-source-chevron { flex: none; padding: 0 0.1rem; color: #006B75; font: 700 1.7rem/1 Nunito, sans-serif; }
.review-setup-primary {
  width: 100%; min-height: 50px; margin-top: 0.85rem;
  border: 0; border-radius: var(--r-pill); background: var(--orange); color: #fff;
  cursor: pointer; font: 800 0.85rem Nunito, sans-serif; letter-spacing: 0.06em; text-transform: uppercase;
}
.review-setup-primary:hover { background: var(--orange-600); }
.review-setup-primary:active { background: var(--orange-600); transform: translateY(1px); }
.review-setup-primary:disabled { opacity: .42; cursor: not-allowed; }
.review-setup-source { margin-bottom: 0.7rem !important; color: #006B75 !important; }
.review-content-type {
  display: flex; align-items: center; gap: 0.15rem;
  margin: 0 0 0.85rem; padding: 0.2rem;
  border-radius: var(--r-pill); background: #f6eee3;
}
.review-content-type[hidden] { display: none !important; }
.review-content-btn {
  flex: 1; min-height: 38px; border: 0; border-radius: var(--r-pill);
  background: transparent; color: var(--ink-soft); cursor: pointer;
  font: 800 0.78rem Nunito, sans-serif;
}
.review-content-btn.on { background: #fff; color: var(--ink); box-shadow: 0 4px 12px rgba(27, 33, 68, .08); }
.count-wheel {
  position: relative;
  margin: 0.15rem auto 0.2rem;
  width: min(16rem, 100%);
}
.count-wheel-highlight {
  position: absolute;
  z-index: 0;
  left: 6%;
  right: 6%;
  top: 88px;
  height: 44px;
  border-radius: 0.7rem;
  background: rgba(0, 107, 117, 0.1);
  box-shadow: inset 0 1px 0 rgba(0, 107, 117, 0.28), inset 0 -1px 0 rgba(0, 107, 117, 0.28);
  pointer-events: none;
}
.count-wheel-window {
  position: relative;
  z-index: 1;
  height: 220px;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: transparent;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 16%, #000 84%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 16%, #000 84%, transparent);
}
.count-wheel-window:focus { outline: none; }
.count-wheel-window:focus-visible { outline: 3px solid rgba(0, 107, 117, 0.28); outline-offset: 2px; border-radius: 0.8rem; }
.count-wheel-list { padding: 88px 0; }
.count-wheel-item {
  height: 44px;
  line-height: 44px;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  font: 700 1.25rem/44px Nunito, sans-serif;
  color: #9aa0b4;
  user-select: none;
}
.count-wheel-item.is-selected {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--ink);
}
.review-count-field {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  margin: 0 0 0.75rem; text-align: left;
  font: 800 0.78rem Nunito, sans-serif; color: var(--ink-soft);
}
.review-count-field select {
  min-width: 7.5rem; min-height: 44px; padding: 0.35rem 0.8rem;
  border: 2px solid #7C8295; border-radius: 0.85rem;
  background: var(--paper); color: var(--ink); font: 800 0.9rem Nunito, sans-serif;
}
.review-word-choices { display: flex; flex-direction: column; gap: 0.65rem; }
.review-word-choice {
  width: 100%; min-height: 68px; display: flex; align-items: center; gap: 0.75rem;
  padding: 0.7rem 0.85rem; border: 2px solid #7C8295; border-radius: var(--r-lg);
  background: var(--paper); color: var(--ink); cursor: pointer; text-align: left;
  transition: border-color .12s ease, background .12s ease, transform .05s ease;
}
.review-word-choice:hover { border-color: #006B75; background: var(--green-50); }
.review-word-choice:active { transform: translateY(1px); }
.review-word-choice:disabled { opacity: .42; cursor: not-allowed; transform: none; }
.review-word-copy { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 0.15rem; }
.review-word-copy strong { font: 800 1rem Nunito, sans-serif; }
.review-word-copy small { font: 600 0.72rem/1.25 Nunito, sans-serif; color: var(--ink-soft); }
.review-word-count {
  min-width: 5.8rem; min-height: 2.35rem; display: inline-flex; align-items: center; justify-content: center;
  padding: 0.2rem 0.45rem; border-radius: var(--r-pill); background: var(--green-50); color: #006B75;
  font: 800 0.67rem "IBM Plex Mono", monospace;
}
.review-direction-picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .65rem;
  padding: .25rem .25rem .5rem;
}
.review-direction-picker .review-dir-btn {
  width: min(18rem, 94%);
  min-height: 76px;
}
.review-direction-actions { display: flex; align-items: center; gap: .65rem; margin-top: .35rem; }
.review-direction-actions .review-setup-back { flex: 0 0 6rem; margin: 0; }
.review-direction-actions .review-setup-primary { flex: 1; margin: 0; }
.review-option-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; text-align: left; }
.review-option-fields label {
  display: flex; flex-direction: column; gap: 0.3rem; min-width: 0;
  font: 800 0.72rem Nunito, sans-serif; color: var(--ink-soft);
}
.review-option-fields label:first-child { grid-column: 1 / -1; }
.review-option-fields select {
  width: 100%; min-width: 0; min-height: 50px; padding: 0.45rem 2rem 0.45rem 0.65rem;
  border: 2px solid #7C8295; border-radius: 0.85rem;
  background-color: var(--paper); color: var(--ink); font: 700 0.88rem Nunito, sans-serif;
}
.review-option-fields select:focus { outline: 3px solid rgba(0,107,117,.22); border-color: #006B75; }
.review-session-count {
  min-height: 1.3rem; margin: 0.75rem 0 0 !important;
  color: #006B75 !important; font: 800 0.8rem/1.3 Nunito, sans-serif !important;
}
.review-session-count.empty { color: var(--red-500) !important; }
.review-options-actions { display: flex; align-items: center; gap: 0.65rem; margin-top: 0.7rem; }
.review-options-actions .review-setup-back { flex: 0 0 6rem; margin: 0; }
.review-options-actions .review-setup-primary { flex: 1; margin: 0; }
.review-setup-back {
  min-width: 7rem; min-height: 44px; margin-top: 0.65rem;
  border: 0; border-radius: var(--r-pill); background: transparent; color: var(--ink-soft); cursor: pointer;
  font: 700 0.8rem Nunito, sans-serif;
}
.review-setup-back:hover { color: var(--ink); }

@media (orientation: landscape) and (max-height: 31rem) {
  .review-setup-overlay { align-items: center; }
  .review-setup-card { max-width: 31rem; padding-top: 0.8rem; padding-bottom: 0.7rem; overflow-y: auto; }
  .review-setup-mascot { width: 2rem; height: 2rem; margin-bottom: 0; }
  .review-setup-card h3 { font-size: 1.35rem; }
  .review-setup-step > p { margin: 0.25rem auto 0.55rem; }
  .review-source-list { max-height: 11rem; }
  .review-word-choice { min-height: 56px; padding-top: 0.5rem; padding-bottom: 0.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  .review-setup-card { animation: none; }
  .review-dir-btn.switching .review-dir-arrow { animation: none; }
}
@media (max-width: 22rem) {
  .review-option-fields { grid-template-columns: 1fr; }
  .review-option-fields label:first-child { grid-column: auto; }
}

/* ---------- LIBRARY ---------- */
.library-folders-area {
  flex: none;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 0.8rem 0.75rem;
  margin-bottom: 0.75rem;
  background: var(--paper);
}
.library-folders { display: flex; flex: 1 1 auto; flex-wrap: wrap; gap: 0.9rem 1.1rem; min-width: 0; }
.library-my-words {
  width: auto;
  min-width: 4.2rem;
  max-width: 5.6rem;
  margin-left: auto;
}
.library-my-words:focus-visible { outline: 3px solid #c26510; outline-offset: 3px; }
.library-folder {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 0.25rem;
  width: 4.2rem; padding: 0.2rem 0; border: 0; background: transparent; cursor: pointer;
  border-radius: var(--r-md);
  -webkit-appearance: none;
  appearance: none;
}
.library-folder img,
.library-add-bubble { position: relative; z-index: 1; }
.library-folder img { width: 2.6rem; height: 2.6rem; object-fit: contain; }
.library-folder-name {
  font: 600 0.6875rem Nunito, sans-serif; color: var(--ink-soft);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.library-folder.drop-target { outline: 0; background: transparent; }
.library-folder.drop-target::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: 50%;
  top: -.18rem;
  width: 3.25rem;
  height: 3.25rem;
  border: 2px solid var(--orange);
  border-radius: 50%;
  background: rgba(255,248,239,.72);
  box-shadow: 0 0 0 5px rgba(0,169,183,.16), 0 0 22px rgba(242,122,24,.58);
  transform: translateX(-50%);
  animation: library-drop-glow .72s ease-in-out infinite alternate;
}
.library-folder.drop-target .library-folder-name { color: var(--orange); font-weight: 800; }
@keyframes library-drop-glow {
  from { transform: translateX(-50%) scale(.94); box-shadow: 0 0 0 3px rgba(0,169,183,.12), 0 0 12px rgba(242,122,24,.38); }
  to { transform: translateX(-50%) scale(1.06); box-shadow: 0 0 0 6px rgba(0,169,183,.2), 0 0 25px rgba(242,122,24,.7); }
}
.library-add-bubble {
  width: 2.6rem; height: 2.6rem; border: 0; background: transparent;
  display: flex; align-items: center; justify-content: center;
  font: 500 2.3rem Nunito, sans-serif; line-height: 1; color: var(--ink-soft);
}
.library-folder-add:hover .library-add-bubble { color: var(--orange); }
.library-recent-head {
  flex: none;
  border-top: 1px solid var(--line);
  padding-top: 0.7rem;
  margin-bottom: 0.5rem;
  font: 600 0.75rem Nunito, sans-serif;
  color: var(--ink-soft);
}
.folder-pop {
  position: fixed;
  z-index: 130;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: 0 14px 38px rgba(20, 20, 22, 0.18);
  padding: 0.9rem;
  transition: clip-path .3s cubic-bezier(.2, .9, .25, 1);
}
.folder-pop-head {
  display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem;
}
.folder-pop-head img { width: 1.9rem; height: 1.9rem; object-fit: contain; }
.folder-pop-head .t { font: 800 1rem Nunito, sans-serif; color: var(--ink); }
.folder-pop-list { max-height: 52vh; overflow-y: auto; display: flex; flex-direction: column; gap: 0.4rem; }
.folder-pop-row {
  display: flex; align-items: center; gap: 0.55rem; width: 100%;
  border: 1px solid var(--line-soft); border-radius: var(--r-md);
  background: var(--paper); padding: 0.45rem 0.6rem; cursor: pointer; text-align: left;
}
.folder-pop-row img { width: 3.4rem; height: 1.95rem; object-fit: cover; border-radius: 0.35rem; background: var(--line-soft); flex: none; }
.folder-pop-row .t {
  font: 600 0.8125rem Nunito, sans-serif; color: var(--ink); min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.folder-pop-empty { font: 500 0.8125rem Nunito, sans-serif; color: var(--ink-faint); padding: 0.4rem 0.2rem 0.2rem; }
.folder-pop-action {
  width: 100%; min-height: 42px; margin-top: 0.45rem;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  background: transparent; color: var(--ink); cursor: pointer;
  font: 700 0.85rem Nunito, sans-serif;
}
.folder-pop-action.danger { color: var(--red-500, #D64545); border-color: var(--red-500, #D64545); }
.library-drag-ghost {
  position: fixed;
  z-index: 150;
  pointer-events: none;
  opacity: .94;
  display: flex;
  align-items: stretch;
  gap: .7rem;
  padding: .55rem;
  border: 2px solid var(--orange);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(20,20,22,.25);
  background: var(--card);
  will-change: left, top, width, height, border-radius;
  transition: left .2s cubic-bezier(.2,.85,.25,1), top .2s cubic-bezier(.2,.85,.25,1),
    width .22s cubic-bezier(.2,.85,.25,1), height .22s cubic-bezier(.2,.85,.25,1),
    border-radius .22s ease, padding .2s ease, box-shadow .2s ease;
}
.library-drag-ghost .library-card-media {
  transition: width .18s ease;
}
.library-drag-ghost .info {
  flex: 1;
  min-width: 0;
  transition: opacity .12s ease;
}
.library-drag-ghost.is-orb {
  padding: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(0,169,183,.24), 0 16px 34px rgba(20,20,22,.32);
}
.library-drag-ghost.is-orb.is-following { transition: none; }
.library-drag-ghost.is-orb .info,
.library-drag-ghost.is-orb .library-card-folder { display: none; }
.library-drag-ghost.is-orb .library-card-media {
  width: 100%;
  height: 100%;
  display: block;
}
.library-drag-ghost.is-orb .library-card-thumb,
.library-drag-ghost.is-orb .recent-thumb {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  object-fit: cover;
}
.library-drag-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: #fff; background: linear-gradient(145deg, var(--orange), var(--teal)); font-weight: 900;
}
.library-swipe.library-dragging .library-card {
  opacity: .28;
  transform: scale(.985);
}
.library-swipe.library-dragging .recent-delete-banner { opacity: 0; }
html.library-drag-active .library-list { overflow: hidden; }
#screen-library .library-body { flex: 1; padding: 1.125rem 1.375rem 0; display: flex; flex-direction: column; min-height: 0; }
.library-head { display: flex; align-items: center; justify-content: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.library-list {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 0.85rem; padding-bottom: 1rem;
  overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch;
}
/* These wrappers also power swipe-to-delete. They must remain at their
   content height so the list scrolls instead of shrinking and clipping them. */
.library-list > .library-swipe { flex: 0 0 auto; }
.library-series { border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 0.7rem 0.75rem; background: var(--card); }
.library-series h3 { margin: 0 0 0.5rem; font: 700 1rem Nunito, sans-serif; }
.library-episodes { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.55rem; }
.library-ep {
  min-width: 2.4rem; min-height: 2rem; padding: 0.2rem 0.45rem;
  border-radius: var(--r-pill); border: 1px solid var(--line);
  font: 700 0.75rem "IBM Plex Mono", monospace; background: var(--paper); color: var(--ink-faint);
}
.library-ep.have { border-color: var(--green-500); background: var(--green-50); color: var(--green-600); }
.library-card {
  display: flex; gap: 0.7rem; align-items: stretch; width: 100%;
  padding: 0.55rem; border: 1px solid var(--line-soft); border-radius: var(--r-md);
  background: var(--card); cursor: pointer; text-align: left;
}
.library-list .library-card { min-height: 7.5rem; }
.library-card > img,
.library-card-thumb { width: 6.4rem; height: 3.6rem; object-fit: cover; border-radius: 0.4rem; background: #111; flex: none; }
.library-card-media {
  width: 6.4rem; min-width: 0; flex: none;
  display: flex; flex-direction: column; gap: 0.35rem;
}
.library-card-media > .library-card-thumb { width: 100%; display: block; }
.library-card-folder {
  min-width: 0; display: flex; align-items: center; gap: 0.25rem;
  color: var(--ink-soft); font: 700 0.6875rem/1.2 Nunito, sans-serif;
}
.library-card-folder img {
  width: 0.95rem; height: 0.95rem; flex: none;
  object-fit: contain; border-radius: 0; background: transparent;
}
.library-card-folder span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-card .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.library-card .t { font: 700 0.95rem Nunito, sans-serif; }
.library-language-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  align-items: center;
}
.library-language-chip {
  --language-badge-size: 1.05rem;
  box-shadow: none;
  border-width: 1px;
  cursor: inherit;
  pointer-events: none;
}
.library-language-chip:hover,
.library-language-chip:active {
  transform: none;
  border-color: rgba(0, 153, 168, .7);
}
.folder-pop-row .library-language-chips { margin-left: auto; }
.library-card .meta { font: 400 0.7rem "IBM Plex Mono", monospace; color: var(--ink-faint); }
.library-list .library-card .t { line-height: 1.2; overflow-wrap: anywhere; }
.library-list .library-card .meta { line-height: 1.3; overflow-wrap: anywhere; }
.library-bar { height: 6px; background: var(--line-soft); border-radius: 99px; overflow: hidden; }
.library-bar > span { display: block; height: 100%; background: var(--green-500); width: 0; }
.library-card-tools { display: flex; gap: 0.4rem; align-items: center; margin-top: 0.25rem; }
.library-card-tools select {
  flex: 1; min-height: 34px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--paper); font: 600 0.75rem Nunito, sans-serif;
}
.clip-end-copy { margin: 0.35rem 0 0.65rem; font: 400 0.95rem Nunito, sans-serif; color: var(--ink-soft); }
.clip-end-actions { flex-direction: column; }
.clip-end-status { margin: 0 0 0.55rem; font: 600 0.85rem "IBM Plex Mono", monospace; color: var(--green-600); }
.clip-end-progress.progress-row {
  margin-top: 0;
  margin-bottom: 0.85rem;
  max-width: none;
}
.clip-end-progress[hidden] { display: none !important; }
.clip-end-extend {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 3.6rem 1fr;
  align-items: stretch;
  width: 100%;
  height: 84px;
  border-radius: 999px;
  background: #f6eee3;
  overflow: hidden;
  box-shadow: inset 0 0 0 2px var(--orange);
}
.clip-end-extend::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  background: var(--orange);
  transform: scale(0);
  z-index: 0;
  pointer-events: none;
}
.clip-end-extend.is-bursting::before {
  animation: clip-end-fill 0.72s linear forwards;
}
@keyframes clip-end-fill {
  to { transform: scale(36); }
}
.clip-end-extend.is-hinting .clip-minute-wheel {
  animation: clip-end-shake 0.46s ease-in-out 3;
}
@keyframes clip-end-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.clip-end-extend[hidden] { display: none !important; }
.clip-end-side {
  position: relative;
  z-index: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 0 0.2rem;
  font: 800 1.12rem/1 Nunito, sans-serif;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.clip-end-side:disabled { cursor: default; }
.clip-minute-wheel {
  position: relative;
  z-index: 1;
  width: 3.6rem;
  align-self: stretch;
}
.clip-minute-wheel::before,
.clip-minute-wheel::after {
  content: "";
  position: absolute;
  top: 16px;
  bottom: 16px;
  width: 1px;
  background: rgba(27, 33, 68, 0.12);
  pointer-events: none;
  z-index: 2;
}
.clip-minute-wheel::before { left: 0; }
.clip-minute-wheel::after { right: 0; }
.clip-minute-window {
  position: relative;
  z-index: 1;
  height: 84px;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: transparent;
  touch-action: pan-y;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 20%, #000 80%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 20%, #000 80%, transparent);
}
.clip-minute-window::-webkit-scrollbar { display: none; }
.clip-minute-window:focus { outline: none; }
.clip-minute-window:focus-visible { outline: 2px solid rgba(0, 107, 117, 0.35); outline-offset: -4px; border-radius: 0.6rem; }
.clip-minute-list { padding: 24px 0; }
.clip-minute-item {
  height: 36px;
  line-height: 36px;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  font: 700 1.2rem/36px Nunito, sans-serif;
  color: #9aa0b4;
  text-align: center;
  user-select: none;
}
.clip-minute-item.is-selected {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--ink);
}
.clip-end-hint {
  position: relative;
  z-index: 1;
  display: block;
  width: max-content;
  max-width: 100%;
  margin: 0.15rem auto 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: 700 0.92rem/1.2 Nunito, sans-serif;
  opacity: 0;
}
.clip-end-hint[hidden] { display: none !important; }
.clip-end-hint.is-on { animation: clip-end-hint 2.5s ease forwards; }
@keyframes clip-end-hint {
  0% { opacity: 0; transform: translateY(-1.65rem); }
  16% { opacity: 1; transform: translateY(0); }
  68% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(0.2rem); }
}
.clip-end-or {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 2.15rem 0.35rem 1.9rem;
  color: #8e93a3;
  font: 500 0.84rem/1 Nunito, sans-serif;
  position: relative;
  z-index: 1;
}
.clip-end-or::before,
.clip-end-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(27, 33, 68, 0.16);
}
.clip-end-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
  margin: 0 0 0.7rem;
  position: relative;
  z-index: 1;
}
.clip-end-action {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  font: 800 1rem/1.05 Nunito, sans-serif;
}
.clip-end-action img {
  width: 4.6rem;
  height: 4.6rem;
  display: block;
  object-fit: contain;
  pointer-events: none;
}
.clip-end-action:active { transform: translateY(1px); }
.clip-end-action:disabled { cursor: default; }
.pool-main { display: flex; gap: 0.75rem; flex: 1; min-height: 0; align-items: stretch; }
.pool-list { flex: 1; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; padding: 0.25rem 0.25rem 0.875rem; align-content: start; }
.pool-row {
  display: flex; align-items: center; gap: 0.625rem; padding: 0.5625rem 0.6875rem;
  min-height: 44px; border-radius: var(--r-md);
  border: 1px solid var(--line-soft); background: var(--card); min-width: 0;
}
.pool-row .info { flex: 1; min-width: 0; }
.pool-row .ru { font: 700 1rem Nunito, sans-serif; display: flex; align-items: baseline; gap: 0.375rem; }
.pool-row .en { font: 400 0.8125rem Nunito, sans-serif; color: var(--ink-soft); margin-top: 0.0625rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pool-row .meta { font: 400 0.65rem "IBM Plex Mono", monospace; color: var(--ink-faintest); margin-top: 0.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-tag {
  font: 600 0.5625rem "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--green-600); background: var(--green-50); padding: 0.0625rem 0.3125rem; border-radius: var(--r-pill);
}
.fav-star {
  flex: none; width: 2rem; height: 2rem; border: 0; background: transparent; cursor: pointer;
  font-size: 1.125rem; color: var(--line); display: flex; align-items: center; justify-content: center;
}
.fav-star:hover { color: var(--amber-500); }
.fav-star.active { color: var(--amber-500); }
.due-chip { flex: none; font-size: 0.625rem; padding: 0.125rem 0.4375rem; border-radius: var(--r-pill); font-family: "IBM Plex Mono", monospace; }
.due-chip.due { background: rgba(245,158,11,.15); color: var(--amber-500); }
.due-chip.new { background: var(--green-50); color: var(--green-600); }
.due-chip.later { background: var(--line-soft); color: var(--ink-faint); }
.pool-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.375rem; color: var(--ink-faint); text-align: center; padding: 0 2.5rem; }
.pool-empty .big { font: 700 1rem Nunito, sans-serif; color: var(--ink); }
.pool-footer { flex: none; padding: 0.625rem 1.375rem; display: flex; flex-direction: column; gap: 0.5rem; }
.btn-secondary {
  width: 100%; min-height: 44px; padding: 0.75rem 1rem; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  cursor: pointer; font: 600 0.875rem Nunito, sans-serif;
  transition: background .12s ease, border-color .12s ease, color .12s ease, transform .05s ease;
}
.btn-secondary:hover { background: var(--green-50); border-color: var(--green-500); color: var(--green-600); }
.btn-secondary:active { transform: translateY(1px); }
.btn-secondary:disabled { opacity: .4; cursor: not-allowed; }

/* Narrow phone: a 2-column word grid squeezes each card too tight to read
   comfortably - one column instead. */
@media (max-width: 37.5em), (orientation: portrait) {
  .pool-watching { flex-direction: column; }
  .pool-watching .library-card { max-width: none; }
  .pool-watching-stats { flex-direction: row; flex-wrap: wrap; min-width: 0; }
  .pool-stat { flex: 1; min-width: 6rem; }
  .pool-actions { width: 100%; flex-direction: row; margin-left: 0; }
  .pool-actions .btn-secondary { flex: 1; }
  .pool-actions .review-dir-btn { flex: 1; }
}
@media (max-width: 30em) {
  .pool-list { grid-template-columns: 1fr; }
  .pool-empty { padding: 0 1.5rem; }
  .pool-main { flex-direction: column; }
  .reward-slot { width: 100%; height: 5.5rem; font-size: 2rem; }
}

/* ---------- REVIEW ---------- */
#screen-review .review-body { flex: 1; padding: 0.4rem 1.5rem 0; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.review-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.review-head span { font: 600 0.75rem Nunito, sans-serif; color: var(--ink-soft); }
.review-head .pos { font: 500 0.6875rem "IBM Plex Mono", monospace; color: var(--ink); }
.review-progress { height: 8px; background: var(--line-soft); border-radius: var(--r-pill); overflow: hidden; margin-bottom: 0.875rem; }
.review-progress-fill { height: 100%; background: var(--teal); width: 0%; border-radius: inherit; }
.review-main { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 7vh; min-height: 0; padding-bottom: 0.25rem; }
/* Review's compact card layout has no spare room for a 200x200 slot yet
   (this screen gets properly restructured in visual redesign Part 3) - so
   the reward slot only appears where a wide window genuinely has space,
   rather than forcing it in and breaking the tight default layout. */
/* align-self, not the parent's align-items - .quiz-card must stay
   centered at its own natural height, only the reward slot itself needs
   to stretch/shrink to whatever room is actually available. */
#review-reward-slot { display: none; align-self: stretch; }
@media (min-width: 60em) {
  .review-main { gap: 1.25rem; }
  #review-reward-slot { display: flex; }
}

.quiz-card {
  position: relative;
  width: 100%; max-width: 37.5rem; display: flex; align-items: flex-start; gap: 0.875rem;
  padding: 1.6rem 1.25rem 1rem; border: 2px solid rgba(242,122,24,.82); border-radius: 1.25rem; background: var(--card);
  box-shadow: 0 0 0 4px rgba(0,169,183,.07), 0 10px 28px rgba(27,33,68,.08);
  overflow: hidden;
}
.quiz-cefr {
  position: absolute;
  top: 0.7rem;
  right: 0.85rem;
  font: 800 0.78rem Nunito, sans-serif;
  letter-spacing: 0.06em;
  color: var(--orange);
}
.quiz-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 0.25rem; }
.quiz-word-row { display: flex; align-items: center; gap: 0.625rem; max-width: 100%; padding-right: 2.1rem; }
.quiz-word {
  font: 800 2.25rem Nunito, sans-serif; line-height: 1.05; color: var(--ink);
  max-width: 100%; overflow: hidden; text-align: center;
  word-break: break-word; overflow-wrap: anywhere;
}
.quiz-sentence-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.25rem; max-width: 100%; }
.quiz-sentence-ru { font: 400 0.8125rem Nunito, sans-serif; line-height: 1.35; text-align: center; }
.quiz-sentence-word { transition: background-color .12s, color .12s; border-radius: 4px; }
.quiz-sentence-word.active { background: var(--green-50); color: var(--green-600); font-weight: 600; }
/* Phase 4.4: another pool word in this sentence (not the one being
   quizzed) - amber, not green, so it stays visually distinct from
   .active's "this is playing right now" cue rather than looking like a
   second copy of the same signal. */
.quiz-sentence-word.pool-word { border-bottom: 1.5px dotted var(--amber-500); }
.tts-btn {
  flex: none; width: 44px; height: 44px; border-radius: var(--r-pill); border: 1px solid var(--green-500);
  background: var(--green-50); color: var(--green-600); cursor: pointer;
  font-size: 0.5625rem; display: flex; align-items: center; justify-content: center;
}
.tts-btn[hidden],
.replay-btn[hidden] { display: none !important; }
.tts-btn:hover { background: var(--green-500); color: #fff; }
.tts-btn:disabled { opacity: .5; cursor: default; }
.quiz-sentence-en {
  margin-top: 0.25rem; font: 400 0.75rem Nunito, sans-serif; color: var(--ink-faint); text-align: center; visibility: hidden;
}
.quiz-sentence-en.revealed { visibility: visible; }
.replay-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.3125rem;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--card); color: var(--ink-soft);
  cursor: pointer; font: 600 0.75rem Nunito, sans-serif;
}
.replay-btn:hover { background: var(--green-50); border-color: var(--green-500); color: var(--green-600); }
#screen-review .replay-btn { margin-top: 0; padding: 0.5rem 0.75rem; min-height: 44px; }
.tri {
  display: inline-block; width: 0; height: 0;
  border-style: solid; border-width: 0.25rem 0 0.25rem 0.375rem;
  border-color: transparent transparent transparent currentColor;
}

/* Answers stay transparent and brand-framed until the learner commits.
   Green and red are reserved exclusively for the grading result. */
.quiz-options { width: 100%; display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.375rem; margin-top: 0.5rem; }
.quiz-option {
  position: relative; min-height: 3.25rem; padding: 0.7rem 0.5rem; border: 2px solid var(--teal); border-radius: 1rem;
  cursor: pointer; font: 700 0.9rem Nunito, sans-serif; color: var(--ink); text-align: center;
  background: transparent;
  transition: transform .1s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
}
.quiz-option:hover:not(:disabled) { transform: translateY(-1px); background: rgba(0,169,183,.045); box-shadow: 0 2px 8px rgba(26,24,21,.1); }
.quiz-option:active:not(:disabled) { transform: translateY(0); box-shadow: none; }
.quiz-option:disabled { cursor: default; }
/* Solid saturated background + white text (not a pale tint + dark text) so
   these stay clearly readable regardless of any browser's own disabled-
   control dimming - -webkit-text-fill-color pins it against WebKit/Blink's
   tendency to override plain `color` on :disabled form controls. */
.quiz-option.correct {
  border-color: var(--green-600); background: var(--green-500); color: #fff; opacity: 1; -webkit-text-fill-color: #fff;
}
.quiz-option.correct::after {
  content: "\2713"; position: absolute; top: 0.3125rem; right: 0.4375rem;
  font-size: 0.75rem; font-weight: 700; color: #fff;
}
.quiz-option.wrong {
  border-color: var(--red-500); background: var(--red-500); color: #fff; opacity: 1; -webkit-text-fill-color: #fff;
}
.quiz-option.wrong::after {
  content: "\00d7"; position: absolute; top: .2rem; right: .45rem;
  color: #fff; font: 900 1rem/1 Nunito, sans-serif;
}

.review-mini-player { display: none; flex: none; width: 10.5rem; }
.review-mini-player.show { display: block; }
.review-mini-player #review-yt-target { width: 10.5rem; height: 5.875rem; background: #000; }
.review-mini-player #review-yt-target video,
.review-mini-player #review-yt-target iframe { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; border: 0; }

.review-feedback {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  z-index: 5;
  width: min(92%, 37.5rem); margin: 0;
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.55rem 1rem; border-radius: 1rem; background: #E7F8F9; color: var(--green-600);
  box-shadow: 0 8px 22px rgba(27, 33, 68, 0.10);
}
.review-feedback[hidden] { display: none; }
.review-feedback.ok { background: #E7F8F9; color: var(--green-600); }
.review-feedback.nope { background: #FFE8E4; color: var(--red-500); }
.review-feedback-mark { font-size: 1.25rem; }
.review-feedback strong { display: block; font: 800 0.95rem Nunito, sans-serif; }
.review-feedback span { font: 600 0.75rem Nunito, sans-serif; }

.quiz-next {
  width: min(37.5rem, 100%); margin: 0.75rem auto 0;
  min-height: 52px; border: 0; border-radius: var(--r-pill);
  background: var(--orange); color: #fff; cursor: pointer;
  font: 800 0.95rem Nunito, sans-serif; letter-spacing: 0.08em;
  display: none; align-items: center; justify-content: center;
}
.quiz-next.show { display: flex; }
.quiz-next:hover { background: var(--orange-600); }

.quiz-type-wrap { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 0.45rem; margin-top: 0.55rem; }
.quiz-type-wrap[hidden],
.quiz-options[hidden] { display: none !important; }
.quiz-help-btn {
  min-height: 2.3rem; padding: 0 1rem; border-radius: var(--r-pill);
  border: 2px solid var(--teal); background: transparent; color: var(--teal);
  font: 800 0.8rem Nunito, sans-serif; letter-spacing: 0.06em; text-transform: uppercase;
  cursor: pointer;
}
.quiz-help-btn:disabled { opacity: 0.28; cursor: default; }
.quiz-hint {
  font: 700 1.55rem Nunito, sans-serif; color: var(--ink);
  letter-spacing: 0.12em; min-height: 1.9rem;
}
.quiz-type-line {
  width: 100%; display: flex; align-items: center; gap: 0.4rem;
}
.quiz-type-input {
  flex: 1; min-width: 0; min-height: 52px; padding: 0.5rem 1rem;
  border: 2px solid var(--line); border-radius: var(--r-pill);
  background: var(--card); color: var(--ink);
  font: 700 1.55rem Nunito, sans-serif; outline: none;
  transition: border-color .25s ease, box-shadow .25s ease;
}
.quiz-type-input.ok {
  border-color: #2FBF71;
  background: #4CD08A;
  color: var(--ink);
  -webkit-text-fill-color: var(--ink);
  animation: quiz-ok-pulse 1.15s ease-in-out infinite;
}
@keyframes quiz-ok-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(47, 191, 113, 0.25), 0 0 14px rgba(47, 191, 113, 0.5); }
  50% { box-shadow: 0 0 0 7px rgba(47, 191, 113, 0.35), 0 0 28px rgba(47, 191, 113, 0.8); }
}
.quiz-type-input.nope {
  border-color: var(--red-500);
  box-shadow: 0 0 0 3px rgba(214, 69, 69, 0.16), 0 0 16px rgba(214, 69, 69, 0.4);
  animation: quiz-shake .45s ease;
}
@keyframes quiz-shake {
  0%, 100% { transform: translateX(0); }
  18% { transform: translateX(-7px); }
  36% { transform: translateX(6px); }
  54% { transform: translateX(-5px); }
  72% { transform: translateX(4px); }
  88% { transform: translateX(-2px); }
}
.quiz-type-enter {
  flex: none; width: 2.4rem; height: 2.4rem; border-radius: 50%;
  border: 0; background: var(--orange); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.quiz-type-enter svg { width: 1.1rem; height: 1.1rem; }
.quiz-mode-capsule {
  display: flex; align-items: center; gap: 0.15rem;
  margin: 0.7rem auto 0; padding: 0.2rem;
  border-radius: 999px; background: var(--line-soft);
}
.quiz-mode-capsule[hidden] { display: none; }
.quiz-mode-btn {
  width: 3.4rem; height: 3rem; border: 0; border-radius: 999px;
  background: transparent; cursor: pointer; opacity: 0.42;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .15s ease;
}
.quiz-mode-btn svg { width: 1.9rem; height: 1.9rem; }
.quiz-mode-btn.on { background: var(--card); opacity: 1; box-shadow: 0 1px 4px rgba(27,33,68,.12); }

.recaption-btn {
  position: relative;
  margin-left: auto;
  width: 40px;
  height: 40px;
}
.recaption-btn[hidden] { display: none !important; }
.recaption-btn svg { width: 1.15rem; height: 1.15rem; display: block; }
.recaption-bubble {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.5rem);
  z-index: 6;
  padding: 0.45rem 0.7rem;
  border-radius: 1rem;
  background: rgba(255,255,255,.16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ink);
  font: 600 0.72rem Nunito, sans-serif;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0,0,0,.14);
  pointer-events: none;
}
.recaption-bubble[hidden] { display: none; }
html.theme-dark .recaption-bubble { color: #FFF8EF; }

/* Short landscape (phone rotate, or the desktop mockup frame): keep the
   whole quiz on one screen — no vertical scroll to reach CONTINUE.
   Tab rail sits on the right so the card can use the full height. */
@media (orientation: landscape) {
  #screen-review.active { flex-direction: row; }
  #screen-review .review-body {
    flex: 1;
    min-width: 0;
    padding: 0.4rem 0.5rem 0 1rem;
    overflow: hidden;
  }
  #screen-review .tabbar {
    flex-direction: column;
    width: 3.55rem;
    border-top: 0;
    border-left: 1px solid var(--line-soft);
    justify-content: center;
    gap: 0.25rem;
    padding: 0.4rem 0.2rem;
  }
  #screen-review .tabbar button {
    flex: none;
    width: 100%;
    min-height: 3.4rem;
    border-top: 0;
    border-right: 2px solid transparent;
    padding: 0.35rem 0.1rem;
    font-size: 0.58rem;
  }
  #screen-review .tabbar button.active {
    border-top-color: transparent;
    border-right-color: var(--green-500);
  }
  #screen-review .tabbar .mono { display: none; }
  #screen-review { overflow: hidden; }
  .review-head { margin-bottom: 0.2rem; }
  .review-progress { height: 6px; margin-bottom: 0.4rem; }
  .review-main {
    justify-content: flex-start;
    overflow: hidden;
    padding-bottom: 0;
  }
  .quiz-card {
    padding: 0.55rem 0.85rem 0.5rem;
    gap: 0.55rem;
    max-height: 100%;
  }
  .quiz-main { gap: 0.15rem; }
  .quiz-word { font-size: 1.45rem; }
  .quiz-sentence-ru { font-size: 0.72rem; line-height: 1.25; }
  .quiz-sentence-en { font-size: 0.68rem; margin-top: 0.1rem; }
  .tts-btn { width: 36px; height: 36px; }
  #screen-review .replay-btn { min-height: 32px; padding: 0.2rem 0.6rem; }
  .quiz-options { gap: 0.25rem; margin-top: 0.3rem; }
  .quiz-option { min-height: 2.15rem; padding: 0.35rem 0.4rem; font-size: 0.8rem; border-width: 2px; }
  .review-feedback { margin: 0.4rem auto 0; padding: 0.4rem 0.75rem; }
  .review-feedback-mark { font-size: 1rem; }
  .review-feedback strong { font-size: 0.85rem; }
  .review-feedback span { font-size: 0.68rem; }
  .quiz-next { min-height: 40px; margin-top: 0.4rem; }
  #review-reward-slot { display: none !important; }
  .review-mini-player { width: 7.5rem; }
  .review-mini-player #review-yt-target { width: 7.5rem; height: 4.2rem; }
  #screen-sentence-review .sentence-build-card {
    padding: 1.45rem 1.25rem 1.2rem;
    gap: 1rem;
    max-height: none;
  }
}

.review-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.375rem; color: var(--ink-faint); text-align: center; padding: 0 2.5rem; }
.review-empty[hidden],
.review-main[hidden],
.sentence-review-main[hidden] { display: none !important; }
.review-empty .big { font: 700 1rem Nunito, sans-serif; color: var(--ink); }
.review-empty .btn-secondary { width: auto; padding: 0.75rem 1.375rem; margin-top: 0.375rem; }
/* "Review again" acknowledgment when the click genuinely changes nothing
   on screen (still nothing due) - see the click handler in app.js. */
@keyframes review-empty-pulse {
  0% { transform: scale(1); }
  35% { transform: scale(1.04); }
  100% { transform: scale(1); }
}
.review-empty.pulse .big { animation: review-empty-pulse .3s ease; }

/* Narrow phone: the fixed-width mini-player sitting beside the quiz content
   would squeeze it down to an unreadable sliver - stack it below instead. */
@media (max-width: 30em) {
  .quiz-card { flex-direction: column; align-items: stretch; }
  .review-mini-player { width: 100%; align-self: center; max-width: 16rem; }
  .review-mini-player #review-yt-target { width: 100%; height: auto; aspect-ratio: 16/9; }
}

/* Release beta privacy controls stay reachable for guests and signed-in users. */
.auth-oauth[hidden], .auth-or[hidden], #auth-google-btn[hidden] { display: none; }
.privacy-link { display: block; margin: .7rem auto 0; padding: .5rem; border: 0; background: transparent; color: var(--ink-muted, #655b54); font: 700 .8rem/1.3 Nunito, sans-serif; text-decoration: underline; cursor: pointer; }
.home-privacy-link { margin-top: .1rem; }
.privacy-dialog { box-sizing: border-box; width: min(34rem, calc(100% - 2rem)); max-height: calc(100dvh - 3rem); overflow: auto; padding: 1.4rem; border: 1px solid #d8cabf; border-radius: 1.25rem; background: var(--bg, #fff8ef); color: var(--ink, #33251b); font: 1rem/1.5 Nunito, sans-serif; }
.privacy-dialog::backdrop { background: rgba(28, 22, 18, .55); }
.privacy-dialog h2 { margin-top: 0; font-size: 1.4rem; }
.privacy-dialog a { color: var(--teal, #087080); text-decoration: underline; }
.privacy-actions { display: grid; gap: .7rem; margin-top: 1rem; }
.privacy-dialog button { white-space: normal; }
.privacy-link:focus-visible, .privacy-dialog a:focus-visible { outline: 3px solid #d77a21; outline-offset: 3px; }
.account-delete-btn { color: #ad3329; margin-left: .5rem; }
#account-delete-error:empty { display: none; }

.offer-free-beta {
  position: absolute;
  z-index: 7;
  top: calc(.85rem + var(--para-safe-top, env(safe-area-inset-top, 0px)));
  right: max(1.2rem, calc((100% - 42rem) / 2 + 1.2rem));
  padding: .4rem .75rem;
  border: 1px solid #de741b;
  border-radius: 999px;
  background: #f58220;
  color: #25150a;
  font: 800 .75rem/1.2 Nunito, sans-serif;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.offer-free-beta:focus-visible { outline: 3px solid #087080; outline-offset: 3px; }
.offer-free-beta:disabled { opacity: .65; }

.privacy-entry { display: flex; flex-wrap: wrap; justify-content: center; column-gap: .6rem; }
.privacy-entry .privacy-link { margin-left: 0; margin-right: 0; }
.account-privacy-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: 0.85rem;
}
.account-privacy-links .privacy-link {
  margin: 0;
  padding: 0.15rem 0;
  color: #d0d0d0;
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

/* Experimental sentence review — isolated overlays; word gloss/review CSS unchanged. */
.sentence-picker-overlay { z-index: 22; align-items: flex-end; }
.sentence-picker-card {
  position: relative; width: min(26rem, 100%); max-height: 92%;
  padding: 0.75rem 1.05rem 1.05rem; overflow: auto;
  background: var(--card); border-radius: 1.5rem 1.5rem 1.15rem 1.15rem;
  box-shadow: 0 16px 40px rgba(27,33,68,.2); text-align: left;
}
.sentence-picker-card h3 { margin: 0 2rem 0.4rem 0; font: 800 1.28rem/1.15 Nunito, sans-serif; }
.sentence-picker-selected {
  display: flex; align-items: flex-start; gap: 0.55rem;
  margin: 0 0 1.85rem; padding: 1rem 0.9rem 1.15rem;
  min-height: 5.6rem;
  border: 1px solid #f4e6d4; border-radius: 0.85rem; background: #fffaf3;
}
.sentence-picker-selected input { margin-top: 0.2rem; accent-color: var(--orange); width: 1.05rem; height: 1.05rem; }
.sentence-picker-tokens {
  display: flex; flex-wrap: wrap; gap: 0.22rem 0.32rem;
  font: 700 1.02rem/1.45 Nunito, sans-serif; color: var(--ink);
}
.sentence-pick-token {
  color: #b8b0a4;
  opacity: .62;
  border-radius: 0.4rem;
  padding: 0 0.12rem;
}
.sentence-pick-token.in-range {
  color: var(--orange);
  opacity: 1;
  background: rgba(242, 122, 24, .14);
}
.sentence-pick-token.is-anchor.in-range { box-shadow: inset 0 -2px 0 rgba(242, 122, 24, .45); }
.sentence-range {
  position: relative;
  width: 100%;
  height: 2.85rem;
  margin: 0.1rem 0 0.2rem;
  touch-action: none;
}
.sentence-range-track {
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  height: 0.42rem;
  transform: translateY(-50%);
  border-radius: 999px;
  background: #efe3d2;
}
.sentence-range-fill {
  position: absolute;
  top: 0; bottom: 0;
  left: 0;
  width: 0;
  border-radius: inherit;
  background: var(--orange);
}
.sentence-range-thumb {
  position: absolute;
  top: 50%;
  left: 0;
  width: 2.25rem;
  height: 2.25rem;
  margin: 0;
  padding: 0;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 4px 14px rgba(242, 122, 24, .38);
  transform: translate(-50%, -50%);
  cursor: grab;
  z-index: 2;
  touch-action: none;
}
.sentence-range-thumb.is-end { z-index: 3; }
.sentence-range-thumb.is-active { z-index: 4; }
.sentence-range-input {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  appearance: none;
  -webkit-appearance: none;
  accent-color: var(--orange);
}
.sentence-range-times {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.25rem 0 0;
  font: 800 0.72rem "IBM Plex Mono", monospace;
  color: var(--ink-soft);
}
.sentence-picker-translation {
  display: block;
  margin: 0.55rem 0 0.15rem;
  min-height: 2.4rem;
  font: 600 0.86rem/1.35 Nunito, sans-serif; color: var(--ink-soft);
}
.sentence-picker-translation:empty::before {
  content: "\00a0";
}
.sentence-brick-preview {
  margin: 0.75rem 0 0.15rem; padding: 0.2rem 0 0.4rem;
  background: transparent; text-align: left;
}
.sentence-brick-preview[hidden] { display: none; }
.sentence-brick-preview-label {
  margin: 0 0 0.45rem;
  font: 800 0.72rem Nunito, sans-serif; color: var(--ink);
}
.sentence-brick-preview-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.sentence-brick-preview-row .sentence-tile {
  min-height: 34px; padding: 0.28rem 0.7rem; border: 0; border-radius: var(--r-pill);
  background: #fff4e6; color: var(--ink); font: 700 0.82rem Nunito, sans-serif;
}
.sentence-picker-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; margin-top: 1.05rem;
}
.sentence-picker-actions .save,
.sentence-picker-actions .resume {
  min-height: 48px; border-radius: var(--r-pill); cursor: pointer;
  font: 800 0.95rem Nunito, sans-serif;
}
.sentence-picker-actions .save { border: 0; background: var(--orange); color: #fff; }
.sentence-picker-actions .resume {
  border: 1px solid #efe3d2; background: #fff; color: var(--ink-soft);
}

.sentence-toast {
  position: absolute; left: 50%; bottom: 12%; z-index: 23;
  transform: translateX(-50%);
  padding: 0.55rem 0.95rem; border-radius: var(--r-pill);
  background: var(--ink); color: #fff;
  font: 800 0.78rem Nunito, sans-serif; letter-spacing: 0.02em;
  box-shadow: 0 10px 24px rgba(27,33,68,.22);
}
.sentence-toast[hidden] { display: none; }

#screen-sentence-review.active { display: flex; flex-direction: column; min-height: 0; }
#screen-sentence-review .review-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0.4rem 1.5rem 0;
  display: flex;
  flex-direction: column;
}
.sentence-practice-head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.55rem;
  margin: 0.15rem 0 0.55rem;
}
.sentence-practice-head h2 { margin: 0; flex: 1; font: 800 1.2rem Nunito, sans-serif; color: var(--ink); }
.sentence-practice-back {
  width: 2.4rem; height: 2.4rem; border: 0; border-radius: 50%;
  background: transparent; color: var(--ink); cursor: pointer;
  font: 700 1.2rem Nunito, sans-serif;
}
.sentence-review-pos { font: 700 0.78rem "IBM Plex Mono", monospace; color: #7a7268; }
.sentence-review-main {
  padding-top: 0.45rem;
  width: 100%;
  max-width: 37.5rem;
  align-self: center;
  align-items: stretch;
}
.sentence-build-title-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem;
  width: 100%;
  margin: 0 0 0.65rem;
}
.sentence-dir-row {
  display: flex;
  justify-content: flex-start;
  width: 100%;
  margin: 0 0 0.85rem;
}
.sentence-dir-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.15rem;
  padding: 0.2rem 0.7rem;
  border: 1.5px solid rgba(242, 122, 24, .7);
  border-radius: var(--r-pill);
  background: #fffaf3;
  color: var(--ink);
  cursor: pointer;
  font: 800 0.78rem Nunito, sans-serif;
}
.sentence-dir-btn[data-dir="en-ru"] { border-color: rgba(0, 153, 168, .7); }
.sentence-dir-swap { color: var(--teal); font-size: 0.95rem; }
.sentence-build-kicker {
  margin: 0; flex: 1; font: 700 0.98rem/1.3 Nunito, sans-serif; color: #7a7268; text-align: left;
  letter-spacing: 0; text-transform: none;
}
.sentence-build-card {
  flex-direction: column; align-items: stretch; gap: 1rem;
  width: 100%;
  max-width: none;
  border: 0; background: #fff;
  box-shadow: 0 10px 28px rgba(27,33,68,.08);
  padding: 1.45rem 1.25rem 1.2rem;
  max-height: none;
}
.sentence-build-pair { display: flex; flex-direction: column; gap: 0.35rem; }
.sentence-build-prompt {
  margin: 0; font: 800 1.2rem/1.4 Nunito, sans-serif; color: var(--ink); text-align: left;
}
.sentence-build-prompt:empty { display: none; }
.sentence-loop-btn {
  min-height: 36px; padding: 0.3rem 0.7rem; border: 0; background: transparent;
  color: var(--orange); cursor: pointer; font: 800 0.78rem Nunito, sans-serif;
}
.sentence-loop-btn.is-on { color: var(--teal); }
.sentence-build-row {
  min-height: 3.4rem; display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 0.45rem;
  padding: 0.15rem 0; border: 0; background: transparent;
}
.sentence-slot {
  min-width: 3.4rem; min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0.35rem 0.7rem; border-radius: 0.85rem;
  font: 800 0.9rem Nunito, sans-serif;
}
.sentence-slot.is-empty {
  min-width: 2.75rem;
  border: 1.5px dashed #d7c8b2; color: transparent; background: #fffdf8;
  border-radius: var(--r-pill);
}
.sentence-slot.is-filled {
  border: 0; background: #fff4e6; color: var(--ink); cursor: pointer;
}
.sentence-slot.is-filled.is-right {
  background: var(--green-500); color: #fff; -webkit-text-fill-color: #fff;
}
.sentence-slot.is-filled.is-wrong {
  background: var(--red-500); color: #fff; -webkit-text-fill-color: #fff;
}
.sentence-tile-bank {
  display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 0.45rem; min-height: 3rem;
}
.sentence-tile {
  min-height: 42px; padding: 0.4rem 0.85rem; border: 0; border-radius: var(--r-pill);
  background: #fff4e6; color: var(--ink); cursor: pointer;
  font: 800 0.95rem Nunito, sans-serif;
}
.sentence-tile:active { transform: translateY(1px); }
.sentence-tile.is-used { opacity: 0.22; pointer-events: none; }
.sentence-build-feedback {
  margin: 0; min-height: 1.2rem; text-align: left;
  font: 700 0.85rem Nunito, sans-serif;
}
.sentence-build-feedback.is-ok { color: var(--green-600); }
.sentence-build-feedback.is-no { color: var(--red-500); }
.sentence-build-actions { display: flex; align-items: center; gap: 0.7rem; }
.sentence-build-check { position: static; display: flex; flex: 1; width: auto; margin-top: 0; text-transform: none; letter-spacing: 0; }
.sentence-hint-btn {
  width: 3.3rem; min-height: 3.3rem; border: 0; border-radius: 50%;
  background: #fff4e6; color: var(--orange); cursor: pointer;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  font: 800 0.58rem Nunito, sans-serif;
}
.sentence-hint-btn span { font-size: 1.05rem; line-height: 1; }
.sentence-dir-row[hidden],
.sentence-build-row[hidden],
.sentence-tile-bank[hidden],
.sentence-speak-btn[hidden],
.sentence-socket-line[hidden],
.sentence-type-wrap[hidden],
.sentence-read-btn[hidden],
.sentence-read-panel[hidden],
.sentence-mode-capsule[hidden] { display: none !important; }
.sentence-source-line { display: flex; align-items: flex-start; gap: 0.55rem; }
.sentence-speak-btn {
  width: 2.35rem; height: 2.35rem; flex: none; border: 0; border-radius: 50%;
  background: #e7f4f6; color: #087080; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.sentence-speak-btn svg { width: 1.15rem; height: 1.15rem; }
.sentence-socket-line { height: 2px; background: #e3e7ee; }
.sentence-type-wrap { display: flex; flex-direction: column; gap: 0.4rem; }
.sentence-type-label { font: 800 0.78rem Nunito, sans-serif; color: #7a7268; }
.sentence-type-input {
  width: 100%; min-height: 6.5rem; box-sizing: border-box;
  border: 0; border-bottom: 2px solid #e3e7ee; border-radius: 0;
  background: transparent; color: var(--ink); resize: none;
  font: 700 1.2rem/1.45 Nunito, sans-serif; padding: 0.35rem 0.1rem;
}
.sentence-read-btn {
  min-height: 3rem; border-radius: 1rem; border: 2px solid #d5dbe3;
  background: #fff; color: var(--ink); cursor: pointer;
  font: 800 1rem Nunito, sans-serif;
}
.sentence-read-panel { display: flex; flex-direction: column; gap: 0.7rem; }
.sentence-read-listen {
  display: flex; align-items: center; gap: 0.45rem; margin: 0;
  font: 800 0.92rem Nunito, sans-serif; color: #087080;
}
.sentence-mic { width: 1.35rem; height: 1.35rem; display: inline-flex; }
.sentence-mic svg { width: 1.35rem; height: 1.35rem; }
.sentence-read-panel.is-listening .sentence-mic { animation: sentence-mic-pulse 1.1s ease-in-out infinite; }
@keyframes sentence-mic-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: 0.72; }
}
.sentence-read-words { display: flex; flex-wrap: wrap; gap: 0.45rem 0.55rem; }
.sentence-read-word {
  border: 0; background: transparent; padding: 0.1rem 0.05rem;
  font: 800 1.2rem/1.3 Nunito, sans-serif; color: var(--ink); cursor: default;
}
.sentence-read-word.is-heard { color: var(--green-600); }
.sentence-read-word.is-tappable { cursor: pointer; border-bottom: 2px solid #d5dbe3; }
.sentence-drag-ghost {
  position: fixed; z-index: 40; pointer-events: none; margin: 0;
  min-height: 48px; padding: 0.4rem 0.9rem; border-radius: 0.85rem;
  background: #fff; color: var(--ink); box-shadow: 0 8px 20px rgba(27,33,68,.18);
  font: 800 1.05rem Nunito, sans-serif;
}
.sentence-study-bar[hidden] { display: none !important; }
.sentence-study-bar {
  display: none;
  align-items: center;
  gap: 0.65rem;
  margin: 0.15rem 0 0.85rem;
  padding: 0.45rem 0.65rem 0.45rem 0.35rem;
  border-radius: 0.95rem;
  background: #fff;
}
.sentence-study-close {
  width: 2.1rem;
  height: 2.1rem;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: 500 1.55rem/1 Nunito, sans-serif;
}
.sentence-study-progress {
  flex: 1;
  height: 0.62rem;
  border-radius: 999px;
  background: #ece7df;
  overflow: hidden;
}
.sentence-study-progress > div {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--orange);
}
.sentence-study-count {
  flex: none;
  min-width: 2.4rem;
  text-align: right;
  font: 800 0.95rem/1 Nunito, sans-serif;
  color: var(--ink);
}

#screen-sentence-review.is-en-ru-study .review-progress,
#screen-sentence-review.is-en-ru-study .sentence-review-pos,
#screen-sentence-review.is-en-ru-study .sentence-loop-btn,
#screen-sentence-review.is-en-ru-study .sentence-hint-btn,
#screen-sentence-review.is-en-ru-study .sentence-build-kicker,
#screen-sentence-review.is-en-ru-study .sentence-practice-back,
#screen-sentence-review.is-en-ru-study .sentence-build-title-row { display: none; }
#screen-sentence-review.is-en-ru-study .sentence-study-bar { display: flex; }
#screen-sentence-review.is-en-ru-study .sentence-practice-head { margin: 0.15rem 0 0.85rem; }
#screen-sentence-review.is-en-ru-study .sentence-practice-head h2 {
  font: 800 1.45rem/1.2 Nunito, sans-serif;
}
#screen-sentence-review.is-en-ru-study .review-body {
  padding: 0.35rem 1rem 0.2rem;
}
#screen-sentence-review.is-en-ru-study .sentence-review-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: none;
  padding-top: 0.15rem;
}
#screen-sentence-review.is-en-ru-study .sentence-build-card {
  flex: 1;
  background: transparent;
  box-shadow: none;
  padding: 0.2rem 0 0.4rem;
  gap: 0.85rem;
  justify-content: flex-start;
}
#screen-sentence-review.is-en-ru-study .sentence-source-line {
  align-items: center;
  margin-top: 0.15rem;
  padding: 0.95rem 1rem;
  border: 1px solid #e6e1d8;
  border-radius: 0.95rem;
  background: #f4f1eb;
}
#screen-sentence-review.is-en-ru-study .sentence-build-prompt {
  font: 800 1.28rem/1.35 Nunito, sans-serif;
}
#screen-sentence-review.is-en-ru-study .sentence-socket-line {
  height: 1px;
  margin: 0.8rem 0 0;
  background: #e4dfd6;
}
#screen-sentence-review.is-en-ru-study .sentence-build-row,
#screen-sentence-review.is-en-ru-study .sentence-tile-bank { touch-action: none; }
#screen-sentence-review.is-en-ru-study .sentence-build-row {
  min-height: 4.4rem;
  margin-top: 1.85rem;
  gap: 0.55rem 0.6rem;
  align-items: flex-end;
  padding: 0.2rem 0 0.45rem;
  border-bottom: 2px solid #e3e7ee;
}
#screen-sentence-review.is-en-ru-study .sentence-slot {
  min-height: 56px;
  font: 800 1.16rem Nunito, sans-serif;
}
#screen-sentence-review.is-en-ru-study .sentence-slot.is-empty {
  min-width: 4.6rem;
  background: transparent;
  border: 0;
  border-bottom: 3px solid #cfd6e0;
  border-radius: 0;
}
#screen-sentence-review.is-en-ru-study .sentence-slot.is-filled {
  background: #f3f6fa;
  color: var(--ink);
  -webkit-text-fill-color: var(--ink);
  border-radius: 1rem;
  padding: 0.5rem 1rem;
  transition: transform 180ms ease;
}
#screen-sentence-review.is-en-ru-study .sentence-slot.is-filled.is-right {
  background: var(--green-500);
  color: #fff;
  -webkit-text-fill-color: #fff;
}
#screen-sentence-review.is-en-ru-study .sentence-slot.is-filled.is-wrong {
  background: var(--red-500);
  color: #fff;
  -webkit-text-fill-color: #fff;
}
#screen-sentence-review.is-en-ru-study .sentence-read-words { display: none !important; }
#screen-sentence-review.is-en-ru-study.is-reading .sentence-read-panel {
  margin: 1.15rem 0 0;
}
#screen-sentence-review.is-en-ru-study.is-reading .sentence-build-row {
  margin-top: 0.7rem;
}
#screen-sentence-review.is-en-ru-study.is-reading.is-sentence-type .sentence-build-row,
#screen-sentence-review.is-en-ru-study.is-reading.is-sentence-type .sentence-socket-line {
  display: flex;
}
#screen-sentence-review.is-en-ru-study.is-reading.is-sentence-type .sentence-socket-line {
  display: block;
}
#screen-sentence-review.is-en-ru-study.is-reading .sentence-slot.is-read-outline {
  background: transparent;
  color: #1d4f91;
  -webkit-text-fill-color: #1d4f91;
  border: 2px solid #2f7fd4;
  border-radius: 1rem;
  box-shadow: none;
}
#screen-sentence-review.is-en-ru-study.is-reading .sentence-slot.is-read-heard {
  background: #2f7fd4;
  color: #fff;
  -webkit-text-fill-color: #fff;
  border: 2px solid #2f7fd4;
  border-radius: 1rem;
}
#screen-sentence-review.is-en-ru-study.is-reading .sentence-slot.is-read-correct {
  background: var(--green-500);
  color: #fff;
  -webkit-text-fill-color: #fff;
  border: 2px solid var(--green-500);
  border-radius: 1rem;
  animation: sentence-read-correct-glow 0.72s ease;
}
@keyframes sentence-read-correct-glow {
  0% { box-shadow: 0 0 0 0 rgba(0, 169, 183, 0); }
  45% { box-shadow: 0 0 0 7px rgba(0, 169, 183, 0.45), 0 0 16px rgba(0, 169, 183, 0.55); }
  100% { box-shadow: 0 0 0 0 rgba(0, 169, 183, 0); }
}
#screen-sentence-review.is-en-ru-study .sentence-build-check.is-continue-glow {
  animation: sentence-continue-glow 1.15s ease;
}
@keyframes sentence-continue-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(242, 122, 24, 0); }
  28%, 72% { box-shadow: 0 0 0 8px rgba(242, 122, 24, 0.38), 0 0 18px var(--orange); }
  50% { box-shadow: 0 0 0 0 rgba(242, 122, 24, 0); }
}
#screen-sentence-review.is-en-ru-study.is-reading.is-read-done .sentence-read-listen {
  visibility: hidden;
}
@media (prefers-reduced-motion: reduce) {
  #screen-sentence-review.is-en-ru-study.is-reading .sentence-slot.is-read-correct,
  #screen-sentence-review.is-en-ru-study .sentence-build-check.is-continue-glow {
    animation-duration: 0.01ms;
  }
}
#screen-sentence-review.is-en-ru-study.is-reading .sentence-slot.is-read-tappable {
  cursor: pointer;
}
#screen-sentence-review.is-en-ru-study .sentence-tile-bank {
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 1.25rem;
  align-content: flex-start;
}
#screen-sentence-review.is-en-ru-study .sentence-tile {
  min-height: 56px;
  padding: 0.55rem 1.05rem;
  border-radius: 1rem;
  font: 800 1.16rem Nunito, sans-serif;
  background: #eef2f6;
}
#screen-sentence-review.is-en-ru-study .sentence-build-actions {
  flex-direction: column;
  align-items: stretch;
  margin-top: 0.55rem;
}
#screen-sentence-review.is-en-ru-study .sentence-build-check {
  min-height: 64px;
  width: 100%;
  font-size: 1.12rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
#screen-sentence-review.is-en-ru-study .sentence-type-label { display: none; }
#screen-sentence-review.is-en-ru-study .sentence-type-input {
  min-height: 9.5rem;
  background: #f4f6f8;
  border: 0;
  border-radius: 1rem;
  padding: 1rem;
  outline: none;
}
#screen-sentence-review.is-en-ru-study.is-sentence-type .sentence-build-row,
#screen-sentence-review.is-en-ru-study.is-sentence-type .sentence-tile-bank,
#screen-sentence-review.is-en-ru-study.is-sentence-type .sentence-socket-line { display: none; }
#screen-sentence-review.is-en-ru-study.is-sentence-type .sentence-build-actions { margin-top: auto; }
#screen-sentence-review.is-en-ru-study .sentence-mode-capsule { margin: 0.7rem auto 0.2rem; }

/* ---------- LANGUAGE HUB (Warm Echo) ---------- */
.language-hub-screen {
  --hub-orange: #eab68a;
  --hub-teal: #81bccb;
  --hub-ink: #1b2144;
  --hub-row: 54%;
  position: relative;
  overflow: hidden;
  background: var(--hub-orange);
  color: var(--hub-ink);
  container-type: inline-size;
  touch-action: none;
  user-select: none;
}
.language-hub-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.language-hub-split {
  position: absolute;
  inset: 0;
  display: flex;
}
.language-hub-pane { width: 50%; }
.language-hub-pane.is-left { background: var(--hub-orange); }
.language-hub-pane.is-right { background: var(--hub-teal); }
.language-hub-bear {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 21%;
  width: 89%;
  height: auto;
  transform: translateX(-50%);
  opacity: .12;
  pointer-events: none;
}
.language-hub-label {
  position: absolute;
  z-index: 2;
  top: 25%;
  width: 40%;
  margin: 0;
  text-align: center;
  font: 800 clamp(1.125rem, 5.9cqw, 1.45rem)/1.16 Nunito, sans-serif;
  letter-spacing: -.04em;
  pointer-events: none;
}
.language-hub-label.is-left { left: 5%; }
.language-hub-label.is-right { right: 5%; }
.language-hub-rail {
  position: absolute;
  z-index: 2;
  top: var(--hub-row);
  left: 10%;
  width: 80%;
  height: clamp(78px, 26.7cqw, 104px);
  transform: translateY(-50%);
  border: 1px solid rgba(255, 255, 255, .79);
  border-radius: 55px;
  background: rgba(255, 255, 255, .25);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, .79), 0 12px 25px rgba(27, 33, 68, .12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.language-hub-socket {
  position: absolute;
  z-index: 3;
  top: var(--hub-row);
  left: 20%;
  width: clamp(44px, 13.9cqw, 54px);
  height: clamp(44px, 13.9cqw, 54px);
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .79);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(27, 33, 68, .09);
  box-shadow: inset 0 3px 7px rgba(27, 33, 68, .12);
  color: var(--hub-ink);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.language-hub-socket.is-right { left: 80%; }
.language-hub-socket svg { width: 17px; height: 17px; opacity: .7; }
.language-hub-socket.is-over {
  background: rgba(255, 255, 255, .79);
  box-shadow: inset 0 2px 6px rgba(27, 33, 68, .12), 0 0 0 7px rgba(255, 255, 255, .25);
}
.language-hub-socket:focus-visible,
.language-hub-orb:focus-visible {
  outline: 3px solid var(--hub-ink);
  outline-offset: 3px;
}
.language-hub-orb {
  position: absolute;
  z-index: 20;
  left: 50%;
  top: var(--hub-row);
  width: clamp(64px, 23cqw, 90px);
  height: clamp(64px, 23cqw, 90px);
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .79);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse at 24% 15%, rgba(255, 255, 255, .79), rgba(255, 255, 255, .25) 25%, rgba(255, 255, 255, .06) 57%, rgba(255, 255, 255, .16) 72%, rgba(255, 255, 255, .79));
  box-shadow: inset 2px 3px 5px rgba(255, 255, 255, .79), inset -3px -4px 7px rgba(27, 33, 68, .12), 0 13px 24px rgba(27, 33, 68, .12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  touch-action: none;
  cursor: grab;
}
.language-hub-orb::after {
  content: "";
  position: absolute;
  top: 8%;
  left: 12%;
  width: 38%;
  height: 20%;
  border-radius: 50%;
  transform: rotate(-26deg);
  background: linear-gradient(rgba(255, 255, 255, .79), transparent);
  pointer-events: none;
}
.language-hub-orb-flag {
  display: block;
  width: 65%;
  height: 65%;
  border-radius: 50%;
  background: var(--language-flag-image) center / cover no-repeat;
  box-shadow: inset -3px -5px 8px rgba(22, 36, 64, .2);
}
.language-hub-orb.is-settled {
  border: 3px solid #fff;
  background: #fff;
  box-shadow: 0 6px 14px rgba(27, 33, 68, .07);
  backdrop-filter: none;
}
.language-hub-orb.is-settled::after { display: none; }
.language-hub-orb.is-settled .language-hub-orb-flag {
  width: 100%;
  height: 100%;
  box-shadow: none;
}
.language-hub-orb.is-echo-orb {
  position: absolute;
  z-index: 40;
  margin: 0;
}
.language-hub-screen.is-echoing .language-hub-orb { cursor: grabbing; }
.language-hub-brand {
  position: absolute;
  z-index: 4;
  top: max(7.3%, calc(var(--para-safe-top, env(safe-area-inset-top, 0px)) + .35rem));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: baseline;
  gap: .5rem;
  pointer-events: none;
}
.language-hub-brand strong {
  font: 800 1.55rem/1 Nunito, sans-serif;
  letter-spacing: -.04em;
}
.language-hub-brand span {
  color: #006c78;
  font: 800 .7rem/1 Nunito, sans-serif;
  letter-spacing: .14em;
}
.language-hub-wave {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  clip-path: circle(0px at var(--echo-x, 50%) var(--echo-y, 54%));
  -webkit-clip-path: circle(0px at var(--echo-x, 50%) var(--echo-y, 54%));
}
.language-hub-wave.is-open {
  clip-path: circle(var(--echo-r, 120%) at var(--echo-x, 50%) var(--echo-y, 54%));
  -webkit-clip-path: circle(var(--echo-r, 120%) at var(--echo-x, 50%) var(--echo-y, 54%));
}
.language-hub-ring {
  position: absolute;
  z-index: 30;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 1.5px solid rgba(255, 255, 255, .5);
  box-shadow: 0 0 14px rgba(255, 255, 255, .27), inset 0 0 12px rgba(255, 255, 255, .13);
  pointer-events: none;
}
.language-screen.is-echo-reveal {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  overflow: hidden;
  clip-path: circle(0px at var(--echo-x, 20%) var(--echo-y, 54%));
  -webkit-clip-path: circle(0px at var(--echo-x, 20%) var(--echo-y, 54%));
  transition: none;
}
.language-screen.is-echo-reveal.is-echo-open {
  clip-path: circle(var(--echo-r, 140%) at var(--echo-x, 20%) var(--echo-y, 54%));
  -webkit-clip-path: circle(var(--echo-r, 140%) at var(--echo-x, 20%) var(--echo-y, 54%));
  transition: clip-path 744ms cubic-bezier(.24,.78,.18,1), -webkit-clip-path 744ms cubic-bezier(.24,.78,.18,1);
}
.language-screen.is-hub-pair.is-echo-reveal {
  position: absolute;
  inset: 0;
  z-index: 8;
}
.language-back[hidden] { display: none; }
.language-back {
  position: absolute;
  z-index: 12;
  top: max(0.45rem, calc(env(safe-area-inset-top, 0px) + 0.2rem));
  left: max(0.45rem, env(safe-area-inset-left, 0px));
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: rgba(255, 248, 239, 0.94);
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(27, 33, 68, 0.08);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.language-back svg { width: 22px; height: 22px; }
.language-back:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
}

/* Cream pair step. The row uses the pre-hub stage (flags, bear, gaps).
   Left flag is always the video language. Right flag is always subtitles.
   Know-Russian swaps those anchors and uses its own inward wheel: the
   arc bulges from the left flag toward the bear. Learn keeps the
   right-hand wheel that opens left. */
.language-screen.is-hub-pair {
  background: #fff8ef;
  color: var(--ink);
}
.language-screen.is-hub-pair .language-picker-copy {
  width: min(100%, 20rem);
  margin-top: clamp(2.6rem, 8vh, 3.8rem);
}
.language-screen.is-hub-pair .language-picker-copy h1 {
  color: var(--ink);
  font-size: clamp(1.9rem, 8.2vw, 2.4rem);
  line-height: 1.05;
}
.language-screen.is-hub-pair .language-mascot {
  width: clamp(7.5rem, 34vw, 9rem);
}
.language-screen.is-hub-pair.is-video-selectable .language-source-choice { left: calc(100% - 4.75rem); }
.language-screen.is-hub-pair.is-video-selectable .language-target-choice { left: 0; }
.language-screen.is-hub-pair .language-source-bubble { border-color: var(--pair-fixed-ring, var(--orange)); }
.language-screen.is-hub-pair .language-target-bubble { border-color: var(--pair-other-ring, var(--teal)); }
.language-screen.is-hub-pair .language-pair-stage.language-menu-open .language-target-bubble,
.language-screen.is-hub-pair .language-pair-stage.language-menu-open .language-radial-option[data-slot="0"] {
  border-color: var(--orange);
}
.language-screen.is-video-selectable .language-radial-option { left: 2.375rem; }
/* Know-Russian wheel only. Flat edge on the left flag, curve toward the
   bear. Learn's ::before (right side, opening left) is unchanged. */
.language-screen.is-video-selectable .language-radial-menu::before {
  right: auto;
  left: 2.375rem;
  width: 8.6rem;
  height: 24rem;
  border-top: 2px solid rgba(242, 122, 24, .18);
  border-right: 2px solid rgba(242, 122, 24, .18);
  border-bottom: 2px solid rgba(242, 122, 24, .18);
  border-left: 0;
  border-radius: 0 9rem 9rem 0;
  transform: translateY(-50%);
}
.language-screen.is-video-selectable .language-radial-option[data-slot="-1"],
.language-screen.is-video-selectable .language-radial-option[data-slot="1"] {
  --wheel-x: 1.152rem;
}
.language-screen.is-video-selectable .language-radial-option[data-slot="-2"],
.language-screen.is-video-selectable .language-radial-option[data-slot="2"] {
  --wheel-x: 4.3rem;
}
.language-screen.is-video-selectable .language-radial-option[data-slot="-3"],
.language-screen.is-video-selectable .language-radial-option[data-slot="3"] {
  --wheel-x: 8.6rem;
}
.language-screen.is-video-selectable .language-radial-option[data-slot="-4"],
.language-screen.is-video-selectable .language-radial-option[data-slot="4"] {
  --wheel-x: 12.9rem;
}
.language-screen.is-hub-pair .language-continue {
  width: min(100%, 20rem);
  height: 49px;
  margin-top: 0.85rem;
  border-radius: 25px;
  letter-spacing: .5px;
}
.account-direction-reset {
  display: block;
  width: 100%;
  margin-top: .65rem;
  padding: .55rem .2rem;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  text-align: left;
  font: 800 .78rem/1.3 Nunito, sans-serif;
}
.account-direction-reset:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .language-hub-orb,
  .language-screen.is-echo-reveal { transition: none; }
}
