/* play & learn ♡ — the shell, the UI kit and the kitty (SPEC §8.1, ux 0.1–1.5).
   The kit comes from the hug jar (game/public/game/style.css), which took it from the site.
   Tiers are learn's own: :root[data-layout="phone|tablet|desk"] (+ data-short, data-pointer,
   data-motion, data-big, data-classroom), and body[data-screen] / :root[data-screen].
   Never copy the game's layout selectors. CSP: no inline styles anywhere; dynamic values go
   through CSSOM custom properties (--p, --kitty, …). */

/* ---------- Tokens ---------- */

/* from game/public/game/style.css (:root), plus learn's type scale, targets and fonts (ux 0.3, 1.1, 1.5) */
:root {
  --milk: #ffe3ec;      /* strawberry milk */
  --gingham: rgba(255, 143, 177, 0.14);
  --bow: #e8384f;       /* bow red */
  --bow-deep: #b01c35;  /* small red text: 6.9:1 on white */
  --pink: #ff8fb1;      /* bubblegum */
  --nose: #ffcf3f;      /* nose yellow */
  --white: #ffffff;
  --ink: #5b2a3c;       /* berry-brown, never black */
  --ink-soft: rgba(91, 42, 60, 0.8);   /* 5:1 on the darkest gingham cell */
  --gutter: clamp(16px, 3vw, 36px);
  --heart-cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3E%3Cpath d='M15 26 C2 17 3 7 9.5 6 C12.5 5.5 14.3 7.4 15 9 C15.7 7.4 17.5 5.5 20.5 6 C27 7 28 17 15 26Z' fill='%23e8384f' stroke='white' stroke-width='2.6' stroke-linejoin='round'/%3E%3C/svg%3E") 15 15, auto;

  --mint: #7fdcc2;
  --lavender: #b49cff;
  --sky: #8fd3ff;
  --bow-pink: #ff5c8a;
  --ear-pink: #ffc2d4;
  --blush: #fff2f6;
  --dash: rgba(255, 143, 177, 0.55);
  --boing: cubic-bezier(0.34, 1.56, 0.64, 1);
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);

  --ring:
    0.075em 0.000em 0 var(--white), 0.069em 0.029em 0 var(--white),
    0.053em 0.053em 0 var(--white), 0.029em 0.069em 0 var(--white),
    0.000em 0.075em 0 var(--white), -0.029em 0.069em 0 var(--white),
    -0.053em 0.053em 0 var(--white), -0.069em 0.029em 0 var(--white),
    -0.075em 0.000em 0 var(--white), -0.069em -0.029em 0 var(--white),
    -0.053em -0.053em 0 var(--white), -0.029em -0.069em 0 var(--white),
    -0.000em -0.075em 0 var(--white), 0.029em -0.069em 0 var(--white),
    0.053em -0.053em 0 var(--white), 0.069em -0.029em 0 var(--white),
    0 0.1em 0 var(--pink), 0 0.16em 0.22em rgba(232, 56, 79, 0.22);
  --ring-lite:
    0.07em 0 0 var(--white), -0.07em 0 0 var(--white), 0 0.07em 0 var(--white), 0 -0.07em 0 var(--white),
    0.05em 0.05em 0 var(--white), -0.05em 0.05em 0 var(--white), 0.05em -0.05em 0 var(--white),
    -0.05em -0.05em 0 var(--white), 0 0.12em 0 var(--pink);

  /* learn: semantic colours (ux 1.3) */
  --mint-soft: #e6f9f2;   /* correct fill (mint 25 %) */
  --hmm: var(--lavender); /* not yet: a dashed lavender outline, never red */
  --hmm-soft: #f3efff;
  --due: var(--nose);
  --lavender-ink: #6a4fd1;
  --subj: var(--pink);    /* a subject's colour; set by [data-subject] below */

  /* learn: fonts (ux 1.1 fallback stacks; no layout depends on their metrics) */
  --font-display: "Mochiy Pop One", "Hiragino Maru Gothic ProN", "Arial Rounded MT Bold", ui-rounded, system-ui, sans-serif;
  --font-ui: "M PLUS Rounded 1c", ui-rounded, "Hiragino Maru Gothic ProN", "Arial Rounded MT Bold", system-ui, sans-serif;
  --round: var(--font-ui);
  --pop: var(--font-display);

  /* learn: type scale (ux 0.3). Tiers set the *-px bases, big letters sets the k-* multipliers. */
  --fs-title-px: 26px;
  --fs-prompt-px: 24px;
  --fs-option-px: 20px;
  --fs-body-px: 16px;
  --fs-ui-px: 14px;
  --fs-small-px: 12px;
  --k-title: 1;
  --k-prompt: 1;
  --k-option: 1;
  --k-body: 1;
  --k-ui: 1;
  --k-small: 1;
  --fs-title: calc(var(--fs-title-px) * var(--k-title));
  --fs-prompt: calc(var(--fs-prompt-px) * var(--k-prompt));
  --fs-option: calc(var(--fs-option-px) * var(--k-option));
  --fs-body: calc(var(--fs-body-px) * var(--k-body));
  --fs-ui: calc(var(--fs-ui-px) * var(--k-ui));
  --fs-small: calc(var(--fs-small-px) * var(--k-small));
  --lh-prompt: 1.3;
  --lh-body: 1.5;

  /* learn: sizes (ux 1.5, 5.4) */
  --target: 44px;         /* minimum hit target; 52 in big letters */
  --option-h: 64px;       /* option buttons; 76 in big letters */
  --pill-pad: 7px 16px 8px;
  --inner: 640px;         /* .sheet-inner max width; 720 in big letters */
  --head-h: 66px;         /* sheet-head height without the safe area */
  --topbar-h: 56px;       /* session top bar */
  --strip-h: 72px;        /* kitty strip */
  --tray-h: 64px;         /* answer tray */
  --radius-card: 24px;
}

/* Components put their drop shadow in --drop so the focus ring can sit on top of it (ux 1.3). It is
   reset on every element, so a parent's drop never leaks into a focused child. */
* { --drop: 0 0 #0000; }

/* Subject colours (SPEC §1, ux 1.3). */
[data-subject="num"] { --subj: var(--sky); }
[data-subject="spell"] { --subj: var(--bow-pink); }
[data-subject="word"] { --subj: var(--mint); }
[data-subject="logic"] { --subj: var(--lavender); }
[data-subject="sci"] { --subj: var(--nose); }
[data-subject="friends"] { --subj: var(--pink); }

/* ---------- Tiers (SPEC §8.1; ui/app.js relayout() sets the attributes) ---------- */

:root[data-layout="desk"] {
  --fs-title-px: 30px;
  --fs-prompt-px: 26px;
  --fs-option-px: 22px;
}

:root[data-short="true"] {
  --head-h: 52px;
  --topbar-h: 44px;
  --strip-h: 40px;
  --tray-h: 56px;
}

:root[data-big="true"] {
  --k-title: 1.15;
  --k-prompt: 1.25;
  --k-option: 1.2;
  --k-body: 1.2;
  --k-ui: 1.15;
  --k-small: 1.15;
  --target: 52px;
  --option-h: 76px;
  --pill-pad: 9px 20px 10px;
  --inner: 720px;
}

/* Show/hide helpers by tier and pointer. */
:root:not([data-layout="desk"]) .desk-only,
:root[data-layout="desk"] .no-desk,
:root:not([data-layout="phone"]) .phone-only,
:root[data-layout="phone"] .no-phone,
:root:not([data-pointer="coarse"]) .coarse-only,
:root[data-pointer="coarse"] .fine-only,
:root[data-short="true"] .no-short { display: none !important; }

/* ---------- Base ---------- */

/* from game/public/game/style.css (reset, page, gingham) */
*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  height: 100dvh;
  background-color: var(--milk);
  /* Picnic-cloth gingham. */
  background-image:
    linear-gradient(90deg, var(--gingham) 50%, transparent 50%),
    linear-gradient(var(--gingham) 50%, transparent 50%);
  background-size: 46px 46px;
  cursor: var(--heart-cursor);
  font-variant-numeric: tabular-nums;
}

button {
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; }
p, h1, h2, h3, h4, figure { margin: 0; }
h1, h2, h3 { font-weight: 400; }
ul, ol { margin: 0; padding: 0; }

/* Focus is never removed: a bow ring on a white gap, over the component's own drop (ux 1.3). */
:focus-visible {
  outline: 3px solid var(--bow);
  outline-offset: 3px;
  box-shadow: 0 0 0 3px var(--white), var(--drop);
}

/* Programmatic focus targets (screen <h1 tabindex="-1">) keep the ring only for keyboard users; headings and
   dialog titles are read, not operated, so they never wear it. */
[tabindex="-1"]:focus:not(:focus-visible) { outline: none; }
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus { outline: none; box-shadow: none; }

.glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 55% at 50% 48%, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0) 70%),
    radial-gradient(ellipse 120% 100% at 50% 50%, transparent 60%, rgba(255, 143, 177, 0.28) 100%);
}

/* Screen-reader-only text. */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.icon {
  display: inline-block;
  flex: none;
  width: 1.25em;
  height: 1.25em;
  vertical-align: -0.25em;
  overflow: visible;
}
.icon-lg { width: 1.6em; height: 1.6em; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.noscript {
  position: fixed;
  inset: auto 0 18% 0;
  z-index: 40;
  text-align: center;
  font: 800 18px var(--font-ui);
}

/* ---------- Boot (plain HTML/CSS; main.js removes it) ---------- */

.boot {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
  pointer-events: none;
}
body:not([data-screen="boot"]) .boot { display: none; }

.boot-kitty {
  width: 120px;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 6px 0 rgba(255, 143, 177, 0.55));
  transform-origin: 50% 100%;
  animation: sway 5s ease-in-out infinite;
}

.boot-text {
  max-width: 16em;
  font: 400 clamp(20px, 6vw, 28px)/1.3 var(--font-display);
  color: var(--bow-deep);
  text-shadow: var(--ring);
  text-wrap: balance;
}

/* The reload pill means "nothing is happening", not "this is slow" (a first visit on a slow phone takes a while):
   with no JS at all it fades in after 20 s; once main.js runs it flips html[data-boot-tick] between a and b as each
   file arrives, which restarts an 8 s wait (a new animation name restarts it); html[data-boot="stuck"] shows it now. */
.boot .boot-retry {
  pointer-events: auto;
  opacity: 0;
  visibility: hidden;
  animation: boot-retry 0.4s ease-out 20s forwards;
}
/* index.html marks the pill `hidden` for the unstyled first paint; here the timers above decide */
.boot .boot-retry[hidden] { display: inline-flex !important; }
:root[data-boot-tick="a"] .boot .boot-retry { animation-name: boot-retry-a; animation-delay: 8s; }
:root[data-boot-tick="b"] .boot .boot-retry { animation-name: boot-retry-b; animation-delay: 8s; }
:root[data-boot="stuck"] .boot .boot-retry { animation-name: boot-retry; animation-delay: 0s; }

@keyframes boot-retry {
  from { opacity: 0; visibility: visible; }
  to   { opacity: 1; visibility: visible; }
}
@keyframes boot-retry-a {
  from { opacity: 0; visibility: visible; }
  to   { opacity: 1; visibility: visible; }
}
@keyframes boot-retry-b {
  from { opacity: 0; visibility: visible; }
  to   { opacity: 1; visibility: visible; }
}

/* ---------- Shell layers (SPEC §8.2) ---------- */

#screens { position: relative; z-index: 3; }

.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
}

/* Session chrome: fixed above the session screen only. */
.topbar {
  position: fixed;
  z-index: 12;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--topbar-h) + var(--sat));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--sat) calc(var(--sar) + 12px) 0 calc(var(--sal) + 12px);
  background: linear-gradient(var(--milk) 70%, rgba(255, 227, 236, 0));
}
body:not([data-screen="session"]) .topbar { display: none; }

/* Storage banner (ux 2.6b): under home's sheet-head, never a toast. */
.banner {
  position: fixed;
  z-index: 11;
  top: calc(var(--sat) + var(--head-h));
  left: 0;
  right: 0;
  width: min(var(--inner), calc(100% - 32px));
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 8px 10px 8px 12px;
  font: 800 var(--fs-ui)/1.35 var(--font-ui);
  color: var(--ink);
  background: var(--milk);
  border: 2.5px solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 4px 0 var(--ink);
}
.banner .banner-text { flex: 1 1 180px; min-width: 0; text-wrap: pretty; }
body:not([data-screen="home"]) .banner { display: none; }
.sheet-body > .banner { position: static; width: 100%; max-width: var(--inner); margin: 0 auto 14px; }
:root[data-layout="tablet"] .sheet-body > .banner { max-width: 720px; }
:root[data-layout="desk"] .sheet-body > .banner { max-width: 1120px; }
.sheet-body > .banner[hidden] { display: none !important; }

/* A layer for kitties that float above the screens (ui/app.js decides who lives here). */
.kitty-dock {
  position: fixed;
  inset: 0;
  z-index: 11;
  pointer-events: none;
}
.kitty-dock > * { pointer-events: auto; }

.fx-layer { position: fixed; inset: 0; z-index: 25; overflow: hidden; pointer-events: none; }

/* ---------- Pills, buttons and chips ---------- */

/* from game/public/game/style.css (.pill; the site's #music pill, generalised) */
.pill {
  --drop: 0 3px 0 var(--ink);
  position: relative;
  pointer-events: auto;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--target);
  margin: 0;
  padding: var(--pill-pad);
  font: 800 var(--fs-ui)/1 var(--font-ui);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  box-shadow: var(--drop);
  transition: translate 0.12s, box-shadow 0.12s, background-color 0.15s;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.pill:active { --drop: 0 0 0 var(--ink); translate: 0 3px; }
.pill[aria-pressed="true"] { background: var(--pink); }
.pill.round { width: var(--target); height: var(--target); min-width: var(--target); padding: 0; font-size: 18px; flex: none; }
.pill.small { padding: 6px 13px 7px; font-size: calc(13px * var(--k-ui)); }
.pill.pill-pink { background: var(--pink); }
.pill .glyph { font-size: 17px; line-height: 1; }
.pill .icon { width: 20px; height: 20px; }
.pill.round .icon { width: 22px; height: 22px; }

@media (hover: hover) {
  .pill:hover { --drop: 0 4px 0 var(--ink); translate: 0 -1px; }
  .pill:active { --drop: 0 0 0 var(--ink); translate: 0 3px; }
  .pill:not([aria-pressed="true"]):not(.pill-pink):hover { background: #fff5f8; }
}

/* Disabled stays focusable (aria-disabled), reads as pressed-in (ux 1.3). */
.pill[aria-disabled="true"],
.btn-primary[aria-disabled="true"],
.chip[aria-disabled="true"] {
  --drop: 0 0 #0000;
  opacity: 0.5;
  translate: 0 3px;
  cursor: default;
}

/* from game/public/game/style.css (.btn-primary: candy-red, the one next step of a screen) */
.btn-primary {
  --drop: 0 5px 0 var(--ink);
  position: relative;
  pointer-events: auto;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 240px;
  height: 64px;
  margin: 0;
  padding: 0 28px 3px;
  font: 400 calc(24px * var(--k-option)) / 1 var(--font-display);
  color: var(--white);
  text-decoration: none;
  white-space: nowrap;
  background: var(--bow);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: var(--drop);
  text-shadow: 0 2px 0 rgba(91, 42, 60, 0.3);
  transition: translate 0.12s, box-shadow 0.12s, background-color 0.15s;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

/* A little gloss so it looks like a sweet. */
.btn-primary::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 20px;
  width: 22px;
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.55);
  rotate: -12deg;
}

.btn-primary:active { --drop: 0 0 0 var(--ink); translate: 0 5px; }
.btn-primary:focus-visible { outline-offset: 4px; }
@media (hover: hover) {
  .btn-primary:hover { background: #ef4a60; }
}

.btn-wide { min-width: 0; width: 100%; max-width: 340px; font-size: calc(24px * var(--k-option)); } /* white on bow: never under 24 px (§10.2.7) */
.jelly-loop { animation: jelly-loop 3s ease-in-out 1.2s infinite; }

/* from game/public/game/style.css (.chip: an inline toggle, role=switch) */
.chip {
  --drop: 0 3px 0 var(--ink);
  pointer-events: auto;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--target);
  margin: 0;
  padding: 0 16px 1px 12px;
  font: 800 var(--fs-ui)/1 var(--font-ui);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.78);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  box-shadow: var(--drop);
  transition: translate 0.12s, box-shadow 0.12s, background-color 0.15s;
  touch-action: manipulation;
}

.chip[role="switch"]::before {
  content: "";
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2.5px solid var(--ink);
  background: var(--white);
  transition: background-color 0.15s;
}

.chip[aria-checked="true"] { background: #e3f4ff; }
.chip[aria-checked="true"]::before { background: var(--bow); box-shadow: inset 0 0 0 2.5px var(--white); }
.chip:active { --drop: 0 0 0 var(--ink); translate: 0 3px; }
.chip.is-due { background: var(--due); }

/* learn: the beat is opt-in (.beat-loop), so a page of dots never breaks the 2-loop budget (ux 1.4). */
.new-dot {
  position: absolute;
  top: -8px;
  right: 8px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--bow);
  border: 2.5px solid var(--white);
  box-shadow: 0 0 0 2px var(--ink);
}
.beat-loop { animation: beat 1.1s ease-in-out infinite; }

.sticker-text { color: var(--bow-deep); text-shadow: var(--ring); }

.count-chip {
  padding: 7px 12px 8px;
  font: 800 calc(13px * var(--k-ui))/1 var(--font-ui);
  white-space: nowrap;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--ink);
}

/* ---------- Cards ---------- */

/* from game/public/game/style.css (.card; ux 1.1: radius 24, 2.5px ink border, 4px ink drop) */
.card {
  --drop: 0 4px 0 var(--ink);
  position: relative;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: var(--radius-card);
  box-shadow: var(--drop);
}

.card-x { position: absolute; top: 12px; right: 12px; }

.card-title {
  margin: 0;
  font: 400 calc(22px * var(--k-title))/1.15 var(--font-display);
}

/* ---------- Sheets ---------- */

/* from game/public/game/style.css (.sheet, .sheet-head, .sheet-body, .sheet-inner) */
.sheet {
  display: flex;
  flex-direction: column;
  background-color: var(--milk);
  background-image:
    radial-gradient(ellipse 80% 45% at 50% 20%, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0) 70%),
    linear-gradient(90deg, var(--gingham) 50%, transparent 50%),
    linear-gradient(var(--gingham) 50%, transparent 50%);
  background-size: 100% 100%, 46px 46px, 46px 46px;
  animation: fade-in 0.2s ease-out backwards;
}

.sheet-head {
  flex: none;
  display: grid;
  grid-template-columns: var(--target) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: calc(var(--inner) + 40px);
  min-height: calc(var(--head-h) + var(--sat));
  margin: 0 auto;
  padding: calc(var(--sat) + 12px) calc(var(--sar) + 14px) 10px calc(var(--sal) + 14px);
}

.sheet-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font: 400 clamp(20px, 6.4vw, var(--fs-title))/1.35 var(--font-display);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
  /* the clamp clips at the padding edge, and a clamped third line is still painted under it. Mochiy's glyphs
     overhang a tight line box, so at 1.35 there is a band between line 2's descenders (g, p, y, with their
     sticker ring and drop) and the tops of line 3 (l, d, 2, with their ring): the bottom padding ends in it.
     The negative block margins keep a one-line title's box the size it had at 1.15. */
  padding: 0 0.1em 0.15em;
  margin: -0.055em -0.1em;
}
:root[data-layout="phone"] .sheet-title { font-size: clamp(19px, 5.6vw, var(--fs-title)); }
.home-head .sheet-title { text-wrap: balance; overflow-wrap: normal; }

.sheet-body {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 6px calc(var(--sar) + 16px) calc(var(--sab) + 28px) calc(var(--sal) + 16px);
}

.sheet-inner {
  max-width: var(--inner);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: rise-in 0.35s ease-out backwards;
}

.sheet-hint {
  font: 800 calc(13px * var(--k-small))/1.4 var(--font-ui);
  color: var(--ink-soft);
  text-align: center;
  text-wrap: pretty;
}

.section-title {
  font: 400 calc(20px * var(--k-title))/1.2 var(--font-display);
  color: var(--bow-deep);
  text-shadow: var(--ring);
}

:root[data-short="true"] .sheet-head { padding-top: calc(var(--sat) + 6px); padding-bottom: 6px; }

/* from game/public/game/style.css (.tabs, .tab: WAI-ARIA tabs) */
.tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--ink);
}

.tab {
  flex: 1;
  min-height: var(--target);
  margin: 0;
  padding: 0 8px 1px;
  font: 800 var(--fs-ui)/1 var(--font-ui);
  color: var(--ink-soft);
  white-space: nowrap;
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.15s, color 0.15s;
}

.tab[aria-selected="true"] { color: var(--ink); background: var(--pink); box-shadow: inset 0 0 0 2px var(--ink); }
.tab:focus-visible { outline-offset: 2px; }
.tab small { font-weight: 800; opacity: 0.7; }

/* ---------- Settings rows: switch, seg, hold ---------- */

/* from game/public/game/style.css (.set-card, .set-row, .set-label, .switch, .seg, .hold, .set-foot) */
.set-card {
  padding: 2px 16px;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: var(--radius-card);
  box-shadow: 0 4px 0 var(--ink);
}

.set-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  min-height: 66px;
  padding: 10px 0;
}

.set-row + .set-row { border-top: 2px dashed var(--dash); }

.set-label {
  display: flex;
  flex-direction: column;
  flex: 1 1 140px;
  min-width: 0;
  font: 800 calc(15px * var(--k-ui))/1.2 var(--font-ui);
  color: var(--ink);
}

.set-label small { margin-top: 3px; font: 500 var(--fs-small)/1.3 var(--font-ui); color: var(--ink-soft); }

.switch {
  --drop: 0 3px 0 var(--ink);
  position: relative;
  flex: none;
  width: 72px;
  height: var(--target);
  margin: 0;
  padding: 0;
  cursor: pointer;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  box-shadow: var(--drop);
  touch-action: manipulation;
  transition: background-color 0.2s, translate 0.12s, box-shadow 0.12s;
}

.switch::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 4px;
  width: 32px;
  height: 32px;
  margin-top: -16px;
  border-radius: 50%;
  background: var(--white);
  border: 2.5px solid var(--ink);
  transition: translate 0.3s var(--boing);
}

.switch[aria-checked="true"] { background: var(--pink); }
.switch[aria-checked="true"]::after { translate: 27px 0; }
.switch:active { --drop: 0 0 0 var(--ink); translate: 0 3px; }

/* learn: 8 px between neighbouring options (ux 7.6, small fingers), inside the one pill */
.seg {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  gap: 8px;
  padding: 3px;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: calc(var(--target) / 2 + 6px);   /* a pill on one row, a soft card if a narrow screen wraps it */
  box-shadow: 0 3px 0 var(--ink);
}

.seg button {
  min-width: 60px;
  min-height: var(--target);
  margin: 0;
  padding: 0 10px 1px;
  font: 800 calc(13px * var(--k-ui))/1 var(--font-ui);
  color: var(--ink-soft);
  background: none;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
}

.seg button[aria-checked="true"] { color: var(--ink); background: var(--pink); box-shadow: inset 0 0 0 2px var(--ink); }
.seg button:focus-visible { outline-offset: 2px; }

.hold {
  --drop: 0 3px 0 var(--ink);
  position: relative;
  flex: none;
  overflow: hidden;
  min-height: var(--target);
  margin: 0;
  padding: 0 18px 1px;
  font: 800 var(--fs-ui)/1 var(--font-ui);
  color: var(--bow-deep);
  white-space: nowrap;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  box-shadow: var(--drop);
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.hold-fill {
  position: absolute;
  inset: 0;
  background: var(--pink);
  transform-origin: 0 50%;
  transform: scaleX(0);
  transition: transform 0.25s ease;
}

.hold.holding .hold-fill { transform: scaleX(1); transition: transform 2s linear; }
.hold-text { position: relative; }

.set-foot { font: 800 var(--fs-small)/1.4 var(--font-ui); color: var(--ink-soft); text-align: center; }

/* ---------- Modal ---------- */

/* from game/public/game/style.css (.modal, .modal-back, .modal-card, .modal-x) */
.modal {
  position: fixed;
  inset: 0;
  z-index: 15;
  display: grid;
  place-items: center;
  padding: calc(var(--sat) + 20px) 20px calc(var(--sab) + 20px);
}

.modal-back { position: absolute; inset: 0; background: rgba(255, 214, 228, 0.8); animation: fade-in 0.2s ease-out backwards; }

.modal-card {
  position: relative;
  width: min(360px, 100%);
  max-height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 22px 24px;
  text-align: center;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 28px;
  box-shadow: 0 6px 0 var(--ink);
  animation: modal-in 0.45s var(--boing) backwards;
}

/* learn: the modal rises with a boing but never scales, so its targets measure true while it lands */
@keyframes modal-in {
  0%   { transform: translateY(46px); opacity: 0; }
  60%  { transform: translateY(-6px); opacity: 1; }
  100% { transform: none; opacity: 1; }
}

.modal-x { position: absolute; top: 10px; right: 10px; }
.modal-title { font: 400 calc(24px * var(--k-title))/1.2 var(--font-display); color: var(--bow-deep); text-shadow: var(--ring); }
.modal-text { font: 800 var(--fs-body)/var(--lh-body) var(--font-ui); text-wrap: pretty; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 6px; }

/* ---------- Toast (ux 4.10): always in the DOM, shown by class, never [hidden] ---------- */

/* from game/public/game/style.css (.toast) */
.toast {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: calc(var(--sab) + 28px);
  width: max-content;
  max-width: calc(100vw - 32px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px 9px;
  font: 800 var(--fs-ui)/1.3 var(--font-ui);
  color: var(--ink);
  text-align: center;
  text-wrap: pretty;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--ink);
  pointer-events: none;
  opacity: 0;
  transform: translateY(18px) scale(0.85);
  transition: opacity 0.25s ease, transform 0.4s var(--boing);
}
.toast:empty { padding: 0; border-width: 0; }
.toast.is-on { opacity: 1; transform: none; }
body[data-screen="session"] .toast { bottom: calc(var(--sab) + var(--tray-h) + 28px); }
/* desk: under the right rail (680 + 32 + 320 px grid, centred), never over the answer area or its tray */
:root[data-layout="desk"]:not([data-short="true"]) body[data-screen="session"] .toast {
  bottom: calc(var(--sab) + 28px); left: calc((100vw - 1032px) / 2 + 872px); right: auto; max-width: 320px; margin: 0; translate: -50% 0;
}
/* desk results: under the kitty's column (820 px row: 272 px side, 28 px gap, the 520 px card), clear of the card */
:root[data-layout="desk"]:not([data-short="true"]) body[data-screen="results"] .toast {
  left: calc((100vw - 820px) / 2 + 136px); right: auto; max-width: 264px; margin: 0; translate: -50% 0;
}

/* ---------- Coach hand (from game/public/game/style.css) ---------- */

.coach {
  position: fixed;
  z-index: 7;
  pointer-events: none;
  translate: -50% -50%;
}

.coach-hand {
  display: block;
  width: 34px;
  height: 34px;
}

/* ---------- The kitty (ui/kitty.js; the site's #kitty) ---------- */

.kitty {
  --kitty: 96px;
  position: relative;
  flex: none;
  display: inline-block;
  width: var(--kitty);
  height: calc(var(--kitty) * 0.85);
  margin: 0;
  padding: 0;
  color: var(--ink);
  background: none;
  border: 0;
  border-radius: 40%;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.kitty[aria-hidden="true"] { cursor: default; }
/* a tappable kitty is a full 44 px (52 in big letters) target even with a small face (the short strip's 40 px head):
   the box grows round the face and negative margins keep its footprint, so the strip never grows */
.kitty:not([aria-hidden="true"]) {
  display: inline-grid;
  place-items: center;
  min-width: var(--target);
  min-height: var(--target);
  margin: min(0px, calc((var(--kitty) * 0.85 - var(--target)) / 2)) min(0px, calc((var(--kitty) - var(--target)) / 2));
}
.kitty:not([aria-hidden="true"]) > .kitty-svg { width: var(--kitty); height: calc(var(--kitty) * 0.85); }
.kitty:not([aria-hidden="true"])::after { content: ""; position: absolute; inset: 0; border-radius: 50%; }

/* from public/style.css (#kitty) */
.kitty-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 calc(var(--kitty) * 0.045) 0 rgba(255, 143, 177, 0.55));
  transform-origin: 50% 100%;
  transition: rotate 0.3s var(--boing), translate 0.3s var(--boing), scale 0.3s var(--boing);
}
.kitty.is-sway .kitty-svg { animation: sway 5s ease-in-out infinite; }

.kitty-svg .k-ear { transform-box: fill-box; transform-origin: 50% 85%; }
.kitty-svg .k-eyes-open { transform-box: fill-box; transform-origin: center; transition: scale 0.2s var(--boing), translate 0.25s ease; }
.kitty-svg .k-look { transition: translate 0.25s ease-out; }
.kitty-svg .k-bow { transform-box: fill-box; transform-origin: 50% 60%; transition: rotate 0.3s var(--boing); }
.kitty-svg .k-sparkles path { transform-box: fill-box; transform-origin: center; }
.kitty-svg .k-paws { transform-box: fill-box; transform-origin: 50% 100%; }

/* Faces: one set of eyes and one mouth at a time. */
.kitty-svg .k-eyes-happy,
.kitty-svg .k-eyes-sleep,
.kitty-svg .k-eyes-star,
.kitty-svg .k-mouth-o,
.kitty-svg .k-mouth-grin,
.kitty-svg .k-mouth-hmm,
.kitty-svg .k-paws,
.kitty-svg .k-sparkles,
.kitty-svg .k-zz { display: none; }

.kitty.is-legend .k-sparkles { display: inline; }

.kitty[data-pose="think"] .kitty-svg { rotate: -6deg; }
.kitty[data-pose="think"] .k-eyes-open { translate: -3px -5px; }
.kitty[data-pose="think"] .k-mouth-smile { display: none; }
.kitty[data-pose="think"] .k-mouth-hmm { display: inline; }

.kitty[data-pose="lean"] .kitty-svg { rotate: calc(8deg * var(--face, 1)); translate: calc(var(--kitty) * 0.06 * var(--face, 1)) calc(var(--kitty) * 0.02); }
.kitty[data-pose="lean"] .k-eyes-open { translate: calc(5px * var(--face, 1)) 1px; scale: 1.08; }

.kitty[data-pose="gasp"] .k-eyes-open { scale: 1.2; }
.kitty[data-pose="gasp"] .k-mouth-smile,
.kitty[data-pose="gasp_big"] .k-mouth-smile { display: none; }
.kitty[data-pose="gasp"] .k-mouth-o,
.kitty[data-pose="gasp_big"] .k-mouth-o,
.kitty[data-pose="gasp"] .k-paws,
.kitty[data-pose="gasp_big"] .k-paws { display: inline; }
.kitty[data-pose="gasp_big"] .k-eyes-open { display: none; }
.kitty[data-pose="gasp_big"] .k-eyes-star { display: inline; }
.kitty[data-pose="gasp_big"] .kitty-svg { scale: 1.06; }

.kitty[data-pose="happy"] .k-eyes-open,
.kitty[data-pose="twirl"] .k-eyes-open,
.kitty[data-pose="bow"] .k-eyes-open { display: none; }
.kitty[data-pose="happy"] .k-eyes-happy,
.kitty[data-pose="twirl"] .k-eyes-happy,
.kitty[data-pose="bow"] .k-eyes-happy { display: inline; }
.kitty[data-pose="happy"] .k-mouth-smile,
.kitty[data-pose="twirl"] .k-mouth-smile { display: none; }
.kitty[data-pose="happy"] .k-mouth-grin,
.kitty[data-pose="twirl"] .k-mouth-grin { display: inline; }

.kitty[data-pose="bow"] .kitty-svg { translate: 0 calc(var(--kitty) * 0.06); scale: 1.03 0.94; }
.kitty[data-pose="bow"] .k-bow { rotate: 14deg; }

.kitty[data-pose="sleepy"] .k-eyes-open { display: none; }
.kitty[data-pose="sleepy"] .k-eyes-sleep,
.kitty[data-pose="sleepy"] .k-zz { display: inline; }

/* The bubble she talks into (from game/public/game/style.css .bubble; the site's tail). */
.kitty-friend {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.bubble {
  position: relative;
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 340px;
  min-height: 2.6em;
  padding: 10px 15px 11px;
  display: flex;
  align-items: center;
  font: 800 clamp(14px, 1.5vw, 16px)/1.45 var(--font-ui);
  color: var(--ink);
  text-wrap: pretty;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 22px;
  box-shadow: 0 4px 0 var(--ink);
  transition: opacity 0.35s ease;
}
:root[data-big="true"] .bubble { font-size: 18px; min-height: 3em; }
.bubble .ghost { visibility: hidden; }

/* speech.js quiets the bubble between lines in a session. */
.bubble.quiet { opacity: 0; }

/* Tail pointing back at the kitty (row: she is on the left). */
.bubble::before,
.bubble::after {
  content: "";
  position: absolute;
  top: 50%;
  border-style: solid;
}

.bubble::before {
  left: -16px;
  margin-top: -10px;
  border-width: 10px 16px 10px 0;
  border-color: transparent var(--ink) transparent transparent;
}

.bubble::after {
  left: -11px;
  margin-top: -7px;
  border-width: 7px 12px 7px 0;
  border-color: transparent var(--white) transparent transparent;
}

/* She is on the right: the tail points right. */
.kitty-friend[data-bubble="row-rev"] { flex-direction: row-reverse; }
.kitty-friend[data-bubble="row-rev"] .bubble::before { left: auto; right: -16px; border-width: 10px 0 10px 16px; border-color: transparent transparent transparent var(--ink); }
.kitty-friend[data-bubble="row-rev"] .bubble::after { left: auto; right: -11px; border-width: 7px 0 7px 12px; border-color: transparent transparent transparent var(--white); }

/* Stacked under her: the tail points up (the site's phone style). */
.kitty-friend[data-bubble="stack"] { flex-direction: column; gap: 16px; }
.kitty-friend[data-bubble="stack"] .bubble { width: min(320px, 100%); justify-content: center; text-align: center; }
.kitty-friend[data-bubble="stack"] .bubble::before { left: 50%; top: -16px; margin: 0 0 0 -10px; border-width: 0 10px 16px 10px; border-color: transparent transparent var(--ink) transparent; }
.kitty-friend[data-bubble="stack"] .bubble::after { left: 50%; top: -11px; margin: 0 0 0 -7px; border-width: 0 7px 12px 7px; border-color: transparent transparent var(--white) transparent; }

/* Above her: the tail points down. */
.kitty-friend[data-bubble="over"] { flex-direction: column-reverse; gap: 16px; }
.kitty-friend[data-bubble="over"] .bubble { width: min(320px, 100%); justify-content: center; text-align: center; }
.kitty-friend[data-bubble="over"] .bubble::before { left: 50%; top: auto; bottom: -16px; margin: 0 0 0 -10px; border-width: 16px 10px 0 10px; border-color: var(--ink) transparent transparent transparent; }
.kitty-friend[data-bubble="over"] .bubble::after { left: 50%; top: auto; bottom: -11px; margin: 0 0 0 -7px; border-width: 12px 7px 0 7px; border-color: var(--white) transparent transparent transparent; }

/* Hearts when she is booped (from game/public/game/style.css .heart-pop). */
.heart-pop {
  position: absolute;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  animation: heart-fly 0.95s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}

/* ---------- Keyframes ---------- */

/* from game/public/game/style.css (site and game keyframes) */
@keyframes pop {
  from { transform: translateY(0.4em) scale(0.2); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

@keyframes jelly {
  0%, 100% { transform: none; }
  25%      { transform: scale(1.18, 0.86) rotate(-4deg); }
  50%      { transform: scale(0.9, 1.12) rotate(3deg); }
  75%      { transform: scale(1.05, 0.96); }
}

@keyframes boing {
  0%   { transform: translateY(0) scale(1, 1); }
  30%  { transform: translateY(-18px) scale(0.94, 1.08); }
  60%  { transform: translateY(0) scale(1.08, 0.92); }
  100% { transform: translateY(0) scale(1, 1); }
}

@keyframes sway {
  0%, 100% { transform: rotate(-3deg); }
  50%      { transform: rotate(3deg); }
}

@keyframes blink {
  0%, 94%, 100% { transform: scaleY(1); }
  96%           { transform: scaleY(0.1); }
}

@keyframes wiggle {
  0%, 80%, 100% { transform: rotate(0); }
  85%           { transform: rotate(-9deg); }
  90%           { transform: rotate(7deg); }
  95%           { transform: rotate(-4deg); }
}

@keyframes beat {
  0%, 60%, 100% { transform: scale(1); }
  15%           { transform: scale(1.35); }
  30%           { transform: scale(1.05); }
  45%           { transform: scale(1.25); }
}

@keyframes jelly-loop {
  0%, 76%, 100% { transform: none; }
  81%           { transform: scale(1.1, 0.9) rotate(-2deg); }
  87%           { transform: scale(0.94, 1.07) rotate(1.5deg); }
  93%           { transform: scale(1.03, 0.98); }
}

@keyframes card-in {
  0%   { transform: translateY(46px) scale(0.6); opacity: 0; }
  55%  { transform: translateY(-6px) scale(1.04); opacity: 1; }
  100% { transform: none; opacity: 1; }
}

@keyframes rise-in {
  from { transform: translateY(14px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes stamp {
  0%   { transform: scale(2.6); opacity: 0; }
  50%  { opacity: 1; }
  100% { transform: none; opacity: 1; }
}

@keyframes chip-in {
  from { transform: scale(0.3); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

@keyframes heart-fly {
  0%   { transform: translate(0, 0) scale(0.3) rotate(0deg); opacity: 1; }
  70%  { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1) rotate(var(--rot)); opacity: 0; }
}

@keyframes twinkle {
  0%, 100% { transform: scale(0.7) rotate(0deg); opacity: 0.5; }
  50%      { transform: scale(1.15) rotate(20deg); opacity: 1; }
}

/* A hidden page rests every loop (ux 1.4). */
:root[data-hidden="true"] *, :root[data-hidden="true"] *::before, :root[data-hidden="true"] *::after { animation-play-state: paused !important; }

/* ---------- Calm motion (ux 1.4: nothing loops, nothing lasts more than 0.4 s) ---------- */

/* from game/public/game/style.css (calm), plus learn's short fades */
:root[data-motion="calm"] *,
:root[data-motion="calm"] *::before,
:root[data-motion="calm"] *::after {
  animation-duration: 0.001ms !important;
  animation-delay: 0s !important;
  animation-iteration-count: 1 !important;
  animation-fill-mode: backwards !important;   /* a finished animation never lingers in getAnimations() (e2e #13) */
  transition-duration: 0s !important;           /* instant; the few calm fades below opt back in */
  transition-delay: 0s !important;
}
:root[data-motion="calm"] .bubble { transition: opacity 0.15s ease !important; }

:root[data-motion="calm"] .sheet,
:root[data-motion="calm"] .sheet-inner,
:root[data-motion="calm"] .modal-back,
:root[data-motion="calm"] .modal-card { animation: fade-in 0.15s ease-out backwards !important; }
:root[data-motion="calm"] .toast { transform: none; transition: opacity 0.15s ease !important; }
/* The hold gate's fill is the timer itself (2 s), not decoration. */
:root[data-motion="calm"] .hold.holding .hold-fill { transition-duration: 2s !important; }

@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion]) *,
  :root:not([data-motion]) *::before,
  :root:not([data-motion]) *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
  }
  /* The reload pill still waits (20 s, or 8 s from the last file that arrived) before it shows. */
  :root:not([data-motion]) .boot .boot-retry { animation: boot-retry 0.15s ease-out 20s forwards !important; }
  :root:not([data-motion])[data-boot-tick="a"] .boot .boot-retry { animation: boot-retry-a 0.15s ease-out 8s forwards !important; }
  :root:not([data-motion])[data-boot-tick="b"] .boot .boot-retry { animation: boot-retry-b 0.15s ease-out 8s forwards !important; }
  :root:not([data-motion])[data-boot="stuck"] .boot .boot-retry { animation: boot-retry 0.15s ease-out 0s forwards !important; }
}

/* =====================================================================================================
   learn: the screens (ux 5.x) and the shared components (ux 4.x). Tiers: phone / tablet / desk, + short.
   ===================================================================================================== */

/* ---------- shared bits ---------- */

.sheet-inner.wide { max-width: min(1120px, 100%); }
:root[data-layout="desk"] .sheet-inner.wide { max-width: 1120px; }
.head-aux { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: var(--target); }
.head-spacer { width: var(--target); }
.head-back { justify-self: start; }
.head-site { justify-self: start; padding: 0 12px; }
:root[data-layout="phone"] .head-site { width: var(--target); padding: 0; }
.head-album.has-new::after { content: ""; position: absolute; top: -5px; right: -3px; width: 13px; height: 13px; border-radius: 50%; background: var(--bow); border: 2.5px solid var(--white); box-shadow: 0 0 0 2px var(--ink); }
:root[data-layout="phone"] .head-album { width: var(--target); padding: 0; }
.home-head { grid-template-columns: auto minmax(0, 1fr) auto; }
:root[data-layout="desk"] .sheet-head { max-width: 1160px; }
:root[data-layout="tablet"] .sheet-head { max-width: 760px; }
.home-head .sheet-title { text-align: center; }
:root[data-layout="phone"] .home-head .sheet-title { font-size: calc(22px * var(--k-title)); }
/* big letters: the 52px head pills leave the title less room, so it keeps its phone size (the pills grow instead) */
:root[data-layout="phone"][data-big="true"] .home-head .sheet-title { font-size: clamp(17px, 5.2vw, 22px); }

.tag-mini {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px 1px;
  font: 800 calc(11px * var(--k-small))/1 var(--font-ui); color: var(--ink);
  background: var(--white); border: 2px solid var(--ink); border-radius: 999px; white-space: nowrap;
}
.tag-mini.is-due { background: var(--due); }
.ribbon-stretch {
  display: inline-flex; align-items: center; height: 20px; padding: 0 9px 1px 8px;
  font: 800 calc(11px * var(--k-small))/1 var(--font-ui); color: var(--ink); white-space: nowrap;
  background: var(--lavender); border: 2px solid var(--ink); border-radius: 4px 999px 999px 4px;
}
.dot-new { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--bow); border: 2px solid var(--white); box-shadow: 0 0 0 2px var(--ink); }

.sticker { display: block; flex: none; }
.sticker-fallback { width: var(--size, 40px); height: var(--size, 40px); display: grid; place-items: center; }
.sticker-fallback .icon { width: 80%; height: 80%; }

.kitty-face { width: 28px; height: auto; flex: none; }
.drawn-later { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 28px 20px; text-align: center; }
.drawn-kitty { width: 110px; height: auto; }

/* The peek spot (album, report, settings, print): a 28px decorative kitty whose bubble reads like the sheet hint. */
.peek-spot { display: flex; justify-content: center; min-height: 34px; }
.peek-kitty .bubble {
  min-height: 0; padding: 2px 0 0; max-width: 32em;
  font: 800 calc(13px * var(--k-small))/1.4 var(--font-ui); color: var(--ink-soft);
  background: none; border: 0; box-shadow: none;
}
.peek-kitty .bubble::before, .peek-kitty .bubble::after { display: none; }
.peek-kitty.kitty-friend { gap: 8px; }
.peek-kitty .kitty-svg { filter: none; }

/* The read-aloud pill: arcs ripple while speaking (calm: a filled dot). */
.listen .listen-icon { width: 22px; height: 22px; }
.listen[aria-pressed="true"] { background: var(--mint-soft); }
.listen[aria-pressed="true"] .listen-icon { animation: listen-arcs 0.9s ease-in-out infinite; }
:root[data-motion="calm"] .listen[aria-pressed="true"]::after { content: ""; position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--bow); }
.listen.nudge { animation: listen-nudge 1.2s var(--boing) 0.6s 1 backwards; }
:root[data-motion="calm"] .listen.nudge { box-shadow: 0 0 0 3px var(--white), 0 0 0 6px var(--nose), var(--drop); }
@keyframes listen-arcs { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@keyframes listen-nudge { 0%, 100% { transform: none; } 30% { transform: scale(1.14); } 60% { transform: scale(0.96); } }

/* ---------- the coach hand (ux 5.0): a ghost heart that bobs at the hero pill a few times ---------- */

.hero-wrap { position: relative; display: flex; justify-content: center; }
.hero .coach { position: absolute; z-index: 2; right: 5%; bottom: -20px; translate: none; pointer-events: none; }
.coach-hand { width: 40px; height: 40px; filter: drop-shadow(0 3px 0 rgba(91, 42, 60, 0.35)); animation: coach-bob 1.1s ease-in-out 8; }
@keyframes coach-bob { 0%, 100% { transform: translate(0, 0) rotate(-12deg); } 50% { transform: translate(-8px, -10px) rotate(-18deg); } }

/* ---------- home (ux 5.1) ---------- */

.home-grid { display: flex; flex-direction: column; gap: 14px; max-width: var(--inner); }
.h-subjects { display: flex; flex-direction: column; gap: 10px; }
.home-foot { display: flex; flex-direction: column; align-items: center; gap: 12px; padding-top: 6px; }
.foot-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.home-grid.is-fresh { animation: fade-in 0.3s ease-out backwards; }

.h-kitty .kitty-friend { justify-content: flex-start; }
.home-kitty .bubble { min-height: 2.6em; max-width: none; }
.hero { white-space: normal; height: auto; min-height: 64px; max-width: 420px; padding: 10px 26px 12px; font-size: calc(24px * var(--k-option)); line-height: 1.15; text-align: center; }
.hero-label { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
:root:not([data-layout="phone"]) .hero { font-size: calc(26px * var(--k-option)); }

.home-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.home-chips .chip { text-decoration: none; }
.chip.dust.is-wish { background: var(--nose); }
.album-chip.has-new { background: #fff5f8; }
.streak .streak-moons { display: inline-flex; gap: 1px; }
.streak .streak-moons .icon { width: 17px; height: 17px; }
.streak .streak-today { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--mint); border: 2px solid var(--ink); }
.streak .streak-today .icon { width: 13px; height: 13px; }
.streak.is-zero { background: var(--white); }
.sound-pill .icon { width: 18px; height: 18px; }

.banner-inner { display: contents; }
.banner-kitty { width: 34px; height: auto; flex: none; }

/* the streak modal */
.streak-body { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.streak-big { font: 400 calc(30px * var(--k-title))/1 var(--font-display); color: var(--bow-deep); text-shadow: var(--ring); }
.streak-best { font: 800 var(--fs-ui)/1.2 var(--font-ui); color: var(--ink-soft); }
.streak-dots { display: flex; gap: 8px; padding: 4px 0; }
.streak-dot { width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--white); }
.streak-dot.on { background: var(--pink); }
.streak-dot.today { box-shadow: 0 0 0 3px var(--white), 0 0 0 5px var(--bow); }
.streak-rest { display: flex; align-items: center; gap: 4px; font: 800 var(--fs-ui)/1.2 var(--font-ui); }
.streak-rest .icon { width: 18px; height: 18px; }
.modal-text.small, .modal-text .small, p.small { font-size: var(--fs-small); color: var(--ink-soft); font-weight: 800; }

/* ---------- the sparks meter + the pack cap (ux 4.1) ---------- */

.meter-wrap { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; }
.meter { position: relative; flex: 1; min-width: 0; }
.meter-track {
  position: relative; height: 44px; overflow: hidden;
  background: var(--white); border: 2.5px solid var(--ink); border-radius: 999px; box-shadow: 0 3px 0 var(--ink);
}
.meter-fill, .meter-edge {
  position: absolute; inset: 3px; border-radius: 999px;
  transform-origin: 0 50%;
  transition: transform 0.35s ease-out;
}
.meter-fill {
  transform: scaleX(var(--p, 0));
  background-color: var(--pink);
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, 0.22) 50%, transparent 50%),
    linear-gradient(rgba(255, 255, 255, 0.22) 50%, transparent 50%),
    linear-gradient(90deg, var(--pink), var(--bow-pink));
  background-size: 16px 16px, 16px 16px, 100% 100%;
}
.meter-edge { transform: translateX(calc((var(--p, 0) - 1) * 100%)); background: none; }
.meter-wrap.is-empty .meter-star { opacity: 0; }
.meter-star {
  position: absolute; right: 2px; top: 50%; translate: 0 -50%; transition: opacity 0.2s;
  font: 400 18px/1 var(--font-display); color: var(--white);
  text-shadow: 0 0 2px var(--ink), 0 0 2px var(--ink), 0 1px 0 var(--ink);
}
.meter-shine { position: absolute; left: 14px; right: 30%; top: 7px; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.5); pointer-events: none; }
.meter-label {
  position: absolute; left: 16px; top: 50%; translate: 0 -50%;
  font: 800 var(--fs-ui)/1 var(--font-ui); color: var(--ink); white-space: nowrap;
  text-shadow: var(--ring-lite); pointer-events: none;
}
.meter-label b { font-size: 1.15em; }
.meter-wrap.flash .meter-fill { animation: meter-flash 0.2s ease-out 1 backwards; }
.meter-wrap.restart .meter-fill, .meter-wrap.restart .meter-edge { transition: none; }
@keyframes meter-flash { 0% { opacity: 1; } 50% { opacity: 0.4; } 100% { opacity: 1; } }
:root[data-motion="calm"] .meter-fill, :root[data-motion="calm"] .meter-edge { transition-duration: 0.2s !important; }

.meter-wrap.mini { width: auto; gap: 6px; }
.meter.mini { width: clamp(96px, 30vw, 150px); flex: none; }
.meter.mini .meter-track { height: 28px; box-shadow: 0 2px 0 var(--ink); }
.meter.mini .meter-shine { top: 4px; height: 4px; }
.meter.mini .meter-star { font-size: 13px; }
.meter.mini .meter-label { left: 10px; font-size: calc(12px * var(--k-small)); }
.meter-dot { position: absolute; top: -6px; right: -4px; width: 14px; height: 14px; border-radius: 50%; background: var(--nose); border: 2.5px solid var(--ink); }
.meter-chips { position: absolute; top: calc(100% + 2px); right: 0; display: flex; gap: 4px; pointer-events: none; }
.meter-chip { padding: 2px 8px 3px; font: 800 var(--fs-small)/1 var(--font-ui); color: var(--ink); background: var(--milk); border: 2px solid var(--ink); border-radius: 999px; white-space: nowrap; }
/* a sleepy / resting chip stacks under the meter inside the 56 px bar, clear of the kitty strip's bubble (ux 5.4) */
:root:not([data-short="true"]) .topbar-right:has(.meter-chip) { translate: 0 -10px; }
:root[data-big="true"] .meter-chip { padding-block: 1px 2px; }
/* short landscape: the bubble strip sits right under the bar, so the chip takes its own slot left of the meter */
:root[data-short="true"] .meter-wrap.mini .meter-chips { top: 50%; right: calc(100% + 8px); translate: 0 -50%; }

.pack-cap {
  --drop: 0 3px 0 var(--ink);
  position: relative; flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--ink); text-decoration: none; border-radius: 16px;
}
.cap-pouch {
  position: relative; display: grid; place-items: center; width: 52px; height: 62px;
  filter: drop-shadow(0 3px 0 var(--ink));
  animation: wiggle 3s ease-in-out infinite;
}
.cap-art { display: block; width: 44px; height: 57px; }
.cap-art .pack-sprite { width: 44px; height: 57px; }
.cap-count { top: -8px; right: -8px; width: auto; height: auto; min-width: 22px; padding: 1px 5px; font: 800 11px/1.2 var(--font-ui); color: var(--white); text-align: center; background: var(--bow-deep); border-radius: 999px; } /* white on bow-deep 6.9:1 */
.cap-label { font: 800 calc(12px * var(--k-small))/1 var(--font-ui); white-space: nowrap; }

/* ---------- plan card + challenge card (ux 4.3) ---------- */

.card.plan, .card.challenge { padding: 16px 16px 14px; }
.card.plan .card-title, .card.challenge .card-title { font-size: calc(20px * var(--k-title)); }
.plan-date { margin-top: 2px; font: 800 var(--fs-small)/1.3 var(--font-ui); color: var(--ink-soft); }
.plan-empty { margin-top: 8px; font: 800 var(--fs-body)/1.4 var(--font-ui); }
.plan-list { list-style: none; margin-top: 10px; }
.plan-row { border-top: 2px dashed var(--dash); }
.plan-row + .plan-row, .skill-li + .skill-li { margin-top: 3px; padding-top: 3px; }
.plan-row:first-child { border-top: 0; }
.plan-go {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  min-height: 64px; padding: 6px 8px 6px 10px; color: var(--ink); text-decoration: none; border-radius: 14px;
  border-left: 4px solid transparent;
}
.plan-row[data-state="current"] .plan-go { border-left-color: var(--pink); background: #fff5f8; }
.plan-row[data-state="done"] .plan-text b { color: var(--ink-soft); }
.plan-icon { display: grid; place-items: center; }
.plan-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.plan-text b { font: 800 calc(16px * var(--k-body))/1.2 var(--font-ui); overflow-wrap: anywhere; }
.plan-text small { font: 800 var(--fs-small)/1.25 var(--font-ui); color: var(--ink-soft); }
.plan-state { display: inline-flex; align-items: center; gap: 2px; font: 800 var(--fs-ui)/1 var(--font-ui); white-space: nowrap; }
.plan-state .icon { width: 20px; height: 20px; color: #2f8f74; }
.plan-stamp {
  display: inline-flex; flex-direction: column; align-items: center; gap: 2px; align-self: center;
  margin: 10px auto 0; padding: 8px 16px 9px; rotate: -6deg;
  font: 400 calc(22px * var(--k-title))/1 var(--font-display); color: var(--ink);
  background: var(--mint-soft); border: 3px solid var(--mint); border-radius: 16px;
  animation: stamp 0.5s var(--boing) backwards;
}
.plan-stamp small { font: 800 var(--fs-ui)/1 var(--font-ui); }
.card.plan { display: flex; flex-direction: column; }
.plan-stamps { margin-top: 8px; font: 800 var(--fs-small)/1.3 var(--font-ui); color: var(--ink-soft); text-align: center; }

.card.challenge { display: flex; flex-direction: column; gap: 8px; border-top: 6px solid var(--subj); }
.chal-head { display: flex; align-items: center; gap: 10px; }
.chal-line { font: 800 var(--fs-body)/1.35 var(--font-ui); }
.chal-result { font: 800 var(--fs-body)/1.35 var(--font-ui); color: #1f7a62; }
.chal-result.is-notyet { color: var(--lavender-ink); }
.card.challenge .pill { align-self: flex-start; }
.chal-next { font: 800 var(--fs-small)/1.3 var(--font-ui); color: var(--ink-soft); }

/* ---------- subjects grid (ux 5.1) ---------- */

.subject-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.subject-card {
  --drop: 0 4px 0 var(--ink);
  position: relative; display: flex; flex-direction: column; gap: 3px; min-height: 148px; padding: 18px 12px 12px;
  color: var(--ink); text-decoration: none; overflow: hidden;
  background: var(--white); border: 2.5px solid var(--ink); border-radius: 22px; box-shadow: var(--drop);
  transition: translate 0.12s, box-shadow 0.12s;
}
.subj-band { position: absolute; top: 0; left: 0; right: 0; height: 6px; background: var(--subj); border-bottom: 2px solid var(--ink); }
.subject-card .sticker { width: 56px; height: 56px; margin-bottom: 2px; }
.subj-name { font: 400 calc(20px * var(--k-title))/1.1 var(--font-display); }
.subj-sub { font: 800 var(--fs-small)/1.3 var(--font-ui); color: var(--ink-soft); }
.subj-bar { display: block; height: 8px; margin-top: auto; border-radius: 99px; background: var(--blush); border: 2px solid var(--ink); overflow: hidden; }
.subj-bar-fill { display: block; height: 100%; transform-origin: 0 50%; transform: scaleX(var(--p, 0)); background: var(--subj); }
.subject-card .new-dot { top: 12px; right: 12px; }
.subj-due { position: absolute; top: 14px; right: 10px; }
:root[data-layout="phone"] .subj-due { display: none; }
:root:not([data-layout="phone"]) .subj-due-dot { display: none; }
.subject-card.is-broken { cursor: default; opacity: 0.85; }
.subject-card.is-broken .sticker { opacity: 0.4; }
@media (hover: hover) { a.subject-card:hover { translate: 0 -2px; --drop: 0 6px 0 var(--ink); } }
a.subject-card:active { translate: 0 3px; --drop: 0 1px 0 var(--ink); }
.album-fan { position: relative; width: 70px; height: 58px; margin-bottom: 2px; }
.alb-fan-card { position: absolute; bottom: 0; left: 20px; width: 34px; height: 48px; border: 2.5px solid var(--ink); border-radius: 7px; background: var(--white); transform-origin: 50% 100%; }
.alb-fan-card.f1 { rotate: -16deg; background: var(--sky); }
.alb-fan-card.f2 { rotate: 0deg; background: var(--mint); }
.alb-fan-card.f3 { rotate: 16deg; background: var(--milk); display: grid; place-items: center; }
.alb-fan-card.f3 .icon { width: 20px; height: 20px; }

/* home tiers: tablet two columns (ux 5.1 T), desk three (D), short two under the hero (S) */
:root[data-layout="tablet"] .home-grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 14px 22px; max-width: 720px; align-items: start; }
:root[data-layout="tablet"] .home-grid > * { grid-column: 1; }
:root[data-layout="tablet"] .home-grid > .h-subjects { grid-column: 2; grid-row: 1 / span 6; }
:root[data-layout="tablet"] .home-grid > .home-foot { grid-column: 1 / -1; }
:root[data-layout="tablet"] .h-kitty .kitty-friend { justify-content: center; }
:root[data-layout="tablet"] .subject-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

:root[data-layout="desk"] .home-grid {
  display: grid; grid-template-columns: 300px minmax(0, 1fr) 380px; grid-template-rows: auto auto auto auto 1fr;
  gap: 16px 24px; max-width: 1120px; align-items: start;
}
:root[data-layout="desk"] .h-kitty { grid-area: 1 / 1 / 3 / 2; }
:root[data-layout="desk"] .h-hero { grid-area: 1 / 2 / 2 / 3; }
:root[data-layout="desk"] .h-chips { grid-area: 3 / 1 / 4 / 2; }
:root[data-layout="desk"] .h-meter { grid-area: 4 / 1 / 5 / 2; }
:root[data-layout="desk"] .h-plan { grid-area: 2 / 2 / 5 / 3; }
:root[data-layout="desk"] .h-chal { grid-area: 5 / 2 / 6 / 3; }
:root[data-layout="desk"] .h-subjects { grid-area: 1 / 3 / 7 / 4; }
:root[data-layout="desk"] .home-foot { grid-area: 5 / 1 / 7 / 2; }
:root[data-layout="desk"] .h-kitty .kitty-friend { flex-direction: column; align-items: center; }
:root[data-layout="desk"] .home-kitty .bubble { width: 100%; justify-content: center; text-align: center; }
:root[data-layout="desk"] .home-kitty .bubble::before { left: 50%; top: -16px; margin: 0 0 0 -10px; border-width: 0 10px 16px 10px; border-color: transparent transparent var(--ink) transparent; }
:root[data-layout="desk"] .home-kitty .bubble::after { left: 50%; top: -11px; margin: 0 0 0 -7px; border-width: 0 7px 12px 7px; border-color: transparent transparent var(--white) transparent; }
:root[data-layout="desk"] .hero { max-width: none; }
:root[data-layout="desk"] .home-chips { justify-content: flex-start; }
:root[data-layout="desk"] .meter-wrap { flex-wrap: nowrap; }
:root[data-layout="desk"] .home-foot { align-items: flex-start; }
:root[data-layout="desk"] .foot-pills { flex-direction: column; align-items: flex-start; }

:root[data-short="true"] .home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 820px; gap: 12px 16px; }
:root[data-short="true"] .h-kitty, :root[data-short="true"] .h-hero, :root[data-short="true"] .home-foot, :root[data-short="true"] .h-subjects { grid-column: 1 / -1; }
:root[data-short="true"] .home-kitty .bubble { min-height: 0; padding: 6px 12px; }

/* ---------- subject (ux 5.2) ---------- */

.kitty-strip { display: flex; align-items: center; min-height: var(--strip-h); }
.kitty-strip .kitty-friend { flex: 1; gap: 14px; }
.kitty-strip .bubble { max-width: none; }
.teacher .bubble { min-height: 2.4em; }
.subject-layout { display: flex; flex-direction: column; gap: 14px; }
.subject-rail { display: flex; flex-direction: column; gap: 6px; }
.unit-grid { display: flex; flex-direction: column; gap: 14px; }
.card.unit { padding: 14px 12px 8px; border-top: 6px solid var(--subj); }
.unit-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 0 4px 6px; }
.unit-name { font: 400 calc(20px * var(--k-title))/1.15 var(--font-display); }
.unit-count { font: 800 var(--fs-small)/1 var(--font-ui); color: var(--ink-soft); white-space: nowrap; }
.unit-blurb { padding: 0 4px 6px; font: 500 var(--fs-small)/1.35 var(--font-ui); color: var(--ink-soft); }
.skill-list { list-style: none; }
.skill-li + .skill-li { border-top: 2px dashed var(--dash); }
.skill-row {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto 18px; align-items: center; gap: 10px;
  min-height: 64px; padding: 6px 6px 6px 6px; color: var(--ink); text-decoration: none; border-radius: 14px;
  border-left: 4px solid transparent;
}
.skill-row.is-today { border-left-color: var(--pink); background: #fff5f8; }
.row-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.row-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.row-name b { font: 800 calc(16px * var(--k-body))/1.2 var(--font-ui); overflow-wrap: anywhere; }
.row-last { white-space: nowrap; }
.row-last .dot-new { margin-left: 6px; vertical-align: 1px; }
.row-sub { font: 500 var(--fs-small)/1.2 var(--font-ui); color: var(--ink-soft); }
.row-kicker { font: 800 calc(11px * var(--k-small))/1 var(--font-ui); color: var(--bow-deep); text-transform: none; }
.row-go .icon { width: 18px; height: 18px; color: var(--ink-soft); }
@media (hover: hover) { .skill-row:hover { background: #fff5f8; } }

.ring-wrap { position: relative; display: inline-block; width: var(--size, 36px); height: var(--size, 36px); flex: none; }
.level-ring { display: block; width: 100%; height: 100%; }
.level-ring .ring-on { stroke: var(--subj); }
.level-ring .ring-off { stroke: rgba(91, 42, 60, 0.16); }
.level-ring .ring-n { font: 400 13px/1 var(--font-display); fill: var(--ink); }
.ring-badge { position: absolute; right: -6px; bottom: -4px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--white); border: 2px solid var(--ink); }
.ring-badge .icon { width: 14px; height: 14px; }
.stars-inline { display: inline-flex; gap: 1px; }
.stars-inline .icon { width: 17px; height: 17px; }
.stars-inline.is-dusty { position: relative; filter: saturate(0.45); }
.stars-inline.is-dusty::after {
  content: ""; position: absolute; inset: -2px; border-radius: 6px; pointer-events: none;
  background-image: radial-gradient(rgba(91, 42, 60, 0.35) 1px, transparent 1.4px); background-size: 5px 5px;
}

:root[data-layout="tablet"] .unit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
:root[data-layout="desk"] .subject-rail { flex-direction: row; align-items: center; gap: 18px; }
:root[data-layout="desk"] .subject-rail .kitty-strip { flex: 0 1 560px; }
:root[data-layout="desk"] .subject-rail .sheet-hint { flex: 1; text-align: left; }
:root[data-layout="desk"] .unit-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
:root[data-short="true"] .skill-row { min-height: 56px; }

/* ---------- skill (ux 5.3) ---------- */

.skill-layout { display: flex; flex-direction: column; gap: 14px; }
.skill-main { display: flex; flex-direction: column; gap: 14px; }
.skill-rail { display: contents; }
.skill-rail > .kitty-strip { order: -1; }
.skill-rail > .print-card { order: 10; }
.card.about { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-top: 6px solid var(--subj); }
.about-top { display: flex; align-items: center; gap: 14px; }
.about-level { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.about-h { font: 400 calc(20px * var(--k-title))/1.1 var(--font-display); }
.level-pips { display: flex; gap: 5px; }
.lp { width: 22px; height: 10px; border-radius: 99px; border: 2px solid var(--ink); background: var(--white); }
.lp.on { background: var(--subj); }
.about-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge-gold, .badge-crown { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 3px; font: 800 var(--fs-small)/1 var(--font-ui); background: #fff3b8; border: 2px solid var(--ink); border-radius: 999px; }
.badge-gold .icon, .badge-crown .icon { width: 15px; height: 15px; }
.about-stats { font: 800 var(--fs-small)/1.4 var(--font-ui); color: var(--ink-soft); }
.is-due-text { white-space: nowrap; padding: 1px 6px; color: var(--ink); background: var(--due); border-radius: 6px; }
.about-learn { font: 800 var(--fs-ui)/1.2 var(--font-ui); }
.about-list { padding-left: 20px; font: 500 var(--fs-body)/1.45 var(--font-ui); }
details.standards summary { list-style: none; cursor: pointer; }
details.standards summary::-webkit-details-marker { display: none; }
.standards-text { margin-top: 8px; font: 500 var(--fs-small)/1.4 var(--font-ui); color: var(--ink-soft); }
.mode-grid { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.mode-primary { flex-direction: column; gap: 4px; height: auto; min-height: 72px; max-width: none; padding: 10px 24px 12px; }
.mode-primary .mode-title { font: 400 calc(24px * var(--k-option))/1 var(--font-display); }
.mode-primary .mode-sub { padding: 2px 9px 3px; font: 800 var(--fs-small)/1.2 var(--font-ui); color: var(--ink); text-shadow: none; background: var(--white); border-radius: 999px; } /* small text never white on bow: ink on a white chip */
.mode-btn {
  --drop: 0 4px 0 var(--ink);
  display: flex; align-items: center; gap: 12px; min-height: 72px; padding: 10px 16px;
  color: var(--ink); text-decoration: none;
  background: var(--white); border: 2.5px solid var(--ink); border-radius: 22px; box-shadow: var(--drop);
  transition: translate 0.12s, box-shadow 0.12s;
}
.mode-btn:active { translate: 0 3px; --drop: 0 1px 0 var(--ink); }
.mode-btn.is-due { background: #fff3b8; }
.mode-icon { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 14px; background: var(--blush); border: 2px solid var(--ink); }
.mode-icon .icon { width: 26px; height: 26px; }
.mode-text { display: flex; flex-direction: column; gap: 3px; }
.mode-text b { font: 400 calc(19px * var(--k-title))/1.1 var(--font-display); }
.mode-text small { font: 800 var(--fs-small)/1.25 var(--font-ui); color: var(--ink-soft); }
.gold-note { padding: 10px 14px; font: 800 var(--fs-ui)/1.4 var(--font-ui); background: var(--milk); border: 2px dashed var(--dash); border-radius: 16px; text-align: center; }
.card.print-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; padding: 12px; }
.ws-seg { display: inline-flex; align-items: center; gap: 8px; }
.ws-level { min-width: 6em; text-align: center; font: 800 var(--fs-ui)/1 var(--font-ui); }

:root[data-layout="tablet"] .mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
:root[data-layout="tablet"] .mode-primary { grid-column: 1 / -1; }
:root[data-layout="desk"] .skill-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; max-width: 1040px; }
:root[data-layout="desk"] .skill-rail { order: 2; position: sticky; top: 0; display: flex; flex-direction: column; gap: 14px; }
:root[data-layout="desk"] .skill-rail > * { order: 0; }
:root[data-layout="desk"] .skill-rail .kitty-strip .kitty-friend { flex-direction: column; }
:root[data-layout="desk"] .sheet-inner.skill-layout { max-width: 1040px; }
:root[data-short="true"] .mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
:root[data-short="true"] .about-list, :root[data-short="true"] .about-learn { display: none; }

/* ---------- session (ux 5.4): top bar, kitty strip, card, answer, dock, tray ---------- */

.topbar { justify-content: space-between; }
.topbar-centre { flex: 1; min-width: 0; display: flex; justify-content: center; }
.topbar-right { position: relative; display: flex; align-items: center; gap: 8px; }
.puzzle-tag { font: 400 calc(16px * var(--k-title))/1 var(--font-display); color: var(--bow-deep); text-shadow: var(--ring); white-space: nowrap; }
.pips { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.pip { flex: none; border-radius: 50%; }
.pip.is-next { width: 8px; height: 8px; border: 2px dashed var(--ink-soft); }
.pip.is-now { width: 14px; height: 14px; background: var(--pink); border: 2.5px solid var(--ink); animation: pip-pulse 1.6s ease-in-out infinite; }
.pip.is-ft { width: 10px; height: 10px; background: var(--mint); border: 2px solid var(--ink); }
.pip.is-st { width: 10px; height: 10px; background: var(--white); border: 3px solid var(--lavender); box-shadow: 0 0 0 1px var(--ink); }
.pips-text { font: 800 var(--fs-ui)/1 var(--font-ui); }
@keyframes pip-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }

.speedy-ring { position: absolute; inset: -5px -5px -5px -5px; pointer-events: none; display: block; border-radius: 999px; }
.speedy-ring::before { content: ""; position: absolute; inset: 0; border-radius: 999px; border: 3px solid var(--sky); clip-path: inset(0 0 0 0); }
.speedy-ring.is-running::before { animation: speedy-drain var(--speedy-ms, 20s) linear 1 forwards; }
.speedy-ring.is-paused::before { animation-play-state: paused; }
.sr-seg { display: none; }
@keyframes speedy-drain { from { clip-path: inset(0 0 0 0); } to { clip-path: inset(0 100% 0 0); } }
:root[data-motion="calm"] .speedy-ring::before { display: none; }
:root[data-motion="calm"] .speedy-ring { inset: auto 6px -9px 6px; height: 4px; display: flex; gap: 3px; }
:root[data-motion="calm"] .sr-seg { display: block; flex: 1; height: 4px; border-radius: 99px; background: var(--sky); }
:root[data-motion="calm"] .sr-seg.gone { visibility: hidden; }

.screen-session { padding-top: calc(var(--topbar-h) + var(--sat)); }
.session { position: relative; height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); }
.s-rail { display: contents; }
.s-rail > .kitty-strip { grid-row: 1; padding: 0 calc(var(--sar) + 16px) 4px calc(var(--sal) + 16px); min-height: var(--strip-h); }
.dock-slot { display: none; }
.s-main { grid-row: 2; display: flex; flex-direction: column; min-height: 0; }
.session-body {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 12px; padding: 12px calc(var(--sar) + 16px) 16px calc(var(--sal) + 16px);
}
.q-col, .a-col { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 640px; margin: 0 auto; }
.a-col:empty { display: none; }
.s-bottom { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 0 calc(var(--sar) + 16px) calc(var(--sab) + 10px) calc(var(--sal) + 16px); background: linear-gradient(rgba(255, 227, 236, 0), var(--milk) 12px); transition: transform 0.2s ease; }
.dock-wrap { width: 100%; max-width: 640px; margin: 0 auto; }
/* scrolled down, the card slips under the kitty strip through a soft edge, not a hard cut */
.session-body.is-scrolled { -webkit-mask-image: linear-gradient(transparent, #000 16px); mask-image: linear-gradient(transparent, #000 16px); }
.dock-wrap:empty, .dock-wrap:has(> .dock[hidden]) { display: none; }
.session-kitty .bubble { min-height: 2.4em; font-size: clamp(14px, 3.6vw, 16px); }
:root[data-big="true"] .session-kitty .bubble { font-size: 17px; }

/* the question card (ux 4.5) */
.card.qcard, .card.lesson-card, .card.passage-card { padding: 18px; }
:root:not([data-layout="phone"]) .card.qcard, :root:not([data-layout="phone"]) .card.lesson-card { padding: 22px; }
.q-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: var(--target); margin: -6px -6px 6px 0; }
.q-kicker { font: 800 var(--fs-small)/1.2 var(--font-ui); color: var(--ink-soft); }
.q-prompt { font: 800 var(--fs-prompt)/var(--lh-prompt) var(--font-ui); color: var(--ink); overflow-wrap: anywhere; text-wrap: pretty; }
/* numbered clues (logic grids, keys): one per line, the number hanging in its own column (components.js#promptText) */
.q-lead, .q-clue { display: block; }
.q-clue { display: grid; grid-template-columns: 1.5em minmax(0, 1fr); margin-top: 0.3em; }
.q-lead + .q-clue { margin-top: 0.45em; }
.q-clue-n { color: var(--bow-deep); font-variant-numeric: tabular-nums; }
:root[data-big="true"][data-layout="phone"] .q-prompt { max-inline-size: 20ch; }
.q-visual { display: flex; justify-content: center; margin-top: 10px; max-height: 240px; }
:root[data-layout="tablet"] .q-visual { max-height: 320px; }
:root[data-layout="desk"] .q-visual { max-height: 360px; }
/* short landscape: the picture shrinks to its 200 px slot (a 240 cap spilled over the prompt; the keypad trim still
   writes a smaller one). The listen task is not a picture: it keeps its full height inside the card. */
:root[data-short="true"] .q-visual:not(.q-listen) { max-height: 200px; }
:root[data-short="true"] .q-visual:not(.q-listen) .visual { --v-max: min(var(--v-p, 240px), 200px); }
.q-visual.q-listen { max-height: none; display: block; }
.q-visual > .visual { max-width: 100%; }
.passage-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
/* phone and tablet: the text scrolls inside the card, its bottom edge fading while more waits (ux 8 passage) */
:root:is([data-layout="phone"]:not([data-short="true"]), [data-layout="tablet"]) .passage-scroll { max-height: 45vh; overflow-y: auto; overscroll-behavior: contain; }
.passage-scroll.has-more { -webkit-mask-image: linear-gradient(#000 calc(100% - 52px), transparent); mask-image: linear-gradient(#000 calc(100% - 52px), transparent); }
.passage-more { display: flex; margin: 6px auto 0; }

/* the listen task (ux 4.5, §5.2.2) */
.listen-task { display: flex; flex-direction: column; gap: 12px; }
.listen-row { display: flex; align-items: center; justify-content: center; gap: 14px; }
.listen-big { width: 96px !important; height: 96px !important; flex-direction: column; gap: 2px; background: var(--milk); }
.listen-big .listen-icon { width: 38px !important; height: 38px !important; }
.listen-word { font: 800 calc(12px * var(--k-small))/1 var(--font-ui); white-space: nowrap; }
.listen-side { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.peek-pill { position: relative; overflow: hidden; }
.peek-pill.is-hot { box-shadow: 0 0 0 3px var(--white), 0 0 0 6px var(--nose), var(--drop); }
.peek-ring { position: absolute; left: 0; bottom: 0; height: 4px; width: 100%; background: var(--ink); transform-origin: 0 50%; transform: scaleX(0); }
.peek-pill.is-peeking .peek-ring { animation: peek-drain var(--ms, 2500ms) linear 1 backwards; }
@keyframes peek-drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.listen-shape { position: relative; }
.peek-overlay {
  position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; align-content: center; row-gap: 6px; padding: 10px;
  font: 400 calc(30px * var(--k-title))/1.2 var(--font-display); color: var(--ink); text-align: center; overflow-wrap: normal; text-wrap: balance;
  background: rgba(255, 255, 255, 0.97); border: 3px solid var(--nose); border-radius: 18px;
}
/* the countdown under the word (its seconds from data-left; the bar drains like the pill's ring) */
.peek-count { position: relative; overflow: hidden; height: 28px; min-width: 48px; padding: 0 10px; font: 800 15px/24px var(--font-ui); color: var(--ink); background: var(--nose); border: 2px solid var(--ink); border-radius: 999px; }
.peek-count::before { content: attr(data-left); }
.peek-count::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--ink); transform-origin: 0 50%; transform: scaleX(0); animation: peek-drain var(--ms, 2500ms) linear 1 backwards; }

/* the lesson card (ux 8) */
.lesson-title { font: 400 calc(22px * var(--k-title))/1.15 var(--font-display); color: var(--bow-deep); margin: 0 0 8px; }
.lesson-body { font: 800 var(--fs-body)/var(--lh-body) var(--font-ui); text-wrap: pretty; }
.lesson-example { margin-top: 12px; padding: 12px 14px; background: var(--milk); border: 2px dashed var(--dash); border-radius: 16px; display: flex; flex-wrap: wrap; justify-content: center; }
.lesson-caption { flex: 0 0 100%; margin-top: 8px; text-align: center; font: 800 var(--fs-ui)/1.35 var(--font-ui); color: var(--ink); text-wrap: balance; }
.lesson-example.is-text { font: 400 calc(20px * var(--k-option))/1.35 var(--font-display); text-align: center; display: block; }
.kw-word { margin: 0 2px; padding: 0 6px 1px; min-height: 0; font: 800 11px/1.5 var(--font-ui); color: var(--ink); background: var(--ear-pink); border: 1.5px solid var(--ink); border-radius: 999px; cursor: pointer; vertical-align: 2px; }
.kw-tip { display: none; }
.kw-tip.is-on { display: block; margin: 6px 0; padding: 6px 10px; font: 800 var(--fs-small)/1.35 var(--font-ui); background: var(--blush); border-radius: 10px; }

/* the tray (ux 4.5) */
.tray { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 640px; margin: 0 auto; min-height: var(--tray-h); }
.tray-left { flex: none; }
.tray-left.is-hot { box-shadow: 0 0 0 3px var(--white), 0 0 0 6px var(--nose), var(--drop); }
.tray-primary { position: relative; flex: 1; min-width: 0; max-width: none; height: auto; min-height: 64px; white-space: normal; line-height: 1.1; font-size: calc(26px * var(--k-option)); }
.tray-primary.is-fitting { white-space: nowrap; }
.tray-primary.fit-1 { font-size: calc(25px * var(--k-option)); }
.tray-primary.fit-2 { font-size: calc(24px * var(--k-option)); padding-inline: 14px; }
.tray-primary.wrap { padding: 8px 18px 10px; }
.tray-label { position: relative; z-index: 1; min-width: 0; overflow-wrap: anywhere; }
.tray-ring { position: absolute; inset: -6px; border-radius: 999px; border: 3px solid var(--nose); clip-path: inset(0 0 0 100%); pointer-events: none; }
.tray-primary.is-ring .tray-ring { animation: ring-fill var(--ring-ms, 1800ms) linear 1 backwards; }
@keyframes ring-fill { from { clip-path: inset(0 0 0 0); } to { clip-path: inset(0 0 0 100%); } }
:root[data-short="true"] .tray-primary { min-height: 48px; font-size: calc(24px * var(--k-option)); }
:root[data-short="true"] .tray-left { min-height: var(--target); padding: 5px 14px; font-size: calc(13px * var(--k-ui)); }

/* the hint dock (ux 4.7) */
.dock {
  position: relative; max-height: min(36vh, 220px); overflow-y: auto; overscroll-behavior: contain;
  padding: 10px 12px 12px 18px; background: var(--white);
  border: 2.5px solid var(--lavender); border-left-width: 6px; border-radius: 18px; box-shadow: 0 3px 0 var(--ink);
  animation: dock-rise 0.3s ease-out backwards;
}
.dock.explain { border-color: var(--mint); }
@keyframes dock-rise { from { transform: translateY(18px); opacity: 0; } to { transform: none; opacity: 1; } }
:root[data-motion="calm"] .dock { animation: fade-in 0.15s ease-out backwards !important; }
.panel-top { display: flex; align-items: center; gap: 8px; }
.panel-icon { width: 28px; height: auto; flex: none; }
.panel-h { flex: 1; font: 400 calc(17px * var(--k-title))/1 var(--font-display); color: var(--lavender-ink); }
.dock.explain .panel-h { color: #1f7a62; }
.panel-body { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.panel-text { font: 800 var(--fs-body)/1.5 var(--font-ui); }
.panel-hint { font: 800 var(--fs-small)/1.4 var(--font-ui); color: var(--ink-soft); }
.panel-answer { font: 800 var(--fs-body)/1.4 var(--font-ui); }
/* the answer chip wraps as one box (onto its own line when it does not fit after "the answer:") */
.panel-answer b { display: inline-block; max-width: 100%; padding: 1px 8px; background: var(--mint-soft); border: 2px solid var(--mint); border-radius: 8px; overflow-wrap: anywhere; }
.panel-visual { display: flex; justify-content: center; }
.panel-line { display: none; }
.dock.is-collapsed { max-height: 44px; overflow: hidden; padding-top: 6px; padding-bottom: 6px; }
.dock.is-collapsed .panel-body, .dock.is-collapsed .panel-top { display: none; }
.dock.is-collapsed .panel-line { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 800 var(--fs-ui)/28px var(--font-ui); }

/* the level banner (ux 4.8) and the floating "+n ✦" */
/* one line, centred over the finished question: clear of the kitty's bubble, which says the level-up line meanwhile */
.level-banner {
  position: fixed; z-index: 5; top: 36%; left: 0; right: 0; width: max-content; max-width: calc(100vw - 32px); margin-inline: auto;
  display: flex; align-items: center; gap: 8px; padding: 10px 22px 12px; white-space: nowrap;
  font: 400 calc(24px * var(--k-title))/1 var(--font-display); color: var(--ink);
  background: var(--nose); border: 3px solid var(--ink); border-radius: 999px; box-shadow: 0 4px 0 var(--ink);
  animation: banner-in 1.2s var(--boing) 1 backwards;
}
/* desk: over the middle of the question column (the 680 + 32 + 320 px grid, centred) */
:root[data-layout="desk"]:not([data-short="true"]) .level-banner { left: calc((100vw - 1032px) / 2 + 340px); right: auto; margin: 0; translate: -50% 0; }
.level-banner.is-down { background: var(--sky); }
.lb-plus { font: 800 var(--fs-ui)/1 var(--font-ui); }
@keyframes banner-in { 0% { transform: translateY(-16px); opacity: 0; } 18% { transform: none; opacity: 1; } 85% { transform: none; opacity: 1; } 100% { transform: translateY(-10px); opacity: 0; } }
.float-plus {
  position: fixed; z-index: 26; translate: -50% -50%; pointer-events: none;
  font: 400 22px/1 var(--font-display); color: var(--bow-deep); text-shadow: var(--ring); white-space: nowrap;
  animation: float-plus 0.9s ease-out 1 backwards;
}
@keyframes float-plus { from { transform: translateY(0); opacity: 1; } 70% { opacity: 1; } to { transform: translateY(-24px); opacity: 0; } }
:root[data-motion="calm"] .float-plus { animation: fade-in 0.15s ease-out 1 backwards !important; }

/* session tiers: tablet column, desk two columns with the rail, short two columns */
/* desk: the question block sits a little above the middle of the page (the fr rows fold to 0 when it is taller, so its
   top never hides); the row is sized by the question column alone and the rail (kitty + hint dock) hangs from its top,
   so a hint opening never moves the card */
:root[data-layout="desk"]:not([data-short="true"]) .session {
  grid-template-rows: 2fr auto 3fr; grid-template-columns: minmax(560px, 680px) 320px; grid-template-areas: ". ." "main rail" ". .";
  justify-content: center; column-gap: 32px; overflow-y: auto; padding-bottom: 24px;
}
:root[data-layout="desk"]:not([data-short="true"]) .s-rail { grid-area: rail; display: flex; flex-direction: column; gap: 14px; align-self: start; position: sticky; top: 0; z-index: 5; padding-top: 12px; height: 0; overflow: visible; }
:root[data-layout="desk"]:not([data-short="true"]) .s-rail > * { flex: none; }
:root[data-layout="desk"]:not([data-short="true"]) .s-rail > .kitty-strip { padding: 0; min-height: 0; }
:root[data-layout="desk"]:not([data-short="true"]) .s-rail .kitty-friend { flex-direction: column-reverse; }
:root[data-layout="desk"]:not([data-short="true"]) .dock-slot { display: block; }
:root[data-layout="desk"]:not([data-short="true"]) .dock-slot .dock { max-height: 60vh; }
:root[data-layout="desk"]:not([data-short="true"]) .s-main { grid-area: main; min-height: auto; }
:root[data-layout="desk"]:not([data-short="true"]) .s-main { display: block; }
:root[data-layout="desk"]:not([data-short="true"]) .session-body { flex: none; overflow: visible; padding: 12px 0 8px; }
:root[data-layout="desk"]:not([data-short="true"]) .q-col, :root[data-layout="desk"]:not([data-short="true"]) .a-col, :root[data-layout="desk"]:not([data-short="true"]) .tray { max-width: none; }
/* a question taller than the room (a passage, a 3×3 matrix, the club) scrolls under the tray, which waits at the foot of
   the column in view (check-r5-retest-7); the soft band behind it shows only then, and focus scrolls clear of it */
:root[data-layout="desk"]:not([data-short="true"]) .session { scroll-padding-bottom: 104px; overflow-anchor: none; }
:root[data-layout="desk"]:not([data-short="true"]) .s-bottom { position: sticky; bottom: 0; z-index: 4; padding: 6px 0 0; background: none; }
/* (the band runs the room's width, like the top bar's; the rail's kitty and hint stay over it; the session's foot
   padding moves into the band so the scroll height never changes with it; the band overlaps only the body's foot
   padding, so the last control can scroll wholly above it) */
:root[data-layout="desk"]:not([data-short="true"]) .session.is-tall { padding-bottom: 0; }
:root[data-layout="desk"]:not([data-short="true"]) .session.is-tall .s-bottom { padding: 12px 0 24px; margin-top: -6px; border-image: linear-gradient(rgba(255, 227, 236, 0), var(--milk) 12px) fill 0 // 0 100vw; }
:root[data-layout="desk"]:not([data-short="true"]) .tray { justify-content: flex-start; }
:root[data-layout="desk"]:not([data-short="true"]) .tray-primary { flex: 0 1 auto; min-width: 280px; }

:root[data-short="true"] .s-rail > .kitty-strip { min-height: var(--strip-h); padding-bottom: 2px; }
:root[data-short="true"] .session-kitty .bubble { min-height: 0; padding: 4px 10px; font-size: 13px; line-height: 1.3; }
:root[data-short="true"] .s-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; grid-template-areas: "q a" "q tray"; column-gap: 16px; padding: 0 calc(var(--sar) + 12px) calc(var(--sab) + 6px) calc(var(--sal) + 12px); }
:root[data-short="true"] .session-body { display: contents; }
:root[data-short="true"] .q-col { grid-area: q; overflow-y: auto; padding: 8px 0; }
:root[data-short="true"] .a-col { grid-area: a; overflow-y: auto; padding: 8px 0; }
:root[data-short="true"] .s-bottom { display: contents; }
:root[data-short="true"] .tray { grid-area: tray; }
:root[data-short="true"] .dock-wrap { grid-area: q; align-self: end; z-index: 3; padding-bottom: 6px; }
:root[data-short="true"] .card.qcard { padding: 12px; }

/* ---------- results (ux 5.5) ---------- */

.results-layout { display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 560px; margin: 0 auto; padding-top: calc(var(--sat) + 14px); }
.results-side { display: flex; justify-content: center; }
.results-kitty .bubble { width: min(340px, 86vw); }
.card.results-card { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px 16px 16px; text-align: center; border-top: 6px solid var(--subj); }
.results-mode { padding: 5px 11px 6px; font: 800 var(--fs-small)/1 var(--font-ui); color: var(--ink-soft); background: var(--blush); border-radius: 999px; }
.results-title { font: 400 calc(26px * var(--k-title))/1.15 var(--font-display); }
.results-note, .results-total { font: 800 var(--fs-body)/1.4 var(--font-ui); }
.results-total { font: 400 calc(24px * var(--k-title))/1.2 var(--font-display); }
.star-row { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 64px; }
.big-star .icon { width: 56px; height: 56px; filter: drop-shadow(0 3px 0 var(--ink)); }
.star-row.is-landing .big-star { opacity: 0; transform: scale(0.3); }
.star-row.is-landing .big-star.landed { animation: star-land 0.45s var(--boing) 1 backwards; opacity: 1; transform: none; }
.star-badge { display: inline-flex; align-items: center; gap: 4px; margin-left: 4px; padding: 4px 10px 5px; font: 800 var(--fs-ui)/1 var(--font-ui); background: #fff3b8; border: 2.5px solid var(--ink); border-radius: 999px; }
.star-badge .icon { width: 20px; height: 20px; }
.star-row.is-landing .star-badge { opacity: 0; }
.star-row.is-landing .star-badge.landed { opacity: 1; animation: stamp 0.5s var(--boing) 1 backwards; }
@keyframes star-land { from { transform: scale(0.3) rotate(-30deg); opacity: 0; } to { transform: none; opacity: 1; } }

.receipt-card {
  width: 100%; padding: 14px 14px 12px;
  background: var(--milk); border: 2px dashed rgba(91, 42, 60, 0.45); border-left: 0; border-right: 0;
  -webkit-mask: none;
}
table.receipt { width: 100%; border-collapse: collapse; font: 800 var(--fs-ui)/1.3 var(--font-ui); font-variant-numeric: tabular-nums; }
table.receipt caption { padding-bottom: 8px; font: 800 var(--fs-small)/1.3 var(--font-ui); color: var(--ink-soft); }
table.receipt th { padding: 3px 4px; text-align: left; font-weight: 800; }
table.receipt td { padding: 3px 4px; text-align: right; white-space: nowrap; }
table.receipt .r-each { color: var(--ink-soft); }
table.receipt .r-bonus th, table.receipt .r-event th { color: var(--bow-deep); }
table.receipt tr.is-minus th, table.receipt tr.is-minus .r-sum { color: var(--lavender-ink); }
table.receipt .r-sleepy td { text-align: left; color: var(--ink-soft); font-size: var(--fs-small); }
table.receipt tfoot td { padding-top: 8px; border-top: 2px dashed rgba(91, 42, 60, 0.45); text-align: left; font: 400 calc(20px * var(--k-title))/1.3 var(--font-display); color: var(--ink); }
.r-next { display: block; font: 800 var(--fs-small)/1.3 var(--font-ui); color: var(--ink-soft); }

.results-packs { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.results-sub { font: 400 calc(18px * var(--k-title))/1.1 var(--font-display); color: var(--bow-deep); text-shadow: var(--ring); }
.pack-shelf.is-list { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.shelf-item { display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: 150px; }
.shelf-label { font: 800 var(--fs-small)/1.3 var(--font-ui); text-align: center; }
.pack-sprite { position: relative; display: block; width: var(--w, 72px); height: var(--h, 92px); }
.pack-canvas { display: block; width: 100%; height: 100%; }
.pouch {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: var(--white); border: 2.5px solid var(--ink); border-radius: 14px 14px 18px 18px; box-shadow: 0 4px 0 var(--ink);
  overflow: hidden;
}
.pouch-crimp { position: absolute; top: 0; left: 0; right: 0; height: 12px; border-bottom: 2.5px solid var(--ink); background: repeating-linear-gradient(90deg, var(--pink) 0 6px, var(--white) 6px 12px); }
.pouch-star .icon { width: 30px; height: 30px; }
.pouch-badge { position: absolute; right: 4px; bottom: 4px; }
.pack-sprite[data-kind="star"] .pouch { background-color: var(--milk); background-image: radial-gradient(var(--sky) 2px, transparent 2.5px); background-size: 14px 14px; }
.pack-sprite[data-kind="gold"] .pouch { background: var(--nose); }
.pack-sprite[data-kind="gold"] .pouch-crimp { background: repeating-linear-gradient(90deg, #f0b400 0 6px, #ffe9a0 6px 12px); }
.pack-sprite[data-kind="rainbow"] .pouch { background: linear-gradient(160deg, #ff9fbd, #ffd966 30%, #93e4cd 55%, #9fd9ff 78%, #c2aeff); }
.pack-sprite[data-kind="welcome"] .pouch { background: var(--milk); }

.results-chips { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.chip-stat { padding: 6px 12px 7px; font: 800 var(--fs-ui)/1 var(--font-ui); background: var(--white); border: 2.5px solid var(--ink); border-radius: 999px; }
.chip-stat.is-up { background: var(--nose); }
details.look-again { width: 100%; text-align: left; }
details.look-again summary { list-style: none; cursor: pointer; display: inline-flex; }
details.look-again summary::-webkit-details-marker { display: none; }
.look-list { list-style: none; display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.look-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; background: var(--blush); border: 2px solid var(--ink); border-radius: 16px; }
.look-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.look-prompt { font: 800 var(--fs-body)/1.35 var(--font-ui); overflow-wrap: anywhere; }
.look-answer b { padding: 0 6px; background: var(--mint-soft); border: 2px solid var(--mint); border-radius: 6px; }
.look-explain { font: 500 var(--fs-small)/1.4 var(--font-ui); color: var(--ink-soft); }
.look-none { font: 800 var(--fs-ui)/1.4 var(--font-ui); color: var(--ink-soft); }
.receipt-more { display: none; }
:root[data-short="true"] .receipt-more { display: inline-flex; }
:root[data-short="true"] .receipt-card:not(.is-open) caption, :root[data-short="true"] .receipt-card:not(.is-open) tbody { display: none; }
.results-actions { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 4px; }
.results-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.results-primary { max-width: 360px; white-space: normal; height: auto; min-height: 64px; padding: 10px 24px 12px; text-align: center; line-height: 1.1; }

:root[data-layout="desk"] .results-layout { flex-direction: row; align-items: flex-start; justify-content: center; max-width: 820px; gap: 28px; }
:root[data-layout="desk"] .results-side { flex: 1; position: sticky; top: 24px; }
:root[data-layout="desk"] .card.results-card { width: 520px; flex: none; }
:root[data-short="true"] .results-layout { flex-direction: row; align-items: flex-start; max-width: 760px; }
:root[data-short="true"] .big-star .icon { width: 44px; height: 44px; }

/* ---------- report (ux 5.8) ---------- */

.report-inner { gap: 14px; }
.report-cols { display: flex; flex-direction: column; gap: 14px; }
.report-panel { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel-title { font: 400 calc(20px * var(--k-title))/1.1 var(--font-display); color: var(--bow-deep); text-shadow: var(--ring); }
.card.report-card { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.report-h { font: 400 calc(18px * var(--k-title))/1.15 var(--font-display); }
.report-line, .report-empty { font: 800 var(--fs-body)/1.45 var(--font-ui); }
.report-small { font: 800 var(--fs-small)/1.35 var(--font-ui); color: var(--ink-soft); }
.report-card .pill.small { align-self: flex-start; }
.stat-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat-tile { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; background: var(--blush); border: 2px solid var(--ink); border-radius: 16px; }
.stat-tile b { font: 400 calc(26px * var(--k-title))/1 var(--font-display); }
.stat-tile small { font: 800 var(--fs-small)/1.2 var(--font-ui); color: var(--ink-soft); }
.reason-bar { display: flex; height: 28px; overflow: hidden; border: 2.5px solid var(--ink); border-radius: 999px; background: var(--white); }
.rb-seg { flex: var(--p, 0) 1 0; min-width: 4px; border-right: 2px solid var(--ink); }
.rb-seg:last-child { border-right: 0; }
.rb-effort { background: var(--pink); }
.rb-learning { background: var(--sky); }
.rb-review { background: var(--lavender); }
.rb-plan { background: var(--mint); }
.rb-other { background: var(--nose); }
.rb-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; font: 800 var(--fs-small)/1.2 var(--font-ui); }
.rb-legend li { display: inline-flex; align-items: center; gap: 5px; }
.rb-key { width: 14px; height: 14px; border: 2px solid var(--ink); border-radius: 4px; }
.next-list, .log-list, .quest-list, .help-list, .badge-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.help-list { list-style: disc; padding-left: 20px; font: 800 var(--fs-body)/1.45 var(--font-ui); }
.next-row { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; color: var(--ink); text-decoration: none; background: var(--blush); border: 2px solid var(--ink); border-radius: 14px; }
.next-row b { font: 800 var(--fs-body)/1.2 var(--font-ui); }
.next-row small { font: 800 var(--fs-small)/1.2 var(--font-ui); color: var(--ink-soft); }
.log-list li { font: 500 var(--fs-small)/1.35 var(--font-ui); padding-left: 10px; border-left: 3px solid var(--ear-pink); }
.badge-list { flex-direction: row; flex-wrap: wrap; }
.badge-chip { padding: 4px 10px 5px; font: 800 var(--fs-small)/1.2 var(--font-ui); background: #fff3b8; border: 2px solid var(--ink); border-radius: 999px; }
.quest-list li { display: flex; flex-direction: column; gap: 4px; font: 800 var(--fs-ui)/1.3 var(--font-ui); }
.rq-bar { height: 10px; border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; background: var(--white); }
.rq-fill { display: block; height: 100%; transform-origin: 0 50%; transform: scaleX(var(--p, 0)); background: linear-gradient(90deg, #ff9fbd, #ffd966, #93e4cd, #9fd9ff, #c2aeff); }
.stamped { font: 400 calc(20px * var(--k-title))/1 var(--font-display); color: #1f7a62; }
.q-table { width: 100%; border-collapse: collapse; font: 800 var(--fs-ui)/1.3 var(--font-ui); }
.q-table th { text-align: left; padding: 5px 4px; }
.q-table td { text-align: right; padding: 5px 4px; }
.q-table tr + tr { border-top: 2px dashed var(--dash); }
.q-table .quiet { color: var(--ink-soft); }
.gate-body { display: flex; justify-content: center; padding: 6px 0; }
.hold-gate { display: inline-flex; }
.hold.has-taps .hold-fill { transform: scaleX(var(--taps, 0)); }
.hold.passed .hold-fill { transform: scaleX(1); }

table.mastery-grid { width: 100%; border-collapse: separate; border-spacing: 0 6px; }
table.mastery-grid caption { text-align: left; font: 800 var(--fs-ui)/1.2 var(--font-ui); color: var(--ink-soft); padding-bottom: 2px; }
table.mastery-grid th { width: 34%; padding-right: 8px; text-align: left; vertical-align: middle; font: 800 var(--fs-small)/1.25 var(--font-ui); }
.mg-cells { display: flex; flex-wrap: wrap; gap: 6px; }
.mg-cell {
  position: relative; display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  font: 800 13px/1 var(--font-ui); color: var(--ink); cursor: pointer;
  background: var(--ear-pink); border: 2px solid var(--ink); border-radius: 12px;
}
.mg-cell.sx, .mg-cell.s0 { background: var(--milk); border-style: dashed; }
.mg-cell.s1 { background: var(--ear-pink); }
.mg-cell.s2 { background: var(--pink); }
.mg-cell.s3 { background: var(--bow-pink); color: var(--white); text-shadow: 0 1px 0 var(--ink); }
.mg-cell.is-stretch::before { content: ""; position: absolute; top: 0; left: 0; width: 0; height: 0; border-top: 12px solid var(--lavender); border-right: 12px solid transparent; border-top-left-radius: 9px; }
.mg-mark { position: absolute; top: -7px; right: -7px; display: grid; place-items: center; width: 18px; height: 18px; background: var(--white); border: 1.5px solid var(--ink); border-radius: 50%; }
.mg-mark .icon { width: 12px; height: 12px; }
.mg-due { position: absolute; bottom: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--nose); border: 1.5px solid var(--ink); }
.mg-stds { margin: 6px 0 0; font: 800 var(--fs-small)/1.35 var(--font-ui); color: var(--ink-soft); overflow-wrap: anywhere; }
.mg-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 6px; font: 800 var(--fs-small)/1 var(--font-ui); }
.mg-legend li { display: inline-flex; align-items: center; gap: 6px; }
.mg-legend .mg-cell { width: 20px; height: 20px; border-radius: 6px; cursor: default; }

.bars.is-v .bars-list { display: flex; align-items: flex-end; gap: 4px; height: 140px; padding-top: 18px; }
.bars.is-v .bar { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bars.is-v .bar-track { position: relative; width: 100%; max-width: 22px; height: 100px; display: flex; align-items: flex-end; background: rgba(255, 143, 177, 0.12); border-radius: 7px 7px 3px 3px; }
.bars.is-v .bar-fill { display: block; width: 100%; height: 100%; transform-origin: 50% 100%; transform: scaleY(var(--p, 0)); background: var(--pink); border: 2px solid var(--ink); border-radius: 7px 7px 3px 3px; }
.bars.is-v .bar-top { position: absolute; top: 0; font: 800 10px/1 var(--font-ui); }
.bars.is-v .bar-label { margin-top: 4px; font: 800 11px/1 var(--font-ui); color: var(--ink-soft); }
.bars.is-v .bar.is-today .bar-label { color: var(--ink); border-radius: 50%; box-shadow: 0 0 0 2px var(--bow); padding: 2px 3px; }
.bars.is-h .bars-list { display: flex; flex-direction: column; gap: 8px; }
.bars.is-h .bar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; }
.bars.is-h .bar-track { height: 16px; border: 2px solid var(--ink); border-radius: 999px; background: var(--white); overflow: hidden; }
.bars.is-h .bar-fill { display: block; height: 100%; transform-origin: 0 50%; transform: scaleX(var(--p, 0)); background: var(--subj, var(--pink)); }
.bars.is-h .bar-label { font: 800 var(--fs-small)/1.2 var(--font-ui); order: -1; }
.bars-empty { font: 800 var(--fs-small)/1.3 var(--font-ui); color: var(--ink-soft); text-align: center; }

:root[data-layout="tablet"] .stat-tiles, :root[data-short="true"] .stat-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
:root[data-layout="tablet"] .mg-cell { width: 48px; height: 48px; }
:root[data-layout="desk"] .report-inner { max-width: 1120px; }
:root[data-layout="desk"] .report-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }
:root[data-layout="desk"] .stat-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---------- settings (ux 5.9) ---------- */

.settings-inner { max-width: 640px; }
.set-card-title { padding: 12px 0 2px; font: 400 calc(18px * var(--k-title))/1.1 var(--font-display); color: var(--bow-deep); }
.set-name { font: 400 calc(18px * var(--k-title))/1.2 var(--font-display); color: var(--ink); margin-top: 3px; }
.name-choices { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.seg-pair { display: flex; flex-wrap: wrap; gap: 8px; }
.how-row { justify-content: flex-start; }
.code-host:empty { display: none; }
.code-box { display: flex; flex-direction: column; gap: 8px; padding: 10px 0 14px; }
.code-text { width: 100%; padding: 10px 12px; font: 500 13px/1.4 ui-monospace, "SF Mono", Menlo, monospace; color: var(--ink); background: var(--blush); border: 2px solid var(--ink); border-radius: 14px; resize: vertical; word-break: break-all; }
.code-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.code-error { font: 800 var(--fs-ui)/1.4 var(--font-ui); color: var(--bow-deep); }
.code-error:empty { display: none; }
.code-note { font: 800 var(--fs-small)/1.3 var(--font-ui); color: var(--ink-soft); }
.how-body { display: flex; flex-direction: column; gap: 8px; text-align: left; }

/* ---------- modals: the layer, onboarding, the lesson sheet ---------- */

.modal-layer { position: absolute; inset: 0; display: grid; place-items: center; padding: calc(var(--sat) + 20px) 16px calc(var(--sab) + 20px); overflow-y: auto; }
.modal-layer .modal-back { position: fixed; }
.modal-primary { min-width: 0; width: 100%; max-width: 300px; font-size: calc(22px * var(--k-option)); white-space: normal; height: auto; min-height: 58px; padding: 8px 20px 10px; }
.modal-card.is-sheet { align-self: end; width: min(560px, 100%); max-height: 86vh; margin-bottom: calc(-1 * var(--sab) - 8px); border-radius: 28px 28px 0 0; text-align: left; align-items: stretch; animation-name: rise-in; }
.modal-card.is-sheet .card.lesson-card { box-shadow: none; border: 0; padding: 0; }
.modal-card.is-sheet .modal-actions { justify-content: center; }

.onboard-wrap { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; width: min(380px, 100%); }
.onboard-kitty.kitty-friend { gap: 12px; }
.onboard-kitty .bubble { width: min(320px, 100%); }
.modal-card.onboard { width: 100%; gap: 12px; }
.onboard-step { font: 800 var(--fs-small)/1 var(--font-ui); color: var(--ink-soft); }
.onboard-body { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
.onboard-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.onboard-next { max-width: 300px; }
.name-pill { font-size: calc(15px * var(--k-ui)); }
.seg-big button { min-width: 64px; min-height: 52px; font: 800 var(--fs-option)/1 var(--font-ui); }
.seg-big { flex-wrap: nowrap; }
/* a 320 px phone: four 64 px ages and their 8 px gaps do not fit one row of the card, so they sit two by two */
@media (max-width: 359px) { .seg-big { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.seg-big button { padding: 0 14px 1px; }
.onboard-tts { width: 100%; border-top: 2px dashed var(--dash); }
.onboard-body .v-flow, .onboard-body .visual { max-width: 100%; }
:root[data-short="true"] .onboard-wrap { flex-direction: row; align-items: flex-start; gap: 20px; width: min(660px, 100%); }
:root[data-short="true"] .onboard-kitty { flex: none; }
:root[data-short="true"] .onboard-kitty .bubble { display: none; }

/* ---------- print preview on screen (print.css makes it paper) ---------- */

.print-inner { max-width: 860px; }
.print-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; }
.paper-holder { position: relative; width: 100%; overflow: hidden; }
.paper-stack { width: max-content; transform-origin: 0 0; transform: scale(var(--scale, 1)); display: flex; flex-direction: column; gap: 18px; }
.paper {
  width: 210mm; min-height: 297mm; padding: 14mm; color: #000; background: var(--white);
  border: 1px solid rgba(91, 42, 60, 0.3); border-radius: 6px; box-shadow: 0 4px 0 rgba(91, 42, 60, 0.25);
  font: 500 11pt/1.4 var(--font-ui); display: flex; flex-direction: column; gap: 3mm;
}
.paper-head { display: flex; justify-content: space-between; gap: 8mm; padding-bottom: 3mm; border-bottom: 1.5px solid #333; }
.ph-title { font: 800 14pt/1.2 var(--font-ui); }
.ph-small { font: 500 8.5pt/1.3 var(--font-ui); color: #333; }
.ph-right p { font: 500 10pt/1.8 var(--font-ui); white-space: nowrap; }
.paper-foot { display: flex; align-items: center; gap: 3mm; margin-top: auto; padding-top: 1mm; font: 500 8.5pt/1 var(--font-ui); color: #333; }
.foot-kitty { width: 7mm; height: auto; color: #333; }
/* the sheet is the same on screen and on paper (print.css only removes the chrome and inks it), so the preview shows
   what prints: 12 compact blocks in 2 columns, pictures in the paper's type sizes */
.paper { --fs-title: 15pt; --fs-prompt: 12pt; --fs-option: 11pt; --fs-body: 10pt; --fs-ui: 10pt; --fs-small: 8.5pt; }
.ws-list { list-style: none; columns: 2; column-gap: 8mm; }
.ws-q { display: flex; gap: 2mm; margin-bottom: 2mm; break-inside: avoid; page-break-inside: avoid; }
.ws-q.is-line { margin-bottom: 1.5mm; }
.ws-n { flex: none; font: 800 11pt/1.4 var(--font-ui); }
.ws-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1mm; }
.ws-prompt, .paper .pq-prompt { font: 800 11.5pt/1.3 var(--font-ui); margin: 0 0 0.5mm; }
.ws-listen, .ws-clue { font: 500 10.5pt/1.35 var(--font-ui); }
.ws-clue .ws-listen { font-weight: 800; }
.ws-writeline { display: block; height: 7mm; border-bottom: 1.4px solid #333; }
/* a prompt's picture (context print): a block the width of the column. A drawing fills it up to 25 mm tall (an SVG
   with only a viewBox needs a definite width, never a shrink-wrapped flex item); real text and HTML pictures
   (passages, column sums, grids, tables) keep their own height so nothing spills onto the next question */
.ws-visual { display: block; }
.paper .visual.v-in-print { max-width: 100%; max-height: none; margin: 0.5mm 0; justify-content: flex-start; }
.paper .visual.v-in-print > svg { width: 100%; max-width: 100%; height: auto; max-height: 25mm; }
/* square logic pictures built from glyphs keep their cells and colour words legible (§5.3 print) */
.paper .visual.v-in-print:is(.v-matrix, .v-sudoku, .v-magic, .v-pixels) > svg { max-height: 42mm; }
.paper .visual.v-in-print:not(:has(> svg)) { display: block; overflow: visible; }
/* column sums, magic squares, pyramids: drawn in screen pixels, so the paper shows them at 80 % (still 13 pt digits) */
.paper .visual.v-in-print:not(.v-text):not(:has(> svg)) { zoom: 0.8; }
.paper .pq-answer { margin-top: 1mm; }
.paper .pq-grid-table { font-size: 8.5pt; margin-top: 1mm; }
.paper .pq-grid-table td { width: 11mm; height: 6.5mm; }
.paper :is(.pq-note, .pq-pick, .pq-bank) { margin-top: 0.5mm; font-size: 8.5pt; }
/* forms fit their column: a 4-bucket sort table shares the width, long words wrap their letter boxes */
.paper .pq-sort-table { width: 100%; table-layout: fixed; }
.paper .pq-sort-table :is(th, td) { min-width: 0; padding: 1mm 1.5mm; font-size: 9pt; overflow-wrap: anywhere; }
.paper .pq-sort-table td { height: 16mm; }
.paper .pq-letters { flex-wrap: wrap; }
/* a number line's end labels ("3,900") hang past its ends: room for them inside the column */
.paper .pq-line-svg { box-sizing: border-box; padding-inline: 3mm; }
.ws-answers { list-style: none; columns: 3; column-gap: 6mm; }
.ws-answers li { display: flex; flex-direction: column; gap: 1mm; margin-bottom: 2mm; break-inside: avoid; }
.ws-answers b { font: 800 11pt/1.3 var(--font-ui); }
.ws-hint { font: 500 8.5pt/1.3 var(--font-ui); color: #333; }
.ws-read { padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 2.5mm; font: 500 11pt/1.4 var(--font-ui); }
.ws-sub { font: 800 12pt/1.2 var(--font-ui); }
.pf-options { display: flex; flex-wrap: wrap; gap: 3mm 6mm; font: 500 11pt/1.4 var(--font-ui); }
.pf-box { display: inline-block; width: 28mm; height: 12mm; border: 1.4px solid #333; border-radius: 2mm; vertical-align: middle; }
.pf-letter { display: inline-block; width: 8mm; height: 9mm; margin-right: 1.5mm; border-bottom: 1.4px solid #333; }
.pf-rank, .pf-match ul { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 2mm; }
.pf-rankbox { display: inline-block; width: 9mm; height: 7mm; border: 1.4px solid #333; vertical-align: middle; }
.pf-match { display: flex; justify-content: space-between; gap: 10mm; }
.pf-table { border-collapse: collapse; width: 100%; }
.pf-table th, .pf-table td { border: 1.2px solid #333; height: 8mm; padding: 1mm 2mm; }
.pf-clockface { width: 32mm; height: 32mm; color: #333; }
.pf-note { font: 500 10pt/1.3 var(--font-ui); }
.pr-line { font: 500 10.5pt/1.45 var(--font-ui); }
.pr-tiles { width: 100%; border-collapse: collapse; }
.pr-tiles td { border: 1.2px solid #333; padding: 1.2mm 2.5mm; vertical-align: top; }
.pr-tiles b { display: block; font: 800 12pt/1.15 var(--font-ui); }
.pr-tiles small { font: 500 8.5pt/1.2 var(--font-ui); }
.pr-h { font: 800 9.5pt/1.3 var(--font-ui); margin-top: 1mm; }
.pr-bars { width: 100%; height: auto; max-height: 17mm; }
.pr-reasons { width: 100%; border-collapse: collapse; table-layout: fixed; }
.pr-reasons th, .pr-reasons td { border: 1.2px solid #333; padding: 0.8mm 1.5mm; font: 500 8.5pt/1.3 var(--font-ui); text-align: center; }
.pr-reasons th { font-weight: 800; }
.pr-list { padding-left: 5mm; font: 500 9pt/1.4 var(--font-ui); }
.pr-std { padding-left: 4mm; columns: 3; column-gap: 6mm; font: 500 6.8pt/1.25 var(--font-ui); }
.pr-std li { break-inside: avoid; }
.paper-report { gap: 2mm; }
.pr-two { display: grid; grid-template-columns: 1fr 1fr; gap: 6mm; }
.pr-col { display: flex; flex-direction: column; gap: 1.5mm; min-width: 0; }
.pr-small { font: 500 8.5pt/1.35 var(--font-ui); color: #333; }
.prm { columns: 3; column-gap: 4mm; }
/* subjects flow through the 3 columns (one whole subject per column left a 26-row spelling + words column, two
   pages); a unit row never splits and a subject's name never ends a column */
.prm-subject { margin-bottom: 2mm; }
.prm-name { font: 800 9pt/1.3 var(--font-ui); margin-bottom: 0.3mm; break-after: avoid; break-after: avoid-column; }
.prm-unit { display: flex; align-items: flex-start; gap: 1.2mm; padding: 0.15mm 0; break-inside: avoid; }
.prm-unit-name { flex: 0 0 21mm; font: 500 6.5pt/1.2 var(--font-ui); padding-top: 0.5mm; }
.prm-cells { display: flex; flex-wrap: wrap; gap: 0.8mm; }
.prm-cell { display: inline-grid; place-items: center; min-width: 6.5mm; height: 4.2mm; padding: 0 0.8mm; font: 800 6.5pt/1 var(--font-ui); white-space: nowrap; border: 1px solid #333; border-radius: 1mm; color: #555; }
.prm-cell.is-on { color: #000; background: #eee; }
.wanted-sets { columns: 3; column-gap: 5mm; }
.wanted-set { margin-bottom: 3mm; }
.wanted-cap { font: 800 9.5pt/1.3 var(--font-ui); break-after: avoid; }
.wanted-table { width: 100%; border-collapse: collapse; }
.wanted-table tr { break-inside: avoid; }
.wanted-table td { border-bottom: 0.8px solid #999; padding: 0.5mm 0.8mm; font: 500 7.5pt/1.25 var(--font-ui); vertical-align: top; }
.w-box { width: 3.5mm; font-size: 9pt !important; }
.w-no { width: 6mm; white-space: nowrap; color: #333; }
.w-rarity { width: 1%; white-space: nowrap; font-size: 6.5pt !important; color: #333; text-align: right; }
.w-rarity.is-quest { white-space: normal; min-width: 16mm; }
.wanted-end { margin-top: 2mm; font-weight: 800; }
.paper-cert { justify-content: center; }
.cert-frame { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7mm; padding: 14mm 12mm; text-align: center; border: 4px double #333; outline: 1.5px solid #333; outline-offset: 3mm; }
.cert-art { display: flex; align-items: center; gap: 10mm; color: #333; }
.cert-kitty { width: 44mm; height: auto; }
.seal { width: 32mm; height: 32mm; }
.cert-title { font: 400 28pt/1.1 var(--font-display); color: #000; }
.cert-line { max-width: 140mm; font: 800 15pt/1.45 var(--font-ui); }
.cert-flavor { max-width: 130mm; font: 500 12pt/1.5 var(--font-ui); font-style: italic; }
.cert-date { font: 500 11pt/1.4 var(--font-ui); }
.cert-ring { width: 70mm; height: 70mm; color: #333; }
.cert-mosaic { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1mm; width: 130mm; }
.cert-mosaic span { display: grid; place-items: center; aspect-ratio: 1; border: 1px solid #333; font: 500 6.5pt/1 var(--font-ui); }
.meter.mini .meter-star { display: none; }
.ws-rule { font: 500 10.5pt/1.4 var(--font-ui); padding: 2mm 3mm; border-left: 2px solid #333; }
