:root {
  /* The device's safe area; in Telegram's fullscreen (tablets, web/telegram.js)
     also Telegram's own buttons over the top of the page. */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --paper: #f3eddf;
  --paper-deep: #e7ddca;
  --ink: #173b36;
  --ink-soft: #4b625d;
  --red: #df553f;
  --red-dark: #be3e2d;
  --on-red: #fff;
  --jade: #b8d1bd;
  --white: #fffdf7;
  --line: rgba(23, 59, 54, 0.14);
  --shadow: 0 26px 60px rgba(37, 45, 34, 0.16), 0 5px 14px rgba(37, 45, 34, 0.08);
}

:root.tg-fullscreen {
  --safe-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: calc(var(--tg-safe-area-inset-bottom, 0px) + var(--tg-content-safe-area-inset-bottom, 0px));
  --safe-left: calc(var(--tg-safe-area-inset-left, 0px) + var(--tg-content-safe-area-inset-left, 0px));
  --safe-right: calc(var(--tg-safe-area-inset-right, 0px) + var(--tg-content-safe-area-inset-right, 0px));
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* Older Safari gives every button align-items: flex-start, so a column-flex button (the dialogue cards) shrank its
 * children to their text and clipped what sits absolutely inside them (Ivan's 2019 iPad, 2026-11-03). Today's default. */
button { align-items: normal; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  height: calc(100dvh / var(--ui-zoom, 1));
  background: #cfc9bd;
  color: var(--ink);
  font-family: "Manrope", system-ui, sans-serif;
  /* Manrope's space is only .18em wide, and headings are tracked tighter still. */
  word-spacing: .12em;
  /* No line ends on one lonely word; short titles and labels balance their lines. */
  text-wrap: pretty;
}
h1, h2, h3, .path-node__label b, .bao-bubble, .translation, .achievement b, .topic-button strong { text-wrap: balance; }
.nowrap { white-space: nowrap; }
button { font: inherit; word-spacing: inherit; color: inherit; touch-action: manipulation; }
button, img { -webkit-user-drag: none; }
button { user-select: none; }

.app-shell {
  position: relative;
  width: 100%;
  height: calc(100dvh / var(--ui-zoom, 1));
  min-height: 0;
  margin: 0 auto;
  overflow: hidden;
  background:
    radial-gradient(circle at 86% 4%, rgba(223, 85, 63, .11), transparent 30%),
    linear-gradient(155deg, #f8f3e9 0%, var(--paper) 65%, #eee5d5 100%);
}

[hidden] { display: none !important; }
.menu-screen {
  height: calc(100dvh / var(--ui-zoom, 1));
  overflow-y: auto;
  padding: max(18px, var(--safe-top)) 20px max(28px, var(--safe-bottom));
  overscroll-behavior: contain;
}
.menu-header, .menu-player, .random-panel__top, .all-cards-panel__top, .section-heading, .all-cards-button, .all-cards-count {
  display: flex;
  align-items: center;
}
.menu-header { justify-content: space-between; }
.brand-mark {
  display: grid;
  width: 45px;
  height: 45px;
  place-items: center;
  border-radius: 50% 50% 50% 18%;
  background: var(--red);
  color: var(--on-red);
  font-family: "Noto Serif SC", serif;
  font-size: 24px;
  font-weight: 700;
  transform: rotate(-4deg);
}
.menu-player { gap: 7px; font-size: 12px; font-weight: 800; }
.menu-player .avatar { border-color: rgba(255,255,255,.65); }
.menu-intro { margin: clamp(28px, 6dvh, 54px) 2px 24px; }
.menu-intro h1 { max-width: 340px; font-size: clamp(36px, 10vw, 48px); line-height: 1.02; }
.menu-intro > p:last-child { max-width: 330px; margin: 13px 0 0; color: var(--ink-soft); font-size: 14px; line-height: 1.55; }
.random-panel {
  position: relative;
  overflow: hidden;
  padding: 20px;
  border-radius: 26px 26px 52px 26px;
  background: var(--ink);
  color: white;
  box-shadow: 0 18px 44px rgba(23,59,54,.16);
}
.random-panel::after {
  content: "";
  position: absolute;
  right: -42px;
  bottom: -65px;
  width: 150px;
  height: 150px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 50%;
  box-shadow: 0 0 0 28px rgba(255,255,255,.025), 0 0 0 56px rgba(255,255,255,.018);
}
.random-panel__top { position: relative; z-index: 1; justify-content: space-between; }
.menu-kicker { color: #e7a89b; font-size: 10.5px; font-weight: 800; letter-spacing: .15em; }
.random-panel h2 { margin-top: 3px; color: white; font-size: 24px; }
.random-glyph { font-family: "Noto Serif SC", serif; font-size: 50px; line-height: 1; opacity: .2; }
.deck-size { position: relative; z-index: 1; display: flex; gap: 8px; margin: 20px 0 12px; }
.deck-size button {
  min-width: 58px;
  min-height: 44px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 13px;
  background: rgba(255,255,255,.07);
  color: white;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.deck-size button.is-selected { border-color: #f2b0a2; background: var(--red); }
.menu-primary {
  position: relative;
  z-index: 1;
  display: flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  padding: 0 17px;
  border: 0;
  border-radius: 15px;
  background: var(--white);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.menu-primary span { font-size: 20px; }
#startReview { justify-content: center; text-align: center; }
/* A paused round: "continue" leads, a quiet reset sits to its right. */
.start-row { display: flex; flex-wrap: wrap; gap: 8px; }
.start-row #startReview { flex: 3 1 0; width: auto; min-width: max-content; white-space: nowrap; }
.start-reset { flex: none; width: 52px; border: 1px solid rgba(255,255,255,.34); border-radius: 15px; background: rgba(255,255,255,.08); color: rgba(255,255,255,.8); font-size: 20px; font-weight: 700; cursor: pointer; }
.start-reset:hover { background: rgba(255,255,255,.16); color: white; }
/* Beside «Начать»; on a narrow phone with the free count it takes a row of its own. */
.start-test { display: flex; flex: 1 0 auto; flex-direction: column; align-items: center; justify-content: center; min-height: 44px; padding: 0 14px; white-space: nowrap; border: 1px solid rgba(255,255,255,.34); border-radius: 15px; background: rgba(255,255,255,.08); color: #fffef9; font: inherit; font-size: 15px; font-weight: 800; cursor: pointer; }
.start-test:hover { background: rgba(255,255,255,.16); }
.start-test small { color: rgba(255,255,255,.72); font-size: 11px; font-weight: 700; letter-spacing: 0; line-height: 1.2; }
.topics-section { margin-top: 28px; }
/* A hint too long for the title's line drops under it, instead of squeezing the title onto two lines. */
.section-heading { flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; margin: 0 2px 13px; }
.section-heading h2 { font-size: 21px; }
.section-heading span { color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.topic-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.topic-button {
  min-width: 0;
  min-height: 118px;
  padding: 12px 9px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(var(--glass-rgb), .67);
  text-align: left;
  cursor: pointer;
}
.topic-glyph {
  display: grid;
  width: 42px;
  height: 42px;
  margin-bottom: 10px;
  place-items: center;
  border-radius: 50% 50% 16px 50%;
  font-family: "Noto Serif SC", serif;
  font-size: 22px;
  font-weight: 700;
}
.topic-glyph--coral { background: #f2c7bb; color: #9f3e2f; }
.topic-glyph--gold { background: #efdbac; color: #805b17; }
.topic-glyph--green { background: #c9ddca; color: #2f6659; }
.topic-glyph--blue { background: #c5dbe1; color: #326576; }
.topic-glyph--violet { background: #dad0e2; color: #634f75; }
.topic-glyph--ink { background: #cbd3cc; color: #294c46; }
.topic-glyph--rose { background: #e6c6cf; color: #8f4a5e; }
.topic-glyph--clay { background: #ddc9ac; color: #7a5230; }
.topic-button strong, .topic-button small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topic-button strong { font-size: 12px; }
.topic-button small { margin-top: 3px; color: var(--ink-soft); font-size: 10px; }
.all-cards-panel {
  position: relative;
  overflow: hidden;
  margin-top: 14px;
  padding: 20px;
  border-radius: 26px 26px 52px 26px;
  background: #1b4650;
  color: white;
  box-shadow: 0 18px 44px rgba(23,59,54,.16);
}
.all-cards-panel::after {
  content: "";
  position: absolute;
  right: -42px;
  bottom: -65px;
  width: 150px;
  height: 150px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 50%;
  box-shadow: 0 0 0 28px rgba(255,255,255,.025), 0 0 0 56px rgba(255,255,255,.018);
}
.all-cards-panel__top { position: relative; z-index: 1; justify-content: space-between; }
.all-cards-panel .menu-kicker { color: #9cc9bb; }
.all-cards-panel h2 { margin-top: 3px; color: white; font-size: 24px; }
.panel-glyph { font-family: "Noto Serif SC", serif; font-size: 50px; line-height: 1; opacity: .2; }
.all-cards-button {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 70px;
  justify-content: space-between;
  margin-top: 16px;
  padding: 0 17px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 18px;
  background: rgba(255,255,255,.07);
  color: white;
  text-align: left;
  cursor: pointer;
}
.all-cards-copy strong, .all-cards-copy small { display: block; }
.all-cards-copy strong { font-size: 15px; }
.all-cards-copy small { margin-top: 3px; color: rgba(255,255,255,.68); font-size: 11px; }
.all-cards-total { opacity: .72; }
.all-cards-count { gap: 12px; }
.all-cards-count > span { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 50%; background: var(--jade); color: var(--ink); font-size: 18px; }
.all-cards-panel .toggle-row { position: relative; z-index: 1; }
.all-cards-panel .toggle-row:not([hidden]) ~ .toggle-row { border-top: 0; }
.all-cards-panel .switch { background: rgba(255,255,255,.24); }
.all-cards-panel .toggle-row[aria-checked="true"] .switch { background: var(--jade); }

.toggle-row {
  display: flex;
  width: 100%;
  min-height: 46px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px;
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
/* A divider only between visible rows: hidden rows around them leave no stray line. */
.toggle-row:not([hidden]) ~ .toggle-row { border-top: 1px solid var(--line); }
/* The profile's support code: read out or copied, so it looks like one. */
.support-code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 700; letter-spacing: .06em; user-select: all; }
.switch { position: relative; flex: 0 0 auto; width: 46px; height: 28px; border-radius: 999px; background: rgba(23,59,54,.22); transition: background .2s ease; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s ease; }
.toggle-row[aria-checked="true"] .switch { background: var(--red); }
.toggle-row[aria-checked="true"] .switch::after { transform: translateX(18px); }
.toggle-arrow { color: var(--red-dark); font-size: 18px; font-weight: 800; }

.game-screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: max(16px, var(--safe-top)) 20px max(14px, var(--safe-bottom));
}

.topbar, .progress-row, .answer-buttons, .score-strip, .sheet-header {
  display: flex;
  align-items: center;
}
.topbar { justify-content: space-between; min-height: 44px; }
.topbar__left { display: flex; align-items: center; gap: 5px; }
.back-button { font-size: 25px; }
#detailClose, #componentClose { font-size: 28px; font-weight: 400; }
.back-button__label { display: none; }
.icon-button.back-button--home { display: inline-flex; flex: 0 0 auto; align-items: center; height: 36px; width: auto; gap: 6px; padding: 0 14px 0 8px; border-radius: 999px; background: rgba(23,59,54,.07); font-size: 20px; }
.icon-button.back-button--home .back-button__label { display: inline; font-size: 14px; font-weight: 800; }
.avatar {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 2px solid var(--paper);
  border-radius: 50%;
  color: white;
  font-size: 10px;
  font-weight: 800;
}
.avatar--red { background: var(--red); }
.avatar--blue { background: #467d8b; }
.avatar--gold { background: #c5953d; }
.icon-button, .close-button {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.icon-button svg { width: 23px; height: 23px; }

.eyebrow { margin: 0 0 4px; color: var(--red-dark); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
h1, h2 { margin: 0; letter-spacing: -.04em; }
h1 { font-size: clamp(26px, 7vw, 32px); line-height: 1.1; }
h2 { font-size: 25px; }
.timer { position: relative; display: grid; width: 52px; height: 52px; place-items: center; }
.timer svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 3; }
.timer__track { stroke: rgba(23,59,54,.12); }
.timer__progress { stroke: var(--red); stroke-linecap: round; stroke-dasharray: 113.1; stroke-dashoffset: 0; transition: stroke-dashoffset .3s linear; }
.timer span { font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; }
.timer.is-hidden { display: none; }

.progress-row { gap: 10px; margin: 14px 2px 14px; }
.progress-bar { flex: 1; height: 4px; overflow: hidden; border-radius: 99px; background: rgba(23,59,54,.11); }
.progress-bar span { display: block; width: 100%; height: 100%; border-radius: inherit; background: var(--red); transition: transform .35s ease-out; transform-origin: left; }
.progress-row > span { min-width: 40px; color: var(--ink-soft); font-size: 11px; font-weight: 800; }
.progress-row .timer { flex: 0 0 auto; width: 38px; height: 38px; }
.progress-row .timer span { font-size: 9px; }

.card-stage { position: relative; flex: 1; min-height: 0; perspective: 1300px; }
.card-level { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 5; padding: 3px 9px; border-radius: 999px; background: var(--deck-tint); color: var(--ink); font-size: 11px; font-weight: 800; letter-spacing: .02em; pointer-events: none; }
.card-swipe-surface {
  position: absolute;
  z-index: 1;
  inset: 0;
  perspective: 1300px;
  transition: transform .35s cubic-bezier(.2,.75,.25,1), opacity .35s ease;
  will-change: transform;
}
.card-swipe-surface.is-dragging { transition: none; }
.card-swipe-surface.is-reset { transition: none !important; }
.card-bookmark {
  position: absolute;
  z-index: 5;
  top: -7px;
  right: 24px;
  width: 38px;
  height: 58px;
  padding: 0;
  border: 2px solid #326576;
  border-top: 0;
  background: #d9e8ec;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 76%, 0 100%);
  cursor: pointer;
  filter: drop-shadow(0 5px 5px rgba(37,45,34,.12));
}
.card-bookmark.is-active { background: #326576; }
.card-speak, .quiz-speak { display: inline-grid; place-items: center; width: 46px; height: 46px; border: 0; border-radius: 50%; background: linear-gradient(135deg, #fa8466, #cf4934); color: white; box-shadow: 0 4px 12px rgba(223,85,63,.3); cursor: pointer; }
.card-speak:active, .quiz-speak:active { transform: scale(.94); }
/* Recording still being looked up: a quiet placeholder where the button will be. */
.card-speak.is-loading, .quiz-speak.is-loading, .detail-speak.is-loading { background: var(--paper-deep); box-shadow: none; color: transparent; cursor: default; animation: speak-skeleton 1.1s ease-in-out infinite alternate; }
@keyframes speak-skeleton { from { opacity: .45; } to { opacity: .9; } }
@media (prefers-reduced-motion: reduce) { .card-speak.is-loading, .quiz-speak.is-loading, .detail-speak.is-loading { animation: none; opacity: .6; } }
.card-speak { position: absolute; z-index: 5; top: 14px; left: 16px; }
.card-report { position: absolute; z-index: 5; right: 12px; bottom: 12px; }
/* A new word's page (examples, other meanings, structure), at the foot of its card. */
.card-more { position: absolute; z-index: 5; left: 50%; bottom: 14px; transform: translateX(-50%); min-height: 36px; padding: 0 8px; border: 0; background: none; color: var(--ink-soft); font: inherit; font-size: 15px; font-weight: 600; text-decoration: underline; text-decoration-color: rgba(23,59,54,.3); text-underline-offset: 4px; white-space: nowrap; cursor: pointer; }
.card-more::after { content: " ›"; display: inline-block; margin-left: 4px; text-decoration: none; }
.card-more:active { transform: translateX(-50%) scale(.96); }
.quiz-more { position: static; transform: none; min-height: 32px; }
.quiz-more:active { transform: scale(.96); }
.card-stack { position: absolute; z-index: 0; inset: 0; pointer-events: none; }
.stack-card {
  position: absolute;
  inset: 0;
  display: block;
  border: 1px solid rgba(255,255,255,.78);
  border-radius: 30px 30px 68px 30px;
  background: rgba(var(--glass-rgb), .72);
  box-shadow: 0 14px 36px rgba(37,45,34,.08);
  transform-origin: 50% 85%;
  transition: opacity .28s ease, transform .4s cubic-bezier(.2,.75,.25,1);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}
.stack-card--3 { opacity: .38; transform: translate(4px, -17px) rotate(2.6deg) scale(.962); }
.stack-card--2 { opacity: .56; transform: translate(-5px, -11px) rotate(-1.8deg) scale(.976); }
.stack-card--1 { opacity: .82; transform: translate(3px, -5px) rotate(.8deg) scale(.99); }
.stack-card.is-hidden { opacity: 0; transform: translateY(0) scale(.94); }
.flashcard { position: absolute; z-index: 1; inset: 0; width: 100%; height: auto; min-height: 0; padding: 0; border: 0; background: none; cursor: pointer; touch-action: none; }
.flashcard.is-reset,
.flashcard.is-reset .flashcard__inner,
.flashcard.is-reset .flashcard__face,
.flashcard.no-flip .flashcard__inner,
.flashcard.no-flip .flashcard__face { transition: none !important; }
.swipe-cue {
  position: absolute;
  z-index: 3;
  top: 72px;
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .02em;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s linear;
}
.swipe-cue span { font-size: 18px; }
.swipe-cue--miss { left: 18px; background: rgba(229,222,209,.94); color: #6f5d56; border: 2px solid #c8bda9; transform: rotate(-6deg); }
.swipe-cue--hit { right: 18px; background: rgba(23,59,54,.94); color: white; border: 2px solid #2f7061; transform: rotate(6deg); }
.swipe-hint { position: absolute; z-index: 4; inset: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 10px; opacity: 0; transition: opacity .25s ease; pointer-events: none; }
.swipe-hint.is-visible { opacity: 1; }
.swipe-hint__side { display: flex; flex-direction: column; align-items: center; gap: 4px; max-width: 96px; color: var(--ink); }
/* Arrows sit on the card art, which is light in both themes; labels sit on the card. */
.swipe-hint__side--miss { color: var(--ink-soft); }
.swipe-hint__side--hit { color: var(--ink); }
.swipe-hint__side--miss .swipe-hint__arrow { color: #7a655c; }
.swipe-hint__side--hit .swipe-hint__arrow { color: #173b36; }
.swipe-hint__arrow { font-size: 46px; font-weight: 800; line-height: 1; }
.swipe-hint__label { font-size: 12px; font-weight: 800; text-align: center; }
.flashcard__inner { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; -webkit-transform-style: preserve-3d; transition: transform .62s cubic-bezier(.2,.75,.25,1); }
.flashcard.is-flipped .flashcard__inner { transform: rotateY(180deg); }
.flashcard.is-flipped.turns-left .flashcard__inner { transform: rotateY(-180deg); }
.flashcard.is-turning .flashcard__inner { transition: none; }
.flashcard__face {
  position: absolute;
  inset: 0;
  display: flex;
  overflow: hidden;
  border-radius: 30px 30px 68px 30px;
  background: var(--white);
  box-shadow: var(--shadow);
  /* The visible face is decided purely by its orientation: no delayed
     visibility swap that can desync from the rotation and flash the other side. */
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.flashcard__front { flex-direction: column; align-items: center; justify-content: center; padding: 28px; transform: rotateY(0deg) translateZ(1px); }
.flashcard__front::before {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  border: 1px solid rgba(223,85,63,.13);
  border-radius: 50%;
  box-shadow: 0 0 0 38px rgba(223,85,63,.04), 0 0 0 76px rgba(223,85,63,.025);
}
.card-label { z-index: 1; color: var(--red-dark); font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.hanzi { z-index: 1; display: flex; align-items: center; justify-content: center; margin: -4px 0 6px; font-family: "Noto Serif SC", serif; font-size: clamp(64px, min(34vw, 24dvh), 160px); font-weight: 600; line-height: 1; }
.hanzi[data-length="2"] { font-size: clamp(52px, min(26vw, 18dvh), 120px); }
.hanzi[data-length="3"] { font-size: clamp(40px, min(20vw, 14dvh), 92px); }
.hanzi-char { color: var(--radical-color, var(--ink)); }
.pinyin { z-index: 1; font-size: 26px; font-weight: 600; }
/* A word with the character, for a character two cards share: the character in ink, the rest softer. */
.front-cue { z-index: 1; margin-top: 12px; color: var(--ink-soft); font-family: "Noto Serif SC", serif; font-size: 20px; letter-spacing: .06em; }
.front-cue b { color: var(--ink); font-weight: 600; text-decoration: underline 2px var(--red); text-underline-offset: 5px; }
.flip-hint {
  position: absolute;
  bottom: 24px;
  z-index: 2;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--white);
  font-size: 12px;
  font-weight: 800;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .24s ease, transform .24s ease;
}
.flip-hint.is-tutorial-visible { opacity: 1; transform: none; }
.flashcard__back { flex-direction: column; transform: rotateY(180deg) translateZ(1px); }
.association { display: block; width: 100%; height: 54%; flex: 0 0 54%; min-height: 0; object-fit: contain; object-position: center; background: var(--muted); transition: opacity .12s ease; }
.association.is-loading,
.quiz-image.is-loading { opacity: 0; }
.back-copy { display: flex; flex: 1 1 auto; min-height: 0; flex-direction: column; align-items: center; justify-content: center; padding: 14px 18px; overflow: hidden; }
/* «Подробнее» sits at the card's foot: the meaning keeps clear of it. */
.flashcard.has-more .back-copy { padding-bottom: 50px; }
/* A new word's character, sound and meaning above it on a short screen: the picture gives way. */
@media (max-height: 700px) { .flashcard.has-more.is-intro .association { height: 44%; flex-basis: 44%; } }
.translation { margin: 4px 0 2px; max-width: 100%; font-size: clamp(20px, 5.6vw, 32px); font-weight: 800; letter-spacing: -.03em; line-height: 1.12; text-align: center; overflow-wrap: anywhere; }
.back-pinyin { color: var(--ink-soft); font-size: 15px; font-weight: 600; text-align: center; }
.back-hanzi { font-family: "Noto Serif SC", serif; font-weight: 700; }
/* A card met for the first time: the character and its sound first, big, then the meaning. */
.flashcard.is-intro .back-pinyin { order: -1; display: flex; flex-direction: column; align-items: center; margin-top: 6px; color: var(--ink-soft); font-size: 20px; }
.flashcard.is-intro .back-pinyin > [aria-hidden] { display: none; }
.flashcard.is-intro .back-hanzi { color: var(--ink); font-size: clamp(44px, min(16vw, 9dvh), 72px); font-weight: 600; line-height: 1.1; }
.flashcard.is-intro .back-hanzi[data-length="3"],
.flashcard.is-intro .back-hanzi[data-length="4"] { font-size: clamp(36px, min(12vw, 7dvh), 56px); }
.flashcard.is-intro .card-label { order: -2; }

.answer-area { height: 93px; padding-top: 13px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .2s ease, transform .2s ease; }
.answer-area.is-visible { opacity: 1; pointer-events: auto; transform: none; }
.answer-area p { margin: 0 0 8px; color: var(--ink-soft); text-align: center; font-size: 11px; font-weight: 700; }
.answer-buttons { gap: 10px; }
.answer-button { flex: 1; min-height: 48px; border: 0; border-radius: 16px; font-size: 14px; font-weight: 800; cursor: pointer; }
.answer-button span { margin-right: 4px; font-size: 20px; vertical-align: -1px; }
.answer-button--miss { background: var(--white); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.answer-button--miss span:first-child { color: var(--red); }
.answer-button--hit { background: var(--ink); color: var(--on-ink); }

.score-strip { justify-content: center; gap: 16px; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.score-player { display: grid; grid-template-columns: 28px auto auto; column-gap: 8px; align-items: center; }
.score-player .avatar { grid-row: 1; }
.score-player span:not(.avatar) { font-size: 12px; font-weight: 700; }
.score-player strong { font-size: 18px; line-height: 1; }

/* The whole screen scrolls (the list never squeezes between header and buttons); the buttons stay at the bottom. */
.result-screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  --result-pad: 20px;
  padding: max(22px, var(--safe-top)) var(--result-pad) 0;
}
.result-heading h1 { font-size: clamp(30px, 8vw, 38px); }
.result-screen > * { flex-shrink: 0; }
.result-score { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.result-score h1 { min-width: 0; }
.result-summary { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; margin: 20px 0 16px; }
.result-stat { padding: 15px 17px; border: 1px solid var(--line); border-radius: 20px; background: rgba(var(--glass-rgb), .72); }
.result-stat b { display: block; font-size: 34px; line-height: 1; letter-spacing: -.04em; }
.result-stat span { display: block; margin-top: 5px; color: var(--ink-soft); font-size: 10px; font-weight: 800; letter-spacing: .1em; }
.result-stat--hit b { color: var(--hit); }
.result-stat--miss b { color: var(--red-dark); }
.result-stat--new b { color: var(--growth-learning); }
.result-stages { display: grid; gap: 4px; margin: -4px 2px 14px; color: var(--ink-soft); font-size: 13px; line-height: 1.4; }
/* The bar behind the row fills to the level progress, like the home level chip. */
/* The first study day: tomorrow's first review, and when the bot should remind. */
.result-tomorrow { margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 18px; background: rgba(var(--glass-rgb), .66); }
.result-tomorrow h2 { margin: 0 0 4px; color: var(--ink); font-size: 15px; font-weight: 800; }
.result-tomorrow p { margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.4; }
.result-tomorrow__ask { display: grid; gap: 8px; margin-top: 10px; color: var(--ink); font-size: 13px; font-weight: 700; }
.result-tomorrow__times { display: flex; flex-wrap: wrap; gap: 6px; }
.result-tomorrow__times .chip { min-height: 36px; color: var(--ink); font-size: 13px; }
.result-tomorrow__times .chip.is-selected { color: var(--on-ink); }
/* Pro after a daily or new round: Bao with a speech bubble listing what Pro opens. */
.result-pro { display: grid; grid-template-columns: 74px minmax(0, 1fr); align-items: center; gap: 8px; margin: 0 0 14px; }
.result-pro[hidden] { display: none; }
.result-pro__bao { position: relative; height: 80px; background: url("assets/achievements/chapter_10.svg") center top / 74px 72px no-repeat; filter: drop-shadow(0 5px 8px rgba(23, 59, 54, .16)); }
.result-pro__bao span { position: absolute; bottom: 0; left: 50%; padding: 1px 6px; border-radius: 99px; background: var(--offer-gold); color: #5c3600; font-size: 8.5px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; transform: translateX(-50%); box-shadow: 0 2px 5px rgba(0, 0, 0, .12); }
.result-pro__bubble { position: relative; border: 1px solid var(--line); border-radius: 18px; background: var(--white); box-shadow: 0 8px 20px -12px rgba(23, 59, 54, .18); }
.result-pro__bubble::before { content: ""; position: absolute; top: 24px; left: -6px; width: 10px; height: 10px; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); background: var(--white); transform: rotate(45deg); }
.result-pro__open { width: 100%; display: grid; gap: 3px; padding: 11px 32px 11px 13px; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.result-pro__open > b { font-size: 13.5px; font-weight: 800; line-height: 1.24; }
.result-pro__perks { display: flex; flex-wrap: wrap; gap: 5px; margin: 3px 0 0; padding: 0; list-style: none; }
.result-pro__perks li { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; background: rgba(233, 169, 58, .14); font-size: 11.5px; font-weight: 700; line-height: 1.2; }
.result-pro__perks svg { flex: none; width: 12px; height: 12px; fill: none; stroke: #b07a16; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.result-pro__cta { justify-self: start; margin-top: 5px; padding: 5.5px 12px; border: 1px solid rgba(223, 85, 63, .22); border-radius: 999px; background: var(--tint-red); color: var(--red-dark); font-size: 12.5px; font-weight: 800; line-height: 1.15; }
.result-pro__close { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: none; color: var(--ink-soft); font-size: 18px; line-height: 1; cursor: pointer; }
:root[data-theme="dark"] .result-pro__bubble { border-color: rgba(229, 235, 217, .16); box-shadow: 0 8px 20px -12px rgba(0, 0, 0, .45); }
:root[data-theme="dark"] .result-pro__bubble::before { border-color: rgba(229, 235, 217, .16); }
:root[data-theme="dark"] .result-pro__perks li { background: rgba(240, 196, 92, .14); }
:root[data-theme="dark"] .result-pro__perks svg { stroke: #f3cf7a; }
:root[data-theme="dark"] .result-pro__cta { border-color: rgba(227, 138, 104, .3); background: rgba(227, 138, 104, .16); }
.result-xp { position: relative; isolation: isolate; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; overflow: hidden; margin: 0 0 14px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: rgba(var(--glass-rgb), .66); }
.result-xp::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(239,184,142,.45), rgba(223,85,63,.28)); transform-origin: left; transform: scaleX(var(--xp, 0)); transition: transform .5s cubic-bezier(.2,.75,.25,1); }
.result-xp b { color: var(--red-dark); font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.result-xp span { color: var(--ink-soft); font-size: 12px; font-weight: 700; text-align: right; }
.result-list { flex: 0 0 auto; margin: 0; padding: 0; }
.result-screen.is-tones .result-summary { display: none; }
.result-group ol { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.result-group__title { margin: 14px 4px 6px; color: var(--ink-soft); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.result-group:first-child .result-group__title { margin-top: 4px; }
.result-group.is-miss .result-group__title { color: var(--red); }
.result-group.is-new .result-group__title { color: var(--growth-learning); }
.result-group.is-hit .result-group__title { color: var(--hit); }
.result-item { display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--line); }
.result-item__open { display: flex; flex: 1; min-width: 0; align-items: center; gap: 12px; padding: 8px 4px; border: 0; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.result-item__open:hover { background: rgba(23,59,54,.04); }
/* One column for the characters, so every row's text starts at the same line. */
/* Longer words get smaller characters (--chars is the count) instead of wrapping. */
.result-hanzi { flex: none; width: 64px; color: var(--ink); font-family: "Noto Serif SC", serif; font-size: min(32px, 54px / var(--chars, 1)); font-weight: 700; line-height: 1.15; text-align: center; white-space: nowrap; }
.result-item__open:hover .result-hanzi, .result-item__open:focus-visible .result-hanzi { color: var(--red-dark); }
.result-word { display: grid; flex: 1; min-width: 0; gap: 2px; }
.result-pinyin { color: var(--ink); font-size: 15px; font-weight: 800; }
.result-item.is-miss .result-pinyin { color: var(--hit); }
.result-picked { margin-left: 4px; color: var(--red-dark); font-size: 13px; font-weight: 700; }
.result-translation { overflow: hidden; color: var(--ink-soft); font-size: 13px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.result-play { flex: none; display: grid; width: 36px; height: 36px; place-items: center; margin-right: 2px; padding: 0 0 0 2px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--ink); font-size: 12px; cursor: pointer; }
.result-play.is-playing { border-color: var(--hit); color: var(--hit); }
.result-home { display: flex; width: 100%; min-height: 56px; align-items: center; justify-content: center; gap: 10px; margin-top: 16px; border: 0; border-radius: 18px; background: var(--ink); color: var(--on-ink); font-size: 15px; font-weight: 800; cursor: pointer; }
.result-home span { font-size: 20px; }

.sheet-backdrop { position: absolute; z-index: 5; inset: 0; background: rgba(20,33,30,.33); backdrop-filter: blur(3px); }
.settings-sheet {
  position: absolute;
  z-index: 6;
  right: 0;
  bottom: 0;
  left: 0;
  max-height: calc(100% - 16px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 10px 20px max(18px, var(--safe-bottom));
  border-radius: 30px 30px 0 0;
  background: var(--white);
  box-shadow: 0 -20px 60px rgba(20,33,30,.18);
  transform: translateY(105%);
  transition: transform .38s cubic-bezier(.2,.8,.2,1);
}
.settings-sheet.is-open { transform: none; }
.sheet-handle { width: 38px; height: 4px; margin: 0 auto 17px; border-radius: 99px; background: #d5cdbf; }
.sheet-header { justify-content: space-between; margin-bottom: 22px; }
.close-button { background: var(--muted); font-size: 28px; font-weight: 400; }
fieldset { margin: 0 0 20px; padding: 0; border: 0; }
legend { margin-bottom: 10px; font-size: 13px; font-weight: 800; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
/* The glyph keeps one height across a row; the label centres in what is left, however many lines it takes. */
.segmented button { display: flex; flex-direction: column; justify-content: center; min-height: 92px; padding: 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); cursor: pointer; }
.segmented button strong { display: block; font-family: "Noto Serif SC", serif; font-size: 28px; }
/* Three ways to write: one row, labels may take two lines. */
#handwritingStyleControl { grid-template-columns: repeat(3, 1fr); gap: 7px; }
#handwritingStyleControl button { padding: 10px 6px; line-height: 1.2; }
/* Writing styles drawn on a small model; the chosen one shows its round frame by frame (app.js syncHandwritingPreview). */
.hw-pic { display: block; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.hw-pic svg { display: block; width: 100%; height: 100%; }
.hw-pic .hw-grid { fill: none; stroke: rgba(190,62,45,.28); stroke-width: 5; stroke-dasharray: 22 18; }
.hw-pic .hw-outline { fill: var(--ink); opacity: .2; }
.hw-pic .hw-ink { fill: var(--ink); }
.hw-pic .hw-next { fill: var(--red); }
#handwritingStyleControl .hw-pic { width: 56px; margin: 0 auto 6px; }
/* Practice's words: a pill in the header (level and topic) and the sheet it opens. */
.words-pill { display: flex; flex: 0 1 auto; align-items: center; gap: 5px; min-width: 0; max-width: 58%; margin-left: auto; padding: 3px 8px 3px 3px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.words-pill::after { content: "▾"; flex: none; color: var(--ink-soft); font-size: 10px; }
.words-pill .topic-glyph, .words-pill .deck-chip__glyph { display: grid; flex: none; width: 28px; height: 28px; margin: 0; place-items: center; border-radius: 50%; font-size: 15px; line-height: 1; }
.words-pill > span:last-of-type { display: grid; min-width: 0; line-height: 1.15; }
.words-pill b, .words-pill small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.words-pill b { font-size: 13.5px; }
.words-pill small { color: var(--ink-soft); font-size: 10px; font-weight: 700; }
/* Beside the pill a long title takes two lines rather than an ellipsis. */
#viewPlay .screen-header h2 { min-width: 0; overflow: visible; white-space: normal; text-overflow: clip; line-height: 1.1; }
.words-sheet { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; justify-content: flex-end; }
.words-sheet[hidden] { display: none; }
.words-sheet__scrim { position: absolute; inset: 0; background: rgba(20, 24, 22, .38); }
.words-sheet__panel { position: relative; max-height: 86%; overflow-y: auto; padding: 8px 16px max(16px, var(--safe-bottom)); border-radius: 24px 24px 0 0; background: var(--paper); box-shadow: 0 -10px 30px rgba(0,0,0,.16); animation: words-sheet-up .22s ease-out; }
@keyframes words-sheet-up { from { transform: translateY(40px); opacity: 0; } }
.words-sheet__grab { display: block; width: 40px; height: 4px; margin: 2px auto 12px; border-radius: 2px; background: var(--line); }
.words-sheet__panel > h2 { margin: 0 0 10px; font-size: 18px; }
.words-sheet__levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 14px; }
.words-sheet__levels .deck-menu__item { gap: 6px; min-height: 0; padding: 7px 8px; border: 1.5px solid var(--line); border-radius: 12px; background-color: var(--surface); font-size: 13px; }
.words-sheet__levels .deck-menu__item:first-child { grid-column: 1 / -1; min-height: 0; border-bottom: 1.5px solid var(--line); border-radius: 12px; }
.words-sheet__levels .deck-menu__item[aria-checked="true"] { border-color: var(--red); }
.words-sheet__levels .deck-menu__item::after { display: none; }
.words-sheet__levels .deck-menu__label { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.words-sheet__levels .deck-menu__percent { font-size: 10.5px; }
.words-sheet__levels .deck-chip__glyph { flex: none; width: 22px; height: 22px; font-size: 12px; }
.words-sheet__done { width: 100%; margin-top: 14px; }
.hw-preview { margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.hw-preview h3 { margin: 0 0 8px; font-size: 13px; font-weight: 800; }
.hw-film { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hw-film[data-frames="1"] { grid-template-columns: 1fr; max-width: 33%; }
.hw-film[data-frames="2"] { grid-template-columns: repeat(2, 1fr); max-width: 66%; }
.hw-film[data-frames="4"] { grid-template-columns: repeat(4, 1fr); }
.hw-film figure { display: grid; gap: 4px; margin: 0; text-align: center; }
.hw-film .hw-pic { width: 100%; max-width: 72px; margin: 0 auto; }
.hw-film figcaption { color: var(--ink-soft); font-size: 10.5px; font-weight: 700; line-height: 1.2; }
.hw-preview p { margin: 9px 0 0; color: var(--ink-soft); font-size: 12.5px; line-height: 1.4; }
.hw-preview .handwriting-auto-hint { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.segmented button span { display: flex; flex-grow: 1; align-items: center; justify-content: center; margin-top: 2px; font-size: 11px; font-weight: 700; }
.segmented button.is-selected { border-color: var(--red); background: var(--tint-red); box-shadow: inset 0 0 0 1px var(--red); }
.segmented--sm { grid-template-columns: 1fr 1fr; }
.segmented--sm button { min-height: 58px; }
.segmented--sm button strong { font-size: 22px; }
.timer-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.timer-options button { min-height: 44px; border: 1px solid var(--line); border-radius: 14px; background: transparent; font-size: 12px; font-weight: 700; cursor: pointer; }
.timer-options button.is-selected { border-color: var(--ink); background: var(--ink); color: var(--on-ink); }
/* Interface language: the current one opens the list of all (app.js languageOptionsInto); the tour shows the list open. */
.language-select { display: grid; gap: 8px; }
.language-select__current { display: flex; min-height: 44px; align-items: center; gap: 10px; padding: 0 14px; border: 1px solid var(--line); border-radius: 14px; background: transparent; color: var(--ink); font-size: 14px; font-weight: 700; text-align: start; cursor: pointer; }
.language-select__current > span:first-of-type { flex: 1; }
.language-select__chevron { color: var(--ink-soft); font-size: 16px; line-height: 1; transition: rotate .2s; }
.language-select__current[aria-expanded="true"] .language-select__chevron { rotate: 180deg; }
.language-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.language-list[hidden] { display: none; }
.language-option { display: flex; min-width: 0; min-height: 44px; align-items: center; gap: 9px; padding: 0 12px; border: 1px solid var(--line); border-radius: 14px; background: transparent; color: var(--ink); font-size: 13px; font-weight: 700; text-align: start; cursor: pointer; }
.language-option span { min-width: 0; line-height: 1.2; overflow-wrap: anywhere; }
.language-option.is-selected { border-color: var(--ink); background: var(--ink); color: var(--on-ink); }
.language-flag { width: 22px; height: 22px; flex: none; border-radius: 50%; box-shadow: 0 0 0 1px var(--line); }
.language-list--tour { width: min(340px, 100%); margin-top: 16px; }
.language-list--tour .language-option { background: var(--white); }
.language-list--tour .language-option.is-selected { background: var(--ink); }
/* In Telegram the tour has no language step: Bao's hello holds this menu at the header's end, its list dropping over the step. */
.language-menu { position: relative; z-index: 2; }
.language-menu[hidden] { display: none; }
.language-menu__current { display: flex; min-height: 44px; align-items: center; gap: 8px; padding: 0 12px 0 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); color: var(--ink); font-size: 13px; font-weight: 700; cursor: pointer; }
.language-menu__current[aria-expanded="true"] .language-select__chevron { rotate: 180deg; }
.language-menu__list { position: absolute; top: calc(100% + 8px); right: 0; width: min(320px, calc(100vw / var(--ui-zoom, 1) - 40px)); padding: 10px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: 0 18px 40px -22px rgba(41,73,59,.55); }
.language-menu__list .language-option { background: var(--white); }
.language-menu__list .language-option.is-selected { background: var(--ink); }
.start-button { display: flex; width: 100%; min-height: 56px; align-items: center; justify-content: center; padding: 0 20px; border: 0; border-radius: 18px; background: var(--red); color: var(--on-red); font-weight: 800; cursor: pointer; }
.start-button span { font-size: 15px; }
.toast { position: absolute; z-index: 9; bottom: 24px; left: 50%; padding: 10px 14px; border-radius: 12px; background: var(--ink); color: var(--on-ink); font-size: 12px; font-weight: 700; opacity: 0; transform: translate(-50%, 10px); transition: .2s ease; pointer-events: none; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

button:focus-visible { outline: 3px solid rgba(223,85,63,.38); outline-offset: 3px; }
button:active { transform: scale(.97); transition: transform .08s ease; }
.flashcard:active { transform: none; }

@media (max-height: 740px) {
  .menu-intro { margin-block: 20px 18px; }
  .topic-button { min-height: 105px; }
  .progress-row { margin-block: 10px; }
  .score-strip { margin-top: 4px; }
}
/* Phones of every width fill the screen; up to 599px there is no framed phone
   (a large phone with small display scaling is 470–480px wide). */
@media (min-width: 461px) {
  .game-screen, .result-screen, .menu-screen { height: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
@media (hover: hover) and (pointer: fine) {
  .icon-button:hover, .close-button:hover { background: rgba(23,59,54,.08); }
  .answer-button--hit:hover { background: #24564e; }
  .answer-button--miss:hover { background: var(--tint-red); }
  .start-button:hover { background: var(--red-dark); }
  .menu-primary:hover { background: var(--red-dark); }
  /* Neutral, so a hovered option never looks like a wrong answer. */
  .probe-option:not(:disabled):hover { border-color: var(--ink-soft); }
}

/* ================================================================== *
 * Learning product — new screens & components
 * ================================================================== */

.view { height: 100%; min-height: 0; }
.home-screen,
.collection-screen,
.detail-screen,
.confuse-screen {
  display: flex;
  flex-direction: column;
  padding: max(16px, var(--safe-top)) 20px max(24px, var(--safe-bottom));
}
.home-screen { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.collection-screen, .detail-screen, .confuse-screen { height: 100%; }

.topbar__actions { display: flex; align-items: center; gap: 2px; }
.brand { display: flex; align-items: center; gap: 9px; }
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: -.02em; }
/* "Bao HSK" is two words wider than "Baozi": on the narrowest phones the mark alone, so the level picker keeps its width. */
@media (max-width: 340px) { .topbar .brand-name { display: none; } }
/* Profile: the avatar on home, the row atop the settings, the head of the profile. */
.profile-button { display: grid; width: 44px; height: 44px; padding: 0; place-items: center; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.profile-avatar { position: relative; display: grid; flex: 0 0 auto; width: 30px; height: 30px; place-items: center; overflow: hidden; border-radius: 50%; background: var(--jade); color: var(--ink); font-size: 12px; font-weight: 800; box-shadow: 0 0 0 2px var(--white); }
.profile-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.profile-avatar--row { width: 44px; height: 44px; font-size: 17px; }
.profile-avatar--large { width: 72px; height: 72px; font-size: 28px; }
/* Pro: a slowly turning gold-and-red ring with a warm glow, a paper gap inside it. */
.profile-avatar.is-pro { --pro-ring: 2px; --pro-gap: 2px; overflow: visible; box-shadow: 0 0 0 var(--pro-gap) var(--white), 0 0 14px 3px rgba(240, 195, 90, .5); }
.profile-avatar.is-pro img { border-radius: 50%; }
.profile-avatar.is-pro::before { content: ""; position: absolute; inset: calc(-1 * (var(--pro-gap) + var(--pro-ring))); padding: var(--pro-ring); border-radius: 50%; background: conic-gradient(#f0c35a, #df553f, #c68a1c, #f7dc8a, #df553f, #f0c35a); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); animation: pro-ring 7s linear infinite; pointer-events: none; }
.profile-avatar--row.is-pro { --pro-ring: 2.5px; }
.profile-avatar--large.is-pro { --pro-ring: 3px; --pro-gap: 3px; box-shadow: 0 0 0 var(--pro-gap) var(--white), 0 0 22px 5px rgba(240, 195, 90, .45); }
@keyframes pro-ring { to { transform: rotate(1turn); } }
/* A "PRO" pill on the avatar's lower edge while Pro is on. */
.profile-avatar.is-pro::after { content: "PRO"; position: absolute; left: 50%; bottom: calc(-1 * var(--pro-pill-drop, 6px)); z-index: 1; padding: 1px 4px; border-radius: 99px; background: linear-gradient(120deg, #c42b2a, #e2452e 45%, #f0a43a); box-shadow: 0 0 0 1.5px var(--white), 0 2px 5px rgba(150, 40, 20, .35); color: #fff; font-size: var(--pro-pill-size, 7px); font-weight: 900; letter-spacing: .06em; line-height: 1.2; transform: translateX(-50%); pointer-events: none; }
.profile-avatar--row.is-pro { --pro-pill-size: 8px; --pro-pill-drop: 7px; }
.profile-avatar--large.is-pro { --pro-pill-size: 11px; --pro-pill-drop: 9px; margin-bottom: 8px; }
.profile-avatar--large.is-pro::after { padding: 2px 8px; box-shadow: 0 0 0 2px var(--white), 0 3px 8px rgba(150, 40, 20, .35); }
:root[data-theme="dark"] .profile-avatar.is-pro::after { box-shadow: 0 0 0 1.5px var(--paper), 0 2px 5px rgba(0, 0, 0, .4); }
@media (prefers-reduced-motion: reduce) { .profile-avatar.is-pro::before { animation: none; } }
/* Бао Супер (web/app.js renderProfile): an all-gold ring, a gold «SUPER» pill and a golden card's glints. Now and
   then one flares up on the ring, drifts slowly and fades; the next shows up elsewhere. Two per avatar on long,
   different periods, so most of the time there is none (Ivan, 2026-10-27; design/super-tier/avatar-glints.html). */
.profile-avatar.is-super { --pro-ring: 3px; --r: 19px; --sz: 22px; box-shadow: 0 0 0 var(--pro-gap) var(--white), 0 0 18px 5px rgba(240, 195, 90, .7); }
.profile-avatar--row.is-super { --r: 26px; --sz: 30px; }
.profile-avatar--large.is-super { --pro-ring: 4px; --r: 42px; --sz: 46px; box-shadow: 0 0 0 var(--pro-gap) var(--white), 0 0 28px 8px rgba(240, 195, 90, .6); }
.profile-avatar.is-super::before { background: conic-gradient(#fff4c8, #f0c35a, #b8801a, #f7dc8a, #fff4c8, #c9901f, #f0c35a, #fff4c8); animation-duration: 5s; }
.profile-avatar.is-super::after { content: "SUPER"; letter-spacing: .08em; background: linear-gradient(120deg, #f7dc8a, #f0c35a 45%, #c9901f); color: #8a1c14; }
.super-fx { position: absolute; inset: 0; z-index: 2; overflow: visible; border-radius: 50%; pointer-events: none; }
.profile-avatar:not(.is-super) .super-fx { display: none; }
.super-fx b { position: absolute; left: 50%; top: 50%; width: var(--sz); height: var(--sz); margin: calc(var(--sz) / -2); opacity: 0; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cdefs%3E%3CradialGradient id='h'%3E%3Cstop offset='0' stop-color='%23fff6d6' stop-opacity='.9'/%3E%3Cstop offset='.25' stop-color='%23f6c95a' stop-opacity='.45'/%3E%3Cstop offset='1' stop-color='%23f0b53a' stop-opacity='0'/%3E%3C/radialGradient%3E%3CradialGradient id='s'%3E%3Cstop offset='0' stop-color='%23fff'/%3E%3Cstop offset='.22' stop-color='%23fff8e0'/%3E%3Cstop offset='.55' stop-color='%23ffd977'/%3E%3Cstop offset='1' stop-color='%23d4851a'/%3E%3C/radialGradient%3E%3ClinearGradient id='fx' x1='0' x2='1'%3E%3Cstop offset='0' stop-color='%23ffe7a0' stop-opacity='0'/%3E%3Cstop offset='.5' stop-color='%23fffbe8'/%3E%3Cstop offset='1' stop-color='%23ffe7a0' stop-opacity='0'/%3E%3C/linearGradient%3E%3ClinearGradient id='fy' x1='0' x2='0' y1='0' y2='1'%3E%3Cstop offset='0' stop-color='%23ffe7a0' stop-opacity='0'/%3E%3Cstop offset='.5' stop-color='%23fffbe8'/%3E%3Cstop offset='1' stop-color='%23ffe7a0' stop-opacity='0'/%3E%3C/linearGradient%3E%3C/defs%3E%3Ccircle cx='50' cy='50' r='30' fill='url(%23h)'/%3E%3Crect x='0' y='49.3' width='100' height='1.4' rx='.7' fill='url(%23fx)'/%3E%3Crect x='49.3' y='6' width='1.4' height='88' rx='.7' fill='url(%23fy)'/%3E%3Cpath d='M50 35 C51.8 47 53 48.2 65 50 C53 51.8 51.8 53 50 65 C48.2 53 47 51.8 35 50 C47 48.2 48.2 47 50 35Z' fill='url(%23s)' transform='rotate(45 50 50)' opacity='.6'/%3E%3Cpath d='M50 22 C52 44 56 48 78 50 C56 52 52 56 50 78 C48 56 44 52 22 50 C44 48 48 44 50 22Z' fill='url(%23s)'/%3E%3Ccircle cx='50' cy='50' r='3.2' fill='%23fff'/%3E%3C/svg%3E") center / contain no-repeat;
  animation: super-glint 17s cubic-bezier(.45, .05, .55, .95) infinite; }
.super-fx b:nth-child(2) { --off: 160deg; animation-duration: 23s; animation-delay: -9s; }
/* One cycle: two glints about half a cycle apart, each ~2.5 s: grow, linger while drifting, fade. Transform and opacity only. */
@keyframes super-glint {
  0%    { opacity: 0; transform: rotate(calc(var(--off, 0deg) - 60deg)) translateX(var(--r)) rotate(calc(60deg - var(--off, 0deg))) scale(.15); }
  4%    { opacity: 1; transform: rotate(calc(var(--off, 0deg) - 56deg)) translateX(var(--r)) rotate(calc(70deg - var(--off, 0deg))) scale(1); }
  9%    { opacity: .85; transform: rotate(calc(var(--off, 0deg) - 49deg)) translateX(calc(var(--r) + 1px)) rotate(calc(86deg - var(--off, 0deg))) scale(.8); }
  15%   { opacity: 0; transform: rotate(calc(var(--off, 0deg) - 42deg)) translateX(calc(var(--r) + 2px)) rotate(calc(100deg - var(--off, 0deg))) scale(.3); }
  50%   { opacity: 0; transform: rotate(calc(var(--off, 0deg) + 125deg)) translateX(var(--r)) rotate(calc(-125deg - var(--off, 0deg))) scale(.15); }
  54%   { opacity: 1; transform: rotate(calc(var(--off, 0deg) + 129deg)) translateX(var(--r)) rotate(calc(-115deg - var(--off, 0deg))) scale(.9); }
  59%   { opacity: .85; transform: rotate(calc(var(--off, 0deg) + 136deg)) translateX(calc(var(--r) + 1px)) rotate(calc(-99deg - var(--off, 0deg))) scale(.75); }
  65%   { opacity: 0; transform: rotate(calc(var(--off, 0deg) + 143deg)) translateX(calc(var(--r) + 2px)) rotate(calc(-85deg - var(--off, 0deg))) scale(.3); }
  100%  { opacity: 0; transform: rotate(calc(var(--off, 0deg) + 300deg)) translateX(var(--r)) rotate(calc(-300deg - var(--off, 0deg))) scale(.15); }
}
@media (prefers-reduced-motion: reduce) { .super-fx b { display: none; } }
.profile-row { display: flex; width: 100%; align-items: center; gap: 12px; margin: 0 0 20px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; }
.profile-row__text { display: grid; flex: 1; min-width: 0; gap: 2px; }
.profile-row__text b { overflow: hidden; font-size: 15px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.profile-row__text small { color: var(--ink-soft); font-size: 12px; }
.profile-row .card-chevron { color: var(--ink-soft); font-size: 20px; }
.profile-head { display: grid; justify-items: center; gap: 6px; margin: 4px 0 22px; text-align: center; }
.profile-head__name { max-width: 100%; overflow: hidden; font-size: 19px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.profile-head__since { color: var(--ink-soft); font-size: 13px; font-weight: 600; }
.profile-head__since:empty { display: none; }
.profile-delete { margin-top: 6px; border-top: 1px solid var(--line); }
.profile-support { margin-top: 6px; border-top: 1px solid var(--line); color: var(--ink-soft); }
/* The profile's Pro banner: the plans, or until when Pro runs. */
.pro-banner { position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: center; gap: 14px; width: 100%; margin: 0 0 10px; padding: 16px 14px; border: 0; border-radius: 20px; background: radial-gradient(120% 140% at 100% 0%, rgba(255, 211, 107, .32), transparent 55%), linear-gradient(135deg, #173b36 0%, #1f574b 55%, #2c7558 100%); color: #fff; font: inherit; text-align: left; cursor: pointer; box-shadow: 0 12px 26px rgba(23, 59, 54, .28), inset 0 1px 0 rgba(255, 255, 255, .18); }
.pro-banner::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(circle at 93% 84%, var(--offer-gold) 0 2px, transparent 3px),
    radial-gradient(circle at 74% 10%, rgba(255, 255, 255, .7) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 97% 46%, var(--offer-gold-soft) 0 1.6px, transparent 2.6px),
    radial-gradient(circle at 24% 92%, rgba(255, 255, 255, .5) 0 1.4px, transparent 2.4px); }
.pro-banner__seal { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: radial-gradient(circle at 35% 30%, #fff6d6, var(--offer-gold) 72%); color: var(--red-dark); font-family: "Noto Serif SC", serif; font-size: 28px; font-weight: 700; box-shadow: 0 6px 14px rgba(0, 0, 0, .25), inset 0 0 0 3px rgba(255, 255, 255, .5); transform: rotate(-6deg); }
.pro-banner__copy { min-width: 0; display: grid; gap: 3px; }
.pro-banner__kicker { color: var(--offer-gold-soft); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.pro-banner__title { font-size: 17px; font-weight: 800; line-height: 1.2; }
/* «Потом — Про до …»: the Pro that Super paused. */
.pro-banner__after { color: rgba(255, 255, 255, .8); font-size: 12px; font-weight: 700; }
.pro-banner__after[hidden] { display: none; }
.pro-banner__cta { margin-top: 2px; color: rgba(255, 255, 255, .88); font-size: 13px; font-weight: 700; }
.pro-banner__offer { position: absolute; top: 10px; right: 10px; padding: 3px 9px; border-radius: 99px; background: var(--offer-gradient); color: #fff; font-size: 12px; font-weight: 900; box-shadow: 0 4px 10px rgba(206, 64, 38, .35); }
.pro-banner__offer[hidden] { display: none; }
/* Documents: small links at the very bottom of the settings. */
.legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin: 26px 0 4px; padding-top: 16px; border-top: 1px solid var(--line); }
.legal-links a { color: var(--ink-soft); font-size: 11px; font-weight: 600; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.legal-links a[hidden] { display: none; }

/* --- home --- */
/* Deck picker: the HSK level being studied. Everything below follows it. */
.deck-picker { margin: 2px 0 6px; }
.deck-picker { position: relative; flex: 1; display: flex; justify-content: center; min-width: 0; }
.deck-select { display: flex; align-items: center; gap: 7px; max-width: 100%; padding: 5px 10px 5px 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; }
.deck-select::after { content: "▾"; color: var(--ink-soft); font-size: 12px; }
.deck-select b { overflow: hidden; font-size: 14px; white-space: nowrap; text-overflow: ellipsis; }
.deck-select small { display: none; }
.deck-select__glyphs { display: flex; flex: none; }
.deck-select__glyphs .deck-chip__glyph { width: 26px; height: 26px; font-size: 14px; }
.deck-select__glyphs .deck-chip__glyph + .deck-chip__glyph { margin-left: -9px; box-shadow: 0 0 0 2px var(--surface); }
.deck-menu { position: absolute; top: 100%; left: 50%; z-index: 30; display: grid; width: min(300px, calc(100vw / var(--ui-zoom, 1) - 32px)); margin-top: 8px; padding: 6px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 14px 34px rgba(0,0,0,.18); transform: translateX(-50%); }
.deck-menu__item { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border: 0; border-radius: 12px; background: none; color: var(--ink); font: inherit; font-size: 14px; font-weight: 700; text-align: left; cursor: pointer; }
.deck-menu__item:first-child { min-height: 46px; border-bottom: 1px solid var(--line); border-radius: 12px 12px 0 0; }
.deck-select[class*="deck-fill--"] { background: linear-gradient(to right, var(--deck-tint) var(--fill, 0%), var(--surface) var(--fill, 0%)); }
.deck-fill--mixed { --deck-tint: rgba(var(--jade-rgb), .55); }
.deck-menu__percent { margin-left: auto; color: var(--ink-soft); font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.deck-menu__item::after { content: ""; flex: none; width: 16px; margin-left: 4px; text-align: center; }
.deck-menu__item[aria-checked="true"]::after { content: "✓"; margin-left: 4px !important; }
.deck-menu__item .pro-badge { margin-left: 6px !important; }
.deck-menu__item[class*="deck-fill--"] { background: linear-gradient(to right, var(--deck-tint) var(--fill, 0%), transparent var(--fill, 0%)); }
.deck-fill--coral { --deck-tint: rgba(242, 199, 187, .55); }
.deck-fill--gold { --deck-tint: rgba(239, 219, 172, .6); }
.deck-fill--green { --deck-tint: rgba(201, 221, 202, .65); }
.deck-fill--blue { --deck-tint: rgba(197, 219, 225, .65); }
.deck-fill--violet { --deck-tint: rgba(218, 208, 226, .65); }
.deck-fill--rose { --deck-tint: rgba(230, 198, 207, .6); }
.deck-fill--clay { --deck-tint: rgba(221, 201, 172, .65); }
.deck-fill--teal { --deck-tint: rgba(190, 224, 220, .65); }
.deck-fill--ink { --deck-tint: rgba(203, 211, 204, .7); }

.deck-select__glyphs .deck-select__more { width: auto; min-width: 26px; margin-left: 3px !important; padding: 0 5px; border-radius: 999px; background: var(--line); box-shadow: none !important; color: var(--ink-soft); font-family: inherit; font-size: 11px; font-weight: 800; }
.deck-menu__item[aria-checked="true"]::after { content: "✓"; margin-left: auto; font-weight: 800; }
.deck-menu__item:disabled { opacity: .45; cursor: default; }
.deck-menu__item .pro-badge { margin-left: auto; }
.deck-picker__row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; margin-top: 7px; }
.deck-chip { display: grid; justify-items: center; gap: 3px; padding: 8px 3px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink); cursor: pointer; }
.deck-chip__glyph { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 50% 50% 11px 50%; font-family: "Noto Serif SC", serif; font-size: 15px; font-weight: 700; }
.deck-chip--coral .deck-chip__glyph, .deck-chip__glyph.deck-chip--coral { background: #f2c7bb; color: #9f3e2f; }
.deck-chip--gold .deck-chip__glyph, .deck-chip__glyph.deck-chip--gold { background: #efdbac; color: #805b17; }
.deck-chip--green .deck-chip__glyph, .deck-chip__glyph.deck-chip--green { background: #c9ddca; color: #2f6659; }
.deck-chip--blue .deck-chip__glyph, .deck-chip__glyph.deck-chip--blue { background: #c5dbe1; color: #326576; }
.deck-chip--violet .deck-chip__glyph, .deck-chip__glyph.deck-chip--violet { background: #dad0e2; color: #634f75; }
.deck-chip--rose .deck-chip__glyph, .deck-chip__glyph.deck-chip--rose { background: #e6c6cf; color: #8f4a5e; }
.deck-chip--clay .deck-chip__glyph, .deck-chip__glyph.deck-chip--clay { background: #ddc9ac; color: #7a5230; }
.deck-chip--teal .deck-chip__glyph, .deck-chip__glyph.deck-chip--teal { background: #bee0dc; color: #1f6a64; }
.deck-chip--ink .deck-chip__glyph, .deck-chip__glyph.deck-chip--ink { background: #cbd3cc; color: #294c46; }
.deck-chip b { font-size: 11px; }
.deck-chip small { color: var(--ink-soft); font-size: 10px; }
.deck-chip.is-selected { border-color: var(--ink); background: var(--ink); color: var(--on-ink); }
.deck-chip.is-selected small { color: var(--on-ink); opacity: .72; }
.deck-chip:disabled { opacity: .4; cursor: default; }
.home-hero { text-align: center; margin: 4px 0 10px; }
.mascot-slot { display: grid; place-items: center; }
/* The card in Bao's paw opens its character (app.js mascotInto); the hit area reaches past the small card. */
.mascot-slot:has(> .mascot-card) { position: relative; }
.mascot-card { position: absolute; padding: 0; border: 0; border-radius: 14%; background: transparent; cursor: pointer; rotate: 5.5deg; -webkit-tap-highlight-color: transparent; }
.mascot-card::before { content: ""; position: absolute; inset: -8px; }
.mascot-slot .mascot { transition: scale .12s ease-out; }
.mascot-slot:has(> .mascot-card:active) .mascot { scale: .95; }
.mascot-slot--hero { width: 100px; height: 100px; margin: 0 auto 2px; }
.mascot-slot--overlay { width: 118px; height: 118px; margin: 0 auto 6px; }
/*
 * Achievement stickers standing in for Bao (unlock modal, onboarding). They
 * move like Bao in the trailer: drop in, squash on landing, then breathe.
 * `translate`/`scale` animate while `rotate` keeps each sticker's tilt.
 */
.sticker-stack { position: relative; display: flex; justify-content: center; align-items: center; --sticker: 148px; }
.sticker-stack[data-count="2"] { --sticker: 118px; }
.sticker-stack[data-count="3"] { --sticker: 110px; }
.mascot-slot--overlay.sticker-stack { width: auto; height: 136px; }
/*
 * Animated stickers carry a drop shadow. While a transform animates, the
 * browser draws the sticker as its own layer clipped to its box, so a shadow
 * reaching past the box shows straight edges. --pad gives the shadow room
 * inside the box; the matching negative margin keeps the visible size.
 */
.sticker { --pad: 22px; position: relative; display: block; box-sizing: content-box; width: var(--sticker); height: 100%; margin: calc(var(--pad) * -1); padding: var(--pad); object-fit: contain; filter: drop-shadow(0 8px 12px rgba(37,45,34,.2)); transform-origin: 50% 90%; rotate: var(--tilt, 0deg); animation: sticker-land .7s var(--delay, 0s) both, sticker-breathe 2.8s ease-in-out calc(var(--delay, 0s) + .7s) infinite; }
.sticker + .sticker { margin-left: calc(var(--sticker) * -.16 - var(--pad)); }
.sticker > img, .achievement__art > img { display: block; width: 100%; height: 100%; object-fit: contain; }
.sticker:nth-of-type(1) { --tilt: -4deg; }
.sticker:nth-of-type(2) { --tilt: 3deg; --delay: .12s; }
.sticker:nth-of-type(3) { --tilt: -2deg; --delay: .24s; }
.sticker:only-of-type { --tilt: 0deg; }
.sticker-spark { position: absolute; left: var(--x); top: var(--y); width: var(--s, 14px); height: var(--s, 14px); background: #ffc93c; clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); opacity: 0; animation: sticker-spark 2.4s var(--spark-delay, .5s) ease-in-out infinite; pointer-events: none; }
@keyframes sticker-land {
  0% { opacity: 0; translate: 0 -48px; scale: .72; }
  42% { opacity: 1; translate: 0 0; scale: .95 1.07; }
  60% { scale: 1.12 .86; }
  78% { scale: .96 1.05; }
  100% { translate: 0 0; scale: 1; }
}
@keyframes sticker-breathe { 0%, 100% { translate: 0 0; scale: 1; } 50% { translate: 0 -3px; scale: 1.014 .986; } }
@keyframes sticker-spark { 0%, 100% { opacity: 0; scale: .2; rotate: 0deg; } 30% { opacity: 1; scale: 1; } 60% { opacity: 0; scale: .4; rotate: 90deg; } }
/* A tap on an earned sticker makes it hop. */
@keyframes sticker-hop {
  0% { translate: 0 0; scale: 1; }
  15% { scale: 1.08 .9; }
  45% { translate: 0 -16px; scale: .95 1.06; }
  72% { translate: 0 0; scale: 1.1 .88; }
  86% { scale: .97 1.03; }
  100% { translate: 0 0; scale: 1; }
}
@media (prefers-reduced-motion: reduce) { .sticker, .sticker-spark { animation: none; } .sticker-spark { display: none; } }
.mascot { width: 100%; height: 100%; object-fit: contain; }
.mascot--idle { animation: mascot-bob 3.4s ease-in-out infinite; }
.mascot--celebrating { animation: mascot-pop .6s ease-out; }
.mascot--watering { animation: mascot-tilt 1.6s ease-in-out infinite; }
/* A scene from mascot-motion.js moves the parts; the loops above wait for it. */
.mascot.is-acting { animation: none; overflow: visible; }
.mascot [data-part], .mascot .bao-shadow { pointer-events: none; }
@keyframes mascot-bob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-3px) } }
@keyframes mascot-pop { 0% { transform: scale(.9) } 60% { transform: scale(1.06) } 100% { transform: scale(1) } }
@keyframes mascot-tilt { 0%,100% { transform: rotate(-3deg) } 50% { transform: rotate(3deg) } }
/* Bao's face (mascot.js): every Bao blinks on its own rhythm. */
.mascot .bao-eye { transform-box: fill-box; transform-origin: center; animation: bao-blink 4.4s var(--blink-delay, 0s) infinite; }
@keyframes bao-blink { 0%, 93%, 100% { transform: scaleY(1) } 95.5% { transform: scaleY(.08) } }

.streak-chip { display: inline-block; margin: 0 0 4px; padding: 4px 10px; border-radius: 999px; background: var(--tint-red); color: var(--red-dark); font-size: 11px; font-weight: 800; }
.home-next { color: var(--green-ink); font-weight: 700; }
.home-next:not(:empty)::before { content: " · "; color: var(--ink-soft); font-weight: 600; }

.progress-track { height: 8px; overflow: hidden; border-radius: 99px; background: rgba(23,59,54,.11); }
.progress-track > span { display: block; width: 100%; height: 100%; border-radius: inherit; background: var(--red); transform-origin: left; transform: scaleX(0); transition: transform .5s cubic-bezier(.2,.75,.25,1); }
.progress-track--lg { height: 9px; }

.today-card { position: relative; padding: 14px; margin-bottom: 8px; border-radius: 22px 22px 38px 22px; background: var(--strong); color: var(--on-strong); box-shadow: 0 16px 40px rgba(23,59,54,.16); }
.today-card .menu-kicker { color: #e7a89b; }
.today-card h2 { margin: 3px 0; color: white; font-size: 20px; }
.today-sub { margin: 0 0 10px; color: rgba(255,255,255,.72); font-size: 11px; font-weight: 600; }
.menu-primary { display: flex; width: 100%; min-height: 44px; align-items: center; justify-content: center; gap: 10px; padding: 0 18px; border: 0; border-radius: 15px; background: var(--red); color: var(--on-red); font-size: 14px; font-weight: 800; text-align: center; cursor: pointer; }
.menu-primary span { font-size: inherit; }
.menu-primary:disabled, .menu-primary:disabled:hover { background: var(--muted); color: var(--ink-soft); cursor: default; }
#tutorialNext { transition: background .2s ease, color .2s ease; }
.menu-secondary { display: flex; width: 100%; min-height: 42px; align-items: center; justify-content: center; gap: 8px; margin-top: 6px; border: 1px solid var(--line); border-radius: 14px; background: rgba(var(--glass-rgb), .6); color: var(--ink); font-size: 13px; font-weight: 800; text-align: center; cursor: pointer; }


.save-warning { margin: 0 0 8px; padding: 10px 12px; border: 1px solid var(--red); border-radius: 14px; background: var(--tint-red, #fbe9e4); color: var(--ink); font-size: 12px; font-weight: 700; line-height: 1.35; }
.save-warning .link-button { display: inline; margin-left: 4px; }
/* The welcome offer: half off for a day after onboarding, with its countdown. */
:root {
  --offer-gradient: radial-gradient(130% 160% at 0% 0%, rgba(255, 140, 80, .55) 0%, transparent 52%), linear-gradient(118deg, #c42b2a 0%, #e2452e 42%, #f2792d 100%);
  --offer-gold: #ffd36b;
  --offer-gold-soft: #ffe7a6;
  --offer-ink: #9e1f1a;
}
.welcome-offer { position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: center; margin: 0 0 12px; border-radius: 20px; background: var(--offer-gradient); color: #fff; box-shadow: 0 12px 26px rgba(206, 64, 38, .32), inset 0 1px 0 rgba(255, 255, 255, .28); }
.welcome-offer[hidden] { display: none; }
/* Confetti specks and a slow shine across the card. */
.welcome-offer::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .9;
  background:
    radial-gradient(circle at 88% 22%, var(--offer-gold) 0 2.5px, transparent 3.5px),
    radial-gradient(circle at 74% 78%, rgba(255, 255, 255, .85) 0 2px, transparent 3px),
    radial-gradient(circle at 96% 64%, var(--offer-gold-soft) 0 1.8px, transparent 2.8px),
    radial-gradient(circle at 58% 16%, rgba(255, 255, 255, .6) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 30% 92%, var(--offer-gold) 0 1.8px, transparent 2.8px),
    radial-gradient(120% 90% at 105% 110%, rgba(255, 211, 107, .45), transparent 55%); }
.welcome-offer::after { content: ""; position: absolute; top: 0; bottom: 0; left: -60%; z-index: -1; width: 45%; pointer-events: none; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .28), transparent); transform: skewX(-18deg); animation: offer-shine 5.5s ease-in-out 1.2s infinite; }
@keyframes offer-shine { 0% { left: -60%; } 38%, 100% { left: 130%; } }
.welcome-offer__open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 12px 4px 12px 12px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.welcome-offer__badge { flex: none; display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6d6, var(--offer-gold) 70%); color: var(--offer-ink); font-size: 17px; font-weight: 900; letter-spacing: -.02em; box-shadow: 0 6px 14px rgba(120, 20, 10, .3), inset 0 0 0 3px rgba(255, 255, 255, .55), inset 0 0 0 5px rgba(158, 31, 26, .18); transform: rotate(-10deg); animation: offer-badge 3.2s ease-in-out infinite; }
/* "до −50%": the comeback offer's "up to" goes on its own line over the share. */
.welcome-offer__badge.is-upto { font-size: 14px; line-height: 1.05; text-align: center; }
@keyframes offer-badge { 0%, 100% { transform: rotate(-10deg) scale(1); } 50% { transform: rotate(-4deg) scale(1.06); } }
.welcome-offer__copy { min-width: 0; display: grid; gap: 3px; }
.welcome-offer__kicker { color: var(--offer-gold-soft); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.welcome-offer__title { font-size: 17px; font-weight: 800; line-height: 1.15; text-shadow: 0 1px 2px rgba(120, 20, 10, .25); }
.welcome-offer__ends { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 3px; font-size: 12px; font-weight: 700; color: rgba(255, 255, 255, .92); }
.welcome-offer__close { position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(90, 10, 5, .18); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }
/* The countdown in tiles: 23 : 41 : 07 */
.offer-clock { display: inline-flex; align-items: center; gap: 3px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.offer-clock i { min-width: 26px; padding: 3px 4px; border-radius: 7px; background: rgba(70, 8, 4, .32); box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .12); color: #fff; font-size: 13px; font-style: normal; font-weight: 800; text-align: center; }
.offer-clock em { font-style: normal; font-weight: 800; opacity: .85; }
.paywall-offer { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; margin: 0 0 12px; padding: 10px 12px; border-radius: 14px; background: var(--offer-gradient); color: #fff; font-size: 14px; font-weight: 800; box-shadow: 0 8px 18px rgba(206, 64, 38, .28); }
.paywall-offer[hidden] { display: none; }
/* When a used-up free allowance comes back: "New rounds in 5 h 12 min". */
.paywall-reset { display: flex; width: fit-content; align-items: center; gap: 7px; margin: -2px auto 12px; padding: 6px 12px; border-radius: 99px; background: rgba(223, 85, 63, .1); color: var(--red-dark); font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.paywall-reset svg { flex: none; }
.plan-option__old { color: var(--ink-soft); font-size: 11px; font-weight: 700; text-decoration-color: var(--red); text-decoration-thickness: 2px; }
.plan-option__old[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .welcome-offer::after, .welcome-offer__badge { animation: none; } }
.link-button { padding: 4px 2px; border: 0; background: none; color: var(--red-dark); font-size: 12px; font-weight: 800; cursor: pointer; }

/* --- session --- */
.session-progress { flex: 1; height: 5px; margin: 0 12px; overflow: hidden; border-radius: 99px; background: rgba(23,59,54,.11); }
.session-progress > span { display: block; width: 100%; height: 100%; border-radius: inherit; background: var(--red); transform-origin: left; transform: scaleX(0); transition: transform .35s ease-out; }
.session-counter { color: var(--ink-soft); font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; }
.card-tags { position: absolute; top: 16px; left: 50%; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: calc(100% - 144px); transform: translateX(-50%); pointer-events: none; }
.card-tag { max-width: 100%; overflow: hidden; padding: 4px 12px; border-radius: 999px; background: rgba(223,85,63,.12); color: var(--red-dark); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.card-growth { padding: 3px 10px; border-radius: 999px; background: rgba(23,59,54,.08); color: var(--ink-soft); font-size: 11px; font-weight: 800; white-space: nowrap; }
.card-tag[hidden], .card-growth[hidden] { display: none; }
/* The level chip sits at the card's top edge; the tags drop below it instead of overlapping. */
.card-stage.has-level .card-tags { top: 46px; }
.mnemonic { margin-top: 8px; color: var(--ink-soft); font-size: 12px; line-height: 1.4; text-align: center; }

.session-actions { display: flex; gap: 10px; height: 74px; align-items: center; }
.session-actions.is-waiting { visibility: hidden; }
.reveal-actions { display: flex; height: 74px; align-items: center; }
.reveal-continue { display: block; width: 100%; min-height: 52px; border: 0; border-radius: 16px; background: var(--ink); color: var(--on-ink); font-size: 15px; font-weight: 800; cursor: pointer; }

.probe { position: absolute; z-index: 5; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 22px; border-radius: 30px 30px 68px 30px; background: var(--white); box-shadow: var(--shadow); }
.cant-listen { display: block; margin: 6px auto 0; font-size: 13px; }
.probe__title { margin: 0; color: var(--red-dark); font-size: 10px; font-weight: 800; letter-spacing: .16em; text-align: center; text-transform: uppercase; }
/* Taking over from a flashcard, the question panel eases in instead of popping. */
.probe.is-entering { animation: probe-enter .38s cubic-bezier(.2, .8, .2, 1) both; }
.probe.is-entering .probe__title { animation: probe-title .5s .12s cubic-bezier(.3, 1.5, .5, 1) both; }
@keyframes probe-enter { from { opacity: 0; transform: translateY(22px) scale(.97); } }
@keyframes probe-title { from { opacity: 0; transform: scale(.6); } }
@media (prefers-reduced-motion: reduce) { .probe.is-entering, .probe.is-entering .probe__title { animation: none; } }
.probe__question { margin: 0 0 6px; font-size: 20px; font-weight: 800; line-height: 1.2; text-align: center; }
.probe__options { display: grid; gap: 9px; }
.format-meaning { margin: 4px 0 2px; font-size: 18px; font-weight: 800; text-align: center; }
.order { gap: 14px; }
.order__built { display: flex; flex-wrap: wrap; gap: 8px; min-height: 58px; padding: 8px; border: 2px dashed var(--line); border-radius: 16px; }
.order__built.is-correct { border-style: solid; border-color: var(--green); background: var(--tint-green); }
.order__built.is-wrong { border-style: solid; border-color: var(--red); background: var(--tint-red); }
.order__pool { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.order__tile { min-width: 48px; min-height: 44px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font: 700 24px "Noto Serif SC", serif; cursor: pointer; }
.order__tile:disabled { cursor: default; }
.order__check { margin-top: 4px; }
.order__tile.is-off { border-color: var(--red); color: var(--red-dark); }
span.order__tile { display: inline-flex; align-items: center; cursor: default; }
.order__tile.word-tap { cursor: pointer; }
.order__tile.word-tap.is-open { border-color: var(--red); background: var(--tint-red, #fbe9e4); }
/* Pinyin: the tiles are readings, in the Latin face. */
.order--pinyin .order__tile { min-width: 44px; padding: 6px 12px; font: 700 19px "Manrope", system-ui, sans-serif; }
.quiz-feedback.is-order .quiz-translation { color: var(--ink-soft); font-size: 14px; font-weight: 600; }
.probe-option { min-height: 54px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); font-size: 16px; font-weight: 700; cursor: pointer; transition: transform .08s ease; }
.probe-option--pinyin { font-size: 22px; letter-spacing: .02em; }
/* The option a finger is on, answered when it lifts (option-slide.js). */
.probe-option.is-held { border-color: var(--ink); background: var(--paper-deep); box-shadow: inset 0 0 0 1px var(--ink); transform: scale(.97); }

/* --- result extras --- */
.result-breakdown { margin: 0 0 14px; padding: 14px 16px; border-radius: 16px; background: rgba(var(--jade-rgb), .4); font-size: 13px; font-weight: 700; }
.result-breakdown p { margin: 2px 0; }

/* --- collection --- */
.garden-scope { position: relative; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.garden-decks { padding: 3px 9px; border: 0; border-radius: 999px; background: var(--red); color: #fff; font: inherit; font-size: 11px; font-weight: 800; white-space: nowrap; cursor: pointer; }
.garden-decks::after { content: " ▾"; opacity: .8; }
.garden-deck-menu { position: absolute; top: 100%; right: 0; z-index: 20; display: grid; min-width: 170px; margin-top: 6px; padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 12px 30px rgba(0,0,0,.18); }
/* HSK 2 and up coming down (app.js levelsProgress): a bar under the level buttons, atop the level menus, and at the top of the screen while a tap waits for them. */
.levels-loading .deck-select, .levels-loading .garden-decks { position: relative; }
.levels-loading .deck-select::before, .levels-loading .garden-decks::before, .levels-loading .deck-menu::before, .levels-loading .garden-deck-menu::before, .levels-waiting body::before {
  content: ""; height: 3px; border-radius: 2px; pointer-events: none;
  background: linear-gradient(to right, var(--red) calc(var(--levels-loaded, 0) * 100%), var(--line) 0);
}
.levels-loading .deck-select::before, .levels-loading .garden-decks::before { position: absolute; left: 14px; right: 14px; bottom: -6px; }
.levels-loading .garden-decks::before { left: 8px; right: 8px; }
.levels-loading .deck-menu::before, .levels-loading .garden-deck-menu::before { margin: 4px 10px 6px; }
.levels-waiting body::before { position: fixed; top: 0; left: 0; right: 0; z-index: 1000; border-radius: 0; }
.garden-deck-menu__item { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border: 0; border-radius: 10px; background: none; color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; text-align: left; cursor: pointer; }
.garden-deck-menu__item:first-child { border-bottom: 1px solid var(--line); border-radius: 10px 10px 0 0; }
.garden-deck-menu__box { display: grid; width: 18px; height: 18px; place-items: center; border: 1.5px solid var(--line); border-radius: 5px; font-size: 12px; }
.garden-deck-menu__item[aria-checked="true"] .garden-deck-menu__box { border-color: var(--ink); background: var(--ink); color: var(--on-ink); }
.collection-count { color: var(--ink-soft); font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
/* The print button sits left of the count and deck picker. */
.garden-actions { display: flex; align-items: center; gap: 2px; }
.garden-print { color: var(--ink); }
/* Все · Этап ▾ · Тема ▾ · Избранное: one row, menus under their pill. */
.selection-picker { position: relative; display: inline-flex; }
.selection-pill { display: inline-flex; align-items: center; gap: 5px; color: var(--ink); }
.selection-pill svg { flex: 0 0 auto; }
.selection-pill--icon { padding-inline: 11px; }

.selection-pill__chevron { margin-right: -3px; opacity: .75; transition: transform .15s ease; }
.selection-picker.is-open .selection-pill__chevron { transform: rotate(180deg); }
.selection-menu { left: 0; right: auto; min-width: 220px; max-width: min(300px, calc(100vw / var(--ui-zoom, 1) - 32px)); max-height: min(calc(52vh / var(--ui-zoom, 1)), 420px); overflow-y: auto; overscroll-behavior: contain; grid-auto-rows: max-content; }
.selection-menu .selection-menu__item, .selection-menu .selection-menu__item:first-child { border-bottom: 0; border-radius: 10px; }
.selection-menu__item[aria-checked="true"] { background: rgba(23,59,54,.06); }
.selection-menu__tick { border-radius: 50%; }
.selection-menu__glyph { display: grid; flex: 0 0 auto; width: 28px; height: 28px; place-items: center; border-radius: 50%; background: rgba(23,59,54,.08); font-size: 15px; font-weight: 600; }
.selection-menu__item[aria-checked="true"] .selection-menu__glyph { background: var(--ink); color: var(--on-ink); }
.selection-menu__label { flex: 1; }
.selection-menu__count { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.selection-menu__heading { margin: 8px 8px 2px; color: var(--ink-soft); font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.selection-menu__heading:first-child { margin-top: 2px; }
/* Display and sort sit in one icon pill at the end of the row, dashed and tinted so it reads as a different kind of control than the filters. */
.garden-settings { margin-left: auto; }
.settings-pill { border: 1.5px dashed rgba(23,59,54,.55); background: rgba(23,59,54,.07); }
.settings-pill.is-changed { border: 1.5px solid var(--ink); background: rgba(23,59,54,.16); }
.garden-settings .selection-menu { left: auto; right: 0; }
/* The tiles carry both lines; the menu hides the ones not wanted. */
.hide-pinyin .character-tile__pinyin, .hide-translation .character-tile__translation { display: none; }
.character-tile__translation:empty { display: none; }
.character-tile__pinyin ~ .character-tile__translation { -webkit-line-clamp: 1; }
.hide-pinyin .character-tile__pinyin ~ .character-tile__translation { -webkit-line-clamp: 2; }
.collection-screen .filter-row .chip { padding-inline: 11px; }
.collection-screen .filter-row .selection-pill--icon { padding-inline: 9px; }
.search-field { display: block; margin: 8px 0 10px; }
.search-field input { width: 100%; min-height: 46px; padding: 0 15px; border: 1px solid var(--line); border-radius: 14px; background: rgba(var(--glass-rgb), .8); color: var(--ink); font: inherit; font-size: 14px; }
.search-field input:focus { outline: 2px solid rgba(223,85,63,.35); }
.filter-row { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.garden-search { position: relative; }
.garden-recent { position: absolute; top: 100%; left: 0; right: 0; z-index: 20; display: grid; margin-top: -4px; padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 12px 30px rgba(0,0,0,.18); }
.garden-recent[hidden] { display: none; }
.garden-recent__head { display: flex; align-items: center; justify-content: space-between; padding: 2px 0 2px 8px; }
.garden-recent__title { color: var(--ink-soft); font-size: 12px; font-weight: 800; }
.garden-recent__clear { min-height: 32px; padding: 0 8px; border: 0; border-radius: 8px; background: none; color: var(--red); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.garden-recent__item { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: baseline; gap: 10px; padding: 9px 8px; border: 0; border-radius: 10px; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.garden-recent__item + .garden-recent__item { border-top: 1px solid var(--line); border-radius: 0; }
.garden-recent__hanzi { font-size: 19px; font-weight: 700; }
.garden-recent__pinyin { color: var(--ink-soft); font-size: 13px; }
.garden-recent__meaning { overflow: hidden; color: var(--ink-soft); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.chip { padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; background: rgba(var(--glass-rgb), .6); font-size: 12px; font-weight: 700; cursor: pointer; }
.chip.is-selected { border-color: var(--ink); background: var(--ink); color: var(--on-ink); }
.character-grid { display: grid; flex: 1; min-height: 0; grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 8px; align-content: start; overflow-y: auto; overscroll-behavior: contain; }
/* The grid runs down to the tab bar. Its padding keeps the due ring and
   borders of edge tiles inside the scroll box, and the edges fade instead
   of cutting tiles off. */
.collection-screen { padding-bottom: 0; }
.collection-screen .filter-row { margin-bottom: 0; }
.character-grid {
  margin: 0 -6px; padding: 12px 6px 20px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 12px, #000 calc(100% - 16px), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 12px, #000 calc(100% - 16px), transparent 100%);
}
/* Where the next tiles get added as the grid scrolls (fillGrid in app.js). */
.character-grid__more { grid-column: 1 / -1; height: 1px; }
.character-tile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; aspect-ratio: 1 / 1; border: 1px solid var(--line); border-radius: 16px; background: rgba(var(--glass-rgb), .72); cursor: pointer; }
.character-tile__hanzi { font-family: "Noto Serif SC", serif; font-size: 27px; line-height: 1; }
.character-tile__meta { display: -webkit-box; max-width: 94%; overflow: hidden; color: var(--ink-soft); font-size: 10px; font-weight: 700; line-height: 1.15; text-align: center; overflow-wrap: break-word; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.character-tile.state-new { opacity: .5; }
.character-tile.state-new .character-tile__hanzi { color: #8b8b82; }
.character-tile.state-familiar { border-color: #cfe0cf; background: rgba(var(--jade-rgb), .5); }
/* "Помню": a still jade sheen. "Освоил" gets the shine foil below. */
.character-tile.state-remembered { border-color: #b9d3bd; background: linear-gradient(135deg, rgba(var(--jade-rgb), .62), rgba(255,255,255,.4) 48%, rgba(var(--jade-rgb), .5)); }
.character-tile.shine .character-tile__meta { color: var(--shine-ink); opacity: .75; }
.character-tile.is-due { box-shadow: 0 0 0 2px rgba(223,85,63,.35); }
.character-tile__due { position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border-radius: 99px; background: var(--red); overflow: hidden; font-size: 0; }
/* Best writing on the card: traced (faint), from memory, from memory with no mistakes (gold). */
.character-tile__writing { position: absolute; top: 4px; left: 6px; color: var(--ink-soft); font-size: 10px; line-height: 1; opacity: .45; }
.character-tile__writing.is-level-2 { opacity: .9; }
.character-tile__writing.is-level-3 { color: #b8860b; opacity: 1; }
/* How common the word is ("Top 500"), between the writing mark and the due dot; switched off in the garden's menu. */
.character-grid.hide-frequency .character-tile__freq:not(.character-tile__level) { display: none; }
/* The label sits in the tile's top strip, so the character starts below it. */
.character-grid:not(.hide-frequency) .character-tile:has(.character-tile__freq) { padding-top: 12px; }
.character-grid.hide-frequency .character-tile:has(.character-tile__level) { padding-top: 12px; }
.character-tile__freq { position: absolute; top: 4px; left: 50%; transform: translateX(-50%); max-width: 70%; overflow: hidden; color: var(--ink-soft); font-size: 8.5px; font-weight: 800; line-height: 1; white-space: nowrap; text-overflow: ellipsis; opacity: .8; }
.empty-state { padding: 30px 10px; color: var(--ink-soft); font-size: 14px; text-align: center; }

/* --- detail --- */
.detail-hero { padding: 4px 0 10px; text-align: center; }
.detail-pronunciation { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 6px; }
.detail-pronunciation__sep { color: var(--ink-soft); font-size: 19px; font-weight: 600; }
.detail-pronunciation:not(:has(.detail-speak:not([hidden]))) .detail-pronunciation__sep { display: none; }
.detail-speak { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 99px; color: #fff; cursor: pointer; background: linear-gradient(135deg, rgba(255,122,89,.82), rgba(223,85,63,.82) 55%, rgba(199,62,44,.82)); box-shadow: 0 4px 12px rgba(223,85,63,.3), inset 0 1px 0 rgba(255,255,255,.3); }
.detail-speak:hover { box-shadow: 0 6px 16px rgba(223,85,63,.42), inset 0 1px 0 rgba(255,255,255,.3); transform: translateY(-1px); }
.detail-speak:active { transform: scale(.94); }
.detail-topbar-actions { display: flex; align-items: center; gap: 8px; }
.detail-note-toggle { position: relative; display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--red); border-radius: 12px; background: transparent; color: var(--red-dark); cursor: pointer; }
.detail-note-toggle[aria-expanded="true"] { background: var(--red); color: var(--on-red); }
.detail-note-toggle:active { transform: scale(.94); }
.detail-note-toggle.has-note::after { content: ""; position: absolute; top: -3px; right: -3px; width: 9px; height: 9px; border-radius: 50%; background: #f0c45c; box-shadow: 0 0 0 2px var(--paper); }
.detail-bookmark { min-height: 34px; padding: 0 12px; border: 1px solid var(--red); border-radius: 12px; background: transparent; color: var(--red-dark); font-size: 11px; font-weight: 800; cursor: pointer; }
.detail-bookmark.is-active { background: var(--red); color: var(--on-red); }
.detail-hanzi { display: block; margin: 0 auto; padding: 0; border: 0; background: none; font-family: "Noto Serif SC", serif; font-size: clamp(64px, 22vw, 100px); line-height: 1; font-weight: 600; cursor: pointer; }
.detail-pinyin { color: var(--ink-soft); font-size: 19px; font-weight: 600; }
.detail-translation { display: block; margin-top: 1px; font-size: 15px; font-weight: 700; }
/* Under the meaning: the word's HSK level and how common it is in Chinese ("Top 500", switched off in settings). */
.detail-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 6px; }
.detail-tags:not(:has(> :not([hidden]))) { display: none; }
.detail-tag { padding: 2px 9px; border: 1px solid var(--line); border-radius: 99px; color: var(--ink-soft); font-size: 11px; font-weight: 800; }
.detail-rows { display: grid; gap: 1px; }
.detail-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 12px; }
.detail-row__label { color: var(--ink-soft); font-weight: 600; }
.detail-row__value { font-weight: 800; }
.detail-row__bar { grid-column: 1 / -1; height: 6px; overflow: hidden; border-radius: 99px; background: rgba(23,59,54,.11); }
.detail-row__caption { grid-column: 1 / -1; margin-top: -1px; color: var(--ink-soft); font-size: 11px; font-weight: 600; }
.detail-row__bar > span { display: block; width: 100%; height: 100%; border-radius: inherit; background: var(--red); transform-origin: left; }
.detail-sections { margin-top: 10px; }
/* The character's other readings under the memory bar: one row a reading, opening its word's card. */
.detail-readings { margin-top: 12px; }
.detail-readings h3 { margin: 0 0 6px; font-size: 12px; }
.detail-readings__list { display: grid; gap: 6px; }
.detail-reading { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 2px 12px; width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--white); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.detail-reading:active { transform: scale(.98); }
.detail-reading__glyph { grid-column: 1; grid-row: 1 / span 2; font-family: "Noto Serif SC", serif; font-size: 28px; line-height: 1; }
.detail-reading__head { grid-column: 2; display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 13px; line-height: 1.35; }
.detail-reading__head b { font-size: 14px; }
.detail-reading__words { grid-column: 2; color: var(--ink-soft); font-family: "Noto Serif SC", serif; font-size: 13px; }
.detail-reading__go { grid-column: 3; grid-row: 1 / span 2; color: var(--ink-soft); font-size: 18px; }
/* The learner's own note on a word (card page). */
.note-card { margin-top: 12px; }
.note-view, .note-form { padding: 12px 14px; border: 1px solid var(--line); border-radius: 20px; background: #fff8e6; }
.note-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.note-head h3 { margin: 0; font-size: 15px; }
.note-card .note-text { text-wrap: wrap; margin: 6px 0 0; font-size: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; cursor: text; }
.note-link { padding: 4px 2px; border: 0; background: none; color: var(--red-dark); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.note-link--quiet { color: var(--ink-soft); }
.note-input { display: block; width: 100%; min-height: 76px; margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); color: var(--ink); font: inherit; font-size: 14px; line-height: 1.45; letter-spacing: inherit; word-spacing: inherit; resize: none; overflow: hidden; }
.note-input:focus { outline: 2px solid #f0c45c; outline-offset: 0; }
.note-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 10px; }
.note-actions > :first-child { margin-right: auto; }
.note-save { padding: 8px 18px; border: 0; border-radius: 99px; background: var(--strong, var(--ink)); color: var(--on-strong, #fff); font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; }
.mnemonic--own { padding: 6px 10px; border-radius: 12px; background: #fff3d1; color: var(--ink); font-weight: 600; }
.quiz-note { text-wrap: wrap; justify-self: stretch !important; margin: 8px 0 0; font-size: 13px; line-height: 1.4; text-align: left; white-space: pre-wrap; }
.flashcard .mnemonic--own { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; }
.mnemonic--own::before { content: "✎\FE0E  "; }
:root[data-theme="dark"] .note-view, :root[data-theme="dark"] .note-form { background: rgba(240, 196, 92, .08); }
:root[data-theme="dark"] .mnemonic--own { background: rgba(240, 196, 92, .14); }
.composition-row { display: flex; align-items: flex-start; justify-content: center; flex-wrap: wrap; gap: 10px; padding: 4px 0 2px; }
.composition-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 58px; }
.composition-cell__glyph { font-family: "Noto Serif SC", serif; font-size: 44px; line-height: 1.15; font-weight: 600; }
.composition-cell__role { font-size: 9.5px; font-weight: 800; letter-spacing: .4px; text-transform: lowercase; color: var(--ink-soft); opacity: .85; }
.composition-cell__role--radical { color: var(--red-dark); opacity: 1; }
.composition-cell__role--phonetic { color: #3e6f91; opacity: 1; }
.composition-cell__role--semantic { color: #2f7061; opacity: 1; }
.composition-cell__gloss { color: var(--ink-soft); font-size: 11.5px; font-weight: 700; text-align: center; line-height: 1.3; }
.composition-plus { color: var(--ink-soft); font-size: 20px; font-weight: 600; padding: 12px 2px 0; }
.detail-section { margin-bottom: 8px; }
.detail-section h3 { margin: 0 0 3px; font-size: 12px; }
.detail-section p { margin: 0; color: var(--ink-soft); font-size: 12px; line-height: 1.4; }
.detail-examples { margin-top: 10px; }
.component-hanzi { cursor: default; }
.component-pinyin { display: block; margin-top: 6px; }
.component-key { display: inline-block; margin-top: 8px; }
.component-card { display: block; margin: 10px auto 0; }
.component-usage { margin-top: 6px; }
.component-usage h3 { font-size: 14px; }
.component-grid { flex: none; overflow: visible; margin: 8px 0 0; padding: 4px 0 8px; -webkit-mask-image: none; mask-image: none; }
.detail-screen {
  overflow-y: auto;
}
.detail-example {
  padding: 12px;
  border-radius: 18px;
  background: var(--white);
  box-shadow: 0 10px 26px rgba(37, 45, 34, .08), 0 2px 6px rgba(37, 45, 34, .05);
}
.detail-example h3 { margin-bottom: 8px; color: var(--ink-soft); letter-spacing: .04em; text-transform: uppercase; }
.detail-example__list { display: grid; gap: 10px; }
.detail-example__item + .detail-example__item { padding-top: 10px; border-top: 1px solid var(--line); }
.detail-example__item:has(> .detail-example__speak) { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-items: center; }
.detail-example__item:has(> .detail-example__report) { grid-template-columns: minmax(0, 1fr) auto auto; column-gap: 6px; }
.detail-example__report { width: 26px; height: 26px; }
.detail-example__speak { margin-right: 4px; box-shadow: 0 2px 8px rgba(223,85,63,.28), inset 0 1px 0 rgba(255,255,255,.3); }
.detail-example__speak[hidden] { display: none; }
.detail-example__speak.is-playing { transform: scale(.94); }
/* Free sentences used up for today: muted speaker with a small lock. */
.detail-example__speak.is-locked { position: relative; background: var(--paper-deep); color: var(--ink-soft); box-shadow: none; }
.detail-example__speak.is-locked:hover { box-shadow: none; }
.detail-example__speak.is-locked::after { content: ""; position: absolute; right: -4px; bottom: -4px; width: 17px; height: 17px; border-radius: 99px; background: var(--ink-soft); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10V8a5 5 0 0 1 10 0v2h1a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1zm2 0h6V8a3 3 0 0 0-6 0z'/%3E%3C/svg%3E") center / 10px no-repeat, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10V8a5 5 0 0 1 10 0v2h1a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1zm2 0h6V8a3 3 0 0 0-6 0z'/%3E%3C/svg%3E") center / 10px no-repeat, linear-gradient(#000 0 0); mask-composite: exclude; }
.detail-example__zh { margin: 0; font-family: "Noto Serif SC", serif; font-size: 19px; line-height: 1.4; color: var(--ink); }
.detail-example__target { color: var(--red); font-weight: 700; }
.detail-example__pinyin { display: block; margin-top: 4px; color: var(--ink-soft); font-size: 12px; letter-spacing: .01em; }
.detail-example__ru { display: block; margin-top: 3px; color: var(--ink-soft); font-size: 12px; line-height: 1.4; }
.detail-example__more { width: 100%; min-height: 34px; margin-top: 10px; border: 0; border-radius: 12px; background: var(--paper-deep); color: var(--ink); font-size: 12px; font-weight: 800; cursor: pointer; }
.detail-example__more::after { content: " ↓"; }
.detail-example__more.is-pro::after { content: none; }
/* «Примеры из словаря» (app.js dictExamplesSection): after the card's own examples, unvoiced. */
.detail-dict-examples { margin-top: 10px; }
.detail-dict-examples .dict-entry__source { margin-top: 10px; }
.detail-dict-examples .detail-example__more.is-pro { margin-top: 0; }
/* «Значения из словаря» (app.js dictionaryBlock, web/dictionary-entry.js): folded under the examples. */
.detail-dict { margin-top: 10px; padding: 0 12px; border-radius: 18px; background: var(--white); box-shadow: 0 10px 26px rgba(37, 45, 34, .08), 0 2px 6px rgba(37, 45, 34, .05); }
.detail-dict > summary { display: flex; align-items: center; justify-content: space-between; min-height: 46px; color: var(--ink); font-size: 12.5px; font-weight: 800; list-style: none; cursor: pointer; }
.detail-dict > summary::-webkit-details-marker { display: none; }
.detail-dict > summary::after { content: "›"; color: var(--ink-soft); font-size: 18px; line-height: 1; transform: rotate(90deg); transition: transform .2s ease; }
.detail-dict[open] > summary::after { transform: rotate(-90deg); }
.detail-dict__body { padding: 2px 0 12px; border-top: 1px solid var(--line); }
.detail-dict__status { margin: 10px 0 0; color: var(--ink-soft); font-size: 12.5px; line-height: 1.4; }
.detail-dict__status.is-error { color: var(--red-dark); }
.detail-dict__status.is-loading { display: flex; align-items: center; gap: 8px; }
.detail-dict__status.is-loading::before { content: ""; flex: 0 0 auto; width: 12px; height: 12px; border: 2px solid var(--ink-soft); border-right-color: transparent; border-radius: 50%; animation: sentence-loading .8s linear infinite; }
@media (prefers-reduced-motion: reduce) { .detail-dict__status.is-loading::before { animation: none; } }
.dict-entry { font-size: 13px; line-height: 1.45; color: var(--ink); }
.dict-group { margin-top: 10px; }
.dict-group[hidden], .dict-sense[hidden], .dict-entry__other[hidden] { display: none; }
.dict-group__head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0 0 4px; }
.dict-group__reading { margin-right: 2px; font-weight: 800; }
.dict-pill { display: inline-block; margin-right: 4px; padding: 1px 7px; border-radius: 99px; background: var(--paper-deep); color: var(--ink-soft); font-size: 10.5px; font-weight: 700; line-height: 1.5; vertical-align: 1px; }
.dict-senses { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.dict-sense { display: grid; grid-template-columns: 18px minmax(0, 1fr); column-gap: 4px; }
.dict-sense.is-sub { padding-left: 22px; grid-template-columns: minmax(0, 1fr); }
.dict-sense__n { color: var(--ink-soft); font-weight: 800; font-variant-numeric: tabular-nums; }
.dict-sense__text { margin: 0; overflow-wrap: anywhere; }
.dict-examples { grid-column: -2; display: grid; gap: 2px; margin: 3px 0 0; padding: 0; list-style: none; }
.dict-example { color: var(--ink-soft); font-size: 12.5px; overflow-wrap: anywhere; }
.dict-example__zh { color: var(--ink); font-family: "Noto Serif SC", serif; font-size: 15px; }
.dict-entry__other { margin-top: 12px; padding-top: 8px; border-top: 1px dashed var(--line); }
.dict-entry__readings { margin: 0; color: var(--ink-soft); font-size: 12px; font-weight: 800; }
.dict-entry__more { width: 100%; min-height: 34px; margin-top: 12px; border: 0; border-radius: 12px; background: var(--paper-deep); color: var(--ink); font-size: 12px; font-weight: 800; cursor: pointer; }
.dict-entry__see { margin: 10px 0 0; color: var(--ink-soft); font-size: 12px; }
.dict-entry__source { display: block; margin-top: 12px; color: var(--ink-soft); font-size: 11px; text-decoration: none; }
.dict-entry__source:hover { text-decoration: underline; }
.dict-sheet__pinyin { margin: -6px 0 6px; color: var(--ink-soft); font-size: 15px; }
.dict-sheet__entry { border-top: 0; }
.examples-modal.is-dict #examplesModalTitle { font-family: "Noto Serif SC", serif; font-size: 30px; }
/* Under a garden search: words outside HSK from the dictionary (app.js syncGardenDictionary). */
.garden-dict { grid-column: 1 / -1; margin-top: 6px; }
.garden-dict[hidden] { display: none; }
.garden-dict__title { margin: 4px 2px 8px; color: var(--ink-soft); font-size: 12px; font-weight: 800; letter-spacing: .02em; }
.garden-dict__row { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 12px; align-items: baseline; width: 100%; margin-bottom: 8px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 16px; background: rgba(var(--glass-rgb), .72); color: var(--ink); text-align: left; cursor: pointer; }
.garden-dict__hanzi { grid-row: 1 / 3; align-self: center; font-family: "Noto Serif SC", serif; font-size: 24px; line-height: 1.1; }
.garden-dict__pinyin { color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.garden-dict__level { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: var(--paper-deep); color: var(--ink-soft); font-size: 10px; font-weight: 800; letter-spacing: .02em; vertical-align: 1px; }
.garden-dict__meaning { display: -webkit-box; overflow: hidden; font-size: 13px; line-height: 1.3; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
/* The card page's actions stay at the bottom while the page scrolls under
   them: the bar, not the page, carries the bottom inset (a sticky bar stops
   at its scroller's padding edge), and fades the page out above it. Short
   pages still push it to the bottom (margin-top: auto). */
.detail-screen:has(> .detail-actions) { padding-bottom: 0; }
.detail-actions {
  position: sticky;
  z-index: 2;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: auto -20px 0;
  padding: 24px 20px max(16px, var(--safe-bottom));
  background: linear-gradient(180deg, transparent, var(--paper) 24px);
}
.detail-write { border: 1.5px solid var(--ink); background: transparent; color: var(--ink); }
.detail-more { position: absolute; top: -2px; left: 50%; display: grid; width: 26px; height: 22px; place-items: center; color: var(--ink-soft); opacity: .65; pointer-events: none; transform: translateX(-50%); animation: detail-more-bob 1.8s ease-in-out infinite; }
.detail-more[hidden] { display: none; }
.detail-more svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
@keyframes detail-more-bob { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 3px); } }
@media (prefers-reduced-motion: reduce) { .detail-more { animation: none; } }

.examples-modal { position: absolute; z-index: 12; inset: 0; display: flex; align-items: flex-end; }
.examples-modal.is-note { z-index: 31; }
/* The dictionary's word sheet opens from the garden, over the tab bar. */
.examples-modal.is-dict { z-index: 31; }
.note-rule { margin: 0 0 8px; padding: 10px 12px; border-radius: 12px; background: var(--paper-deep); color: var(--ink); font-size: 18px; font-weight: 800; text-align: center; }
.note-text { margin: 0 0 12px; color: var(--ink); font-size: 14px; line-height: 1.5; white-space: pre-line; }
.note-example { position: relative; }
.chapter-notes { margin: 0; text-align: left; }
/* The chapter's two halves, one at a time: its characters and the theory that
   explains them. Neither has to be scrolled past to reach the other. */
.chapter-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 12px 0 10px; padding: 4px; border-radius: 15px; background: rgba(23, 59, 54, .06); }
.chapter-tab { display: flex; min-height: 34px; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 11px; background: none; color: var(--ink-soft); font-size: 12px; font-weight: 800; cursor: pointer; }
.chapter-tab.is-selected { background: var(--white); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
/* On dark paper the groove is a lighter fill, so the raised half is lighter still. */
:root[data-theme="dark"] .chapter-tabs { background: rgba(229, 235, 217, .09); }
:root[data-theme="dark"] .chapter-tab.is-selected { background: rgba(229, 235, 217, .16); box-shadow: none; }
.chapter-tab em { color: var(--ink-soft); font-size: 10px; font-style: normal; font-weight: 800; font-variant-numeric: tabular-nums; }
.chapter-tab.is-selected em { color: var(--red-dark); }
.chapter-notes__list { display: grid; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.chapter-note { display: flex; width: 100%; align-items: center; gap: 10px; padding: 6px 12px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--ink); font-size: 13px; font-weight: 800; text-align: left; cursor: pointer; }
.chapter-note:first-child { border-top: 0; }
.chapter-note__glyph { display: grid; width: 26px; height: 26px; flex: 0 0 auto; place-items: center; border-radius: 9px; background: var(--paper); color: var(--ink); font: 14px "Noto Serif SC", serif; }
.chapter-note__title { flex: 1; min-width: 0; }
.chapter-note__chevron { flex: 0 0 auto; color: var(--ink-soft); }
.chapter-note__pro { flex: 0 0 auto; display: flex; }
.chapter-note__check { display: grid; flex: 0 0 auto; place-items: center; color: var(--green); }
.examples-modal[hidden] { display: none; }
.examples-modal__backdrop { position: absolute; inset: 0; background: rgba(20,33,30,.42); backdrop-filter: blur(3px); }
.examples-modal__sheet {
  position: relative;
  display: flex;
  width: 100%;
  max-height: calc(100% - max(20px, var(--safe-top)));
  flex-direction: column;
  padding: 18px 20px max(24px, var(--safe-bottom));
  border-radius: 28px 28px 0 0;
  background: var(--white);
  box-shadow: 0 -20px 60px rgba(20,33,30,.22);
}
.examples-modal__header { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.examples-modal__header h2 { font-size: 21px; }
.examples-modal__actions { display: flex; flex: none; align-items: center; gap: 10px; margin-left: auto; }
.examples-modal__actions .close-button { flex: none; }
/* A lesson's title beside its pinyin switch, flag and ×; when the title's longest word can't fit there, the title takes its own line under them. */
.examples-modal.is-note .examples-modal__header { flex-wrap: wrap-reverse; gap: 8px 10px; }
.examples-modal.is-note .examples-modal__header h2 { flex: 1 1 0; }
/* A lesson's pinyin switch sits by the close button; off, the examples and the check show no pinyin (a sound lesson's examples always do). */
.examples-modal__header .examples-modal__pinyin { margin-left: auto; margin-right: -6px; }
.examples-modal.is-note:not(.shows-pinyin) .note-example:not(.is-sound) .detail-example__pinyin { display: none; }
/* The reading after a run of characters in a lesson's rule and text; a short word doesn't break. */
.note-zh { white-space: nowrap; }
.note-py { color: var(--ink-soft); font-family: "Manrope", system-ui, sans-serif; font-size: 0.82em; font-weight: 600; }
.examples-modal.is-note:not(.shows-pinyin) .note-py { display: none; }
.examples-modal__list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 2px 2px 8px; }

/* --- confusions --- */
.confuse-list { display: grid; gap: 10px; overflow-y: auto; }
.confuse-row { padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: rgba(var(--glass-rgb), .72); }
.confuse-chars { display: flex; align-items: center; justify-content: space-around; gap: 12px; }
.confuse-char { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.confuse-glyph { font-family: "Noto Serif SC", serif; font-size: 40px; line-height: 1; }
.confuse-char small { color: var(--ink-soft); font-size: 10px; font-weight: 700; text-align: center; }
.pro-teaser { margin-top: auto; padding: 16px; border-radius: 18px; background: rgba(223,85,63,.08); }
.pro-teaser p { margin: 0 0 12px; font-size: 13px; font-weight: 700; line-height: 1.45; }

/* --- overlays --- */
.overlay { position: absolute; z-index: 10; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(20,33,30,.42); backdrop-filter: blur(3px); }
.overlay-card { width: 100%; max-width: 360px; padding: 24px; border-radius: 26px; background: var(--white); box-shadow: 0 26px 60px rgba(20,33,30,.28); text-align: center; }
/* A whole HSK level's fireworks play inside #milestone (reward-effects.js `under`), behind its card. */
#milestone .overlay-card { position: relative; z-index: 1; }
.overlay-card h2 { margin: 4px 0 8px; font-size: 24px; }
.overlay-lead { margin: 0 0 10px; color: var(--ink-soft); font-size: 14px; line-height: 1.5; }
.overlay-benefit { margin: 0 0 10px; font-size: 13px; font-weight: 700; line-height: 1.5; }
.overlay-note { margin: 12px 0 14px; color: #9a8f83; font-size: 11px; font-weight: 600; }
.overlay-card .menu-primary { justify-content: center; }
.overlay-card .link-button { display: block; margin: 10px auto 0; }
/* Bao asks once whether to leave writing out of today's rounds. */
.write-ask__mascot { width: 110px; height: 110px; margin: 0 auto 2px; }
.write-ask__mascot .mascot { width: 100%; height: 100%; }
.overlay-card #writeAskKeep { margin-top: 8px; width: 100%; justify-content: center; }

@media (prefers-reduced-motion: reduce) {
  .mascot--idle, .mascot--celebrating, .mascot--watering { animation: none !important; }
  .mascot .bao-eye, .result-bao__mascot .mascot, .result-bao__line { animation: none !important; }
}

/* layout fixes for inner headers + overlays */
.confuse-screen .topbar { align-items: center; gap: 6px; }
.confuse-screen .topbar h2 { flex: 1; font-size: 17px; line-height: 1.15; text-align: left; }
.collection-screen .topbar h2 { flex: 1; font-size: 19px; text-align: center; }
.garden-view { position: relative; flex: 1; display: flex; justify-content: center; }
.garden-view__button { padding: 6px 10px; border: 0; border-radius: 12px; background: none; color: var(--ink); font: inherit; font-size: 19px; font-weight: 800; cursor: pointer; }
.garden-view__button::after { content: " ▾"; color: var(--ink-soft); font-size: 14px; }
.garden-view__menu { right: auto; left: 50%; transform: translateX(-50%); margin-top: 2px; }
.component-tile__count { position: absolute; top: 4px; right: 6px; color: var(--ink-soft); font-size: 9px; font-weight: 800; font-variant-numeric: tabular-nums; }
.component-tile.is-met { border-color: #cfe0cf; background: rgba(var(--jade-rgb), .5); }
.collection-screen .topbar .icon-button { flex: 0 0 auto; }
.overlay { overflow-y: auto; }
@media (max-width: 460px) {
  .confuse-screen .topbar h2 { font-size: 15px; }
}

/* --- free play screen --- */
.play-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: max(16px, var(--safe-top)) 20px max(28px, var(--safe-bottom));
}
.play-screen .topbar { align-items: center; gap: 6px; margin-bottom: 4px; }
.play-screen .topbar h2 { flex: 1; min-width: 0; overflow: hidden; font-size: 19px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.play-screen .topbar .icon-button { flex: 0 0 auto; }
.play-screen .random-panel { margin-top: 12px; }
.play-screen .topics-section { margin-top: 20px; }

/* scrolling screens must not shrink their sections */
.home-screen > *, .play-screen > * { flex: 0 0 auto; }

/* --- quiz mode --- */
.probe { justify-content: flex-start; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; scroll-padding-block: 18px; }
.quiz-hanzi {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px 0 2px;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(64px, 26vw, 104px);
  font-weight: 600;
  line-height: 1;
}
.quiz-hanzi[data-length="2"] { font-size: clamp(48px, 20vw, 80px); }
.quiz-hanzi[data-length="3"] { font-size: clamp(38px, 15vw, 62px); }
.quiz-speak { flex: 0 0 auto; align-self: center; margin: 0 auto 4px; }
.probe-option.is-correct { border-color: var(--green); background: var(--tint-green); color: var(--green-ink); box-shadow: inset 0 0 0 1px var(--green); }
.probe-option.is-wrong { border-color: var(--red); background: var(--tint-red); color: var(--red-dark); box-shadow: inset 0 0 0 1px var(--red); }
.probe-option:disabled { cursor: default; opacity: 1; transition: opacity .2s ease; }
.probe-option:disabled:not(.is-correct):not(.is-wrong):not(.is-picked) { opacity: .5; }
.quiz-feedback { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 4px; }
.quiz-report { align-self: flex-end; margin-top: -8px; }
.quiz-image {
  width: 100%;
  max-height: min(calc(24dvh / var(--ui-zoom, 1)), 180px);
  object-fit: contain;
  border-radius: 18px;
  background: var(--muted);
}
.quiz-translation { font-size: 18px; font-weight: 800; text-align: center; }
.quiz-pinyin { color: var(--ink-soft); font-size: 14px; font-weight: 600; }
.quiz-bookmark { align-self: center; cursor: pointer; }

.result-stars { display: flex; flex: none; gap: 2px; font-size: 24px; line-height: 1; }
.result-stars[hidden] { display: none; }
.result-stars .star { color: rgba(23,59,54,.16); transition: transform .2s ease; }
.result-stars .star.is-on { color: #e8a93a; text-shadow: 0 2px 6px rgba(232,169,58,.35); }

/* ghost CTA on the dark today-card + free-play mode picker */
.menu-ghost {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
  padding: 0 18px;
  border: 1px solid rgba(255,255,255,.34);
  border-radius: 16px;
  background: rgba(255,255,255,.08);
  color: white;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
}
.all-cards-button { justify-content: center; text-align: center; }
.all-cards-copy { text-align: center; }

@media (max-height: 740px) {
  .home-screen { padding-top: max(10px, var(--safe-top)); padding-bottom: max(10px, var(--safe-bottom)); }
  .mascot-slot--hero { width: 76px; height: 76px; }
  .home-hero { margin-block: 0 7px; }
  .stack-legend { margin-top: 5px; }
  .today-card { padding: 12px 14px; }
}
.menu-ghost:hover { background: rgba(255,255,255,.16); }
.play-mode-card { padding: 16px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 22px; background: rgba(var(--glass-rgb), .7); }
.play-mode-card .section-heading { margin-bottom: 12px; }
.play-mode-card .section-heading span { color: var(--ink-soft); font-size: 11px; font-weight: 700; }

/* ================================================================== *
 * Mobile product shell — flow redesign
 * ================================================================== */

.screen-header {
  flex: 0 0 auto;
  padding: max(12px, var(--safe-top)) 16px 8px;
  background: rgba(var(--glass-rgb), .92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.screen-header h2 { flex: 1; font-size: 18px; text-align: center; }
.header-spacer { width: 44px; height: 44px; }
.screen-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.screen-footer {
  flex: 0 0 auto;
  padding: 10px 16px max(14px, var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: rgba(var(--glass-rgb), .96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* Home: one clear daily action, progress, garden, then free practice. */
.home-screen { padding: max(12px, var(--safe-top)) 16px max(12px, var(--safe-bottom)); }
.home-screen .topbar { flex: 0 0 auto; }
.home-practice { margin: 8px 0 0; padding: 9px 14px; min-height: 52px; }
.home-practice > span { display: flex; min-width: 0; flex-direction: column; align-items: center; gap: 2px; }
.home-practice strong { font-size: 13px; }
.home-practice small { color: var(--ink-soft); font-size: 10px; font-weight: 600; }

/* Free practice is a single configuration flow with one start action. */
.play-screen { display: flex; height: 100%; flex-direction: column; padding: 0; overflow: hidden; }
.practice-scroll { flex: 1 1 auto; padding: 8px 16px 18px; }
.screen-intro { padding: 6px 2px 12px; }
.screen-intro h1 { margin-top: 3px; font-size: 28px; }
.screen-intro p { margin: 6px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.45; }
.config-card {
  margin-bottom: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(var(--glass-rgb), .76);
}
.config-card .section-heading { margin-bottom: 10px; }
.config-card .section-heading h2 { font-size: 17px; }
.source-control { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.source-control button {
  display: grid;
  min-height: 66px;
  place-items: center;
  gap: 2px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  cursor: pointer;
}
.source-control button > span { font-family: "Noto Serif SC", serif; font-size: 23px; line-height: 1; }
.source-control button strong { font-size: 11px; }
.source-control button.is-selected { border-color: var(--red); background: var(--tint-red); box-shadow: inset 0 0 0 1px var(--red); }
.deck-size { margin: 12px 0 0; }
.deck-size button { flex: 1; min-width: 46px; min-height: 38px; border-color: var(--line); background: var(--surface); color: var(--ink); }
.deck-size button.is-selected { border-color: var(--ink); background: var(--ink); color: var(--on-ink); }
.config-card .toggle-row { margin-top: 8px; }
/* Practice: four skills (words, listening, reading, writing), then how, which words and how many. */
.skill-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.skill-grid button { display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); text-align: start; cursor: pointer; }
.skill-grid button strong { font: 600 26px/1 "Noto Serif SC", serif; }
.skill-grid button b { display: block; font-size: 14px; }
.skill-grid button small { display: block; margin-top: 1px; color: var(--ink-soft); font-size: 11px; line-height: 1.25; }
.skill-grid button.is-selected { border-color: var(--red); background: var(--tint-red); box-shadow: inset 0 0 0 1px var(--red); }
.skill-how { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.skill-how h3 { margin: 0 2px 8px; font-size: 14px; }
.skill-how__text { margin: 10px 2px 0; color: var(--ink-soft); font-size: 12.5px; line-height: 1.4; }
.skill-how .tone-how { margin-top: 10px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip-row button { min-height: 36px; padding: 6px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.chip-row button.is-selected { border-color: var(--ink); background: var(--ink); color: var(--on-ink); }
.topic-fold { margin-top: 10px; }
/* Random's words (#wordPick): the Random chip drops a menu over what follows, like the HSK menu. */
.word-pick { position: relative; display: inline-flex; }
.word-pick__list[hidden] { display: none; }
.word-pick__list.is-up { top: auto; bottom: 100%; margin: 0 0 6px; }
#wordPickCurrent { display: inline-flex; align-items: center; gap: 6px; }
/* Flips in place on open, at once: no slide. */
.word-pick__chevron { flex: none; width: 12px; height: 12px; opacity: .75; }
#wordPickCurrent[aria-expanded="true"] .word-pick__chevron { rotate: 180deg; }
.word-pick__list { position: absolute; top: 100%; left: 0; z-index: 30; display: grid; width: max-content; min-width: 220px; max-width: calc(100vw / var(--ui-zoom, 1) - 64px); margin-top: 6px; padding: 6px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 14px 34px rgba(0,0,0,.18); }
.config-card .chip-row .word-pick__item, .words-sheet .chip-row .word-pick__item, .word-pick__item { display: flex; min-height: 42px; align-items: center; gap: 10px; padding: 0 10px; border: 0; border-radius: 12px; background: none; color: var(--ink); font: inherit; font-size: 14px; font-weight: 700; text-align: start; cursor: pointer; }
.word-pick__item::after { content: ""; flex: none; width: 16px; margin-inline-start: auto; text-align: center; font-weight: 800; }
.word-pick__item[aria-selected="true"]::after { content: "✓"; }
.config-card .chip-row .word-pick__item[aria-selected="true"], .words-sheet .chip-row .word-pick__item[aria-selected="true"] { background: var(--paper); color: var(--ink); }
.topic-fold[hidden], .topic-more[hidden], .topic-button[hidden] { display: none; }
.topic-more { display: block; margin: 8px 0 0 auto; padding: 4px 2px; border: 0; background: none; color: var(--red-dark); font: inherit; font-size: 12.5px; font-weight: 800; cursor: pointer; }
.words-card__length { margin-top: 14px; }
#topicsSection[hidden] + .words-card__length { margin-top: 0; }
.tests-card .section-heading { margin-bottom: 10px; }
.topic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.topic-button { display: grid; min-height: 72px; grid-template-columns: 38px 1fr; grid-template-rows: auto auto; align-items: center; column-gap: 8px; padding: 9px 8px; border-radius: 16px; }
.topic-button .topic-glyph { grid-row: 1 / 3; width: 38px; height: 38px; margin: 0; font-size: 19px; }
.topic-button strong, .topic-button small { align-self: end; }
.topic-button small { align-self: start; }
/* Grammar topics have longer names ("Вопросительные слова"): up to three lines before an ellipsis. */
.topic-button strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; white-space: normal; line-height: 1.2; font-size: 11.5px; overflow-wrap: break-word; hyphens: auto; }
.topic-button.is-selected { border-color: var(--red); background: var(--tint-red); box-shadow: inset 0 0 0 1px var(--red); }
.selection-summary { min-height: 15px; margin: 0 0 7px; color: var(--ink-soft); font-size: 10px; font-weight: 700; text-align: center; }

/* Sessions reserve fixed chrome; only the card/probe owns overflow. */
.game-screen { padding: max(10px, var(--safe-top)) 14px max(8px, var(--safe-bottom)); }
.game-screen > .topbar { flex: 0 0 auto; }
.session-actions, .reveal-actions { flex: 0 0 auto; height: 66px; }
.probe { padding: 18px 16px 8px; }
.quiz-sticky-action {
  position: sticky;
  z-index: 7;
  bottom: -8px;
  margin-top: 12px;
  padding: 10px 0 8px;
  background: linear-gradient(180deg, rgba(255,253,247,0), var(--white) 22%);
}
.quiz-sticky-action .reveal-continue { box-shadow: 0 10px 24px rgba(23,59,54,.18); }

/* Results expose all meaningful next steps without hiding the mistake list. */
.result-screen { --result-pad: 16px; padding: max(18px, var(--safe-top)) var(--result-pad) 0; }
.result-summary { margin: 14px 0 12px; }
.result-actions { position: sticky; bottom: 0; z-index: 1; flex: 0 0 auto; display: grid; gap: 8px; margin: auto calc(-1 * var(--result-pad)) 0; padding: 14px var(--result-pad) max(12px, var(--safe-bottom)); background: linear-gradient(transparent, var(--paper) 22px); }
/* Tone Train: practising the misses is the main button. */
.result-screen.is-tones #resultRetry:not([hidden]) { order: -1; min-height: 50px; border: 0; background: var(--ink); color: var(--on-ink); font-size: 20px; }
.result-screen.is-tones .result-actions:has(#resultRetry:not([hidden])) #resultContinue { min-height: 46px; border: 1px solid var(--ink); background: transparent; color: var(--ink); font-size: 13px; }
.result-screen.is-tones .result-actions:has(#resultRetry:not([hidden])) #resultContinue span { font-size: inherit; }
.result-actions .result-home { min-height: 50px; margin: 0; }
/* The 2nd and 3rd study days: one more short round leads the results; the main button steps back to an outline. */
.result-actions .result-extra.is-lead { order: -1; min-height: 50px; border: 0; border-radius: 18px; background: var(--ink); color: var(--on-ink); font-size: 15px; }
.result-actions #resultContinue.is-second { min-height: 46px; border: 1px solid var(--ink); border-radius: 16px; background: transparent; color: var(--ink); font-size: 13px; }
.result-actions #resultContinue.is-second span { font-size: inherit; }
/* A weak level check after the tour: starting a level lower leads. */
.result-actions .result-lower { order: -1; }
.result-retry { min-height: 46px; border: 1px solid var(--ink); border-radius: 16px; background: transparent; color: var(--ink); font-size: 13px; font-weight: 800; cursor: pointer; }
.result-home-link { margin: 0 auto; min-height: 34px; }

/* Settings are a full-height mobile surface with independently scrolling content. */
.settings-sheet {
  top: 0;
  bottom: 0;
  display: flex;
  max-height: none;
  height: 100%;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border-radius: 0;
  /* Closed: below the screen, shadow included (it would shade full screens' bottom edge). */
  transform: translateY(calc(100% + 80px));
}
.settings-sheet .sheet-header {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  margin: 0;
  padding: max(14px, var(--safe-top)) 16px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--white);
}
.settings-scroll { flex: 1 1 auto; min-height: 0; padding: 16px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
/* Fieldsets default to min-width: min-content, which let wide rows push the page sideways. */
.settings-scroll { overflow-x: hidden; }
.settings-scroll fieldset { min-width: 0; margin-bottom: 18px; }
.settings-footer { flex: 0 0 auto; padding: 10px 16px max(14px, var(--safe-bottom)); border-top: 1px solid var(--line); background: var(--white); }
.settings-footer .start-button { min-height: 50px; }

@media (min-width: 461px) {
  .settings-sheet { top: 0; right: 0; bottom: 0; left: 0; border-radius: 0; }
}

@media (max-height: 680px) {
  .mascot-slot--hero { width: 64px; height: 64px; }
  .today-card { padding-block: 10px; }
  .today-card .menu-primary { min-height: 38px; }
  .garden-card { padding: 10px 12px; }
  .home-practice { min-height: 46px; }
}

/* ================================================================== *
 * Calm mobile ritual — product shell v2
 * ================================================================== */
:root {
  --paper: #f3eddf;
  --paper-deep: #e7ddca;
  --ink: #173b36;
  --ink-soft: #4b625d;
  --red: #df553f;
  --red-dark: #be3e2d;
  --on-red: #fff;
  --jade: #b8d1bd;
  --white: #fffdf7;
  --line: rgba(23,59,54,.14);
  /* Surfaces and tints; dark values below. */
  --on-ink: #fff;
  --surface: #f5f0e7;
  --muted: #eee5d5;
  --tint-red: #fbe9e4;
  --tint-green: #e2f3e7;
  --tint-amber: #fbf0d4;
  --amber: #e8a917;
  --on-amber: #3d2c06;
  --amber-ink: #805b17;
  --green: #2f8a5a;
  --green-ink: #1f6440;
  --stack-mastered: #2f8a5a;
  --stack-remembered: #9dc9a6;
  /* The Progress chart's bands: the garden's hues, stepped apart to stay distinct for colour-blind readers. */
  --growth-mastered: #16804a;
  --growth-remembered: #6cbd84;
  --growth-learning: #e07c38;
  --stack-learning: #efb88e;
  --strong: var(--ink);
  --on-strong: #fff;
  /* rgb triples for translucent surfaces: rgba(var(--glass-rgb), .7) */
  --glass-rgb: 255, 253, 247;
  --jade-rgb: 184, 209, 189;
  --hit: #2f6659;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #17251e;
  --paper-deep: #293e31;
  --ink: #e5ebd9;
  --ink-soft: #a1af9e;
  --red: #e38a68;
  --red-dark: #eba183;
  /* White on the lighter dark-mode red is under 3:1; ink reads at 6:1. */
  --on-red: #17251e;
  --jade: #91ac7f;
  --white: #203329;
  --line: rgba(229,235,217,.14);
  --on-ink: #17251e;
  --surface: #223629;
  --muted: #2a3f33;
  --tint-red: rgba(227,138,104,.18);
  --tint-green: rgba(126,196,146,.18);
  --tint-amber: rgba(232,169,23,.18);
  --amber: #e8b94a;
  --on-amber: #17251e;
  --amber-ink: #f0cf85;
  --green: #7ec492;
  --green-ink: #b6e3c1;
  --growth-mastered: #237f4d;
  --growth-remembered: #5cb47d;
  --growth-learning: #c9692a;
  --stack-mastered: #7ec492;
  --stack-remembered: #4f7a5c;
  --stack-learning: #b77a55;
  /* Big emphasised cards (today's review) stay dark green, lit a step above the page. */
  --strong: #2b4a3c;
  --on-strong: #eef3e6;
  --glass-rgb: 38, 58, 47;
  --jade-rgb: 96, 138, 98;
  --hit: #9fd6ae;
}
:root[data-theme="dark"] body { background: #111d17; }
:root[data-theme="dark"] .app-shell {
  background: radial-gradient(circle at 86% 4%, rgba(227,138,104,.1), transparent 30%), linear-gradient(155deg, #1b2c23, var(--paper));
}
:root[data-theme="dark"] .screen-header,
:root[data-theme="dark"] .screen-footer,
:root[data-theme="dark"] .bottom-nav { background: rgba(23,37,30,.94); }
:root[data-theme="dark"] .settings-sheet,
:root[data-theme="dark"] .settings-sheet .sheet-header,
:root[data-theme="dark"] .settings-footer { background: var(--white); }
:root[data-theme="dark"] .segmented button { background: var(--paper); color: var(--ink); }
:root[data-theme="dark"] .segmented button.is-selected { background: rgba(227,138,104,.2); color: var(--ink); }
:root[data-theme="dark"] .close-button { background: var(--paper-deep); color: var(--ink); }

/* The tab bar's height, reserved under every tabbed view. One value for both,
   so no strip of background shows between a view and the bar. */
.app-shell { --nav-h: calc(67px + var(--safe-bottom)); padding-bottom: var(--nav-h); }
.view { height: 100%; min-height: 0; }
.game-screen, .result-screen, .detail-screen { height: calc(100dvh / var(--ui-zoom, 1)); }
/* Full screens fit the shell, or their bottom actions are cut off. */
@media (min-width: 461px) { .game-screen, .result-screen, .detail-screen { height: 100%; } }
.home-screen { padding-bottom: 16px; }
.home-eyebrow { display: block; color: var(--ink-soft); font-size: 10.5px; font-weight: 800; letter-spacing: .14em; }
.home-hero { margin-top: 4px; }
.mascot-slot--hero { width: 112px; height: 112px; margin-bottom: 1px; }
.today-card { background: var(--strong); border-radius: 24px; }
.today-card .menu-primary { background: var(--red); color: var(--on-red); justify-content: center; }
.garden-card, .daily-word, .config-card, .activity-card, .growth-card, .week-card, .hard-card { box-shadow: 0 8px 28px -22px rgba(41,73,59,.28); }
/* The card of the day: the word on a cream tile, its pinyin and meaning beside it. */
.daily-word {
  display: grid; grid-template-columns: 102px minmax(0, 1fr) auto; align-items: center; gap: 16px; width: 100%;
  margin-top: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 20px;
  background: var(--white); color: var(--ink); font: inherit; text-align: left;
}
.daily-word__frame {
  position: relative; display: grid; width: 102px; height: 102px; place-items: center;
  border: 1.5px solid #c9b48a; border-radius: 16px; background: #fbf6ea;
}
.daily-word__frame b { font: 400 64px/1 "Noto Serif SC", serif; white-space: nowrap; }
.daily-word__frame b[data-len="2"] { font-size: 42px; }
.daily-word__frame b[data-len="3"] { font-size: 29px; }
.daily-word__frame b[data-len="4"] { font-size: 22px; }
.daily-word__frame small { position: absolute; bottom: -6px; left: 50%; translate: -50% 0; padding: 2px 7px; border-radius: 999px; background: var(--ink); color: var(--white); font-size: 10px; font-weight: 800; letter-spacing: .04em; white-space: nowrap; }
.daily-word__text { display: flex; min-width: 0; flex-direction: column; }
.daily-word__pinyin { margin-top: 8px; font-size: 20px; font-weight: 600; }
.daily-word__meaning { display: -webkit-box; margin-top: 4px; overflow: hidden; color: var(--ink-soft); font-size: 14px; line-height: 1.3; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.daily-word > .card-chevron { color: var(--ink-soft); }
:root[data-theme="dark"] .daily-word__frame { border-color: rgba(255,255,255,.25); background-color: transparent; }
:root[data-theme="dark"] .daily-word__frame small { background: #efe6d2; color: #173b36; }

.bottom-nav {
  position: absolute; z-index: 20; right: 0; bottom: 0; left: 0; display: grid;
  height: var(--nav-h); grid-template-columns: repeat(5,1fr); padding: 7px 6px calc(7px + var(--safe-bottom));
  border-top: 1px solid var(--line); background: rgba(var(--glass-rgb), .94);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.bottom-nav button { position: relative; display: flex; min-height: 52px; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; border-radius: 14px; background: transparent; color: var(--ink-soft); }
.bottom-nav button > span { display: grid; width: 34px; height: 25px; place-items: center; border-radius: 10px; font: 19px "Noto Serif SC", serif; }
.bottom-nav button > small { font-size: 11px; font-weight: 700; }
.bottom-nav button.is-active { color: var(--red-dark); }
.bottom-nav button.is-active > span { background: rgba(184,88,57,.12); }
.app-shell:has(.game-screen:not([hidden])) .bottom-nav,
.app-shell:has(.result-screen:not([hidden])) .bottom-nav,
.app-shell:has(.detail-screen:not([hidden])) .bottom-nav,
.app-shell:has(.onboarding:not([hidden])) .bottom-nav { display: none; }
/* Settings end with a close button; the nav would sit on top of it. */
.app-shell:has(.settings-sheet.is-open) .bottom-nav { display: none; }
/* The garden tab: "+N" words met since the garden was last opened, else a dot until it is first opened (syncGardenTab). */
.bottom-nav button > span { position: relative; }
.bottom-nav button.has-dot > span::after { content: ""; position: absolute; top: 1px; right: 1px; width: 8px; height: 8px; border: 2px solid rgb(var(--glass-rgb)); border-radius: 50%; background: var(--red); }
/* The dialogues tab: sparks until it is first opened (syncDialogsTab). */
.nav-spark { display: none; position: absolute; left: var(--x); top: var(--y); width: var(--s); height: var(--s); background: #ffc93c; clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); filter: drop-shadow(0 0 3px rgba(255, 201, 60, .9)); opacity: 0; animation: sticker-spark 2.4s var(--spark-delay) ease-in-out infinite; pointer-events: none; }
.bottom-nav button.has-sparks > span { color: var(--ink); text-shadow: 0 0 10px rgba(255, 201, 60, .75); }
.bottom-nav button.has-sparks .nav-spark { display: block; }
@media (prefers-reduced-motion: reduce) { .nav-spark { animation: none; opacity: 1; } }
.nav-gain { position: absolute; z-index: 1; top: -7px; left: 22px; min-width: 20px; padding: 0 5px; border: 2px solid rgb(var(--glass-rgb)); border-radius: 999px; background: var(--green); color: rgb(var(--glass-rgb)); font: 800 11px/16px system-ui, sans-serif; text-align: center; white-space: nowrap; pointer-events: none; }
.bottom-nav button.is-gaining .nav-gain { animation: nav-gain-pop .6s cubic-bezier(.2,.8,.3,1.4) .25s both; }
.bottom-nav button.is-gaining > span { animation: nav-gain-bounce .5s ease .25s; }
@keyframes nav-gain-pop { 0% { opacity: 0; transform: translateY(8px) scale(.4); } 60% { opacity: 1; transform: translateY(0) scale(1.2); } 100% { transform: none; } }
@keyframes nav-gain-bounce { 40% { transform: scale(1.18); } }
@media (prefers-reduced-motion: reduce) {
  .bottom-nav button.is-gaining .nav-gain, .bottom-nav button.is-gaining > span { animation: none; }
}
.app-shell:has(.game-screen:not([hidden])),
.app-shell:has(.result-screen:not([hidden])),
.app-shell:has(.detail-screen:not([hidden])),
.app-shell:has(.onboarding:not([hidden])) { padding-bottom: 0; }

.quiz-direction-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.quiz-direction-grid button { display: flex; min-height: 62px; flex-direction: column; justify-content: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 15px; background: var(--paper); text-align: left; }
.quiz-direction-grid button:first-child { grid-column: 1 / -1; min-height: 52px; align-items: center; }
.quiz-direction-grid b { font: 15px "Noto Serif SC", serif; }
.quiz-direction-grid span { display: flex; flex-grow: 1; align-items: center; margin-top: 2px; color: var(--ink-soft); font-size: 9px; font-weight: 700; }
.quiz-direction-grid button.is-selected { border-color: var(--red); background: rgba(184,88,57,.1); box-shadow: inset 0 0 0 1px var(--red); }
.quiz-hanzi.quiz-prompt--text { font-family: "Manrope", system-ui, sans-serif; font-size: clamp(24px, 8vw, 38px); line-height: 1.25; text-align: center; }
.probe-option--hanzi { font-family: "Noto Serif SC", serif; font-size: 28px; }

.stats-screen { display: flex; flex-direction: column; padding: max(14px, var(--safe-top)) 16px 10px; }
.stats-header { flex: 0 0 auto; }
.stats-header h1 { margin: 2px 0 0; font-size: 28px; }
.stats-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 0 18px; }
.dialogs-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 0 18px; }
/* No scrollbar: on phone widths it lay over the controls at the right edge (Ivan, 2026-10-29), as the chat's. */
.stats-scroll, .dialogs-scroll { scrollbar-width: none; }
.stats-scroll::-webkit-scrollbar, .dialogs-scroll::-webkit-scrollbar { display: none; }
.activity-card, .growth-card, .week-card, .hard-card { margin-top: 10px; padding: 17px; border: 1px solid var(--line); border-radius: 20px; background: var(--white); }
.growth-card { margin-top: 0; }
.growth-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.growth-card__head h2 { font-size: 21px; }
.growth-card__head span { display: block; margin-top: 3px; color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.growth-card__gain { flex-shrink: 0; padding: 5px 10px; border-radius: 99px; background: var(--tint-green); color: var(--green-ink); font-size: 13px; font-weight: 800; white-space: nowrap; }
.growth-card__empty { margin: 14px 0 4px; color: var(--ink-soft); font-size: 12px; }
.growth-card__eta { margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--line); color: var(--ink); font-size: 12px; font-weight: 700; }
.growth-chart { position: relative; margin-top: 8px; }
.growth-chart svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.growth-chart__area--mastered { fill: var(--growth-mastered); }
.growth-chart__area--remembered { fill: var(--growth-remembered); }
.growth-chart__area--learning { fill: var(--growth-learning); }
.growth-chart__edge { fill: none; stroke: var(--white); stroke-width: 1.5; stroke-linejoin: round; }
.growth-chart__grid { stroke: var(--line); stroke-dasharray: 2 3; }
.growth-chart__base { stroke: var(--line); }
.growth-chart__max, .growth-chart__day { fill: var(--ink-soft); font-size: 10px; font-weight: 700; }
.growth-chart__day--end { text-anchor: end; }
.growth-chart__cursor { stroke: var(--ink); stroke-width: 1; opacity: .5; }
.growth-chart__dot { fill: var(--ink); stroke: var(--white); stroke-width: 2; }
.growth-chart__tip { position: absolute; top: -4px; margin: 0; padding: 5px 8px; border-radius: 8px; background: var(--ink); color: var(--white); font-size: 10px; font-weight: 700; white-space: nowrap; pointer-events: none; }
.growth-chart__tip[data-side="right"] { transform: translateX(8px); }
.growth-chart__tip[data-side="left"] { transform: translateX(calc(-100% - 8px)); }
.growth-legend { margin-top: 6px; }
.growth-legend__item--mastered i { background: var(--growth-mastered); }
.growth-legend__item--remembered i { background: var(--growth-remembered); }
.growth-legend__item--learning i { background: var(--growth-learning); }
.week-rows { display: grid; gap: 2px; }
.week-row { display: grid; grid-template-columns: 1fr auto 58px; align-items: baseline; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; }
.week-row:first-child { border-top: 0; padding-top: 0; }
.week-row span { color: var(--ink-soft); font-weight: 700; }
.week-row b { font-size: 17px; letter-spacing: -.02em; }
.week-row small { color: var(--ink-soft); font-size: 11px; font-weight: 700; text-align: right; }
.week-row small.is-up { color: var(--green-ink); }
.activity-heatmap { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; gap: 3px; }
.heat-cell { aspect-ratio: 1; border-radius: 3px; background: var(--paper-deep); }
.heat-cell.is-future { visibility: hidden; }
.heat-cell.is-today { box-shadow: inset 0 0 0 1.5px var(--ink); }
.activity-heatmap .heat-cell { cursor: pointer; }
.heat-cell.is-open { box-shadow: 0 0 0 2px var(--red); }
/* A tapped day's numbers, over the day (Progress → Rhythm). */
.activity-card { position: relative; }
.day-stats { position: absolute; z-index: 5; box-sizing: border-box; min-width: 168px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); box-shadow: var(--shadow); color: var(--ink); }
.day-stats[hidden] { display: none; }
.day-stats::after { content: ""; position: absolute; bottom: -6px; left: calc(var(--arrow, 50%) - 6px); width: 10px; height: 10px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--white); transform: rotate(45deg); }
.day-stats.is-below::after { top: -6px; bottom: auto; border: 0; border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
.day-stats__day { display: block; margin-bottom: 4px; font-size: 13px; font-weight: 800; }
.day-stats__row { display: flex; justify-content: space-between; gap: 14px; padding: 3px 0; font-size: 12px; }
.day-stats__row span { color: var(--ink-soft); font-weight: 700; }
.day-stats__row b { font-size: 13px; }
.heat-cell[data-level="1"] { background: #d6e1cb; }.heat-cell[data-level="2"] { background: #adc39d; }.heat-cell[data-level="3"] { background: #7e9e70; }.heat-cell[data-level="4"] { background: #55784f; }
.hard-list { display: flex; flex-wrap: wrap; gap: 8px; }
.hard-list button { display: grid; min-width: 52px; height: 56px; padding: 0 8px; place-items: center; align-content: center; gap: 1px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); cursor: pointer; }
.hard-list b { font-family: "Noto Serif SC", serif; font-size: 24px; font-weight: 600; line-height: 1; white-space: nowrap; }
.hard-list small { color: var(--ink-soft); font-size: 10px; font-weight: 700; white-space: nowrap; }

/* Skills hexagon: the card page's (over the learner's average) and Progress's own. */
.skill-card { margin-top: 12px; padding: 14px 14px 12px; border: 1px solid var(--line); border-radius: 20px; background: var(--white); }
.skill-card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.skill-card__head h3 { margin: 0; font-size: 15px; }
.skill-legend { display: flex; gap: 10px; color: var(--ink-soft); font-size: 10px; font-weight: 700; }
.skill-legend > span { display: inline-flex; align-items: center; gap: 4px; }
.skill-legend__word::before { content: ""; width: 12px; height: 8px; border: 2px solid var(--red); border-radius: 3px; background: color-mix(in srgb, var(--red) 22%, transparent); }
.skill-legend__average::before { content: ""; width: 14px; border-top: 2px dashed var(--ink-soft); }
.skill-radar { max-width: 340px; margin: 2px auto 0; }
.skill-radar svg { display: block; width: 100%; height: auto; overflow: visible; }
.skill-radar__ring { fill: none; stroke: var(--line); stroke-width: 1; }
.skill-radar__ring--outer { fill: color-mix(in srgb, var(--paper-deep) 45%, transparent); stroke-width: 1.5; }
.skill-radar__spoke { stroke: var(--line); stroke-dasharray: 2 3; }
.skill-radar__ghost { fill: none; stroke: var(--ink-soft); stroke-width: 1.5; stroke-dasharray: 5 4; stroke-linejoin: round; opacity: .75; }
.skill-radar__shape { transform-origin: 160px 150px; animation: skill-radar-grow .75s cubic-bezier(.2, .9, .3, 1.15) both; }
.skill-radar__area { fill: color-mix(in srgb, var(--red) 24%, transparent); stroke: var(--red); stroke-width: 2.5; stroke-linejoin: round; }
.skill-radar__dot { fill: var(--white); stroke: var(--red); stroke-width: 2.5; transform-box: fill-box; transform-origin: center; animation: skill-radar-pop .35s ease-out both; animation-delay: calc(.45s + var(--i) * 60ms); }
.skill-radar__dot.is-strong { fill: var(--red); }
.skill-radar__empty { fill: var(--ink-soft); font-size: 11px; font-weight: 700; text-anchor: middle; }
.skill-radar__seal { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.skill-radar__corner[data-level="strong"] .skill-radar__seal { fill: var(--tint-green); stroke: var(--green); }
.skill-radar__corner[data-level="middle"] .skill-radar__seal { fill: var(--surface); stroke: var(--ink-soft); }
.skill-radar__corner[data-level="weak"] .skill-radar__seal { fill: var(--tint-red); stroke: var(--red); }
.skill-radar__corner[data-level="none"] .skill-radar__seal { fill: none; stroke-dasharray: 3 3; }
.skill-radar__corner[data-level="none"] text { opacity: .55; }
.skill-radar__glyph { fill: var(--ink); font-family: "Noto Serif SC", serif; font-size: 15px; font-weight: 600; text-anchor: middle; }
.skill-radar__label { fill: var(--ink-soft); font-size: 10.5px; font-weight: 700; text-anchor: middle; }
.skill-radar__count { fill: var(--ink); font-weight: 800; }
@keyframes skill-radar-grow { from { transform: scale(.05); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes skill-radar-pop { from { transform: scale(0); } 70% { transform: scale(1.35); } to { transform: scale(1); } }
.skill-rows { display: grid; margin-top: 4px; }
.skill-row { display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 2px 10px; padding: 8px 2px; border-top: 1px solid var(--line); }
.skill-row__seal { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; background: var(--surface); font-family: "Noto Serif SC", serif; font-size: 14px; font-weight: 600; grid-row: span 2; }
.skill-row__text { display: grid; gap: 1px; min-width: 0; }
.skill-row__text b { font-size: 12.5px; }
.skill-row__text small { color: var(--ink-soft); font-size: 11px; font-weight: 600; }
.skill-row__bar { height: 4px; overflow: hidden; border-radius: 99px; background: rgba(23,59,54,.1); }
.skill-row__bar > span { display: block; height: 100%; border-radius: inherit; background: var(--red); transform-origin: left; }
.skill-row.is-untried { opacity: .6; }
.skill-row.is-untried .skill-row__seal { background: none; box-shadow: inset 0 0 0 1.5px var(--line); }
.skill-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 4px; }
.skill-more { margin-top: 10px; border-top: 1px solid var(--line); }
.skill-more > summary { display: flex; align-items: center; justify-content: space-between; min-height: 40px; padding-top: 2px; color: var(--ink); font-size: 12.5px; font-weight: 800; list-style: none; cursor: pointer; }
.skill-more > summary::-webkit-details-marker { display: none; }
.skill-more > summary::after { content: "›"; color: var(--ink-soft); font-size: 18px; line-height: 1; transform: rotate(90deg); transition: transform .2s ease; }
.skill-more[open] > summary::after { transform: rotate(-90deg); }
.skill-more .skill-rows { margin-top: 0; }
.skill-tile { display: grid; align-content: start; gap: 3px; min-width: 0; padding: 8px 9px; border-radius: 12px; background: var(--surface); }
.skill-tile small { color: var(--ink-soft); font-size: 10px; font-weight: 700; line-height: 1.2; }
.skill-tile b { font-size: 13px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.skill-recent { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.skill-recent__label { color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.skill-dots { display: flex; gap: 4px; flex-wrap: wrap; }
.skill-dot { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 50%; background: var(--tint-red); box-shadow: inset 0 0 0 1.5px var(--red); color: var(--red-dark); font-family: "Noto Serif SC", serif; font-size: 11px; font-weight: 600; }
.skill-dot.is-right { background: var(--tint-green); box-shadow: inset 0 0 0 1.5px var(--green); color: var(--green-ink); }
.skill-since { margin: 8px 0 0; color: var(--ink-soft); font-size: 11px; font-weight: 600; }
.skills-card { margin-top: 10px; padding: 17px; border: 1px solid var(--line); border-radius: 20px; background: var(--white); box-shadow: 0 8px 28px -22px rgba(41,73,59,.28); }
.weak-block { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.weak-block h3 { margin: 0 0 8px; font-size: 14px; }
.weak-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.weak-chip { min-height: 30px; padding: 0 11px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--ink); font-size: 11.5px; font-weight: 800; cursor: pointer; }
.weak-chip span { font-family: "Noto Serif SC", serif; font-weight: 600; }
.weak-chip[aria-pressed="true"] { border-color: var(--strong); background: var(--strong); color: var(--on-strong); }
@media (prefers-reduced-motion: reduce) { .skill-radar__shape, .skill-radar__dot { animation: none; } }

.skill-radar [data-skill] { cursor: pointer; }
.skill-about { margin: 4px 2px 0; color: var(--ink-soft); font-size: 12px; font-weight: 600; line-height: 1.4; text-align: center; }
.skill-about b { color: var(--ink); font-weight: 800; }
/* The skills chart's other looks (web/skill-charts.js): fan, wheel, scrolls. */
.skill-radar:has(.skill-chart--fan) { max-width: 360px; }
.skill-fan__paper { fill: #f6efe0; }
.skill-fan__art { opacity: .95; }
.skill-fan__fill { fill: color-mix(in srgb, var(--red) 78%, transparent); mix-blend-mode: multiply; }
.skill-fan__fold { stroke: rgba(120, 92, 60, .16); stroke-width: 1; }
.skill-fan__edge { fill: none; stroke: rgba(120, 92, 60, .38); stroke-width: 1; stroke-linejoin: round; }
.skill-fan__ghost { fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-dasharray: 4 3; stroke-linecap: round; opacity: .8; }
.skill-fan__leaf[data-level="none"] .skill-fan__art { opacity: .55; }
.skill-fan__leaf, .skill-fan__stick { transform-box: view-box; transform-origin: 180px 202px; animation: skill-fan-open .8s cubic-bezier(.2, .85, .25, 1) both; animation-delay: calc(var(--i) * 25ms); }
.skill-fan__stick { stroke: #c9a676; stroke-width: 3; stroke-linecap: round; }
.skill-fan__stick.is-guard { stroke: #a7824f; stroke-width: 5; }
.skill-fan__pin { fill: #b48a55; stroke: #8a6538; stroke-width: 1.5; }
.skill-fan__pin-dot { fill: #6f4f29; }
.skill-fan__cord { stroke: var(--red); stroke-width: 1.6; fill: none; }
.skill-fan__knot, .skill-fan__tassel { fill: var(--red); }
@keyframes skill-fan-open { from { transform: rotate(var(--turn)); } to { transform: rotate(0); } }
.skill-wheel__tile { fill: var(--surface); stroke: var(--line); stroke-width: 1.2; }
.skill-wheel__track { fill: none; stroke: var(--line); stroke-width: 5; stroke-linecap: round; }
.skill-wheel__arc { fill: none; stroke: var(--red); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 400; stroke-dashoffset: 0; animation: skill-wheel-draw .9s ease-out both; animation-delay: calc(var(--i) * 70ms); }
.skill-wheel__ghost { stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.skill-wheel__hub { fill: var(--paper-deep); stroke: var(--line); stroke-width: 1.5; }
.skill-wheel__hub-glyph { fill: var(--red); font-family: "Noto Serif SC", serif; font-size: 26px; font-weight: 600; text-anchor: middle; }
@keyframes skill-wheel-draw { from { stroke-dashoffset: 400; } }
.skill-chart__name { font-size: 9.5px; }
.skill-chart__value { font-size: 12px; text-anchor: middle; }
.skill-scroll__ghost { stroke: var(--ink); stroke-width: 1.8; stroke-dasharray: 4 3; stroke-linecap: round; }
.skill-scroll__ghost { stroke: #173b36; }
/* The scrolls are light paper in both themes, so their writing stays dark. */
.skill-scroll .skill-radar__glyph { fill: #173b36; }
.skill-chart--scrolls .skill-radar__corner[data-level] .skill-radar__seal { fill: #fbf6ea; stroke: #5b6f66; }
.skill-chart--scrolls .skill-radar__corner[data-level="strong"] .skill-radar__seal { fill: #e3f0e4; stroke: #2f7a52; }
.skill-chart--scrolls .skill-radar__corner[data-level="weak"] .skill-radar__seal { fill: #fbe5df; stroke: #d9543f; }
.skill-chart--scrolls .skill-radar__corner[data-level="none"] .skill-radar__seal { fill: none; stroke: #9aa59f; }
.skill-scroll__rod { fill: none; stroke: #8a6538; stroke-width: 3; stroke-linecap: round; }
.skill-scroll__knob { fill: #6f4f29; }
.skill-scroll__string { stroke: #8a6538; stroke-width: 1; }
.skill-scroll__paper { fill: #f6efe0; stroke: rgba(120, 92, 60, .3); stroke-width: 1; }
.skill-scroll[data-level="none"] .skill-scroll__art { opacity: .6; }
.skill-scroll__gauge { fill: rgba(251, 246, 234, .7); stroke: rgba(120, 92, 60, .3); stroke-width: 1; }
.skill-scroll[data-level="none"] .skill-scroll__gauge { fill: none; stroke-dasharray: 3 3; }
.skill-scroll__level { fill: color-mix(in srgb, var(--red) 75%, transparent); transform-box: fill-box; transform-origin: bottom; animation: skill-grow-up .9s cubic-bezier(.2, .9, .3, 1) both; animation-delay: calc(var(--i) * 70ms); }
/* Scroll paper stays light in the dark theme, so its writing stays dark. */
.skill-scroll .skill-radar__label, .skill-scroll .skill-chart__value { fill: #29493b; }
@keyframes skill-grow-up { from { transform: scaleY(0); } }
@media (prefers-reduced-motion: reduce) { .skill-fan__leaf, .skill-fan__stick, .skill-wheel__arc, .skill-scroll__level { animation: none; } }
.achievements-card__next { margin-top: 2px; }

.onboarding { position: absolute; z-index: 50; inset: 0; display: flex; flex-direction: column; background: var(--paper); }
/* Continue waits for the step's task (a quiz answer, a pace, a tone) or its entrance. On a task it names the task in a dashed outline;
   for a moment only it stays red and fills up from the left (--lock-ms), so it never looks like a dead grey button. */
#onboardingNext.is-locked { cursor: default; }
#onboardingNext.is-task { background: var(--surface); color: var(--red); box-shadow: none; outline: 2px dashed color-mix(in srgb, var(--red) 55%, transparent); outline-offset: -2px; font-size: 15px; line-height: 1.25; white-space: normal; text-wrap: balance; }
#onboardingNext.is-filling { position: relative; overflow: hidden; background: color-mix(in srgb, var(--red) 55%, var(--paper)); box-shadow: none; }
#onboardingNext.is-filling::before { content: ""; position: absolute; inset: 0; background: var(--red); transform-origin: left; animation: ob-fill var(--lock-ms, .9s) linear both; }
#onboardingNext.is-filling > span { position: relative; }
#onboardingNext:not(.is-locked) { animation: ob-ready .35s cubic-bezier(.3,1.6,.5,1); }
@keyframes ob-fill { from { transform: scaleX(0); } }
@keyframes ob-ready { 50% { transform: scale(1.03); } }
@media (prefers-reduced-motion: reduce) { #onboardingNext.is-filling::before, #onboardingNext:not(.is-locked) { animation: none; } }
/* A level above HSK 1 waits for its cards before the first round. */
#onboardingNext.is-waiting { opacity: .7; cursor: progress; }
.onboarding__hint { margin: 0 0 8px; color: var(--ink-soft); font-size: 13px; font-weight: 800; text-align: center; }
.is-nudged { animation: ob-nudge .45s cubic-bezier(.3,1.6,.5,1); }
@keyframes ob-nudge { 20% { translate: -6px 0; } 45% { translate: 5px 0; } 70% { translate: -3px 0; } }
.onboarding__header { display: flex; min-height: 70px; align-items: center; justify-content: space-between; padding: max(12px, var(--safe-top)) 20px 8px; }
.onboarding__progress { display: flex; gap: 6px; padding: 5px 20px; }
.onboarding__progress span { height: 5px; flex: 1; border-radius: 5px; background: var(--paper-deep); }
.onboarding__progress span.is-done { background: var(--red); }
.onboarding__body { display: flex; flex: 1; min-height: 0; flex-direction: column; align-items: center; justify-content: center; padding: 10px 28px; text-align: center; }
.onboarding__mascot { width: min(230px, calc(56vw / var(--ui-zoom, 1))); height: min(230px, calc(29dvh / var(--ui-zoom, 1))); margin-bottom: 12px; }
/*
 * The forgetting curve (memory-curve.js). Everything is drawn in its final
 * state and animates from hidden (fill-mode both), so reduced motion simply
 * shows the finished graph.
 */
.onboarding__mascot.memory-curve { position: relative; display: block; width: min(340px, calc(88vw / var(--ui-zoom, 1))); height: auto; }
.memory-curve__plot { position: relative; }
.memory-curve svg { display: block; width: 100%; height: auto; overflow: visible; }
.memory-curve__frame { fill: none; stroke: var(--line); stroke-width: 2; stroke-linecap: round; }
.memory-curve__grid { stroke: var(--red); stroke-width: 1.5; stroke-dasharray: 4 5; opacity: .35; }
.memory-curve__axis { fill: var(--ink-soft); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.memory-curve__tick { stroke: var(--line); stroke-width: 2; }
.memory-curve__day { fill: var(--ink-soft); font-size: 9.5px; font-weight: 800; text-anchor: middle; }
/* Each stretch between reviews: fragile red at first, bold gold once mastered. */
.memory-curve { --curve-0: #e0553f; --curve-1: #ef8b35; --curve-2: #a7b53a; --curve-3: #2f8a5a; --curve-4: #e8a917; }
:root[data-theme="dark"] .memory-curve { --curve-3: #7ec492; --curve-4: #f4c64f; }
.memory-curve__line { fill: none; stroke: var(--curve); stroke-width: var(--weight); stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: var(--len); animation: curve-draw var(--dur) linear var(--delay) both; }
.memory-curve__line--0 { --curve: var(--curve-0); --weight: 3; }
.memory-curve__line--1 { --curve: var(--curve-1); --weight: 3.5; }
.memory-curve__line--2 { --curve: var(--curve-2); --weight: 4; }
.memory-curve__line--3 { --curve: var(--curve-3); --weight: 4.5; }
.memory-curve__line--4 { --curve: var(--curve-4); --weight: 6; filter: drop-shadow(0 0 4px rgba(232,169,23,.55)); }
.memory-curve__dot { stroke: var(--white); stroke-width: 2.5; animation: curve-pop .45s cubic-bezier(.3,1.6,.5,1) var(--delay) both; }
.memory-curve__dot--1 { fill: var(--curve-1); } .memory-curve__dot--2 { fill: var(--curve-2); } .memory-curve__dot--3 { fill: var(--curve-3); } .memory-curve__dot--4 { fill: var(--curve-4); }
/* State badges stand on their review points. */
.memory-curve__badge { position: absolute; padding: 3px 7px; border-radius: 99px; font-size: 10.5px; font-weight: 800; white-space: nowrap; box-shadow: 0 3px 8px rgba(37,45,34,.12); translate: -50% calc(-100% - 9px); animation: curve-badge .45s cubic-bezier(.3,1.6,.5,1) var(--delay) both; }
.memory-curve__badge--1 { background: #fde3c8; color: #7a3a0c; }
.memory-curve__badge--3 { background: #d3ecdc; color: #1f6440; }
.memory-curve__badge--4 { background: #f6c64a; color: #4c2a05; }
/* On top of the Mastered badge (its left/top are the day-30 point). */
.memory-curve__sticker { position: absolute; --sticker: 56px; height: 56px; margin: calc(-92px - var(--pad)) 0 0 calc(-28px - var(--pad)); }
@keyframes curve-draw { 0% { stroke-dashoffset: var(--len); opacity: 0; } 1% { opacity: 1; } 100% { stroke-dashoffset: 0; } }
@keyframes curve-pop { from { opacity: 0; scale: .2; } }
@keyframes curve-badge { from { opacity: 0; scale: .4; } }
@media (prefers-reduced-motion: reduce) { .memory-curve__line, .memory-curve__dot, .memory-curve__badge { animation: none; } }
.onboarding__body h1 { max-width: 340px; margin: 12px 0 10px; font-size: 32px; line-height: 1.12; letter-spacing: -.05em; }
.onboarding__body > p { max-width: 330px; margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.6; }
.onboarding__demo { display: flex; min-width: 230px; margin-top: 24px; align-items: center; justify-content: center; gap: 14px; padding: 14px 16px 14px 22px; border: 1px solid var(--line); border-radius: 22px; background: var(--white); }
.onboarding__demo .ob-tea { font: 58px "Noto Serif SC", serif; }
.ob-tea-reading { display: grid; justify-items: start; gap: 1px; text-align: left; }
.onboarding__demo b { font-size: 20px; }.onboarding__demo small { color: var(--ink-soft); font-size: 14px; font-weight: 700; }
.onboarding__footer { padding: 12px 20px max(16px, var(--safe-bottom)); }
.onboarding__footer .menu-primary { justify-content: center; background: var(--red); color: var(--on-red); }
.onboarding__footer .menu-primary:disabled { background: var(--muted); color: var(--ink-soft); }

/*
 * Onboarding scenes (onboarding-scenes.js). Each step replays its entrance:
 * the body's children rise in one after another. Decorations animate from
 * hidden with fill-mode both, so reduced motion shows the finished scene.
 */
.onboarding__body { justify-content: safe center; overflow-y: auto; }
.onboarding__body.is-entering > * { animation: ob-enter .5s cubic-bezier(.2,.8,.25,1) both; }
.onboarding__body.is-entering > :nth-child(2) { animation-delay: .07s; }
.onboarding__body.is-entering > :nth-child(3) { animation-delay: .12s; }
.onboarding__body.is-entering > :nth-child(n+4) { animation-delay: .18s; }
.onboarding__body.is-entering > :nth-child(n+6) { animation-delay: .26s; }
.onboarding__body.is-entering .onboarding__stage:is([data-scene="bao"], [data-scene="year"]) .mascot { animation: ob-bao-hop .75s cubic-bezier(.3,1.4,.5,1) both; transform-origin: 50% 90%; }
@keyframes ob-enter { from { opacity: 0; transform: translateY(14px); } }
@keyframes ob-bao-hop { 0% { opacity: 0; transform: translateY(18px) scale(.8, .86); } 55% { opacity: 1; transform: translateY(-10px) scale(.96, 1.05); } 78% { transform: scale(1.05, .95); } 100% { transform: none; } }
#onboardingProgress span.is-current { position: relative; overflow: hidden; background: var(--paper-deep); }
#onboardingProgress span.is-current::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--red); transform-origin: left; animation: ob-fill .55s .1s ease-out both; }
@keyframes ob-fill { from { transform: scaleX(0); } }

.onboarding__stage { position: relative; display: flex; justify-content: center; }
.onboarding__fx { position: absolute; inset: 0; pointer-events: none; }
.onboarding__stage[data-scene="year"] .onboarding__mascot { width: 118px; height: 118px; margin-bottom: 0; }
/* The level step's stairs and Bao stand under the text: no stage above it. */
.onboarding__stage[data-scene="level"] { display: none; }
/* The language step leaves room for the list under the text. */
.onboarding__stage[data-scene="language"] .onboarding__mascot { width: min(150px, calc(38vw / var(--ui-zoom, 1))); height: min(150px, calc(18dvh / var(--ui-zoom, 1))); margin-bottom: 4px; }

/* Step 1: steam rises off the bun, and Bao says 你好. */
.ob-steam { position: absolute; top: 2%; left: calc(38% + var(--i) * 10%); width: 16px; height: 46px; overflow: visible; fill: none; stroke: var(--ink-soft); stroke-width: 3; stroke-linecap: round; opacity: 0; animation: ob-steam 2.8s calc(.6s + var(--i) * .55s) ease-out infinite; }
@keyframes ob-steam { 0% { opacity: 0; transform: translateY(12px) scaleY(.6); } 30% { opacity: .38; } 100% { opacity: 0; transform: translateY(-26px) scaleY(1.1); } }
.ob-hello { position: absolute; top: 12%; right: calc(50% - min(150px, calc(40vw / var(--ui-zoom, 1)))); padding: 6px 11px; border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; background: var(--white); color: var(--red); font: 800 17px "Noto Serif SC", serif; box-shadow: 0 10px 22px -14px rgba(41,73,59,.5); animation: ob-pop .5s .55s cubic-bezier(.3,1.6,.5,1) both, ob-float 3.2s 1.1s ease-in-out infinite; }
@keyframes ob-pop { from { opacity: 0; scale: .3; } }
@keyframes ob-float { 50% { translate: 0 -4px; } }

/* Step 2: 茶 is inked in, and the tea steams. */
.onboarding__demo { position: relative; }
.ob-tea { position: relative; }
.onboarding__demo:not([hidden]) .ob-tea { animation: ob-ink 1s .3s cubic-bezier(.3,.7,.3,1) both; }
.onboarding__demo:not([hidden]) b, .onboarding__demo:not([hidden]) .ob-tea-reading small { animation: ob-enter .45s both; }
.onboarding__demo:not([hidden]) b { animation-delay: .9s; }
.onboarding__demo:not([hidden]) .ob-tea-reading small { animation-delay: 1.05s; }
/* Negative insets leave room for the steam above the glyph. */
@keyframes ob-ink { from { clip-path: inset(-150% 100% -20% -20%); filter: blur(4px); } 60% { filter: blur(0); } to { clip-path: inset(-150% -20% -20% -20%); } }
.ob-tea-steam { position: absolute; bottom: 88%; left: 50%; width: 0; height: 0; }
.ob-tea-steam svg { position: absolute; bottom: 0; left: calc(var(--x) - 6px); width: 12px; height: 34px; overflow: visible; fill: none; stroke: var(--ink-soft); stroke-width: 3; stroke-linecap: round; opacity: 0; animation: ob-steam 2.6s var(--d) ease-out infinite; }
.ob-tea-steam svg:nth-child(1) { --x: -12px; --d: 1.2s; }
.ob-tea-steam svg:nth-child(2) { --x: 2px; --d: 1.8s; }
.ob-tea-steam svg:nth-child(3) { --x: 15px; --d: 2.4s; }

/* The tea card's play button: it pulses until heard, and shows sound waves while playing. */
.ob-speak { position: relative; display: grid; flex: none; place-items: center; width: 50px; height: 50px; border: 0; border-radius: 50%; background: linear-gradient(135deg, #fa8466, #cf4934); color: #fff; box-shadow: 0 6px 16px rgba(223,85,63,.34); cursor: pointer; transition: transform .15s; }
.ob-speak:active { transform: scale(.93); }
.ob-speak svg { width: 25px; height: 25px; }
.ob-speak::before { content: ""; position: absolute; inset: -5px; border: 2px solid var(--red); border-radius: 50%; opacity: 0; animation: ob-speak-ring 1.9s 1.3s ease-out infinite; pointer-events: none; }
.onboarding__demo.is-heard .ob-speak::before { animation: none; }
.onboarding__demo:not([hidden]) .ob-speak { animation: ob-pop .5s 1.1s cubic-bezier(.3,1.6,.5,1) both; }
/* Until the first tap it also breathes inside a second ring: with one faint ring only ~60 % found it. */
.ob-speak::after { content: ""; position: absolute; inset: -5px; border: 2px solid var(--red); border-radius: 50%; opacity: 0; animation: ob-speak-ring 1.9s 2.25s ease-out infinite; pointer-events: none; }
.onboarding__demo.is-heard .ob-speak::after { animation: none; }
.onboarding__demo:not([hidden]):not(.is-heard) .ob-speak { animation: ob-pop .5s 1.1s cubic-bezier(.3,1.6,.5,1) both, ob-speak-breathe 1.9s 1.3s ease-in-out infinite; }
@keyframes ob-speak-breathe { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.12); box-shadow: 0 8px 24px rgba(223,85,63,.55); } }
.ob-speak.is-playing .ob-wave { animation: ob-wave .7s ease-in-out infinite; }
.ob-speak.is-playing .ob-wave--2 { animation-delay: .18s; }
@keyframes ob-speak-ring { 0% { opacity: .75; transform: scale(.9); } 100% { opacity: 0; transform: scale(1.4); } }
@keyframes ob-wave { 50% { opacity: .2; } }
/* A speaker button while its sound plays: the waves pulse (app.js marks the tapped button .is-sounding). */
.is-sounding svg path:nth-of-type(2), .is-sounding svg path:nth-of-type(3) { animation: ob-wave .7s ease-in-out infinite; }
.is-sounding svg path:nth-of-type(3) { animation-delay: .18s; }
@media (prefers-reduced-motion: reduce) { .is-sounding svg path { animation: none !important; } }
.ob-spark { position: absolute; left: var(--x); top: var(--y); width: var(--s, 12px); height: var(--s, 12px); background: #ffc93c; clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); opacity: 0; animation: sticker-spark 2.4s var(--spark-delay, .85s) ease-in-out infinite; pointer-events: none; }

/* Step 5: the pace chart (pace-chart.js). */
.onboarding__mascot.pace-chart { position: relative; display: block; width: min(340px, calc(88vw / var(--ui-zoom, 1))); height: auto; margin-bottom: 4px; }
.pace-chart__plot { position: relative; margin-top: 16px; }
.pace-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.pace-chart__band--1 { fill: var(--tint-red); opacity: .7; }
.pace-chart__band--2 { fill: var(--tint-green); opacity: .7; }
.pace-chart__band--3 { fill: var(--tint-red); opacity: .45; }
.pace-chart__band--4 { fill: var(--tint-green); opacity: .45; }
.pace-chart__band--5 { fill: var(--tint-red); opacity: .3; }
.pace-chart__level { stroke: var(--ink-soft); stroke-width: 1.2; stroke-dasharray: 3 4; opacity: .4; }
.pace-chart__band-label { fill: var(--ink-soft); font-size: 9px; font-weight: 900; letter-spacing: .04em; text-anchor: start; }
.pace-chart__frame { fill: none; stroke: var(--line); stroke-width: 2; stroke-linecap: round; }
.pace-chart__axis { fill: var(--ink-soft); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.pace-chart__tick { stroke: var(--line); stroke-width: 2; }
.pace-chart__month { fill: var(--ink-soft); font-size: 9.5px; font-weight: 800; text-anchor: middle; }
.pace-chart__line { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.pace-chart__line--other { stroke: var(--ink-soft); stroke-width: 2.5; opacity: .22; }
.pace-chart__line--chosen { stroke: var(--red); stroke-width: 5; stroke-dasharray: 1; filter: drop-shadow(0 3px 5px rgba(223,85,63,.35)); animation: pace-draw var(--dur) cubic-bezier(.4,.1,.3,1) var(--delay) both; }
@keyframes pace-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.pace-chart__dot { fill: var(--white); stroke: var(--red); stroke-width: 3; animation: curve-pop .45s cubic-bezier(.3,1.6,.5,1) var(--delay) both; }
.pace-chart__end { fill: var(--red); font-size: 12px; font-weight: 900; text-anchor: end; animation: curve-pop .45s cubic-bezier(.3,1.6,.5,1) var(--delay) both; }
.pace-chart__badge { position: absolute; padding: 3px 8px; border-radius: 99px; background: var(--ink); color: var(--paper); font-size: 10.5px; font-weight: 800; white-space: nowrap; box-shadow: 0 3px 8px rgba(37,45,34,.18); translate: -50% calc(-100% - 9px); animation: curve-badge .45s cubic-bezier(.3,1.6,.5,1) var(--delay) both; }
.pace-chart__badge--up { translate: -14px calc(-100% - 9px); }
.pace-chart__badge--below { translate: 10px 6px; }
.pace-chart__badge--left { translate: calc(-100% - 8px) calc(-50% - 24px); }

/* Step 5: minutes a day, and Bao's comment on the choice. */
.ob-pace { width: min(340px, 100%); margin-top: 14px; }
.ob-pace__options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.ob-pace__options button { display: grid; justify-items: center; gap: 1px; padding: 9px 4px 8px; border: 1px solid var(--line); border-radius: 16px; background: var(--white); color: var(--ink); font: inherit; cursor: pointer; transition: border-color .2s, background .2s, transform .2s cubic-bezier(.3,1.6,.5,1); }
.ob-pace__options b { font-size: 24px; line-height: 1; letter-spacing: -.04em; }
.ob-pace__options span { color: var(--ink-soft); font-size: 11px; font-weight: 800; }
.ob-pace__options small { color: var(--ink-soft); font-size: 10.5px; font-weight: 700; }
.ob-pace__options button[aria-checked="true"] { border-color: var(--red); background: var(--tint-red); box-shadow: inset 0 0 0 1px var(--red); transform: translateY(-3px); }
.ob-pace__options button[aria-checked="true"] b { color: var(--red); }
.ob-pace__bao { display: flex; align-items: center; gap: 10px; margin-top: 12px; text-align: left; }
.ob-pace__mascot { flex: none; width: 64px; height: 64px; }
.ob-pace__sticker { display: block; width: 100%; height: 100%; object-fit: contain; }
.ob-pace__sticker.is-reacting { animation: ob-bao-hop .6s cubic-bezier(.3,1.4,.5,1); transform-origin: 50% 90%; }
.ob-pace__mascot .mascot.is-reacting { animation: ob-bao-hop .6s cubic-bezier(.3,1.4,.5,1); transform-origin: 50% 90%; }
.ob-pace__line { flex: 1; min-height: 3.9em; margin: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 16px 16px 16px 5px; background: var(--white); color: var(--ink); font-size: 13px; font-weight: 700; line-height: 1.38; }
.ob-pace__line.is-reacting { animation: result-bao-line .35s ease-out; }
.ob-pace__more { margin: 10px 2px 0; color: var(--ink-soft); font-size: 12px; font-weight: 700; line-height: 1.35; }
/* A wide, short screen (a tablet on its side at a larger text size): the chart beside the question, so Bao's line
 * isn't left under Continue (Ivan's 2019 iPad, 2026-11-03). */
@media (min-width: 760px) and (max-height: 640px) {
  /* Wider than the tour's column (styles.css, .onboarding padding-inline), within the window. */
  .onboarding__body:has(> .onboarding__stage[data-scene="pace"]) { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 340px); column-gap: 36px; align-content: center; justify-content: center; justify-items: center; margin-inline: min(0px, (560px - 100vw / var(--ui-zoom, 1)) / 2 + 24px); }
  .onboarding__body:has(> .onboarding__stage[data-scene="pace"]) > .onboarding__stage { grid-column: 1; grid-row: 1 / span 12; align-self: center; }
  .onboarding__body:has(> .onboarding__stage[data-scene="pace"]) > :not(.onboarding__stage) { grid-column: 2; }
}

/* Step 6: a year of five-minute days. */
.ob-year { width: min(330px, 100%); margin: 2px 0 12px; }
.ob-year__count b { display: block; color: var(--red); font-size: 44px; line-height: 1; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.ob-year__count small { color: var(--ink-soft); font-size: 12px; font-weight: 800; }
.ob-year__calendar { position: relative; margin-top: 30px; }
.ob-year__grid { display: grid; grid-template-rows: repeat(7, 1fr); grid-template-columns: repeat(var(--weeks), 1fr); grid-auto-flow: column; gap: 1.5px; }
.ob-year__grid i { aspect-ratio: 1; border-radius: 1.5px; background: var(--c); animation: ob-cell .4s calc(.25s + var(--w) * 34ms) ease-out both; }
.ob-year__grid i[data-level="1"] { --c: #d6e1cb; }
.ob-year__grid i[data-level="2"] { --c: #adc39d; }
.ob-year__grid i[data-level="3"] { --c: #7e9e70; }
.ob-year__grid i[data-level="4"] { --c: #e8a917; }
:root[data-theme="dark"] .ob-year__grid i[data-level="1"] { --c: #3b5646; }
:root[data-theme="dark"] .ob-year__grid i[data-level="2"] { --c: #56785f; }
:root[data-theme="dark"] .ob-year__grid i[data-level="3"] { --c: #7ea484; }
:root[data-theme="dark"] .ob-year__grid i[data-level="4"] { --c: #f4c64f; }
/* Each level finished after HSK 1: its own colour (decks.js: gold, green, blue, violet). */
.ob-year__grid i[data-level="5"] { --c: #e98a3c; }
.ob-year__grid i[data-level="6"] { --c: #4f9a72; }
.ob-year__grid i[data-level="7"] { --c: #4a7fc1; }
.ob-year__grid i[data-level="8"] { --c: #8a62c4; }
@keyframes ob-cell { from { background: var(--paper-deep); opacity: .4; scale: .3; } }
.ob-year__pin { position: absolute; bottom: calc(100% + 6px); padding: 3px 8px; border-radius: 99px; background: #f6c64a; color: #4c2a05; font-size: 10.5px; font-weight: 900; white-space: nowrap; translate: -50% 0; animation: curve-badge .45s calc(.35s + var(--w) * 34ms) cubic-bezier(.3,1.6,.5,1) both; }
.ob-year__pin::after { content: ""; position: absolute; top: 100%; left: 50%; width: 2px; height: 6px; background: inherit; translate: -50% 0; }
.ob-year__pin.is-high { bottom: calc(100% + 28px); }
.ob-year__pin.is-high::after { height: 28px; }
.ob-year__pin--2 { background: #e98a3c; color: #fff; }
.ob-year__pin--3 { background: #4f9a72; color: #fff; }
.ob-year__pin--4 { background: #4a7fc1; color: #fff; }
.ob-year__pin--5 { background: #8a62c4; color: #fff; }
.ob-year__calendar.has-rows { margin-top: 52px; }
.ob-year__ends { display: flex; justify-content: space-between; margin-top: 5px; color: var(--ink-soft); font-size: 9.5px; font-weight: 800; }
.ob-confetti { position: absolute; left: 50%; top: 50%; width: 7px; height: 12px; margin: -6px 0 0 -3.5px; border-radius: 2px; background: var(--c); opacity: 0; animation: ob-confetti 1.4s var(--d) cubic-bezier(.15,.7,.3,1) both; }
.ob-confetti--round { width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; }
@keyframes ob-confetti { 0% { opacity: 1; transform: scale(.3); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--dx), calc(var(--dy) + 26px)) rotate(var(--r)) scale(1); } }

/*
 * Scenes standing in for Bao (onboarding-scenes.js): the tones, writing, a
 * quiz, a sentence, the four skills, the garden and the path to the mock
 * test. Part, method and tone colours are tokens, redefined for dark mode.
 */
:root {
  --ob-part-0: #3f8f5f; --ob-part-0-tint: #e4f1e7;
  --ob-part-1: #df553f; --ob-part-1-tint: #fbe7e2;
  --ob-part-2: #c68a1c; --ob-part-2-tint: #f8ecd2;
  --ob-method-0: #df553f; --ob-method-0-tint: #fbe7e2;
  --ob-method-1: #3e6f91; --ob-method-1-tint: #e2edf5;
  --ob-method-2: #3f8f5f; --ob-method-2-tint: #e4f1e7;
  --ob-method-3: #c68a1c; --ob-method-3-tint: #f8ecd2;
  --ob-tone-1: #df553f; --ob-tone-1-tint: #fbe7e2;
  --ob-tone-2: #c68a1c; --ob-tone-2-tint: #f8ecd2;
  --ob-tone-3: #3f8f5f; --ob-tone-3-tint: #e4f1e7;
  --ob-tone-4: #3e6f91; --ob-tone-4-tint: #e2edf5;
  --ob-gold: #c68a1c;
}
:root[data-theme="dark"] {
  --ob-part-0: #7ec492; --ob-part-0-tint: rgba(126,196,146,.16);
  --ob-part-1: #e38a68; --ob-part-1-tint: rgba(227,138,104,.16);
  --ob-part-2: #f0c35a; --ob-part-2-tint: rgba(240,195,90,.16);
  --ob-method-0: #e38a68; --ob-method-0-tint: rgba(227,138,104,.16);
  --ob-method-1: #8fb8d8; --ob-method-1-tint: rgba(143,184,216,.16);
  --ob-method-2: #7ec492; --ob-method-2-tint: rgba(126,196,146,.16);
  --ob-method-3: #f0c35a; --ob-method-3-tint: rgba(240,195,90,.16);
  --ob-tone-1: #e38a68; --ob-tone-1-tint: rgba(227,138,104,.16);
  --ob-tone-2: #f0c35a; --ob-tone-2-tint: rgba(240,195,90,.16);
  --ob-tone-3: #7ec492; --ob-tone-3-tint: rgba(126,196,146,.16);
  --ob-tone-4: #8fb8d8; --ob-tone-4-tint: rgba(143,184,216,.16);
  --ob-gold: #f0c35a;
}
.onboarding__stage:has(> .ob-scene:not([hidden])) { width: 100%; }
.onboarding__stage:has(> .ob-scene:not([hidden])) .onboarding__mascot { display: none; }
.ob-scene { position: relative; width: min(330px, 100%); margin: 0 auto 16px; }

/* Writing: the brush reveals each stroke along its median; parts pop in as they are finished. */
.ob-write { display: flex; flex-direction: column; align-items: center; }
.ob-write__box { position: relative; width: min(210px, 29dvh); aspect-ratio: 1; border: 1.5px solid rgba(223,85,63,.45); border-radius: 18px; background: var(--white); box-shadow: 0 16px 30px -22px rgba(41,73,59,.6); }
.ob-write__grid { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; fill: none; stroke: var(--red); stroke-width: .5; stroke-opacity: .3; stroke-dasharray: 2.2 1.8; clip-path: inset(0 round 16px); }
.ob-write__glyph { position: absolute; inset: 9%; width: 82%; height: 82%; overflow: visible; }
.ob-write__ghost { fill: var(--paper-deep); }
.ob-write__stroke { fill: none; stroke: var(--c); stroke-width: 200; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 1; stroke-dashoffset: 0; animation: ob-stroke .42s var(--at) cubic-bezier(.45,.05,.55,.95) both; }
@keyframes ob-stroke { 0% { opacity: 0; stroke-dashoffset: 1; } 1% { opacity: 1; } 100% { stroke-dashoffset: 0; } }
.ob-write__replay { position: absolute; right: -10px; bottom: -10px; display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; background: var(--white); color: var(--ink-soft); box-shadow: 0 6px 14px -8px rgba(41,73,59,.5); cursor: pointer; }
.ob-write__replay svg { width: 18px; height: 18px; }
.ob-write__replay:active { transform: scale(.93); }
.ob-write__parts { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 14px; }
.ob-part { display: flex; align-items: center; gap: 6px; animation: ob-part .5s var(--at) cubic-bezier(.3,1.5,.5,1) both; }
.ob-part i { color: var(--ink-soft); font-size: 18px; font-style: normal; font-weight: 800; }
.ob-part__chip { display: grid; justify-items: center; min-width: 66px; padding: 5px 8px 6px; border: 1.5px solid var(--c); border-radius: 16px; background: var(--t); }
.ob-part b { color: var(--c); font: 700 26px/1.15 "Noto Serif SC", serif; }
.ob-part small { color: var(--ink-soft); font-size: 11px; font-weight: 800; }
@keyframes ob-part { from { opacity: 0; transform: translateY(12px) scale(.7); } }

/* Quiz */
.ob-quiz { display: grid; gap: 9px; }
.ob-quiz__prompt { display: grid; justify-items: center; padding: 10px 0 8px; border: 1px solid var(--line); border-radius: 22px; background: var(--white); box-shadow: 0 16px 34px -24px rgba(41,73,59,.6); }
.ob-quiz__prompt small { color: var(--ink-soft); font-size: 12px; font-weight: 800; }
.ob-quiz__prompt span { font: 64px/1.15 "Noto Serif SC", serif; }
.ob-quiz__options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ob-quiz .probe-option { position: relative; min-height: 48px; color: var(--ink); }
.ob-quiz .probe-option.is-wrong { animation: ob-shake .4s; }
.ob-quiz .probe-option.is-correct { animation: ob-right .5s cubic-bezier(.3,1.6,.5,1); }
.ob-quiz.is-solved .probe-option:disabled:not(.is-correct) { opacity: .45; }
.ob-quiz__confetti { position: absolute; z-index: 2; width: 0; height: 0; pointer-events: none; }
.ob-quiz__feedback { min-height: 1.4em; margin: 0; color: var(--ink-soft); font-size: 13px; font-weight: 800; }
.ob-quiz__feedback.is-good { color: var(--green-ink); animation: ob-enter .3s both; }
.ob-quiz__feedback.is-bad { color: var(--red-dark); animation: ob-enter .3s both; }
@keyframes ob-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes ob-right { 50% { transform: scale(1.06); } }

/* The four ways: each lights up, links to the character and fills a quarter of its memory ring. */
.ob-methods { aspect-ratio: 300 / 220; }
.ob-methods__links { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ob-methods__links path { fill: none; stroke: var(--c); stroke-width: 2; stroke-linecap: round; stroke-opacity: .55; stroke-dasharray: 1 1; animation: ob-link .45s calc(.45s + var(--i) * .55s) ease-out both; }
@keyframes ob-link { from { stroke-dashoffset: 1; } }
.ob-methods__core { position: absolute; top: 50%; left: 50%; display: grid; place-items: center; align-content: center; width: 40%; aspect-ratio: 1; border-radius: 50%; background: var(--white); box-shadow: 0 14px 30px -18px rgba(41,73,59,.6); translate: -50% -50%; }
.ob-methods__core svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ob-methods__core circle { fill: none; stroke-width: 9; }
.ob-methods__track { stroke: var(--paper-deep); }
.ob-methods__arc { stroke: var(--c); stroke-linecap: round; stroke-dasharray: 21 79; transform-box: fill-box; transform-origin: center; animation: ob-arc .5s calc(.7s + var(--i) * .55s) ease-out both; }
@keyframes ob-arc { from { stroke-dasharray: 0 100; } }
.ob-methods__glyph { position: relative; font: 46px/1 "Noto Serif SC", serif; animation: ob-gold .7s 2.95s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes ob-gold { 50% { transform: scale(1.18); } to { color: var(--ob-gold); } }
.ob-methods__core small { position: relative; max-width: 66%; margin-top: 3px; color: var(--ink-soft); font-size: 9.5px; font-weight: 900; line-height: 1.15; text-align: center; animation: ob-enter .4s 3.1s both; }
.ob-methods__core::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; box-shadow: 0 0 0 0 var(--ob-gold); opacity: 0; animation: ob-glow 1.6s 3s ease-out both; }
@keyframes ob-glow { 0% { opacity: .7; box-shadow: 0 0 0 0 var(--ob-gold); } 100% { opacity: 0; box-shadow: 0 0 0 18px var(--ob-gold); } }
.ob-method { position: absolute; display: flex; align-items: center; gap: 7px; padding: 5px 11px 5px 5px; border: 1.5px solid var(--c); border-radius: 15px; background: var(--t); color: var(--ink); font-size: 12.5px; font-weight: 800; white-space: nowrap; translate: -50% -50%; animation: ob-part .5s calc(.3s + var(--i) * .55s) cubic-bezier(.3,1.5,.5,1) both; }
.ob-method b { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: var(--c); color: var(--white); font: 700 17px/1 "Noto Serif SC", serif; }
.ob-method:nth-of-type(1) { left: 20.7%; top: 20%; }
.ob-method:nth-of-type(2) { left: 79.3%; top: 20%; }
.ob-method:nth-of-type(3) { left: 20.7%; top: 80%; }
.ob-method:nth-of-type(4) { left: 79.3%; top: 80%; }

/* A talk of the Dialogues tab played out: the mission, the host's line, the reply said into the mic, the host won over, the mission stamped. */
.ob-talk { display: grid; gap: 8px; padding: 14px 10px 10px; border: 1px solid rgba(23,59,54,.09); border-radius: 22px; background: radial-gradient(circle at 50% 30%, rgba(255,255,255,.7), transparent 62%), linear-gradient(162deg, #eaf2f8 0%, #dfebf5 58%, #d3e2ef 100%); box-shadow: inset 0 1px 0 rgba(255,255,255,.75), 0 16px 34px -24px rgba(41,73,59,.6); text-align: left; }
:root[data-theme="dark"] .ob-talk { border-color: transparent; background: linear-gradient(160deg, #263845 0%, #22333f 60%, #1e2d38 100%); box-shadow: none; }
.ob-talk__mission { position: relative; margin: 0; padding: 8px 12px 9px; animation: ob-enter .4s .15s both; }
.ob-talk__mission .situation-live__missionText { margin-top: 3px; font-size: 13.5px; line-height: 1.35; }
.ob-talk__done { position: absolute; top: -11px; right: 10px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 3px; border-radius: 999px; background: var(--green); color: var(--on-ink); font: 800 10.5px/1.5 "Manrope", system-ui, sans-serif; letter-spacing: .02em; animation: ob-talk-stamp .45s 4.7s cubic-bezier(.3,1.6,.5,1) both; }
.ob-talk__done b { display: grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--on-ink); color: var(--green); font-size: 10px; line-height: 1; }
@keyframes ob-talk-stamp { from { opacity: 0; scale: 1.8; rotate: -10deg; } }
.ob-talk__chat { display: flex; flex-direction: column; gap: 6px; }
.ob-talk .situation-line { max-width: 96%; animation: ob-talk-in .35s .7s ease-out both; }
.ob-talk .situation-line:nth-child(2) { animation-delay: 1.5s; }
.ob-talk .situation-line:nth-child(3) { animation-delay: 4.1s; }
@keyframes ob-talk-in { from { opacity: 0; transform: translateY(8px) scale(.96); } }
.ob-talk .situation-line__avatar { width: 34px; height: 34px; }
.ob-talk .situation-line__who { padding: 0 4px; font-size: 10px; }
.ob-talk .situation-line__body { gap: 1px; padding: 6px 12px 7px; cursor: default; }
.ob-talk .situation-line__zh { font-size: 18px; line-height: 1.3; }
.ob-talk .situation-line__pinyin { font-size: 12px; }
.ob-talk .situation-live__gloss { margin: 1px 0 0; font-size: 11.5px; line-height: 1.3; }
.ob-talk .is-mine .situation-line__body { display: grid; }
.ob-talk .is-mine .situation-line__body > * { grid-area: 1 / 1; }
.ob-talk__said { display: grid; gap: 1px; justify-items: start; animation: ob-talk-said .35s 3.2s ease-out both; }
@keyframes ob-talk-said { from { opacity: 0; transform: translateY(4px); } }
.ob-talk__score { margin-top: 4px; padding: 1px 8px; border-radius: 999px; background: var(--green); color: var(--on-ink); font-size: 10.5px; font-weight: 800; animation: ob-pop .4s 3.6s cubic-bezier(.3,1.6,.5,1) both; }
.ob-talk__wave { display: flex; align-items: center; justify-content: center; gap: 3px; animation: ob-talk-hide .2s 3.1s both; }
.ob-talk__wave i { width: 3px; height: 24px; border-radius: 2px; background: var(--green-ink); transform: scaleY(.2); animation: ob-talk-bar .3s calc(1.6s + var(--k, 0) * .07s) ease-in-out 5 alternate both; }
@keyframes ob-talk-bar { to { transform: scaleY(var(--h, 1)); } }
@keyframes ob-talk-hide { to { opacity: 0; visibility: hidden; } }
.ob-talk__mic { position: relative; flex: none; align-self: center; display: grid; place-items: center; width: 30px; height: 30px; border: 2px solid var(--white); border-radius: 50%; background: var(--red); color: #fff; box-shadow: 0 4px 10px rgba(223,85,63,.35); }
.ob-talk__mic svg { position: relative; width: 14px; height: 14px; }
.ob-talk__mic::before { content: ""; position: absolute; inset: -2px; border-radius: 50%; background: var(--red); opacity: 0; animation: ob-talk-ring .75s 1.6s ease-out 2; }
@keyframes ob-talk-ring { from { opacity: .5; transform: scale(1); } to { opacity: 0; transform: scale(2); } }
:root[data-theme="dark"] .ob-talk__mic { border-color: var(--surface); }

/* The garden, as on the Garden tab: characters light up to their state, mastered ones in gold. */
.ob-garden { position: relative; margin-top: 96px; padding: 12px 12px 13px; border: 1px solid var(--line); border-radius: 22px; background: rgba(var(--glass-rgb), .82); box-shadow: 0 16px 34px -24px rgba(41,73,59,.6); text-align: left; }
.ob-garden__bar { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 0 2px; }
.ob-garden__bar > b { font-size: 16px; font-weight: 900; letter-spacing: -.02em; }
.ob-garden__bar span { color: var(--ink-soft); font-size: 12px; font-weight: 800; }
/* The tour's garden and path are samples, not the learner's own. */
.ob-garden__example { display: inline-block; margin-left: 4px; padding: 2px 7px; border: 1px dashed var(--ink-soft); border-radius: 99px; color: var(--ink-soft); font-size: 8.5px; font-style: normal; font-weight: 800; letter-spacing: .1em; vertical-align: 3px; }
.ob-garden__count { color: var(--ob-gold); font-size: 17px; font-variant-numeric: tabular-nums; }
.ob-garden__chips { display: flex; gap: 5px; margin: 8px 0 10px; }
.ob-garden__chips span { padding: 4px 9px; border: 1px solid var(--line); border-radius: 99px; color: var(--ink-soft); font-size: 10.5px; font-weight: 800; }
.ob-garden__chips .is-selected { border-color: var(--ink); background: var(--ink); color: var(--on-ink); }
.ob-garden__printer { display: grid; place-items: center; width: 28px; height: 28px; margin: -2px 0 -2px auto; border-radius: 50%; background: rgba(223,85,63,.12); color: var(--red); animation: ob-printer .5s 2.6s cubic-bezier(.3,1.6,.5,1) both; }
.ob-garden__printer svg { width: 17px; height: 17px; }
@keyframes ob-printer { 50% { scale: 1.25; } }
.ob-garden__grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.ob-garden .character-tile { border-radius: 12px; cursor: default; animation: ob-tile .5s var(--d) cubic-bezier(.3,1.4,.5,1) both; }
.ob-garden .character-tile.state-new { animation: none; }
.ob-garden .character-tile.shine--burst { animation: ob-tile-gold .65s var(--d) cubic-bezier(.3,1.5,.5,1) both; }
.ob-garden .character-tile__hanzi { font-size: 21px; }
.ob-garden .character-tile__meta { font-size: 8.5px; }
/* A printed worksheet floats above the garden's corner, a hand-drawn line down to the card; it pops in once the garden
   has lit up. It only shows the feature: tapping it does nothing. */
.ob-garden__sheet { position: absolute; right: 18px; bottom: calc(100% + 22px); z-index: 2; display: grid; justify-items: center; gap: 4px; width: 92px; padding: 7px 7px 6px; border: 1px solid var(--line); border-radius: 6px; background: #fffdf8; box-shadow: 0 10px 22px -12px rgba(41,73,59,.55); color: #1f3d33; pointer-events: none; transform: rotate(6deg); animation: ob-sheet .55s 2.7s cubic-bezier(.3,1.4,.5,1) both; }
.ob-garden__sheet::before { content: "PDF"; position: absolute; top: -8px; left: -8px; padding: 2px 6px; border-radius: 6px; background: var(--red); color: #fff; font-size: 9px; font-weight: 900; letter-spacing: .06em; transform: rotate(-10deg); }
.ob-garden__cells { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; border: 1px solid rgba(223,85,63,.35); }
.ob-garden__cells i { display: grid; place-items: center; aspect-ratio: 1; border: 0 solid rgba(223,85,63,.35); border-width: 0 1px 1px 0; background: linear-gradient(rgba(223,85,63,.16), rgba(223,85,63,.16)) center / 100% 1px no-repeat, linear-gradient(rgba(223,85,63,.16), rgba(223,85,63,.16)) center / 1px 100% no-repeat; font: 700 15px/1 "Noto Serif SC", serif; font-style: normal; }
.ob-garden__cells i:nth-child(4n) { border-right-width: 0; }
.ob-garden__cells i:nth-last-child(-n+4) { border-bottom-width: 0; }
.ob-garden__cells .is-faint { opacity: .32; }
.ob-garden__cells .is-fainter { opacity: .14; }
.ob-garden__sheet b { font-size: 9.5px; font-weight: 900; line-height: 1.1; text-align: center; }
.ob-garden__wire { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.ob-garden__wire path { fill: none; stroke: var(--red); stroke-width: 2.2; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: ob-wire .5s 2.75s ease-out forwards; }
@keyframes ob-wire { to { stroke-dashoffset: 0; } }
@keyframes ob-sheet { from { opacity: 0; transform: translateY(12px) rotate(-2deg) scale(.75); } }
@keyframes ob-tile { from { opacity: .5; filter: grayscale(1); transform: scale(.88); } }
@keyframes ob-tile-gold { 0% { opacity: .5; filter: grayscale(1); transform: scale(.88); } 60% { opacity: 1; filter: none; transform: scale(1.14) rotate(-3deg); } 100% { transform: none; } }

/* The four tones: each tile draws its pitch line; a tap plays it and the voice rides the line. */
.ob-tones__keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.ob-tone { display: grid; justify-items: center; gap: 1px; padding: 9px 4px 9px; border: 1.5px solid var(--line); border-radius: 18px; background: var(--white); color: var(--ink); font: inherit; cursor: pointer; box-shadow: 0 12px 26px -22px rgba(41,73,59,.6); animation: ob-part .5s calc(.12s + var(--i) * .1s) cubic-bezier(.3,1.5,.5,1) both; transition: border-color .2s, background .2s, transform .25s cubic-bezier(.3,1.6,.5,1); }
.ob-tone:active { transform: scale(.95); }
.ob-tone.is-playing { border-color: var(--c); background: var(--t); transform: translateY(-4px); }
.ob-tone__line { width: 100%; height: auto; aspect-ratio: 3 / 2; margin-bottom: 4px; overflow: visible; }
.ob-tone__level { fill: none; stroke: var(--ink-soft); stroke-width: .7; stroke-dasharray: 1.6 2.4; opacity: .4; }
.ob-tone__shape { fill: none; stroke: var(--c); stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 1; animation: ob-stroke .55s calc(.5s + var(--i) * .38s) cubic-bezier(.45,.05,.55,.95) both; }
.ob-tone.is-sounding .ob-tone__shape { animation: ob-stroke-again .7s cubic-bezier(.45,.05,.55,.95) both; }
@keyframes ob-stroke-again { 0% { stroke-dashoffset: 1; } 100% { stroke-dashoffset: 0; } }
.ob-tone__voice { fill: var(--white); stroke: var(--c); stroke-width: 2.4; opacity: 0; }
.ob-tone.is-sounding .ob-tone__voice { animation: ob-voice .9s ease-out both; }
@keyframes ob-voice { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
.ob-tone b { color: var(--c); font-size: 21px; line-height: 1; letter-spacing: -.02em; }
.ob-tone span { font: 700 22px/1.2 "Noto Serif SC", serif; }
.ob-tone small { color: var(--ink-soft); font-size: 10.5px; font-weight: 800; line-height: 1.2; }
.ob-tones__hint { display: table; margin: 9px auto 0; padding: 4px 11px; border-radius: 99px; background: var(--paper-deep); color: var(--ink-soft); font-size: 12px; font-weight: 800; animation: ob-enter .4s 2.2s both; transition: opacity .3s; }
.ob-tones.is-heard .ob-tones__hint { opacity: 0; }
/* chá's rising tone beside it on the tea card: drawn as the card settles, again when it plays. */
.ob-tea-tone { width: 30px; height: 20px; margin-left: 6px; overflow: visible; vertical-align: -2px; }
.ob-tea-tone path { fill: none; stroke: var(--ob-tone-2); stroke-width: 6; stroke-linecap: round; stroke-dasharray: 1 1; animation: ob-stroke .5s 1.3s ease-out both; }
.onboarding__demo.is-heard .ob-tea-tone path { animation: ob-stroke-again .6s .1s ease-out both; }

/* A sentence to build: the right word flies into its slot, a wrong one shakes; built, it turns green and plays. */
.ob-sentence { display: grid; gap: 10px; }
.ob-sentence__card { display: grid; justify-items: center; gap: 4px; padding: 11px 12px 10px; border: 1px solid var(--line); border-radius: 22px; background: var(--white); box-shadow: 0 16px 34px -24px rgba(41,73,59,.6); }
.ob-sentence__card > small { color: var(--ink-soft); font-size: 12px; font-weight: 800; }
.ob-sentence__meaning { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.ob-sentence__line { display: flex; justify-content: center; gap: 7px; margin-top: 4px; }
.ob-sentence__slot { display: grid; place-items: center; min-width: calc(var(--n, 1) * 27px + 12px); height: 42px; border-bottom: 2.5px dashed var(--line); font: 700 27px/1 "Noto Serif SC", serif; transition: color .3s, border-color .3s; }
.ob-sentence__slot.is-given { border-bottom-style: solid; }
.ob-sentence__slot.is-filled { border-bottom-style: solid; border-bottom-color: var(--red); }
.ob-sentence__slot.is-filled b { display: block; font: inherit; animation: ob-fly .42s cubic-bezier(.3,1.25,.5,1) both; }
@keyframes ob-fly { from { transform: translate(var(--fx, 0), var(--fy, 0)) scale(.85); } }
.ob-sentence.is-built .ob-sentence__slot { border-bottom-color: var(--green); color: var(--green-ink); }
.ob-sentence__done { display: flex; min-height: 36px; align-items: center; gap: 9px; visibility: hidden; }
.ob-sentence.is-built .ob-sentence__done { visibility: visible; animation: ob-enter .4s .2s both; }
.ob-sentence__pinyin { color: var(--ink-soft); font-size: 14px; font-weight: 800; }
.ob-sentence__speak { position: relative; display: grid; flex: none; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; background: linear-gradient(135deg, #fa8466, #cf4934); color: #fff; box-shadow: 0 5px 12px rgba(223,85,63,.3); cursor: pointer; }
.ob-sentence__speak svg { width: 18px; height: 18px; }
.ob-sentence__speak.is-playing .ob-wave { animation: ob-wave .7s ease-in-out infinite; }
.ob-sentence__pool { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.ob-word { display: grid; justify-items: center; gap: 1px; padding: 8px 3px 7px; border: 1px solid var(--line); border-radius: 16px; background: var(--white); color: var(--ink); font: inherit; cursor: pointer; box-shadow: 0 3px 0 var(--line); transition: opacity .25s, transform .15s; }
.ob-word:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.ob-word b { font: 700 24px/1.15 "Noto Serif SC", serif; }
.ob-word span { font-size: 12px; font-weight: 800; }
.ob-word small { color: var(--ink-soft); font-size: 10.5px; font-weight: 700; }
.ob-word.is-wrong { animation: ob-shake .4s; }
.ob-word.is-used { border-style: dashed; box-shadow: none; opacity: .28; cursor: default; }
.ob-sentence__feedback { min-height: 1.4em; margin: 0; color: var(--ink-soft); font-size: 13px; font-weight: 800; }
.ob-sentence__feedback.is-good { color: var(--green-ink); animation: ob-enter .3s both; }
.ob-sentence__feedback.is-bad { color: var(--red-dark); animation: ob-enter .3s both; }

/* The hero path, as on Home: chapters pass one by one (with their lessons and check), Bao waits at the current one, the road leads to a passed mock test. */
.ob-path { padding: 12px 14px 10px; border: 1px solid var(--line); border-radius: 22px; background: rgba(var(--glass-rgb), .86); box-shadow: 0 16px 34px -24px rgba(41,73,59,.6); text-align: left; }
.ob-path__bar { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 0 2px; }
.ob-path__bar b { font-size: 16px; font-weight: 900; letter-spacing: -.02em; }
.ob-path__bar span { color: var(--ink-soft); font-size: 11.5px; font-weight: 800; }
.ob-path__road { position: relative; display: grid; gap: 3px; margin: 9px 0 0; padding: 0; list-style: none; }
.ob-path__road::before { content: ""; position: absolute; top: 20px; bottom: 22px; left: 18px; border-left: 2.5px dashed rgba(223,85,63,.5); transform-origin: top; animation: ob-road 1.9s .25s ease-out both; }
@keyframes ob-road { from { transform: scaleY(0); } }
.ob-path__row { position: relative; display: flex; align-items: center; gap: 11px; min-height: 40px; animation: ob-enter .4s calc(.2s + var(--i) * .24s) both; }
.ob-path__node { position: relative; display: grid; flex: none; place-items: center; width: 38px; height: 38px; border: 2.5px solid var(--red); border-radius: 50%; background: var(--white); color: var(--red-dark); font: 700 19px/1 "Noto Serif SC", serif; }
.is-passed .ob-path__node { background: var(--tint-red); }
.ob-path__tick { position: absolute; right: -5px; bottom: -3px; display: grid; place-items: center; width: 17px; height: 17px; border: 2px solid var(--paper); border-radius: 50%; background: var(--green); color: #fff; font: 900 9px/1 system-ui, sans-serif; font-style: normal; animation: ob-pop .4s calc(.5s + var(--i) * .24s) cubic-bezier(.3,1.6,.5,1) both; }
.is-current .ob-path__node { border-color: var(--ink); background: var(--ink); color: var(--on-ink); box-shadow: 0 0 0 4px rgba(var(--jade-rgb), .18); }
.ob-path__bao { flex: none; width: 40px; height: 40px; animation: ob-bao-hop .6s calc(.5s + var(--i) * .24s) cubic-bezier(.3,1.4,.5,1) both; transform-origin: 50% 90%; }
.is-next .ob-path__node { border-style: dashed; border-color: var(--ink-soft); background: transparent; color: var(--ink-soft); opacity: .55; }
.is-next .ob-path__text b { color: var(--ink-soft); }
.ob-path__text { display: grid; min-width: 0; flex: 1; justify-items: start; }
.ob-path__text b { font-size: 13.5px; font-weight: 800; line-height: 1.2; }
.ob-path__text small { color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.ob-path__lessons { display: flex; flex-wrap: wrap; gap: 4px; }
.ob-path__lessons:not(:empty) { margin-top: 3px; }
.ob-path__lesson { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 6px; border-radius: 99px; background: var(--ob-method-1-tint); color: var(--ob-method-1); font-size: 10.5px; font-weight: 800; white-space: nowrap; animation: ob-part .45s calc(.6s + var(--i) * .24s + var(--j) * .14s) cubic-bezier(.3,1.5,.5,1) both; }
.ob-path__lesson svg { width: 12px; height: 12px; }
.ob-path__lesson--check { background: var(--ob-method-2-tint); color: var(--ob-method-2); }
.ob-path__more { display: grid; gap: 3px; width: 38px; justify-items: center; padding: 1px 0; animation: ob-enter .4s calc(.2s + var(--i) * .24s) both; }
.ob-path__more i { width: 4px; height: 4px; border-radius: 50%; background: var(--red); opacity: .45; }
.ob-path__exam .ob-path__node { border-color: var(--ob-gold); border-radius: 12px 12px 12px 4px; background: var(--red); color: var(--on-red); rotate: -4deg; }
.ob-path__exam .ob-path__text small { color: var(--green-ink); font-weight: 900; font-variant-numeric: tabular-nums; }
.ob-path__score { position: relative; flex: none; width: 34px; height: 34px; }
.ob-path__score svg { width: 100%; height: 100%; rotate: -90deg; }
.ob-path__score circle { fill: none; stroke: var(--paper-deep); stroke-width: 5; }
.ob-path__score .ob-path__fill { stroke: var(--green); stroke-linecap: round; stroke-dasharray: var(--p) 100; animation: ob-arc .9s 1.9s cubic-bezier(.3,.7,.3,1) both; }

/* The starting level: steps climbing from HSK 1 to HSK 5; Bao hops onto the chosen one, holding its numeral. */
.ob-level { width: min(340px, 100%); margin-top: 14px; }
.ob-level__stairs { --at: 2; --hb: 122px; position: relative; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; gap: 6px; padding-top: 62px; }
.ob-level__step { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-end; padding: 0; border: 0; background: none; color: var(--ink); font: inherit; cursor: pointer; }
.ob-level__bar { display: flex; height: var(--h); flex-direction: column; align-items: center; gap: 5px; padding-top: 8px; border: 1.5px solid var(--line); border-radius: 14px 14px 6px 6px; background: var(--white); box-shadow: 0 12px 24px -20px rgba(41,73,59,.6); transform-origin: bottom; animation: ob-rise .5s calc(.12s + var(--i) * .08s) cubic-bezier(.3,1.3,.5,1) both; transition: border-color .2s, background .2s; }
@keyframes ob-rise { from { opacity: 0; transform: scaleY(.15); } }
.ob-level__bar b { font-size: 11.5px; font-weight: 900; white-space: nowrap; }
.ob-level__step small { min-height: 2.4em; margin-top: 5px; color: var(--ink-soft); font-size: 10.5px; font-weight: 800; line-height: 1.2; text-align: center; }
.ob-level__step[aria-checked="true"] .ob-level__bar { border-color: var(--ink); background: var(--deck-tint); box-shadow: inset 0 0 0 1px var(--ink); }
.ob-level__step[aria-checked="true"] small { color: var(--ink); }
.ob-level__mascot { position: absolute; bottom: calc(var(--hb) + 2.4em + 9px); left: calc((var(--at) + .5) * 20%); width: 58px; height: 58px; translate: -50% 0; transition: left .45s cubic-bezier(.3,1.25,.5,1), bottom .45s cubic-bezier(.3,1.25,.5,1); pointer-events: none; animation: ob-pop .5s .6s cubic-bezier(.3,1.6,.5,1) both; }
.ob-level__mascot .mascot { transform-origin: 50% 90%; }
.ob-level__mascot.is-reacting .mascot { animation: ob-bao-hop .6s cubic-bezier(.3,1.4,.5,1); }
.ob-level__line { margin: 12px 0 0; text-align: left; }
.ob-level__line.is-reacting { animation: result-bao-line .35s ease-out; }

/*
 * The tour's painted world (onboarding-world.js): ink-wash hills and the
 * path's watercolour props walk by a step at a time behind the content. The
 * cards float in a gentle tilt (--tx, --ty on #onboarding, −1…1) and the
 * world shifts against it, the far hills least.
 */
:root { --ob-light: rgba(255, 252, 244, .95); --ob-hills: .5; --ob-props: .95; }
:root[data-theme="dark"] { --ob-light: rgba(229, 235, 217, .07); --ob-hills: .16; --ob-props: .78; }
.onboarding { overflow: hidden; isolation: isolate; background: radial-gradient(130% 55% at 50% 0%, var(--ob-light), transparent 70%), var(--paper); }
.onboarding > :not(.ob-world, .ob-tea-flight) { position: relative; z-index: 1; }
.ob-world { position: absolute; z-index: 0; inset: 0; overflow: hidden; pointer-events: none; }
.ob-world__strip { position: absolute; inset: 0; transform: translateX(calc(var(--step, 0) * var(--walk, .88) * -100%)); translate: calc(var(--tx, 0) * -10px) calc(var(--ty, 0) * -6px); transition: transform 1.15s cubic-bezier(.5,.05,.2,1); }
.ob-world__prop { position: absolute; left: calc((var(--k) * var(--walk, .88) + .94) * 100%); width: auto; opacity: 0; translate: -50% 0; filter: drop-shadow(0 8px 10px rgba(41,73,59,.12)); transition: opacity .7s; }
.ob-world__prop.is-loaded { opacity: var(--ob-props); }
.ob-world__prop.is-ground { bottom: calc(max(16px, var(--safe-bottom)) + 62px); height: clamp(70px, 11dvh, 104px); }
.ob-world__prop.is-sky { top: calc(max(12px, var(--safe-top)) + 88px); height: clamp(54px, 8.5dvh, 82px); }
.ob-world__hills { position: absolute; bottom: 0; left: 0; width: 800%; background-position: 0 100%; background-repeat: repeat-x; transition: transform 1.15s cubic-bezier(.5,.05,.2,1); }
.ob-world__hills--far { height: 150px; background-size: 620px 100%; opacity: calc(var(--ob-hills) * .8); transform: translateX(calc(var(--step, 0) * var(--walk, .88) * -3.125%)); translate: calc(var(--tx, 0) * -3px) 0; }
.ob-world__hills--near { height: 104px; background-size: 520px 100%; background-position: 230px 100%; opacity: var(--ob-hills); transform: translateX(calc(var(--step, 0) * var(--walk, .88) * -5.625%)); translate: calc(var(--tx, 0) * -6px) 0; }
.ob-world__sky { position: absolute; inset: 0 0 auto; height: 45%; }
.ob-world__cloud { position: absolute; top: calc(max(12px, var(--safe-top)) + 64px); left: -30%; width: 120px; opacity: 0; animation: ob-cloud 80s -24s linear infinite; transition: opacity 1s; }
.ob-world__cloud.is-loaded { opacity: .32; }
.ob-world__cloud--2 { top: calc(max(12px, var(--safe-top)) + 170px); width: 84px; animation-duration: 110s; animation-delay: -80s; }
@keyframes ob-cloud { to { left: 110%; } }
.ob-world.is-instant, .ob-world.is-instant * { transition: none !important; }

/* Depth: the step's card leans with the phone, its shadow falling the other way. */
#onboardingScene { transform: perspective(800px) rotateX(calc(var(--ty, 0) * -4deg)) rotateY(calc(var(--tx, 0) * 5deg)); }
/* The painting floats flat: leaned in 3D every frame, an iPad redrew it at a new sharpness each time and it flickered (2026-11-03). */
.onboarding__mascot.is-art { translate: calc(var(--tx, 0) * 4px) calc(var(--ty, 0) * 3px); }
.onboarding__stage[data-scene="bao"] .onboarding__mascot { translate: calc(var(--tx, 0) * 5px) calc(var(--ty, 0) * 3px); }
.onboarding__stage[data-scene="bao"] .onboarding__mascot .mascot { filter: drop-shadow(0 18px 16px rgba(41,73,59,.16)); }

/* A card's painting in Bao's place: a print on a white mat, unveiled from the cup, steaming; Bao leans in at its corner. */
.onboarding__mascot.is-art { position: relative; width: min(232px, calc(58vw / var(--ui-zoom, 1)), calc(29dvh / var(--ui-zoom, 1))); height: auto; aspect-ratio: 1; margin-bottom: 18px; padding: 7px; border-radius: 30px; background: var(--white); }
/* Its shadow is a layer that slides the other way, not a box-shadow redrawn every frame. */
.onboarding__mascot.is-art::before { content: ""; position: absolute; z-index: -1; inset: 0; border-radius: inherit; box-shadow: 0 20px 40px -22px rgba(41,73,59,.55); translate: calc(var(--tx, 0) * -10px) calc(var(--ty, 0) * -6px); pointer-events: none; }
.ob-art { position: relative; display: block; width: 100%; height: 100%; overflow: hidden; border-radius: 23px; background: var(--paper-deep); clip-path: circle(0% at 70% 72%); }
/* Unveiled, it drops the clip: no mask left on a card that moves every frame. */
.ob-art.is-loaded { clip-path: none; animation: ob-unveil 1.2s .1s cubic-bezier(.35,.6,.2,1) backwards; }
@keyframes ob-unveil { from { clip-path: circle(0% at 70% 72%); } to { clip-path: circle(110% at 70% 72%); } }
/* The frame floats; the painting only drifts in scale, so it is never redrawn as it moves. */
.ob-art__img { display: block; width: 100%; height: 100%; object-fit: cover; scale: 1.08; }
.ob-art.is-loaded .ob-art__img { animation: ob-art-in 1.6s .1s cubic-bezier(.2,.7,.2,1) both, ob-art-drift 14s 1.7s ease-in-out infinite alternate; }
@keyframes ob-art-in { from { scale: 1.22; filter: blur(5px) saturate(.6); } to { scale: 1.08; } }
@keyframes ob-art-drift { to { scale: 1.14; } }
.ob-art__steam { position: absolute; top: 47%; left: 72%; width: 0; height: 0; }
.ob-art__steam svg { position: absolute; bottom: 0; left: calc(var(--x) - 6px); width: 12px; height: 38px; overflow: visible; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; opacity: 0; filter: blur(.6px); animation: ob-steam 3s var(--d) ease-out infinite; }
.ob-art__steam svg:nth-child(1) { --x: -14px; --d: 1.3s; }
.ob-art__steam svg:nth-child(2) { --x: 0px; --d: 2.1s; }
.ob-art__steam svg:nth-child(3) { --x: 13px; --d: 2.9s; }
.ob-art__bao { position: absolute; bottom: -16px; left: -24px; width: 86px; height: 86px; filter: drop-shadow(0 8px 8px rgba(41,73,59,.18)); animation: ob-bao-hop .7s 1.15s cubic-bezier(.3,1.4,.5,1) both; transform-origin: 50% 90%; }
.ob-tea__glyph { display: inline-block; }

/* 茶 on its way from one step to the next (onboarding-world.js teaFly). */
.ob-tea-flight { position: absolute; z-index: 5; top: 0; left: 0; font-family: "Noto Serif SC", serif; line-height: 1; white-space: nowrap; text-shadow: 0 0 22px rgba(240,195,90,.8), 0 10px 18px rgba(41,73,59,.25); transition: color .35s; pointer-events: none; will-change: transform; }
.is-tea-waiting { visibility: hidden; }

/* Writing: the box opens on the painting, which fades as the ink goes down. */
.ob-write__art { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 16px; object-fit: cover; animation: ob-write-art 1.9s .15s ease-in both; }
@keyframes ob-write-art { 0%, 20% { opacity: 1; } 100% { opacity: 0; filter: blur(6px) saturate(.3); scale: 1.06; } }

/* chá hangs on the key of its tone. */
.ob-tone { position: relative; }
.ob-tone .ob-tone__tea { position: absolute; top: -13px; right: -7px; display: grid; justify-items: center; padding: 3px 6px 2px; border: 1.5px solid var(--c); border-radius: 12px; background: var(--white); box-shadow: 0 6px 12px -8px rgba(41,73,59,.55); font: inherit; rotate: 8deg; animation: ob-pop .45s .45s cubic-bezier(.3,1.6,.5,1) both; }
.ob-tone .ob-tone__tea b { color: var(--ink); font: 400 18px/1.05 "Noto Serif SC", serif; }
.ob-tone .ob-tone__tea small { color: var(--c); font-size: 9.5px; font-weight: 900; }

/* The garden's 茶 lies on its painting. */
.ob-garden .character-tile.has-art::before { content: ""; position: absolute; z-index: -1; inset: 0; background: var(--art) center / cover; opacity: .6; }
.ob-garden .character-tile.has-art .character-tile__hanzi, .ob-garden .character-tile.has-art .character-tile__meta { text-shadow: 0 0 6px #fff, 0 0 12px #fff; }

/* Passed chapters on the path lie on their paintings, fading into the card. */
.ob-path__row { isolation: isolate; }
.ob-path__row.is-passed::before { content: ""; position: absolute; z-index: -1; inset: -3px -8px -3px 34px; border-radius: 14px; background: var(--chapter-art) 85% 40% / cover no-repeat; opacity: .5; -webkit-mask-image: linear-gradient(90deg, transparent 40%, #000 85%); mask-image: linear-gradient(90deg, transparent 40%, #000 85%); }
:root[data-theme="dark"] .ob-path__row.is-passed::before { background-image: var(--chapter-art-dark); }

/* Short screens: the ground props sink behind Continue, clear of the text. */
@media (max-height: 760px) {
  .ob-world__prop.is-ground { bottom: calc(max(16px, var(--safe-bottom)) + 18px); height: 76px; }
  .ob-world__prop.is-sky { height: 54px; }
}

@media (prefers-reduced-motion: reduce) {
  .ob-world *, .onboarding__mascot.is-art, .ob-art, .ob-art *, .ob-tone .ob-tone__tea { animation: none !important; transition: none !important; }
  .ob-art { clip-path: none; }
  .ob-art__steam, .ob-write__art, .ob-world__cloud { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .onboarding__body.is-entering > *, .onboarding__body.is-entering .mascot, #onboardingProgress span.is-current::after,
  .ob-hello, .ob-tea, .onboarding__demo b, .onboarding__demo small, .ob-speak, .ob-speak::before, .ob-speak::after, .ob-wave,
  .pace-chart__line, .pace-chart__dot, .pace-chart__end, .pace-chart__badge, .ob-pace__mascot .mascot, .ob-pace__line,
  .ob-year__grid i, .ob-year__pin,
  .ob-write__stroke, .ob-part, .ob-quiz *, .ob-methods *, .ob-methods__core::after, .ob-garden .character-tile, .ob-garden__sheet, .ob-garden__printer, .ob-garden__wire path,
  .ob-tone, .ob-tone *, .ob-tones__hint, .ob-tea-tone path, .ob-sentence *, .ob-path *, .ob-path__road::before, .ob-level *, .ob-talk *, .ob-talk *::before { animation: none !important; }
  .ob-talk__wave { display: none !important; }
  .ob-methods__glyph { color: var(--ob-gold); }
  .ob-garden__wire path { stroke-dashoffset: 0; }
  .ob-steam, .ob-tea-steam, .ob-spark, .ob-confetti, .ob-tone__voice { display: none; }
}

@media (max-height: 700px) {
  .onboarding__mascot { width: 150px; height: 150px; }
  .onboarding__body h1 { font-size: 27px; }
  .onboarding__mascot.pace-chart { width: min(300px, calc(84vw / var(--ui-zoom, 1))); }
  .onboarding__stage[data-scene="year"] .onboarding__mascot { width: 86px; height: 86px; }
  .ob-pace__mascot { width: 52px; height: 52px; }
  .ob-write__box { width: min(170px, 27dvh); }
  .ob-quiz__prompt span { font-size: 50px; }
  .ob-quiz .probe-option { min-height: 42px; }
  .ob-garden .character-tile__meta { display: none; }
  .ob-garden { width: min(282px, 100%); margin-top: 50px; }
  .ob-garden__sheet { bottom: calc(100% - 4px); scale: .72; transform-origin: 100% 100%; }
  .ob-methods { width: min(290px, 100%); }
  .ob-talk .situation-live__gloss, .ob-talk .situation-line__who, .ob-talk .situation-line:nth-child(3) { display: none; }
  .ob-talk { gap: 6px; padding-top: 12px; }
  .ob-talk .situation-line__zh { font-size: 16px; }
  .ob-talk__mission .situation-live__missionText { font-size: 12.5px; }
  .ob-tone small { display: none; }
  .ob-sentence__line { margin-top: 0; }
  .ob-word small { display: none; }
  .ob-path__row { min-height: 34px; }
  .ob-path__node { width: 32px; height: 32px; font-size: 16px; }
  .ob-path__road::before { left: 15px; }
  .ob-path__more { width: 32px; }
  .ob-path__row:nth-child(2) .ob-path__lessons { display: none; }
  .ob-level__stairs { padding-top: 54px; }
  .ob-level__mascot { width: 48px; height: 48px; }
}

/* Touch handwriting practice. Centred, the field as wide as the card (Ivan, 2026-10-31: A′); no height term: the Mini App's
   height changes as it expands, and the writer is sized once per character. */
.handwriting {
  position: absolute; z-index: 6; inset: 0; display: flex; min-height: 0;
  flex-direction: column; align-items: center; justify-content: safe center; overflow-y: auto; padding: 14px 14px 10px;
  border-radius: 30px 30px 68px 30px; background: var(--white); box-shadow: var(--shadow);
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
.handwriting__eyebrow { margin: 0; color: var(--red-dark); font-size: 9px; font-weight: 800; letter-spacing: .16em; }
.handwriting__word { display: flex; min-height: 38px; align-items: center; justify-content: center; gap: 6px; margin-top: 4px; }
.handwriting__word span { padding: 0 6px; border: 2px solid transparent; border-radius: 10px; color: var(--ink); font: 25px "Noto Serif SC", serif; }
.handwriting__word:has(.is-active) span { color: var(--ink-soft); opacity: .38; }
.handwriting__word span.is-active { border-color: var(--red); color: var(--ink); opacity: 1; }
.handwriting__word span.is-done { color: var(--green); opacity: 1; }
.handwriting__meaning { margin: 1px 0 2px; color: var(--ink-soft); font-size: 11px; font-weight: 700; text-align: center; }
.handwriting__canvas {
  position: relative; width: min(360px, calc(100vw / var(--ui-zoom, 1) - 64px)); height: min(360px, calc(100vw / var(--ui-zoom, 1) - 64px)); flex: 0 0 auto;
  border: 1px solid var(--line); border-radius: 18px; background-color: var(--white);
  background-image: linear-gradient(rgba(23,59,54,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(23,59,54,.08) 1px, transparent 1px);
  background-size: 50% 50%; overflow: hidden; touch-action: none;
}
.handwriting__canvas svg, .handwriting__canvas canvas { display: block; touch-action: none; }
.handwriting__writer-svg > g > path { filter: url(#handwritingLiveBrush); }
.handwriting__writer-svg.is-concealed { visibility: hidden; }
.handwriting__brush-overlay { position: absolute; z-index: 2; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.handwriting__canvas { isolation: isolate; }
/* Learn in steps: the model with its last strokes gone, under Hanzi Writer's hints and the learner's ink. */
.handwriting__fade-outline { position: absolute; z-index: 0; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.handwriting__fade-outline path { fill: #d8d1c3; }
.handwriting__writer-svg { position: relative; z-index: 1; }
.handwriting__brush-stroke { fill: #df553f; filter: drop-shadow(0 .4px .35px rgba(80, 35, 22, .2)); }
.handwriting__comparison { position: absolute; inset: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); }
.handwriting__comparison-side { position: relative; display: flex; min-width: 0; flex-direction: column; align-items: center; justify-content: center; background: var(--white); }
/* Both captions share one baseline at the foot of the card. */
.handwriting__comparison-side small { position: absolute; right: 0; bottom: 9px; left: 0; color: var(--ink-soft); font-size: 10px; font-weight: 700; opacity: .75; text-align: center; }
.handwriting__comparison-reference span { color: var(--ink); font: clamp(72px, 24vw, 102px) "Noto Serif SC", serif; line-height: 1; }
.handwriting__comparison-drawing { padding: 4px; }
.handwriting__result-svg { width: 100%; height: auto; max-height: calc(100% - 24px); }
/* A word's result: the model's characters on top, the learner's under them, one square cell each. */
.handwriting__comparison--word { grid-template-columns: none; grid-template-rows: 1fr 1fr; }
.handwriting__comparison--word .handwriting__comparison-side { padding: 0 0 22px; }
.handwriting__comparison-glyphs { display: flex; align-items: center; justify-content: center; }
.handwriting__comparison-glyphs > * { flex: none; width: var(--cell); height: var(--cell); }
.handwriting__comparison--word .handwriting__comparison-reference span { display: grid; place-items: center; font-size: calc(var(--cell) * .8); }
.handwriting__comparison--word .handwriting__result-svg { max-height: none; }
/* The ink follows the theme: the dark one's canvas is as dark as the old ink. */
.handwriting__result-svg path:not(.is-missed) { fill: var(--ink); }
/* The verdict takes the prompt's place once the glyph is written. */
.handwriting__eyebrow[data-verdict] { position: relative; color: var(--ink-soft); font-size: 17px; font-weight: 900; letter-spacing: .02em; line-height: 1.2; animation: verdict-in .45s cubic-bezier(.2,1.5,.4,1) both; }
.handwriting__eyebrow[data-verdict="good"] { color: var(--green); }
/* Perfect: gold ink with a light sweeping across it and a warm halo; two
 * sparks twinkle at the sides and the card glows. A cousin of the legendary
 * sticker (glow + shine), without its rays and violet. */
.handwriting__eyebrow[data-verdict="perfect"] { padding: 0 20px; }
.handwriting__eyebrow[data-verdict="perfect"] .handwriting__verdict {
  background: linear-gradient(100deg, #b8741a 0%, #eaa92a 32%, #fff1bf 47%, #eaa92a 62%, #c9661c 100%);
  background-size: 260% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 8px rgba(245, 180, 50, .65));
  animation: verdict-shine 2.8s ease-in-out .4s infinite;
}
.handwriting__eyebrow[data-verdict="perfect"]::before, .handwriting__eyebrow[data-verdict="perfect"]::after {
  content: "✦"; position: absolute; top: 50%; color: #f2b632; font-size: 11px; translate: 0 -50%;
  text-shadow: 0 0 6px rgba(245, 180, 50, .8); animation: verdict-spark 1.8s ease-in-out infinite;
}
.handwriting__eyebrow[data-verdict="perfect"]::before { left: 0; }
.handwriting__eyebrow[data-verdict="perfect"]::after { right: 0; font-size: 8px; animation-delay: .9s; }
.handwriting__canvas.is-perfect { border-color: rgba(234, 169, 42, .6); box-shadow: 0 0 0 1px rgba(234, 169, 42, .3), 0 0 20px rgba(245, 180, 50, .3); animation: perfect-glow 2.8s ease-in-out infinite; }
@keyframes verdict-in { from { opacity: 0; scale: .6; } }
@keyframes verdict-shine { 0% { background-position: 100% 0; } 60%, 100% { background-position: 0 0; } }
@keyframes verdict-spark { 50% { opacity: .35; scale: .7; } }
@keyframes perfect-glow { 0%, 100% { box-shadow: 0 0 0 1px rgba(234, 169, 42, .25), 0 0 16px rgba(245, 180, 50, .22); } 50% { box-shadow: 0 0 0 1px rgba(234, 169, 42, .45), 0 0 26px rgba(245, 180, 50, .42); } }
@media (prefers-reduced-motion: reduce) {
  .handwriting__eyebrow[data-verdict], .handwriting__eyebrow[data-verdict] .handwriting__verdict, .handwriting__eyebrow[data-verdict]::before, .handwriting__eyebrow[data-verdict]::after { animation: none; }
  .handwriting__eyebrow[data-verdict="perfect"] .handwriting__verdict { background-position: 50% 0; }
  .handwriting__canvas.is-perfect { animation: none; }
}
.handwriting__status { min-height: 18px; margin: 6px 0 4px; color: var(--ink-soft); font-size: 11px; font-weight: 700; }
#cantWrite { margin-top: 10px; }
.handwriting__report { position: absolute; top: 8px; right: 10px; }
.handwriting__tools, .handwriting__complete { display: grid; width: 100%; grid-template-columns: 1fr 1fr; gap: 8px; }
.handwriting__tools button { min-height: 40px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); color: var(--ink); font-size: 10px; font-weight: 800; }
.handwriting__complete .menu-primary, .handwriting__complete .menu-secondary { min-height: 44px; margin: 0; justify-content: center; }
.handwriting-auto-hint { margin-top: 12px; text-align: left; }
.handwriting-auto-hint > span:first-child { display: grid; gap: 2px; }
.handwriting-auto-hint b { font-size: 11px; }
.handwriting-auto-hint small { color: var(--ink-soft); font-size: 9px; line-height: 1.35; }
@media (max-height: 690px) {
  .handwriting { padding-top: 8px; }
  .handwriting__canvas { width: min(220px, calc(100vw / var(--ui-zoom, 1) - 84px)); height: min(220px, calc(100vw / var(--ui-zoom, 1) - 84px)); }
}

/* ==================================================================
 * Roadmap: levels, path, achievements, cloze, exam, tutorials, paywall
 * ================================================================== */

.pro-badge { display: inline-block; margin-left: 5px; padding: 1px 6px; border-radius: 99px; background: var(--ink); color: var(--paper); font-size: 8px; font-style: normal; font-weight: 800; letter-spacing: .08em; vertical-align: middle; }
.chip.is-selected .pro-badge { background: var(--on-ink); color: var(--ink); }
.segmented button .pro-badge { display: block; flex-grow: 0; width: max-content; margin: 3px auto 0; }
.fieldset-hint { margin: -2px 2px 10px; color: var(--ink-soft); font-size: 11px; line-height: 1.4; }

/*
 * Bao's line (home): the bubble opens from Bao's side, and Bao slides left to
 * make room. The wrapper animates its width; the bubble keeps a fixed width
 * inside it so the text never re-wraps mid-animation.
 */
.hero-bao { display: flex; justify-content: center; align-items: center; container-type: inline-size; }
.bao-say { flex: none; max-width: 0; overflow: hidden; opacity: 0; transition: max-width .45s cubic-bezier(.2,.75,.25,1), opacity .3s ease; }
.bao-say.is-open { max-width: 244px; opacity: 1; }
.bao-bubble { position: relative; display: block; width: 200px; width: min(222px, calc(100cqw - 128px)); margin: 6px 4px 14px 16px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--white); color: var(--ink); font-size: 12.5px; font-weight: 650; line-height: 1.38; text-align: left; overflow-wrap: anywhere; box-shadow: 0 10px 24px -16px rgba(41,73,59,.45); cursor: pointer; }
.bao-bubble::before { content: ""; position: absolute; top: 50%; left: -6px; width: 10px; height: 10px; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); background: inherit; transform: translateY(-50%) rotate(45deg); }
.bao-bubble.has-cta::after { content: "›"; margin-left: 5px; color: var(--red); font-weight: 800; }
@media (prefers-reduced-motion: reduce) { .bao-say { transition: none; } }

/* --- hero level chip (home), next to the streak --- */
.hero-chips { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin: 0 0 8px; }
.hero-chips .streak-chip { margin: 0; }
/* The hero chips and a card's quiet "Hide" are tapped with a thumb: at least 32 and 40 px tall. */
.hero-chips > * { min-height: 32px; }
.hero-chips .streak-chip { display: inline-flex; align-items: center; }
.offer-card__actions .link-button { min-height: 40px; padding-inline: 8px; }
/* The pill fills from the left with progress towards the next level. */
.level-chip { position: relative; isolation: isolate; display: inline-flex; align-items: center; gap: 5px; overflow: hidden; padding: 4px 11px; border: 1px solid var(--line); border-radius: 999px; background: rgba(var(--glass-rgb), .66); color: var(--ink); font-size: 11px; white-space: nowrap; cursor: pointer; }
.level-chip::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(239,184,142,.45), rgba(223,85,63,.28)); transform-origin: left; transform: scaleX(var(--xp, 0)); transition: transform .5s cubic-bezier(.2,.75,.25,1); }
.level-chip b { font-weight: 800; }
.level-chip span { color: var(--red-dark); font-weight: 800; }

/* --- stacked progress (home): mastered, remembered, learning --- */
.stack-bar { display: flex; height: 9px; overflow: hidden; border-radius: 99px; background: rgba(23,59,54,.11); }
.stack-bar__seg { height: 100%; width: 0; transition: width .5s cubic-bezier(.2,.75,.25,1); }
.stack-bar__seg + .stack-bar__seg { box-shadow: inset 1px 0 0 rgba(var(--glass-rgb), .8); }
.stack-bar__seg--mastered, .stack-legend__item--mastered i { background: var(--stack-mastered); }
.stack-bar__seg--remembered, .stack-legend__item--remembered i { background: var(--stack-remembered); }
.stack-bar__seg--learning, .stack-legend__item--learning i { background: var(--stack-learning); }
.stack-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 8px; color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.stack-legend__item { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.stack-legend__item i { width: 8px; height: 8px; border-radius: 50%; }
.stack-legend__item b { color: var(--ink); font-weight: 800; }
.stack-legend__total { margin-left: auto; }
:root[data-theme="dark"] .stack-bar,
:root[data-theme="dark"] .progress-track { background: rgba(229,235,217,.12); }

/* A soft glow behind Bao that changes with the level stage. */
.mascot-slot[data-stage] { position: relative; }
.mascot-slot[data-stage]::before { content: ""; position: absolute; inset: 6%; z-index: -1; border-radius: 50%; background: radial-gradient(circle, var(--stage-glow, transparent) 0 58%, transparent 70%); }
.mascot-slot[data-stage="dough"] { --stage-color: #c9bca6; --stage-glow: rgba(201,188,166,.18); }
.mascot-slot[data-stage="filling"] { --stage-color: #b8a07c; --stage-glow: rgba(184,160,124,.2); }
.mascot-slot[data-stage="folded"] { --stage-color: #8fb096; --stage-glow: rgba(143,176,150,.24); }
.mascot-slot[data-stage="steaming"] { --stage-color: #6f9fae; --stage-glow: rgba(111,159,174,.24); }
.mascot-slot[data-stage="fluffy"] { --stage-color: #a58bc4; --stage-glow: rgba(165,139,196,.24); }
.mascot-slot[data-stage="golden"] { --stage-color: #d9a441; --stage-glow: rgba(217,164,65,.28); }
.mascot-slot[data-stage="master"] { --stage-color: #df553f; --stage-glow: rgba(223,85,63,.24); }

/* --- path card (home) --- */
.path-card { display: block; width: 100%; margin-bottom: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 20px; background: var(--white); color: var(--ink); font: inherit; text-align: left; box-shadow: 0 8px 28px -22px rgba(41,73,59,.28); cursor: pointer; }
.path-card .menu-kicker, .daily-word .menu-kicker { display: block; color: var(--red-dark); }
.path-card__row { display: flex; align-items: center; gap: 12px; margin: 8px 0 10px; }
/* The chapter's painting sits on the right, above the progress bar; the text
   column stops short of it so Bao is never covered. The layer is only as wide
   as the painting, so its left edge fades out at every card width. */
#openPath { position: relative; z-index: 1; isolation: isolate; overflow: hidden; cursor: default; }
#openPath::before {
  content: ""; position: absolute; z-index: -1; top: 0; right: 0; bottom: 24px; width: 290px; pointer-events: none;
  background: var(--chapter-art) no-repeat right 14px center / auto 104px;
  -webkit-mask-image: linear-gradient(90deg, transparent 2%, #000 50%), linear-gradient(180deg, transparent 4%, #000 24%, #000 80%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(90deg, transparent 2%, #000 50%), linear-gradient(180deg, transparent 4%, #000 24%, #000 80%, transparent);
  mask-composite: intersect;
}
#openPath .path-card__copy { max-width: calc(100% - 205px); }
/* Dark theme: the same painting with its paper made transparent
   (tools/chapter_art_dark.py). */
:root[data-theme="dark"] #openPath::before { background-image: var(--chapter-art-dark); }
@media (max-width: 440px) {
  #openPath::before { width: 240px; background-position: right 20px center; background-size: auto 82px; }
  #openPath .path-card__copy { max-width: calc(100% - 150px); }
}
.path-card__main { display: block; width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.path-card__glyph { display: grid; width: 48px; height: 48px; flex: 0 0 auto; place-items: center; border-radius: 16px 16px 16px 6px; background: var(--ink); color: var(--paper); font: 26px "Noto Serif SC", serif; }
.path-card__copy { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.path-card__copy b { font-size: 16px; font-weight: 800; letter-spacing: -.02em; }
.path-card__copy small { margin-top: 3px; color: var(--ink-soft); font-size: 11px; font-weight: 700; }
/* The whole chapter; the tick marks where its checkpoint opens. */
.path-card__track { position: relative; display: block; overflow: visible; }
.path-card__track > span { overflow: hidden; }
/* Words met but not yet reviewed: a lighter layer under the remembered fill. */
.path-card__track > .path-card__seen { position: absolute; inset: 0; opacity: .3; }
.path-card__track > #pathCardFill { position: relative; }
.path-card__mark { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--ink); opacity: .55; }
.offer-card { cursor: default; }
.offer-card h2 { margin: 6px 0 0; font-size: 16px; }
.offer-card p { margin: 3px 0 0; color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.offer-card__actions { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.offer-card__actions .menu-secondary { flex: 1; margin: 0; }

/* --- path screen --- */
.path-screen, .achievements-screen { display: flex; flex-direction: column; padding: max(16px, var(--safe-top)) 16px 0; }
.path-heading { flex: 1; min-width: 0; text-align: center; }
.path-heading h2 { margin: 0; font-size: 19px; }
.path-heading small { color: var(--ink-soft); font-size: 10px; font-weight: 700; }
.header-spacer { width: 44px; }
.path-scroll, .achievements-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 4px 24px; }
/* Chapters scrolled past the edges fade out instead of being sliced off. */
.path-scroll { -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%); mask-image: linear-gradient(to bottom, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%); }
.path-level { margin: 6px 0 2px; color: var(--ink-soft); font-size: 10px; font-weight: 800; letter-spacing: .16em; text-align: center; }
.path-map { position: relative; margin: 0; padding: 30px 0 8px; list-style: none; }
.path-node { position: relative; height: 92px; }
.path-trail { position: absolute; top: 0; left: 0; z-index: 0; overflow: visible; pointer-events: none; }
.path-trail path { fill: none; stroke-linecap: round; stroke-width: 3; }
.path-trail__base { stroke: var(--line); stroke-dasharray: 7 7; }
.path-trail__done { stroke: var(--red); stroke-dasharray: 7 7; opacity: .6; }
.path-node__button { position: absolute; top: 14px; left: calc(50% - 32px + var(--offset, 0px)); z-index: 1; width: 64px; height: 64px; padding: 0; border: 0; background: transparent; color: var(--ink); cursor: pointer; }
.path-node__disc { position: relative; display: grid; width: 64px; height: 64px; place-items: center; border: 3px solid var(--line); border-radius: 50%; background: var(--white); font: 28px "Noto Serif SC", serif; box-shadow: 0 8px 18px -12px rgba(23,59,54,.5); }
/* Only the progress ring: Bao (also an SVG in the disc) must not turn or restyle. */
.path-node__ring { position: absolute; inset: -3px; width: calc(100% + 6px); height: calc(100% + 6px); transform: rotate(-90deg); }
.path-node__ring circle { fill: none; stroke: var(--red); stroke-width: 3; stroke-linecap: round; }
.path-node__ring circle.is-seen { stroke-opacity: .3; }
.path-node__label { position: absolute; top: 50%; left: 76px; display: grid; width: 118px; gap: 1px; text-align: left; transform: translateY(-50%); }
.path-node.is-right .path-node__label { right: 76px; left: auto; text-align: right; }
.path-node__label b { font-size: 12px; line-height: 1.2; }
.path-node__label small { color: var(--ink-soft); font-size: 10.5px; font-weight: 700; }
.path-node.is-done .path-node__disc { border-color: var(--red); background: var(--tint-red); }
.path-node.is-current .path-node__disc { border-color: var(--ink); background: var(--ink); color: var(--paper); transform: scale(1.08); }
/* The current chapter is ready for its checkpoint: a gold ring invites the test. */
.path-node.is-ready .path-node__disc { box-shadow: 0 0 0 3px #e3b341, 0 0 18px rgba(227, 179, 65, .55); }
.path-node.is-locked .path-node__disc { border-color: var(--paper-deep); background: var(--paper); color: rgba(75,98,93,.5); box-shadow: none; }
.path-node.is-locked .path-node__label { opacity: .6; }
.path-node__bao { position: absolute; bottom: -8px; left: -30px; z-index: 2; width: 44px; height: 44px; pointer-events: none; }
.path-node.is-right .path-node__bao { right: -30px; left: auto; }
/* Scenery on the side without a label, sized to the room left beside the disc. */
.path-node__decor { position: absolute; top: 50%; left: 6px; z-index: 0; width: min(76px, calc(50% + var(--offset, 0px) - 46px)); height: auto; max-height: 84px; object-fit: contain; opacity: .9; pointer-events: none; transform: translateY(-38%); }
.path-node.is-right .path-node__decor { right: 6px; left: auto; width: min(76px, calc(50% - var(--offset, 0px) - 46px)); }
:root[data-theme="dark"] .path-node__decor { opacity: .7; }
.path-node__bao .mascot { width: 100%; height: 100%; }
.path-node__lessons[hidden] { display: none; }
.path-node__lessons { position: absolute; top: -5px; left: -5px; z-index: 2; display: grid; width: 24px; height: 24px; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--white); color: var(--red-dark); box-shadow: 0 3px 8px -4px rgba(23,59,54,.45); }
.path-node__lessons svg { width: 14px; height: 14px; }
.path-node__crown { position: absolute; top: -9px; right: -6px; font-size: 16px; }
.path-hint { margin: 8px 16px 0; color: var(--ink-soft); font-size: 11px; line-height: 1.45; text-align: center; }

/* --- chapter sheet --- */
/* A tall sheet: the glyph, the progress bar and the actions stay put, the
   chapter's characters and its theory scroll between them. dvh, not a
   percentage: the overlay's grid row is auto-sized, so a percentage
   max-height would not resolve. */
.chapter-card { position: relative; display: flex; max-height: calc(100dvh / var(--ui-zoom, 1) - 56px); flex-direction: column; padding: 18px 18px 16px; text-align: center; }
.chapter-scroll { min-height: 0; flex: 1 1 auto; overflow-y: auto; padding-bottom: 4px; }
.chapter-card__close { position: absolute; z-index: 1; top: 12px; right: 12px; display: grid; width: 32px; height: 32px; place-items: center; border: 0; border-radius: 50%; background: var(--paper); color: var(--ink-soft); cursor: pointer; }
.chapter-card__glyph { display: grid; width: 64px; height: 64px; margin: 0 auto 8px; place-items: center; border-radius: 20px 20px 20px 8px; background: var(--ink); color: var(--paper); font: 34px "Noto Serif SC", serif; }
/* The chapter at a glance: one bar, three nested stages, and the line where
   its checkpoint opens (the same bar the home card carries). */
.chapter-progress { margin: 14px 0 12px; text-align: left; }
.chapter-progress__track { position: relative; display: block; overflow: visible; }
.chapter-progress__layer { position: absolute; inset: 0; border-radius: inherit; }
.chapter-progress .chapter-progress__layer--seen { background: var(--red); opacity: .3; }
.chapter-progress .chapter-progress__layer--remembered { background: var(--red); }
.chapter-progress .chapter-progress__layer--mastered { background: var(--ink); }
.chapter-progress__mark { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--ink); opacity: .55; }
.chapter-progress__text { margin: 8px 0 0; color: var(--ink-soft); font-size: 12px; font-weight: 700; line-height: 1.4; }
.chapter-legend { display: flex; flex-wrap: wrap; gap: 3px 12px; margin: 8px 0 0; font-size: 10px; font-weight: 700; color: var(--ink-soft); }
.chapter-legend__item { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.chapter-legend__item b { color: var(--ink); font-size: 11px; }
.chapter-legend__chip { width: 8px; height: 8px; border-radius: 3px; background: var(--muted); }
.chapter-legend__chip--seen { background: var(--red); opacity: .3; }
.chapter-legend__chip--remembered { background: var(--red); }
.chapter-legend__chip--mastered { background: var(--ink); }
.chapter-card .menu-secondary { margin-top: 8px; }
/* The chapter's characters as tiles, tinted by how well each one is known. */
.chapter-words { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; margin: 0 0 14px; }
.chapter-words button { display: grid; min-width: 37px; height: 37px; padding: 0 8px; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: #9aa59f; font: 16px "Noto Serif SC", serif; white-space: nowrap; }
.chapter-words button.state-learning { border-color: #cfe0cf; background: rgba(var(--jade-rgb), .34); color: var(--ink); }
.chapter-words button.state-familiar { border-color: #cfe0cf; background: rgba(var(--jade-rgb), .58); color: var(--ink); }
.chapter-words button.state-remembered { border-color: #b9d3bd; background: linear-gradient(135deg, rgba(var(--jade-rgb), .72), rgba(255,255,255,.45) 50%, rgba(var(--jade-rgb), .6)); color: var(--ink); }
.chapter-words button.state-mastered { border-color: var(--shine-edge); background: var(--shine-foil); color: var(--shine-ink); box-shadow: 0 1px 4px var(--shine-glow); }
/* The actions stay at the sheet's foot; a soft edge above them says the
   characters and the theory carry on under it. */
.chapter-actions { position: relative; display: flex; flex: 0 0 auto; gap: 8px; }
.chapter-actions::before { content: ""; position: absolute; right: -18px; bottom: 100%; left: -18px; height: 16px; background: linear-gradient(transparent, var(--white)); pointer-events: none; }
.chapter-actions .menu-primary, .chapter-actions .menu-secondary { flex: 1; margin-top: 0; }
.chapter-print { display: grid; width: 48px; min-height: 48px; flex: 0 0 auto; place-items: center; border: 1px solid var(--line); border-radius: 15px; background: var(--white); color: var(--ink); cursor: pointer; }

/* --- achievements --- */
.achievements-card { display: flex; width: 100%; align-items: center; gap: 12px; margin-top: 10px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 20px; background: var(--white); color: var(--ink); text-align: left; cursor: pointer; }
.achievements-card__icons { display: flex; flex-shrink: 0; }
.achievements-card__icons img { width: 40px; height: 40px; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(37,45,34,.18)); }
.achievements-card__icons img + img { margin-left: -10px; }
.achievements-card__icons img.is-locked { filter: grayscale(1); opacity: .45; }
.achievements-card__copy { display: grid; flex: 1; min-width: 0; }
.achievements-card__copy b { font-size: 14px; }
.achievements-card__copy small { color: var(--ink-soft); font-size: 10px; font-weight: 700; }
.achievement-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 0; padding: 0; list-style: none; }
.achievement { display: grid; justify-items: center; gap: 4px; padding: 14px 10px 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--white); text-align: center; }
.achievement__badge { position: relative; display: block; width: 96px; height: 80px; margin-bottom: 2px; }
.achievement__art { --pad: 16px; position: absolute; inset: calc(var(--pad) * -1); display: block; box-sizing: border-box; padding: var(--pad); filter: grayscale(1); opacity: .38; }
.achievement.is-unlocked .achievement__art { filter: drop-shadow(0 5px 8px rgba(37,45,34,.16)); opacity: 1; transform-origin: 50% 90%; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.achievement__art.is-hopping { animation: sticker-hop .6s ease-out; }
@media (prefers-reduced-motion: reduce) { .achievement__art.is-hopping { animation: none; } }

/* --- achievement tiers (achievements.js → TIERS), hardest first --- */
.achievement[data-tier="legendary"], .achievement-tier[data-tier="legendary"] { --tier-bg: linear-gradient(90deg, #7b4dff, #ff4f9a); --tier-ink: #fff; }
.achievement[data-tier="gold"], .achievement-tier[data-tier="gold"] { --tier-bg: #f4c64f; --tier-ink: #4c2a05; }
.achievement[data-tier="silver"], .achievement-tier[data-tier="silver"] { --tier-bg: #dde2e8; --tier-ink: #3b4652; }
.achievement[data-tier="bronze"], .achievement-tier[data-tier="bronze"] { --tier-bg: #ecc19b; --tier-ink: #5a2f12; }
.achievement__tier { padding: 2px 8px; border-radius: 99px; background: var(--tier-bg); color: var(--tier-ink); font-size: 8.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.achievement:not(.is-unlocked) .achievement__tier { opacity: .55; }
.achievement-tier { display: flex; grid-column: 1 / -1; align-items: center; gap: 8px; margin: 12px 2px 0; }
.achievement-tier:first-child { margin-top: 0; }
.achievement-tier::before { width: 12px; height: 12px; flex: 0 0 auto; border-radius: 50%; background: var(--tier-bg); content: ""; }
.achievement-tier::after { height: 1px; flex: 1; background: var(--line); content: ""; }
.achievement-tier b { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.achievement-tier small { color: var(--ink-soft); font-size: 11px; font-weight: 800; }

/*
 * Legendary: the badge reveal. Gold rays turn behind the sticker over a
 * violet glow, a light sweeps across the sticker's own shape (a white copy
 * masked by a moving band), sparkles twinkle. In the unlock modal a ring
 * bursts and confetti flies first.
 */
.achievement-grid .achievement.is-unlocked[data-tier="legendary"] { overflow: hidden; border-color: rgba(139,92,255,.38); background: linear-gradient(165deg, rgba(139,92,255,.13), rgba(255,79,154,.08) 55%, var(--white)); }
.legend-glow, .legend-rays { position: absolute; top: 50%; left: 50%; aspect-ratio: 1; border-radius: 50%; translate: -50% -50%; pointer-events: none; }
.legend-glow { width: 150%; background: radial-gradient(circle, rgba(161,92,255,.5), rgba(255,79,154,.2) 45%, transparent 68%); animation: legend-pulse 2.8s ease-in-out infinite; }
.legend-rays { width: 200%; background: repeating-conic-gradient(rgba(255,196,70,.6) 0 4deg, transparent 4deg 22.5deg); -webkit-mask-image: radial-gradient(circle, transparent 20%, #000 32%, transparent 68%); mask-image: radial-gradient(circle, transparent 20%, #000 32%, transparent 68%); animation: legend-spin 18s linear infinite; }
.legend-shine { position: absolute; top: var(--pad, 0px); left: var(--pad, 0px); width: calc(100% - 2 * var(--pad, 0px)); height: calc(100% - 2 * var(--pad, 0px)); object-fit: contain; filter: brightness(0) invert(1); opacity: .75; pointer-events: none; -webkit-mask-image: linear-gradient(110deg, transparent 38%, #000 50%, transparent 62%); mask-image: linear-gradient(110deg, transparent 38%, #000 50%, transparent 62%); -webkit-mask-size: 300% 100%; mask-size: 300% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; animation: legend-shine 3.6s ease-in-out 1.2s infinite both; }
.achievement__badge .sticker-spark { z-index: 1; }
.sticker-stack.is-legendary .legend-glow { width: 230px; animation: legend-in .6s .45s both, legend-pulse 2.8s ease-in-out 1.05s infinite; }
.sticker-stack.is-legendary .legend-rays { width: 300px; animation: legend-in .6s .45s both, legend-spin 18s linear infinite; }
/* The card's text stays above the rays. */
.sticker-stack.is-legendary ~ * { position: relative; }
.legend-ring { position: absolute; top: 50%; left: 50%; width: 120px; aspect-ratio: 1; border: 3px solid #ffc93c; border-radius: 50%; box-shadow: 0 0 18px rgba(255,201,60,.7); opacity: 0; translate: -50% -50%; pointer-events: none; animation: legend-ring .9s ease-out .45s forwards; }
.legend-confetti { position: absolute; top: 50%; left: 50%; width: 6px; height: 11px; margin: -5px 0 0 -3px; border-radius: 2px; background: var(--c); opacity: 0; pointer-events: none; animation: legend-confetti 1.4s cubic-bezier(.15,.7,.3,1) .5s forwards; }
@keyframes legend-spin { to { rotate: 360deg; } }
@keyframes legend-pulse { 50% { opacity: .75; scale: 1.08; } }
@keyframes legend-in { from { opacity: 0; scale: .3; } }
@keyframes legend-shine { 0%, 55% { -webkit-mask-position: 100% 0; mask-position: 100% 0; } 100% { -webkit-mask-position: 0 0; mask-position: 0 0; } }
@keyframes legend-ring { 0% { opacity: .95; scale: .3; } 100% { opacity: 0; scale: 2.3; } }
@keyframes legend-confetti {
  0% { opacity: 1; transform: rotate(var(--a)) translateY(0) scale(.5); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--a)) translateY(calc(var(--d) * -1)) rotate(var(--r)); }
}
@media (prefers-reduced-motion: reduce) {
  .legend-glow, .legend-rays, .legend-shine, .sticker-stack.is-legendary .legend-glow, .sticker-stack.is-legendary .legend-rays { animation: none; }
  .legend-shine, .legend-ring, .legend-confetti { display: none; }
}
.achievement b { font-size: 12px; line-height: 1.2; }
.achievement small { color: var(--ink-soft); font-size: 9.5px; line-height: 1.35; }
.achievement .progress-track { width: 80%; height: 5px; margin-top: 2px; }
.achievement__meta { color: var(--ink-soft); font-size: 10px; font-weight: 800; }
.achievement.is-unlocked .achievement__meta { color: var(--red-dark); }

/* --- session: reason line, cloze, exam --- */
.probe__reason { align-self: center; margin: 0 0 -4px; padding: 3px 10px; border-radius: 99px; background: rgba(23,59,54,.07); color: var(--ink-soft); font-size: 10px; font-weight: 800; letter-spacing: .04em; text-align: center; }
.quiz-hanzi.quiz-prompt--phrase { font-family: "Noto Serif SC", serif; font-size: clamp(26px, 8vw, 36px); line-height: 1.35; letter-spacing: .02em; text-align: center; }
.quiz-hanzi .cloze-gap { display: inline-block; margin: 0 .08em; color: var(--red); letter-spacing: -.1em; }
.probe__question.is-hint { color: var(--ink-soft); font-size: 14px; font-style: italic; text-align: center; }
.cloze-full { margin: 0; font: 24px "Noto Serif SC", serif; text-align: center; }
.cloze-full b { color: var(--red-dark); }
.answer-sentence { display: flex; align-items: center; justify-content: center; gap: 10px; }
.answer-sentence:not(:has(> :not([hidden]))) { display: none; }
.answer-speak { flex: 0 0 auto; }
.cloze-ru { margin: 0 0 6px; color: var(--ink-soft); font-size: 13px; text-align: center; }
.probe-option.is-picked { border-color: var(--ink); background: var(--paper-deep); box-shadow: inset 0 0 0 1px var(--ink); }
.result-sub { margin: 6px 0 0; color: var(--ink-soft); font-size: 13px; font-weight: 700; }
/* Bao reacts to the round once it is over (never during it). */
.result-bao { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.result-bao[hidden] { display: none; }
/* The games panel is centred, so Bao's row is too while his line keeps reading from the left. */
.game-bao { justify-content: center; margin: 12px 0 2px; text-align: left; }
.result-bao__mascot { flex: none; width: 60px; height: 60px; }
.result-bao__mascot .mascot { animation: result-bao-hop .7s ease-out both; transform-origin: 50% 90%; }
.result-bao__line { margin: 0; padding: 12px 15px; border: 1px solid var(--line); border-radius: 18px 18px 18px 6px; background: var(--white); color: var(--ink); font-size: 13px; font-weight: 700; line-height: 1.35; animation: result-bao-line .4s .2s ease-out both; }
@keyframes result-bao-hop { 0% { opacity: 0; transform: translateY(14px) scale(.85) } 55% { opacity: 1; transform: translateY(-8px) scale(1.04) } 100% { transform: none } }
@keyframes result-bao-line { from { opacity: 0; transform: translateX(-8px) } }
.result-screen.is-exam-passed .result-heading h1 { color: var(--hit); }
.result-screen.is-exam-failed .result-heading h1 { color: var(--red-dark); }

/* --- tutorials --- */
.tutorial { position: absolute; z-index: 45; inset: 0; display: flex; flex-direction: column; padding-top: max(18px, var(--safe-top)); background: var(--paper); }
.tutorial__body { display: flex; flex: 1; min-height: 0; flex-direction: column; align-items: center; justify-content: center; overflow-y: auto; padding: 10px 26px; text-align: center; }
.tutorial__mascot { width: min(150px, 40vw); height: min(150px, 20dvh); margin-bottom: 6px; }
.tutorial__body h1 { max-width: 340px; margin: 10px 0 8px; font-size: 28px; line-height: 1.12; letter-spacing: -.04em; }
.tutorial__body > p { max-width: 330px; margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.55; }
.tutorial__demo { width: min(320px, 100%); margin-top: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 22px; background: var(--white); }
.tutorial__prompt { margin: 0 0 4px; font: 40px "Noto Serif SC", serif; line-height: 1.2; }
.tutorial__prompt.is-phrase { font-size: 30px; }
.tutorial__prompt .speaker-icon { width: .8em; height: .8em; vertical-align: -.08em; }
.tutorial__hint { margin: 0 0 10px; color: var(--ink-soft); font-size: 13px; font-style: italic; }
.tutorial__options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tutorial__options .probe-option { min-height: 46px; }
.tutorial__options.is-hanzi .probe-option { font: 24px "Noto Serif SC", serif; }
.tutorial__write { width: 200px; height: 200px; margin: 0 auto; border: 1px solid var(--line); border-radius: 16px; background: var(--white); background-image: linear-gradient(rgba(23,59,54,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(23,59,54,.08) 1px, transparent 1px); background-size: 50% 50%; touch-action: none; }
.tutorial__feedback { min-height: 18px; margin: 10px 0 0; font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.tutorial__feedback.is-good { color: var(--hit); }
.tutorial__feedback.is-bad { color: var(--red-dark); }
.tutorial-list { display: flex; flex-wrap: wrap; gap: 7px; }
.tutorial-list button { padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink); font-size: 12px; font-weight: 800; cursor: pointer; }
.tutorial-list button.is-seen::after { content: " ✓"; color: var(--hit); }

/* --- paywall --- */
.paywall-card { max-width: 380px; padding: 20px 20px 16px; text-align: center; }
/* A promo code just worked: on top of the paywall, until the learner closes it. */
.overlay--top { z-index: 11; }
.promo-done__code { display: inline-block; margin: 2px 0 12px; padding: 6px 12px; border-radius: 10px; background: var(--tint-red); color: var(--red-dark); font-size: 15px; }
/* The header: Bao Pro on a golden sunburst in the page's own colours; the rays reach up behind the bar with the tabs
 * (Ivan, 2026-10-27: «пусть фон будет по теме телефона. Пусть лучи пробивают секцию выше»). */
.paywall-card { position: relative; overflow: hidden; padding-top: 0; }
.paywall-head { position: relative; isolation: isolate; margin: 0 -20px 14px; padding: 6px 22px 18px; }
.paywall-head::before { content: ""; position: absolute; inset: -56px 0 0; z-index: -2; pointer-events: none; background: radial-gradient(80% 70% at 50% 40%, #fff3cf, transparent 70%), linear-gradient(180deg, #fff8e6, transparent); -webkit-mask-image: linear-gradient(180deg, #000 60%, transparent); mask-image: linear-gradient(180deg, #000 60%, transparent); }
:root[data-theme="dark"] .paywall-head::before { background: radial-gradient(80% 70% at 50% 40%, rgba(240, 196, 92, .22), transparent 70%); }
/* Bao Pro comes alive: two fans of rays turn opposite ways at different
 * speeds and breathe out of step, so the beams flare where they meet and fade
 * elsewhere; sparks light up on Bao's stars like the legendary sticker's, and
 * three a side out in the rays; a light sweeps across Bao, Bao sways, and a
 * light runs over the button. */
.paywall-rays { position: absolute; z-index: -1; left: 50%; top: 78px; width: 760px; aspect-ratio: 1; translate: -50% -50%; pointer-events: none; -webkit-mask-image: radial-gradient(circle, transparent 7%, #000 16%, rgba(0, 0, 0, .6) 36%, transparent 52%); mask-image: radial-gradient(circle, transparent 7%, #000 16%, rgba(0, 0, 0, .6) 36%, transparent 52%); }
.paywall-rays i { position: absolute; inset: 0; border-radius: 50%; }
.paywall-rays i:first-child { background: repeating-conic-gradient(var(--pro-ray-a, rgba(233, 169, 58, .2)) 0 5deg, transparent 5deg 15deg); animation: legend-spin 70s linear infinite, pro-rays-a 6s ease-in-out infinite; }
.paywall-rays i:last-child { background: repeating-conic-gradient(var(--pro-ray-b, rgba(255, 206, 92, .24)) 0 9deg, transparent 9deg 40deg); animation: pro-spin-back 45s linear infinite, pro-rays-b 4.6s ease-in-out infinite; }
.paywall-art { position: relative; width: 128px; height: 120px; margin: 0 auto 6px; }
.paywall-bao { position: absolute; inset: 0; background: url("assets/achievements/master_100.svg") center / contain no-repeat; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .25)); transform-origin: 50% 92%; animation: pro-sway 4s ease-in-out infinite; }
.paywall-bao::after { content: ""; position: absolute; inset: 0; background: inherit; filter: brightness(0) invert(1); opacity: .7; -webkit-mask-image: linear-gradient(110deg, transparent 38%, #000 50%, transparent 62%); mask-image: linear-gradient(110deg, transparent 38%, #000 50%, transparent 62%); -webkit-mask-size: 300% 100%; mask-size: 300% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; animation: legend-shine 4.2s ease-in-out 1s infinite both; }
.paywall-art i { position: absolute; z-index: 1; left: var(--x); top: var(--y); width: var(--s); height: var(--s); margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2); background: #ffc93c; clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); filter: drop-shadow(0 0 4px rgba(255, 201, 60, .9)); opacity: 0; animation: sticker-spark 2.4s var(--delay) ease-in-out infinite; pointer-events: none; }
.paywall-art i.is-pale { background: #fff7d6; }
#paywallTry::after { content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 30%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent); transform: skewX(-20deg); pointer-events: none; animation: pro-cta-shine 3.6s ease-in-out 1.2s infinite; }
@keyframes pro-spin-back { to { rotate: -360deg; } }
@keyframes pro-rays-a { 0%, 100% { opacity: .65; } 50% { opacity: 1; } }
@keyframes pro-rays-b { 0%, 100% { opacity: .15; } 40% { opacity: .9; } 70% { opacity: .35; } }
@keyframes pro-sway { 0%, 100% { rotate: -2.5deg; } 50% { rotate: 2.5deg; } }
@keyframes pro-cta-shine { 0% { left: -40%; } 35%, 100% { left: 130%; } }
@media (prefers-reduced-motion: reduce) {
  .paywall-rays i, .paywall-bao { animation: none; }
  .paywall-bao::after, .paywall-art i, #paywallTry::after { display: none; }
}
.paywall-head .eyebrow { margin: 0 0 4px; color: #b07a16; font-size: 12px; font-weight: 900; letter-spacing: .32em; }
.paywall-head h2 { margin: 0 0 6px; font-size: 26px; background: linear-gradient(180deg, var(--ink) 40%, #6b4a10); -webkit-background-clip: text; background-clip: text; color: transparent; }
.paywall-head .overlay-lead { margin: 0; }
:root[data-theme="dark"] .paywall-rays { --pro-ray-a: rgba(240, 196, 92, .14); --pro-ray-b: rgba(255, 206, 92, .16); }
:root[data-theme="dark"] .paywall-head .eyebrow { color: #f3cf7a; }
:root[data-theme="dark"] .paywall-head h2 { background-image: linear-gradient(180deg, #fff, #f3cf7a); }
.paywall-benefits { display: grid; gap: 7px; margin: 4px 0 14px; padding: 0; list-style: none; text-align: left; }
.paywall-benefits li { position: relative; padding-left: 24px; font-size: 13px; font-weight: 700; line-height: 1.35; }
.paywall-benefits li::before { content: "✓"; position: absolute; left: 0; top: 0; display: grid; width: 17px; height: 17px; place-items: center; border-radius: 50%; background: var(--tint-green); color: var(--hit); font-size: 10px; font-weight: 800; }
.paywall-card .paywall-benefits li::before { content: "✦"; background: linear-gradient(135deg, #fff1c4, #e3b14d); color: #7a4b05; font-size: 9px; }
/* The circle: one word's steps light the benefits they need Pro for (web/app.js renderPaywallCircle). */
.paywall-word { display: flex; align-items: baseline; justify-content: center; gap: 7px; margin: 0 0 10px; color: var(--ink-soft); font-size: 12px; font-weight: 800; }
.paywall-word .han { color: var(--ink); font-size: 17px; }
.paywall-word em { color: var(--red-dark); font-style: normal; }
.paywall-word #paywallWordStep { color: #7a4b05; }
.paywall-word { position: relative; }
.paywall-word-why { display: inline-grid; align-self: center; width: 18px; height: 18px; padding: 0; place-items: center; border: 0; border-radius: 50%; background: rgba(217, 162, 58, .22); color: #7a4b05; font: inherit; font-size: 11px; font-weight: 900; cursor: pointer; }
.paywall-word-why::before { content: ""; position: absolute; inset: -10px; }
.paywall-word-why { position: relative; }
.paywall-word-tip { position: absolute; z-index: 3; top: calc(100% + 6px); left: 50%; translate: -50% 0; width: max-content; max-width: min(280px, 86vw); padding: 8px 12px; border-radius: 10px; background: var(--ink); color: var(--white); font-size: 12px; font-weight: 700; line-height: 1.35; text-align: center; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
.paywall-word-tip[hidden] { display: none; }
.paywall-card .paywall-benefits.is-circle { position: relative; gap: 4px; }
.paywall-card .paywall-benefits.is-circle li { min-height: 34px; padding: 6px 8px 6px 42px; border-radius: 12px; transition: background .4s, box-shadow .4s; }
.paywall-card .paywall-benefits.is-circle li:not(.is-plain)::before { content: none; }
.paywall-card .paywall-benefits.is-circle li.is-plain::before { left: 12px; top: 8px; }
.paywall-card .paywall-benefits.is-circle li:not(.is-plain):not(:nth-last-child(2))::after { content: ""; position: absolute; left: 19px; top: 30px; bottom: -8px; width: 2px; background: rgba(217, 162, 58, .25); transition: background .4s; }
.paywall-card .paywall-benefits.is-circle li.is-lit::after { background: #d9a23a; }
.paywall-mark { position: absolute; z-index: 1; left: 8px; top: 5px; display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; background: var(--white); box-shadow: inset 0 0 0 1.5px rgba(217, 162, 58, .45); color: rgba(23, 59, 54, .45); font-size: 13px; transition: background .35s, color .35s, box-shadow .35s, scale .35s; }
.paywall-mark svg { width: 13px; height: 13px; }
.paywall-benefits.is-circle li.is-lit { background: linear-gradient(100deg, rgba(251, 233, 196, .55), rgba(251, 233, 196, 0) 80%); }
.paywall-benefits.is-circle li.is-lit .paywall-mark { background: #f4d58a; box-shadow: none; color: #7a4b05; }
.paywall-benefits.is-circle li.is-now { background: linear-gradient(100deg, #fff3d1, #fdf1d8 70%, rgba(253, 241, 216, .4)); box-shadow: inset 0 0 0 1px rgba(217, 162, 58, .35); }
.paywall-benefits.is-circle li.is-now .paywall-mark { background: var(--white); box-shadow: 0 0 0 2px #d9a23a, 0 3px 10px rgba(217, 162, 58, .45); color: var(--ink); scale: 1.12; }
.paywall-card.is-compact .paywall-head { margin-bottom: 10px; padding-bottom: 8px; }
.paywall-card.is-compact .paywall-art { width: 80px; height: 75px; margin-bottom: 2px; }
.paywall-card.is-compact .paywall-head h2 { font-size: 22px; }
:root[data-theme="dark"] .paywall-word #paywallWordStep { color: #f3cf7a; }
:root[data-theme="dark"] .paywall-word em { color: #f08a6e; }
:root[data-theme="dark"] .paywall-word-why { background: rgba(240, 196, 92, .2); color: #f3cf7a; }
:root[data-theme="dark"] .paywall-word-tip { background: #f3ead2; color: #1d2a22; }
:root[data-theme="dark"] .paywall-mark { background: var(--paper); box-shadow: inset 0 0 0 1.5px rgba(240, 196, 92, .4); color: rgba(229, 235, 217, .5); }
:root[data-theme="dark"] .paywall-benefits.is-circle li.is-lit { background: linear-gradient(100deg, rgba(240, 196, 92, .14), rgba(240, 196, 92, 0) 80%); }
:root[data-theme="dark"] .paywall-benefits.is-circle li.is-lit .paywall-mark { background: #c99a3c; color: #2a1a00; }
:root[data-theme="dark"] .paywall-benefits.is-circle li.is-now { background: linear-gradient(100deg, rgba(240, 196, 92, .24), rgba(240, 196, 92, .08) 80%); box-shadow: inset 0 0 0 1px rgba(240, 196, 92, .4); }
:root[data-theme="dark"] .paywall-benefits.is-circle li.is-now .paywall-mark { background: var(--paper); box-shadow: 0 0 0 2px #f0c45c, 0 3px 10px rgba(240, 196, 92, .35); color: var(--ink); }
.paywall-card .plan-option.is-selected { border-color: #d9a23a; background: linear-gradient(160deg, #fff8e6, #fbe9c4); box-shadow: 0 6px 16px rgba(217, 162, 58, .25); }
.paywall-card .plan-option__save { background: linear-gradient(135deg, #f4c55c, #d18d1e); color: #4a2a00 !important; }
:root[data-theme="dark"] .paywall-card .plan-option.is-selected { background: linear-gradient(160deg, rgba(240, 196, 92, .18), rgba(240, 196, 92, .08)); }
#paywallTry { position: relative; overflow: hidden; background: linear-gradient(135deg, #c42b2a, #e2452e 50%, #f2792d); color: #fff; box-shadow: 0 10px 24px rgba(206, 64, 38, .35), inset 0 0 0 1px rgba(255, 214, 120, .6); }
/* The back arrow and the tabs sit in a bar of their own above the header (Ivan, 2026-10-27: «Переключатель про-супер
 * … отдельно от секции и … подальше от бао»). Super's tab turns the header red with Bao's medal and the button gold
 * (web/app.js renderPaywallTier; design/super-tier/paywall-two-tiers.html). */
.paywall-bar { position: relative; z-index: 2; display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; height: var(--paywall-bar, 56px); margin: 0 -12px; }
.paywall-tabs { grid-column: 2; justify-self: center; display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); }
.paywall-tabs button[data-tier="super"]::before { content: "★ "; color: #e3191f; }
.paywall-tabs button[data-tier="super"].is-on::before { color: #8a1010; }
.paywall-tabs button { padding: 7px 24px; border: 0; border-radius: 999px; background: none; color: var(--ink-soft); font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; }
.paywall-tabs button.is-on { background: var(--white); color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.paywall-tabs button[data-tier="super"].is-on { background: linear-gradient(180deg, #ffe58a, #f4ab1f); color: #8a1010; }
.paywall-card.is-super .paywall-head::before { background: radial-gradient(110% 80% at 50% 34%, #ff3d3a, #e3191f 45%, #a50d14); -webkit-mask-image: none; mask-image: none; }
.paywall-card.is-super .paywall-bao { background-image: url("assets/achievements/streak_30.svg"); }
/* «Маятник» (design/super-tier/final-pendulum.html): Bao in a cream medal with a gold ring, a glow behind it,
 * and the particle field (web/super-field.js) in place of Pro's rays and stars. */
.paywall-card.is-super .paywall-rays, .paywall-card.is-super .paywall-art i { display: none; }
.paywall-card.is-super .paywall-art { display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 50% 40%, #fffaf0, #f7e2b2); box-shadow: 0 0 0 4px #e9b54a, 0 0 0 6px rgba(0, 0, 0, .12), 0 0 36px rgba(255, 190, 80, .8); }
.paywall-card.is-super .paywall-bao { inset: 7%; animation-duration: 4s; }
.paywall-card.is-super .paywall-art::before { content: ""; position: absolute; z-index: -1; left: 50%; top: 50%; width: 360px; height: 360px; margin: -180px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 170, 60, .45), transparent 62%); pointer-events: none; }
.super-field { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.super-field--back { z-index: -1; }
.super-field--front { z-index: 5; }
.paywall-card:not(.is-super) .super-field { display: none; }
/* The words sit above the particles on a soft shade, so nothing crosses them (UX review, 2026-10-27). */
.paywall-card.is-super .paywall-head .eyebrow, .paywall-card.is-super .paywall-head h2, .paywall-card.is-super .paywall-head .overlay-lead { position: relative; z-index: 6; }
.paywall-card.is-super .paywall-head .eyebrow { color: #fff1d6; text-shadow: 0 1px 6px rgba(120, 0, 0, .55); }
.paywall-card.is-super .paywall-head .eyebrow::before { content: ""; position: absolute; z-index: -1; left: 50%; top: 0; width: 120%; max-width: 420px; height: 140px; translate: -50% 0; border-radius: 50%; background: radial-gradient(closest-side, rgba(150, 8, 14, .55), transparent); pointer-events: none; }
.paywall-card.is-super .paywall-head h2 { background: none; color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, .25); }
.paywall-card.is-super .paywall-head .overlay-lead { color: #ffe3dc; }
.paywall-card.is-super .paywall-benefits li::before { content: "★"; background: radial-gradient(circle at 40% 35%, #ff7a5a, #d8141c); color: #fff; }
.paywall-card.is-super .plan-option.is-selected { border-color: #e3191f; background: linear-gradient(180deg, #fff1ec, #ffe0d6); box-shadow: 0 6px 16px rgba(227, 25, 31, .2); }
.paywall-card.is-super .plan-option__save { background: #e3191f; color: #fff !important; }
.paywall-card.is-super #paywallTry { background: linear-gradient(180deg, #ffe58a, #f4ab1f); color: #8a1010; box-shadow: 0 8px 24px rgba(227, 25, 31, .3), inset 0 0 0 1px rgba(255, 255, 255, .6); }
:root[data-theme="dark"] .paywall-card.is-super .paywall-head h2 { background: none; }
:root[data-theme="dark"] .paywall-card.is-super .plan-option.is-selected { background: linear-gradient(160deg, rgba(227, 25, 31, .28), rgba(227, 25, 31, .12)); }
.plan-picker.plan-picker--three { grid-template-columns: repeat(3, 1fr); gap: 6px; }
.plan-picker--three .plan-option { padding: 14px 2px 10px; }
.plan-picker--three .plan-option b { white-space: nowrap; }
.plan-picker--three .plan-option span[id$="Price"] { font-size: 15px; font-weight: 800; }
.plan-picker--three .plan-option small:empty { display: none; }
/* Super's tab: "everything in Pro", then Pro against Super where Super gives more, Super's column lit. */
.tier-compare { margin: 0 0 12px; padding: 8px 6px 4px; border-radius: 16px; background: var(--paper); }
.tier-compare__all { margin: 0 0 4px; font-size: 13px; font-weight: 800; }
.tier-compare__all::before { content: "★ "; color: #e3191f; }
.tier-compare table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 12px; }
.tier-compare th { padding: 2px 2px 4px; color: var(--ink-soft); font-size: 11px; font-weight: 800; }
.tier-compare th:first-child { width: 38%; }
.tier-compare td { padding: 5px 2px; border-top: 1px solid var(--line); color: var(--ink-soft); font-weight: 700; text-align: center; white-space: nowrap; }
.tier-compare td:first-child { padding-left: 6px; color: var(--ink); text-align: left; white-space: normal; }
.tier-compare td b { font-size: 13px; font-weight: 900; }
.tier-compare td small { margin-left: 4px; font-size: 9.5px; opacity: .8; }
.tier-compare__line { display: block; line-height: 1.3; }
.tier-compare td:first-child { font-size: 11.5px; line-height: 1.25; }
.tier-compare [data-col="super"] { background: linear-gradient(180deg, #fff4d6, #ffe7a8); color: #8a1010; }
.tier-compare th[data-col] { border-radius: 10px 10px 0 0; }
.tier-compare tr:last-child td[data-col] { border-radius: 0 0 10px 10px; }
:root[data-theme="dark"] .tier-compare [data-col="super"] { background: rgba(240, 196, 92, .22); color: #ffe3a0; }
/* Super's tab is the shorter one: a smaller Bao, no lead and no "free forever" line, so it fits a phone. */
/* Super's red runs up behind the bar too (Ivan, 2026-10-27: «чтобы красная секция у супера тоже была сверху (но не двигай бао вверх)»):
 * the header starts under the bar and is as much taller, so Bao stays where he was; no gold frame («убери желтую рамку»). */
.paywall-card.is-super .paywall-head { overflow: hidden; margin: calc(-1 * var(--paywall-bar, 56px)) -20px 10px; padding: calc(22px + var(--paywall-bar, 56px)) 22px 16px; }
.paywall-card.is-super .paywall-head::before { inset: 0; }
.paywall-card.is-super .paywall-tabs { border-color: rgba(255, 255, 255, .35); background: rgba(120, 0, 0, .35); }
.paywall-card.is-super .paywall-tabs button:not(.is-on), .paywall-card.is-super .paywall-back { color: #fff; }
.paywall-card.is-super .paywall-art { width: 128px; height: 128px; margin-bottom: 12px; }
.paywall-card.is-super .paywall-head h2 { margin-bottom: 4px; font-size: 23px; }
.paywall-card.is-super .paywall-free { display: none; }
/* The plans are a screen of their own (Ivan, 2026-10-27: «maybe it shouldn't be a modal, but a dedicated screen»):
 * the whole app's height, scrolling from the top, a back arrow at the top left (web/app.js closePaywall). */
#paywall { padding: 0; place-items: start center; background: var(--paper); backdrop-filter: none; overflow-y: auto; overscroll-behavior: contain; }
/* At least the screen's height, and as tall as its content: the screen scrolls, the card never clips. */
#paywall > .paywall-card { max-width: 480px; min-height: 100%; margin: 0 auto; padding-bottom: calc(16px + var(--safe-bottom)); border-radius: 0; box-shadow: none; }
/* Phones up to 900 px tall (Ivan, 2026-11-08: «the goal is for the Pro paywall to fit the screen without scrolling»;
 * 390×844 needed 955 px, the Mini App's 390×750 too): a smaller Bao, which rises into the bar's empty middle when
 * there are no tabs, a smaller title, compact rows and plans. Taller phones keep the air. design/ai-icons/fit-paywall.mjs measures it. */
@media (max-width: 859px) and (max-height: 900px) {
  #paywall > .paywall-card { padding-bottom: calc(10px + var(--safe-bottom)); }
  .paywall-card .paywall-art { width: 72px; height: 68px; margin-bottom: 2px; }
  .paywall-card.is-compact .paywall-art { width: 56px; height: 52px; margin-bottom: 2px; }
  .paywall-head, .paywall-card.is-compact .paywall-head { margin-bottom: 8px; padding: 0 22px 10px; }
  .paywall-card:not(.is-super):has(#paywallTabs[hidden]) .paywall-head { margin-top: -48px; }
  .paywall-rays { top: 36px; width: 600px; }
  .paywall-head .eyebrow { margin-bottom: 2px; font-size: 11px; }
  .paywall-head h2, .paywall-card.is-compact .paywall-head h2 { margin-bottom: 4px; font-size: 22px; line-height: 1.15; }
  .paywall-head .overlay-lead { font-size: 13px; line-height: 1.35; }
  .paywall-offer { margin-bottom: 8px; padding: 6px 12px; font-size: 13px; }
  .paywall-reset { margin-bottom: 8px; padding: 4px 12px; }
  .paywall-word { margin-bottom: 6px; }
  .paywall-benefits { gap: 4px; margin-bottom: 10px; }
  .paywall-benefits li { font-size: 12.5px; line-height: 1.3; }
  .paywall-card .paywall-benefits.is-circle { gap: 2px; }
  .paywall-card .paywall-benefits.is-circle li { min-height: 30px; padding: 4px 8px 4px 40px; }
  .paywall-card .paywall-benefits.is-circle li.is-plain::before { top: 5px; }
  .paywall-card .paywall-benefits.is-circle li:not(.is-plain):not(:nth-last-child(2))::after { top: 26px; bottom: -6px; }
  .paywall-mark { left: 9px; top: 4px; width: 22px; height: 22px; }
  .plan-picker { margin-bottom: 10px; }
  .paywall-card .plan-option { gap: 1px; padding-top: 9px; padding-bottom: 7px; }
  /* An offer's old price beside the new one, not on a line of its own. */
  #planPicker .plan-option { display: flex; flex-wrap: wrap; align-content: center; align-items: baseline; justify-content: center; gap: 1px 6px; }
  #planPicker .plan-option > b, #planPicker .plan-option > small { flex-basis: 100%; }
  .paywall-fine { margin: 6px 0 2px; line-height: 1.35; }
  .paywall-free { margin-top: 4px; }
}
/* The Mini App on a 390×844 phone (about 750 px under Telegram's header), with the offer's banner and old prices too. */
@media (max-width: 859px) and (max-height: 780px) {
  .paywall-card .paywall-art { width: 62px; height: 58px; }
  .paywall-card.is-compact .paywall-art { width: 44px; height: 41px; }
  .paywall-head, .paywall-card.is-compact .paywall-head { padding-bottom: 6px; }
  .paywall-head .overlay-lead { line-height: 1.3; }
  .paywall-offer { padding: 5px 12px; }
  .paywall-word { margin-bottom: 4px; }
  .paywall-benefits li { line-height: 1.25; }
  .paywall-card .paywall-benefits.is-circle li { min-height: 28px; padding-top: 3px; padding-bottom: 3px; }
  .paywall-card #paywallLater { margin-top: 4px; }
  .paywall-reset { margin-bottom: 6px; }
}
/* Short phones (iPhone SE, 360×640): a smaller Bao and tighter lines, so the button shows without scrolling. */
@media (max-height: 740px) {
  .paywall-card .paywall-art { width: 54px; height: 50px; }
  .paywall-card.is-compact .paywall-art { width: 40px; height: 37px; }
  .paywall-card.is-super .paywall-art { width: 96px; height: 96px; margin-bottom: 10px; }
  .paywall-card.is-super .paywall-head { padding-top: calc(10px + var(--paywall-bar, 56px)); padding-bottom: 10px; }
  .paywall-head { padding-top: 0; padding-bottom: 8px; }
  .paywall-card { --paywall-bar: 50px; }
  .paywall-head h2, .paywall-card.is-compact .paywall-head h2, .paywall-card.is-super .paywall-head h2 { font-size: 20px; }
  .paywall-head .overlay-lead { font-size: 12.5px; line-height: 1.3; }
  .paywall-benefits { gap: 4px; margin-bottom: 10px; }
  .paywall-benefits li { font-size: 12px; }
  .paywall-card .plan-option { padding-top: 8px; padding-bottom: 6px; }
}
/* A wide, short screen (a tablet on its side, a laptop): the pitch beside the plans, the whole offer on one screen
 * (Ivan's 2019 iPad in landscape had to scroll to the button, 2026-11-03). */
@media (min-width: 860px) and (max-height: 820px) {
  #paywall > .paywall-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto 1fr; column-gap: 40px; max-width: 920px; }
  .paywall-bar { grid-column: 1 / -1; }
  .paywall-pitch, .paywall-buy { align-self: center; }
  /* The header's glow would end in a hard edge at the column's side; the rays alone fade out. */
  .paywall-head::before { display: none; }
}
.paywall-back { grid-column: 1; width: 40px; height: 40px; border: 0; border-radius: 50%; background: none; color: var(--ink); font-size: 22px; }
.plan-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.plan-option { position: relative; display: grid; gap: 2px; padding: 13px 8px 11px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); color: var(--ink); cursor: pointer; }
.plan-option b { font-size: 14px; }
.plan-option span { font-size: 12px; font-weight: 700; }
.plan-option small { color: var(--ink-soft); font-size: 10px; }
.plan-option.is-selected { border-color: var(--red); background: var(--tint-red); box-shadow: inset 0 0 0 1px var(--red); }
.plan-option__save { position: absolute; top: -9px; left: 50%; padding: 2px 8px; border-radius: 99px; background: var(--red); color: var(--on-red) !important; font-size: 9px !important; font-weight: 800; transform: translateX(-50%); white-space: nowrap; }
.pay-option { justify-content: flex-start; gap: 14px; min-height: 66px; margin-top: 10px; padding: 12px 16px; text-align: left; }
.pay-option__icon { display: grid; flex: none; width: 36px; height: 36px; place-items: center; }
.pay-option__icon svg { width: 100%; height: 100%; }
.pay-option__text { display: grid; flex: 1; gap: 3px; min-width: 0; }
/* The usual price crossed out before an offer's (web/app.js noteWithOld), as on the plan cards. */
.pay-option__old { text-decoration-color: var(--red); text-decoration-thickness: 2px; }
.pay-option b { font-size: 15px; }
.pay-option small { color: var(--ink-soft); font-size: 12px; font-weight: 600; line-height: 1.35; }
.paywall-fine { margin: 8px 0 4px; color: var(--ink-soft); font-size: 11px; line-height: 1.4; }
.paywall-free { margin: 6px 0 0; font-size: 11px; font-weight: 700; line-height: 1.4; }
.paywall-card .overlay-note { margin: 6px 0 2px; }
.checkout-card { max-width: 380px; padding: 20px 20px 16px; text-align: left; }
.checkout-card .eyebrow, .checkout-card h2, .checkout-card .paywall-fine { text-align: center; }
.checkout-lines { display: grid; gap: 0; margin: 10px 0 14px; padding: 4px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.checkout-lines div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13px; line-height: 1.35; }
.checkout-lines div:first-child { border-top: 0; }
.checkout-lines dt { color: var(--ink-soft); font-weight: 600; }
.checkout-lines dd { margin: 0; font-weight: 700; text-align: right; }
.checkout-lines .checkout-total { font-size: 15px; }
.checkout-lines .checkout-total dt { color: var(--ink); font-weight: 800; }
.checkout-lines .checkout-total dd { color: var(--red); font-weight: 800; }
.checkout-field { display: grid; gap: 6px; margin: 0 0 12px; font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.checkout-field input { width: 100%; min-height: 46px; padding: 0 15px; border: 1px solid var(--line); border-radius: 14px; background: rgba(var(--glass-rgb), .8); color: var(--ink); font: inherit; font-size: 15px; }
.checkout-field input:focus { outline: 2px solid rgba(223,85,63,.35); }
.promo-form { margin: 10px 0 16px; text-align: left; }
.promo-form .menu-secondary { margin-top: 8px; }
.promo-form .checkout-field { margin: 0; }
.promo-form .checkout-field input { text-transform: uppercase; letter-spacing: .08em; }
#paywallPromoError { color: var(--red-dark); text-align: center; }
#renewalPlan { margin: 0 0 8px; font-weight: 700; }
#renewalPlan[hidden], #renewalSwitch[hidden] { display: none; }
#renewalSwitch { width: 100%; justify-content: center; margin-bottom: 8px; }
.checkout-agree { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 14px; font-size: 12px; font-weight: 600; line-height: 1.4; cursor: pointer; }
.checkout-agree input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--red); }
.checkout-card .menu-primary { width: 100%; }
.checkout-agree a { color: var(--red); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
a.settings-link { color: var(--ink); text-decoration: none; }
/* Above the welcome tour: the documents come first (.overlay further down sets 30). */
.overlay.consent-overlay { z-index: 60; }
.consent-card { max-width: 380px; }
.consent-card .mascot-slot--overlay { width: 84px; height: 84px; margin: 0 auto; }
.consent-docs { display: grid; gap: 8px; margin: 4px 0 12px; padding: 0; list-style: none; }
.consent-check { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); font-size: 13px; font-weight: 600; line-height: 1.35; text-align: left; cursor: pointer; }
.consent-check:has(input:checked) { border-color: var(--red); }
.consent-check input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--red); }
.consent-check a { color: var(--red); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.consent-card .menu-primary { width: 100%; margin-top: 4px; }
.consent-card .menu-primary:disabled { opacity: .45; cursor: default; }
.settings-link .card-chevron { color: var(--ink-soft); }
/* Account: sign in, add an email, sign out, delete. */
.account-card { max-width: 380px; text-align: left; }
.account-card h2, .account-card .eyebrow, .account-card .overlay-lead { text-align: center; }
.account-card .menu-primary { width: 100%; }
.account-card .menu-primary:disabled { opacity: .45; cursor: default; }
.account-card #accountCode { letter-spacing: .3em; font-variant-numeric: tabular-nums; text-align: center; }
.account-error { margin: -4px 2px 12px; color: var(--red); font-size: 12px; font-weight: 700; line-height: 1.4; }
.account-providers { display: grid; gap: 8px; margin-top: 10px; justify-items: center; }
/* Apple drawn like Google's own button beside it (outline theme, large, pill):
   Google centres its label between the logo and the right edge, 39 px and
   13 px in, and keeps normal word gaps. */
.provider-button { position: relative; display: flex; width: 100%; max-width: 400px; height: 40px; align-items: center; justify-content: center; padding: 0 13px 0 39px; border: 1px solid #dadce0; border-radius: 999px; background: #fff; color: #3c4043; font: 500 14px/1 "Google Sans", Roboto, -apple-system, system-ui, Arial, sans-serif; letter-spacing: .25px; word-spacing: normal; cursor: pointer; transition: background-color .15s, border-color .15s; }
.provider-button:hover { border-color: #d2e3fc; background: #f8faff; }
.provider-button:focus-visible { outline: 2px solid #4285f4; outline-offset: 1px; }
.provider-button__logo { position: absolute; left: 13px; width: 15px; height: 18px; fill: #000; }
#accountGoogle { width: 100%; max-width: 400px; }
.account-danger { color: var(--red); }
.checkout-card .menu-primary:disabled { opacity: .45; cursor: default; }

/* --- dark theme --- */
:root[data-theme="dark"] .path-card,
:root[data-theme="dark"] .achievements-card,
:root[data-theme="dark"] .achievement,
:root[data-theme="dark"] .path-node__disc,
:root[data-theme="dark"] .tutorial__demo,
:root[data-theme="dark"] .tutorial__write { background: var(--white); }
:root[data-theme="dark"] .path-node.is-done .path-node__disc,
:root[data-theme="dark"] .plan-option.is-selected { background: rgba(227,138,104,.2); }
:root[data-theme="dark"] .achievement:not(.is-unlocked) .achievement__art { opacity: .3; }
:root[data-theme="dark"] .path-node.is-current .path-node__disc,
:root[data-theme="dark"] #openPath::before { opacity: .75; filter: brightness(.85); }
:root[data-theme="dark"] .path-card__glyph,
:root[data-theme="dark"] .chapter-card__glyph { background: var(--ink); color: var(--paper); }
:root[data-theme="dark"] .paywall-card,
:root[data-theme="dark"] .checkout-card,
:root[data-theme="dark"] .consent-card,
:root[data-theme="dark"] .chapter-card { background: var(--white); }
:root[data-theme="dark"] .heat-cell[data-level="1"] { background: #2f4a39; }
:root[data-theme="dark"] .heat-cell[data-level="2"] { background: #3f6b4c; }
:root[data-theme="dark"] .heat-cell[data-level="3"] { background: #56905f; }
:root[data-theme="dark"] .heat-cell[data-level="4"] { background: #7ec492; }
:root[data-theme="dark"] .tutorial__write { background-image: linear-gradient(rgba(229,235,217,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(229,235,217,.08) 1px, transparent 1px); }

@media (prefers-reduced-motion: reduce) {
  .path-node.is-current .path-node__disc { transform: none; }
}
:root[data-theme="dark"] .offer-card .menu-secondary,
:root[data-theme="dark"] .chapter-card .menu-secondary { background: var(--paper); color: var(--ink); }

.tutorial__header { display: flex; align-items: center; gap: 8px; padding-right: 16px; }
.tutorial__header .onboarding__progress { flex: 1; }
/* Overlays sit above the bottom navigation. */
.overlay { z-index: 30; }
.toast { z-index: 60; }
/* MAX keeps the microphone from the page: this window comes from whatever screen tried to record, so it sits above them all (web/max.js). */
#maxMicSheet { position: fixed; z-index: 95; }

/* --- home: one main action, then the path and the garden --- */
.goal-chip { display: inline-flex; align-items: center; gap: 5px; margin: 0; padding: 4px 10px 4px 7px; border: 1px solid var(--line); border-radius: 999px; background: rgba(var(--glass-rgb), .66); color: var(--ink); font-size: 11px; font-variant-numeric: tabular-nums; }
.goal-chip b { font-weight: 800; }
.goal-chip__ring { width: 14px; height: 14px; rotate: -90deg; }
.goal-chip__ring circle { fill: none; stroke: rgba(23,59,54,.14); stroke-width: 2.6; }
.goal-chip__ring .goal-chip__fill { stroke: var(--red); stroke-linecap: round; stroke-dasharray: 0 100; transition: stroke-dasharray .5s cubic-bezier(.2,.75,.25,1); }
.goal-chip.is-done { border-color: transparent; background: var(--tint-green); color: var(--green-ink); }
.goal-chip.is-done .goal-chip__fill { stroke: var(--green); }
:root[data-theme="dark"] .goal-chip__ring circle { stroke: rgba(229,235,217,.16); }
.hero-chips { margin-bottom: 12px; }

.today-card h2 { margin-bottom: 12px; }
.today-card .today-sub { margin: -8px 0 12px; }
/* Goal met: the card says so and its button steps back. */
.today-card.is-done .menu-primary { border: 1px solid rgba(255,255,255,.34); background: rgba(255,255,255,.08); color: #fffef9; }
.today-card.is-done .menu-primary:hover { background: rgba(255,255,255,.16); }
/* A learner's first study day: the button is the one step (app.js renderFirstStep). */

.card-chevron { flex: none; margin-left: auto; color: var(--ink-soft); font-size: 22px; font-weight: 600; line-height: 1; }

.garden-card { display: block; width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 20px; background: rgba(var(--glass-rgb), .7); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.garden-card__head { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.garden-card__head b { font-weight: 800; letter-spacing: -.02em; }
.garden-card__count { display: block; margin: 2px 0 10px; color: var(--ink-soft); font-size: 13px; font-weight: 600; }
.garden-card__count > b { color: var(--ink); font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.garden-card .stack-legend { margin-top: 8px; }
/* --- listening, reading, HSK 1 mock (formats.js) --- */
.segmented--sm button:last-child:nth-child(odd) { grid-column: 1 / -1; }
.segmented--three { grid-template-columns: repeat(3, 1fr); }
.segmented--sm.segmented--three button:last-child:nth-child(odd) { grid-column: auto; }
.segmented--three button span { line-height: 1.2; }
.tone-how { margin-top: 14px; }
.tone-how__text { margin: 12px 4px 0; color: var(--ink-soft, var(--ink)); font-size: 14px; line-height: 1.4; }
.detail-tones { grid-column: 1 / -1; }
.format-prompt { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 2px 0 4px; }
.format-prompt[hidden] { display: none; }
.format-listen { display: inline-flex; align-items: center; gap: 10px; min-height: 64px; padding: 0 26px 0 20px; border: 0; border-radius: 99px; background: linear-gradient(135deg, #fa8466, #cf4934); color: white; font-size: 15px; font-weight: 800; box-shadow: 0 8px 20px rgba(223,85,63,.28); cursor: pointer; }
.format-listen:active { transform: scale(.96); }
.format-listen.is-playing svg { animation: format-pulse .9s ease-in-out infinite alternate; }
@keyframes format-pulse { from { opacity: .55; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .format-listen.is-playing svg { animation: none; } }
.format-picture { width: min(100%, 240px); aspect-ratio: 1; object-fit: contain; border-radius: 20px; background: var(--muted); }
.format-prompt__text, .format-prompt__ask { width: 100%; text-align: center; }
.format-zh { margin: 0; font: 600 clamp(22px, 7vw, 30px)/1.4 "Noto Serif SC", serif; overflow-wrap: anywhere; }
.format-prompt[data-format="text"] .format-prompt__text .format-zh { font-size: clamp(19px, 5.6vw, 23px); text-align: left; }
.format-prompt[data-format="text"] .format-prompt__text .format-pinyin { text-align: left; }
.format-prompt__ask { padding-top: 10px; border-top: 1px dashed var(--line); }
.format-prompt__ask .format-zh { font-size: clamp(18px, 5.4vw, 22px); color: var(--red-dark); }
.format-pinyin { margin: 4px 0 0; color: var(--ink-soft); font-size: 13px; font-weight: 600; line-height: 1.4; }
.format-hint { margin: 0; color: var(--ink-soft); font-size: 14px; font-style: italic; text-align: center; }
.probe-option--zh { display: flex; flex-direction: column; align-items: center; gap: 2px; font: 600 20px/1.35 "Noto Serif SC", serif; }
.probe-option--zh small { color: var(--ink-soft); font: 600 12px/1.3 "Manrope", system-ui, sans-serif; }
.probe-option--word { display: flex; flex-direction: column; align-items: center; gap: 2px; padding-block: 10px; }
.probe-option--word b { color: var(--red-dark); font-size: 20px; font-weight: 800; }
.probe-option--word .tone-word__zh { font: 600 30px/1.2 "Noto Serif SC", serif; }
.probe-option--word small { color: var(--ink-soft); font: 600 12px/1.3 "Manrope", system-ui, sans-serif; }
.tone-contour { width: 60px; height: 40px; fill: none; stroke: var(--red-dark); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.probe__options--pictures { grid-template-columns: 1fr 1fr; }
.probe__options--pictures.has-three { grid-template-columns: repeat(3, 1fr); }
.probe-option--picture { display: grid; place-items: center; min-height: 0; padding: 6px; aspect-ratio: 1; }
.probe-option--picture img { width: 100%; height: 100%; object-fit: contain; border-radius: 11px; }
.probe-option--picture img.is-loading { opacity: 0; }
.result-sections { display: grid; gap: 6px; width: min(100%, 300px); margin: 12px auto 0; padding: 0; list-style: none; }
.result-sections[hidden] { display: none; }
.result-sections.is-tones { grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; margin-top: 14px; }
.result-sections.is-tones li { display: grid; justify-content: stretch; justify-items: center; gap: 4px; padding: 9px 6px 8px; font-size: 12px; text-align: center; }
.result-tone__mark { font-size: 22px; font-weight: 800; line-height: 1; }
.result-sections.is-tones b { color: var(--ink-soft); font-weight: 800; white-space: nowrap; }
.result-tone__bar { position: relative; width: 100%; height: 4px; overflow: hidden; border-radius: 2px; background: rgba(23,59,54,.1); }
.result-tone__bar::before { content: ""; position: absolute; inset: 0; background: var(--hit); transform-origin: left; transform: scaleX(var(--share, 0)); }
.result-sections.is-tones li.is-weak { border-color: rgba(223,85,63,.45); background: rgba(223,85,63,.07); }
.result-sections.is-tones li.is-weak .result-tone__mark { color: var(--red-dark); }
.result-sections.is-tones li.is-weak .result-tone__bar::before { background: var(--red); }
.result-sections li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(var(--glass-rgb), .7); font-size: 13px; font-weight: 700; }
.mock-card { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 12px; }
.mock-card__seal { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 14px; background: var(--tint-red); color: var(--red-dark); font: 600 26px "Noto Serif SC", serif; }
.mock-card__copy h2 { margin: 0; font-size: 17px; }
.mock-card__copy p { margin: 3px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.45; }
.mock-card__start { grid-column: 1 / -1; margin-top: 10px; }
.tests-fold { display: grid; gap: 10px; }
.test-card { padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.test-card__lock { margin: 6px 0 0 !important; color: var(--red-dark) !important; font-weight: 700; }
.test-card .mock-card__start:disabled { opacity: .5; cursor: default; }
.mock-card.is-locked .mock-card__seal { background: var(--surface); color: var(--ink-soft); }
/* --- Say it: the learner's voice against the tone's line (web/say.js) --- */
.quiz-say { align-self: center; border-color: var(--red); background: var(--red); color: var(--on-red); cursor: pointer; }
body.say-open { overflow: hidden; }
/* The Pro offer opened from Say it (no free checks left) comes over the sheet. */
body.say-open #paywall { z-index: 46; }
/* What the offer opens (how to pay, the order, sign-in, Pro on; the documents are at 60 already) comes over it, not under the sheet. */
body:is(.say-open, .paper-open) :is(#payMethod, #checkout, #account, #promoDone) { z-index: 47; }
.say { position: absolute; inset: 0; z-index: 45; display: flex; flex-direction: column; gap: 10px; padding: max(16px, var(--safe-top)) 20px max(18px, var(--safe-bottom)); background: radial-gradient(circle at 86% 4%, rgba(223, 85, 63, .11), transparent 30%), var(--paper); animation: say-in .22s ease-out; }
.say[hidden] { display: none; }
@keyframes say-in { from { opacity: 0; transform: translateY(14px); } }
@media (prefers-reduced-motion: reduce) { .say { animation: none; } }
.say__top { display: flex; align-items: center; gap: 8px; }
.say__top h2 { flex: 1; margin: 0; font-size: 19px; text-align: center; }
.say__count { min-width: 40px; color: var(--ink-soft); font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.say__body { display: grid; flex: 1; align-content: start; gap: 12px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 4px; }
.say__word { display: grid; justify-items: center; gap: 2px; padding: 14px 16px 12px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); }
.say__hanzi { font: 600 76px/1.1 "Noto Serif SC", serif; }
.say__pinyin { color: var(--red-dark); font-size: 24px; font-weight: 800; }
.say__gloss { max-width: 100%; color: var(--ink-soft); font-size: 14px; font-weight: 600; text-align: center; }
.say__listen { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink); font-size: 13px; font-weight: 800; cursor: pointer; }
.say__listen svg { width: 18px; height: 18px; }
.say__listen.is-playing { border-color: var(--red); color: var(--red-dark); }
.say__tip { margin: 0; color: var(--ink-soft); font-size: 13px; font-weight: 600; line-height: 1.45; text-align: center; }
.say__plot { position: relative; height: 210px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); overflow: hidden; }
.say__plot canvas { display: block; width: 100%; height: 100%; }
.say__waiting { position: absolute; top: 14px; left: 50%; width: max-content; max-width: calc(100% - 32px); transform: translateX(-50%); margin: 0; padding: 7px 16px; border-radius: 999px; background: var(--paper); box-shadow: 0 2px 10px rgba(23, 59, 54, .1); color: var(--ink); font-size: 13px; font-weight: 800; text-align: center; pointer-events: none; }
.say__waiting[hidden] { display: none; }
/* "Previous try" may not fit beside the other two: it goes to a second row, each key kept whole, both rows inside the plot's bottom margin. */
.say__legend { position: absolute; left: 14px; right: 14px; bottom: 5px; display: flex; flex-wrap: wrap; column-gap: 14px; row-gap: 1px; margin: 0; color: var(--ink-soft); font-size: 11px; font-weight: 800; line-height: 1.3; }
.say__key { white-space: nowrap; }
.say__key::before { content: ""; display: inline-block; width: 18px; margin-right: 6px; vertical-align: middle; border-top: 3px solid currentColor; border-radius: 2px; }
.say__key--target { color: var(--hit); }
.say__key--target::before { border-top-style: dotted; }
.say__key--you { color: var(--red-dark); }
.say__replays { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.say__replays[hidden] { display: none; }
.say__replay { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 800; cursor: pointer; }
.say__replay svg { width: 18px; height: 18px; fill: currentColor; }
.say__replay.is-playing { border-color: var(--red); color: var(--red-dark); }
.say__scoreNote[hidden], .say__detail[hidden] { display: none; }
.say__scoreNote { grid-column: 1 / -1; margin: -2px 0 0; color: var(--ink-soft); font-size: 11px; font-weight: 600; text-align: center; }
.say__detail ul { display: grid; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.say__detail li { color: var(--ink-soft); font-size: 13px; font-weight: 600; line-height: 1.4; }
/* One soft line on the rhythm (too broken, a comma run through, a light syllable said full), under the verdict or the check's rows. */
.say__rhythm[hidden] { display: none; }
.say__rhythm { margin: -2px 0 0; padding: 0 14px; color: var(--ink-soft); font-size: 13px; font-weight: 600; line-height: 1.4; }
/* One line before the first permission prompt: why the microphone, where the voice goes. */
.say__prime { display: flex; align-items: center; gap: 10px; margin: 0; padding: 9px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 700; line-height: 1.4; }
.say__prime[hidden], .say__how[hidden], .say__fix[hidden], .say__key--ghost[hidden] { display: none; }
.say__prime svg { flex: none; width: 22px; height: 22px; fill: none; stroke: var(--red); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.say__how { margin: -4px 0 0; padding: 9px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink-soft); font-size: 13px; font-weight: 600; line-height: 1.45; }
.say__rangeRow { display: flex; justify-content: center; gap: 14px; margin: 0; }
.say__link { padding: 2px 6px; border: 0; background: none; color: var(--ink-soft); font-size: 12px; font-weight: 700; text-decoration: underline; text-decoration-color: rgba(23, 59, 54, .25); text-underline-offset: 3px; cursor: pointer; }
.say__link[hidden] { display: none; }
.say.is-range .say__word, .say.is-range .say__legend, .say.is-range .say__next, .say.is-range .say__waiting, .say.is-range .say__denoise { display: none; }
.say.is-range .say__tip { color: var(--ink); font-size: 14px; font-weight: 700; }
.say.is-range .say__plot, .say.is-range.is-live .say__plot { height: 300px; }
/* The link to measure the voice would be cut off behind the footer next to a result. */
.say.has-result .say__rangeRow, .say.has-result .say__denoise { display: none; }
/* With a permission line or the steps to re-enable the microphone on the screen, the word's tip folds away and the plot shrinks, so the line and the button fit together. */
.say:has(.say__prime:not([hidden])) .say__tip, .say:has(.say__how:not([hidden])) .say__tip { display: none; }
.say:has(.say__prime:not([hidden])) .say__plot, .say:has(.say__how:not([hidden])) .say__plot { height: 150px; }
.say__key--ghost { color: var(--red-dark); opacity: .55; }
/* The one thing to change, in the colour the plot shades that part of the syllable. */
.say__feedback p.say__fix { margin: 2px 0 0; padding: 3px 0 3px 10px; border-left: 3px solid #d9a441; color: var(--ink); font-size: 13px; font-weight: 800; line-height: 1.35; }
/* The verdict: a quiet card with a round mark in the verdict's colour, the score as a small pill. */
.say__feedback { --kind: var(--ink-soft); --kind-tint: rgba(23, 59, 54, .07); display: grid; grid-template-columns: 34px 1fr; column-gap: 12px; align-items: start; padding: 10px 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 1px 0 rgba(23, 59, 54, .04); }
.say__feedback::before { content: "?"; grid-row: 1 / span 4; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--kind-tint); color: var(--kind); font-size: 17px; font-weight: 900; line-height: 1; }
.say__feedback > * { grid-column: 2; }
.say__feedback b { align-self: center; min-height: 34px; display: flex; align-items: center; font-size: 15px; font-weight: 800; line-height: 1.25; }
.say__feedback p { margin: 2px 0 0; color: var(--ink-soft); font-size: 13px; font-weight: 600; line-height: 1.45; }
.say__feedback .say__toneScore { justify-self: start; margin: 0; padding: 3px 10px; border-radius: 999px; background: var(--kind-tint); color: var(--kind); font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.say__feedback .say__toneScore[hidden] { display: none; }
.say__feedback p.say__skipHint { color: var(--ink); font-weight: 700; }
.say__feedback p.say__skipHint[hidden] { display: none; }
/* A word: one row per syllable — the character, how it is said, and the verdict. */
.say__syllables { display: grid; }
.say__strip { display: grid; gap: 6px; margin: 6px 0 2px; }
.say__syllables[hidden] { display: none; }
/* The syllables as a strip of tiles, as in the conversation's tone check; a tile's detail shows under the strip. */
.say__tiles { display: flex; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; }
.say__tile { display: grid; flex: 1; justify-items: center; min-width: 26px; padding: 4px 3px; border: 0; border-right: 1px solid var(--line); border-radius: 0; background: rgba(23, 59, 54, .05); color: var(--ink-soft); cursor: pointer; }
.say__tile:last-child { border-right: 0; }
.say__tile small { font-size: 11px; font-weight: 700; }
.say__tile b { font: 600 20px/1.25 "Noto Serif SC", serif; }
.say__tile[data-verdict="right"] { background: var(--tint-green); color: var(--hit); }
.say__tile[data-verdict="wrong"] { background: var(--tint-red); color: var(--red-dark); }
.say__tile.is-picked { box-shadow: inset 0 0 0 2px currentColor; }
/* Every detail laid over the others: the card is as tall as the longest, so moving between tiles doesn't make it jump. */
.say__tileDetails { display: grid; }
.say__tileDetails[hidden] { display: none; }
.say__tileDetail { grid-area: 1 / 1; display: grid; gap: 2px; margin: 0; color: var(--ink-soft); font-size: 13px; font-weight: 700; line-height: 1.4; visibility: hidden; }
.say__tileDetail.is-on { visibility: visible; }
.say__tileDetail b { color: var(--ink); font-weight: 800; }
.say__feedback[data-kind="good"] { --kind: var(--hit); --kind-tint: var(--tint-green); }
.say__feedback[data-kind="good"]::before { content: "✓"; }
.say__feedback[data-kind="close"] { --kind: #a8741a; --kind-tint: rgba(242, 193, 78, .24); }
.say__feedback[data-kind="close"]::before { content: "≈"; }
.say__feedback[data-kind="warn"] { --kind: var(--red-dark); --kind-tint: var(--tint-red); }
.say__feedback[data-kind="warn"]::before { content: "↺"; }
.say__noise { margin: 0; padding: 9px 14px; border: 1px solid #d9a441; border-radius: 14px; background: rgba(242, 193, 78, .2); font-size: 13px; font-weight: 700; line-height: 1.4; }
.say__noise[hidden], .say__caveat[hidden] { display: none; }
.say__ask[hidden], .say__askThanks[hidden] { display: none; }
.say__ask { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.say__ask b { font-size: 15px; font-weight: 800; line-height: 1.25; }
.say__ask p { margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.4; }
.say__askActions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.say__askActions .menu-secondary { margin: 0; min-height: 42px; }
.say__askThanks { margin: 0; padding: 9px 14px; border-radius: 14px; background: rgba(23, 59, 54, .07); font-size: 13px; font-weight: 700; line-height: 1.4; }
.say__caveat { margin: 0; padding: 9px 14px; border: 1px solid #d9a441; border-radius: 14px; background: rgba(242, 193, 78, .2); font-size: 13px; font-weight: 700; line-height: 1.4; }
.say__denoise { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--ink-soft); font-size: 12px; font-weight: 700; cursor: pointer; }
.say__denoise input { width: 16px; height: 16px; accent-color: var(--red); }
.say__error { margin: 0; padding: 10px 14px; border-radius: 14px; background: var(--tint-red); color: var(--red-dark); font-size: 13px; font-weight: 700; line-height: 1.4; }
.say__outside { width: 100%; }
.say__actions { display: grid; gap: 8px; }
.say__actions .menu-primary, .say__actions .menu-secondary { margin: 0; }
/* After a result the way on sits under "Again"; after a match it is the one to press. */
.say__next { min-height: 48px; font-size: 15px; }
.say__next[hidden] { display: none; }
.say__next.is-good { border-color: var(--ink); background: var(--ink); color: var(--on-ink); }
/* A big round microphone: tap to start and tap again to stop (or a few quiet seconds end it), or hold while speaking. While it listens a white square inside says a tap stops it, and a blob behind it swells with the voice; it breathes while it waits for the voice; three dots hop while the take is checked. The button's colour is on ::before so the blob (z-index -2) can sit behind it. */
.say__micRow { display: grid; justify-items: center; gap: 8px; padding-top: 4px; }
.say__mic { position: relative; display: grid; place-items: center; width: 84px; height: 84px; margin: 14px 0 10px; padding: 0; border: 0; border-radius: 50%; background: none; color: #fff; isolation: isolate; cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; -webkit-tap-highlight-color: transparent; transition: transform .15s ease; }
.say__mic::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--red); box-shadow: 0 6px 18px rgba(196, 63, 43, .28); transition: background-color .2s ease; }
.say__mic:active { transform: scale(.96); }
.say__mic:focus-visible { outline: 3px solid var(--green-ink); outline-offset: 4px; }
.say__micIcon, .say__stop, .say__dots { grid-area: 1 / 1; }
.say__micIcon svg { width: 34px; height: 34px; }
.say__stop { display: none; width: 26px; height: 26px; border-radius: 6px; background: #fff; }
/* The blob behind it: a soft shape that swells with the voice and wobbles like it (its outline is drawn in say.js). */
.say__ring { position: absolute; z-index: -2; left: -26px; top: -26px; width: 136px; height: 136px; display: none; overflow: visible; pointer-events: none; }
.say__ring path { fill: rgba(223, 85, 63, .24); stroke: rgba(223, 85, 63, .6); stroke-width: 2; }
.say__mic[data-mode="waiting"] .say__micIcon, .say__mic[data-mode="recording"] .say__micIcon { display: none; }
.say__mic[data-mode="waiting"] .say__stop, .say__mic[data-mode="recording"] .say__stop { display: block; }
.say__mic[data-mode="waiting"] .say__ring, .say__mic[data-mode="recording"] .say__ring { display: block; }
.say__mic[data-mode="waiting"] .say__ring { animation: say-breathe 1.5s ease-in-out infinite; }
.say__mic[data-mode="recording"]::before { background: var(--red-dark); }
/* While the take is checked: three dots hop one after another. */
.say__dots { display: none; align-items: center; gap: 7px; }
.say__dots i { width: 9px; height: 9px; border-radius: 50%; background: #fff; animation: say-hop 1s ease-in-out infinite; }
.say__dots i:nth-child(2) { animation-delay: .15s; }
.say__dots i:nth-child(3) { animation-delay: .3s; }
.say__mic[data-mode="thinking"] .say__micIcon { display: none; }
.say__mic[data-mode="thinking"] .say__dots { display: flex; }
.say__mic[data-mode="thinking"]::before { background: linear-gradient(100deg, var(--red) 30%, var(--red-dark) 50%, var(--red) 70%) 0 0 / 220% 100%; animation: say-think 1.1s linear infinite; }
.say__micText { display: grid; justify-items: center; gap: 2px; margin: 0; text-align: center; }
.say__micText b { color: var(--ink); font-size: 15px; font-weight: 800; }
.say__micText small { color: var(--ink-soft); font-size: 12px; }
@keyframes say-breathe { 50% { opacity: .25; } }
@keyframes say-hop { 0%, 60%, 100% { transform: translateY(0); opacity: .55; } 30% { transform: translateY(-7px); opacity: 1; } }
@keyframes say-think { to { background-position: -220% 0; } }
@media (prefers-reduced-motion: reduce) {
  .say__mic, .say__mic::before { transition: none; }
  .say__mic[data-mode="waiting"] .say__ring { animation: none; opacity: .5; }
  .say__mic[data-mode="thinking"]::before { animation: none; background: var(--red-dark); }
  .say__dots i { animation: none; }
}
.say__privacyLink[hidden], .say__modal[hidden] { display: none; }
.say__privacyLink { display: inline-flex; align-items: center; justify-self: center; gap: 6px; padding: 2px 8px; border: 0; background: none; color: var(--ink-soft); font-size: 12px; font-weight: 700; text-decoration: underline; text-decoration-color: rgba(23, 59, 54, .25); text-underline-offset: 3px; cursor: pointer; }
.say__privacyLink svg { width: 14px; height: 14px; fill: currentColor; opacity: .7; }
.say__modal { position: absolute; inset: 0; z-index: 2; display: grid; align-items: end; padding: 16px 16px max(16px, var(--safe-bottom)); background: rgba(23, 59, 54, .32); animation: say-fade .18s ease-out; }
.say__modalCard { display: grid; gap: 12px; padding: 20px; border-radius: 22px; background: var(--paper); box-shadow: 0 10px 40px rgba(23, 59, 54, .2); animation: say-in .22s ease-out; }
.say__modalCard h3 { margin: 0; font-size: 17px; }
.say__modalCard p { margin: 0; color: var(--ink-soft); font-size: 14px; font-weight: 600; line-height: 1.5; }
.say__modalCard .menu-primary { margin: 4px 0 0; }
@keyframes say-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .say__modal, .say__modalCard { animation: none; } }
/* A result is in: the word folds into one row, the tip (repeated in the verdict) goes, the plot shrinks; the verdict fits on a phone without scrolling. */
.say.has-result .say__body { gap: 10px; }
.say__report { display: flex; justify-content: flex-end; margin-top: -6px; }
.say.is-range .say__report { display: none; }
.say.has-result .say__word, .say.is-live .say__word { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "hanzi pinyin listen" "hanzi gloss listen"; justify-items: start; align-items: center; column-gap: 14px; row-gap: 0; padding: 8px 14px; border-radius: 18px; }
.say.has-result .say__hanzi, .say.is-live .say__hanzi { grid-area: hanzi; font-size: 40px; }
.say.has-result .say__pinyin, .say.is-live .say__pinyin { grid-area: pinyin; align-self: end; font-size: 19px; }
.say.has-result .say__gloss, .say.is-live .say__gloss { grid-area: gloss; min-width: 0; overflow-wrap: anywhere; align-self: start; text-align: left; font-size: 13px; }
.say.has-result .say__listen, .say.is-live .say__listen { grid-area: listen; margin-top: 0; padding: 8px 12px; }
/* A phrase (a situation's line): smaller characters across the top, pinyin and meaning under them. */
.say.is-phrase .say__hanzi { font-size: 40px; line-height: 1.25; text-align: center; }
.say.is-phrase .say__pinyin { font-size: 19px; text-align: center; }
.say.is-phrase.has-result .say__word, .say.is-phrase.is-live .say__word { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "hanzi hanzi" "pinyin listen" "gloss listen"; }
.say.is-phrase.has-result .say__hanzi, .say.is-phrase.is-live .say__hanzi { font-size: 28px; text-align: left; }
.say.is-phrase.has-result .say__pinyin, .say.is-phrase.is-live .say__pinyin { font-size: 16px; text-align: left; }
.say.has-result .say__tip, .say.is-live .say__tip { display: none; }
.say.is-range.is-live .say__tip { display: block; }
.say.has-result .say__plot { height: 136px; }
/* The legend's second row ("Previous try") takes its height from the plot's margin, not from the line. */
.say.has-result .say__plot:has(.say__key--ghost:not([hidden])) { height: 150px; }
.say.is-live .say__plot { height: 150px; }

/* The narrowest phones: path labels stay inside the screen. */
@media (max-width: 340px) { .path-node__label { width: 104px; } }

/* --- shine: cards in "Освоил" ------------------------------------------ *
 * A foil plate with a light sweep every few seconds.
 * --shine-delay staggers tiles so a grid never flashes all at once.
 * :root[data-shine="holo"] swaps the gold foil for a holographic one. */
:root {
  --shine-foil: linear-gradient(135deg, #fff5d9 0%, #f6d98f 34%, #fff2cc 56%, #eac267 100%);
  --shine-edge: #d4a246;
  --shine-ink: #9a3a1f;
  --shine-glow: rgba(201, 151, 59, .38);
  --shine-accent: #c38a1e;
  --shine-light: rgba(255, 255, 255, .8);
}
:root[data-theme="dark"] {
  --shine-foil: linear-gradient(135deg, #4b3b1b 0%, #7d5f25 36%, #574420 58%, #8f6c2b 100%);
  --shine-edge: #d4a246;
  --shine-ink: #ffe2a0;
  --shine-glow: rgba(212, 162, 70, .3);
  --shine-accent: #f3c867;
  --shine-light: rgba(255, 236, 190, .45);
}
:root[data-shine="holo"], [data-swatch="holo"] {
  --shine-foil: linear-gradient(125deg, #ffdbe9 0%, #dcecff 24%, #dcfbe6 48%, #fff3cf 72%, #ecdcff 100%);
  --shine-edge: #b99be0;
  --shine-ink: #5b3a8c;
  --shine-glow: rgba(160, 120, 220, .32);
  --shine-accent: #8f6cd6;
}
:root[data-shine="holo"][data-theme="dark"], :root[data-theme="dark"] [data-swatch="holo"] {
  --shine-foil: linear-gradient(125deg, #5a3450 0%, #2f4a6e 24%, #2e5a45 48%, #6a5a2c 72%, #4b3470 100%);
  --shine-ink: #f1e4ff;
  --shine-accent: #d7c2ff;
}
/* The gold swatches in settings stay gold while holo is on. */
:root[data-shine="holo"] .shine-swatch:not([data-swatch="holo"]) {
  --shine-foil: linear-gradient(135deg, #fff5d9 0%, #f6d98f 34%, #fff2cc 56%, #eac267 100%);
  --shine-edge: #d4a246;
  --shine-ink: #9a3a1f;
  --shine-glow: rgba(201, 151, 59, .38);
  --shine-accent: #c38a1e;
}
:root[data-shine="holo"][data-theme="dark"] .shine-swatch:not([data-swatch="holo"]) {
  --shine-foil: linear-gradient(135deg, #4b3b1b 0%, #7d5f25 36%, #574420 58%, #8f6c2b 100%);
  --shine-ink: #ffe2a0;
  --shine-glow: rgba(212, 162, 70, .3);
  --shine-accent: #f3c867;
}
.shine { position: relative; overflow: hidden; isolation: isolate; border-color: var(--shine-edge) !important; background: var(--shine-foil) !important; background-size: 100% 100%; color: var(--shine-ink) !important; box-shadow: 0 3px 12px var(--shine-glow); }
:root[data-shine="holo"] .shine:not(.shine-swatch), .shine-swatch[data-swatch="holo"] { background-size: 220% 220% !important; animation: shine-holo 6s ease-in-out infinite alternate; }
.shine::after { content: ""; position: absolute; z-index: -1; inset: -30% -60%; background: linear-gradient(110deg, transparent 38%, var(--shine-light) 50%, transparent 62%); transform: translateX(-70%); animation: shine-sweep 5s ease-in-out var(--shine-delay, 0s) infinite; pointer-events: none; }
@keyframes shine-sweep { 0%, 72% { transform: translateX(-70%); } 100% { transform: translateX(70%); } }
@keyframes shine-holo { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }

/* The page of a mastered character: the big glyph on its own foil plate. */
.detail-hanzi.shine { width: fit-content; padding: 10px 24px 14px; border: 2px solid; border-radius: 28px; }

/* Result: everything this round mastered, together, each with one burst. */
.result-mastered { margin: 14px 0 18px; text-align: center; }
.result-mastered h2 { margin: 0 0 10px; color: var(--shine-accent); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.result-mastered__tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
/* A mastered word turns over: its «помню» face, then foil (gold or holo, the learner's look), then sparks. */
.result-mastered__tile { position: relative; display: grid; min-width: 76px; height: 86px; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; transform-style: preserve-3d; animation: mastered-turn 1.15s cubic-bezier(.55, 0, .3, 1) calc(var(--shine-delay, 0s) + .5s) both; }
.result-mastered__face { grid-area: 1 / 1; display: grid; place-content: center; justify-items: center; gap: 6px; min-width: 76px; padding: 0 14px; border: 2px solid; border-radius: 20px; font: 600 32px/1 "Noto Serif SC", serif; white-space: nowrap; backface-visibility: hidden; -webkit-backface-visibility: hidden; transform: rotateY(180deg); }
.result-mastered__face small { font-family: "Manrope", system-ui, sans-serif; font-size: 11px; font-weight: 700; line-height: 1; letter-spacing: .02em; opacity: .8; }
.result-mastered__face--before { transform: none; border-color: #b9d3bd; background: linear-gradient(135deg, rgba(var(--jade-rgb), .72), rgba(255,255,255,.45) 50%, rgba(var(--jade-rgb), .6)); color: var(--ink); }
.result-mastered__face.shine::after { animation: shine-sweep-once 1s ease-out calc(var(--shine-delay, 0s) + 1.5s) 1 both, shine-sweep 5s ease-in-out calc(var(--shine-delay, 0s) + 3.6s) infinite; }
.result-mastered__sparks { position: absolute; top: 50%; left: 50%; width: 0; height: 0; pointer-events: none; }
.result-mastered__sparks i { position: absolute; width: 8px; height: 8px; margin: -4px; background: var(--shine-accent); box-shadow: 0 0 10px var(--shine-glow); clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); opacity: 0; animation: mastered-spark .85s ease-out calc(var(--shine-delay, 0s) + 1.2s) both; }
.result-mastered__sparks i:nth-child(odd) { width: 5px; height: 5px; margin: -2.5px; border-radius: 50%; clip-path: none; animation-duration: .7s; }
@keyframes mastered-turn { 0% { transform: rotateY(0) scale(1); } 30% { transform: rotateY(0) scale(1.1); } 72% { transform: rotateY(200deg) scale(1.18); } 100% { transform: rotateY(180deg) scale(1); } }
@keyframes mastered-spark { 0% { opacity: 0; transform: rotate(var(--a)) translateX(10px) scale(.4); } 25% { opacity: 1; } 100% { opacity: 0; transform: rotate(var(--a)) translateX(64px) scale(1.1); } }
.shine--burst { animation: shine-pop .7s cubic-bezier(.3, 1.5, .5, 1) calc(var(--shine-delay, 0s) + .25s) both; }
.shine--burst::after { animation: shine-sweep-once 1s ease-out calc(var(--shine-delay, 0s) + .55s) 1 both, shine-sweep 5s ease-in-out calc(var(--shine-delay, 0s) + 3s) infinite; }
@keyframes shine-pop { 0% { opacity: 0; transform: scale(.4) rotate(-8deg); } 60% { opacity: 1; transform: scale(1.14) rotate(3deg); } 100% { transform: none; } }
@keyframes shine-sweep-once { from { transform: translateX(-70%); } to { transform: translateX(70%); } }

/* Settings: a small sample of each look. */
.shine-options button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 0; padding: 6px; }
.shine-option__text { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; line-height: 1.15; text-align: left; }
.shine-swatch { flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border: 1.5px solid; border-radius: 8px; font: 600 15px/1 "Noto Serif SC", serif; }

/* "Без анимации" (and the system's reduced motion): the foil stays, nothing moves. */
:root[data-shine="still"] .shine, :root[data-shine="still"] .shine--burst, [data-swatch="still"] { animation: none !important; }
:root[data-shine="still"] .shine::after, [data-swatch="still"]::after { display: none; }
@media (prefers-reduced-motion: reduce) {
  .shine, .shine::after, .shine--burst { animation: none !important; }
  .shine::after { display: none; }
}
/* Without motion a mastered word shows its foil face at once. */
:root[data-shine="still"] .result-mastered__tile { animation: none; transform: rotateY(180deg); }
:root[data-shine="still"] .result-mastered__sparks { display: none; }
@media (prefers-reduced-motion: reduce) {
  .result-mastered__tile { animation: none; transform: rotateY(180deg); }
  .result-mastered__sparks { display: none; }
}

/* Memory check: its own screen before the questions, the words hidden as tiles. */
.memcheck { text-align: center; }
.memcheck__seal { display: inline-grid; place-items: center; width: 64px; height: 64px; margin: 4px auto 8px; border: 2px solid var(--shine-edge); border-radius: 20px; background: var(--shine-foil); color: var(--shine-ink); box-shadow: 0 3px 12px var(--shine-glow); font: 600 34px/1 "Noto Serif SC", serif; }
.memcheck__tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 4px 0 18px; }
.memcheck__tile { display: grid; place-items: center; width: 34px; height: 40px; border: 1.5px solid #b9d3bd; border-radius: 10px; background: rgba(var(--jade-rgb), .45); color: var(--ink); font-weight: 800; opacity: .8; animation: memcheck-tile .5s cubic-bezier(.3, 1.5, .5, 1) calc(var(--i, 0) * 50ms) both; }
@keyframes memcheck-tile { from { opacity: 0; transform: translateY(8px) scale(.8); } }
@media (prefers-reduced-motion: reduce) { .memcheck__tile { animation: none; } }

/* Review ask: stars, then a few words for the team (a sheet over the results, and Settings). */
.review-form { display: grid; gap: 10px; text-align: center; }
.review-form__title { margin: 0; font-size: 15px; font-weight: 800; }
.review-stars { display: flex; justify-content: center; gap: 4px; }
.review-star { min-width: 44px; min-height: 44px; padding: 0; border: 0; background: none; color: var(--line); font-size: 32px; line-height: 1; cursor: pointer; transition: transform .15s ease, color .15s ease; }
.review-star.is-on { color: #e8a93a; text-shadow: 0 2px 6px rgba(232,169,58,.35); }
.review-star:active { transform: scale(.9); }
.review-form__prompt { margin: 0; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.review-form__text { width: 100%; min-height: 76px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); font: inherit; font-size: 15px; resize: vertical; }
.review-form__text:focus { outline: 2px solid rgba(223,85,63,.35); }
.review-form__error { margin: 0; color: var(--red-dark); font-size: 12px; font-weight: 700; }
.review-form__send:disabled { opacity: .45; cursor: default; }
.review-form__thanks { margin: 0; font-size: 14px; font-weight: 800; }
.review-form [hidden] { display: none; }
.review-sheet { display: grid; gap: 12px; }
/* Report a problem: a quiet flag, and the sheet above every other layer (it opens from the word and examples sheets too). */
.report-flag { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink-soft); opacity: .55; cursor: pointer; }
.report-flag svg { width: 16px; height: 16px; }
.report-flag:hover, .report-flag:focus-visible { opacity: 1; background: rgba(20,33,30,.06); }
.report-sheet { position: fixed; z-index: 60; }
.examples-modal__report { display: none; margin-left: auto; }
.examples-modal.is-note .examples-modal__report { display: inline-grid; }
.examples-modal__pinyin:not([hidden]) + .examples-modal__report { margin-left: 0; }
.game-report { display: flex; justify-content: flex-end; margin-top: -6px; }
.game-report[hidden] { display: none; }
.report-form { display: grid; gap: 10px; text-align: left; }
.report-form [hidden] { display: none; }
.report-form__title { margin: 0; font-size: 17px; font-weight: 800; text-align: center; }
.report-form__about { margin: -4px 0 2px; color: var(--ink-soft); font-size: 15px; font-weight: 700; text-align: center; }
.report-reasons { display: grid; gap: 6px; }
.report-reason { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; text-align: left; cursor: pointer; }
.report-reason::before { content: ""; flex: none; width: 16px; height: 16px; border: 2px solid var(--line); border-radius: 50%; box-sizing: border-box; }
.report-reason.is-on { border-color: var(--red, #df553f); background: rgba(223,85,63,.06); }
.report-reason.is-on::before { border: 5px solid var(--red, #df553f); }
.report-form__text { width: 100%; min-height: 56px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); font: inherit; font-size: 15px; resize: vertical; box-sizing: border-box; }
.report-form__text:focus { outline: 2px solid rgba(223,85,63,.35); }
.report-form__attach { display: flex; gap: 10px; align-items: center; font-size: 15px; line-height: 1.4; cursor: pointer; }
.report-form__attach span { flex: 1; text-wrap: wrap; }
.report-form__attach input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--red); }
.report-form__error { margin: 0; color: var(--red-dark); font-size: 12px; font-weight: 700; }
.report-form__send { width: 100%; justify-content: center; }
.report-form__send:disabled { opacity: .45; cursor: default; }
.report-form__thanks { margin: 6px 0; font-size: 15px; font-weight: 800; text-align: center; }
.settings-link__note { margin-left: auto; padding-left: 12px; color: var(--ink-soft); font-size: 12px; font-weight: 600; }
/* Boot splash: over everything until the first screen is drawn, then fades. */
.boot-splash { position: fixed; z-index: 1000; inset: 0; display: grid; place-content: center; justify-items: center; gap: 18px; background: var(--paper); transition: opacity .24s ease; }
.boot-splash.is-done { opacity: 0; pointer-events: none; }
.boot-splash__seal { display: grid; width: 64px; height: 64px; place-items: center; border-radius: 18px; background: var(--red); color: #fff; font-family: "Noto Serif SC", serif; font-size: 36px; font-weight: 700; box-shadow: 0 10px 26px rgba(223,85,63,.28); }
.boot-splash__dots { display: flex; gap: 6px; }
.boot-splash__dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-soft); opacity: .25; animation: boot-dot 1s ease-in-out infinite; }
.boot-splash__dots i:nth-child(2) { animation-delay: .15s; }
.boot-splash__dots i:nth-child(3) { animation-delay: .3s; }
@keyframes boot-dot { 50% { opacity: .8; } }
/* A slow link: say so after a few seconds, offer a reload after half a minute. The page stays covered, never the unfilled screen behind it. */
.boot-splash__note, .boot-splash__reload { margin: 0; opacity: 0; visibility: hidden; animation: boot-reveal .4s forwards; }
.boot-splash__note { max-width: 260px; color: var(--ink-soft); font-size: 14px; font-weight: 600; line-height: 1.35; text-align: center; animation-delay: 6s; }
.boot-splash__reload { padding: 10px 20px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--ink); font: inherit; font-size: 14px; font-weight: 700; animation-delay: 30s; }
.boot-splash [data-lang] { display: none; }
:root[data-boot-lang="ru"] .boot-splash [data-lang="ru"], :root:not([data-boot-lang="ru"]) .boot-splash [data-lang="en"] { display: inline; }
@keyframes boot-reveal { to { opacity: 1; visibility: visible; } }
:root[data-theme="dark"] .profile-avatar { box-shadow: 0 0 0 2px var(--paper); }
:root[data-theme="dark"] .profile-avatar.is-pro { box-shadow: 0 0 0 var(--pro-gap) var(--paper), 0 0 14px 3px rgba(240, 195, 90, .35); }
:root[data-theme="dark"] .profile-avatar.is-super { box-shadow: 0 0 0 var(--pro-gap) var(--paper), 0 0 18px 5px rgba(240, 195, 90, .5); }

/* ================================================================== *
 * Tablet and desktop: the tab bar becomes a sidebar
 * ================================================================== *
 * Phones keep the bottom tab bar, the app filling the screen. From
 * 600px the app fills the window and the nav is a rail down the left edge
 * (icons over labels); from 1200px a sidebar (icons beside labels). Both add
 * the brand on top and the profile and settings at the foot, which leave the
 * screens' own headers. Views centre their content in a column --content
 * wide, at least --gutter from the edges; their scroll containers stay full
 * width, so the wheel scrolls anywhere and the scrollbar sits at the edge.
 * Rounds, their results and the welcome tour hide the sidebar, as they hide
 * the tab bar on phones.
 */
.nav-brand, .nav-foot { display: none; }
.bottom-nav button { cursor: pointer; }
/* The shell never scrolls, not even from a script or find-in-page: closed sheets wait beside it, off screen. */
.app-shell { overflow: clip; }
/* Closed sheets are hidden too, so crossing a breakpoint never slides one across the screen. */
.settings-sheet { visibility: hidden; transition: transform .38s cubic-bezier(.2,.8,.2,1), visibility 0s .38s; }
.settings-sheet.is-open { visibility: visible; transition: transform .38s cubic-bezier(.2,.8,.2,1); }

@media (min-width: 600px) {
  body { padding-block: 0; }
  .app-shell {
    --side-w: calc(96px + var(--safe-left));
    --gutter: 24px;
    --content: 600px;
    width: 100%;
    max-width: none;
    height: calc(100dvh / var(--ui-zoom, 1));
    padding: 0 0 0 var(--side-w);
    border-radius: 0;
    box-shadow: none;
  }
  .app-shell:has(.game-screen:not([hidden])),
  .app-shell:has(.result-screen:not([hidden])),
  .app-shell:has(.onboarding:not([hidden])) { --side-w: 0px; }
  /* Card pages and the open settings keep it (on phones they hide the tab bar). */
  .app-shell:has(.detail-screen:not([hidden])) .bottom-nav,
  .app-shell:has(.settings-sheet.is-open) .bottom-nav { display: flex; }

  /* --- the rail --- */
  .bottom-nav {
    top: 0;
    right: auto;
    display: flex;
    width: var(--side-w);
    height: auto;
    flex-direction: column;
    gap: 4px;
    padding: max(16px, var(--safe-top)) 8px max(16px, var(--safe-bottom)) calc(8px + var(--safe-left));
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
    border-top: 0;
    border-right: 1px solid var(--line);
  }
  .bottom-nav button { flex: none; min-height: 60px; gap: 4px; padding: 0; }
  .bottom-nav button > span { width: 52px; height: 32px; border-radius: 16px; font-size: 20px; transition: background-color .15s ease; }
  .bottom-nav button > span > svg { width: 22px; height: 22px; }
  /* Long words (Einstellungen, Entraînement) hyphenate in the language of the page rather than break anywhere. */
  .bottom-nav button > small { max-width: 100%; font-size: 10.5px; line-height: 1.2; text-align: center; -webkit-hyphens: auto; hyphens: auto; overflow-wrap: anywhere; }
  .nav-brand { display: flex; flex: none; align-items: center; justify-content: center; gap: 10px; min-height: 52px; margin-bottom: 12px; }
  .nav-brand .brand-mark { width: 42px; height: 42px; font-size: 22px; }
  .nav-brand .brand-name { display: none; }
  .nav-foot { display: flex; flex: none; flex-direction: column; gap: 4px; margin-top: auto; padding-top: 12px; }
  .nav-profile .profile-avatar { width: 28px; height: 28px; font: 800 12px "Manrope", system-ui, sans-serif; }
  .home-screen .brand, #goProfile, #goSettings, #statsSettings { display: none; }
  /* Practice and the garden are places of their own here, not steps back from home. */
  #playBack, .play-screen .header-spacer, #collectionBack { display: none; }

  /* --- views: a centred column, full-width scrolling --- */
  .view { --pad-x: max(var(--gutter), (100vw / var(--ui-zoom, 1) - var(--side-w) - var(--content)) / 2); }
  .home-screen { padding: max(24px, var(--safe-top)) var(--pad-x) 32px; }
  /* Bao and the bubble stay together in the middle (on phones Bao centres in the room the bubble leaves). */
  .mascot-slot--hero { margin-inline: 0; }
  .play-screen .screen-header { padding: max(20px, var(--safe-top)) var(--pad-x) 8px; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .practice-scroll { padding: 8px var(--pad-x) 32px; }
  .screen-footer { padding-inline: var(--pad-x); }
  .stats-screen { padding: max(24px, var(--safe-top)) 0 0; }
  .stats-header { padding-inline: var(--pad-x); }
  .stats-scroll { padding: 12px var(--pad-x) 32px; }
  .dialogs-scroll { padding: 12px var(--pad-x) 32px; }
  .collection-screen { --content: 960px; padding: max(20px, var(--safe-top)) 0 0; }
  .collection-screen > *, .confuse-screen > * { margin-inline: var(--pad-x); }
  .collection-screen > .character-grid { margin-inline: 0; padding-inline: var(--pad-x); }
  .character-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
  .character-tile__hanzi { font-size: 30px; }
  .character-tile__meta { font-size: 10px; }
  .confuse-screen { --content: 640px; padding: max(20px, var(--safe-top)) 0 max(24px, var(--safe-bottom)); }
  .confuse-screen > .confuse-list { margin-inline: 0; padding-inline: var(--pad-x); }
  .path-screen, .achievements-screen { padding: max(20px, var(--safe-top)) 0 0; }
  .path-screen > .topbar, .achievements-screen > .topbar { padding-inline: var(--pad-x); }
  .path-screen { --content: 560px; }
  .path-scroll, .achievements-scroll { padding: 8px var(--pad-x) 32px; }
  /* The trail is drawn for the map's width once (app.js drawPathTrail): a fixed width keeps it on the chapters. */
  .path-map { width: min(100%, 420px); margin-inline: auto; }
  .achievements-screen { --content: 880px; }
  .achievement-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
  .detail-screen { --content: 640px; padding-inline: var(--pad-x); padding-top: max(20px, var(--safe-top)); }
  .detail-actions { margin-inline: 0; padding-inline: 0; }
  /* A round: the card keeps a card's proportions, and with room to spare it and its answers sit mid-screen. */
  .game-screen { --content: 520px; padding: max(20px, var(--safe-top)) var(--pad-x) max(20px, var(--safe-bottom)); }
  .card-stage { max-height: 760px; margin-top: auto; }
  .session-actions, .reveal-actions { margin-bottom: auto; }
  /* A question without buttons under the card (quiz, check, listening) centres the card alone. */
  .game-screen:not(:has(> .session-actions:not([hidden]), > .reveal-actions:not([hidden]))) > .card-stage { margin-bottom: auto; }
  .result-screen { --content: 560px; --result-pad: var(--pad-x); padding: max(28px, var(--safe-top)) var(--pad-x) 0; }
  .onboarding, .tutorial { padding-inline: max(0px, (100% - 560px) / 2); }

  /* --- layers above the sidebar --- */
  .sheet-backdrop { z-index: 24; }
  .settings-sheet {
    z-index: 25;
    left: auto;
    width: min(440px, 100%);
    padding-right: var(--safe-right);
    border-radius: 28px 0 0 28px;
    box-shadow: -24px 0 60px rgba(20,33,30,.18);
    transform: translateX(calc(100% + 80px));
  }
  .settings-sheet .sheet-header { padding: max(20px, var(--safe-top)) 24px 14px; }
  .settings-scroll { padding: 20px 24px; }
  .settings-footer { padding: 14px 24px max(20px, var(--safe-bottom)); }
  .examples-modal { z-index: 26; align-items: center; justify-content: center; padding: 24px; }
  .examples-modal__sheet { width: min(100%, 560px); max-height: min(100%, 720px); padding-bottom: 24px; border-radius: 28px; box-shadow: 0 26px 60px rgba(20,33,30,.28); }
  /* Toasts centre on the content, not on the whole window. */
  .toast { left: calc(var(--side-w) + (100% - var(--side-w)) / 2); }
}

/* Room to write with a mouse or a pen (app.js sizes the writer to the canvas). */
@media (min-width: 600px) and (min-height: 760px) {
  .handwriting__canvas { width: 320px; height: 320px; }
}

/* Short windows (a phone on its side): the rail drops the brand and tightens. */
@media (min-width: 600px) and (max-height: 560px) {
  .nav-brand { display: none; }
  .bottom-nav { gap: 2px; padding-block: max(8px, var(--safe-top)) max(8px, var(--safe-bottom)); }
  .bottom-nav button { min-height: 50px; gap: 2px; }
  .bottom-nav button > span { height: 28px; }
  .nav-foot { padding-top: 6px; }
}

/* Room for two columns: home pairs its cards, Practice puts the topics beside the settings, Progress splits in two. */
@media (min-width: 1000px) {
  .home-screen { --content: 880px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 16px 20px; }
  .home-screen > * { grid-column: 1 / -1; margin-block: 0; }
  .home-screen > .today-card, .home-screen > .path-stack, .home-screen > .garden-card, .home-screen > .daily-word { grid-column: auto; }
  .home-screen > .today-card { display: flex; flex-direction: column; justify-content: center; }
  /* Offers span the row: the pitch on the left, its buttons on the right. */
  .home-screen > .offer-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 32px; }
  .home-screen > .offer-card > :not(.offer-card__actions) { grid-column: 1; }
  .home-screen > .offer-card > .offer-card__actions { grid-column: 2; grid-row: 1 / span 3; margin: 0; }
  .home-screen > .offer-card .menu-secondary { min-width: 200px; padding-inline: 24px; }
  .play-screen { --content: 880px; }
  .practice-scroll { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; align-content: start; column-gap: 20px; }
  .practice-scroll > .screen-intro { grid-column: 1 / -1; }
  /* The round's settings on the left, its words on the right. */
  .practice-scroll > .practice-config { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; column-gap: 20px; }
  .practice-config > * { grid-column: 1; margin-top: 0; }
  .practice-config > .words-card { grid-column: 2; grid-row: 1 / span 4; }
  .tests-fold { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .tests-fold:has(> .test-card[hidden]) { grid-template-columns: 1fr; }
  .screen-footer { display: flex; align-items: center; gap: 20px; }
  .selection-summary { flex: 1; margin: 0; font-size: 12px; text-align: start; }
  #practiceStart { width: auto; min-width: 280px; }
  .stats-screen { --content: 880px; }
  .stats-scroll { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; align-content: start; column-gap: 20px; }
  .stats-col > :first-child { margin-top: 0; }
}

@media (min-width: 1200px) {
  .app-shell { --side-w: calc(240px + var(--safe-left)); --gutter: 40px; }
  .bottom-nav { gap: 2px; padding: max(24px, var(--safe-top)) 16px max(20px, var(--safe-bottom)) calc(16px + var(--safe-left)); }
  .nav-brand { justify-content: flex-start; padding-inline: 6px; margin-bottom: 24px; }
  .nav-brand .brand-name { display: block; font-size: 20px; }
  .bottom-nav button { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 48px; padding: 0 14px 0 6px; }
  .bottom-nav button > span { width: 36px; height: 32px; border-radius: 10px; }
  .bottom-nav button > small { font-size: 15px; text-align: start; }
  .bottom-nav button.is-active { background: rgba(184,88,57,.12); }
  .bottom-nav button.is-active > span { background: transparent; }
  .nav-foot { gap: 2px; }
}

/* A mouse: what can be clicked answers the pointer. */
@media (hover: hover) and (pointer: fine) {
  .bottom-nav button:hover { color: var(--ink); }
  .bottom-nav button:not(.is-active):hover > span { background: var(--line); }
  .path-card:not(.offer-card), .garden-card, .achievements-card, .character-tile, .topic-button, .hard-list button, .daily-word { transition: border-color .15s ease, box-shadow .15s ease; }
  .path-card:not(.offer-card):hover, .garden-card:hover, .achievements-card:hover, .daily-word:hover { border-color: var(--ink-soft); box-shadow: 0 14px 34px -22px rgba(41,73,59,.5); }
  .character-tile:hover, .topic-button:hover, .hard-list button:hover { border-color: var(--ink-soft); }
}
@media (min-width: 1200px) and (hover: hover) and (pointer: fine) {
  .bottom-nav button:not(.is-active):hover { background: var(--line); }
  .bottom-nav button:not(.is-active):hover > span { background: transparent; }
}

/* --- printed worksheets: the print sheet over the garden or a chapter --- */
.worksheet-card { max-width: 400px; text-align: left; }
.worksheet-card h2 { margin-top: 0; }
.worksheet-pills { margin: 4px 0 12px; }
.worksheet-summary { display: grid; gap: 3px; margin-bottom: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px; background: rgba(var(--glass-rgb), .6); }
.worksheet-summary b { font-size: 16px; }
.worksheet-summary small { color: var(--ink-soft); font-size: 12px; font-weight: 600; line-height: 1.4; }
.worksheet-glyphs { margin: 4px 0 0; font-size: 20px; letter-spacing: .04em; line-height: 1.35; }
.worksheet-range { display: flex; align-items: center; gap: 6px; margin-top: 6px; min-width: 0; }
.worksheet-range .icon-button { width: 32px; height: 32px; flex: 0 0 auto; }
.worksheet-range .icon-button:disabled { opacity: .35; }
.worksheet-range__start { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; flex: 0 1 auto; min-width: 0; color: var(--ink-soft); font-size: 10.5px; font-weight: 700; line-height: 1.2; text-align: center; }
.worksheet-range__start input { width: 54px; padding: 6px 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); color: var(--ink); font: inherit; font-size: 15px; font-weight: 700; text-align: center; }
.worksheet-range b { flex: 1 1 auto; min-width: 0; margin-left: 4px; color: var(--ink-soft); font-size: 12.5px; text-align: right; white-space: nowrap; }
.worksheet-edit { display: inline-flex; align-items: center; gap: 6px; justify-self: start; margin-top: 2px; }
.worksheet-edit::after { content: "›"; }
.worksheet-edit[aria-expanded="true"]::after { content: "‹"; }
.worksheet-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; max-height: 180px; overflow-y: auto; }
.worksheet-pick__char { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); color: var(--ink); font: inherit; font-size: 19px; cursor: pointer; }
.worksheet-pick__char.is-off { color: var(--ink-soft); opacity: .45; text-decoration: line-through; }
.worksheet-card .menu-primary.is-done, .worksheet-card .menu-primary.is-done:disabled { background: var(--green); color: #fff; }
.worksheet-kinds { display: flex; flex-wrap: wrap; gap: 7px; }
.worksheet-kinds .chip { display: inline-flex; align-items: center; gap: 6px; }
.worksheet-formats { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 12px; }
.worksheet-formats__label { color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.worksheet-formats .chip { display: inline-flex; align-items: center; gap: 6px; }
.worksheet-lines__value { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
#worksheetLines .selection-menu { min-width: 120px; }
#worksheetList { margin: 4px 0 10px; }
#worksheetList .selection-menu { min-width: 200px; }
#worksheetList .selection-menu__item .pro-badge { margin-left: auto; }
.worksheet-own { width: 100%; min-height: 46px; margin: 0 0 10px; padding: 0 15px; border: 1px solid var(--line); border-radius: 14px; background: rgba(var(--glass-rgb), .8); color: var(--ink); font: inherit; font-size: 18px; }
.worksheet-own:focus { outline: 2px solid rgba(223,85,63,.35); }
.worksheet-own::placeholder { font-size: 14px; color: var(--ink-soft); }
#worksheetLines .selection-menu__item .pro-badge { margin-left: auto; }
.worksheet-hint { margin: 8px 0 4px; color: var(--ink-soft); font-size: 12px; line-height: 1.45; }
/* The top of the first page, drawn like the PDF: always white paper, the bottom fades out. */
.worksheet-preview { margin: 6px 0 10px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 6px 18px rgba(43, 38, 34, .08); overflow: hidden; -webkit-mask-image: linear-gradient(#000 72%, transparent); mask-image: linear-gradient(#000 72%, transparent); }
.worksheet-preview svg { display: block; width: 100%; height: auto; }
.worksheet-card .toggle-row { margin-bottom: 10px; border-top: 1px solid var(--line); }
.worksheet-card .menu-primary svg { flex: 0 0 auto; }

/* "Check yourself" under a lesson. */
.note-check { margin-top: 18px; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); }
.note-check__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 10px; }
.note-check__top .note-check__title { margin: 0; }
.note-check__pinyin { flex: none; min-height: 32px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-soft); font-size: 13px; font-weight: 700; line-height: 1; cursor: pointer; }
.note-check__pinyin[aria-pressed="true"] { border-color: var(--red); background: var(--red); color: #fff; }
.note-check__py { display: none; }
.note-check.shows-pinyin .note-check__py:not(:empty), .note-check__py.is-shown { display: block; }
.note-check .order__tile .note-check__py { margin-top: 2px; color: var(--ink-soft); font-family: "Manrope", system-ui, sans-serif; font-size: 12px; font-weight: 600; line-height: 1.2; }
.note-check.shows-pinyin .order__tile { display: inline-flex; flex-direction: column; align-items: center; }
p.note-check__py { margin: -8px 0 14px; color: var(--ink-soft); font-size: 14px; font-weight: 600; }
.note-check .probe-option .note-check__py { color: var(--ink-soft); font-size: 12px; font-weight: 600; }
.note-meaning__line { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.note-meaning__line .note-pick__line { margin-bottom: 14px; }
.note-check__options.note-meaning__options { grid-template-columns: 1fr; }
.note-meaning__option { text-align: left; font-size: 15px; font-weight: 600; line-height: 1.35; white-space: normal; }
.note-check__title { margin: 0 0 10px; color: var(--red-dark); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.note-check__prompt { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 16px; font-weight: 700; }
.note-check__play { flex: none; }
.note-check__options { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 8px; }
.note-check__options .probe-option--pinyin { padding-inline: 6px; font-size: 20px; }
.note-check__options.order { display: flex; flex-direction: column; }
.note-pick__line { margin: 0 0 14px; font: 600 22px/1.6 "Noto Serif SC", serif; }
.note-pick__gap { display: inline-block; min-width: 2.2em; margin: 0 2px; padding: 0 6px; border-bottom: 2px dashed var(--line); text-align: center; }
.note-pick__gap.is-correct { border-bottom: 2px solid var(--green); background: var(--tint-green); border-radius: 6px 6px 0 0; }
.note-check__reveal { margin: 12px 0 0; display: flex; flex-direction: column; gap: 2px; }
.note-check__reveal b { font: 700 22px "Noto Serif SC", serif; }
.note-check__reveal small { color: var(--ink-soft); font-size: 13px; font-weight: 600; }
.note-check__heard { margin-top: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.note-check__heard .note-check__reveal { margin: 0; min-width: 0; }
.note-check__next { width: 100%; margin-top: 12px; }
.note-check__score { margin: 0 0 6px; font-size: 18px; font-weight: 800; color: var(--green-ink, var(--ink)); }

/* The path card and the theory strip tucked under it: the chapter's next lesson peeks out below the card. */
.path-stack { margin-bottom: 8px; }
.path-stack > .path-card { margin-bottom: 0; }
.path-stack:has(.path-peek:not([hidden])) { margin-bottom: 12px; }
.path-peek { position: relative; z-index: 0; display: flex; width: calc(100% - 24px); align-items: flex-start; gap: 8px; margin: -16px 12px 0; padding: 24px 14px 10px; border: 1px solid var(--line); border-radius: 0 0 16px 16px; background: var(--paper-deep); color: var(--ink); font: inherit; font-size: 13px; font-weight: 800; line-height: 1.3; text-align: left; cursor: pointer; }
.path-peek[hidden] { display: none; }
.path-peek svg { width: 16px; height: 16px; flex: none; margin-top: 1px; color: var(--red-dark); }
.path-peek__label { min-width: 0; flex: 1; }
.path-peek em { flex: none; color: var(--ink-soft); font-size: 12px; font-style: normal; }
.path-peek .pro-badge { align-self: center; color: var(--paper); font-size: 8px; }
.path-peek i { flex: none; color: var(--ink-soft); font-size: 18px; font-style: normal; line-height: 1; }

/* Brush up: on home only when there is something to practise. */
/* Home: «Работа над ошибками», one deep green row like the today card; a red 错 seal and a few missed words (renderHome). */
.mistakes-entry { display: flex; width: 100%; min-height: 64px; margin-bottom: 8px; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid rgba(126, 196, 146, 0.3); border-radius: 22px; background: radial-gradient(120% 90% at 100% 0%, rgba(126, 196, 146, 0.22), transparent 60%), linear-gradient(140deg, #18473a 0%, #1f5a45 55%, #2a6c4c 100%); color: #fffdf7; font: inherit; text-align: left; box-shadow: 0 16px 36px -16px rgba(23, 59, 54, 0.45); cursor: pointer; }
.mistakes-entry[hidden] { display: none; }
.mistakes-entry > b { flex: 1; font-size: 16px; font-weight: 800; letter-spacing: -0.01em; color: #fffdf7; }
.mistakes-entry__seal { flex: none; display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; background: var(--red); color: #fff; border: 1.5px solid rgba(255, 255, 255, 0.35); font-family: "Noto Serif SC", serif; font-size: 24px; font-weight: 700; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25); }
.mistakes-entry__words { display: flex; }
.mistakes-entry__words i { display: grid; min-width: 30px; height: 36px; place-items: center; margin-left: -6px; padding: 0 4px; border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 8px; background: rgba(255, 253, 247, 0.18); color: #fffdf7; font-family: "Noto Serif SC", serif; font-size: 16px; font-style: normal; font-weight: 700; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2); backdrop-filter: blur(4px); }
.mistakes-entry__words i:nth-child(odd) { rotate: -5deg; }
.mistakes-entry__words i:nth-child(even) { rotate: 4deg; }
.mistakes-entry .card-chevron { margin-left: 4px; color: rgba(255, 253, 247, 0.7); }

/* The mistakes screen: the missed words on green over their round, a tile per kind of question, the look-alikes. */
.mistakes-screen .topbar { border-bottom: 1px solid var(--line); }
.mistakes-body { display: grid; gap: 16px; overflow-y: auto; padding-bottom: 16px; }
.mistakes-hero[hidden], .mistakes-section[hidden], .mistakes-row[hidden] { display: none; }
/* Bao at the top of the mistakes screen: what the screen is for on the first visit, a cheer after that (renderMistakes). */
.mistakes-bao { display: flex; align-items: center; gap: 10px; }
.mistakes-bao__mascot { flex: none; width: 72px; height: 72px; }
.mistakes-bao__bubble { position: relative; flex: 1; margin: 0; white-space: pre-line; padding: 10px 13px; border: 1px solid var(--line); border-radius: 16px; background: var(--white); color: var(--ink); font-size: 13.5px; font-weight: 650; line-height: 1.38; box-shadow: 0 10px 24px -16px rgba(41,73,59,.45); }
.mistakes-bao__bubble::before { content: ""; position: absolute; left: -6px; top: 50%; width: 10px; height: 10px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--white); transform: translateY(-50%) rotate(45deg); }
.mistakes-hero { position: relative; overflow: hidden; padding: 16px 16px 22px; border-radius: 26px; background: radial-gradient(120% 90% at 100% 0%, rgba(126, 196, 146, 0.26), transparent 60%), linear-gradient(140deg, #18473a 0%, #1f5a45 55%, #2a6c4c 100%); border: 1px solid rgba(126, 196, 146, 0.25); box-shadow: 0 18px 42px -18px rgba(23, 59, 54, 0.5); }
.mistakes-hero .menu-kicker { display: block; margin-bottom: 12px; color: #a7dfb8; font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.mistakes-words { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.mistakes-words button { aspect-ratio: 1; padding: 0; border: 1px solid rgba(255, 255, 255, 0.85); border-radius: 16px; background: var(--white); color: var(--ink); font-family: "Noto Serif SC", serif; font-size: 30px; font-weight: 700; box-shadow: 0 6px 16px -8px rgba(10, 35, 24, 0.4); cursor: pointer; transition: transform 0.12s ease; }
.mistakes-words button:active { transform: scale(0.95); }
.mistakes-words button[data-len="2"] { font-size: 21px; }
.mistakes-words button[data-len="3"] { font-size: 15px; }
.mistakes-hero .menu-primary { display: flex; width: 100%; min-height: 52px; align-items: center; justify-content: center; gap: 8px; border-radius: 16px; border: 1px solid rgba(255, 255, 255, 0.2); background: var(--red); color: #fff; font-size: 16px; font-weight: 800; box-shadow: 0 8px 22px -6px rgba(223, 85, 63, 0.5); }
.mistakes-section { display: grid; gap: 10px; }
.mistakes-section .menu-kicker { display: block; margin-bottom: 2px; color: #24503e; font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.mistakes-kinds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mistakes-kind { display: grid; justify-items: start; gap: 2px; padding: 12px 10px; border: 1.5px solid rgba(184, 209, 189, 0.5); border-radius: 18px; background: var(--white); color: var(--ink); font: inherit; text-align: left; cursor: pointer; position: relative; box-shadow: 0 6px 18px -12px rgba(23, 59, 54, 0.16); }
.mistakes-kind span { font-family: "Noto Serif SC", serif; font-size: 26px; font-weight: 700; line-height: 1.1; color: #18473a; }
.mistakes-kind b { font-size: 12px; font-weight: 800; line-height: 1.2; }
.mistakes-kind small { position: absolute; top: 9px; right: 9px; padding: 2px 7px; border-radius: 8px; background: rgba(184, 209, 189, 0.35); color: #18473a; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.mistakes-row { display: flex; width: 100%; min-height: 60px; align-items: center; gap: 12px; padding: 10px 14px; border: 1.5px solid rgba(184, 209, 189, 0.5); border-radius: 18px; background: var(--white); color: var(--ink); font: inherit; text-align: left; cursor: pointer; box-shadow: 0 6px 18px -12px rgba(23, 59, 54, 0.16); }
.mistakes-row b { font-size: 15px; font-weight: 800; }
.mistakes-row__pair { display: flex; align-items: center; gap: 6px; font-family: "Noto Serif SC", serif; font-size: 22px; font-weight: 700; color: var(--red-dark); }
.mistakes-row__pair i { color: var(--ink-soft); font-family: inherit; font-size: 13px; font-style: normal; }
.mistakes-row__count { margin-left: auto; padding: 3px 8px; border-radius: 8px; background: rgba(184, 209, 189, 0.35); color: #18473a; font-size: 13px; font-weight: 800; }
.mistakes-row .card-chevron { margin-left: 0; color: var(--ink-soft); }
:root[data-theme="dark"] .mistakes-entry { background: radial-gradient(120% 90% at 100% 0%, rgba(126, 196, 146, 0.16), transparent 60%), linear-gradient(140deg, #1d3f32 0%, #24503e 60%, #2b5d45 100%); border-color: rgba(126, 196, 146, 0.3); }
:root[data-theme="dark"] .mistakes-hero { background: radial-gradient(120% 90% at 100% 0%, rgba(126, 196, 146, 0.18), transparent 60%), linear-gradient(140deg, #1d3f32 0%, #24503e 60%, #2b5d45 100%); border-color: rgba(126, 196, 146, 0.3); }
:root[data-theme="dark"] .mistakes-words button { background: #253d32; border-color: rgba(229, 235, 217, 0.18); color: #e5ebd9; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3); }
:root[data-theme="dark"] .mistakes-section .menu-kicker { color: #7ec492; }
:root[data-theme="dark"] .mistakes-kind, :root[data-theme="dark"] .mistakes-row { background: var(--white); border-color: rgba(126, 196, 146, 0.22); }
:root[data-theme="dark"] .mistakes-kind span { color: #7ec492; }
:root[data-theme="dark"] .mistakes-kind small, :root[data-theme="dark"] .mistakes-row__count { background: rgba(126, 196, 146, 0.18); color: #7ec492; }

/* Tone check: slide through the four tones, then check. */
.tone-pick__syllable { margin: 0 0 10px; color: var(--ink-soft); font-size: 34px; font-weight: 800; letter-spacing: .01em; text-align: center; }
.tone-pick__syllable.is-picked { color: var(--ink); }
.tone-pick { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; grid-template-columns: none; gap: 4px; padding: 4px; border-radius: 16px; background: var(--paper-deep); }
.tone-pick__stop { display: flex; min-height: 58px; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 4px; border: 0; border-radius: 12px; background: none; color: var(--ink-soft); font: inherit; cursor: pointer; }
.tone-pick__stop svg { width: 44px; height: 26px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.tone-pick__stop span { font-size: 12px; font-weight: 800; }
.tone-pick__stop[aria-checked="true"] { background: var(--white); color: var(--red-dark); box-shadow: 0 2px 8px -4px rgba(23,59,54,.45); }
.tone-pick__stop.is-correct { background: var(--tint-green); color: var(--green-ink); }
.tone-pick__stop.is-wrong { background: var(--tint-red); color: var(--red-dark); }
.tone-pick__stop:disabled { cursor: default; }
.note-check__go { width: 100%; margin-top: 12px; }

/* The tones' sound lab, and the pitch line in front of an example's pinyin. */
.tone-lab { margin: 4px 0 14px; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); }
.tone-lab__chips { display: flex; gap: 6px; margin-bottom: 4px; }
.tone-lab__chip { min-width: 52px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); color: var(--ink-soft); font: inherit; font-size: 15px; font-weight: 800; cursor: pointer; }
.tone-lab__chip[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.tone-lab__head { display: flex; justify-content: center; margin: 4px 0 10px; }
/* The syllable is the play button: big text with a small outlined speaker beside it. */
.tone-lab__again { display: inline-flex; align-items: center; gap: 10px; padding: 4px 14px; border: 0; border-radius: 16px; background: none; color: var(--ink); font: inherit; cursor: pointer; transition: background .15s ease, transform .1s ease; }
.tone-lab__again:hover { background: rgba(255,255,255,.55); }
.tone-lab__again:active { transform: scale(.97); }
.tone-lab__again .tone-pick__syllable { margin: 0; min-width: 3ch; color: var(--ink); }
.tone-lab__again .speaker-icon { width: 22px; height: 22px; color: var(--red-dark); opacity: .85; }
.tone-lab__again .speaker-icon path:first-child { fill: none; stroke: currentColor; stroke-width: 2; }
.note-example .detail-example__pinyin { display: flex; align-items: center; line-height: 18px; }
.tone-mark { display: inline-flex; margin-right: 8px; color: var(--red-dark); }
.tone-mark svg { display: block; width: 30px; height: 18px; fill: currentColor; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.tone-mark svg path { fill: none; }
.tone-pick__stop[hidden] { display: none; }
.tone-lab__word { display: flex; min-height: 34px; align-items: baseline; justify-content: center; gap: 10px; margin: 12px 0 0; color: var(--ink-soft); font-size: 15px; font-weight: 700; }
.tone-lab__word b { color: var(--ink); font: 600 26px "Noto Serif SC", serif; }
.tone-lab__none { color: var(--ink-faint, var(--ink-soft)); }

/* A tone still loading: its pitch line and the speaker pulse until the sound starts. */
@keyframes tone-loading { from { opacity: 1; } to { opacity: .25; } }
.tone-pick__stop.is-loading svg, .tone-lab__again.is-loading .speaker-icon { animation: tone-loading .5s ease-in-out infinite alternate; }
@media (prefers-reduced-motion: reduce) { .tone-pick__stop.is-loading svg, .tone-lab__again.is-loading .speaker-icon { animation: none; opacity: .4; } }

/* "Saved for later" preview: the pocket of new words waiting to be asked, the 记 seal. */
.later-pocket { display: inline-flex; align-items: center; gap: 3px; margin-left: 8px; padding: 4px 9px; border: 0; border-radius: 999px; background: var(--red-soft); color: var(--red-dark); font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; }
.later-pocket[aria-expanded="true"] { background: var(--red); color: #fff; }
.later-pocket[hidden] { display: none; }
.later-pocket svg { width: 15px; height: 15px; }
.saved-ghost { transform-origin: center; }
.saved-stamp { position: absolute; left: 50%; top: 50%; z-index: 3; display: grid; width: 92px; height: 92px; place-items: center; border: 4px solid var(--red); border-radius: 18px; color: var(--red); font: 700 56px "Noto Serif SC", serif; background: rgba(255,253,247,.55); transform: translate(-50%, -50%) rotate(-12deg); opacity: 0; }
.topbar:has(.later-stash) { position: relative; }
.later-stash { position: absolute; top: calc(100% + 4px); right: 10px; z-index: 40; width: min(260px, calc(100vw / var(--ui-zoom, 1) - 32px)); padding: 12px 14px 8px; border: 1px solid var(--line); border-radius: 18px; background: var(--white); box-shadow: 0 18px 40px -18px rgba(23,59,54,.45); transform-origin: top right; animation: stash-open .18s ease-out; }
.later-stash[hidden] { display: none; }
@keyframes stash-open { from { opacity: 0; transform: scale(.92) translateY(-4px); } }
.later-stash__title { margin: 0 0 6px; color: var(--red-dark); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.later-stash__list { margin: 0; padding: 0; list-style: none; }
.later-stash__list li { display: flex; align-items: baseline; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); }
.later-stash__list li:first-child { border-top: 0; }
.later-stash__list b { font: 600 24px "Noto Serif SC", serif; color: var(--ink); }
.later-stash__list span { flex: 1; color: var(--ink-soft); font-size: 14px; font-weight: 700; }
.later-stash__list small { color: var(--ink-soft); font-size: 12px; font-weight: 700; }

/* After an answer the card must fit one screen: the word's picture becomes a
   thumbnail beside its meaning, the "review" chip goes, and a reply question's
   prompt is not repeated above the dialogue the reveal already shows. */
.probe.has-answer .probe__reason,
.probe.has-answer .format-prompt[data-format="reply"] { display: none; }
.quiz-feedback:has(> .quiz-image:not([hidden])) {
  display: grid;
  grid-template-columns: 84px 1fr;
  grid-auto-flow: row;
  column-gap: 14px;
  row-gap: 2px;
  align-items: center;
  justify-items: start;
  text-align: left;
}
.quiz-feedback:has(> .quiz-image:not([hidden])) > * { grid-column: 1 / -1; justify-self: center; }
.quiz-feedback:has(> .quiz-image:not([hidden])) > .quiz-image {
  grid-column: 1;
  grid-row: span 2;
  justify-self: stretch;
  width: 84px;
  height: 84px;
  max-height: none;
  object-fit: cover;
  border-radius: 16px;
}
.quiz-feedback:has(> .quiz-image:not([hidden])) > .quiz-translation,
.quiz-feedback:has(> .quiz-image:not([hidden])) > .quiz-pinyin { grid-column: 2; justify-self: start; text-align: left; }
.quiz-feedback:has(> .quiz-image:not([hidden])) > .quiz-report { justify-self: end; }

/* ------------------------------------------------------------------ *
 * Practice papers of HSK 2–6 (web/paper-view.js)
 * ------------------------------------------------------------------ */
.paper-best { margin: 6px 0 0; color: var(--green-ink); font-size: 13px; font-weight: 800; }
body.paper-open { overflow: hidden; }
body.paper-open #paywall { z-index: 46; }
.paper { position: absolute; inset: 0; z-index: 45; display: flex; flex-direction: column; gap: 10px; padding: max(16px, var(--safe-top)) 20px max(18px, var(--safe-bottom)); background: radial-gradient(circle at 86% 4%, rgba(223, 85, 63, .11), transparent 30%), var(--paper); animation: say-in .22s ease-out; }
.paper[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .paper { animation: none; } }
.paper__top { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; gap: 10px; }
.paper__heading { display: grid; justify-items: center; gap: 2px; min-width: 0; }
.paper__heading h2 { margin: 0; max-width: 100%; overflow: hidden; font-size: 17px; font-weight: 800; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.paper__count { color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.paper__count:empty { display: none; }
.paper__body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 2px 8px; }
.paper__foot { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.paper__foot [hidden] { display: none; }
.paper__foot:has(#paperBack[hidden]) { grid-template-columns: 1fr; }
.paper-lead { margin: 8px 0 16px; font-size: 17px; font-weight: 700; }
.paper-note { margin: 16px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 1.5; }
.paper-parts { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.paper-parts li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.paper-parts span { color: var(--ink-soft); font-weight: 700; }
.paper-question { display: grid; gap: 14px; }
.paper-zh { font-family: "Noto Serif SC", "Songti SC", serif; }
.paper-line { margin: 0; }
.paper-pinyin { display: block; color: var(--ink-soft); font-size: 12px; font-weight: 600; line-height: 1.3; }
.paper-passage { font-size: 20px; line-height: 1.7; }
.paper-stem { font-size: 18px; font-weight: 800; }
.paper-hint { margin: 0; color: var(--ink-soft); font-size: 18px; font-weight: 700; letter-spacing: .02em; }
.paper-play { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px; border: 0; border-radius: 18px; background: var(--ink); color: var(--paper); font-size: 16px; font-weight: 800; cursor: pointer; }
.paper-play:disabled { opacity: .45; cursor: default; }
.paper-play.is-playing .paper-play__icon { animation: paper-pulse 1s ease-in-out infinite; }
@keyframes paper-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .paper-play.is-playing .paper-play__icon { animation: none; } }
.paper-options { display: grid; gap: 10px; }
.paper-options--chars { grid-template-columns: repeat(2, 1fr); }
.paper-option { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); font-size: 17px; font-weight: 700; text-align: left; cursor: pointer; }
.paper-option__mark { flex: none; width: 26px; color: var(--ink-soft); font-size: 13px; }
.paper-option__char { font-size: 30px; }
.paper-option__order { font-size: 20px; font-weight: 800; letter-spacing: .12em; }
.paper-options--bank { grid-template-columns: repeat(2, 1fr); gap: 8px; }
.paper-options--bank .paper-option { min-height: 50px; padding: 8px 10px; font-size: 16px; }
.paper-option.is-picked, .paper-letter.is-picked { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.paper-option.is-correct, .paper-letter.is-correct { border-color: var(--green); background: var(--tint-green); color: var(--green-ink); box-shadow: inset 0 0 0 1px var(--green); }
.paper-option.is-wrong, .paper-letter.is-wrong { border-color: var(--red); background: var(--tint-red); color: var(--red-dark); box-shadow: inset 0 0 0 1px var(--red); }
.paper-option:disabled, .paper-letter:disabled { opacity: 1; cursor: default; }
.paper-sentences { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.paper-sentence { display: flex; align-items: baseline; gap: 10px; padding: 8px 12px; border: 1px dashed var(--line); border-radius: 12px; font-size: 17px; }
.paper-sentence b { flex: none; width: 20px; color: var(--ink-soft); font-size: 13px; }
.paper-build { display: grid; gap: 12px; }
.paper-build__line, .paper-build__tiles { display: flex; flex-wrap: wrap; gap: 8px; min-height: 56px; padding: 8px; border-radius: 14px; }
.paper-build__line { border: 1px dashed var(--ink-soft); background: var(--surface); }
.paper-tile { min-height: 44px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 20px; cursor: pointer; }
.paper-tile:disabled:not(.is-placed) { opacity: .3; }
.paper-write { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); font-size: 18px; line-height: 1.6; resize: vertical; }
.paper-review { display: grid; gap: 10px; margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--line); }
.paper-verdict { margin: 0; font-weight: 800; }
.paper-verdict.is-right { color: var(--green-ink); }
.paper-verdict.is-wrong { color: var(--red-dark); }
.paper-answer { margin: 0; font-size: 18px; font-weight: 700; }
.paper-transcript h3 { margin: 0 0 6px; font-size: 13px; color: var(--ink-soft); }
.paper-transcript__row { display: grid; gap: 2px; margin: 0 0 8px; }
.paper-transcript__row b { color: var(--ink-soft); font-size: 12px; }
.paper-transcript__row small, .paper-gloss p { color: var(--ink-soft); font-size: 13px; line-height: 1.5; }
.paper-gloss p { margin: 0 0 4px; }
.paper-score { display: grid; justify-items: center; gap: 2px; margin: 12px 0 8px; }
.paper-score b { font-size: 56px; font-weight: 800; line-height: 1; }
.paper-score.is-passed b { color: var(--green-ink); }
.paper-score span { color: var(--ink-soft); font-weight: 700; }
.paper-verdict-line { margin: 0 0 16px; font-size: 17px; font-weight: 800; text-align: center; }
.paper-options--pictures { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.paper-options--pictures .paper-option { display: grid; align-content: start; gap: 6px; min-height: 0; padding: 6px; }
.paper-picture { position: relative; display: block; aspect-ratio: 1; overflow: hidden; border-radius: 10px; background: var(--paper-deep); }
.paper-picture img { display: block; width: 100%; height: 100%; object-fit: cover; }
.paper-picture .paper-option__mark { position: absolute; top: 4px; left: 4px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--paper); color: var(--ink); font-size: 12px; }
.paper-picture__zh { font-size: 14px; font-weight: 700; line-height: 1.35; }
.paper-picture__gloss { color: var(--ink-soft); font-size: 11px; line-height: 1.3; font-weight: 600; }
.paper-essay { display: grid; gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.paper-essay__task { color: var(--ink-soft); font-size: 15px; }
.paper-essay__score { display: flex; align-items: baseline; gap: 8px; }
.paper-essay__score b { font-size: 40px; font-weight: 800; line-height: 1; }
.paper-essay__score span { color: var(--ink-soft); font-weight: 700; }
.paper-essay h3 { margin: 6px 0 0; color: var(--ink-soft); font-size: 13px; }
.paper-essay__summary { margin: 0; font-size: 15px; line-height: 1.5; }
.paper-essay__list, .paper-essay__fixes { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.paper-essay__list li { padding-left: 14px; border-left: 3px solid var(--jade); font-size: 14px; line-height: 1.45; }
.paper-essay__fixes li { padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.paper-essay__change { margin: 0 0 4px; font-size: 17px; }
.paper-essay__from { color: var(--red-dark); text-decoration: line-through; text-decoration-thickness: 1px; }
.paper-essay__to { color: var(--green-ink); font-weight: 700; }
.paper-essay__fixes small { color: var(--ink-soft); font-size: 13px; line-height: 1.4; }
.paper-essay__task, .paper-passage { white-space: pre-line; }
.paper-writing-link { margin-top: 6px; padding: 0; color: var(--ink); font-size: 14px; font-weight: 800; text-decoration: underline; }
.paper-writing { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.paper-writing__item { display: grid; gap: 4px; width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-align: left; cursor: pointer; }
.paper-writing__head { display: flex; align-items: baseline; gap: 8px; }
.paper-writing__head small { color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.paper-writing__head em { margin-left: auto; color: var(--green-ink); font-size: 20px; font-style: normal; font-weight: 800; }
.paper-writing__preview { color: var(--ink-soft); font-size: 15px; line-height: 1.5; }
.paper-writing__text h3 { margin: 10px 0 4px; color: var(--ink-soft); font-size: 13px; }
.paper-writing__text { font-size: 17px; line-height: 1.7; white-space: pre-wrap; }
.paper-writing__date { color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.paper-writing__delete { margin-top: 14px; }
.paper-writing__date { display: block; margin: 6px 0 8px; }
.paper-essay__to { padding: 0 1px; border-radius: 3px; background: var(--tint-green); }
.paper-essay__from { padding: 0 1px; border-radius: 3px; background: var(--tint-red); }
.paper-writing__title { font-size: 17px; font-weight: 800; }
.paper-writing__title--big { display: block; margin: 8px 0 2px; font-size: 22px; }
.paper-essay__random { width: 100%; margin-bottom: 12px; }
.paper-topic { display: grid; gap: 2px; margin: 6px 0 12px; }
.paper-topic__gloss { color: var(--ink-soft); font-size: 13px; font-weight: 600; line-height: 1.4; }
.paper-topic__task { margin: 8px 0 0; font-size: 17px; line-height: 1.7; }
.paper-essay__counter { margin: 6px 0 12px; }
.paper-essay__check { width: 100%; }
.paper-topic__draft { color: var(--red-dark); font-size: 12px; font-style: normal; font-weight: 800; }
.paper-essay__progress { margin: 0; font-size: 14px; font-weight: 800; }
.paper-essay__progress.is-up { color: var(--green-ink); }
.paper-essay__progress.is-down { color: var(--red-dark); }
.paper-essay__progress.is-same { color: var(--ink-soft); }
.paper-chips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 4px 0 0; padding: 0; list-style: none; }
.paper-chip { --tint: rgba(46, 125, 87, .24); position: relative; isolation: isolate; display: flex; align-items: center; gap: 8px; min-height: 48px; overflow: hidden; padding: 8px 12px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(90deg, var(--tint) var(--fill), var(--surface) var(--fill)); font-size: 14px; }
.paper-chip.is-mid { --tint: rgba(214, 160, 40, .28); }
.paper-chip.is-weak { --tint: rgba(223, 85, 63, .22); }
.paper-chip__icon { display: grid; place-items: center; flex: none; }
.paper-chip b { flex: 1; min-width: 0; font-weight: 800; }
.paper-chip__score { color: var(--ink-soft); font-size: 13px; font-weight: 800; white-space: nowrap; }
.paper-chips { margin: 8px 0 14px; }
.paper-chip b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Permission before a writing or detailed voice check. */
.processing-consent { box-sizing: border-box; width: min(calc(92vw / var(--ui-zoom, 1)), 460px); max-height: calc(85dvh / var(--ui-zoom, 1)); overflow: auto; border: 1px solid var(--line); border-radius: 22px; padding: 24px; background: var(--paper); color: var(--ink); }
.processing-consent::backdrop { background: rgba(20,33,30,.45); }
.processing-consent h2 { margin: 0 0 12px; font-size: 21px; }
.processing-consent p { font-size: 15px; line-height: 1.5; }
.processing-consent button { width: 100%; margin-top: 10px; }
.processing-consent__share { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 8px; font-size: 15px; line-height: 1.4; cursor: pointer; }
.processing-consent__share input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--red); }
.processing-consent__hint { margin: -4px 0 10px 30px; color: var(--ink-soft); font-size: 13px; line-height: 1.4; }

/* --- my journey: the Progress card and the timeline screen (web/journey.js) --- */
.journey-card { display: flex; width: 100%; align-items: center; gap: 12px; margin-top: 10px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 20px; background: var(--white); color: var(--ink); text-align: left; cursor: pointer; }
.journey-card__glyphs { display: flex; flex-shrink: 0; }
.journey-card__glyphs:empty { display: none; }
.journey-card__glyphs b { display: grid; min-width: 36px; height: 36px; padding: 0 5px; box-sizing: border-box; place-items: center; white-space: nowrap; border: 2px solid var(--white); border-radius: 12px; background: var(--paper-deep); font-size: 19px; font-weight: 600; }
.journey-card__glyphs b + b { margin-left: -9px; }
.journey-card__glyphs b[data-len="2"] { font-size: 16px; }
.journey-card__glyphs b[data-len="3"], .journey-card__glyphs b[data-len="4"] { font-size: 13px; }
.journey-card__glyphs b:last-child { background: var(--ink); color: var(--paper); }
.journey-card__copy { display: grid; flex: 1; min-width: 0; }
.journey-card__copy b { font-size: 14px; }
.journey-card__copy small { color: var(--ink-soft); font-size: 10px; font-weight: 700; }
.journey-card__latest { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.journey-screen { display: flex; flex-direction: column; padding: max(16px, var(--safe-top)) 16px 0; }
.journey-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 4px 32px; }
.journey-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0 0 18px; }
.journey-stats[hidden] { display: none; }
.journey-stats div { display: grid; gap: 2px; padding: 10px 6px; border: 1px solid var(--line); border-radius: 16px; background: var(--white); text-align: center; }
.journey-stats dd { margin: 0; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.journey-stats dt { color: var(--ink-soft); font-size: 9.5px; font-weight: 700; line-height: 1.2; }

/* The rail: a line down the left, a dot per day. */
.journey-line { position: relative; margin: 0; padding: 0 0 0 22px; list-style: none; }
.journey-line::before { content: ""; position: absolute; top: 6px; bottom: 18px; left: 6px; width: 2px; border-radius: 2px; background: var(--line); }
.journey-month { position: relative; margin: 18px 0 8px -22px; padding-left: 22px; color: var(--red); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.journey-month:first-child { margin-top: 0; }
.journey-day { position: relative; display: grid; gap: 6px; margin-bottom: 14px; }
.journey-day::before { content: ""; position: absolute; top: 4px; left: -21px; width: 10px; height: 10px; border: 2px solid var(--paper); border-radius: 50%; background: var(--ink-soft); box-shadow: 0 0 0 1px var(--line); }
.journey-day.is-start::before { background: var(--red); }
.journey-day__date { color: var(--ink-soft); font-size: 11px; font-weight: 700; }

.journey-event { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; border: 1px solid var(--line); border-radius: 16px; background: var(--white); }
.journey-event__icon { display: grid; flex-shrink: 0; width: 36px; height: 36px; place-items: center; border-radius: 12px; background: var(--paper-deep); color: var(--ink); font-size: 21px; font-weight: 600; }
.journey-event__icon svg { width: 20px; height: 20px; }
.journey-event__icon img { width: 44px; height: 44px; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(37,45,34,.18)); }
.journey-event__icon--achievement { width: 44px; background: none; }
.journey-event__icon--start { background: var(--red); color: var(--on-red); }
.journey-event__icon--firstMastered, .journey-event__icon--crown { background: #efdbac; color: #805b17; }
.journey-event__icon--checkpoint { background: var(--jade); }
.journey-event__icon--streak { background: rgba(223, 85, 63, .14); color: var(--red); }
.journey-event__icon--pro { background: var(--ink); color: var(--paper); }
.journey-event__copy { display: grid; min-width: 0; }
.journey-event__copy b { font-size: 13.5px; line-height: 1.25; }
.journey-event__copy small { color: var(--ink-soft); font-size: 11px; font-weight: 600; }
.journey-event--start { border-color: rgba(223, 85, 63, .35); }
.journey-event--checkpoint { padding-block: 4px; border-style: dashed; background: transparent; }
.journey-event--checkpoint .journey-event__icon { width: 28px; height: 28px; border-radius: 9px; }
.journey-event--checkpoint .journey-event__copy { display: flex; flex-wrap: wrap; column-gap: 6px; align-items: baseline; }

.journey-words { display: grid; gap: 5px; }
.journey-words small { color: var(--ink-soft); font-size: 10.5px; font-weight: 700; }
.journey-words__chips { display: flex; flex-wrap: wrap; gap: 5px; }
.journey-words__chips button { min-width: 32px; height: 32px; padding: 0 6px; border: 1px solid var(--line); border-radius: 9px; background: var(--white); color: var(--ink); font-size: 16px; cursor: pointer; }
.journey-words--mastered .journey-words__chips button { border-color: #e2c27d; background: #f6ead0; color: #6e4d12; }
.journey-words__chips .journey-words__more { color: var(--ink-soft); font-size: 12px; font-weight: 800; }
:root[data-theme="dark"] .journey-card, :root[data-theme="dark"] .journey-event:not(.journey-event--checkpoint), :root[data-theme="dark"] .journey-stats div, :root[data-theme="dark"] .journey-words__chips button { background: var(--white); }
:root[data-theme="dark"] .journey-words--mastered .journey-words__chips button, :root[data-theme="dark"] .journey-event__icon--firstMastered, :root[data-theme="dark"] .journey-event__icon--crown { border-color: rgba(240,195,90,.4); background: rgba(240,195,90,.16); color: #f0c35a; }
@media (min-width: 600px) {
  .journey-screen { --content: 640px; padding: max(20px, var(--safe-top)) 0 0; }
  .journey-screen > .topbar { padding-inline: var(--pad-x); }
  .journey-scroll { padding: 8px var(--pad-x) 32px; }
}

/* Games on the practice screen (web/games.js): the list, the shared screen, and each game's board. */
/* Practice's parts: "Training" (a round to configure), "Games" and "Exams"; #viewPlay[data-tab] shows one. */
.practice-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 12px; padding: 4px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.practice-tabs button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--ink-soft); font-size: 14px; font-weight: 800; cursor: pointer; }
.practice-tabs button.is-selected { background: var(--ink); color: var(--paper); }
.practice-tabs__icon { font: 600 19px/1 "Noto Serif SC", serif; }
/* Four parts don't fit in a row on a phone: the seal goes above the label. */
@media (max-width: 560px) { .practice-tabs button { flex-direction: column; gap: 2px; min-height: 54px; padding: 6px 2px; font-size: 12px; } .practice-tabs__icon { font-size: 18px; } }
#viewPlay:not([data-tab="train"]) .practice-config, #viewPlay[data-tab="exams"] .screen-footer { display: none; }
#viewPlay:not([data-tab="games"]) .games-pane, #viewPlay:not([data-tab="exams"]) .tests-card { display: none; }
/* Games draw from the training's words: on the games tab its word choice (not the round length) stands below the tiles. */
#viewPlay[data-tab="games"] .practice-scroll { display: grid; align-content: start; }
#viewPlay[data-tab="games"] .practice-config { display: block; order: 1; }
#viewPlay[data-tab="games"] .practice-config > :not(#deckSizeRow), #viewPlay[data-tab="games"] .words-card__length, #viewPlay[data-tab="games"] #deckSize { display: none; }
#viewPlay[data-tab="games"] #deckSizeRow[hidden] { display: block; }
#viewPlay[data-tab="games"] #deckSizeRow:has(> #topicsSection[hidden]) { display: none; }
#viewPlay[data-tab="games"] #deckSizeRow { margin-top: 12px; }
.practice-scroll > .games-pane, .practice-scroll > .tests-card { grid-column: 1 / -1; }
.games-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.game-tile { position: relative; display: flex; min-height: 150px; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; }
button.game-tile:active { transform: scale(.98); }
.game-tile__seal { display: grid; width: 46px; height: 46px; margin-bottom: 6px; place-items: center; border-radius: 14px; background: var(--tint-green); color: var(--green-ink); font: 600 26px "Noto Serif SC", serif; }
.game-tile b { font-size: 15px; line-height: 1.2; }
.game-tile small { color: var(--ink-soft); font-size: 12px; line-height: 1.35; }
.game-tile__best { margin-top: auto; padding-top: 4px; color: var(--green-ink); font-size: 12px; font-style: normal; font-weight: 800; }
.game-tile__sizes { display: grid; width: 100%; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: auto; padding-top: 8px; }
.game-tile__sizes button { min-height: 34px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); color: var(--ink); font-size: 13px; font-weight: 800; cursor: pointer; }
/* The picked game, started by «Начать игру» below. */
.game-tile.is-selected { border-color: var(--red); background: var(--tint-red); box-shadow: inset 0 0 0 1px var(--red); }
.game-tile__sizes button.is-selected { border-color: var(--ink); background: var(--ink); color: var(--on-ink); }
.games-grid > .game-tile:last-child:nth-child(odd) { grid-column: 1 / -1; min-height: 0; }
@media (min-width: 720px) { .games-grid { grid-template-columns: repeat(3, 1fr); } .games-grid > .game-tile:last-child:nth-child(odd) { grid-column: auto; min-height: 150px; } }
.games-screen { display: flex; flex-direction: column; }
/* Situations (web/situations.js): the list on the dialogues screen (a place in the tab bar), then a dialogue on its own screen. */
.situations-lead { margin: 0 0 12px; color: var(--ink-soft); font-size: 14px; line-height: 1.45; }
.situations-list { display: grid; gap: 28px; }
/* The dialogues tab's two cards (Ivan's pick of Gemini 4 Argon's, 2026-10-29); the whole card is the button. */
.dialogs-cards { display: grid; gap: 16px; align-content: start; }
.talk-hero { position: relative; display: flex; flex-direction: column; width: 100%; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: var(--white); box-shadow: 0 10px 28px -20px rgba(23, 59, 54, .26); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.talk-hero:active { transform: scale(.985); }
/* Full width whatever the browser's button defaults (older Safari shrank these to their text). */
.talk-hero__orbit, .talk-hero__head, .talk-hero__foot { width: 100%; }
.talk-hero[aria-busy="true"] { animation: speak-skeleton .7s ease-in-out infinite alternate; }
.talk-hero__copy { position: relative; display: grid; gap: 5px; text-align: center; }
.talk-hero__copy b { font-size: 23px; line-height: 1.12; letter-spacing: -.04em; }
.talk-hero__copy small { color: var(--ink-soft); font-size: 14px; font-weight: 500; line-height: 1.42; }
.talk-hero__go { display: grid; flex: none; place-items: center; width: 34px; height: 34px; padding-bottom: 2px; border-radius: 50%; font-size: 22px; font-weight: 800; line-height: 1; }
/* Live conversation: Lulu on air among the hosts, then the line and the «Начать говорить» bar. */
.talk-hero__orbit { position: relative; display: block; height: 184px; overflow: hidden; border-bottom: 1px solid var(--line); background: radial-gradient(circle at 50% 54%, rgba(255, 253, 247, .92) 0%, rgba(226, 239, 246, .4) 58%, transparent 75%), linear-gradient(180deg, #dceaf3 0%, #eff6f9 100%); }
.talk-hero__orbit::before, .talk-hero__orbit::after { content: ""; position: absolute; top: 56%; left: 50%; border: 1.5px dashed rgba(23, 59, 54, .12); border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none; }
.talk-hero__orbit::before { width: 156px; height: 118px; }
.talk-hero__orbit::after { width: 296px; height: 158px; }
.talk-hero__lulu { position: absolute; z-index: 5; top: 54%; left: 50%; display: flex; flex-direction: column; align-items: center; transform: translate(-50%, -50%); }
.talk-hero__lulu img { width: 82px; height: 82px; padding: 3px; border-radius: 50%; object-fit: cover; background: var(--white); box-shadow: 0 0 0 3px var(--red), 0 10px 24px rgba(223, 85, 63, .28); }
.talk-hero__onAir { margin-top: -10px; padding: 2px 10px 3px; border-radius: 99px; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; white-space: nowrap; box-shadow: 0 3px 8px rgba(223, 85, 63, .3); }
.talk-hero__host { position: absolute; z-index: 3; display: flex; align-items: center; gap: 5px; }
.talk-hero__face { flex: none; width: 48px; height: 48px; border: 2.5px solid var(--white); border-radius: 50%; object-fit: cover; object-position: 50% 20%; background: #fbf7ee; box-shadow: 0 5px 12px rgba(23, 59, 54, .14); }
.talk-hero__chip { padding: 3px 8px 4px; border: 1px solid rgba(23, 59, 54, .12); border-radius: 10px; background: rgba(255, 253, 247, .94); box-shadow: 0 3px 8px rgba(23, 59, 54, .08); color: var(--ink); font-size: 11px; font-weight: 700; white-space: nowrap; }
.talk-hero__host--1 { top: 14px; left: 14px; }
.talk-hero__host--2 { top: 14px; right: 14px; flex-direction: row-reverse; }
.talk-hero__host--3 { bottom: 48px; left: 10px; }
.talk-hero__host--4 { bottom: 48px; right: 10px; flex-direction: row-reverse; }
.talk-hero__surprise, .talk-hero__secret { position: absolute; z-index: 6; bottom: 8px; display: inline-flex; align-items: center; border-radius: 99px; box-shadow: 0 4px 10px rgba(23, 59, 54, .12); white-space: nowrap; }
.talk-hero__surprise { left: 12px; gap: 6px; padding: 3px 10px 3px 4px; border: 1px solid rgba(223, 85, 63, .3); background: var(--white); color: var(--red-dark); font-size: 11.5px; font-weight: 800; }
.talk-hero__surprise img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.talk-hero__secret { right: 12px; gap: 5px; padding: 4px 10px; background: var(--ink); color: var(--paper); font-size: 11px; font-weight: 700; }
.talk-hero__dot { width: 7px; height: 7px; border-radius: 50%; background: #f5b942; }
.talk-hero__foot { display: grid; gap: 14px; padding: 16px 18px 18px; }
.talk-hero__start { display: flex; align-items: center; justify-content: center; position: relative; min-height: 52px; padding: 0 56px; border-radius: 99px; background: var(--red); color: #fff; font-size: 17px; font-weight: 800; box-shadow: 0 8px 18px -8px rgba(223, 85, 63, .6); }
.talk-hero__start .talk-hero__go { position: absolute; right: 8px; background: #fff; color: var(--red); }
/* Ready scenarios: the heading over the next scene's picture, then that scene and how far the band is. */
.talk-hero--scenarios { background: linear-gradient(180deg, #ecf6f3 0%, #e1f0eb 100%); }
.talk-hero__head { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px 18px 16px; overflow: hidden; }
.talk-hero__fan { position: relative; flex: none; width: 168px; height: 122px; }
.talk-hero__postcard { position: absolute; overflow: hidden; border: 2.5px solid var(--white); border-radius: 12px; background: #fbf7ee; box-shadow: 0 8px 18px rgba(23, 59, 54, .16); }
.talk-hero__postcard img { display: block; width: 100%; height: 100%; object-fit: cover; }
.talk-hero__postcard--1 { z-index: 1; top: 16px; left: 2px; width: 86px; height: 66px; transform: rotate(-11deg); }
.talk-hero__postcard--2 { z-index: 2; top: 4px; right: 4px; width: 92px; height: 70px; transform: rotate(9deg); }
.talk-hero__postcard--3 { z-index: 3; bottom: 4px; left: 34px; width: 112px; height: 78px; transform: rotate(-2.5deg); }
.talk-hero__check { position: absolute; top: 5px; right: 5px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--green); color: #fff; font-size: 10.5px; font-weight: 800; box-shadow: 0 2px 5px rgba(0, 0, 0, .18); }
.talk-hero__lesson { position: relative; display: grid; gap: 12px; width: calc(100% - 24px); margin: 0 12px 12px; padding: 12px 14px 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--white); box-shadow: 0 6px 16px -10px rgba(23, 59, 54, .25); }
.talk-hero__lessonRow { display: flex; align-items: center; gap: 14px; }
.talk-hero__thumb { flex: none; width: 88px; height: 62px; overflow: hidden; border-radius: 12px; }
.talk-hero__thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.talk-hero__lessonName { display: grid; flex: 1; justify-items: start; gap: 6px; }
.talk-hero__lessonName b { font-size: 20px; line-height: 1.15; letter-spacing: -.03em; }
.talk-hero__now { padding: 3px 9px 4px; border-radius: 8px; background: rgba(223, 85, 63, .12); color: var(--red-dark); font-size: 12px; font-weight: 700; }
.talk-hero__lessonRow .talk-hero__go { background: rgba(223, 85, 63, .1); color: var(--red); }
.talk-hero__meter { display: flex; align-items: center; gap: 12px; }
.talk-hero__bar { flex: 1; height: 7px; overflow: hidden; border-radius: 99px; background: rgba(23, 59, 54, .1); }
.talk-hero__bar i { display: block; height: 100%; border-radius: 99px; background: var(--green); }
.talk-hero__meter b { font-size: 14px; letter-spacing: -.01em; }
:root[data-theme="dark"] .talk-hero { border-color: transparent; background: var(--surface); box-shadow: none; }
:root[data-theme="dark"] .talk-hero__orbit { background: radial-gradient(circle at 50% 54%, rgba(255, 255, 255, .06) 0%, transparent 70%), linear-gradient(180deg, #263845 0%, #22333f 100%); }
:root[data-theme="dark"] .talk-hero__orbit::before, :root[data-theme="dark"] .talk-hero__orbit::after { border-color: rgba(255, 255, 255, .12); }
:root[data-theme="dark"] .talk-hero__face, :root[data-theme="dark"] .talk-hero__lulu img { border-color: var(--surface); background: var(--surface); }
:root[data-theme="dark"] .talk-hero__chip, :root[data-theme="dark"] .talk-hero__surprise, :root[data-theme="dark"] .talk-hero__lesson { border-color: var(--line); background: var(--paper); }
:root[data-theme="dark"] .talk-hero--scenarios { background: linear-gradient(180deg, #1f3934 0%, #192f2b 100%); }
:root[data-theme="dark"] .talk-hero__postcard { border-color: #f4efe4; box-shadow: 0 10px 22px rgba(0, 0, 0, .42); }
:root[data-theme="dark"] .talk-hero__check { color: #17251e; }
:root[data-theme="dark"] .talk-hero__bar { background: var(--line); }
/* The situations of one band: the switch, how many are passed, and the rows (the next one outlined). */
.situations-bands { display: grid; grid-auto-flow: column; padding: 3px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 253, 247, .55); }
:root[data-theme="dark"] .situations-bands { background: var(--surface); }
.situations-bands button { padding: 7px 11px; border: 0; border-radius: 11px; background: none; color: var(--ink-soft); font-size: 13px; font-weight: 800; white-space: nowrap; cursor: pointer; }
.situations-bands button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.situations-meter { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; color: var(--ink-soft); font-size: 13px; }
.situations-meter__bar { flex: 1; height: 6px; overflow: hidden; border-radius: 3px; background: var(--line); }
.situations-meter__bar i { display: block; height: 100%; border-radius: 3px; background: var(--green); transition: width .3s ease; }
.situation-rows { display: grid; gap: 8px; }
@media (min-width: 720px) { .situation-rows { grid-template-columns: 1fr 1fr; } }
.situation-row { display: grid; grid-template-columns: 104px 1fr; gap: 12px; align-items: center; padding: 8px 12px 8px 8px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; }
.situation-row:active { transform: scale(.98); }
.situation-row[aria-busy="true"] { animation: speak-skeleton .7s ease-in-out infinite alternate; }
.situation-row__art { position: relative; display: grid; width: 104px; height: 72px; place-items: center; border-radius: 14px; background: #fbf7ee; }
.situation-row__art img { display: block; width: 100%; height: 100%; border-radius: 14px; object-fit: cover; }
:root[data-theme="dark"] .situation-row__art img { filter: brightness(.88); }
.situation-row__art .game-tile__seal { margin: 0; }
.situation-row__check { position: absolute; top: -4px; right: -6px; display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; background: var(--green); color: #fff; font-size: 13px; font-weight: 800; box-shadow: 0 0 0 2px var(--surface); }
.situation-row__copy { display: grid; gap: 3px; min-width: 0; }
.situation-row__copy b { font-size: 16px; line-height: 1.25; }
.situation-row__copy small { display: -webkit-box; overflow: hidden; color: var(--ink-soft); font-size: 13px; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.situation-row__done { color: var(--green-ink); font-size: 12px; font-style: normal; font-weight: 800; }
/* A begun situation: a ring of its steps done («1/3») where a passed one has its check. */
.situation-row__ring { position: absolute; top: -6px; right: -8px; display: grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; background: radial-gradient(var(--surface) 0 58%, transparent 60%), conic-gradient(var(--green) calc(var(--share, 0) * 360deg), var(--line) 0); box-shadow: 0 0 0 2px var(--surface); color: var(--green-ink); font-size: 10px; font-weight: 800; font-variant-numeric: tabular-nums; }
.situation-row__next { color: var(--ink-soft); font-size: 13px; line-height: 1.35; }
.situation-row__next b { color: var(--ink); font-size: 13px; font-weight: 700; }
/* Grey rows while they come down, and a painting still coming down. */
.situation-rows--skeleton .situation-row { cursor: default; pointer-events: none; }
.situation-rows--skeleton .situation-row__art, .situation-rows--skeleton i, .situation-row__art:not(.is-loaded) { background: var(--line); animation: speak-skeleton 1.1s ease-in-out infinite alternate; }
.situation-rows--skeleton i { display: block; width: 85%; height: 14px; border-radius: 7px; }
.situation-rows--skeleton i + i { width: 55%; }
.situation-art { display: block; width: 100%; aspect-ratio: 2.2; border-radius: 22px; object-fit: cover; background: #fbf7ee; }
:root[data-theme="dark"] .situation-art { filter: brightness(.88); }
.situation-screen { display: flex; flex-direction: column; }
.situation-stage { display: flex; flex: 1 1 auto; flex-direction: column; gap: 14px; width: 100%; max-width: 520px; min-height: 0; margin: 0 auto; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; padding: 14px 2px 28px; scrollbar-width: none; }
/* No scrollbar of its own (a desktop's classic one took the right edge of the chat), as the side menu. */
.situation-stage::-webkit-scrollbar { display: none; }
.situation-intro { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 18px; text-align: center; }
.situation-intro h1 { margin: 4px 0 0; font-size: 26px; }
/* The intro's title and level in the top bar, centred on the screen: the right margin balances «back» (web/situations.js showIntro; Ivan picked C, 2026-10-31). */
.situation-titlebar { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; margin-right: 44px; text-align: center; }
/* Listening: the switches in the top bar beside «back», where the track goes later. */
.situation-titlebar--tools { position: relative; align-items: stretch; margin: 0 0 0 6px; }
.situation-titlebar--tools .talk-head__view { width: 38px; height: 38px; font-size: 14px; }
.situation-titlebar--tools .situation-player-toggle { width: 38px; height: 38px; border-radius: 50%; }
/* Иероглифы off while a situation is heard: every line is its voice message (and pinyin, meaning when on). */
.situation-chat:not(.situation-live__chat).hide-hanzi .situation-line__body > .situation-line__zh { display: none; }
.situation-titlebar--tools .situation-tools__row { flex-wrap: nowrap; justify-content: flex-end; gap: 5px; }
.situation-titlebar--tools .situation-toggle.is-ticked { gap: 5px; min-height: 32px; padding: 0 8px 0 7px; border-width: 1px; border-radius: 10px; font-size: 12px; }
.situation-titlebar--tools .situation-toggle__box { width: 14px; height: 14px; border-radius: 4px; }
.situation-titlebar--tools .situation-toggle__box svg { width: 10px; height: 10px; }
.situation-player-toggle { display: grid; flex: none; place-items: center; width: 34px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 253, 247, .7); color: var(--ink-soft); cursor: pointer; }
.situation-player-toggle svg { width: 18px; height: 18px; }
.situation-player-toggle.is-selected { border-color: #2f8a5a; background: var(--white); color: #2f8a5a; }
.situation-player .speed-switch { grid-auto-columns: minmax(30px, 1fr); gap: 0; padding: 2px; }
.situation-player .speed-switch button { min-height: 26px; padding: 0 5px; }
.situation-player .speed-switch button svg { width: 15px; height: 15px; }
.situation-titlebar h1 { margin: 0; font-size: 24px; line-height: 1.15; }
.situation-intro.is-art { padding-top: 0; }
/* While talking the character's header takes the bar. */
.situation-screen.is-talking .situation-titlebar { display: none; }
.situation-seal { display: grid; width: 72px; height: 72px; place-items: center; border-radius: 22px; background: var(--tint-green); color: var(--green-ink); font: 600 40px "Noto Serif SC", serif; }
.situation-level { margin: 0; color: var(--ink-soft); font-size: 13px; font-weight: 800; }
.situation-can { max-width: 380px; margin: 0; color: var(--ink-soft); font-size: 15px; line-height: 1.5; }
.situation-goal, .situation-section { padding: 14px 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.situation-goal h2, .situation-section h2 { margin: 0 0 6px; font-size: 15px; }
.situation-goal p, .situation-section p { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.5; }
/* The buttons under the stage, on the page's background; the lines fade a little as they go under its edge, never to
   nothing and with no colour of its own (Ivan, 2026-10-30: «return gradient again, just make it less prominent»). */
.situation-stage { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), rgba(0, 0, 0, .35)); mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), rgba(0, 0, 0, .35)); }
.situation-actions { flex: none; display: grid; gap: 8px; width: 100%; max-width: 520px; margin: 0 auto; padding: 2px 2px 8px; }
.situation-actions .link-button { justify-self: center; }
/* After a wrong reply: the words out of place on request, or skip. */
.situation-build__help { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.situation-build__help[hidden] { display: none; }
.situation-build__help .menu-secondary { min-height: 44px; padding: 8px 12px; font-size: 14px; }
.situation-answer .situation-word.is-off { border-color: var(--red); background: var(--tint-red); color: var(--red-dark); }
/* A situation's two ways in, alike: a glimpse of each over its name. */
.situation-ways { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.situation-way { display: grid; grid-template-rows: auto 1fr; min-width: 0; gap: 0; padding: 0; overflow: hidden; border: 1.5px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; box-shadow: 0 6px 16px rgba(23, 59, 54, .08); transition: transform .15s ease, border-color .15s ease; }
.situation-way:active { transform: scale(.98); }
.situation-way:hover { border-color: var(--green); }
.situation-way:focus-visible { outline: 3px solid var(--green-ink); outline-offset: 3px; }
.situation-way__preview { display: flex; min-width: 0; height: 104px; padding: 12px 10px; background: var(--tint-green); }
.situation-way__title { align-self: center; padding: 12px 14px 14px; font: 800 15px/1.25 "Manrope", system-ui, sans-serif; }
.situation-way__script { flex-direction: column; justify-content: center; gap: 8px; }
.situation-way__line { display: flex; align-items: center; gap: 5px; min-width: 0; }
.situation-way__line.is-mine { flex-direction: row-reverse; }
.situation-way__face { flex: none; width: 22px; height: 22px; border-radius: 50%; object-fit: cover; background: var(--paper); }
.situation-way__bubble { min-width: 0; overflow: hidden; padding: 5px 9px; border-radius: 12px; background: var(--white); font-size: 14px; line-height: 1.2; white-space: nowrap; text-overflow: ellipsis; }
.situation-way__line.is-mine .situation-way__bubble { background: #c9e6d3; }
:root[data-theme="dark"] .situation-way__line.is-mine .situation-way__bubble { background: rgba(126, 196, 146, .3); }
.situation-way__talk { position: relative; align-items: center; justify-content: center; gap: 8px; background: #e3ecf5; }
.situation-way__host { flex: none; width: 46px; height: 46px; border-radius: 50%; object-fit: cover; background: var(--paper); box-shadow: 0 0 0 3px #fff; }
.situation-way__wave { display: flex; flex: none; align-items: center; gap: 3px; height: 34px; }
.situation-way__wave i { width: 3px; border-radius: 2px; background: #3b6ea5; opacity: .7; }
:root[data-theme="dark"] .situation-way__talk { background: rgba(120, 165, 215, .16); }
:root[data-theme="dark"] .situation-way__host { box-shadow: 0 0 0 3px var(--surface); }
:root[data-theme="dark"] .situation-way__wave i { background: #8fb4dc; }
.situation-way__mic { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--red); color: #fff; box-shadow: 0 4px 10px rgba(196, 63, 43, .3); }
.situation-way__mic svg { width: 20px; height: 20px; }
.situation-tools { display: grid; gap: 10px; padding-bottom: 6px; }
.situation-hint { margin: 0; padding: 0 8px; color: var(--ink-soft); font-size: 13px; font-weight: 500; line-height: 1.45; text-align: center; text-wrap: balance; }
.situation-tools__dock { display: flex; align-items: center; gap: 4px; padding: 5px 5px 5px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); box-shadow: 0 4px 14px rgba(23, 59, 54, .05); }
.situation-tools__label { flex: 1; min-width: 0; color: var(--ink-soft); font-size: 11px; font-weight: 800; letter-spacing: .04em; line-height: 1.2; text-transform: uppercase; }
.situation-tools__dock .situation-toggle.is-ticked { gap: 5px; min-height: 32px; padding: 0 12px 0 10px; border-width: 1px; border-radius: 999px; background: var(--surface); box-shadow: none; }
.situation-tools__dock .situation-toggle__box { width: 12px; height: 12px; border: 0; color: currentColor; opacity: .3; }
.situation-tools__dock .situation-toggle__box svg { width: 12px; height: 12px; }
.situation-tools__dock .situation-toggle.is-ticked.is-selected { border-color: var(--ink); background: var(--ink); color: var(--paper); box-shadow: none; }
.situation-tools__dock .situation-toggle.is-ticked.is-selected .situation-toggle__box { border: 0; background: none; color: currentColor; opacity: 1; }
.situation-screen.is-talking .situation-tools { display: none; }
.situation-toggle { flex: none; min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-soft); font-size: 12px; font-weight: 800; cursor: pointer; }
.situation-toggle.is-selected { border-color: var(--ink); background: var(--ink); color: var(--paper); }
/* Перевод and Пиньинь: each with its own tick, both can be on (Ivan, 2026-10-27, Gemini's variant H). */
.situation-toggle.is-ticked { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 11px 0 9px; border-width: 1.5px; border-radius: 12px; background: rgba(255, 253, 247, .7); transition: border-color .15s ease, background-color .15s ease, color .15s ease; }
.situation-toggle__box { display: grid; place-items: center; flex: none; width: 16px; height: 16px; border: 1.5px solid rgba(23, 59, 54, .3); border-radius: 5px; color: transparent; transition: inherit; }
.situation-toggle__box svg { width: 11px; height: 11px; }
.situation-toggle.is-ticked.is-selected { border-color: #2f8a5a; background: var(--white); color: var(--ink); box-shadow: 0 3px 10px rgba(47, 138, 90, .14); }
.situation-toggle.is-ticked.is-selected .situation-toggle__box { border-color: #2f8a5a; background: #2f8a5a; color: #fff; }
.situation-chat { display: flex; flex-direction: column; gap: 10px; }
/* Time passes between two lines: a quiet divider across the chat. */
.situation-later { display: flex; align-items: center; gap: 10px; margin: 8px 0; color: var(--ink-soft); font-size: 12px; font-weight: 600; animation: situation-in .4s ease-out; }
.situation-later::before, .situation-later::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.situation-line { display: flex; align-items: flex-end; gap: 8px; max-width: 92%; animation: situation-in .25s ease-out; }
.situation-line.is-mine { align-self: flex-end; flex-direction: row-reverse; }
.situation-line__avatar { flex: none; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: #fbf7ee; object-fit: cover; }
.situation-line__column { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
/* A character's line, tapped: the chat fades around it and its menu opens under it. */
.situation-chat > * { transition: opacity .15s; }
.situation-chat.has-line-menu > :not(.has-menu) { opacity: .3; }
.situation-line-menu { display: grid; min-width: 230px; margin-top: 6px; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); box-shadow: 0 12px 30px rgba(23, 59, 54, .16); animation: situation-in .15s ease-out; }
.situation-line-menu__item { display: flex; align-items: center; justify-content: flex-start; gap: 12px; width: 100%; height: 46px; padding: 0 16px; border: 0; border-radius: 0; background: transparent; font: inherit; font-size: 15px; font-weight: 500; color: var(--ink); text-align: left; opacity: 1; cursor: pointer; }
.situation-line-menu__item + .situation-line-menu__item { border-top: 1px solid var(--line); }
.situation-line-menu__item svg { flex: none; width: 19px; height: 19px; }
.situation-line-menu__item.is-report { color: var(--red-dark); }
.situation-end-report { display: inline-flex; gap: 5px; width: auto; height: 28px; margin: 2px auto 0; padding: 0 8px; border-radius: 14px; font: inherit; font-size: 13px; font-weight: 500; color: var(--ink-soft); opacity: .8; }
.situation-end-report svg { width: 14px; height: 14px; }
.situation-actions .situation-end-report { justify-self: center; }
.situation-line.is-mine .situation-line__column { align-items: flex-end; }
.situation-line__who { padding: 0 6px; color: var(--ink-soft); font-size: 11px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; }
.situation-line__body { display: grid; gap: 2px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 18px 18px 18px 6px; background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; }
.situation-line.is-mine .situation-line__body { border-color: transparent; border-radius: 18px 18px 6px 18px; background: var(--tint-green); }
.situation-line.is-speaking .situation-line__body { box-shadow: 0 0 0 2px var(--green-ink); }
.situation-line__zh { font: 600 22px/1.35 "Noto Serif SC", serif; }
.situation-line__pinyin { color: var(--ink-soft); font-size: 13px; }
.situation-line__text { color: var(--ink); font-size: 13px; line-height: 1.4; }
@keyframes situation-in { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .situation-line { animation: none; } }
/* Talking a situation through live, or chatting with Bao (web/situations.js showLive). */
.situation-live__head { display: flex; align-items: center; gap: 14px; padding-top: 8px; }
.situation-live__portrait { flex: none; width: 72px; height: 72px; border: 1px solid var(--line); border-radius: 50%; background: #fbf7ee; object-fit: cover; }
.situation-live__copy h1 { margin: 0; font-size: 22px; }
.situation-live__copy p { margin: 4px 0 0; color: var(--ink-soft); font-size: 14px; line-height: 1.45; }
.situation-live__setup { display: grid; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); transition: opacity .2s ease; }
.situation-live__setup.is-locked { opacity: .5; pointer-events: none; }
.situation-live__choice { display: grid; gap: 6px; }
.situation-live__label { color: var(--ink-soft); font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.situation-live__chips { display: flex; flex-wrap: wrap; gap: 6px; }
/* «Сюрприз» stands out among the topics: a red tint and a slowly breathing ✦, solid red once picked (Ivan, 2026-10-31,
   Gemini's variant 1). */
.situation-live__chips .situation-toggle[data-value="random"] { display: inline-flex; align-items: center; gap: 5px; padding: 0 12px 0 10px; border-color: rgba(223, 85, 63, .42); background: var(--tint-red); color: var(--ink); box-shadow: 0 1px 4px rgba(223, 85, 63, .12); transition: border-color .2s ease, background-color .2s ease, color .2s ease, box-shadow .2s ease; }
.situation-live__chips .situation-toggle[data-value="random"]::before { content: "✦"; color: var(--red); font-size: 11px; line-height: 1; animation: surprise-sparkle 3.2s ease-in-out infinite; }
.situation-live__chips .situation-toggle[data-value="random"].is-selected { border-color: var(--red); background: var(--red); color: var(--paper); box-shadow: 0 3px 10px rgba(223, 85, 63, .32); }
.situation-live__chips .situation-toggle[data-value="random"].is-selected::before { color: var(--paper); animation: none; }
:root[data-theme="dark"] .situation-live__chips .situation-toggle[data-value="random"] { border-color: rgba(227, 138, 104, .45); box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
:root[data-theme="dark"] .situation-live__chips .situation-toggle[data-value="random"].is-selected { border-color: var(--red); box-shadow: 0 3px 10px rgba(0, 0, 0, .4); }
@keyframes surprise-sparkle { 0%, 100% { transform: scale(.92); opacity: .8; } 50% { transform: scale(1.18); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .situation-live__chips .situation-toggle[data-value="random"]::before { animation: none; } }
.situation-live__chat:empty { display: none; }
/* minmax: no line, however long, makes the bubble wider than the screen (the stage clips what sticks out). */
.situation-live__chat .situation-line__body { grid-template-columns: minmax(0, 1fr); cursor: default; }
/* A narrow phone at the largest text: the voice message stays inside its bubble. */
.situation-live__chat .situation-voice { min-width: min(210px, calc(70vw / var(--ui-zoom, 1))); }
.situation-live__chat .situation-voice__wave { min-width: 0; }
.situation-live__chat .situation-line__zh ruby { ruby-position: over; }
.situation-live__chat .situation-line__zh rt { color: var(--ink-soft); font: 600 11px/1.2 "Manrope", system-ui, sans-serif; }
.situation-live__chat.hide-pinyin rt { visibility: hidden; }
.situation-live__gloss { display: block; margin: 4px 0 2px; color: var(--ink-soft); font: 600 13px/1.4 "Manrope", system-ui, sans-serif; }
.situation-live__asr { color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.situation-live__line.is-pending .situation-line__body { opacity: .7; }
/* The learner's line while it's being listened to: three hopping dots in its bubble. */
.situation-live__dots { display: inline-flex; gap: 6px; align-items: center; height: 28px; padding: 0 4px; }
.situation-live__dots span { width: 8px; height: 8px; border-radius: 999px; background: currentColor; opacity: .45; animation: talk-dot 1s ease-in-out infinite; }
.situation-live__dots span:nth-child(2) { animation-delay: .15s; }
.situation-live__dots span:nth-child(3) { animation-delay: .3s; }
@keyframes talk-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-5px); opacity: .9; } }
@media (prefers-reduced-motion: reduce) { .situation-live__dots span { animation: none; } }
.situation-live__line.is-pending .situation-line__body:has(.situation-live__dots) { opacity: 1; }
/* Turn by turn: a line as a voice message (play, its wave, its length), as in a messenger. */
/* Turn by turn: a line as a voice message, a strip across the top of its bubble (play, the wave, its length); Gemini's layout 3, picked by Ivan 2026-10-26. */
.situation-live__line .situation-line__body.has-voice { overflow: hidden; padding-top: 0; }
/* A situation's lines too (Ivan, 2026-11-01): the voice message over the words. */
.situation-line__body.has-voice { overflow: hidden; padding-top: 0; }
.situation-voice { display: flex; align-items: center; gap: 10px; min-width: 210px; margin: 0 -14px 8px; padding: 7px 12px; border: 0; border-bottom: 1px solid var(--line); background: rgba(23, 59, 54, .05); background: color-mix(in srgb, currentColor 6%, transparent); color: var(--ink); text-align: left; cursor: pointer; }
.situation-line.is-mine .situation-voice { background: rgba(47, 138, 90, .1); background: color-mix(in srgb, var(--green) 12%, transparent); }
.situation-voice__icon { display: grid; flex: none; place-items: center; width: 30px; height: 30px; border-radius: 999px; background: var(--green-ink); color: var(--surface); }
.situation-voice__icon svg { width: 14px; height: 14px; }
.situation-voice__wave { display: flex; flex: 1; align-items: center; gap: 2px; min-width: 110px; height: 22px; }
.situation-voice__wave span { flex: 1; max-width: 3px; min-height: 3px; border-radius: 2px; background: currentColor; opacity: .28; transition: opacity .1s; }
.situation-voice__wave span.is-played { opacity: .9; }
.situation-voice__time { flex: none; color: var(--ink-soft); font: 800 11px/1 "Manrope", system-ui, sans-serif; font-variant-numeric: tabular-nums; }
/* «Послушать диалог» as a player (Ivan, 2026-11-02): the dialogue's wave, a stretch per line, and ⏮ ◀ ▶ ▶ ⏭. */
.situation-player { display: grid; gap: 4px; padding: 10px 12px 4px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.situation-player__wave { display: flex; align-items: center; gap: 4px; height: 34px; cursor: pointer; }
.situation-player__line { display: flex; flex: 2 1 0; align-items: center; justify-content: space-between; gap: 1px; min-width: 0; height: 100%; padding: 0 2px; border-radius: 6px; transition: background-color .15s; }
.situation-player__line span { flex: 1; min-width: 1px; max-width: 3px; min-height: 3px; border-radius: 2px; background: var(--ink); opacity: .22; transition: opacity .1s; }
.situation-player__line span.is-played { background: var(--green-ink); opacity: .9; }
.situation-player__line.is-current { background: rgba(47, 138, 90, .1); background: color-mix(in srgb, var(--green) 12%, transparent); }
.situation-player[hidden] { display: none; }
.situation-player__times { display: flex; align-items: center; justify-content: space-between; padding: 0 2px; color: var(--ink-soft); font: 800 11px/1 "Manrope", system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.situation-player__controls { display: flex; align-items: center; justify-content: center; gap: 10px; }
.situation-player__button { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--ink); cursor: pointer; }
.situation-player__button svg { width: 22px; height: 22px; }
.situation-player__button.is-main { width: 50px; height: 50px; background: var(--green-ink); color: var(--surface); }
/* A line's menu opens on a long press: no text selection or callout under the finger. */
.situation-chat .situation-line__body { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
/* The speaker's name, for screen readers only: the bubble's side and colour say who speaks. */
.situation-live__who { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* The learner's tones, a card inside their bubble: the score, the characters as one segmented row, a character's review under it. */
.situation-live__toneResult { display: grid; gap: 6px; margin-top: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.situation-live__toneHead { display: flex; align-items: center; }
.situation-live__toneChars { display: flex; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; }
.situation-live__toneChar { display: grid; flex: 1; justify-items: center; min-width: 30px; padding: 3px 4px; border: 0; border-right: 1px solid var(--line); border-radius: 0; background: none; color: inherit; cursor: pointer; }
.situation-live__toneChar:last-child { border-right: 0; }
.situation-live__toneChar small { font-size: 10px; font-weight: 700; }
.situation-live__toneChar b { font: 600 17px/1.2 "Noto Serif SC", serif; }
.situation-live__toneChar.is-right { background: var(--tint-green); color: var(--green-ink); }
.situation-live__toneChar.is-wrong { background: var(--tint-red); color: var(--red-dark); }
.situation-live__toneChar.is-picked { box-shadow: inset 0 0 0 2px currentColor; }
.situation-live__toneDetails { display: grid; }
.situation-live__toneDetails[hidden] { display: none; }
.situation-live__toneDetails > .situation-live__toneDetail { grid-area: 1 / 1; visibility: hidden; }
.situation-live__toneDetails > .situation-live__toneDetail.is-on { visibility: visible; }
.situation-line.has-tones { width: 92%; }
.situation-line.has-tones .situation-line__column, .situation-line.has-tones .situation-line__body { width: 100%; }
.situation-live__toneDetail { display: grid; gap: 2px; margin: 0; color: var(--ink-soft); font: 600 13px/1.4 "Manrope", system-ui, sans-serif; }
.situation-live__toneDetail b { color: var(--ink); font-weight: 800; }
/* «Перевод»: every line's meaning under it; then the hint doesn't repeat the reply's. */
.situation-live__meaning { display: none; }
.situation-live__chat.show-meaning .situation-live__meaning { display: block; }
.situation-live__chat.show-meaning .situation-live__helpMeaning { display: none; }
/* Every tone right and a high score: a green tick beside the score, the score green (Ivan, 2026-10-26). */
.situation-live__great { flex: none; margin-right: 5px; vertical-align: -3px; color: var(--green); }
.situation-live__toneResult.is-great .situation-live__label { color: var(--green-ink); }
.situation-live { display: flex; flex-direction: column; gap: 14px; }
.situation-live.is-talking .situation-live__head, .situation-live.is-talking .situation-live__setup, .situation-live.is-talking .situation-hint { display: none; }
/* While talking the screen's top bar is the character's (design 3, Ivan 2026-10-29): no progress track, the
   switches behind «Аа», the goal pinned under the name (or a card in the chat, web/situations.js paintGoal). */
.situation-live.is-talking .situation-tools { display: none; }
.situation-screen.is-talking .session-progress { display: none; }
.situation-screen.is-talking .topbar { gap: 10px; align-items: flex-start; }
/* «Back» level with the portrait, not with the goal under it. */
.situation-screen.is-talking .topbar .back-button { margin-top: 6px; }
.talk-head { position: relative; flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.talk-head__portrait { flex: none; width: 56px; height: 56px; border: 2px solid var(--amber); border-radius: 50%; background: #fbf7ee; object-fit: cover; }
.talk-head__copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
/* The name wraps between words and shrinks to fit (fitName) rather than being cut. */
.talk-head__name { min-width: 0; font-size: 18px; line-height: 1.15; color: var(--ink); overflow-wrap: normal; }
.talk-head__name.is-squeezed { overflow-wrap: anywhere; hyphens: auto; }
.talk-head__sub { font-size: 13px; line-height: 1.3; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.talk-head__goal { flex: 1 0 100%; display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border-radius: 999px; background: var(--tint-amber); color: var(--amber-ink); font: 600 12.5px/1.3 "Manrope", system-ui, sans-serif; min-width: 0; }
.talk-head__goal[hidden] { display: none; }
.talk-head__goalDot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.talk-head__goalText { flex: 1; min-width: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.talk-head__unpin { flex: none; width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent; color: var(--amber-ink); font-size: 17px; line-height: 1; cursor: pointer; }
.talk-head__view { flex: none; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; background: #fbf7ee; color: var(--ink); font: 800 15px/1 "Manrope", system-ui, sans-serif; cursor: pointer; }
.talk-head__view[aria-expanded="true"] { background: var(--ink); color: #fdf8ee; }
:root[data-theme="dark"] .talk-head__view { background: var(--surface); color: var(--ink); }
:root[data-theme="dark"] .talk-head__view[aria-expanded="true"] { background: var(--ink); color: var(--on-ink); }
.talk-head__menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 5; display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: 0 12px 30px rgba(23, 59, 54, .16); }
.talk-head__menu[hidden] { display: none; }
/* How fast the voices speak (web/speech-speed.js): the turtle, «1×», the lightning. */
.speed-switch { display: inline-grid; grid-auto-flow: column; grid-auto-columns: minmax(36px, 1fr); gap: 2px; padding: 3px; border-radius: 999px; background: var(--muted); }
.speed-switch button { display: grid; place-items: center; min-height: 28px; padding: 0 8px; border: 0; border-radius: 999px; background: none; color: var(--ink-soft); font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; }
.speed-switch button svg { width: 17px; height: 17px; }
.speed-switch button.is-selected { background: var(--white); color: var(--ink); box-shadow: 0 1px 3px rgba(23, 59, 54, .16); }
:root[data-theme="dark"] .speed-switch button.is-selected { background: var(--surface); }
#speechSpeedOptions { display: contents; }
.settings-seg.speed-switch { display: grid; border-radius: 12px; }
.settings-seg.speed-switch button { min-height: 32px; border-radius: 9px; }
.situation-tools__row { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; }
.situation-tools__dock--speed { padding-block: 3px; }
.talk-head__speed { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 2px 0 12px; color: var(--ink-soft); font-size: 13px; font-weight: 700; }
.talk-head__report { display: flex; justify-content: flex-start; gap: 8px; width: auto; height: 40px; padding: 0 12px; border: 0; border-radius: 12px; font: inherit; font-size: 14px; font-weight: 600; color: var(--red-dark); opacity: 1; }
/* Characters off: the character's lines are their recording only (the hint's line to say keeps its characters). */
.situation-live__chat.hide-hanzi .situation-line:not(.is-mine) .situation-line__body > .situation-line__zh { display: none; }
/* …and with nothing under it, the bubble is the voice strip alone. */
.situation-live__chat.hide-hanzi:not(.show-meaning) .situation-line:not(.is-mine) .situation-line__body.has-voice:not(:has(> :not(.situation-voice, .situation-line__zh, .situation-live__meaning))) { padding-bottom: 0; }
.situation-live__chat.hide-hanzi:not(.show-meaning) .situation-line:not(.is-mine) .situation-line__body.has-voice:not(:has(> :not(.situation-voice, .situation-line__zh, .situation-live__meaning))) > .situation-voice { margin-bottom: 0; border-bottom: 0; }
.situation-live__mission { position: relative; }
.situation-live__mission:has(.situation-live__pin) { padding-right: 46px; }
.situation-live__pin { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .55); color: var(--amber-ink); cursor: pointer; }
.situation-live__pin svg { width: 17px; height: 17px; }
@media (max-width: 400px) {
  .talk-head { gap: 9px; }
  .talk-head__portrait { width: 46px; height: 46px; }
}
/* The smallest phones keep the name, the goal and «Аа»; the portrait goes. */
@media (max-width: 340px) {
  .talk-head__portrait { display: none; }
}
.situation-live__chat .situation-line.is-mine { max-width: 86%; }
.situation-live__bottom { gap: 4px; }
.situation-live__buttons { display: grid; gap: 8px; }
.situation-live__buttons .link-button { justify-self: center; }
.situation-live__orb { display: flex; align-items: center; justify-content: center; gap: 8px; height: 76px; }
/* The equaliser only while a conversation is on (Ivan, 2026-10-26: not before it starts, nor after it ends). */
.situation-live__orb:not(.is-live) { display: none; }
.situation-live__orb span { width: 14px; height: 14px; border-radius: 999px; opacity: .35; transition: height .08s linear, opacity .3s ease; }
.situation-live__orb span:nth-child(1) { background: var(--ink); }
.situation-live__orb span:nth-child(2) { background: #c5953d; }
.situation-live__orb span:nth-child(3) { background: var(--red); }
.situation-live__orb span:nth-child(4) { background: #4f8a5b; }
.situation-live__orb span:nth-child(5) { background: #6f93b5; }
.situation-live__orb.is-on span { opacity: 1; }
/* Turn by turn: one round mic (Say it's), its line, and two quiet links; no bars. */
.situation-live__bottom.is-turns .situation-live__orb, .situation-live__bottom.is-turns .situation-live__status { display: none; }
.situation-live__bottom.is-turns .situation-live__buttons { justify-items: center; gap: 2px; }
/* Room for the ring at rest; when the voice is loud it reaches over the lines' faded edge and the label (Ivan, 2026-10-30: «make the bottom section more compact… spacing could be reduced»). */
.situation-live__mic { margin: 10px 0 8px; }
.situation-live__mic:disabled { cursor: default; }
.situation-live__mic .say__ring { display: block; }
.situation-live__mic:not(.is-heard):not([data-mode="recording"]) .say__ring path { fill: rgba(223, 85, 63, .12); stroke: rgba(223, 85, 63, .3); }
/* The character speaking: the button and its ring (moving with the voice) in grey (Ivan, 2026-10-27; was blue). */
.situation-live__mic[data-mode="speaking"]::before { background: #8a8f8c; box-shadow: 0 6px 18px rgba(60, 66, 63, .22); }
.situation-live__mic[data-mode="speaking"] .say__ring path, .situation-live__mic[data-mode="speaking"]:not(.is-heard) .say__ring path { fill: rgba(110, 116, 113, .14); stroke: rgba(110, 116, 113, .45); }
/* While the character speaks, three dots instead of the mic, rising with its voice (Ivan, 2026-10-28: «иконку микрофона менять на 3 точки (с эквалайзером тоже)»); while the learner's line is listened to they hop as in Say it. */
.situation-live__mic[data-mode="speaking"] .say__micIcon { display: none; }
.situation-live__mic[data-mode="speaking"] .say__dots { display: flex; }
.situation-live__mic[data-mode="speaking"] .say__dots i { height: calc(9px + var(--level, 0) * 18px); border-radius: 5px; opacity: 1; animation: none; transition: height .08s linear; }
.situation-live__mic[data-mode="speaking"] .say__dots i:nth-child(2) { height: calc(9px + var(--level, 0) * 26px); }
.situation-live__micLabel { min-height: 20px; margin: 0; color: var(--ink-soft); font-size: 13px; font-weight: 800; text-align: center; }
.situation-live__micLabel.is-ending { color: var(--red-dark); font-variant-numeric: tabular-nums; }
/* A line said in another language: as said, in the page's letters. */
.situation-line__zh.situation-live__foreign { font: 600 17px/1.4 "Manrope", system-ui, sans-serif; }
/* Turn by turn: «Закончить», the mic, «Подсказка» in one row. */
.situation-live__trio { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; width: 100%; max-width: 360px; }
.situation-live__side { justify-self: center; display: grid; justify-items: center; gap: 6px; min-width: 76px; padding: 4px; border: 0; background: none; color: var(--ink-soft); font-size: 12px; font-weight: 800; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.situation-live__sideIcon { display: grid; place-items: center; width: 52px; height: 52px; border: 1.5px solid var(--line); border-radius: 50%; background: var(--white); box-shadow: 0 4px 12px rgba(23, 59, 54, .06); transition: transform .15s ease; }
.situation-live__sideIcon svg { width: 20px; height: 20px; }
.situation-live__side.is-end .situation-live__sideIcon { border-color: rgba(223, 85, 63, .3); background: #fdf8f7; color: var(--red-dark); }
.situation-live__side.is-hint .situation-live__sideIcon { border-color: rgba(217, 148, 51, .45); background: #fdfaf3; color: #b27318; box-shadow: 0 4px 14px rgba(217, 148, 51, .14); }
.situation-live__side.is-hint svg { width: 22px; height: 22px; }
.situation-live__side:active .situation-live__sideIcon { transform: scale(.94); }
.situation-live__side.is-off { visibility: hidden; }
/* Dark theme: the two side buttons keep their red and amber, on the dark paper (Ivan, 2026-10-30: «В темной теме кнопки выглядят плохо читаемыми»). */
:root[data-theme="dark"] .situation-live__side { color: var(--ink); }
:root[data-theme="dark"] .situation-live__side.is-end .situation-live__sideIcon { border-color: rgba(235, 161, 131, .45); background: var(--tint-red); color: var(--red-dark); box-shadow: none; }
:root[data-theme="dark"] .situation-live__side.is-hint .situation-live__sideIcon { border-color: rgba(232, 185, 74, .5); background: var(--tint-amber); color: var(--amber); box-shadow: none; }
.situation-live__links { display: flex; justify-content: space-between; width: 100%; max-width: 360px; margin-top: 6px; }
.situation-live__link { min-height: 36px; padding: 0 6px; border: 0; background: none; color: var(--ink-soft); font-size: 13px; font-weight: 700; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; cursor: pointer; }
.situation-live__link.is-off { visibility: hidden; }
.situation-live__quiet { color: var(--ink-soft); font-weight: 600; font-size: 12px; }
.situation-live__help { display: grid; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.situation-live__help p { margin: 0; }
.situation-live__note { color: var(--red-dark); font: 700 13px/1.4 "Manrope", system-ui, sans-serif; }
/* A learner's line nobody could make out. */
.situation-live__unclear { color: var(--ink-soft); font: italic 600 16px/1.4 "Manrope", system-ui, sans-serif; }
/* Under a learner's line recorded too dull, quiet or loud: what to do about the microphone. */
.situation-live__mic-note { display: flex; gap: 10px; align-items: center; margin-top: 8px; padding: 8px 8px 8px 12px; border-radius: 12px; background: var(--tint-amber); color: var(--amber-ink); }
.situation-live__mic-note p { flex: 1; margin: 0; font: 600 13px/1.4 "Manrope", system-ui, sans-serif; }
.situation-live__mic-note strong { font-weight: 800; }
.situation-live__mic-ok { flex: none; min-height: 32px; padding: 0 12px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .7); color: var(--amber-ink); font: 700 13px/1 "Manrope", system-ui, sans-serif; cursor: pointer; }
:root[data-theme="dark"] .situation-live__mic-ok { background: rgba(0, 0, 0, .22); }
/* When a conversation is over: whether the learner did what the situation asked. */
.situation-live__goal { display: flex; gap: 12px; align-items: flex-start; margin: 4px 0; padding: 12px 14px; border-radius: 16px; background: var(--tint-green); color: var(--green-ink); }
.situation-live__goal.is-missed { background: var(--tint-red); color: var(--red-dark); }
.situation-live__goalMark { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--green); color: var(--on-ink); font: 800 15px/1 "Manrope", system-ui, sans-serif; }
.situation-live__goal.is-missed .situation-live__goalMark { background: var(--red); }
.situation-live__goal.is-partial { background: var(--tint-amber); color: var(--amber-ink); }
.situation-live__goal.is-partial .situation-live__goalMark { border-radius: 0; background: none; }
.situation-live__goalMark svg { display: block; }
.situation-live__goalText { margin: 2px 0 0; font: 600 15px/1.45 "Manrope", system-ui, sans-serif; }
/* The end check: a waiting line while it runs, then «Разбор фраз» (web/situations.js fixesBox). Theme colours only, so dark reads too. */
.situation-live__reviewWait { display: flex; gap: 12px; align-items: center; margin: 4px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink-soft); font: 600 15px/1.4 "Manrope", system-ui, sans-serif; }
.situation-live__dots, .situation-live__dots::before, .situation-live__dots::after { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: situation-dots 1.1s ease-in-out infinite; }
.situation-live__dots { position: relative; flex: none; margin: 0 12px; animation-delay: .18s; }
.situation-live__dots::before, .situation-live__dots::after { content: ""; position: absolute; top: 0; }
.situation-live__dots::before { left: -11px; animation-delay: 0s; }
.situation-live__dots::after { left: 11px; animation-delay: .36s; }
@keyframes situation-dots { 0%, 80%, 100% { opacity: .2; } 40% { opacity: .9; } }
@media (prefers-reduced-motion: reduce) { .situation-live__dots, .situation-live__dots::before, .situation-live__dots::after { animation: none; opacity: .6; } }
.situation-live__fixes { margin: 4px 0; padding: 12px 14px 4px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.situation-live__fixesTitle { margin: 0; color: var(--ink-soft); font: 800 12px/1.3 "Manrope", system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.situation-live__fix { padding: 10px 0; border-top: 1px solid var(--line); }
.situation-live__fixesTitle + .situation-live__fix { border-top: 0; }
.situation-live__fixSaid { margin: 0; color: var(--ink-soft); font-size: 17px; }
.situation-live__fixSaid del { color: var(--red); text-decoration-thickness: 2px; }
.situation-live__fixFixed { margin: 2px 0 0; color: var(--ink); font-size: 19px; }
.situation-live__fixFixed ins { border-radius: 4px; padding: 0 1px; background: var(--tint-green); color: var(--green-ink); text-decoration: none; }
.situation-live__fixWhy { margin: 4px 0 0; color: var(--ink); font: 500 14px/1.45 "Manrope", system-ui, sans-serif; }
/* A free talk's secret mission, on top of the conversation (Ivan, 2026-10-29). */
.situation-live__mission { margin: 4px 0 8px; padding: 10px 14px 12px; border: 1.5px dashed var(--amber); border-radius: 16px; background: var(--tint-amber); color: var(--amber-ink); }
.situation-live__missionLabel { display: block; font: 800 11px/1.2 "Manrope", system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.situation-live__missionText { margin: 4px 0 0; font: 600 15px/1.45 "Manrope", system-ui, sans-serif; }
.situation-live__suggest { display: grid; gap: 2px; }
.situation-live__suggest .situation-line__zh { font-size: 20px; }
.situation-live__status { min-height: 20px; margin: 0; color: var(--ink-soft); font-size: 13px; font-weight: 800; text-align: center; }
.situation-phrases { display: grid; gap: 8px; }
.situation-phrase { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; }
.situation-phrase__play { display: grid; flex: none; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: var(--tint-green); color: var(--green-ink); font-size: 12px; }
.situation-phrase__words { display: grid; gap: 2px; }
.situation-phrase__words b { font: 600 20px/1.35 "Noto Serif SC", serif; }
.situation-phrase__pinyin { color: var(--ink-soft); font-size: 13px; }
.situation-phrase__words small { font-size: 13px; }
.situation-turn { display: grid; gap: 10px; }
.situation-turn:empty { display: none; }
.situation-cue { display: grid; gap: 2px; margin: 4px 0 0; padding: 10px 14px; border-radius: 14px; background: var(--tint-green); }
.situation-cue span { color: var(--green-ink); font-size: 12px; font-weight: 800; }
.situation-cue b { font-size: 15px; line-height: 1.35; }
.situation-options { display: grid; gap: 8px; }
.situation-option { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; }
.situation-option b { font: 600 20px/1.35 "Noto Serif SC", serif; }
.situation-option__pinyin { color: var(--ink-soft); font-size: 12px; }
.situation-option:disabled { opacity: .55; cursor: default; }
.situation-why { display: grid; gap: 2px; margin: 0; color: var(--red-dark); font-size: 13px; font-weight: 700; line-height: 1.45; }
.situation-why__meaning { color: var(--ink-soft); font-weight: 600; }
.situation-answer { display: flex; min-height: 64px; flex-wrap: wrap; align-content: flex-start; gap: 6px; padding: 8px; border: 1.5px dashed var(--line); border-radius: 16px; }
.situation-bank { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.situation-bank button, .situation-answer button { display: grid; justify-items: center; gap: 1px; min-width: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); color: var(--ink); cursor: pointer; }
.situation-bank button b, .situation-answer button b { font: 600 20px/1.3 "Noto Serif SC", serif; }
.situation-turn__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
/* The two side by side, one size: the secondary button drops its own top margin and smaller height. */
.situation-turn__actions > .menu-primary, .situation-turn__actions > .menu-secondary { min-height: 48px; margin: 0; border-radius: 15px; font-size: 14px; }
.situation-stage .situation-stats { grid-template-columns: repeat(2, 1fr); width: 100%; max-width: 260px; margin: 0 auto; text-align: center; }
.situation-screen .is-wrong { border-color: var(--red); background: var(--tint-red); animation: game-shake .4s; }
@media (prefers-reduced-motion: reduce) { .situation-screen .is-wrong { animation: none; } }
.game-clock { min-width: 44px; color: var(--ink); font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.game-play { display: flex; flex: 1 1 auto; flex-direction: column; justify-content: center; min-height: 0; padding: 14px 2px 40px; }
.game-hint { margin: 0 0 14px; color: var(--ink-soft); font-size: 13px; font-weight: 700; text-align: center; }
.game-stage { width: 100%; max-width: 460px; margin: 0 auto; }
.game-status { min-height: 18px; margin: 14px 0 0; color: var(--red-dark); font-size: 13px; font-weight: 800; text-align: center; }
.game-done, .game-gate { display: flex; flex: 1 1 auto; flex-direction: column; align-items: center; gap: 10px; min-height: 0; overflow-y: auto; padding: 22px 4px 8px; text-align: center; }
.game-gate p { max-width: 380px; margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.5; }
.game-done__seal { display: grid; width: 64px; height: 64px; place-items: center; border-radius: 20px; background: var(--tint-green); color: var(--green-ink); font: 600 36px "Noto Serif SC", serif; }
.game-done h1, .game-gate h1 { margin: 4px 0 0; font-size: 24px; }
.game-done__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; max-width: 380px; }
.game-done__stats div { display: grid; gap: 2px; padding: 12px 6px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.game-done__stats b { font-size: 24px; font-variant-numeric: tabular-nums; }
.game-done__stats span { color: var(--ink-soft); font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.game-missed { display: grid; gap: 6px; width: 100%; max-width: 380px; margin: 4px 0 0; padding: 0; list-style: none; }
.game-missed li { display: grid; grid-template-columns: auto auto 1fr; align-items: baseline; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-align: left; }
.game-missed b { font: 600 22px "Noto Serif SC", serif; }
.game-missed span { font-weight: 700; }
.game-missed small { overflow: hidden; color: var(--ink-soft); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.game-done__actions { display: grid; gap: 6px; width: 100%; max-width: 380px; margin-top: auto; padding-top: 12px; }
@keyframes game-shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.games-screen .is-wrong { animation: game-shake .4s; }
@media (prefers-reduced-motion: reduce) { .games-screen .is-wrong { animation: none; } }

/* Pairs: characters left, pinyin right. */
.pairs-board { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pairs-col { display: grid; gap: 10px; align-content: start; }
.pairs-tile, .sudoku-chip, .build-tile { min-height: 62px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); font-weight: 700; cursor: pointer; transition: transform .12s ease, opacity .3s ease, background .2s ease, border-color .2s ease; touch-action: manipulation; }
.pairs-tile--zh { font-family: "Noto Serif SC", serif; font-size: 30px; }
.pairs-tile--zh.is-long { font-size: 22px; }
.pairs-tile--py { font-size: 20px; letter-spacing: .02em; }
.pairs-tile:not(:disabled):active, .sudoku-chip:active, .build-tile:not(:disabled):active { transform: scale(.97); }
.games-screen .is-picked { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink), 0 6px 14px rgba(23, 59, 54, .12); }
.pairs-tile.is-picked { transform: translateY(-2px); }
.games-screen .is-wrong { border-color: var(--red); background: var(--tint-red); color: var(--red-dark); }
.pairs-tile.is-joined, .build-tile.is-joined { border-color: var(--green); background: var(--tint-green); color: var(--green-ink); opacity: .45; cursor: default; }

/* Sudoku: the characters in the grid, their pinyin on the chips below. */
.sudoku-grid { display: grid; grid-template-columns: repeat(var(--size), 1fr); width: min(100%, 380px); margin: 0 auto; overflow: hidden; border: 2px solid var(--ink); border-radius: 14px; background: var(--surface); }
.sudoku-cell { aspect-ratio: 1; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); font: 600 30px "Noto Serif SC", serif; cursor: pointer; }
.sudoku-grid--6 .sudoku-cell { font-size: 22px; }
.sudoku-cell:nth-child(4n) { border-right: 0; }
.sudoku-grid--6 .sudoku-cell:nth-child(4n) { border-right: 1px solid var(--line); }
.sudoku-grid--6 .sudoku-cell:nth-child(6n) { border-right: 0; }
.sudoku-cell.is-box-right { border-right: 2px solid var(--ink); }
.sudoku-cell.is-box-bottom { border-bottom: 2px solid var(--ink); }
.sudoku-cell.is-given { background: var(--paper-deep); cursor: default; }
.sudoku-cell.is-filled { color: var(--green-ink); }
.sudoku-cell.is-picked { box-shadow: inset 0 0 0 3px var(--red); }
.sudoku-palette { display: grid; grid-template-columns: repeat(var(--chips, 3), 1fr); gap: 8px; margin-top: 16px; }
.sudoku-chip { min-height: 52px; font-size: 18px; }

/* Word search: the grid, and the words to find by pinyin and meaning. */
.search-grid { display: grid; grid-template-columns: repeat(var(--size), 1fr); gap: 4px; width: min(100%, 400px); margin: 0 auto; touch-action: none; user-select: none; }
.search-cell { aspect-ratio: 1; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: 600 22px "Noto Serif SC", serif; cursor: pointer; }
.search-cell.is-found { border-color: transparent; }
.search-cell.is-found-1 { background: var(--tint-green); color: var(--green-ink); }
.search-cell.is-found-2 { background: rgba(80, 120, 200, .2); }
.search-cell.is-found-3 { background: rgba(214, 160, 40, .22); }
.search-cell.is-found-0 { background: rgba(150, 90, 180, .2); }
.search-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 14px 0 0; padding: 0; list-style: none; }
.search-list li { display: grid; gap: 1px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.search-list b { font-size: 15px; }
.search-list small { overflow: hidden; color: var(--ink-soft); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.search-list li.is-found { opacity: .45; text-decoration: line-through; }

/* Build a character: its sound and meaning, the slots for its parts, the tiles. */
.build-prompt { display: grid; gap: 4px; text-align: center; }
.build-prompt b { font-size: 28px; }
.build-prompt span { color: var(--ink-soft); font-size: 14px; }
.build-slots { display: flex; justify-content: center; gap: 8px; min-height: 150px; margin: 18px 0; align-items: center; }
.build-slots--stack { flex-direction: column; gap: 6px; }
.build-slot { display: grid; width: 76px; height: 68px; place-items: center; border: 2px dashed var(--line); border-radius: 16px; color: var(--ink); font: 600 40px "Noto Serif SC", serif; }
.build-slots--stack .build-slot { width: 96px; height: 64px; }
.build-slot.is-filled { border-style: solid; border-color: var(--green); background: var(--tint-green); color: var(--green-ink); }
.build-result { color: var(--ink); font: 600 110px/1 "Noto Serif SC", serif; animation: build-pop .5s cubic-bezier(.3, 1.6, .5, 1); }
/* A character from a longer word: the word with a gap for it, then the word with it in place. */
.build-prompt .build-word { margin-bottom: 4px; color: var(--ink); font: 600 40px/1.1 "Noto Serif SC", serif; }
.build-prompt .build-gap { display: inline-block; font-size: inherit; width: .9em; height: .9em; margin: 0 .05em; vertical-align: -.1em; border: 2px dashed var(--green); border-radius: 10px; background: var(--tint-green); }
.build-result--word { color: var(--ink-soft); font-size: 76px; }
.build-result--word .is-built { color: var(--green-ink); }
@keyframes build-pop { from { opacity: 0; transform: scale(.6); } }
.build-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.build-tile { font: 600 32px "Noto Serif SC", serif; }

/* Tone run: the word falls through the sky; say it before it lands. */
.run-sky { position: relative; height: min(calc(52vh / var(--ui-zoom, 1)), 420px); overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: linear-gradient(var(--surface), var(--paper)); }
.run-word { --fall: 0; position: absolute; top: calc(var(--fall) * (100% - 104px)); left: 50%; display: grid; min-width: 110px; justify-items: center; padding: 10px 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--white); box-shadow: 0 8px 18px rgba(23, 59, 54, .12); transform: translateX(-50%); }
.run-word b { font: 600 46px/1.1 "Noto Serif SC", serif; }
.run-word span { font-size: 18px; font-weight: 800; }
.run-word.is-said { border-color: var(--green); background: var(--tint-green); color: var(--green-ink); transition: opacity .4s ease; opacity: .6; }
.run-word.is-landed { border-color: var(--red); background: var(--tint-red); color: var(--red-dark); }
.run-ground { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding: 0 6px; }
.run-lives span { margin-right: 4px; color: var(--line); font-size: 22px; }
.run-lives span.is-on { color: var(--red); }
.run-points { font-size: 26px; font-variant-numeric: tabular-nums; }
.run-mic { min-height: 20px; margin: 10px 0 0; color: var(--ink-soft); font-size: 14px; font-weight: 800; text-align: center; }
.run-mic[data-tone="miss"] { color: var(--red-dark); }
.run-mic[data-tone="right"] { color: var(--green-ink); }

/* Practice settings on warm paper: the card a step darker than the page, its choices lighter, each skill in its own colour. */
:root {
  --config-card: linear-gradient(165deg, rgba(250,245,234,.92), rgba(236,226,207,.82));
  --config-choice: var(--white);
  --skill-words: #2f8a5a; --skill-words-bg: #e2f3e7;
  --skill-listen: #a8650f; --skill-listen-bg: #fbeed3;
  --skill-read: #2f6659; --skill-read-bg: #dcece8;
  --skill-write: #be3e2d; --skill-write-bg: #fbe4dd;
}
:root[data-theme="dark"] {
  --config-card: linear-gradient(165deg, rgba(41,62,49,.92), rgba(33,52,41,.92));
  --config-choice: var(--paper);
  --skill-words: #9fd6ae; --skill-words-bg: rgba(126,196,146,.18);
  --skill-listen: #f0c47a; --skill-listen-bg: rgba(240,196,122,.16);
  --skill-read: #9cd0c4; --skill-read-bg: rgba(156,208,196,.16);
  --skill-write: #eba183; --skill-write-bg: rgba(227,138,104,.18);
}
.config-card { background: var(--config-card); }
.config-card .skill-grid button,
.config-card .chip-row button,
.config-card .source-control button,
.config-card .deck-size button,
:root .config-card .segmented button { background: var(--config-choice); color: var(--ink); }
.config-card .skill-grid button.is-selected,
.config-card .source-control button.is-selected,
:root .config-card .segmented button.is-selected { background: var(--tint-red); }
.config-card .chip-row button.is-selected,
.config-card .deck-size button.is-selected { background: var(--ink); color: var(--on-ink); }
.skill-grid button strong { display: grid; width: 42px; height: 42px; flex: none; place-items: center; border-radius: 13px; background: var(--skill-bg); color: var(--skill-ink); font-size: 24px; }
.skill-grid [data-skill="words"] { --skill-ink: var(--skill-words); --skill-bg: var(--skill-words-bg); }
.skill-grid [data-skill="listen"] { --skill-ink: var(--skill-listen); --skill-bg: var(--skill-listen-bg); }
.skill-grid [data-skill="read"] { --skill-ink: var(--skill-read); --skill-bg: var(--skill-read-bg); }
.skill-grid [data-skill="write"] { --skill-ink: var(--skill-write); --skill-bg: var(--skill-write-bg); }
/* The fifth tile, Tones, takes the whole row under the four skills. */
.skill-grid [data-skill="tones"] { grid-column: 1 / -1; --skill-ink: var(--skill-listen); --skill-bg: var(--skill-listen-bg); }
.config-card .test-card { background: var(--config-choice); }
.config-card .test-card .mock-card__start { background: var(--surface); }
.tone-how .segmented strong { color: var(--skill-listen); }
.pinyin-how .segmented strong { color: var(--skill-read); }
/* Practice's title bar sits on the page itself, and its footer on warm paper, not white glass. */
.play-screen .screen-header { background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.play-screen .screen-footer { background: rgba(239,231,216,.94); }
:root[data-theme="dark"] .play-screen .screen-header { background: none; }
/* No heading above Practice's tabs: they name the screen's parts themselves. */
.practice-scroll > .screen-intro { padding-top: 4px; }
.practice-scroll > .screen-intro .practice-tabs { margin-top: 0; }

/* Invite a friend (profile, Russian deployment): the card, the friends who counted, and the "+7 days" sheet. */
/* Invite a friend: a warm jade card of its own (the Pro banner's quieter sibling) with Bao and Lulu together, and the
   friends below as a small study circle. Bao and Lulu on the card; a 友 seal in the "+3 days" window. */
.invite-card, .invite-from, .invite-row, #inviteDone {
  --friend-bg: linear-gradient(160deg, #fdf3df 0%, #f3ead2 46%, #dcebd9 100%);
  --friend-glow: rgba(255, 196, 120, .5);
  --friend-glow-2: rgba(120, 180, 140, .35);
  --friend-edge: rgba(23, 59, 54, .12);
  --friend-panel: rgba(255, 253, 247, .72);
  --friend-online: #1d8a5b;
  --friend-online-glow: rgba(29, 138, 91, .32);
  --friend-thread: #df553f;
}
:root[data-theme="dark"] .invite-card, :root[data-theme="dark"] .invite-from, :root[data-theme="dark"] .invite-row, :root[data-theme="dark"] #inviteDone {
  --friend-bg: linear-gradient(160deg, #2a4033 0%, #233a30 50%, #1d3330 100%);
  --friend-glow: rgba(240, 195, 90, .2);
  --friend-glow-2: rgba(126, 196, 146, .2);
  --friend-edge: rgba(229, 235, 217, .14);
  --friend-panel: rgba(12, 24, 19, .34);
  --friend-online: #7ec492;
  --friend-online-glow: rgba(126, 196, 146, .34);
  --friend-thread: #e38a68;
}
.invite-card { position: relative; isolation: isolate; overflow: hidden; margin: 0 0 20px; padding: 14px 16px 16px; border: 1px solid var(--friend-edge); border-radius: 22px; background: radial-gradient(90% 70% at 0% 0%, var(--friend-glow), transparent 60%), radial-gradient(80% 70% at 100% 100%, var(--friend-glow-2), transparent 62%), var(--friend-bg); box-shadow: 0 12px 26px rgba(23, 59, 54, .14), inset 0 1px 0 rgba(255, 255, 255, .5); }
:root[data-theme="dark"] .invite-card { box-shadow: 0 12px 26px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .08); }
.invite-card::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(circle at 12% 18%, var(--offer-gold) 0 2px, transparent 3px),
    radial-gradient(circle at 90% 14%, rgba(255, 255, 255, .8) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 94% 40%, var(--offer-gold) 0 1.6px, transparent 2.6px),
    radial-gradient(circle at 6% 44%, rgba(255, 255, 255, .6) 0 1.4px, transparent 2.4px); }
.invite-card[hidden] { display: none; }
.invite-card__title { margin: 0 0 8px; font-size: 18px; font-weight: 800; line-height: 1.2; text-align: center; }
/* The terms as a tear-off coupon: the friend's days on top, the inviter's two below. */
.invite-ticket { --ticket-accent: var(--red); --ticket-notch: #f6e7c8; overflow: hidden; margin: 4px 0 14px; border: 1px solid var(--friend-edge); border-radius: 16px; background: var(--friend-panel); box-shadow: 0 4px 12px rgba(23, 59, 54, .06); text-align: left; }
:root[data-theme="dark"] .invite-ticket { --ticket-accent: var(--friend-thread); --ticket-notch: #233a30; box-shadow: none; }
.invite-ticket__head { display: flex; align-items: center; gap: 9px; padding: 10px 13px 8px; background: linear-gradient(90deg, rgba(255, 207, 120, .32), rgba(223, 85, 63, .08)); }
.invite-ticket__seal { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--red); color: #fff4dc; font-family: "Noto Serif SC", serif; font-size: 17px; font-weight: 700; transform: rotate(-5deg); box-shadow: 0 3px 8px rgba(223, 85, 63, .25); }
.invite-ticket__text { flex: 1; min-width: 0; }
.invite-ticket__who { display: block; color: var(--ticket-accent); font-size: 10.5px; font-weight: 800; letter-spacing: .05em; line-height: 1.15; text-transform: uppercase; }
.invite-ticket__when { display: block; margin-top: 2px; color: var(--ink-soft); font-size: 12px; font-weight: 600; line-height: 1.25; }
.invite-ticket__head .invite-ticket__when { color: var(--ink); }
.invite-ticket__gain { flex: none; color: var(--ink); font-size: 19px; font-weight: 800; line-height: 1; white-space: nowrap; }
.invite-ticket__tag { display: inline-block; padding: 2px 6px; border-radius: 6px; background: var(--red); color: #fffdf7; font-size: 11px; font-weight: 800; letter-spacing: .03em; line-height: 1.15; text-transform: uppercase; vertical-align: 2px; }
.invite-ticket__perf { position: relative; height: 12px; margin: 0 8px; background: repeating-linear-gradient(90deg, var(--friend-edge) 0 5px, transparent 5px 9px) center / 100% 1.5px no-repeat; }
.invite-ticket__perf::before, .invite-ticket__perf::after { content: ""; position: absolute; top: 0; width: 12px; height: 12px; border: 1px solid var(--friend-edge); border-radius: 50%; background: var(--ticket-notch); }
.invite-ticket__perf::before { left: -15px; }
.invite-ticket__perf::after { right: -15px; }
.invite-ticket__body { display: grid; grid-template-columns: 1fr 1fr; padding: 3px 12px 11px; }
.invite-ticket__stub { min-width: 0; }
.invite-ticket__stub:first-child { padding-right: 10px; border-right: 1.5px dashed var(--friend-edge); }
.invite-ticket__stub:last-child { padding-left: 11px; }
.invite-ticket__val { display: block; margin-top: 2px; color: var(--ink); font-size: 18px; font-weight: 800; line-height: 1.12; white-space: nowrap; }
.invite-ticket__pro { color: var(--ticket-accent); }
.invite-card .menu-primary { box-shadow: 0 8px 18px rgba(190, 62, 45, .26); }
.invite-card .menu-secondary { margin-top: 8px; background: var(--friend-panel); border-color: var(--friend-edge); }
#inviteDone .menu-secondary { margin-top: 8px; }

/* In the profile only a row: the card itself opens in its own window. */
.invite-row { display: flex; width: 100%; align-items: center; gap: 12px; margin: 0 0 20px; padding: 8px 12px 8px 8px; border: 1px solid var(--friend-edge); border-radius: 18px; background: radial-gradient(90% 90% at 0% 0%, var(--friend-glow), transparent 60%), var(--friend-bg); color: var(--ink); text-align: left; cursor: pointer; }
.invite-row[hidden] { display: none; }
.invite-row__img { flex: none; width: 66px; height: auto; filter: drop-shadow(0 4px 4px rgba(41, 73, 59, .18)); }
.invite-row__title { flex: 1; min-width: 0; font-size: 15px; font-weight: 800; line-height: 1.25; }
.invite-row .invite-circle__stack:empty { display: none; }
.invite-row .card-chevron { color: var(--ink-soft); font-size: 20px; }
#inviteSheet .invite-card { margin: 0; padding: 18px 18px 20px; }
#inviteSheet .invite-card__title { margin: 0 0 8px; font-size: 22px; }
.invite-card__close { position: absolute; top: 10px; right: 10px; z-index: 2; width: 36px; height: 36px; font-size: 24px; }
.invite-friend { text-align: left; }

/* The circle: who is in it, then one row per friend. */
.invite-circle { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 16px 0 0; padding: 14px 0 0; border-top: 1px dashed var(--friend-edge); }
.invite-circle[hidden] { display: none; }
.invite-circle__label { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.invite-circle__stack { display: flex; }
.invite-circle__stack .invite-avatar { position: relative; width: 26px; height: 26px; font-size: 11px; margin-left: -8px; box-shadow: 0 0 0 2px var(--paper); }
.invite-circle__stack .invite-avatar:first-child { margin-left: 0; }
.invite-circle__stack .invite-avatar:nth-child(1) { z-index: 4; } .invite-circle__stack .invite-avatar:nth-child(2) { z-index: 3; } .invite-circle__stack .invite-avatar:nth-child(3) { z-index: 2; }
.invite-friends { display: grid; gap: 8px; margin: 10px 0 0; padding: 0; list-style: none; }
.invite-friends[hidden] { display: none; }
.invite-friend { display: grid; grid-template-columns: 42px 1fr; gap: 6px 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--friend-edge); border-radius: 16px; background: var(--friend-panel); }
.invite-friend.is-online { border-color: var(--friend-online-glow); box-shadow: 0 0 0 3px rgba(29, 138, 91, .06), 0 6px 16px var(--friend-online-glow); }
.invite-friend .invite-avatar { grid-row: 1; }
.invite-avatar { position: relative; width: 42px; height: 42px; font-size: 17px; font-weight: 800; color: #173b36; background: #b8d1bd; }
.invite-avatar[data-tint="1"] { background: #f4c9a8; }
.invite-avatar[data-tint="2"] { background: #f2dc9b; }
.invite-avatar[data-tint="3"] { background: #bcd5ea; }
:root[data-theme="dark"] .invite-avatar { color: #10201a; }
:root[data-theme] .invite-avatar.is-online, :root[data-theme] .invite-from__avatar.is-online, :root .invite-avatar.is-online, :root .invite-from__avatar.is-online { overflow: visible; box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--friend-online), 0 0 14px var(--friend-online-glow); }
.invite-avatar.is-online::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%; background: var(--friend-online); box-shadow: 0 0 0 2.5px var(--white); animation: invite-pulse 2.4s ease-in-out infinite; }
@keyframes invite-pulse { 50% { box-shadow: 0 0 0 2.5px var(--white), 0 0 0 6px var(--friend-online-glow); } }
.invite-friend__head { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.invite-friend__name { font-size: 15px; font-weight: 800; line-height: 1.2; }
.invite-friend__seen { margin: 0; color: var(--ink-soft); font-size: 12px; line-height: 1.25; }
.invite-friend__seen.is-online, .invite-from__seen.is-online { color: var(--friend-online); font-weight: 800; }
.invite-friend__doing { grid-column: 1 / -1; margin: 0; padding: 7px 11px; border-radius: 12px; background: rgba(var(--jade-rgb), .38); color: var(--ink); font-size: 13px; font-weight: 600; line-height: 1.3; }
.invite-friend__doing[hidden], .invite-from__doing[hidden] { display: none; }
:root[data-theme="dark"] .invite-friend__doing { background: rgba(126, 196, 146, .14); }

/* The invited friend sees who brought them. */
.invite-from { position: relative; overflow: hidden; display: flex; align-items: center; gap: 12px; margin: 0 0 14px; padding: 12px 8px 12px 14px; border: 1px solid var(--friend-edge); border-radius: 22px; background: radial-gradient(90% 90% at 0% 0%, var(--friend-glow), transparent 60%), var(--friend-bg); box-shadow: 0 10px 22px rgba(23, 59, 54, .12), inset 0 1px 0 rgba(255, 255, 255, .5); }
:root[data-theme="dark"] .invite-from { box-shadow: 0 10px 22px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .08); }
.invite-from[hidden] { display: none; }
.invite-from__avatar { flex: none; }
.invite-from__avatar.profile-avatar { width: 46px; height: 46px; font-size: 19px; font-weight: 800; color: #173b36; background: #b8d1bd; }
.invite-from__avatar[data-tint="1"] { background: #f4c9a8; }
.invite-from__avatar[data-tint="2"] { background: #f2dc9b; }
.invite-from__avatar[data-tint="3"] { background: #bcd5ea; }
:root[data-theme="dark"] .invite-from__avatar.profile-avatar { color: #10201a; }
.invite-from__copy { min-width: 0; flex: 1; }
.invite-from__title { margin: 0 0 2px; font-size: 15px; font-weight: 800; line-height: 1.2; }
.invite-from__seen { margin: 0; color: var(--ink-soft); font-size: 12px; line-height: 1.25; }
.invite-from__doing { margin: 4px 0 0; color: var(--ink); font-size: 13px; line-height: 1.3; }
.invite-from__seen.is-online::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: var(--friend-online); vertical-align: 1px; }

#inviteDone .overlay-card { position: relative; overflow: hidden; border: 1px solid var(--friend-edge); background: radial-gradient(90% 60% at 50% 0%, var(--friend-glow), transparent 70%), var(--friend-bg); }

.invite-card__art { position: relative; display: flex; align-items: flex-end; justify-content: center; height: 134px; margin: 2px 0 12px; }
.invite-card__art::before { content: ""; position: absolute; left: 50%; bottom: 0; width: 250px; height: 110px; margin-left: -125px; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 255, 255, .7), transparent); z-index: 0; }
:root[data-theme="dark"] .invite-card__art::before { background: radial-gradient(closest-side, rgba(255, 211, 107, .16), transparent); }
.invite-art { position: relative; z-index: 1; width: auto; height: 126px; filter: drop-shadow(0 8px 8px rgba(41, 73, 59, .2)); }
.invite-from__img { flex: none; width: 70px; height: auto; margin: -10px -2px -10px 0; filter: drop-shadow(0 6px 6px rgba(41, 73, 59, .2)); }

/* "+3 days" window: a red 友 seal with sparkles on the same warm card. */
#inviteDone .overlay-card { position: relative; overflow: hidden; border: 1px solid var(--friend-edge); background: radial-gradient(90% 60% at 50% 0%, var(--friend-glow), transparent 70%), var(--friend-bg); }
.invite-done__art { position: relative; display: grid; place-items: center; height: 108px; margin: 0 0 8px; }
.invite-done__art::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at 24% 28%, var(--offer-gold) 0 3px, transparent 4px), radial-gradient(circle at 78% 20%, #fff 0 2px, transparent 3px), radial-gradient(circle at 86% 66%, var(--offer-gold) 0 2.5px, transparent 3.5px), radial-gradient(circle at 16% 74%, #fff 0 2px, transparent 3px); }
.invite-seal { display: grid; place-items: center; flex: none; width: 88px; height: 88px; border-radius: 26px; background: radial-gradient(circle at 35% 30%, #f27a60, #cf3f2b 72%); color: #fff4dc; font-family: "Noto Serif SC", serif; font-size: 52px; font-weight: 700; transform: rotate(-6deg); box-shadow: 0 10px 24px rgba(160, 40, 25, .35), 0 0 0 8px rgba(255, 211, 107, .28), inset 0 0 0 4px rgba(255, 244, 220, .45); animation: invite-hop .9s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes invite-hop { from { translate: 0 22px; opacity: 0; } 60% { translate: 0 -8px; opacity: 1; } to { translate: 0 0; } }
.invite-done__kicker { margin: 0 0 2px; color: var(--red-dark); }
@media (prefers-reduced-motion: reduce) { .invite-seal, .invite-avatar.is-online::after { animation: none; } }

/* The card and the inviter's card share the peach, gold and jade gradient. */
.invite-card, .invite-from { background: radial-gradient(90% 70% at 100% 0%, rgba(255, 207, 120, .65), transparent 60%), radial-gradient(80% 70% at 0% 100%, rgba(150, 205, 170, .55), transparent 62%), linear-gradient(135deg, #fff1d6 0%, #fadcb8 42%, #d5e9d3 100%); }
.invite-card { box-shadow: 0 14px 30px rgba(120, 70, 30, .18), inset 0 1px 0 rgba(255, 255, 255, .6); }
:root[data-theme="dark"] .invite-card, :root[data-theme="dark"] .invite-from { background: radial-gradient(90% 70% at 100% 0%, rgba(240, 195, 90, .3), transparent 60%), radial-gradient(80% 70% at 0% 100%, rgba(126, 196, 146, .22), transparent 62%), linear-gradient(135deg, #2f4a39 0%, #264135 50%, #1f3530 100%); }
:root[data-theme="dark"] .invite-card { box-shadow: 0 14px 30px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .1); }
/* Gifts (docs/gifts.md): the invitation's warm card with a 礼 seal, three plans, then the buyer's gifts. */
.gift-row, #giftSheet { --friend-bg: linear-gradient(160deg, #fdf3df 0%, #f3ead2 46%, #dcebd9 100%); --friend-glow: rgba(255, 196, 120, .5); --friend-glow-2: rgba(120, 180, 140, .35); --friend-edge: rgba(23, 59, 54, .12); --friend-panel: rgba(255, 253, 247, .72); }
:root[data-theme="dark"] .gift-row, :root[data-theme="dark"] #giftSheet { --friend-bg: linear-gradient(160deg, #2a4033 0%, #233a30 50%, #1d3330 100%); --friend-glow: rgba(240, 195, 90, .2); --friend-glow-2: rgba(126, 196, 146, .2); --friend-edge: rgba(229, 235, 217, .14); --friend-panel: rgba(12, 24, 19, .34); }
.gift-row { padding: 10px 12px 10px 10px; }
.gift-row__seal { display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 14px; background: radial-gradient(circle at 35% 30%, #f27a60, #cf3f2b 72%); color: #fff4dc; font-family: "Noto Serif SC", serif; font-size: 26px; font-weight: 700; transform: rotate(-6deg); box-shadow: 0 6px 14px rgba(160, 40, 25, .3), inset 0 0 0 2px rgba(255, 244, 220, .45); }
#giftSheet .invite-card { margin: 0; padding: 18px 18px 20px; max-height: calc(100dvh / var(--ui-zoom, 1) - 32px); overflow-y: auto; }
#giftSheet .invite-card__title { font-size: 22px; }
#giftSheet .invite-done__art { height: 96px; margin: 0 0 4px; }
.gift-buy[hidden], .gift-ready[hidden], .gift-methods[hidden], .gift-only[hidden] { display: none; }
.gift-fine { margin: 10px 0 0; text-align: center; }
.gift-ready .promo-done__code { margin: 0 0 14px; text-align: center; }
.gift-ready .link-button { display: block; margin: 10px auto 0; }
.gift-mine__actions { display: flex; gap: 6px; }
.gift-mine__actions .menu-secondary { width: auto; min-height: 34px; margin: 0; padding: 0 12px; font-size: 13px; }
.gift-card__accent { color: var(--red); }
/* Plans: one row each (radio, Bao's picture, length over the price a month, price); the longest marked «Выгоднее». */
.gift-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 16px; padding: 4px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.gift-methods button { min-height: 44px; padding: 4px 10px; border: 0; border-radius: 12px; background: transparent; color: var(--ink-soft); font: inherit; font-size: 14px; font-weight: 800; line-height: 1.2; cursor: pointer; }
.gift-methods button.is-selected { background: var(--ink); color: var(--paper); }
.gift-only { margin: -8px 0 18px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--friend-panel); color: var(--ink-soft); font-size: 13px; font-weight: 700; text-align: center; }
.gift-plans { display: grid; gap: 8px; margin: 16px 0 18px; }
.gift-plan { position: relative; display: grid; grid-template-columns: 22px 52px minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; padding: 8px 14px 8px 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--friend-panel); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.gift-plan.is-selected { border-color: var(--red); background: var(--tint-red); box-shadow: inset 0 0 0 1px var(--red); }
.gift-plan__radio { width: 22px; height: 22px; border: 2px solid var(--line); border-radius: 50%; background: var(--paper); }
.gift-plan.is-selected .gift-plan__radio { border-color: var(--red); background: var(--red) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 14px no-repeat; }
.gift-plan__art { display: block; width: 52px; height: 52px; object-fit: contain; }
.gift-plan__info { display: grid; gap: 2px; min-width: 0; }
.gift-plan__name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 16px; font-weight: 800; white-space: nowrap; }
.gift-plan__info small { color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.gift-plan__badge { position: absolute; top: -9px; right: 14px; padding: 3px 8px; border-radius: 99px; background: var(--red); color: var(--on-red); font-size: 10px; font-weight: 800; line-height: 1.2; text-transform: uppercase; letter-spacing: .03em; }
.gift-plan__price { font-size: 17px; font-weight: 800; white-space: nowrap; }
.gift-plan.is-best .gift-plan__name, .gift-plan.is-best .gift-plan__price { color: var(--red); }
:root[data-theme="dark"] .gift-plan.is-selected { background: rgba(227,138,104,.2); }
#giftPay::after, #giftSend::after { content: "→"; margin-left: 8px; font-weight: 800; }
/* The buyer's gifts: a gift box on a soft tint, then what it is and a send button. */
#giftMineTitle { display: inline-flex; align-items: center; gap: 8px; }
#giftMineTitle::before { content: ""; width: 22px; height: 22px; background: url("assets/gift/gift-icon.webp?v=20261023-gifts") center / contain no-repeat; }
.gift-mine .gift-item { grid-template-columns: 38px minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 10px 10px 10px 10px; }
.gift-item__icon { grid-row: 1; width: 38px; height: 38px; border-radius: 12px; background: url("assets/gift/gift-icon.webp?v=20261023-gifts") center / 24px no-repeat, #fbd3d0; }
.gift-item__icon[data-tint="1"] { background-color: #cfe0f6; }
.gift-item__icon[data-tint="2"] { background-color: #cfeedd; }
.gift-item__icon[data-tint="3"] { background-color: #e6dcf3; }
:root[data-theme="dark"] .gift-item__icon { background-color: rgba(255, 160, 150, .2); }
:root[data-theme="dark"] .gift-item__icon[data-tint="1"] { background-color: rgba(150, 190, 240, .2); }
:root[data-theme="dark"] .gift-item__icon[data-tint="2"] { background-color: rgba(140, 220, 180, .2); }
:root[data-theme="dark"] .gift-item__icon[data-tint="3"] { background-color: rgba(200, 180, 240, .2); }
.gift-item .invite-friend__name { font-size: 14px; }
.gift-item .invite-friend__seen { font-size: 11.5px; }
#giftMine .gift-item__send { width: auto; min-height: 32px; margin: 0; padding: 0 10px; font-size: 12.5px; }
.gift-item__send::after { content: "›"; margin-left: 4px; font-size: 15px; }
.gift-mine__more { display: block; margin: 10px auto 0; }
.gift-mine__more[hidden], .gift-used[hidden] { display: none; }
/* Used gifts fold away under one row, so thirty gifts stay a short list. */
.gift-used { margin: 12px 0 0; border: 1px solid var(--friend-edge); border-radius: 16px; background: var(--friend-panel); }
.gift-used__summary { display: flex; align-items: center; gap: 8px; padding: 12px 14px; text-align: left; color: var(--ink); font-size: 14px; font-weight: 800; list-style: none; cursor: pointer; }
.gift-used__summary::-webkit-details-marker { display: none; }
.gift-used__summary::after { content: "›"; margin-left: auto; color: var(--ink-soft); font-size: 20px; line-height: 1; transition: transform .2s; }
.gift-used[open] .gift-used__summary::after { transform: rotate(90deg); }
.gift-used__count { min-width: 22px; padding: 1px 7px; border-radius: 99px; background: rgba(var(--jade-rgb), .4); color: var(--ink); font-size: 12px; text-align: center; }
.gift-used .gift-mine { margin: 0; padding: 0 8px 8px; }
.gift-used .gift-mine { gap: 0; }
.gift-used .gift-item { grid-template-columns: 30px minmax(0, 1fr); padding: 8px 6px; border: 0; border-top: 1px solid var(--friend-edge); border-radius: 0; background: none; box-shadow: none; }
.gift-used .gift-item__icon { width: 30px; height: 30px; border-radius: 9px; background-size: 18px; }
.gift-used .invite-friend__name { font-size: 13px; }
#paywallGift { display: block; margin: 8px auto 0; }
#paywallPromoOpen { color: var(--ink-soft); font-weight: 700; }
#paywallGift[hidden] { display: none; }

/* Settings: reminder time, four choices in two rows. */
#remindOptions { display: grid; grid-template-columns: 1fr 1fr; }
#remindOptions [data-remind-at="off"] { grid-column: 1 / -1; }
#remindSettings .fieldset-hint { margin-top: 10px; }
/* A start-round button's length, in a muted tail: «Ещё раунд ⏰ ~2 мин». */
.round-time { display: inline-flex; align-items: center; gap: 4px; margin-left: 2px; font-weight: 600; opacity: .62; white-space: nowrap; }
.round-time svg { width: 1.05em; height: 1.05em; }

/* Lessons (app.js renderLessons): the path's «Уроки», then every chapter's lessons by level, with a search. */
.path-lessons { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 6px; min-height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 800; cursor: pointer; }
.path-lessons svg { width: 17px; height: 17px; color: var(--red-dark); }
.lessons-screen { display: flex; flex-direction: column; padding: max(16px, var(--safe-top)) 16px 0; }
.lessons-search { margin: 8px 0 6px; }
.lessons-levels { display: flex; flex: 0 0 auto; gap: 6px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.lessons-levels::-webkit-scrollbar { display: none; }
.lessons-levels .chip { flex: 0 0 auto; }
.lessons-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 0 32px; }
.lessons-chapter { display: flex; align-items: center; gap: 10px; margin: 14px 0 8px; }
.lessons-chapter:first-child { margin-top: 4px; }
.lessons-chapter__glyph { display: grid; width: 30px; height: 30px; flex: 0 0 auto; place-items: center; border-radius: 9px; background: var(--paper-deep); color: var(--ink); font: 17px "Noto Serif SC", serif; }
.lessons-chapter__name { display: grid; gap: 1px; }
.lessons-chapter__name b { font-size: 14px; font-weight: 800; }
.lessons-chapter__name small { color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.lesson-row { display: flex; width: 100%; align-items: center; gap: 12px; margin: 0 0 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--white); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.lesson-row__glyph { display: grid; width: 42px; height: 42px; flex: 0 0 auto; place-items: center; border-radius: 12px; background: rgba(184, 209, 189, .45); color: var(--ink); font: 20px "Noto Serif SC", serif; }
.lesson-row__glyph.is-sound { background: rgba(223, 85, 63, .12); color: var(--red-dark); }
.lesson-row__text { display: grid; flex: 1; min-width: 0; gap: 2px; }
.lesson-row__text b { font-size: 15px; font-weight: 800; line-height: 1.25; }
.lesson-row__rule { overflow: hidden; color: var(--ink-soft); font-size: 12.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.lesson-row__where { color: var(--ink-soft); font-size: 11px; font-weight: 800; }
.lesson-row__check { display: grid; flex: 0 0 auto; place-items: center; color: var(--green); }
.lesson-row__chevron { flex: 0 0 auto; color: var(--ink-soft); font-size: 20px; }
.lesson-row__pro { flex: 0 0 auto; }
@media (min-width: 600px) {
  .lessons-screen { --content: 560px; padding: max(20px, var(--safe-top)) var(--pad-x) 0; }
}

/* Settings: tiles where the choice is seen (the card's face, the script, the foil, Bao's character, the skill chart),
   one row for everything else; a "value ›" row opens its choices under it (app.js setSettingsPanel). */
.settings-scroll fieldset { margin-bottom: 14px; }
.settings-scroll .profile-row { margin-bottom: 14px; padding: 8px 12px; }
.settings-scroll .profile-avatar--row { width: 40px; height: 40px; }
.settings-scroll legend { margin: 0 4px 6px; }
.settings-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.settings-tiles--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.settings-tiles--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.settings-tiles button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 0; min-height: 0; padding: 6px 4px 8px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); font-size: 11px; font-weight: 700; line-height: 1.15; text-align: center; cursor: pointer; }
.settings-tiles button.is-selected { border-color: var(--red); background: var(--tint-red); color: var(--ink); box-shadow: inset 0 0 0 1px var(--red); }
.settings-tiles button > span { display: block; margin: 0; }
.settings-tiles button strong { display: block; font-family: "Noto Serif SC", serif; font-size: 32px; font-weight: 600; line-height: 1.1; }
.settings-tiles .pro-badge { position: absolute; top: 5px; right: 5px; margin: 0; }
.settings-tile__pinyin { display: block; height: 14px; color: var(--ink-soft); font-size: 12px; font-weight: 600; line-height: 14px; }
.settings-tiles .shine-swatch { box-sizing: border-box; width: 48px; height: 44px; padding-top: 5px; border-radius: 12px; font-size: 28px; line-height: 1; }
.settings-tiles button strong.settings-tile__card { display: grid; place-items: center; min-width: 46px; max-width: 100%; height: 46px; padding: 0 6px; white-space: nowrap; border: 1px solid var(--line); border-radius: 10px; background: var(--white); box-shadow: 0 2px 6px rgba(23,59,54,.12); font-size: 28px; }
.settings-tiles--4 button > span:not(.settings-tile__chart) { max-width: 100%; font-size: 10px; overflow-wrap: anywhere; hyphens: auto; }
.settings-tile__chart { display: block; width: 100%; max-width: 58px; aspect-ratio: 1; }
.settings-tile__chart svg { display: block; width: 100%; height: 100%; }
.settings-tile__chart text { display: none; }
:root[data-theme="dark"] .settings-tiles button { background: var(--paper); }
:root[data-theme="dark"] .settings-tiles button.is-selected { background: rgba(227,138,104,.2); }

.settings-list { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.settings-row { display: flex; flex-wrap: wrap; width: 100%; min-height: 46px; align-items: center; gap: 10px; padding: 8px 14px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--ink); font: inherit; font-size: 14px; font-weight: 700; text-align: start; text-decoration: none; cursor: pointer; }
.settings-list > .settings-row:first-child { border-top: 0; }
.settings-row > span:first-child { flex: 1 1 auto; min-width: 0; }
.settings-row.toggle-row, .settings-row--more { flex-wrap: nowrap; }
.settings-row__text { display: flex; flex-direction: column; gap: 2px; }
.settings-row__text small { color: var(--ink-soft); font-size: 11px; font-weight: 600; line-height: 1.3; }
.settings-row__value { flex: 0 1 auto; max-width: 55%; overflow: hidden; color: var(--ink-soft); font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.settings-row__chevron { flex: none; color: var(--ink-soft); font-size: 20px; line-height: 1; transition: rotate .2s; }
.settings-row[aria-expanded="true"] .settings-row__chevron { rotate: 90deg; }
/* The label and its choices share a line when they fit, else the choices go under it. */
.settings-row--stacked { row-gap: 8px; cursor: default; }
.settings-row--stacked > span:first-child { flex: 1 0 auto; }
.settings-row-group[hidden], .settings-panel[hidden] { display: none; }
/* Settings open on a list of sections; a section opens in the same sheet under its own title and ‹ (app.js showSettingsPage). */
.settings-heading { display: flex; min-width: 0; align-items: center; gap: 2px; }
.settings-back { display: grid; flex: none; width: 36px; height: 40px; margin-left: -10px; place-items: center; border: 0; background: none; color: var(--ink); font: inherit; font-size: 34px; line-height: 1; cursor: pointer; }
.settings-sheet:not([data-page="root"]) #settingsTitle { overflow: hidden; font-size: 22px; text-overflow: ellipsis; white-space: nowrap; }
.settings-group { margin-bottom: 14px; }
.settings-row--nav { flex-wrap: nowrap; }
.settings-row--nav > .settings-row__value { max-width: 50%; }
.settings-panel { padding: 2px 14px 14px; }
.settings-panel .fieldset-hint { margin: 8px 2px 0; }
.settings-seg { flex: 1 1 auto; max-width: 100%; display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 2px; padding: 3px; border-radius: 12px; background: var(--muted); }
.settings-seg button { min-height: 32px; padding: 0 8px; border: 0; border-radius: 9px; background: none; color: var(--ink-soft); font-size: 12px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.settings-seg--scale button { font-size: var(--glyph); font-weight: 800; }
.settings-seg button.is-selected { background: var(--white); color: var(--ink); box-shadow: 0 1px 3px rgba(23,59,54,.16); }
.settings-row.language-select { display: flex; cursor: default; }
.settings-row .language-select__current { min-height: 0; flex: 0 1 auto; padding: 0; border: 0; color: var(--ink-soft); font-size: 13px; font-weight: 600; }
.settings-row__hint { margin: 0; padding: 0 14px 10px; }
.settings-scroll .legal-links { margin-top: 8px; }
/* The tiles' characters in a clear green on the light theme; the dark theme keeps its own colour. */
:root:not([data-theme="dark"]) .settings-tiles button strong { color: #24603f; }

/* A requested sentence is downloading; only its button waits. */
.detail-example__speak.is-loading { position: relative; animation: none; opacity: 1; }
.detail-example__speak.is-loading::after { content: ""; position: absolute; inset: 10px; border: 2px solid var(--ink); border-right-color: transparent; border-radius: 50%; animation: sentence-loading .8s linear infinite; }
@keyframes sentence-loading { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .detail-example__speak.is-loading::after { animation: none; } }
/* ================================================================== *
 * Home cards (2026-10): a green today card with two flat cards, and a
 * garden card with its sprout. The sprout loads after the first screen
 * (data-src).
 * ================================================================== */
.home-screen { --leaf: #2f6b46; --lime-top: #7bc94a; --lime-bottom: #3d932b; }
:root[data-theme="dark"] .home-screen { --lime-top: #6cb146; --lime-bottom: #357f29; }

/* Today: deep green, flat cards top right, a lime start button. */
.today-card {
  isolation: isolate; overflow: hidden; padding: 18px 16px 16px; border-radius: 26px;
  background: radial-gradient(120% 90% at 100% 0%, rgba(126,196,146,.22), transparent 60%), linear-gradient(140deg, #18473a 0%, #1f5a45 55%, #2a6c4c 100%);
  box-shadow: 0 18px 40px -18px rgba(23,59,54,.55);
}
:root[data-theme="dark"] .today-card { background: radial-gradient(120% 90% at 100% 0%, rgba(126,196,146,.16), transparent 60%), linear-gradient(140deg, #1d3f32 0%, #24503e 60%, #2b5d45 100%); }
.today-card > :not(.today-card__art) { position: relative; z-index: 1; }
.today-card h2, .today-card .today-sub { padding-right: 92px; }
.today-card h2 { font-size: 24px; letter-spacing: -.02em; }
.today-card .today-sub { color: rgba(255,255,255,.82); font-size: 12.5px; }
/* The art sits above the title's padding so its front card takes taps (it opens the word). */
.today-card__art { position: absolute; top: 14px; right: 28px; z-index: 2; width: 84px; height: 90px; pointer-events: none; scale: .82; transform-origin: top right; }
/* Flat cards: a pale green one behind, a cream one in front with a word from this round (renderHome). */
.today-card__back, .today-card__front { position: absolute; width: 56px; height: 70px; border-radius: 12px; }
/* The cards behind sit 10 % smaller than the front one, so the front word leads. */
.today-card__back { left: 7px; top: 18px; width: 50px; height: 63px; background: #a9d4b4; rotate: -10deg; box-shadow: 27px 5px 0 -2px #8cc39b; }
.today-card__front { left: 14px; top: 6px; display: grid; place-items: center; background: #fbf8ee; color: #12402f; font-family: "Noto Serif SC", serif; font-size: 34px; font-weight: 700; line-height: 1; rotate: 6deg; box-shadow: 0 6px 14px -6px rgba(0,0,0,.35); padding: 0; border: 0; pointer-events: auto; cursor: pointer; }
.today-card__front:active { scale: .95; }
.today-card__front[data-len="2"] { font-size: 23px; }
.today-card__spark { position: absolute; right: -4px; top: -6px; width: 26px; height: 26px; fill: none; stroke: #f2d660; stroke-width: 3; stroke-linecap: round; }
.today-card .start-row { gap: 10px; }
.today-card .menu-primary {
  min-height: 52px; border-radius: 18px; background: linear-gradient(180deg, var(--lime-top), var(--lime-bottom)); color: #fff;
  font-size: 16px; font-weight: 800; text-shadow: 0 1px 1px rgba(20,70,20,.35);
  box-shadow: 0 10px 20px -10px rgba(74,170,50,.8), inset 0 1px 0 rgba(255,255,255,.35);
}
.today-card .menu-primary:hover { background: linear-gradient(180deg, #86d354, #469f31); }
.start-icon { flex: none; width: 18px; height: 18px; }
.menu-primary .start-icon { filter: drop-shadow(0 1px 1px rgba(20,70,20,.35)); }
.today-card .start-test, .today-card .start-reset { min-height: 52px; border-radius: 18px; border-color: rgba(255,255,255,.22); background: rgba(255,255,255,.09); }
.start-test__label { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 800; }
.start-test__label .start-icon { width: 20px; height: 20px; }
.today-card.is-done .menu-primary { text-shadow: none; box-shadow: none; }
.today-card.is-done .menu-primary .start-icon { filter: none; }

/* Garden: the sprout in its own tile beside the title and count; the bar and legend run the card's width. */
.garden-card { position: relative; display: grid; grid-template-columns: 54px minmax(0, 1fr); column-gap: 12px; align-items: center; padding: 12px 14px; border: 0; border-radius: 24px; background: var(--white); box-shadow: 0 10px 30px -22px rgba(41,73,59,.45), inset 0 0 0 1px var(--line); overflow: hidden; }
.garden-card > * { grid-column: 1 / -1; }
.garden-card > .garden-card__head, .garden-card > .garden-card__count { grid-column: 2; }
.garden-card__art { grid-column: 1; grid-row: 1 / span 2; display: grid; width: 54px; height: 54px; place-items: center; border-radius: 16px; background: linear-gradient(160deg, #eaf5e4, #d7ecd0); }
:root[data-theme="dark"] .garden-card__art { background: rgba(126,196,146,.14); }
.garden-card__art img { width: 40px; height: 40px; }
.garden-card__head { font-size: 16px; }
.garden-card__head .card-chevron { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; background: var(--tint-green); color: var(--green-ink); font-size: 18px; }
.garden-card__count { margin: 0; }
.garden-card__count > b { color: var(--green-ink); font-size: 24px; }
.garden-card .stack-bar { height: 9px; margin-top: 10px; }
.garden-card .stack-legend { gap: 4px 10px; margin-top: 7px; font-size: 11px; }

@media (max-height: 740px) {
  .today-card { padding: 14px 14px 12px; }
  .today-card .menu-primary, .today-card .start-test, .today-card .start-reset { min-height: 46px; }
}
@media (max-height: 680px) {
  .today-card .menu-primary, .today-card .start-test, .today-card .start-reset { min-height: 42px; }
  .garden-card { padding: 10px 12px; }
}
/* Until its picture arrives an image shows nothing, not a broken frame. */
.home-screen img[data-src]:not([src]) { visibility: hidden; }
.garden-card .home-next { white-space: nowrap; }

/* Tap a word in an example sentence (app.js tappableSentence, openWordPeek). */
.word-tap { border-radius: 4px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.word-tap:hover, .word-tap.is-open { background: var(--tint-red, #fbe9e4); }
.quiz-hanzi.word-tap { width: fit-content; margin-inline: auto; padding: 0 8px; border-radius: 14px; }
.probe:not(.has-answer) .quiz-hanzi.word-tap { background: none; cursor: default; }
.chapter-words .word-tap { border-radius: 12px; }
.chapter-words .word-tap.is-open { border-color: var(--red); }
.word-peek { position: fixed; z-index: 90; box-sizing: border-box; max-height: calc(100dvh / var(--ui-zoom, 1) - 16px); overflow-y: auto; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--white); box-shadow: var(--shadow); color: var(--ink); }
.word-peek[hidden] { display: none; }
.word-peek::before { content: ""; position: absolute; top: -7px; left: calc(var(--arrow, 50%) - 7px); width: 12px; height: 12px; border-left: 1px solid var(--line); border-top: 1px solid var(--line); background: var(--white); transform: rotate(45deg); }
.word-peek.is-above::before { top: auto; bottom: -7px; transform: rotate(225deg); }
/* Scrolling inside, the arrow would be clipped and drawn over the content. */
.word-peek.is-scrolling::before { display: none; }
.word-peek__head { display: flex; align-items: center; gap: 12px; }
.word-peek__tile { flex: none; min-width: 64px; height: 64px; padding: 0 10px; border: 0; border-radius: 16px; background: var(--red); color: var(--on-red); font-family: "Noto Serif SC", serif; font-size: 30px; font-weight: 700; box-shadow: 0 4px 0 var(--red-dark); cursor: pointer; }
.word-peek__head-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: none; }
.word-peek__speak { flex: none; width: 40px; height: 40px; }
.word-peek__bookmark { display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--paper-deep); color: var(--ink-soft); cursor: pointer; transition: transform .12s ease, background .15s ease, color .15s ease; }
.word-peek__bookmark svg { width: 18px; height: 18px; }
.word-peek__bookmark:active { transform: scale(.92); }
.word-peek__bookmark.is-active { border-color: var(--red); background: var(--red); color: var(--on-red); }
.word-peek__bookmark.is-active svg path { fill: currentColor; }
.word-peek__speak[hidden] { display: none; }
.word-peek__speak svg { width: 20px; height: 20px; }
.word-peek__about { display: grid; gap: 3px; min-width: 0; }
.word-peek__pinyin { color: var(--ink-soft); font-size: 14px; font-weight: 700; }
.word-peek__meaning { font-size: 15px; font-weight: 800; line-height: 1.3; }
.word-peek__chars { display: grid; gap: 6px; margin: 12px 0 0; padding: 10px 0 0; border-top: 1px solid var(--line); list-style: none; }
.word-peek__chars li { display: grid; grid-template-columns: 28px 56px minmax(0, 1fr); align-items: baseline; gap: 6px; }
.word-peek__glyph { font-family: "Noto Serif SC", serif; font-size: 20px; }
.word-peek__syllable { color: var(--ink-soft); font-size: 12.5px; }
.word-peek__sense { font-size: 13px; font-weight: 700; line-height: 1.3; }
.word-peek__open { width: 100%; min-height: 38px; margin-top: 12px; border: 0; border-radius: 12px; background: var(--paper-deep); color: var(--ink); font-size: 13px; font-weight: 800; cursor: pointer; }
.word-peek__built { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.word-peek__built h4 { margin: 0 0 8px; color: var(--ink-soft); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.word-peek__parts { display: flex; align-items: center; gap: 8px; }
.word-peek__parts + .word-peek__parts { margin-top: 8px; }
.word-peek__whole { width: 28px; font-family: "Noto Serif SC", serif; font-size: 20px; }
.word-peek__part { display: grid; justify-items: center; gap: 2px; min-width: 58px; max-width: 96px; padding: 6px 8px 5px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); box-shadow: 0 2px 0 var(--line); cursor: pointer; }
.word-peek__part.is-still { box-shadow: none; cursor: default; }
.word-peek__part span { font-family: "Noto Serif SC", serif; font-size: 22px; line-height: 1.1; }
.word-peek__part small { overflow: hidden; max-width: 100%; color: var(--ink-soft); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.word-peek__tags { color: var(--ink-soft); font-size: 11.5px; font-weight: 700; }
.word-peek__stats { display: grid; grid-template-columns: 1.5fr 1fr 1.1fr; gap: 6px; margin-top: 12px; }
.word-peek__stat { display: grid; align-content: start; gap: 2px; min-width: 0; padding: 7px 8px; border-radius: 10px; background: var(--paper); }
.word-peek__stat small { color: var(--ink-soft); font-size: 10.5px; font-weight: 700; }
.word-peek__stat b { font-size: 12.5px; line-height: 1.25; overflow-wrap: anywhere; }
.word-peek__bar { display: block; height: 4px; margin-top: 3px; overflow: hidden; border-radius: 99px; background: var(--paper-deep); }
.word-peek__bar i { display: block; height: 100%; border-radius: inherit; background: var(--green, #2f8a5a); transform-origin: left; }
.word-peek__note { margin-top: 10px; }
.word-peek__note h4 { margin: 0 0 4px; color: var(--ink-soft); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.word-peek__note-text { display: block; width: 100%; padding: 8px 10px; border: 0; border-left: 3px solid var(--red); border-radius: 4px 10px 10px 4px; background: var(--tint-red, #fbe9e4); color: var(--ink); font: inherit; font-size: 13px; line-height: 1.4; text-align: left; white-space: pre-wrap; cursor: text; }
.word-peek__note-add { padding: 4px 0; border: 0; background: none; color: var(--ink-soft); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.word-peek__note-form textarea { box-sizing: border-box; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); font: inherit; font-size: 16px; resize: none; }
.word-peek__note-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.word-peek__note-actions button { min-height: 32px; padding: 0 14px; border: 0; border-radius: 10px; font: inherit; font-size: 12.5px; font-weight: 800; cursor: pointer; }
.word-peek__note-cancel { background: var(--paper-deep); color: var(--ink); }
.word-peek__note-save { background: var(--red); color: var(--on-red); }

/* «Спросить Бао» (web/tutor.js): a short sheet over the screen, growing with the chat; under the app's overlays. */
.tutor { position: absolute; z-index: 28; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; }
.tutor[hidden] { display: none; }
.tutor__backdrop { position: absolute; inset: 0; background: rgba(20,33,30,.28); animation: tutor-fade .2s ease-out; }
.tutor__sheet { position: relative; display: flex; flex-direction: column; min-height: 42%; max-height: calc(100% - 48px); border-radius: 22px 22px 0 0; background: var(--paper); box-shadow: 0 -12px 40px rgba(20,33,30,.18); color: var(--ink); padding-bottom: var(--safe-bottom); animation: tutor-rise .22s cubic-bezier(.2,.8,.3,1); }
/* Closing: the sheet slides down and the shade fades before it hides (tutor.js LEAVE_MS). */
.tutor.is-leaving { pointer-events: none; }
.tutor.is-leaving .tutor__backdrop { opacity: 0; transition: opacity .18s ease-in; }
.tutor.is-leaving .tutor__sheet { transform: translateY(100%); opacity: .4; transition: transform .18s ease-in, opacity .18s ease-in; }
@keyframes tutor-fade { from { opacity: 0; } }
@keyframes tutor-rise { from { transform: translateY(100%); } }
/* Minimized: only Bao's bubble, the page under it usable. */
.tutor.is-min { pointer-events: none; }
.tutor.is-min .tutor__backdrop, .tutor.is-min .tutor__sheet { display: none; }
.tutor__pill { display: none; }
.tutor.is-min .tutor__pill { pointer-events: auto; position: absolute; right: 12px; bottom: 34%; display: grid; place-items: center; width: 54px; height: 54px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--paper); box-shadow: 0 8px 24px rgba(20,33,30,.24); animation: tutor-pop .2s ease-out; }
.tutor__pill img { width: 40px; height: 40px; }
.tutor__pill-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@keyframes tutor-pop { from { transform: scale(.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .tutor__backdrop, .tutor__sheet, .tutor__pill { animation: none !important; } .tutor.is-leaving .tutor__sheet, .tutor.is-leaving .tutor__backdrop { transition: none; } }
.tutor__head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 8px; }
.tutor__face { width: 30px; height: 30px; }
.tutor__title { flex: 1; margin: 0; font-size: 17px; font-weight: 800; }
.tutor__hide { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: var(--white); color: var(--ink-soft); padding: 0; }
.tutor__hide svg { width: 20px; height: 20px; }
.tutor__close { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: var(--white); color: var(--ink-soft); font-size: 20px; line-height: 1; }
.tutor__context { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0 14px 6px; padding: 8px 12px; border-radius: 12px; background: var(--paper-deep); font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.tutor__context[hidden] { display: none; }
.tutor__task { font-size: 15px; font-weight: 800; color: var(--ink); overflow-wrap: anywhere; }
.tutor__answers { display: inline-flex; gap: 8px; }
.tutor__chosen { color: var(--red-dark); }
.tutor__correct { color: var(--green-ink); }
.tutor__log { flex: 1; min-height: 60px; overflow-y: auto; padding: 4px 14px 8px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.tutor__me { align-self: flex-end; max-width: 82%; margin: 0; padding: 8px 12px; border-radius: 14px 14px 4px 14px; background: var(--ink); color: var(--on-ink, #fff); font-size: 15px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.tutor__answer { padding: 10px 12px; border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; background: var(--white); }
.tutor__prose { margin: 0 0 6px; font-size: 15px; line-height: 1.55; font-weight: 600; }
.tutor__word { display: inline-flex; align-items: baseline; gap: 3px; margin: 0 1px; padding: 0 5px; border-radius: 7px; background: var(--tint-green); color: var(--green-ink); font: inherit; border: 0; cursor: pointer; }
.tutor__word b { font-family: "Noto Serif SC", serif; font-size: 17px; font-weight: 700; }
.tutor__word small { font-size: 12px; font-weight: 700; opacity: .8; }
.tutor__word.is-open { background: var(--tint-red); color: var(--red-dark); }
.tutor__examples { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.tutor__example { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px; background: var(--surface); }
.tutor__example > div { flex: 1; min-width: 0; }
.tutor__example-zh { display: block; font-family: "Noto Serif SC", serif; font-size: 17px; line-height: 1.3; }
.tutor__example-py, .tutor__example-tr { display: block; font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.tutor__example-tr { font-weight: 600; color: var(--ink); }
.tutor__example .detail-speak { flex: 0 0 auto; }
/* A Bao example's own voiced recording (server/tutor-voice.js): outlined, with «ИИ» on its corner; a ring turns while it is made. */
.tutor__voice { position: relative; overflow: visible; margin-right: 4px; color: var(--red); background: var(--white); box-shadow: inset 0 0 0 2px var(--red); transition: opacity .25s ease; }
.tutor__voice:hover { box-shadow: inset 0 0 0 2px var(--red); }
.tutor__voice.is-playing { transform: scale(.94); }
.tutor__voice-tag { position: absolute; top: -8px; right: -10px; padding: 0 5px; border: 1px solid var(--line); border-radius: 99px; background: var(--white); color: var(--ink-soft); font-size: 10.5px; font-weight: 800; line-height: 15px; letter-spacing: .03em; pointer-events: none; }
.tutor__voice.is-waiting { opacity: 0; visibility: hidden; transition: none; }
.tutor__foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.tutor__note { flex: 1; padding: 4px 10px; border-radius: 99px; background: var(--tint-green); color: var(--green-ink); font-size: 12px; font-weight: 800; }
.tutor__flag { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--ink-soft); }
.tutor__flag svg { width: 18px; height: 18px; }
.tutor__retry { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--ink-soft); }
.tutor__retry svg { width: 18px; height: 18px; }
.tutor__answer[hidden] { display: none; }
.tutor__error { align-self: center; margin: 0; font-size: 13px; font-weight: 700; color: var(--red-dark); }
.tutor__dots { align-self: flex-start; display: flex; gap: 5px; padding: 12px 14px; border-radius: 4px 14px 14px 14px; background: var(--white); border: 1px solid var(--line); }
.tutor__dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-soft); animation: tutor-dot 1s infinite ease-in-out; }
.tutor__dots i:nth-child(2) { animation-delay: .15s; }
.tutor__dots i:nth-child(3) { animation-delay: .3s; }
@keyframes tutor-dot { 0%, 80%, 100% { opacity: .25; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }
.tutor__chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 14px 8px; scrollbar-width: none; }
.tutor__chips[hidden] { display: none; }
.tutor__chip { flex: 0 0 auto; min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--white); color: var(--ink); font: 700 13px var(--font, inherit); white-space: nowrap; }
.tutor__form { display: flex; gap: 8px; padding: 0 14px 12px; }
.tutor__form[hidden] { display: none; }
.tutor__input { flex: 1; min-width: 0; height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); color: var(--ink); font: 600 15px inherit; font-size: 16px; }
.tutor__send { flex: 0 0 auto; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 14px; background: var(--ink); color: var(--on-ink, #fff); }
.tutor__send svg { width: 20px; height: 20px; }
.tutor__form.is-busy .tutor__send { opacity: .45; pointer-events: none; }
.tutor__limit { margin: 0 14px 12px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); text-align: center; }
.tutor__limit[hidden] { display: none; }
.tutor__wait { margin: 0; font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.tutor__pro { width: 100%; min-height: 44px; margin-top: 10px; border: 0; border-radius: 12px; background: var(--offer-gradient); color: #fff; font-weight: 800; font-size: 15px; }

/* The entries: Bao's face beside «Дальше», by the card's sound, on a missed word's row; a chip in a lesson and the word preview. */
.tutor-entry { display: inline-grid; place-items: center; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 16px; background: var(--white); padding: 0; cursor: pointer; }
.tutor-entry[hidden] { display: none; }
/* The learner's pick (Settings → «Иконка кнопки», body[data-tutor-icon]): the bubble unless chosen otherwise. */
.tutor-face { display: block; width: 74%; height: 74%; background: url(assets/mascot/tutor-bubble.webp) center / contain no-repeat; pointer-events: none; }
body[data-tutor-icon="idea"] .tutor-face { background-image: url(assets/mascot/tutor-idea.webp); }
body[data-tutor-icon="bulb"] .tutor-face { background-image: url(assets/mascot/tutor-bulb.svg); width: 62%; height: 62%; }
body[data-tutor-icon="sparkles"] .tutor-face { background-image: url(assets/mascot/tutor-sparkles.svg); }
body[data-tutor-icon="sparkleBubble"] .tutor-face { background-image: url(assets/mascot/tutor-sparkle-bubble.svg); }
body[data-tutor-icon="aiSeal"] .tutor-face { background-image: url(assets/mascot/tutor-ai-seal.svg); }
body[data-tutor-icon="aiBubble"] .tutor-face { background-image: url(assets/mascot/tutor-ai-bubble.svg); }
/* The sparkles' ink outline vanishes on the dark page: their gold outline instead. */
:root[data-theme="dark"] body[data-tutor-icon="sparkles"] .tutor-face, :root[data-theme="dark"] .tutor-icons [data-icon="sparkles"] .tutor-icon-preview { background-image: url(assets/mascot/tutor-sparkles-dark.svg); }
/* Seven to choose from (2026-11-08: four more from design/ai-icons, 1, 11, 20 and 16), four to a row; a long name wraps. */
.tutor-icons { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-flow: row; }
.tutor-icons button { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 64px; padding: 8px 4px; white-space: normal; line-height: 1.2; text-align: center; }
.tutor-icon-preview { width: 34px; height: 34px; background: url(assets/mascot/tutor-bubble.webp) center / contain no-repeat; }
.tutor-icons [data-icon="idea"] .tutor-icon-preview { background-image: url(assets/mascot/tutor-idea.webp); }
.tutor-icons [data-icon="bulb"] .tutor-icon-preview { background-image: url(assets/mascot/tutor-bulb.svg); width: 28px; height: 28px; margin: 3px 0; }
.tutor-icons [data-icon="sparkles"] .tutor-icon-preview { background-image: url(assets/mascot/tutor-sparkles.svg); }
.tutor-icons [data-icon="sparkleBubble"] .tutor-icon-preview { background-image: url(assets/mascot/tutor-sparkle-bubble.svg); }
.tutor-icons [data-icon="aiSeal"] .tutor-icon-preview { background-image: url(assets/mascot/tutor-ai-seal.svg); }
.tutor-icons [data-icon="aiBubble"] .tutor-icon-preview { background-image: url(assets/mascot/tutor-ai-bubble.svg); }
.quiz-sticky-action:has(.tutor-entry:not([hidden])) { display: flex; gap: 8px; }
.quiz-sticky-action:has(.tutor-entry:not([hidden])) .reveal-continue { flex: 1; min-width: 0; }
.quiz-sticky-action .tutor-entry { width: 52px; align-self: stretch; }
/* Next to the speaker's 34px disc: Bao's own picture at that size, not a small face inside a ringed circle (it read as a dark dot). */
.detail-pronunciation .tutor-entry { width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; margin-left: 4px; }
.detail-pronunciation .tutor-entry .tutor-face, body[data-tutor-icon] .detail-pronunciation .tutor-entry .tutor-face { width: 100%; height: 100%; }
.result-item .tutor-entry { width: 34px; height: 34px; border-radius: 50%; margin-right: 6px; align-self: center; }
.tutor-chip { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; min-height: 32px; padding: 0 12px 0 6px; border: 1px solid var(--line); border-radius: 99px; background: var(--white); color: var(--ink); font-weight: 800; font-size: 13px; }
/* body[data-tutor-icon] too: the bulb's 62 % would leave an empty, collapsed face in the chip. */
.tutor-chip .tutor-face, body[data-tutor-icon] .tutor-chip .tutor-face { flex: none; width: 22px; height: 22px; }
.tutor-chip[hidden] { display: none; }
.note-text + .tutor-chip { margin: 2px 0 10px; }
.word-peek .tutor-chip { margin-top: 10px; }
.skill-grid .tutor-tile { --skill-ink: var(--green-ink); --skill-bg: var(--tint-green); }

/* Settings → Бао: the switch's «бета» tag; the memory screen. */
.settings-beta { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 99px; background: var(--tint-red); color: var(--red-dark); font-size: 10px; font-weight: 800; letter-spacing: .04em; vertical-align: 2px; }
.tutor-consent__data { margin: 10px 0 0; font-size: 12px; color: var(--ink-soft); line-height: 1.35; }
.tutor-memory h3 { margin: 14px 0 6px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.tutor-memory ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.tutor-memory li { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 40px; padding: 8px 6px 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); font-size: 14px; font-weight: 600; }
.tutor-memory li button { flex: 0 0 auto; width: 32px; height: 32px; border: 0; background: transparent; color: var(--ink-soft); font-size: 18px; }
.tutor-memory__empty { margin: 0; font-size: 14px; color: var(--ink-soft); }
.tutor-memory__forget { margin-top: 12px; border: 0; background: transparent; color: var(--red-dark); font-weight: 800; font-size: 14px; padding: 8px 0; }
.tutor-memory { position: relative; max-height: calc(100% - 32px); overflow-y: auto; text-align: left; }
.tutor-memory h2 { margin-right: 36px; font-size: 20px; }
.tutor-memory__close { position: absolute; top: 12px; right: 12px; }
.tutor-memory li.is-fact { justify-content: flex-start; }
/* With «Спросить Бао» beside it, Tones takes one column: an even 2 × 3. */
.skill-grid:has(#playAsk:not([hidden])) [data-skill="tones"] { grid-column: auto; }
.skill-grid .tutor-tile[hidden] { display: none; }

/* Support chat (web/support-chat.js): the row's count dot, home's banner, the full-screen conversation. */
.settings-dot { flex: none; min-width: 22px; height: 22px; margin-left: auto; padding: 0 7px; border-radius: 999px; background: var(--red); color: var(--on-red); font-size: 12px; font-weight: 800; line-height: 22px; text-align: center; }
.settings-dot[hidden] { display: none; }
.settings-link.is-unread > span:first-child { font-weight: 800; }
.settings-link .settings-row__chevron { margin-left: 8px; }
.settings-link .settings-row__chevron[hidden] { display: none; }
.support-banner { display: flex; width: 100%; align-items: center; gap: 12px; margin: 0 0 12px; padding: 10px 14px; border: 1.5px solid var(--red); border-radius: 20px; background: var(--white); color: var(--ink); text-align: left; cursor: pointer; }
.support-banner[hidden] { display: none; }
.support-banner__bao { flex: none; width: 44px; height: 44px; }
.support-banner__bao svg { width: 100%; height: 100%; }
.support-banner__copy { display: grid; min-width: 0; flex: 1; gap: 2px; }
.support-banner__copy b { font-size: 15px; font-weight: 800; }
.support-banner__copy small { overflow: hidden; color: var(--ink-soft); font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.support-banner__copy small:empty { display: none; }
.support-banner__open { flex: none; padding: 6px 12px; border-radius: 999px; background: var(--red); color: var(--on-red); font-size: 13px; font-weight: 800; }
.support-chat { position: absolute; z-index: 60; inset: 0; display: flex; flex-direction: column; background: var(--paper); color: var(--ink); }
.support-chat[hidden] { display: none; }
.support-chat__header { display: flex; flex: none; align-items: center; gap: 10px; padding: 12px 14px 10px 6px; border-bottom: 1px solid var(--line); }
.support-chat__back { flex: none; width: 40px; height: 40px; border: 0; background: none; color: var(--ink-soft); font-size: 34px; line-height: 1; cursor: pointer; }
.support-chat__bao { flex: none; width: 44px; height: 44px; }
.support-chat__bao svg { width: 100%; height: 100%; }
.support-chat__titles { min-width: 0; }
.support-chat__titles h2 { margin: 0; font-size: 18px; font-weight: 800; line-height: 1.2; }
.support-chat__titles p { margin: 2px 0 0; color: var(--ink-soft); font-size: 13px; font-weight: 600; }
.support-chat__list { display: flex; min-height: 0; flex: 1; flex-direction: column; gap: 8px; overflow-y: auto; padding: 14px 14px 10px; overscroll-behavior: contain; }
.support-chat__day { align-self: center; margin: 6px 0 2px; padding: 3px 12px; border-radius: 999px; background: var(--paper-deep); color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.support-chat__empty { margin: auto; max-width: 280px; color: var(--ink-soft); font-size: 14px; font-weight: 600; line-height: 1.5; text-align: center; }
.support-msg { display: flex; max-width: 82%; flex-direction: column; gap: 4px; margin: 0; padding: 9px 13px 7px; border: 0; border-radius: 20px; font: inherit; font-size: 15px; line-height: 1.4; text-align: left; overflow-wrap: anywhere; }
.support-msg__text { white-space: pre-wrap; }
.support-msg__time { align-self: flex-end; font-size: 11px; font-weight: 600; opacity: .65; }
.support-msg--mine { align-self: flex-end; border-bottom-right-radius: 8px; background: var(--ink); color: var(--on-ink); }
.support-msg--team { align-self: flex-start; border: 1px solid var(--line); border-bottom-left-radius: 8px; background: var(--white); }
.support-msg__author { color: var(--red-dark); font-size: 12.5px; font-weight: 800; }
.support-msg__button { align-self: flex-start; margin-top: 4px; padding: 8px 16px; border: 0; border-radius: 999px; background: var(--red); color: var(--on-red); font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; }
.support-msg.is-failed { cursor: pointer; box-shadow: inset 0 0 0 1.5px var(--red); }
.support-msg__error { align-self: flex-end; color: #ffb4a6; font-size: 12px; font-weight: 700; }
.support-chat__form { display: flex; flex: none; align-items: flex-end; gap: 8px; padding: 10px 12px calc(10px + var(--safe-bottom)); border-top: 1px solid var(--line); background: var(--paper); }
.support-chat__input { min-width: 0; flex: 1; max-height: 120px; resize: none; padding: 11px 16px; border: 1px solid var(--line); border-radius: 22px; background: var(--white); color: var(--ink); font: inherit; font-size: 16px; line-height: 1.3; }
.support-chat__input:focus { outline: 2px solid var(--red); outline-offset: -1px; }
.support-chat__send { flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--red); color: var(--on-red); font-size: 22px; font-weight: 800; line-height: 1; cursor: pointer; }
/* Wide screens (an unfolded phone, a tablet, desktop): the conversation keeps a phone-like column in the middle. */
@media (min-width: 760px) {
  .support-chat__header, .support-chat__list, .support-chat__form { padding-left: max(14px, calc((100% - 720px) / 2)); padding-right: max(14px, calc((100% - 720px) / 2)); }
}
.support-chat__send:disabled { opacity: .4; cursor: default; }
:root[data-theme="dark"] .support-msg__error { color: var(--red-dark); }
