/* Phone first (most readers use a phone browser); wider screens get more room from 700px up. */
:root { --ink: #1d1d1f; --muted: #6e6e73; --line: #d2d2d7; --bg: #fbfbfd; --card: #ffffff; --accent: #0a66c2; --ok: #1a7f37; --warn: #b35900; --bad: #c62828;
  --pad: 14px; --bar: calc(76px + env(safe-area-inset-bottom)); }
@media (prefers-color-scheme: dark) {
  :root { --ink: #f2f2f7; --muted: #a1a1a6; --line: #3a3a3c; --bg: #111113; --card: #1c1c1e; --accent: #4ea1ff; --ok: #3fb950; --warn: #f0a050; --bad: #ff6b6b; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 17px/1.5 -apple-system, "Segoe UI", "Noto Sans Armenian", sans-serif; color: var(--ink); background: var(--bg);
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }

/* header: one compact line on a phone */
header { display: flex; gap: 10px; align-items: center; padding: 8px var(--pad); padding-top: calc(8px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); min-height: 48px; }
.brand { font-weight: 600; color: var(--ink); font-size: 15px; margin-right: auto; white-space: nowrap; }
header #nav-home { order: -1; font-size: 15px; font-weight: 600; padding: 8px 10px 8px 0; min-height: 44px; }
header.in .brand { display: none; }  /* on a phone the menu button takes the brand's place */
#who { white-space: nowrap; margin-left: auto; }
#progress { white-space: nowrap; }

main { max-width: 760px; margin: 0 auto; padding: var(--pad); padding-bottom: calc(var(--bar) + 16px); }
h1 { font-size: 23px; line-height: 1.3; margin: 6px 0 12px; }
h2 { font-size: 15px; color: var(--muted); margin: 20px 0 6px; font-weight: 600; }
p { margin: 0 0 12px; }
.view { display: none; }
.view.on { display: block; }
.hidden { display: none !important; }

/* buttons: 44px+ touch targets */
button { font: inherit; min-height: 44px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.stop { background: var(--bad); border-color: var(--bad); color: #fff; font-weight: 600; }
button.big { font-size: 19px; padding: 14px 20px; width: 100%; }
button.link { border: 0; padding: 6px 4px; min-height: 0; color: var(--accent); font-size: 15px; background: none; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }

/* the action bar stays at the bottom of the screen, above the iPhone home bar */
.sticky { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; margin: 0; padding: 10px var(--pad); padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--line); display: flex; flex-wrap: nowrap; gap: 10px; align-items: center; }
.sticky > button { flex: 1; min-width: 0; }
.sticky .meter { position: absolute; left: 0; right: 0; top: -1px; height: 4px; margin: 0; border-radius: 0; }

/* forms: 16px+ inputs so iPhone Safari does not zoom in */
label { display: block; margin: 12px 0; }
label input:not([type=checkbox]):not([type=radio]), label select, label textarea { display: block; width: 100%; font: inherit; font-size: 17px; padding: 10px 12px; margin-top: 6px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); }
label select option { color: #000; }
label input[type=file] { padding: 8px; }
label.check { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; }
label.check input { width: 22px; height: 22px; flex: none; margin: 2px 0 0; accent-color: var(--accent); }
fieldset { border: 0; padding: 0; margin: 14px 0; }
legend { font-weight: 600; padding: 0; margin-bottom: 2px; }
#dialect-box input { margin-top: 8px; }
.consent { border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px; max-height: 45vh; overflow: auto; font-size: 15px; background: var(--card); -webkit-overflow-scrolling: touch; }
.consent ul { padding-left: 20px; }
.tips { padding-left: 20px; color: var(--muted); }
.step { font-weight: 600; }

/* menu and lists */
.menu { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 8px 0 16px; }
.card, .work { text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 14px; background: var(--card); width: 100%; }
.card b { font-size: 17px; }
.card span, .work span { font-size: 14px; color: var(--muted); }
.works { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
#pick-for-me { width: 100%; }

/* reading */
.steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 10px; counter-reset: step; font-size: 12px; }
.steps li { counter-increment: step; flex: 1; padding: 5px 4px; border-radius: 8px; border: 1px solid var(--line); color: var(--muted); text-align: center; white-space: nowrap; }
.steps li::before { content: counter(step) ". "; }
.steps li.on { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.steps li.done { color: var(--ok); border-color: var(--ok); }
.part { font-size: 26px; font-weight: 700; line-height: 1.2; margin: 6px 0 4px; }
.pagehead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.pagehead #change-work { white-space: nowrap; font-size: 14px; }
.prompt { font-size: 22px; font-weight: 600; line-height: 1.45; }
.read { font-size: 21px; line-height: 1.65; }
.read p { margin: 0 0 14px; }
.read.single { font-size: 25px; line-height: 1.5; margin-top: 18px; }
.hint { color: var(--muted); font-size: 15px; }
.meter { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin: 10px 0; }
.meter div { height: 100%; width: 0; background: var(--ok); transition: width .05s; }
.meter div.hot { background: var(--bad); }
.mic-input { min-width: 0; flex-basis: 100%; }
.mic-input:has(label.hidden):has(.mic-name:empty), .mic-name:empty { display: none; }
.mic-name { overflow-wrap: anywhere; }
#rec-time { font-variant-numeric: tabular-nums; font-weight: 400; margin-left: 6px; }
.result { color: var(--muted); }
.result.ok { color: var(--ok); }
.result.warn, .warn { color: var(--warn); }

/* review */
.review { display: flex; flex-direction: column; gap: 10px; }
.sent { border: 1px solid var(--line); border-left-width: 4px; border-radius: 12px; padding: 10px 12px; background: var(--card); }
.sent p { margin: 0 0 8px; font-size: 18px; line-height: 1.5; }
.sent.done { border-left-color: var(--ok); }
.sent.done p { color: var(--muted); font-size: 16px; }
.sent.pending { border-left-color: var(--warn); }
.sent.dropped { border-left-color: var(--line); opacity: .6; }
.sent .heard { font-size: 15px; color: var(--warn); }
.sent .meter { margin: 0 0 8px; }
.btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: center; }
.btns button { padding: 8px 10px; font-size: 15px; }
.btns .tag { font-size: 13px; color: var(--muted); }
.btns button.link { justify-self: start; }
.edit textarea { width: 100%; font: inherit; font-size: 17px; padding: 8px 10px; border: 1px solid var(--accent); border-radius: 10px; background: var(--bg); color: var(--ink); margin-bottom: 8px; }
mark { background: color-mix(in srgb, var(--warn) 30%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }

.flash { position: fixed; top: 40%; left: 50%; transform: translate(-50%, -50%); font-size: 72px; color: var(--ok); pointer-events: none; animation: fade .9s ease-out forwards; z-index: 10; }
@keyframes fade { from { opacity: 1; } to { opacity: 0; transform: translate(-50%, -70%); } }

/* owner page */
table { border-collapse: collapse; width: 100%; font-size: 14px; }
td, th { border-bottom: 1px solid var(--line); padding: 6px; text-align: left; vertical-align: top; }
.table-wrap { overflow-x: auto; }

/* laptops and tablets */
@media (min-width: 700px) {
  :root { --pad: 24px; }
  header { font-size: 14px; }
  header.in .brand { display: inline; }
  .brand { margin-right: 4px; }
  header #nav-home { order: 0; }
  h1 { font-size: 28px; }
  .menu { grid-template-columns: 1fr 1fr; }
  .steps { font-size: 14px; }
  .part { font-size: 32px; }
  .read { font-size: 23px; }
  .read.single { font-size: 30px; }
  .prompt { font-size: 26px; }
  .btns { display: flex; flex-wrap: wrap; }
  .sticky > button { flex: 0 1 280px; }
  .sticky { justify-content: center; }
  button.big { width: auto; min-width: 260px; }
  #pick-for-me { width: auto; }
  .card:hover, .work:hover { border-color: var(--accent); }
}

/* Orchard map, game pieces and the player HUD. */
.reader {
  --apricot: #f28c28; --pomegranate: #c0392b; --blue: #1c376e; --brand-blue: #2b6a96; --brand-teal: #3fa7c4;
  --gold: #e8b923; --green: #3fa34d;
  --ink: #13213d; --heading: var(--blue); --muted: #4d5c76; --line: #e4e9f2; --bg: #fbf3ec; --card: #fff;
  --backdrop-opacity: .35;
  --soft: #f1f5fa; --tint: #ffead0; --accent: var(--brand-blue); --info: var(--brand-blue); --ok: #256d38; --warn: #904609;
  --fire: #a53429; --fire-soft: #fde5de; --blue-soft: #e9f1fa; --gold-soft: #fff0bf;
  --secondary-ink: var(--blue); --tab-on: #e3eefa; --input-line: #7b8ba5;
  --progress-ink: color-mix(in srgb, var(--brand-teal), var(--brand-blue) 60%);
  --ruby: var(--pomegranate); --ruby-paper: #fceeea;
  --card-radius: 14px; --window-radius: 18px; --button-radius: 999px; --chip-radius: 10px;
  --card-shadow: 0 6px 16px #1c376e17; --window-shadow: 0 20px 40px #13213d2e;
  /* Shade the reference apricot stops enough to keep white labels at AA. */
  --action: linear-gradient(135deg, color-mix(in srgb, #f39a55 54%, #4a2215), color-mix(in srgb, #e2733a 67%, #4a2215));
  --action-shadow: 0 4px 10px #e2733a55;
  --map: #faf3e6; --map-dot: #dacebb; --terrain-shadow: #dccfb8; --road: #e2cfaa; --stitch: #fff5df;
  --stone: #dedcd5; --stone-edge: #aba89e; --stone-ink: #75756f;
  --hud: var(--review-hud, calc(64px + env(safe-area-inset-top))); --pad: clamp(14px, 4vw, 28px);
  --display: ui-rounded, system-ui, -apple-system, "Segoe UI", "Noto Sans Armenian", sans-serif;
  isolation: isolate; min-height: 100vh; font-family: var(--display); color-scheme: light; background: var(--bg);
}
/* Background: a faint painted stop scene at the top of the screen, changing every 10 minutes (backdrop.js). */
#backdrop { position: fixed; z-index: -1; inset: 0; pointer-events: none; overflow: hidden; }
.backdrop-layer { position: absolute; inset: -6px -6px auto; height: 70vh; opacity: 0;
  background: center top / 100% auto no-repeat; filter: blur(2px) saturate(.8);
  -webkit-mask-image: linear-gradient(#000 0, #000 18%, transparent 92%); mask-image: linear-gradient(#000 0, #000 18%, transparent 92%);
  transition: opacity 3.5s ease-in-out; }
.backdrop-layer.on { opacity: var(--backdrop-opacity, .35); }
.backdrop-layer.instant { transition: none; }
@media (min-aspect-ratio: 3/4) { .backdrop-layer { background-size: cover; height: 80vh; } }
@media (prefers-reduced-motion: reduce) { .backdrop-layer { transition-duration: .4s; } }
@media (prefers-color-scheme: dark) {
  .reader {
    --ink: #e8eef9; --heading: #8fd3e8; --muted: #a3b3cf; --line: #233256; --bg: #0d1424; --card: #141d33;
    --backdrop-opacity: .45;
    --soft: #19243e; --tint: #4c3528; --accent: var(--heading); --info: var(--heading); --ok: #9ae3a6; --warn: #ffc188;
    --fire: #ffad99; --fire-soft: #532f30; --blue-soft: #1c2947; --gold-soft: #49402b;
    --secondary-ink: #cfe3f5; --tab-on: #1c3150; --input-line: #657aa5;
    --progress-ink: var(--brand-teal);
    --ruby: #ff9c8a; --ruby-paper: #382432;
    --card-shadow: 0 8px 18px #0006; --window-shadow: 0 20px 40px #000a;
    --map: #2d2b2a; --map-dot: #4b453c; --terrain-shadow: #39382f; --road: #574c3b; --stitch: #8b795b;
    --stone: #555353; --stone-edge: #383537; --stone-ink: #d0c8bf; color-scheme: dark;
  }
  .reader select option { color: var(--ink); }
}
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.reader .icon { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.game-icon { display: block; object-fit: contain; }
.reader h1, .reader h2, .reader b, .reader strong { font-family: var(--display); }
.reader h1 { font-size: clamp(25px,4vw,38px); line-height: 1.18; font-weight: 780; letter-spacing: -.025em; margin: 3px 0 20px; }
.reader :is(h1, h2, h3, legend) { color: var(--heading); }
.reader h2 { font-weight: 800; }
.reader :where(button) {
  border-radius: var(--button-radius); background: var(--blue-soft); color: var(--secondary-ink);
  font-weight: 650; transition: background-color .18s, transform .16s, box-shadow .16s;
}
.reader :is(a, button.link) { color: var(--info); }
.reader :is(a, button, input, select, summary, textarea):focus-visible { outline: 3px solid var(--info); outline-offset: 4px; }
.reader button.primary {
  min-height: 48px; border: 1px solid transparent; border-radius: var(--button-radius);
  background: var(--action); color: white; box-shadow: var(--action-shadow);
  font-weight: 850; font-size: 15px; letter-spacing: .015em;
}
.reader button.primary:active:not(:disabled) { transform: translateY(2px); }
.reader button.stop { background: var(--pomegranate); border-color: var(--pomegranate); color: white; }
.reader button.link { min-height: 44px; color: var(--info); }
.reader button:disabled:where(:not(.lesson-node, .trail-chest)) {
  opacity: 1; color: var(--muted); background: var(--soft); border-color: var(--line); box-shadow: none; cursor: default;
}
.reader :is(.lesson-node, .trail-chest):disabled { opacity: 1; }
.reader label input:not([type=checkbox]):not([type=radio]), .reader label select, .reader label textarea, .reader .edit textarea {
  border-color: var(--input-line); background: var(--card);
}
.reader ::placeholder { color: var(--muted); opacity: 1; }
.reader .consent { border-radius: var(--card-radius); box-shadow: var(--card-shadow); }
.reader progress { appearance: none; display: block; width: 100%; height: 12px; border: 0; border-radius: 20px; background: var(--soft); color: var(--progress-ink); overflow: hidden; }
.reader progress::-webkit-progress-bar { background: var(--soft); border-radius: 20px; box-shadow: inset 0 2px #3a291217; }
.reader progress::-webkit-progress-value { background: var(--progress-ink); border-radius: 20px; transition: width .22s; }
.reader progress::-moz-progress-bar { background: var(--progress-ink); border-radius: 20px; }
.app-header { display: block; margin-inline: calc(-1 * env(safe-area-inset-left)) calc(-1 * env(safe-area-inset-right));
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); background: var(--card); }
.has-game .app-header { position: sticky; top: 0; z-index: 8; }
.review-banner { padding-inline: var(--pad); background: var(--blue-soft); color: var(--info); }
.review-banner summary, #review-effects { max-width: 960px; margin-inline: auto; }
.review-banner summary { display: flex; align-items: center; gap: 6px; min-height: 28px; font-size: 12px; font-weight: 750; cursor: pointer; }
.review-banner summary::-webkit-details-marker { display: none; }
.review-banner summary::after { content: "▾"; }
.review-banner[open] summary::after { content: "▴"; }
#review-effects { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; padding-bottom: 5px; }
#review-effects button { min-height: 34px; padding: 4px 7px; font-size: 11px; }
#review-effects a { display: inline-grid; align-items: center; min-height: 34px; padding-inline: 6px; font-size: 12px; }
#review-tree-picker { font-size: 14px; }
#review-tree-stage { width: 100%; accent-color: var(--accent); }
.topline { max-width: 1030px; height: 63px; padding: 4px var(--pad); margin: auto; display: flex; align-items: center; gap: 8px; }
.topline .brand { display: inline-flex; gap: 9px; align-items: center; font-weight: 800; }
.has-game .brand, .in-lesson #top-stats { display: none; }
.topline #nav-home { order: -1; border: 1px solid var(--line); background: var(--blue-soft); padding: 0 9px; font-size: 13px; flex: none; }
#top-stats { display: flex; gap: clamp(4px,2vw,12px); align-items: center; justify-content: center; margin: 0 auto; min-width: 0; }
.stat-chip {
  display: inline-flex; justify-content: center; align-items: center; gap: 5px; min-height: 35px; padding: 4px 9px;
  border-radius: var(--chip-radius); font-size: clamp(13px,3.8vw,16px); font-variant-numeric: tabular-nums; line-height: 1; white-space: nowrap;
  background: var(--blue-soft); color: var(--secondary-ink);
}
.has-tabs .stat-chip { min-height: 38px; padding-inline: clamp(10px,3vw,17px); }
.has-tabs #top-stats { gap: clamp(6px,2.5vw,16px); }
.stat-chip b { font-weight: 850; }
.stat-chip .icon { width: 21px; height: 21px; }
#top-tree { border: 1px solid var(--line); }
#top-tree .tree-art { display: block; width: 27px; height: 27px; }
#top-tree b::after { content: "ր"; }
.mini-ring { width: 22px; height: 22px; display: inline-grid; place-items: center; position: relative; }
.mini-ring::after { content: ""; position: absolute; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.reader .mini-ring > .game-icon { position: absolute; width: 100%; height: 100%; }
.mini-ring:has(.game-icon)::after, .mini-ring:has(.game-icon) > .fx-ring { visibility: hidden; }
.mini-ring > .fx-ring { width: 100%; height: 100%; }
.mini-ring .fx-ring-track { stroke: currentColor; opacity: .42; }
.mini-ring .fx-ring-fill { stroke: currentColor; }
.star { fill: var(--gold) !important; color: #a9760e; }
#top-level { padding: 4px 5px; background: #f5cc5d; color: #553814; font-size: 10px; border-radius: 7px; font-weight: 850; }
#top-level::before { content: "Մ. "; }
.game-tabs { position: fixed; z-index: 7; inset: auto 0 0;
  padding: 5px calc(4px + env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) calc(4px + env(safe-area-inset-left));
  background: var(--card); border-top: 1px solid var(--line); }
.game-tabs > div { display: flex; justify-content: center; max-width: 760px; margin: auto; }
.game-tabs button { flex: 1; min-width: 0; min-height: 52px; display: grid; justify-items: center; align-content: center; gap: 3px; padding: 1px; border: 0; background: transparent; color: var(--muted); font-size: clamp(10px,2.8vw,13px); line-height: 1.2; white-space: nowrap; }
.game-tabs button:nth-child(2) { flex-grow: 1.3; }
.game-tabs .icon { width: 49px; height: 28px; padding: 3px 11px; border-radius: 14px; }
.game-tabs [aria-current] { color: var(--heading); font-weight: 850; }
.game-tabs [aria-current] .icon { background: var(--tab-on); }
@keyframes tab-pop { 45% { transform: translateY(-3px) scale(1.1); } }
@media (prefers-reduced-motion: no-preference) { .game-tabs [aria-current=page] .icon { animation: tab-pop .22s ease-out; } }
.reader main { padding-top: 20px; }
.reader.has-tabs main { max-width: 1040px; padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
#hub-status { color: var(--muted); font-size: 14px; }
.reader .panel, .reader .card, .reader .work, .reader .sent {
  border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: var(--card-radius); box-shadow: var(--card-shadow);
}
.reader .panel { padding: 18px; }
.panel h2, .panel legend { margin: 0 0 12px; font-size: 19px; font-weight: 800; }
#units { min-width: 0; }
#path-aside { display: none; }
.path-unit {
  --unit: #a64243; position: relative; border-radius: 22px; margin-bottom: 22px;
  background: var(--map); box-shadow: inset 0 0 0 1px var(--line), 0 3px var(--line);
}
.unit-banner {
  position: relative; isolation: isolate; overflow: hidden; border-radius: 20px; padding: 16px 18px 14px;
  background: color-mix(in srgb, var(--unit) 86%, #862f35); color: white; box-shadow: 0 4px 0 color-mix(in srgb, var(--unit) 72%, #382527);
}
.path-unit > .unit-banner { position: sticky; top: var(--hud); z-index: 3; }
.unit-banner > div { position: relative; z-index: 1; max-width: 76%; }
.unit-banner small { display: block; font-size: 13px; letter-spacing: .11em; line-height: 1.3; font-weight: 850; color: #fff0d7; }
.unit-banner h2 { margin: 5px 0; color: white; font-size: clamp(22px,3.4vw,32px); line-height: 1.17; letter-spacing: -.035em; text-shadow: 0 2px #3d142d30; }
.unit-banner p, #league-week { font-size: 13px; font-weight: 700; margin: 0; }
.unit-info { position: absolute; z-index: 2; width: 44px; height: 44px; top: 2px; right: 2px; border: 0; padding: 7px; background: transparent; color: white; }
.unit-info .icon { display: block; width: 100%; height: 100%; border-radius: 50%; border: 1.5px solid #ffffffba; background: #472b3599; }
.trail { position: relative; max-width: 560px; margin: 0 auto; isolation: isolate;
  background-image: radial-gradient(var(--map-dot) 1px, transparent 1.2px); background-size: 19px 19px;
}
.trail-line { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke-linecap: round; }
.road { stroke: var(--road); stroke-width: 12px; }
.road-stitches { stroke: var(--stitch); stroke-width: 2.5px; stroke-dasharray: 3 7; }
.lesson-track { list-style: none; padding: 0; margin: 0; }
.trail-stop { position: absolute; inset-inline: 0; height: 0; }
.lesson-node {
  --face: var(--stone); --edge: var(--stone-edge); --node-ink: var(--stone-ink);
  position: absolute; left: var(--node-x); top: 0; translate: -50% -50%; display: grid; place-items: center;
  width: 76px; height: 67px; border-radius: 50%; padding: 0; color: var(--node-ink); border: 2px solid var(--edge);
  background: var(--face); box-shadow: 0 7px 0 var(--edge), 0 12px 0 -2px var(--terrain-shadow), inset 0 4px #ffffff30;
}
.lesson-node > .icon { width: 33px; height: 33px; stroke-width: 2.5; }
.lesson-node.current { z-index: 3; }
.lock-pin { position: absolute; right: -4px; bottom: -3px; width: 25px; height: 25px; display: grid; place-items: center; border: 2px solid var(--map); border-radius: 50%; background: var(--stone-ink); color: var(--stone); }
.reader .lock-pin .icon { width: 16px; height: 16px; stroke-width: 2.4; }
.lesson-node.current::before {
  content: ""; position: absolute; inset: -8px -8px -12px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(var(--green) var(--completed,0%), #ffb66e 0);
  mask: radial-gradient(ellipse closest-side, transparent calc(100% - 4px), black calc(100% - 3px), black calc(100% - 1px), transparent);
}
.lesson-node:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--edge), inset 0 2px #0001; }
.start-bubble {
  position: absolute; border-radius: 12px; font-size: 13px; font-weight: 850; white-space: nowrap; line-height: 1.2;
  padding: 7px 12px; box-shadow: 0 3px 0 #39282622;
}
.start-bubble { bottom: calc(100% + 14px); background: var(--ink); color: var(--card); }
.start-bubble::after { content: ""; position: absolute; left: calc(50% - 5px); bottom: -4px; width: 9px; height: 9px; background: inherit; transform: rotate(45deg); }
.map-detail { width: 72px; height: 68px; position: absolute; translate: -50% -50%; pointer-events: none; }
/* Lesson preview, level HUD, recording controls and the review desk. */
#lesson-sheet, #take-feedback { width: min(100% - 16px, 424px); max-height: 90dvh; margin: auto auto max(9px, env(safe-area-inset-bottom)); padding: 24px; overflow: auto; border: 1px solid var(--line); border-radius: var(--window-radius); background: var(--card); color: var(--ink); box-shadow: var(--window-shadow); }
#lesson-sheet::backdrop { background: #18151e85; }
#take-feedback::backdrop { background: #201a242c; }
.sheet-close { position: absolute; top: 9px; right: 9px; width: 44px; height: 44px; padding: 0; border: 0; }
.sheet-icon, .goal-emblem { display: grid; place-items: center; width: 54px; height: 53px; border-radius: 17px; background: var(--apricot); color: #5d3218; box-shadow: 0 4px #b96725; }
.sheet-icon > .icon { width: 35px; height: 35px; }
#sheet-eyebrow { display: block; margin-top: 17px; color: var(--accent); font-weight: 800; }
#sheet-eyebrow:empty { display: none; }
#sheet-title { font-size: 25px; line-height: 1.25; margin: 5px 0; }
#sheet-detail { color: var(--muted); margin-bottom: 20px; }
#sheet-start { min-width: 0; width: 100%; }
.in-lesson .topline { max-width: 760px; gap: 14px; }
#lesson-progress { flex: 1; min-width: 0; }
#lesson-progress > div, .level-line { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; font-size: 13px; }
#lesson-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#lesson-count, #profile-xp { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
#lesson-meter { height: 14px; }
.in-lesson #nav-home { width: 44px; height: 44px; font-size: 20px; }
.in-lesson .steps { display: none; }
.reader .steps li { background: var(--card); font-weight: 700; }
.reader .part { color: var(--info); font-size: 17px; font-weight: 800; margin: 7px 0 12px; }
.part:empty, .pagehead:has(#page-where:empty):has(#change-work.hidden) { display: none; }
#page-text, #v-read .prompt, #mic-sentence:not(.hidden) {
  padding: clamp(22px,5vw,38px); border: 1px solid var(--line); border-radius: var(--card-radius);
  background: var(--card); box-shadow: var(--card-shadow); color: var(--ink); line-height: 1.6; overflow-wrap: anywhere;
}
#page-text.single, #v-read .prompt { font-size: clamp(24px,5vw,34px); font-weight: 700; line-height: 1.55; }
#free-instruction { padding: 10px 14px; border-inline-start: 4px solid var(--info); border-radius: 8px;
  background: var(--card); color: var(--info); font-weight: 750; }
#page-text:empty { display: none; }
#page-text p:last-child { margin-bottom: 0; }
.reader[data-view=read] main { padding-bottom: calc(174px + env(safe-area-inset-bottom)); }
.reader .sticky { background: var(--card); }
.reader .recorder { flex-direction: column; justify-content: center; gap: 8px;
  padding: 11px calc(var(--pad) + env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) calc(var(--pad) + env(safe-area-inset-left)); }
.recorder .meter { position: static; width: min(160px, 45%); height: 5px; margin: 0 0 4px; border-radius: 6px; }
.reader .recorder button.big {
  flex: none; display: grid; place-items: center; width: auto; min-width: 122px; border: none; padding: 0;
  background: none; box-shadow: none; color: var(--ink); font-size: 13px; font-weight: 800; text-transform: none;
}
.reader .recorder button::before, .recorder button > .icon, .recorder .stop-icon { grid-area: 1 / 1; }
.reader .recorder button.big::before {
  content: ""; display: block; width: 66px; height: 66px; border-radius: 50%; background: var(--action);
  box-shadow: var(--action-shadow), 0 0 0 7px var(--tint);
}
.recorder #rec-stop::before {
  background: var(--pomegranate); box-shadow: 0 4px #90352c,
    0 0 0 calc(4px + 4px * var(--signal,0)) color-mix(in srgb, var(--pomegranate) 28%, var(--card)),
    0 0 0 calc(8px + 8px * var(--signal,0)) var(--fire-soft);
}
.recorder button > .icon { width: 32px; height: 32px; color: white; }
.recorder .stop-icon { width: 20px; height: 20px; border-radius: 5px; background: white; }
.recorder button > span:last-child { margin-top: 9px; }
#rec-time { margin: 0; }
.reader .recorder button:active:not(:disabled) { box-shadow: none; transform: translateY(3px); }
.reader.owner-review[data-view=read] main { padding-bottom: calc(94px + env(safe-area-inset-bottom)); }
.reader.owner-review .recorder { flex-direction: row; }
.owner-review .recorder .meter, .reader.owner-review .recorder button::before { display: none; }
.reader.owner-review .recorder #rec-start { display: flex; gap: 5px; flex: 0 0 auto; min-width: 0; padding: 0 10px;
  background: var(--soft); color: var(--muted); box-shadow: none; }
.owner-review .recorder #rec-start .icon { width: 19px; height: 19px; color: currentColor; }
.owner-review .recorder #rec-start span { margin-top: 0; }
.owner-review .recorder #review-next { flex: 0 1 250px; padding-inline: 9px; font-size: 14px; }
.reader #v-review .sticky, .reader.owner-review .recorder {
  min-height: calc(74px + env(safe-area-inset-bottom));
  padding-right: calc(var(--pad) + env(safe-area-inset-right) + clamp(60px, 19vw, 86px));
}
.reader[data-view=review] main { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
.reader .sent { border-left-width: 5px; scroll-margin-block: calc(var(--hud) + 10px) calc(var(--bar) + 10px); }
.reader .sent.pending { border-left-color: var(--apricot); }
.reader .sent.done { border-left-color: var(--green); }
.reader .btns button { min-height: 46px; font-size: 14px; }
#take-feedback { padding: 18px; }
.reader:has(#take-feedback[open]) :is(.recorder, #rec-msg) { visibility: hidden; }
.feedback-content { display: flex; align-items: center; gap: 12px; margin-bottom: 15px; }
#feedback-icon { display: grid; place-items: center; width: 43px; height: 43px; flex: none; color: white; background: #a55b22; border-radius: 50%; box-shadow: 0 3px #59301836; }
.passed #feedback-icon { background: #32823e; }
#feedback-title { color: var(--warn); font-size: 19px; line-height: 1.25; }
.passed #feedback-title { color: var(--ok); }
#feedback-combo { display: table; padding: 3px 9px; border-radius: 10px; background: var(--blue); color: white; font-size: 12px; font-weight: 800; margin-top: 5px; }
#feedback-recordings { display: grid; gap: 6px; margin-bottom: 12px; }
#feedback-next { width: 100%; }
@keyframes sheet-rise { from { opacity: 0; transform: translateY(22px); } }
@media (prefers-reduced-motion: no-preference) { #take-feedback[open], #lesson-sheet[open] { animation: sheet-rise .2s ease-out; } }
.reader .flash { top: auto; bottom: 100px; font-size: 18px; font-weight: 750; background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 10px 16px; }

/* League and player profile. */
#v-profile, #v-league, #v-home { max-width: 800px; margin-inline: auto; }
.league-banner { --unit: var(--blue); padding: 18px; background: var(--blue); }
.league-cup.icon { position: absolute; right: 17px; top: 15%; width: 58px; height: 70%; color: #fbd16a; transform: rotate(8deg); }
#podium { display: grid; grid-template-columns: 1fr 1.1fr 1fr; gap: 5px; align-items: end; padding: 42px 4px 4px; }
.podium-place, .rank-circle { --metal: #d7b38d; --rim: #a07951; --metal-ink: #553a28; }
.place-1 { --metal: #f6ce65; --rim: #b78926; --metal-ink: #654414; }
.place-2 { --metal: #cbdbe4; --rim: #8aa1b2; --metal-ink: #314b60; }
.place-3 { --metal: #efb188; --rim: #b27a54; --metal-ink: #663e26; }
.podium-place { position: relative; display: flex; flex-direction: column; text-align: center; align-items: center; justify-content: center; gap: 3px;
  padding: 23px 6px 10px; min-height: 90px; border-radius: 15px 15px 6px 6px; color: var(--metal-ink); background: var(--metal); box-shadow: 0 4px var(--rim), inset 0 2px #ffffff6b; }
.podium-place.place-1 { min-height: 110px; }
.podium-place.place-3 { min-height: 78px; }
.podium-place strong { font-size: clamp(11px,2.8vw,15px); line-height: 1.3; overflow-wrap: anywhere; }
.podium-place > span { font-size: 13px; font-weight: 750; }
.podium-place.vacant { opacity: .58; }
.podium-medal, .rank-circle { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--metal); border: 2px solid var(--rim); color: var(--metal-ink); font-size: 14px; font-weight: 850; }
.podium-medal { position: absolute; top: -22px; width: 42px; height: 42px; box-shadow: 0 3px var(--rim), inset 0 0 0 2px #fff9; font-size: 19px; }
.podium-medal .icon { position: absolute; top: -18px; width: 20px; height: 20px; fill: #fbd05a; color: #a66e18; }
#pinned-rank { position: sticky; top: var(--hud); z-index: 2; display: flex; align-items: center; gap: 7px; margin-top: 19px; padding: 10px 12px; border-radius: 14px; background: var(--blue); color: #fff; box-shadow: 0 3px #143752; font-size: 14px; }
#pinned-rank b { margin-left: auto; white-space: nowrap; }
#pinned-rank small { background: #e4f1fc; border-radius: 7px; padding: 2px 5px; color: #264668; font-weight: 750; }
.league-table { margin-top: 12px; border-spacing: 0; border-collapse: separate; background: var(--card); border: 1px solid var(--line); border-radius: var(--card-radius); box-shadow: var(--card-shadow); overflow: hidden; font-size: 14px; }
.league-table th, .league-table td { vertical-align: middle; padding: 10px; }
.league-table thead { color: var(--muted); font-size: 12px; }
.league-table tr > :last-child { text-align: right; white-space: nowrap; }
.my-rank { background: var(--blue-soft); }
#profile-content { display: grid; gap: 15px; }
.profile-id { display: flex; gap: 15px; align-items: center; padding-bottom: 14px; }
.level-ring { --completed: 0%; position: relative; isolation: isolate; flex: none; display: grid; align-content: center; justify-items: center;
  width: 78px; height: 78px; line-height: 1; color: var(--info); border-radius: 50%; background: conic-gradient(var(--apricot) var(--completed), var(--blue-soft) 0); }
.level-ring::before { content: ""; position: absolute; inset: 7px; z-index: -1; border-radius: 50%; background: var(--card); border: 1px solid var(--line); }
.level-ring small { font-size: 9px; letter-spacing: .08em; font-weight: 850; }
.level-ring b { font-weight: 850; font-size: 28px; }
#profile-nick { margin: 0; font-size: clamp(19px,4.5vw,27px); line-height: 1.25; }
#profile-code { font-size: 13px; color: var(--muted); }
#profile-tree { display: grid; grid-template-columns: min(195px,44%) minmax(0,1fr); align-items: center; gap: clamp(10px,3vw,28px);
  scroll-margin-top: calc(var(--hud) + 14px); }
#profile-tree-art { display: grid; place-items: end center; width: 100%; padding: 0; aspect-ratio: 1; border: 1px solid var(--atlas-rule); border-radius: 50% 50% 16px 16px;
  background: radial-gradient(ellipse at 50% 34%, var(--paper), var(--map-land)); }
#profile-tree-art .tree-art { display: block; width: 95%; }
#profile-tree-title { margin: 0 0 6px; font: 700 clamp(21px,4vw,30px)/1.2 var(--book-type); }
#profile-tree-name { display: block; margin-bottom: 3px; line-height: 1.35; overflow-wrap: anywhere; }
#profile-tree p { margin: 0; color: var(--atlas-muted); line-height: 1.45; font-size: 13px; }
#profile-tree-meter { margin: 8px 0 5px; height: 8px; }
#profile-tree-meter::-webkit-progress-value { background: var(--ok); }
#profile-tree-meter::-moz-progress-bar { background: var(--ok); }
#v-profile fieldset { min-width: 0; margin: 0; }
#v-profile legend { padding: 0 5px; margin: 0; }
.goal-picker, .profile-stats, #badge-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; margin: 0; }
.goal-picker button { padding: 8px 4px; border: 1px solid var(--line); box-shadow: 0 2px var(--line); }
.goal-picker b, .goal-picker small { display: block; }
.goal-picker b { font-size: 15px; }
.goal-picker small, #profile-today { font-size: 13px; color: var(--muted); }
.goal-picker button[aria-pressed=true] { border-color: var(--apricot); background: var(--tint); box-shadow: 0 3px var(--apricot); }
#profile-today { margin: 12px 0 0; }
.profile-stats > div { display: flex; flex-direction: column-reverse; padding: 10px; border-radius: var(--chip-radius); background: var(--soft); }
.profile-stats dt { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.profile-stats dd { font-size: 22px; font-weight: 850; margin: 0; }
.badge-card { padding: 15px 8px 10px; border: 1px solid var(--line); border-radius: var(--card-radius); background: var(--card); box-shadow: var(--card-shadow); display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; overflow-wrap: anywhere; }
.badge-card.earned { background: var(--gold-soft); }
.badge-card b { font-size: 14px; }
.badge-card small { font-size: 12px; color: var(--muted); }
.badge-icon { position: relative; isolation: isolate; display: grid; place-items: center; margin-bottom: 10px; height: 48px; width: 48px; border-radius: 50%; background: #d2cfca; border: 3px solid #a9a49e; color: #736f6c; box-shadow: inset 0 0 0 2px #ffffff75; font-size: 24px; }
.badge-icon::after { content: ""; position: absolute; z-index: -1; top: 100%; width: 32px; height: 11px; background: #9b9692; clip-path: polygon(8% 0,92% 0,100% 100%,72% 78%,58% 100%,50% 30%,40% 100%,25% 76%,0 100%); }
.badge-card:not(.earned) .badge-glyph { filter: grayscale(1) brightness(.4); opacity: .65; }
.badge-glyph .tree-art { display: block; width: 36px; height: 36px; }
.badge-icon > .icon { position: absolute; right: -6px; bottom: -3px; width: 18px; height: 18px; padding: 3px; color: white; background: #625d5b; border-radius: 50%; }
.earned .badge-icon { background: #ffd56d; border-color: #bd8727; }
.earned .badge-icon::after { background: var(--pomegranate); }
.settings { display: flex; flex-wrap: wrap; gap: 8px; }
.settings button { color: var(--info); font-size: 14px; }
#v-setdone { max-width: 440px; margin: 5vh auto; text-align: center; }
#setdone-mascot .fx-mascot { display: block; margin: 0 auto 15px; width: 145px; height: 125px; background: radial-gradient(ellipse closest-side,var(--gold-soft),transparent); }
#v-setdone .row { display: grid; }
/* Reader setup and free choice share the same game controls. */
.reader .card { display: grid; grid-template-columns: 43px minmax(0,1fr); align-content: start; align-items: start; gap: 2px 12px; padding: 17px; }
.reader .card > .icon { grid-row: span 2; width: 43px; height: 43px; padding: 10px; border-radius: 13px; background: var(--tint); color: var(--accent); }
.reader .card:nth-child(3n + 2) > .icon { background: var(--fire-soft); color: var(--fire); }
.reader .card:nth-child(3n) > .icon { background: var(--blue-soft); color: var(--info); }
.reader .card b { font-size: 16px; line-height: 1.35; }
.reader .card:active { transform: translateY(2px); box-shadow: 0 1px var(--line); }
.reader .card:hover, .reader .work:hover { border-color: var(--apricot); }
#v-login { max-width: 600px; margin: auto; padding-bottom: 20px; }
.welcome-art { isolation: isolate; height: clamp(156px,25vh,205px); border-radius: 23px; position: relative; overflow: hidden; margin-bottom: 24px; }
#welcome-mascot { position: absolute; bottom: 5%; left: 4%; height: 80%; }
#welcome-mascot .fx-mascot { width: auto; height: 100%; filter: drop-shadow(0 1px 2px #53271550); }
#v-login .tips { padding-left: 20px; font-size: 15px; }
#v-login .tips li { padding-block: 3px; }
#v-login .tips li::marker { color: var(--accent); }
#v-login #join { width: 100%; }
@media (min-width: 700px) {
  .reader main { padding-top: 27px; }
  .path-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(217px,.48fr); align-items: start; gap: 24px; }
  #path-aside { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; position: sticky; top: calc(var(--hud) + 14px); }
  .aside-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
  .aside-heading h2 { margin: 0; }
  .goal-emblem { width: 42px; height: 42px; border-radius: 13px; background: #f4bf59; box-shadow: 0 3px #c4872c; }
  #aside-goal { font-size: 24px; font-weight: 850; }
  #aside-meter { margin-top: 6px; }
  #aside-profile { margin-top: 8px; font-size: 13px; }
  .guide-row { display: grid; grid-template-columns: 25px minmax(0,1fr) 16px; align-items: center; gap: 8px; min-height: 48px; width: 100%; padding: 7px 5px; border: 0; border-radius: 9px; text-align: left; font-size: 13px; line-height: 1.35; color: var(--muted); }
  .guide-row.current { color: var(--accent); background: var(--tint); }
  .guide-row.done { color: var(--ok); }
  .guide-row .icon:first-child { width: 21px; }
  .guide-row .icon:last-child { width: 14px; }
  .unit-banner { padding: 18px 24px; }
  .game-tabs button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; font-size: 15px; }
  #lesson-sheet { margin: auto; }
  .goal-picker, #badge-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .profile-stats { grid-template-columns: repeat(5,minmax(0,1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .reader *, .reader *::before, .reader *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
.fx-recording .reader *, .fx-recording .reader *::before, .fx-recording .reader *::after {
  animation: none !important; transition: none !important; scroll-behavior: auto !important;
}
/* What a pool sentence is (a fact, a quote...) and who said it / who it is about: shown, not read aloud. */
.read .kind-label { font-size: 13px; font-weight: 800; letter-spacing: .04em; color: var(--heading); margin: 0 0 8px; }
.read .attribution { font-size: 16px; font-style: italic; color: var(--muted); margin: 10px 0 0; text-align: right; }

/* The reader's wallet shares its ruby ink with prices and seed rewards. */
#top-seeds { position: relative; border: 1px solid color-mix(in srgb,var(--ruby) 32%,transparent); color: var(--ruby); background: var(--ruby-paper); }
#top-seeds::after { content: ""; position: absolute; inset: -5px 0; }
#top-seeds:disabled { opacity: 1; }
#top-xp { position: relative; }
#top-boost { position: absolute; top: -6px; right: -2px; padding: 2px 4px; border-radius: 5px; background: #694321; color: #ffe19f; font: 800 10px/1.1 system-ui,sans-serif; }
.reader.in-lesson #top-stats { display: flex; order: 2; margin: 0; }
.in-lesson #top-stats > :not(#top-seeds) { display: none; }
.reader.in-lesson #nav-home { width: auto; font-size: 13px; }
.seed-amount { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--ruby); font-variant-numeric: tabular-nums; font-weight: 650; }
.seed-amount .icon { width: 22px; height: 22px; }
.wallet-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wallet-heading h2 { min-width: 0; margin: 0; overflow-wrap: anywhere; }
#profile-shop { flex: none; white-space: nowrap; }
.profile-wallet dl { margin: 12px 0 0; border-top: 1px solid var(--line); }
.profile-wallet dl > div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 7px; font-size: 14px; }
.profile-wallet dt { color: var(--muted); }
.profile-wallet dd { margin: 0; font-weight: 750; }
.profile-wallet .seed-amount { font-size: 16px; }
.profile-wallet .seed-amount b { font-size: 22px; }

.postcard-reward { margin: 14px 0 0; border-radius: 7px; padding: 4px 9px; background: var(--ruby-paper); font-size: 14px; }
@media (max-width: 599px) {
  .has-tabs .topline #top-stats { gap: 5px; }
  .has-tabs .topline .stat-chip { padding-inline: 5px; }
  .has-game .topline { padding-inline: 8px; gap: 5px; }
  #top-stats { flex-wrap: wrap; }
}
@media (461px <= width <= 599px) {
  .has-game .topline:has(#nav-home:not(.hidden)) .brand { display: none; }
}
@media (max-width: 460px) {
  .has-game:not(.in-lesson) .topline .brand { display: inline-flex; flex: none; margin-right: 0; }
  .has-game .topline .brand-mark { width: auto; }
  .has-game .topline .brand-mark img { height: clamp(26px, 8vw, 34px); width: auto; }
  .has-game .topline #top-stats { flex-wrap: nowrap; gap: 2px; margin-inline: auto 0; }
  .has-game .topline .stat-chip { min-width: 0; min-height: 36px; padding-inline: 3px; gap: 2px; font-size: 12px; }
  .has-game .stat-chip b, .has-game #top-level { overflow: hidden; text-overflow: ellipsis; }
  .has-game .stat-chip > .icon, #top-goal .mini-ring, #top-tree .tree-art { width: 16px; height: 16px; }
  .has-game #top-xp .top-xp-total { display: none; }
  #top-level::before { content: none; }
  .has-game #top-level { padding: 0; border-radius: 0; background: none; color: inherit; font-size: inherit; }
  .has-game:not(.in-lesson) .topline #nav-home { min-width: 34px; padding-inline: 5px; }
}
@media (max-width: 359px) {
  .has-game:not(.in-lesson) .topline:has(#nav-home:not(.hidden)) { padding-inline: 7px; gap: 3px; }
  .topline:has(#nav-home:not(.hidden)) .stat-chip { padding-inline: 1px; font-size: 11px; }
  .topline:has(#nav-home:not(.hidden)) #top-tree b::after { content: none; }
  .topline:has(#nav-home:not(.hidden)) .stat-chip > .icon,
  .topline:has(#nav-home:not(.hidden)) .mini-ring,
  .topline:has(#nav-home:not(.hidden)) .tree-art { width: 15px; height: 15px; }
}
@media (min-width: 1000px) and (max-width: 1150px) {
  .has-tabs .topline .brand-name { display: none; }
}

/* The fitting room is a fabric-lined market stall with an arched display niche. */
#v-shop { max-width: 960px; margin-inline: auto; }
.store-heading, .cabinet-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.store-heading { margin: 0 0 14px; }
.reader .store-heading h1 { margin: 0; font-size: clamp(32px,4vw,46px); }
.store-heading .seed-amount { padding: 4px 10px; border: 1px solid color-mix(in srgb,var(--ruby) 22%,transparent); border-radius: 25px; background: var(--ruby-paper); font-size: 13px; }
#fitting-room {
  --stage: #f5d4a2;
  position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(0,1fr) 45%; align-items: center;
  overflow: hidden; padding: 18px 13px 19px 18px; min-height: 188px; border: 1px solid var(--line); border-radius: var(--card-radius);
  scroll-margin-top: calc(var(--hud) + 9px); background: var(--card); color: var(--ink); box-shadow: var(--card-shadow);
}
.stall-bough { display: none; }
#fitting-room::after, .earn-strip::before { content: ""; position: absolute; inset: auto 7px 6px; height: 5px; background: var(--weave) center / 36px 6px repeat-x; opacity: .65; }
.fitting-copy { position: relative; z-index: 1; min-width: 0; }
#fitting-label, .sheet-kicker { margin: 0 0 5px; font-size: 12px; font-weight: 750; }
#fitting-label { color: var(--muted); }
.reader #fitting-name { margin: 0; color: var(--heading); font: 700 clamp(26px,5vw,49px)/1.12 var(--book-type); overflow-wrap: anywhere; }
#fitting-detail { margin: 9px 0 0; max-width: 34ch; color: var(--muted); font-size: clamp(12px,2vw,16px); line-height: 1.5; }
.fitting-stage { position: relative; display: grid; justify-items: center; padding: 5px 7px 10px; }
.fitting-stage::after { content: ""; position: absolute; bottom: 4px; width: 100%; height: 8px; background: #c2865d; border: 1px solid #81523f; border-radius: 2px 2px 6px 6px; box-shadow: inset 0 2px #f3c794; }
.fitting-niche { display: grid; width: 100%; aspect-ratio: 1 / 1.04; align-items: end; justify-items: center; border-radius: 50% 50% 1px 1px; border: 2px solid #d0a273;
  background: radial-gradient(ellipse at 55% 58%, #ffedc9 0, var(--stage) 70%,#d1a276); box-shadow: 0 0 0 3px var(--line), inset 3px 3px 0 #bf956544; }
#fitting-portrait { position: relative; width: 99%; margin-bottom: 0; }
#fitting-portrait:has([data-frame]) { width: 83%; margin-bottom: 3%; }
#fitting-portrait:has(.portrait-ring) { width: 97%; margin-bottom: 0; }
.reader-portrait { position: relative; display: inline-grid; place-items: center; width: 100%; aspect-ratio: 1; vertical-align: middle; }
.reader-portrait > .fx-mascot { width: 100%; }
.reader-portrait:has(> .frame-art) { border-radius: 16%; background: var(--cloth) center / 50px #f2dbb9; }
.reader-portrait[data-frame] > .fx-mascot { width: 86%; }
.reader-portrait > .frame-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.reader-portrait-painted { isolation: isolate; }
.reader-portrait-painted > .fx-mascot { position: relative; z-index: 1; width: 92%; }
.reader-portrait-painted:has(> .portrait-ring) > .fx-mascot { width: 56%; }
.reader-portrait-painted .fx-mascot-body { animation: none; }
.reader-portrait-painted > .frame-art { z-index: 2; }
.portrait-ring { position: absolute; inset: 0; width: 100%; mask-image: radial-gradient(circle closest-side, #000 91%, transparent); }
#fitting-actions { display: flex; gap: 3px 8px; flex-wrap: wrap; align-items: center; }
#fitting-actions:not(:empty) { margin-top: 10px; }
#fitting-actions .shop-buy { display: inline-flex; gap: 4px; align-items: center; }
#fitting-actions .shop-buy .icon { width: 16px; height: 16px; }
#fitting-actions small { color: var(--muted); }
#fitting-items { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
#fitting-items:not(:empty) { margin-top: 10px; }
#fitting-items button { min-height: 34px; padding: 4px 8px; font-size: 12px; }
.fitting-back { background: none; color: var(--info); border: 0; text-decoration: underline; text-underline-offset: 3px; }
#shop-groups { position: sticky; top: var(--hud); z-index: 4; display: flex; gap: 4px; overflow-x: auto; padding: 6px 0; margin: 10px 0 14px; background: var(--paper); border-block: 1px solid var(--atlas-rule); scrollbar-width: thin; }
#shop-groups button { flex: 1 0 auto; min-height: 44px; padding: 5px 3px; font-size: clamp(11px,2.8vw,15px); color: var(--muted); border: 1px solid transparent; background: transparent; }
#shop-groups [aria-current] { background: var(--tab-on); color: var(--heading); border-color: var(--line); }
.store-group { scroll-margin-top: calc(var(--hud) + 69px); margin-bottom: 27px; }
.reader .store-group h2, .reader .earn-strip h2, .reader .cabinet h2 { color: var(--heading); font: 700 clamp(23px,3vw,30px)/1.28 var(--book-type); margin: 0 0 12px; }
.store-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.shop-card { display: flex; flex-direction: column; min-width: 0; padding: 7px; border: 1px solid var(--atlas-rule); border-radius: var(--card-radius); background: var(--card); color: var(--ink); box-shadow: var(--card-shadow); }
.shop-portrait { position: relative; display: grid; place-items: center; width: 100%; height: clamp(82px,24vw,140px); padding: 7px; overflow: hidden; border: 0; border-radius: 8px;
  background: var(--cloth) center / 57px var(--tint); }
.shop-portrait .fx-mascot, .shop-portrait > svg, .shop-portrait .reader-portrait { width: auto; max-width: 88%; height: 100%; }
.shop-portrait .reader-portrait .fx-mascot { width: 86%; height: auto; }
.shop-portrait .fx-mascot-body { animation: none; }
.shop-card:nth-child(3n+2) .shop-portrait { background-color: var(--gold-soft); }
.shop-friend .shop-portrait, .shop-card:nth-child(3n) .shop-portrait { background-color: var(--blue-soft); }
.shop-stage { position: absolute; top: 5px; left: 50%; height: calc(100% - 10px); aspect-ratio: 1; translate: -50% 0;
  border-radius: 50%; background: radial-gradient(circle at 46% 35%, #fff4db, #f0d5aa 88%); box-shadow: inset 0 0 0 1px #c89d6955; }
.shop-stage::before { content: ""; position: absolute; inset: auto 17% 7%; height: 9%; border-radius: 50%;
  background: radial-gradient(ellipse, #81523655, transparent 73%); }
.shop-figure { position: absolute; inset: 0; }
.shop-portrait .shop-figure .shop-cutout { display: block; width: 100%; height: 100%; max-width: none; object-fit: contain; transform-origin: 50% 92%; }
.shop-frame .shop-portrait::after, .shop-boost .shop-portrait::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.shop-frame .shop-portrait::after { background: linear-gradient(110deg, transparent 44%, #fff3d7c4 50%, transparent 56%); }
.shop-boost .shop-portrait::after { background: radial-gradient(ellipse, #ffd47566, transparent 68%); mix-blend-mode: screen; }
.try-label { position: absolute; bottom: 3px; right: 3px; padding: 1px 5px; border: 1px solid var(--atlas-rule); border-radius: 5px; color: var(--atlas-ink); background: var(--paper); font-size: 10px; }
.shop-copy { flex: 1; padding: 8px 4px; }
.shop-copy h3 { margin: 0; font-size: clamp(15px,2vw,18px); line-height: 1.3; overflow-wrap: anywhere; }
.shop-reason { margin: 0; color: var(--atlas-muted); font-size: 12px; line-height: 1.48; }
.shop-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px; padding: 6px 2px 0; border-top: 1px solid var(--atlas-rule); }
.shop-actions .shop-price { position: relative; }
.shop-price { gap: 3px; font-size: 15px; }
.shop-price .icon { width: 18px; height: 18px; }
.shop-buy, .shop-equip { min-height: 44px; padding: 5px 9px; font-size: 13px; }
.shop-buy { border-color: transparent; color: white; background: var(--action); box-shadow: var(--action-shadow); }
.shop-reason { flex-basis: 100%; font-size: 11px; }
.shop-feedback { margin: 6px 0 0; padding: 6px; color: var(--ok); background: color-mix(in srgb,var(--ok) 9%,var(--paper)); border-radius: 6px; font-size: 13px; }
.boost-countdown { margin: 0 0 10px; font: 700 12px/1.5 var(--display); font-variant-numeric: tabular-nums; color: var(--ok); }
.shop-feedback:empty { display: none; }
.shop-feedback.error { color: var(--ruby); background: var(--ruby-paper); }
.earn-strip { position: relative; padding: 19px 16px 25px; background: var(--card); border: 1px solid var(--line); border-radius: var(--card-radius); box-shadow: var(--card-shadow); }
.earn-strip::before { filter: none; }
.earn-strip dl { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px 12px; margin: 0; }
.earn-strip dl div, .purchase-ledger div { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; }
.earn-strip dt { font-size: 12px; }
.earn-strip dd, .purchase-ledger dd { color: var(--ruby); font-weight: 750; margin: 0; white-space: nowrap; }
@media (max-width: 400px) {
  .earn-strip dl { grid-template-columns: 1fr; }
}

html:has(.store-sheet[open]) { overflow: hidden; }
.store-sheet { width: min(100% - 16px, 416px); max-height: calc(100dvh - var(--hud,64px) - 16px); overflow: auto; position: fixed;
  margin: auto auto max(8px,env(safe-area-inset-bottom)); padding: 22px; border: 1px solid var(--atlas-rule); border-radius: var(--window-radius);
  background: var(--card); color: var(--ink); box-shadow: var(--window-shadow); text-align: center; }
.store-sheet::backdrop { background: #15252180; }
.store-sheet .sheet-close { z-index: 1; border: 1px solid var(--line); }
.store-sheet h2 { margin: 0 0 8px; font: 700 clamp(24px,5vw,32px)/1.25 var(--book-type); }
.store-sheet .sheet-kicker { color: var(--atlas-red); margin: 13px 0 3px; }
.store-sheet .shop-buy { width: 100%; margin-top: 10px; font-size: 16px; }
#purchase-art { height: 100px; padding: 0; background: var(--blue-soft); }
#purchase-desc { margin: 0 0 10px; color: var(--muted); font-size: 15px; }
.purchase-ledger { margin: 12px 0 0; font-size: 14px; }
.purchase-ledger div { padding: 6px 0; border-top: 1px solid var(--atlas-rule); }
.purchase-ledger dd .shop-price { font-size: inherit; }
#reward-sheet { padding-top: 18px; }
#reward-art { --reward-art-height: clamp(110px,21vh,175px); display: grid; place-items: center; position: relative; isolation: isolate; height: var(--reward-art-height); }
#reward-art::before, .trail-chest.ready::before { content: ""; position: absolute; z-index: -1; width: 100%; height: 100%; background: repeating-conic-gradient(from 5deg,#f5c47188 0deg 11deg,transparent 11deg 25deg); mask-image: radial-gradient(closest-side,#000 25%,transparent); }
#reward-art svg { width: auto; height: 94%; filter: drop-shadow(0 4px 2px #613a231c); }
#reward-art .treasure-art { width: min(100%, calc(var(--reward-art-height) * .94)); height: calc(var(--reward-art-height) * .94); filter: drop-shadow(0 4px 2px #613a231c); }
.treasure-art { display: block; object-fit: contain; }
.treasure-share:not(:empty) { margin-top: 10px; }
#reward-name.seed-reward { color: var(--ruby); }
#reward-desc { color: var(--atlas-muted); font-size: 15px; }
#reward-desc:empty { display: none; }
.lesson-node.done .treasure-art { width: 45px; height: 45px; }
.sheet-icon:has(> .treasure-art) { width: 106px; height: 106px; }
.sheet-icon > .treasure-art { width: 88px; height: 88px; }
.trail-chest { position: absolute; isolation: isolate; left: 50%; translate: -50% -50%; display: grid; justify-items: center; min-width: 86px; padding: 0; background: none; border: 0; }
.trail-chest .chest-art { width: 70px; height: 70px; filter: drop-shadow(0 3px 1px #46302655); overflow: visible; }
.chest-caption { font-size: 12px; padding: 2px 9px; border: 1px solid var(--atlas-rule); border-radius: 7px; background: var(--paper); color: var(--atlas-ink); }
.trail-chest.locked { opacity: 1; }
.trail-chest.locked svg { filter: saturate(.19) contrast(.82); }
.trail-chest.ready::before { height: 120px; width: 140px; top: -24px; }
.trail-chest.ready .chest-caption { background: var(--action); color: white; border-color: transparent; border-radius: var(--button-radius); box-shadow: var(--action-shadow); }
.trail-chest.beckon { outline: 3px solid #dd9b40; outline-offset: 5px; }
.trail-chest.opening .chest-lid { transform: translateY(-12px) rotate(-7deg); transform-origin: 16px 30px; }
.profile-id { gap: 9px; }
#profile-portrait { width: clamp(59px,16vw,85px); flex: none; }
.profile-id .level-ring { order: 1; margin-left: auto; width: 46px; height: 46px; }
.profile-id .level-ring::before { inset: 4px; }
.profile-id .level-ring b { font-size: 18px; }
.profile-id .level-ring small { font-size: 7px; }
.league-identity { display: inline-flex; gap: 7px; align-items: center; text-align: left; }
.league-identity .reader-portrait, #pinned-rank .reader-portrait { width: 36px; flex: none; background-color: #f3dfbc; border-radius: 16%; }
.league-identity .fx-mascot-body, #pinned-rank .fx-mascot-body { animation: none; }
.reader .cabinet-heading h2 { margin-bottom: 0; }
.cabinet-heading strong { color: var(--ruby); font-size: 15px; }
#cabinet-chests { font-size: 13px; color: var(--atlas-muted); margin: 3px 0 12px; }
#treasure-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(62px,1fr)); gap: 7px; list-style: none; padding: 0; margin: 0; }
.cabinet-cell { min-width: 0; text-align: center; }
.cabinet-mark { display: grid; place-items: center; position: relative; width: 100%; aspect-ratio: 1.12; padding: 6px; border: 1px solid var(--atlas-rule); border-radius: 9px; background: var(--cloth) center / 55px var(--tint); }
.cabinet-mark > .treasure-art { width: 83%; height: 100%; min-height: 0; }
.cabinet-mark::after { content: ""; position: absolute; inset: 12% 12% auto auto; width: 12px; aspect-ratio: 1;
  background: #e5a348; clip-path: polygon(50% 0,62% 38%,100% 50%,62% 62%,50% 100%,38% 62%,0 50%,38% 38%); opacity: 0; pointer-events: none; }
.cabinet-mark b { position: absolute; bottom: 1px; right: 3px; color: var(--ruby); font-size: 11px; }
.missing .cabinet-mark { background: var(--soft); }
.missing .treasure-art { filter: brightness(0); opacity: .48; }
.missing b { inset: 50% auto auto 50%; translate: -50% -50%; color: #fff9e7; text-shadow: 0 1px 2px #342d29; font-size: 14px; }
.cabinet-cell small { display: block; font-size: 10px; overflow-wrap: anywhere; }
@media (min-width: 620px) {
  .store-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
  .shop-card { padding: 10px; }
  #fitting-room { grid-template-columns: 1fr minmax(190px,30%); min-height: 228px; padding: 17px 7%; }
  .fitting-stage { max-width: 220px; width: 100%; }
  .earn-strip dl { grid-template-columns: repeat(3,minmax(0,1fr)); }
  #treasure-grid { grid-template-columns: repeat(8,minmax(0,1fr)); }
  #reward-sheet { margin: auto; }
}
@media (prefers-color-scheme: dark) {
  .missing .cabinet-mark { background: #504e49; }
  .missing svg { opacity: .55; }
}
@media (min-width: 900px) {
  .stall-bough { display: block; position: absolute; top: -3%; right: 31%; width: 25%; height: 90%; pointer-events: none; opacity: .6; }
  .store-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .shop-portrait { height: 121px; }
}

/* Daily assignment slip, set into the same paper and ink as the itinerary. */
.path-column { min-width: 0; }
.path-header {
  --path-gap: 6px;
  --path-button-size: clamp(44px, calc((100vw - 46px) / 6), 60px);
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--path-gap);
  align-items: start; margin-bottom: 16px;
}
/* The summary occupies the first column while its expanded content spans both. */
.path-header #daily-quests { grid-area: 1 / 1 / 2 / -1; }
.path-header summary { width: calc((100% - var(--path-gap)) / 2); min-height: var(--path-button-size); }
.path-actions {
  grid-area: 1 / 2; display: grid; grid-template-columns: repeat(3, var(--path-button-size));
  justify-content: space-between; z-index: 1;
}
.path-actions button {
  display: grid; place-items: center; padding: 2px; min-height: var(--path-button-size);
  border: 1px solid var(--line); background: var(--blue-soft);
}
.path-actions button:nth-child(2) { grid-column: 2; }
.path-actions button:nth-child(3) { grid-column: 3; }
.path-actions img { display: block; width: 100%; max-width: 48px; }
#daily-quests { scroll-margin-top: calc(var(--hud) + 8px); color: var(--atlas-ink); }
#daily-quests summary {
  cursor: pointer; display: flex; align-items: center; gap: clamp(3px, 1vw, 8px);
  padding: 3px clamp(4px, 1.35vw, 12px); list-style: none;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--card-radius); box-shadow: var(--card-shadow);
}
#daily-quests summary:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; }
#daily-quests summary::-webkit-details-marker { display: none; }
.quest-summary-copy { flex: 1; min-width: 0; }
#daily-quests summary strong { display: block; font: bold clamp(11px, 2.8vw, 18px)/1.12 var(--book-type); }
#quest-clock { display: block; margin-top: 2px; color: var(--atlas-muted); font: 550 clamp(9px, 2.4vw, 11px)/1.2 var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.quest-seal { display: block; flex: none; width: clamp(24px, 7.7vw, 44px); }
.quest-panel { margin-top: 6px; overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: var(--card-radius); box-shadow: var(--card-shadow); }
#top-quests { border: 1px solid var(--line); }
.in-lesson #top-stats > #top-quests:not(.hidden) { display: inline-flex; }
.quest-state { display: flex; flex: none; align-items: center; gap: 5px; }
#quest-count { font-size: clamp(10px, 2.6vw, 14px); font-variant-numeric: tabular-nums; }
.quest-chevron { color: var(--atlas-muted); font: bold clamp(12px, 3.7vw, 18px)/1 system-ui; }
#daily-quests[open] .quest-chevron { transform: rotate(180deg); }
@media (max-width: 359px) {
  .path-header .quest-state { flex-direction: column; gap: 0; }
  .path-header #quest-clock { letter-spacing: -.02em; }
}
#quest-list { list-style: none; padding: 0 15px; margin: 0; }
.quest-row { display: flex; gap: 11px; align-items: center; padding: 8px 0; border-top: 1px solid var(--atlas-rule); }
.quest-mark { display: grid; flex: none; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--atlas-ink); background: var(--map); font-size: 19px; }
.quest-row.done .quest-mark, .fx-quest-reward .quest-mark { color: var(--ok); background: color-mix(in srgb,var(--ok) 12%,var(--paper)); }
.quest-mark > svg { width: 25px; height: 25px; }
.quest-copy { flex: 1; min-width: 0; }
.quest-copy b { display: block; font-size: 14px; line-height: 1.3; }
.quest-description { display: block; margin-top: 2px; font-size: 11px; line-height: 1.35; color: var(--atlas-muted); }
.quest-progress { display: flex; gap: 7px; align-items: center; margin-top: 3px; }
.quest-progress small { font-size: 10px; font-variant-numeric: tabular-nums; }
.quest-progress progress { flex: 1; min-width: 0; height: 5px; margin: 0; accent-color: var(--ok); }
#daily-quests .shop-price, .invite-rewards .shop-price { display: inline-flex; gap: 3px; padding: 0; background: transparent; color: var(--ruby); }
#daily-quests .shop-price .icon { width: 16px; height: 16px; }
#daily-quests .shop-price b { font-size: 13px; }
#quest-bonus { display: flex; align-items: center; gap: 8px; padding: 6px 15px; border-top: 1px dashed var(--atlas-rule); background: var(--cloth), var(--map); }
#quest-bonus > svg:first-child { width: 31px; height: 31px; }
.quest-bonus-copy { display: grid; flex: 1; font-size: 12px; }
.quest-bonus-copy small { color: var(--atlas-muted); font-size: 11px; }
#quest-bonus > .icon { color: var(--ok); width: 16px; }
#quest-sheet { width: min(95vw, 450px); color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: var(--window-radius); box-shadow: var(--window-shadow); padding: 10px; }
#quest-sheet #daily-quests { margin-bottom: 6px; }
#quest-sheet summary { min-height: 44px; }
#quest-sheet form { margin: 0; }
#quest-sheet form button { width: 100%; }
#quest-sheet::backdrop { background: #152c2ab0; }
#profile-pwa:empty { display: none; }
#v-invite { max-width: 580px; margin: auto; }
#invite-card { display: grid; gap: 14px; }
.invite-letter { position: relative; overflow: hidden; padding: 20px; border: 1px solid var(--atlas-rule); border-radius: var(--card-radius); background: var(--card); color: var(--ink); box-shadow: var(--card-shadow); }
.invite-letter::after { content: ""; position: absolute; inset: auto 0 0; height: 7px; background: var(--weave); }
#invite-mascot { float: right; width: clamp(74px, 20vw, 110px); margin: -6px -6px 3px 6px; }
#invite-mascot svg { width: 100%; height: auto; }
.invite-letter h2 { margin: 0; font: bold 26px/1.2 var(--book-type); }
.invite-letter p { margin: 8px 0 15px; font-size: 15px; }
.invite-rewards, .invite-counts { display: grid; grid-template-columns: 1fr 1fr; margin: 0; }
.invite-rewards { clear: both; border-block: 1px solid var(--atlas-rule); }
.invite-rewards div, .invite-counts div { padding: 10px 6px; text-align: center; }
.invite-rewards div + div, .invite-counts div + div { border-left: 1px solid var(--atlas-rule); }
.invite-rewards dt, .invite-counts dt, .invite-letter > small { color: var(--atlas-muted); font-size: 12px; }
.invite-rewards dd, .invite-counts dd { margin: 4px 0 0; font-size: 24px; font-weight: 750; }
.invite-letter > small { display: block; text-align: center; margin-top: 10px; }
.invite-controls label { margin: 0 0 8px; font-weight: 650; }
.invite-controls input { width: 100%; min-width: 0; padding: 10px 12px; border: 1px solid var(--input-line); border-radius: 10px; background: var(--card); color: var(--ink); font: 500 15px/1.4 var(--display); }
.invite-controls > div { display: flex; gap: 8px; margin-top: 10px; }
.invite-controls button { flex: 1; }
.invite-counts { align-items: center; }
.invite-greeting { padding: 12px 15px; border-left: 3px solid var(--atlas-red); background: var(--paper); color: var(--atlas-ink); }
.clipboard-input { position: fixed; left: -10000px; }
.share-action { padding: 8px 13px; font-size: 14px; }
#share-postcard { width: 100%; margin-top: 12px; }
@media (min-width: 700px) {
  #quest-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 0 8px 10px; }
  .quest-row { display: grid; grid-template-columns: 32px 1fr; gap: 4px 8px; padding: 5px 10px; border: 0; align-content: start; }
  .quest-row + .quest-row { border-left: 1px solid var(--atlas-rule); }
  .quest-row > .shop-price { justify-self: end; grid-area: 1 / 2; }
  .quest-row .quest-copy { grid-area: 2 / 1 / 3 / -1; }
}

/* Back is an arrow only (owner, 29 Nov 2026); its name stays in aria-label. */
#nav-home { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; padding: 0; }
#nav-home.hidden { display: none; }
#nav-home .icon { width: 22px; height: 22px; stroke-width: 2.4; }

/* Painted shop pictures fill the card's picture area; the purchase sheet shows them a little smaller. */
.shop-portrait .shop-painting { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.shop-card:nth-child(n) .shop-portrait:has(.shop-painting) { padding: 0; background: radial-gradient(circle at 50% 45%, #fcefdc, #f3dcbd); }
#purchase-art .shop-painting { position: static; height: 100px; width: auto; aspect-ratio: 1; border-radius: 12px; }

.shop-owned { position: absolute; z-index: 1; inset: 4px auto auto 4px; padding: 2px 6px; border-radius: 5px;
  border: 1px solid #577d64; background: #e0efd3; color: #244d3d; font-size: 10px; font-weight: 850; }
.fitting-change::after { content: ""; position: absolute; inset: 2%; z-index: 2; border-radius: 50%;
  background: radial-gradient(ellipse, transparent 43%, #fff4be 70%, transparent 75%); opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: no-preference) {
  .shop-card.in-view { transition: transform .2s cubic-bezier(.2,.72,.28,1.3); }
  .shop-card.in-view .shop-figure { transition: transform .25s cubic-bezier(.2,.72,.28,1.45); }
  .shop-card.in-view .shop-portrait > :is(.shop-painting, .reader-portrait, svg) { transition: transform .18s ease-out; }
  .shop-card.in-view:active { transform: translateY(-2px) scale(.985); }
  .shop-card.in-view:active .shop-figure { transform: translateY(-8px); }
  .shop-card.in-view:active .shop-portrait > :is(.shop-painting, .reader-portrait, svg) { transform: rotate(-4deg) scale(1.04); }
  .shop-costume .shop-cutout { animation: shop-breathe 3.8s var(--idle-delay) ease-in-out infinite paused; }
  .shop-friend .shop-cutout { animation: shop-pet var(--pet-tempo, 3.1s) var(--idle-delay) ease-in-out infinite paused; }
  #shop-item-van_cat { --pet-tempo: 4.2s; --pet-lift: -2px; --pet-tilt: -4deg; }
  #shop-item-stork { --pet-tempo: 3.5s; --pet-lift: -4px; --pet-tilt: 3deg; }
  #shop-item-gampr { --pet-tempo: 3.8s; --pet-lift: -3px; --pet-tilt: -2deg; }
  #shop-item-mouflon { --pet-tempo: 2.8s; --pet-lift: -5px; --pet-tilt: 4deg; }
  .shop-frame .shop-portrait::after { animation: shop-shimmer 7s var(--idle-delay) ease-in-out infinite paused; }
  .shop-boost .shop-portrait::after { animation: shop-glow 3.3s var(--idle-delay) ease-in-out infinite paused; }
  .shop-card.in-view .shop-cutout, .shop-card.in-view .shop-portrait::after { animation-play-state: running; }
  .cabinet-mark > .treasure-art { animation: cabinet-float 4.5s var(--idle-delay) ease-in-out infinite paused; }
  .cabinet-mark::after { animation: cabinet-spark 5.8s var(--idle-delay) ease-in-out infinite paused; }
  .cabinet-cell.in-view .cabinet-mark > .treasure-art, .cabinet-cell.in-view .cabinet-mark::after { animation-play-state: running; }
  .just-bought { animation: shop-stamp .66s cubic-bezier(.18,.73,.28,1.28) both; }
  .fitting-change .fx-character { animation: reader-spin .76s ease-in-out both; }
  .fitting-change .fx-companion { animation: fitting-pet .68s .1s ease-out both; }
  .fitting-change::after { animation: fitting-shine .8s .2s ease-out both; }
}
@media (prefers-reduced-motion: no-preference) and (hover: hover) and (pointer: fine) {
  .shop-card.in-view:hover { translate: 0 -2px; }
  .shop-card.in-view:hover .shop-figure { transform: translateY(-5px); }
  .shop-card.in-view:hover:active .shop-figure { transform: translateY(-8px); }
}
@media (prefers-reduced-motion: reduce) {
  html:not(.fx-recording) .reader :is(.just-bought, .fitting-change) { animation: fx-fade-in .25s ease-out both !important; }
  html:not(.fx-recording) .reader .fitting-change::after { animation: fx-twinkle .45s ease-out both !important; }
}
@keyframes shop-stamp {
  0% { transform: scale(.65) rotate(-8deg); opacity: 0; }
  65% { transform: scale(1.14) rotate(2deg); }
}
@keyframes shop-breathe { 50% { transform: translateY(-2px) scale(1.02,1.045); } }
@keyframes shop-pet { 50% { transform: translateY(var(--pet-lift,-3px)) rotate(var(--pet-tilt,2deg)); } }
@keyframes shop-shimmer {
  0%, 48% { transform: translateX(-65%); opacity: 0; }
  59% { opacity: .68; }
  73%, 100% { transform: translateX(65%); opacity: 0; }
}
@keyframes shop-glow { 50% { opacity: .85; transform: scale(1.08); } }
@keyframes cabinet-float { 50% { transform: translateY(-3px); } }
@keyframes cabinet-spark {
  0%, 62%, 100% { transform: scale(.35); opacity: 0; }
  72% { transform: scale(1); opacity: .9; }
}
@keyframes fitting-pet {
  0% { transform: translateX(38px) scale(.94); opacity: 0; }
  47% { transform: translate(7px,-23px) rotate(-7deg); opacity: 1; }
  76% { transform: scale(1.06,.93); }
}
@keyframes fitting-shine {
  0% { transform: scale(.86); }
  35% { opacity: .84; }
  100% { transform: scale(1.13); }
}

/* Free choice (owner, 29 Nov 2026): two columns on phones, title only, painted icon above it. */
#v-home .menu { grid-template-columns: 1fr 1fr; }
#v-home .reader .card, .reader #v-home .card { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 8px; padding: 14px 10px; }
#v-home .card > span { display: none; }
#v-home .card b { font-size: 14px; line-height: 1.3; }
#v-home .card > .mode-picture { width: 56px; height: 56px; object-fit: contain; }
#v-home .card > .icon { grid-row: auto; }

/* Stop info sheet: the stop's lessons with their prizes. */
.stop-lessons { list-style: none; margin: 12px 0 6px; padding: 0; display: grid; gap: 6px; text-align: start; }
.stop-lesson { display: grid; grid-template-columns: 22px 1fr 24px; align-items: center; gap: 8px; font-size: 14px; line-height: 1.3; }
.stop-lesson .icon { width: 20px; height: 20px; }
.stop-lesson.done { opacity: .7; }
.stop-prize { display: grid; place-items: center; width: 24px; height: 24px; }
.stop-prize :is(svg, img) { width: 22px; height: 22px; }
.stop-end { margin: 8px 0 0; font-size: 13px; opacity: .85; }

/* Record button, three states (option «Բ»): blue start, red recording with a live wave, gold checking with dots. */
.reader .recorder #rec-start.big::before { background: linear-gradient(135deg, #1c376e, #2b8fb4);
  box-shadow: 0 4px 10px #1c376e55, 0 0 0 7px var(--blue-soft); }
.recorder #rec-stop .rec-wave, .recorder #rec-stop .rec-dots { grid-area: 1 / 1; display: flex; align-items: center; gap: 3px; height: 66px; }
.recorder #rec-stop .rec-wave i { width: 4px; height: calc(8px + 22px * var(--signal, .3)); border-radius: 2px; background: #fff;
  transition: height .12s; }
.recorder #rec-stop .rec-wave i:nth-child(2), .recorder #rec-stop .rec-wave i:nth-child(4) { height: calc(6px + 30px * var(--signal, .3)); }
.recorder #rec-stop .rec-wave i:nth-child(3) { height: calc(10px + 36px * var(--signal, .3)); }
.recorder #rec-stop .rec-dots { display: none; gap: 6px; }
.recorder #rec-stop .rec-dots i { width: 9px; height: 9px; border-radius: 50%; background: #fff; }
.recorder #rec-stop .rec-label { margin-top: 9px; grid-area: 2 / 1; }
.recorder #rec-stop.checking::before { background: linear-gradient(135deg, #d9a21b, #a8720c);
  box-shadow: 0 4px 10px #b77d0f55, 0 0 0 7px var(--gold-soft); }
.recorder #rec-stop.checking .rec-wave { display: none; }
.recorder #rec-stop.checking .rec-dots { display: flex; }
.reader .recorder #rec-stop.checking:disabled { opacity: 1; cursor: progress; }
.sent .btns button.stop.checking { background: linear-gradient(135deg, #d9a21b, #a8720c); color: #fff; border-color: transparent; }
@media (prefers-reduced-motion: no-preference) {
  .recorder #rec-stop:not(.checking)::before { animation: rec-glow 1.2s ease-in-out infinite; }
  .recorder #rec-stop .rec-dots i { animation: rec-dot 1s ease-in-out infinite; }
  .recorder #rec-stop .rec-dots i:nth-child(2) { animation-delay: .15s; }
  .recorder #rec-stop .rec-dots i:nth-child(3) { animation-delay: .3s; }
}
@keyframes rec-glow { 50% { box-shadow: 0 4px #90352c, 0 0 0 14px #c0392b33; } }
@keyframes rec-dot { 50% { transform: translateY(-6px); opacity: .55; } }

/* Top-bar logo as tall as the chips beside it (owner). */
@media (min-width: 461px) { .has-game .topline .brand-mark img { height: 34px; width: auto; } .has-game .topline .brand-mark { width: auto; } }
