/*
  Questlog: habit tracker app (Screenery template)
  A 16-bit RPG on a night ground: 16 palette tokens, pixel window frames (border-image SVG), chunky notched buttons, crisp SVG sprites.
  Press Start 2P is only for headings and labels (never under 12px); Sono carries every sentence.

  Contents
   1. Tokens (the 16 colours, pixel unit, frames)
   2. Base and browser surfaces
   3. Kit: windows, buttons, labels, bars, fields, segmented radios, chips, tiles, dialogs, toast
   4. Header
   5. Intro + world map
   6. The app: hero card, quests, week grid, inventory, log
   7. Manual
   8. Party
   9. Screens (drawn phones)
  10. Pricing
  11. Download
  12. FAQ, footer, terrain edges
  13. Motion (sprite idle, celebration, all under no-preference)
  14. Narrow screens
*/

/* ---------- 1. Tokens ---------- */
:root {
  /* The 16-colour palette. Every pixel on the page is one of these. */
  --ink: #16131f;
  --night: #251f3e;
  --dusk: #3b3466;
  --slate: #5f5b94;
  --mist: #a3a6cf;
  --paper: #f5f0dd;
  --parch: #e2cf9f;
  --skin: #f0b48a;
  --wood: #9a5f3c;
  --grass: #3f9a4a;
  --leaf: #9fd667;
  --sea: #2c68ad;
  --sky: #6fc8ea;
  --gold: #f6c945;
  --ember: #e8743b;
  --blood: #c0314a;

  /* Roles */
  --ground: var(--night);
  --text: var(--paper);
  --text-2: var(--mist);
  --panel: var(--dusk);
  --focus: var(--gold);

  /* The pixel unit: art pixels are drawn at 4 CSS px */
  --px: 4px;
  --frame: calc(var(--px) * 3);

  /* Spacing */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px; --s9: 112px;
  --wrap: 1240px;
  --gutter: clamp(16px, 4vw, 40px);

  /* Type */
  --pixel: 'Press Start 2P', ui-monospace, monospace;
  --body: 'Sono', ui-sans-serif, system-ui, sans-serif;

  /* Window frames: 9 x 9 pixel art (outer ink with notched corners, a light ring, an inner ink line), sliced 3 / 3 / 3.
     Hex values here mirror the tokens above (data URIs cannot read custom properties). */
  --frame-window: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' viewBox='0 0 9 9' shape-rendering='crispEdges'%3E%3Cpath fill='%2316131f' d='M1 0h7v1h1v7H8v1H1V8H0V1h1z'/%3E%3Cpath fill='%23f5f0dd' d='M1 1h7v7H1z'/%3E%3Cpath fill='%2316131f' d='M2 2h5v5H2z'/%3E%3C/svg%3E");
  --frame-wood: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' viewBox='0 0 9 9' shape-rendering='crispEdges'%3E%3Cpath fill='%2316131f' d='M1 0h7v1h1v7H8v1H1V8H0V1h1z'/%3E%3Cpath fill='%239a5f3c' d='M1 1h7v7H1z'/%3E%3Cpath fill='%2316131f' d='M2 2h5v5H2z'/%3E%3C/svg%3E");
  --frame-gold: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' viewBox='0 0 9 9' shape-rendering='crispEdges'%3E%3Cpath fill='%2316131f' d='M1 0h7v1h1v7H8v1H1V8H0V1h1z'/%3E%3Cpath fill='%23f6c945' d='M1 1h7v7H1z'/%3E%3Cpath fill='%2316131f' d='M2 2h5v5H2z'/%3E%3C/svg%3E");
  /* Buttons: a one-pixel ink outline with notched corners (3 x 3, sliced 1) */
  --frame-btn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='3' height='3' viewBox='0 0 3 3' shape-rendering='crispEdges'%3E%3Cpath fill='%2316131f' d='M1 0h1v1h1v1H2v1H1V2H0V1h1z'/%3E%3C/svg%3E");
  /* Night sky: a 64 x 64 tile of single-pixel stars */
  --stars: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='128' height='128' viewBox='0 0 32 32' shape-rendering='crispEdges'%3E%3Cpath fill='%233b3466' d='M3 5h1v1H3zM19 2h1v1h-1zM27 13h1v1h-1zM9 21h1v1H9zM22 26h1v1h-1zM14 12h1v1h-1z'/%3E%3Cpath fill='%235f5b94' d='M30 4h1v1h-1zM6 29h1v1H6z'/%3E%3C/svg%3E");

  color-scheme: dark;
}

/* ---------- 2. Base and browser surfaces ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; scrollbar-color: var(--slate) var(--ink); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground) var(--stars);
  color: var(--text);
  font: 400 1.0625rem/1.6 var(--body);
  font-variation-settings: 'MONO' 0; /* Sono's proportional cut for reading */
  overflow-x: clip;
  caret-color: var(--gold);
  accent-color: var(--gold);
}
::selection { background: var(--gold); color: var(--ink); }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: var(--slate); border: 3px solid var(--ink); }
img, svg, canvas { display: block; }
a { color: var(--gold); text-underline-offset: 4px; text-decoration-thickness: 2px; }
a:not(.btn):hover { color: var(--paper); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; text-wrap: balance; font-weight: 400; }
p { margin: 0; text-wrap: pretty; }
b { font-weight: 600; }
kbd {
  font: 400 0.75rem/1 var(--pixel);
  padding: 3px 5px 2px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: inset 0 -2px 0 var(--slate);
}
table { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip { position: absolute; left: var(--s4); top: -60px; z-index: 50; background: var(--gold); color: var(--ink); padding: var(--s3) var(--s4); font: 400 0.75rem/1 var(--pixel); }
.skip:focus { top: var(--s4); }

/* Sprites: crisp, never smoothed. Each c-* class is one palette token. */
.sprite { shape-rendering: crispEdges; image-rendering: pixelated; overflow: visible; }
.c-ink { fill: var(--ink); } .c-night { fill: var(--night); } .c-dusk { fill: var(--dusk); } .c-slate { fill: var(--slate); }
.c-mist { fill: var(--mist); } .c-paper { fill: var(--paper); } .c-parch { fill: var(--parch); } .c-skin { fill: var(--skin); }
.c-wood { fill: var(--wood); } .c-grass { fill: var(--grass); } .c-leaf { fill: var(--leaf); } .c-sea { fill: var(--sea); }
.c-sky { fill: var(--sky); } .c-gold { fill: var(--gold); } .c-ember { fill: var(--ember); } .c-blood { fill: var(--blood); }
/* Recolourable parts of the hero: set --hair and --tunic on any ancestor (the party uses this) */
.c-hair { fill: var(--hair, var(--wood)); }
.c-tunic { fill: var(--tunic, var(--sea)); }

/* UI icons: square 2px strokes */
.u { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: square; stroke-linejoin: miter; flex: none; }

/* ---------- 3. Kit ---------- */
.label { font: 400 0.75rem/1.3 var(--pixel); letter-spacing: 0; text-transform: uppercase; }
.h2 { font: 400 clamp(1.25rem, 2.4vw, 1.875rem)/1.45 var(--pixel); color: var(--paper); }

/* Window: the RPG dialogue box. Border is the pixel frame; the fill sits inside it. */
.window {
  border: var(--frame) solid transparent;
  border-image: var(--frame-window) 3 / var(--frame) / 0 stretch;
  background: var(--panel) padding-box;
}
.window--wood { border-image-source: var(--frame-wood); }
.window--gold { border-image-source: var(--frame-gold); }

/* Buttons: notched one-pixel outline, a flat fill and a two-tone bevel. Pressed moves one pixel down. */
.btn {
  --b-bg: var(--slate); --b-fg: var(--paper); --b-hi: rgb(255 255 255 / .22); --b-lo: rgb(22 19 31 / .38);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 48px; padding: 10px 18px;
  border: var(--px) solid transparent;
  border-image: var(--frame-btn) 1 / var(--px) / 0 stretch;
  background: var(--b-bg) padding-box;
  color: var(--b-fg);
  box-shadow: inset var(--px) var(--px) 0 var(--b-hi), inset calc(var(--px) * -1) calc(var(--px) * -1) 0 var(--b-lo);
  font: 400 0.75rem/1.4 var(--pixel);
  text-decoration: none; text-align: center;
  cursor: pointer;
  transition: transform 80ms steps(1), filter 120ms;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { filter: brightness(1.08); color: var(--b-fg); }
.btn:active { transform: translateY(var(--px)); box-shadow: inset var(--px) var(--px) 0 var(--b-lo); }
.btn[disabled], .btn[aria-disabled="true"] { --b-bg: var(--dusk); --b-fg: var(--mist); cursor: not-allowed; filter: none; transform: none; }
.btn--gold { --b-bg: var(--gold); --b-fg: var(--ink); --b-hi: rgb(255 255 255 / .45); --b-lo: rgb(154 95 60 / .55); }
.btn--leaf { --b-bg: var(--leaf); --b-fg: var(--ink); --b-hi: rgb(255 255 255 / .4); --b-lo: rgb(63 154 74 / .7); }
.btn--red { --b-bg: var(--blood); --b-fg: var(--paper); }
.btn--ghost { --b-bg: var(--night); --b-fg: var(--paper); --b-hi: rgb(255 255 255 / .08); --b-lo: rgb(0 0 0 / .3); }
.btn--sm { min-height: 44px; padding: 8px 12px; }
.btn--xs { min-height: 44px; padding: 6px 10px; }
.btn kbd { background: rgb(22 19 31 / .25); color: inherit; box-shadow: none; font-size: 0.75rem; }
.btn__sprite { width: 15px; height: 18px; }
.btn__count { opacity: .85; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 48px; height: 48px;
  border: var(--px) solid transparent;
  border-image: var(--frame-btn) 1 / var(--px) / 0 stretch;
  background: var(--dusk) padding-box;
  color: var(--paper);
  cursor: pointer;
  box-shadow: inset var(--px) var(--px) 0 rgb(255 255 255 / .1), inset calc(var(--px) * -1) calc(var(--px) * -1) 0 rgb(0 0 0 / .3);
}
.icon-btn:active { transform: translateY(var(--px)); }
.icon-btn--sm { width: 44px; height: 44px; }

/* Bars: an ink trough, a segmented fill (one notch every 8 px) */
.bar { position: relative; height: 20px; background: var(--ink); padding: var(--px); box-shadow: 0 0 0 var(--px) var(--ink); }
.bar__fill {
  display: block; height: 100%;
  background:
    linear-gradient(rgb(255 255 255 / .35) 0 var(--px), transparent var(--px)),
    repeating-linear-gradient(90deg, transparent 0 calc(var(--px) * 3), rgb(22 19 31 / .3) calc(var(--px) * 3) calc(var(--px) * 4)),
    var(--fill, var(--gold));
  transition: width 600ms steps(12);
}
.bar--hp { --fill: var(--blood); }
.bar--xp { --fill: var(--gold); }
.bar--party { --fill: var(--leaf); }

/* Fields */
.field { margin: 0 0 var(--s5); padding: 0; border: 0; min-width: 0; }
.field__label { display: block; margin-bottom: var(--s2); padding: 0; font: 400 0.75rem/1.4 var(--pixel); color: var(--paper); }
.input {
  width: 100%; min-height: 48px;
  padding: 10px 14px;
  border: var(--px) solid var(--ink);
  background: var(--paper); color: var(--ink);
  font: 500 1rem/1.4 var(--body);
  border-radius: 0;
  box-shadow: inset var(--px) var(--px) 0 rgb(22 19 31 / .14);
}
.input::placeholder { color: #6a6585; }
.input:focus-visible { outline: 3px solid var(--gold); outline-offset: 0; }
.input[aria-invalid="true"] { border-color: var(--blood); background: #fbe9e4; }
.field__msg { min-height: 1.5em; margin-top: var(--s2); font-size: 0.9375rem; color: var(--text-2); }
.field__msg.is-error { color: #ffb3ba; }
.field__msg.is-ok { color: var(--leaf); }

/* Segmented radios (frequency, difficulty): native radios, so arrow keys move between options */
.seg { display: flex; flex-wrap: wrap; gap: var(--s2); }
.seg label { position: relative; flex: 1 1 auto; }
.seg input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg span {
  display: flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 8px 12px;
  background: var(--night); color: var(--paper);
  font: 400 0.75rem/1.3 var(--pixel);
  border: var(--px) solid var(--ink);
  text-align: center;
}
.seg input:checked + span { background: var(--sky); color: var(--ink); box-shadow: inset var(--px) var(--px) 0 rgb(255 255 255 / .35); }
.seg--diff input[value="easy"]:checked + span { background: var(--leaf); }
.seg--diff input[value="hard"]:checked + span { background: var(--ember); }
.seg input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }
.chip {
  min-height: 44px; padding: 8px 12px;
  border: var(--px) solid var(--ink);
  background: var(--paper); color: var(--ink);
  font: 500 0.9375rem/1.2 var(--body);
  cursor: pointer;
}
.chip:hover { background: var(--gold); }

/* Week tiles */
.tile { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--ink); vertical-align: -2px; }
.tile--done { background: var(--leaf); box-shadow: inset 2px 2px 0 rgb(255 255 255 / .45); }
.tile--miss { background: var(--blood); }
.tile--rest { background: var(--night); background-image: linear-gradient(45deg, transparent 45%, var(--slate) 45% 60%, transparent 60%); }
.tile--open { background: var(--dusk); box-shadow: inset 0 0 0 2px var(--slate); }

/* Dialogs */
.dlg {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  color: var(--paper);
  overflow: auto;
}
.dlg::backdrop { background: rgb(22 19 31 / .78); }
.dlg__body { padding: var(--s5); }
.dlg__body--center { text-align: center; }
.dlg__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s5); }
.dlg__title { font: 400 1rem/1.5 var(--pixel); color: var(--gold); }
.dlg__title--big { font-size: clamp(1.25rem, 5vw, 1.75rem); margin: var(--s4) 0 var(--s3); }
.dlg__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--s3); margin-top: var(--s5); }
.dlg__foot--center { justify-content: center; }
.keys { order: 3; flex: 1 1 100%; justify-content: flex-end; margin: 0; font-size: 0.875rem; color: var(--text-2); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.keys kbd + kbd { margin-left: 8px; }
.keys--center { justify-content: center; margin: var(--s4) 0 0; }
.dlg__foot .btn { white-space: nowrap; }
.reward { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); background: var(--night); border: var(--px) solid var(--ink); }
.reward svg { width: 21px; height: 21px; flex: none; margin-top: 2px; }
.field__msg--form { min-height: 0; }
.field__msg--form:empty { display: none; }

.toast {
  position: fixed; left: 50%; bottom: var(--s5); z-index: 40;
  transform: translate(-50%, 200%);
  max-width: calc(100vw - 32px);
  padding: var(--s3) var(--s4);
  background: var(--ink); color: var(--paper);
  border: var(--px) solid var(--gold);
  font-size: 0.9375rem;
  transition: transform 300ms cubic-bezier(.16, 1, .3, 1);
}
.toast.is-on { transform: translate(-50%, 0); }

.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; image-rendering: pixelated; }

/* ---------- 4. Header ---------- */
.top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: var(--s5);
  padding: var(--s3) var(--gutter);
  background: var(--ink);
  border-bottom: var(--px) solid var(--dusk);
}
.brand { display: inline-flex; align-items: center; gap: var(--s3); color: var(--paper); text-decoration: none; }
.brand__mark { width: 40px; height: 40px; }
.brand__word { font: 400 1rem/1 var(--pixel); color: var(--gold); margin: 0; }
.nav { display: flex; gap: var(--s1); margin-left: auto; }
.nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s3); color: var(--paper); text-decoration: none; font: 400 0.75rem/1 var(--pixel); }
.nav a:hover { color: var(--gold); }
.top__tools { display: flex; align-items: center; gap: var(--s3); }
.nav-toggle { display: none; }
#sound[aria-pressed="false"] { color: var(--mist); }

/* ---------- 5. Intro + world map ---------- */
.intro {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--s6); align-items: center;
  max-width: calc(var(--wrap) + var(--gutter) * 2); margin: 0 auto;
  padding: var(--s7) var(--gutter) var(--s8);
}
.intro__copy { padding: var(--s6); }
.intro__title { font: 400 clamp(1.5rem, 3.1vw, 2.5rem)/1.45 var(--pixel); color: var(--gold); }
.intro__lede { margin-top: var(--s5); font-size: 1.125rem; max-width: 60ch; }
.intro__actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s5); }
.intro__note { margin-top: var(--s4); color: var(--text-2); font-size: 0.9375rem; }

.world { margin: 0; background: var(--ink) padding-box; }
.world__map { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--grass); }
.world__map canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.world__hero { position: absolute; width: 7.8%; aspect-ratio: 1; transform: translate(-50%, -86%); transition: left 900ms steps(9), top 900ms steps(9); filter: drop-shadow(0 2px 0 rgb(22 19 31 / .5)); }
.world__tag {
  position: absolute; transform: translate(-50%, 0);
  padding: 4px 6px 3px; background: var(--ink); color: var(--paper);
  font: 400 0.75rem/1 var(--pixel); white-space: nowrap;
}
.world__tag--end { transform: translate(-100%, 0); }
.world__tag--start { transform: translate(-30%, 0); }
.world__cap { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3); align-items: baseline; padding: var(--s3) var(--s4); background: var(--ink); color: var(--paper); font-size: 0.9375rem; }
.world__cap .label { color: var(--gold); }

/* ---------- 6. The app ---------- */
.app-wrap { background: var(--grass); padding: var(--s7) var(--gutter) var(--s8); }
.app-head { max-width: var(--wrap); margin: 0 auto var(--s5); display: flex; flex-wrap: wrap; gap: var(--s3) var(--s6); align-items: end; justify-content: space-between; }
.app-head .h2 { color: var(--ink); }
.app-head__lede { max-width: 56ch; color: var(--ink); font-weight: 500; }

.app {
  max-width: var(--wrap); margin: 0 auto;
  display: grid; gap: var(--s4);
  grid-template-columns: 300px minmax(0, 1fr) 340px;
  grid-template-areas: "hero quests side" "log log side";
  align-items: start;
}
.panel { padding: var(--s5); min-width: 0; }
.panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); }
.panel__head--sub { margin-top: var(--s6); }
.panel__title { font: 400 0.875rem/1.4 var(--pixel); color: var(--gold); }
.panel__day { color: var(--sky); }
.panel__sub { font-size: 0.9375rem; color: var(--sky); white-space: nowrap; }

/* Hero card */
.hero-card { grid-area: hero; }
.hero-card__stage {
  position: relative; height: 196px; margin: calc(var(--s5) * -1) calc(var(--s5) * -1) var(--s4);
  background:
    linear-gradient(to bottom, transparent 70%, var(--grass) 70% 74%, #2f7a3a 74%),
    var(--sea);
  background-image:
    linear-gradient(to bottom, transparent 0 70%, var(--leaf) 70% calc(70% + 4px), var(--grass) calc(70% + 4px)),
    linear-gradient(to bottom, var(--sea), var(--sea));
  overflow: hidden;
}
.hero-card__stage::before { /* two pixel clouds */
  content: ""; position: absolute; left: 18%; top: 22px; width: 32px; height: 8px; background: var(--sky);
  box-shadow: 8px -8px 0 0 var(--sky), 16px -8px 0 0 var(--sky), 150px 20px 0 0 var(--sky), 158px 12px 0 0 var(--sky);
}
.hero-sprite { position: absolute; left: 50%; bottom: 18px; width: 160px; height: 160px; transform: translateX(-56%); }
.hero-pet { position: absolute; left: calc(50% + 46px); bottom: 26px; width: 48px; height: 40px; }
.lay--blink { opacity: 0; }
.hero-card__float {
  position: absolute; left: 50%; top: 30px; transform: translateX(-50%);
  font: 400 0.875rem/1 var(--pixel); color: var(--gold);
  text-shadow: 2px 2px 0 var(--ink), -2px 2px 0 var(--ink), 2px -2px 0 var(--ink), -2px -2px 0 var(--ink);
  opacity: 0; pointer-events: none; white-space: nowrap;
}
.hero-card__float.is-hurt { color: #ffb3ba; }
.hero-card__float.is-heal { color: var(--leaf); }
.hero-card__float.is-on { opacity: 1; }
.hero-card__id { display: flex; flex-direction: column; gap: var(--s2); margin-bottom: var(--s4); }
.hero-card__name { font: 400 1.125rem/1.2 var(--pixel); color: var(--paper); }
.hero-card__title { color: var(--text-2); display: flex; gap: var(--s3); align-items: baseline; }
.hero-card__title .label { color: var(--gold); }
.stat { margin-bottom: var(--s4); }
.stat__row { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s2); }
.stat__icon { width: 14px; height: 14px; }
.stat__num { margin-left: auto; font: 600 0.9375rem/1 var(--body); font-variant-numeric: tabular-nums; }
.formula { font-size: 0.9375rem; color: var(--text-2); padding: var(--s3); background: var(--night); border: var(--px) solid var(--ink); }
.formula .label { display: block; color: var(--sky); margin-bottom: var(--s2); }
.formula b { color: var(--paper); }
.hero-card__actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s4); }
.hero-card__actions .btn { flex: 1 1 100%; justify-content: flex-start; white-space: nowrap; }
.hero-card__actions .btn__count { margin-left: auto; }
.hero-card.is-low .bar--hp .bar__fill { animation: none; }
.hero-card.is-low .hero-card__stage { background-image: linear-gradient(to bottom, transparent 0 70%, var(--leaf) 70% calc(70% + 4px), var(--grass) calc(70% + 4px)), linear-gradient(var(--dusk), var(--dusk)); }

/* Quests */
.quests { grid-area: quests; }
.quests__summary { color: var(--text-2); margin-bottom: var(--s4); font-variant-numeric: tabular-nums; }
.quest-list { list-style: none; margin: 0 0 var(--s4); padding: 0; display: grid; gap: var(--s2); }
.quest {
  position: relative;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s3); align-items: center;
  padding: var(--s3); background: var(--night); border: var(--px) solid var(--ink);
}
.quest__check {
  display: grid; place-items: center;
  width: 44px; height: 44px; padding: 0;
  border: var(--px) solid var(--ink); background: var(--paper); color: var(--ink);
  box-shadow: inset calc(var(--px) * -1) calc(var(--px) * -1) 0 var(--parch);
  cursor: pointer;
}
.quest__check .u { width: 20px; height: 20px; stroke-width: 3; opacity: 0; }
.quest__check:hover { background: #fff8e0; }
.quest.is-done .quest__check { background: var(--leaf); box-shadow: inset calc(var(--px) * -1) calc(var(--px) * -1) 0 var(--grass); }
.quest.is-done .quest__check .u { opacity: 1; }
.quest__main { min-width: 0; }
.quest__name { display: block; font-weight: 600; overflow-wrap: anywhere; }
.quest.is-done .quest__name { text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: var(--leaf); color: var(--text-2); }
.quest__meta { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); font-size: 0.875rem; color: var(--text-2); }
.quest__streak { display: inline-flex; align-items: center; gap: 5px; color: var(--paper); font-variant-numeric: tabular-nums; }
.quest__streak svg { width: 12px; height: 14px; }
.quest__streak.is-zero { color: var(--text-2); }
.quest__xp { font: 400 0.75rem/1 var(--pixel); color: var(--gold); white-space: nowrap; }
.quest.is-rest { background: transparent; border-style: dashed; border-color: var(--slate); }
.quest.is-rest .quest__check { background: var(--dusk); box-shadow: none; cursor: not-allowed; border-color: var(--slate); }
.quest.is-rest .quest__xp { color: var(--mist); }
.quest.is-new { animation: quest-in 700ms steps(6); }
.quests__add { width: 100%; }
.empty { display: flex; gap: var(--s4); align-items: flex-start; padding: var(--s4); margin-bottom: var(--s4); background: var(--night) padding-box; }
.empty[hidden] { display: none; }
.empty__sprite { width: 60px; height: 50px; flex: none; }
.empty__title { font: 400 0.875rem/1.5 var(--pixel); color: var(--gold); margin-bottom: var(--s2); }
.heat__nojs { color: var(--text-2); font-size: 0.9375rem; }

/* Week grid */
.side { grid-area: side; }
.heat { display: grid; gap: 6px; font-variant-numeric: tabular-nums; }
/* Each quest: its name on one line, its seven days below */
.heat__row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; align-items: center; }
.heat__name { grid-column: 1 / -1; font-size: 0.875rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--paper); }
.heat__row--head .heat__name { display: none; }
.heat__day { font: 400 0.75rem/1 var(--pixel); color: var(--text-2); text-align: center; }
.heat__day.is-today { color: var(--gold); }
.heat__cell { width: 100%; height: 22px; border: var(--px) solid var(--ink); }
.heat__cell.is-today { outline: 2px solid var(--gold); outline-offset: 1px; }
.heat__cell.tile--done { box-shadow: inset 3px 3px 0 rgb(255 255 255 / .45); }
.heat__total { font-size: 0.875rem; color: var(--text-2); margin-top: var(--s2); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); margin: var(--s4) 0 0; padding: 0; font-size: 0.875rem; color: var(--text-2); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }

/* Inventory */
.inv { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); }
.slot {
  position: relative; width: 100%; aspect-ratio: 1; padding: 0; min-height: 0; overflow: hidden;
  display: grid; place-items: center;
  background: var(--night); border: var(--px) solid var(--ink); color: var(--paper);
  cursor: pointer;
  box-shadow: inset var(--px) var(--px) 0 rgb(0 0 0 / .25);
}
.slot svg { position: absolute; inset: 14%; width: 72%; height: 72%; }
.slot:hover { background: #2e2850; }
.slot[aria-pressed="true"] { background: var(--sea); box-shadow: inset 0 0 0 var(--px) var(--gold); }
.slot.is-locked { cursor: not-allowed; }
.slot.is-locked svg { opacity: .55; inset: 28%; width: 44%; height: 44%; }
.slot__lv { position: absolute; right: 4px; bottom: 4px; font: 400 0.75rem/1 var(--pixel); color: var(--paper); background: var(--ink); padding: 2px 3px; }
.slot.is-new::after { content: ""; position: absolute; top: -6px; right: -6px; width: 12px; height: 12px; background: var(--gold); border: 2px solid var(--ink); }
.inv__hint { margin-top: var(--s3); font-size: 0.875rem; color: var(--text-2); }

/* Log: dialogue line at the bottom of the screen */
.log { grid-area: log; display: flex; gap: var(--s4); align-items: center; padding: var(--s4) var(--s5); background: var(--ink) padding-box; min-height: 92px; }
.log__face { width: 48px; height: 40px; flex: none; }
.log__text { font-size: 1.0625rem; max-width: 80ch; }
.log__text::after { content: ""; display: inline-block; width: 10px; height: 10px; margin-left: 10px; background: var(--gold); clip-path: polygon(0 0, 100% 0, 50% 100%); vertical-align: 0; }

/* ---------- 7. Manual ---------- */
.manual { background: var(--parch); color: var(--ink); padding: var(--s8) var(--gutter); }
.manual__page { max-width: var(--wrap); margin: 0 auto; }
.manual__head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: var(--s6); align-items: end; margin-bottom: var(--s7); }
.manual__head .h2 { color: var(--ink); }
.manual__head p { max-width: 60ch; font-size: 1.125rem; }
.manual__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s7) var(--s8); }
.rule { max-width: 62ch; }
.rule__title { font: 400 1rem/1.5 var(--pixel); color: var(--ink); margin-bottom: var(--s3); padding-bottom: var(--s3); border-bottom: var(--px) solid var(--ink); }
.rule p + p, .rule p + .table { margin-top: var(--s4); }
.rule i { font-style: italic; }
.table { width: 100%; border-collapse: collapse; margin-top: var(--s4); background: var(--paper); border: var(--px) solid var(--ink); }
.table caption { text-align: left; font: 400 0.75rem/1.4 var(--pixel); padding-bottom: var(--s2); color: var(--ink); }
.table th, .table td { padding: 8px 12px; text-align: left; border-bottom: 2px solid #c9b47f; }
.table thead th { background: var(--ink); color: var(--paper); font: 400 0.75rem/1.4 var(--pixel); }
.table tbody th { font-weight: 600; }
.table td { font-variant-numeric: tabular-nums; }

/* ---------- 8. Party ---------- */
.party {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: var(--s7); align-items: center;
  max-width: calc(var(--wrap) + var(--gutter) * 2); margin: 0 auto; padding: var(--s8) var(--gutter);
}
.party__copy p { margin-top: var(--s4); max-width: 60ch; }
.party__copy p:last-child { color: var(--text-2); }
.party__board { padding: var(--s5); }
.pq { padding-bottom: var(--s5); margin-bottom: var(--s4); border-bottom: var(--px) solid var(--ink); }
.pq__title { display: flex; flex-direction: column; gap: var(--s2); margin-bottom: var(--s4); font-weight: 600; }
.pq__title .label { color: var(--leaf); }
.pq__num { margin-top: var(--s3); font-size: 0.9375rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.pq__num b { color: var(--paper); }
.members { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.member { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: var(--s4); align-items: center; padding: var(--s2) var(--s3); background: var(--night); border: var(--px) solid var(--ink); }
.member__sprite { width: 56px; height: 56px; }
.member__name { font: 400 0.8125rem/1.4 var(--pixel); }
.member__name span { font: 500 0.875rem/1 var(--body); color: var(--gold); margin-left: 6px; }
.member__meta { font-size: 0.9375rem; color: var(--text-2); }
.cheer[aria-pressed="true"] { --b-bg: var(--leaf); --b-fg: var(--ink); }

/* ---------- 9. Screens ---------- */
.screens { background: var(--dusk); padding: var(--s8) var(--gutter); }
.screens__head { max-width: var(--wrap); margin: 0 auto var(--s7); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: var(--s6); align-items: end; }
.screens__head p { max-width: 60ch; }
.phones { max-width: var(--wrap); margin: 0 auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s6); }
.phone { margin: 0; }
.phone:nth-child(2) { margin-top: var(--s7); }
.phone__screen {
  position: relative; aspect-ratio: 9 / 17; max-width: 300px; margin: 0 auto;
  display: flex; flex-direction: column;
  padding: 36px 14px 18px;
  background: var(--night);
  border: 12px solid var(--ink);
  box-shadow: 0 0 0 var(--px) var(--slate), 0 18px 30px rgb(0 0 0 / .35);
  overflow: hidden;
}
.phone__screen::before { content: ""; position: absolute; top: 12px; left: 50%; width: 56px; height: 8px; margin-left: -28px; background: var(--ink); box-shadow: 0 0 0 2px var(--dusk); }
.phone figcaption { max-width: 300px; margin: var(--s4) auto 0; font-size: 0.9375rem; color: var(--paper); }
.phone figcaption b { color: var(--gold); font-weight: 600; }
.ps__bar { display: flex; justify-content: space-between; font: 400 0.75rem/1 var(--pixel); color: var(--gold); padding-bottom: 10px; border-bottom: var(--px) solid var(--dusk); margin-bottom: 12px; }
.ps__line { margin-top: auto; padding: 10px; background: var(--dusk); font-size: 0.875rem; border: var(--px) solid var(--ink); }
.ps-map { position: relative; flex: 1; margin-bottom: 12px; background:
  linear-gradient(90deg, transparent 0 62%, var(--sea) 62% 70%, transparent 70%),
  repeating-linear-gradient(0deg, transparent 0 12px, rgb(22 19 31 / .14) 12px 16px),
  var(--grass); border: var(--px) solid var(--ink); }
.ps-map i { position: absolute; left: calc(var(--x) * 1%); top: calc(var(--y) * 1%); width: 10px; height: 10px; margin: -5px 0 0 -5px; background: var(--parch); border: 2px solid var(--ink); }
.ps-map i.is-here { width: 16px; height: 16px; margin: -8px 0 0 -8px; background: var(--gold); }
.ps-grid { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ps-grid li { position: relative; aspect-ratio: 1; min-width: 0; min-height: 0; overflow: hidden; background: var(--dusk); border: var(--px) solid var(--ink); }
.ps-grid svg { position: absolute; inset: 12%; width: 76%; height: 76%; }
.ps-grid li.is-locked svg { inset: 28%; width: 44%; height: 44%; opacity: .6; }
.ps-year { display: grid; grid-template-columns: repeat(14, 1fr); gap: 3px; margin-bottom: 12px; align-content: start; }
.ps-year i { aspect-ratio: 1; background: var(--dusk); }
.ps-year i.l1 { background: var(--grass); }
.ps-year i.l2 { background: var(--leaf); }
.ps-year i.l3 { background: var(--gold); }

/* ---------- 10. Pricing ---------- */
.pricing { background: var(--grass); padding: var(--s8) var(--gutter); }
.pricing__head { max-width: var(--wrap); margin: 0 auto var(--s6); display: flex; flex-wrap: wrap; gap: var(--s4) var(--s6); align-items: end; justify-content: space-between; color: var(--ink); }
.pricing__head .h2 { color: var(--ink); width: 100%; }
.pricing__head p { max-width: 60ch; font-weight: 500; }
.toggle { display: inline-flex; background: var(--ink); padding: var(--px); gap: var(--px); }
.toggle button { min-height: 44px; padding: 8px 14px; border: 0; background: var(--ink); color: var(--paper); font: 400 0.75rem/1.2 var(--pixel); cursor: pointer; }
.toggle button[aria-checked="true"] { background: var(--gold); color: var(--ink); }
.toggle button span { font: 600 0.8125rem/1 var(--body); margin-left: 6px; }
.plans { max-width: var(--wrap); margin: 0 auto; display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: var(--s4); align-items: stretch; }
.plan { display: flex; flex-direction: column; padding: var(--s5); }
.plan--main { background: var(--night) padding-box; }
.plan__name { font: 400 0.9375rem/1.4 var(--pixel); color: var(--gold); }
.plan__price { margin: var(--s4) 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s2) var(--s3); }
.plan__price b { font: 400 1.5rem/1 var(--pixel); color: var(--paper); font-variant-numeric: tabular-nums; }
.plan__price span { color: var(--text-2); font-size: 0.9375rem; }
.plan__list { list-style: none; margin: 0 0 var(--s5); padding: 0; display: grid; gap: var(--s2); }
.plan__list li { position: relative; padding-left: 22px; }
.plan__list li::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 10px; height: 10px; background: var(--leaf); box-shadow: 2px 2px 0 var(--ink); }
.plan__cta { margin-top: auto; }

/* ---------- 11. Download ---------- */
.download {
  display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: var(--s7); align-items: center;
  max-width: calc(var(--wrap) + var(--gutter) * 2); margin: 0 auto; padding: var(--s8) var(--gutter);
}
.download__art { position: relative; justify-self: center; width: min(320px, 70vw); aspect-ratio: 16 / 12; }
.download__chest { position: absolute; left: 0; bottom: 0; width: 100%; height: auto; aspect-ratio: 16 / 11; }
.download__coin { position: absolute; width: 14%; aspect-ratio: 1; }
.download__coin.c1 { left: 18%; top: -6%; }
.download__coin.c2 { left: 46%; top: -18%; }
.download__coin.c3 { left: 72%; top: -2%; }
.download__copy p { margin-top: var(--s4); max-width: 60ch; }
.dl-form { margin-top: var(--s5); max-width: 560px; }
.dl-form__row { display: flex; gap: var(--s3); }
.dl-form__row .input { flex: 1; min-width: 0; }
.download__fine { color: var(--text-2); font-size: 0.9375rem; }

/* ---------- 12. FAQ, footer, terrain edges ---------- */
.faq { background: var(--grass); padding: var(--s7) var(--gutter) var(--s8); }
.faq .h2 { max-width: 900px; margin: 0 auto var(--s6); color: var(--ink); }
.faq__list { max-width: 900px; margin: 0 auto; display: grid; gap: var(--s3); }
.qa { background: var(--night) padding-box; }
.qa summary { display: flex; justify-content: space-between; gap: var(--s4); align-items: center; padding: var(--s4); min-height: 48px; cursor: pointer; list-style: none; font-weight: 600; font-size: 1.0625rem; }
.qa summary::-webkit-details-marker { display: none; }
.qa summary::after { content: ""; flex: none; width: 12px; height: 12px; background: var(--gold); clip-path: polygon(0 0, 100% 0, 50% 100%); }
.qa[open] summary::after { transform: rotate(180deg); }
.qa p { padding: 0 var(--s4) var(--s4); color: var(--paper); max-width: 70ch; }

.foot { background: var(--ink); color: var(--paper); }
.foot__ground { height: 24px; background:
  linear-gradient(90deg, var(--grass) 0 50%, transparent 50%) 0 0 / 16px 8px repeat-x,
  linear-gradient(var(--wood), var(--wood)) 0 8px / 100% 8px no-repeat,
  linear-gradient(90deg, var(--wood) 0 25%, transparent 25% 50%, var(--wood) 50% 62%, transparent 62%) 0 16px / 32px 8px repeat-x; }
.foot__inner { max-width: var(--wrap); margin: 0 auto; padding: var(--s7) var(--gutter); display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--s6); }
.foot__brand p + p { margin-top: var(--s3); color: var(--text-2); max-width: 46ch; }
.foot__nav { display: flex; gap: var(--s7); }
.foot__nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); }
.foot__nav a { display: inline-flex; min-height: 44px; align-items: center; color: var(--paper); text-decoration: none; }
.foot__nav a:hover { color: var(--gold); }
.foot__fine { grid-column: 1 / -1; padding-top: var(--s5); border-top: var(--px) solid var(--dusk); color: var(--text-2); font-size: 0.9375rem; }

/* Stepped terrain between sections: each edge is a strip of 8px steps */
.edge { height: 32px; background-repeat: repeat-x; background-size: 128px 32px; }
.edge--hills { background-color: var(--night); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='128' height='32' viewBox='0 0 32 8' shape-rendering='crispEdges'%3E%3Cpath fill='%233f9a4a' d='M0 4h4V2h6v2h6V3h4V1h6v2h6v5H0z'/%3E%3Cpath fill='%239fd667' d='M4 2h6v1H4zM20 1h6v1h-6zM0 4h4v1H0zM10 4h6v1h-6zM16 3h4v1h-4zM26 3h6v1h-6z'/%3E%3C/svg%3E"); }
.app-wrap + .edge--parch, .edge--parch { background-color: var(--grass); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='128' height='32' viewBox='0 0 32 8' shape-rendering='crispEdges'%3E%3Cpath fill='%23e2cf9f' d='M0 5h6V4h8v1h6V3h6v2h6v3H0z'/%3E%3Cpath fill='%2316131f' d='M0 5h6v1H0zM6 4h8v1H6zM14 5h6v1h-6zM20 3h6v1h-6zM26 5h6v1h-6z'/%3E%3C/svg%3E"); }
.edge--parch-out { background-color: var(--night); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='128' height='32' viewBox='0 0 32 8' shape-rendering='crispEdges'%3E%3Cpath fill='%23e2cf9f' d='M0 0h32v3h-6v2h-6V4h-6v1H6V4H0z'/%3E%3Cpath fill='%2316131f' d='M0 4h6v1H0zM6 5h8v1H6zM14 4h6v1h-6zM20 5h6v1h-6zM26 3h6v1h-6z'/%3E%3C/svg%3E"); }
.screens + .edge--hills { background-color: var(--dusk); }
.edge--flip { transform: scaleY(-1); }
.download + .edge--hills { background-color: var(--night); }

/* ---------- 13. Motion ---------- */
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(1px); } }
@keyframes blink { 0%, 94%, 100% { opacity: 0; } 95%, 99% { opacity: 1; } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 30% { transform: translateY(-3px); } 60% { transform: translateY(-1px); } }
@keyframes float-up { 0% { transform: translate(-50%, 8px); opacity: 1; } 80% { opacity: 1; } 100% { transform: translate(-50%, -28px); opacity: 0; } }
@keyframes quest-in { 0% { background: var(--gold); } 100% { background: var(--night); } }
@keyframes pet-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes coin-spin { 0%, 100% { transform: scaleX(1); } 50% { transform: scaleX(.3); } }
@keyframes shake { 0%, 100% { transform: translateX(-56%); } 25% { transform: translateX(calc(-56% - 4px)); } 75% { transform: translateX(calc(-56% + 4px)); } }

@media (prefers-reduced-motion: no-preference) {
  .hero-sprite .bob, .brand__mark { animation: bob 1.2s steps(1) infinite; }
  .hero-sprite .lay--blink { animation: blink 4.2s steps(1) infinite; }
  .hero-pet { animation: pet-bob 1.6s steps(2) infinite; }
  .hero-sprite.is-hop .bob { animation: hop 420ms steps(3); }
  .hero-sprite.is-hurt { animation: shake 300ms steps(4); }
  .hero-card__float.is-on { animation: float-up 1100ms steps(10) forwards; }
  .level__hero { animation: hop 700ms steps(4) infinite; }
  .download__coin { animation: coin-spin 1.4s steps(4) infinite; }
  .download__coin.c2 { animation-delay: -.45s; }
  .download__coin.c3 { animation-delay: -.9s; }
  .member__sprite { animation: bob 1.4s steps(1) infinite; }
  .member:nth-child(2) .member__sprite { animation-delay: -.5s; }
  .member:nth-child(3) .member__sprite { animation-delay: -.9s; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bar__fill, .world__hero, .toast { transition: none; }
  .quest.is-new { animation: none; }
  .hero-card__float.is-on { opacity: 1; transform: translate(-50%, -10px); }
}

/* Level up dialog */
.level__stage { display: grid; place-items: center; height: 150px; margin: calc(var(--s5) * -1) calc(var(--s5) * -1) 0; background: var(--sea);
  background-image: repeating-conic-gradient(from 0deg at 50% 100%, rgb(246 201 69 / .28) 0 10deg, transparent 10deg 20deg); }
.level__hero { width: 128px; height: 128px; }
.level__line { max-width: 44ch; margin: 0 auto; }
.level__next { margin-top: var(--s3); color: var(--text-2); font-size: 0.9375rem; }
.loot { list-style: none; margin: var(--s4) auto 0; padding: 0; display: grid; gap: var(--s2); max-width: 340px; text-align: left; }
.loot li { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3); background: var(--night); border: var(--px) solid var(--ink); }
.loot svg { width: 24px; height: 24px; flex: none; }

/* Night dialog */
.night__row { display: flex; gap: var(--s4); align-items: flex-start; }
.night__hero { width: 88px; height: 88px; flex: none; background: var(--night); border: var(--px) solid var(--ink); }
.night__text { font-size: 1.0625rem; }
.night__list { margin: var(--s3) 0 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 0.9375rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.night__list li { display: flex; justify-content: space-between; gap: var(--s3); padding: 6px 10px; background: var(--night); }
.night__list b { color: #ffb3ba; font-weight: 600; white-space: nowrap; }

/* ---------- 14. Narrow screens ---------- */
@media (max-width: 1180px) {
  .app { grid-template-columns: 300px minmax(0, 1fr); grid-template-areas: "hero quests" "log log" "side side"; }
  .side { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 0 var(--s6); }
  .side > .panel__head:first-child, .side > .heat, .side > .legend { grid-column: 1; }
  .side > .panel__head--sub, .side > .inv, .side > .inv__hint { grid-column: 2; }
  .side > .panel__head--sub { margin-top: 0; grid-row: 1; }
  .side > .inv { grid-row: 2 / span 2; align-self: start; }
  .side > .inv__hint { grid-row: 4; }
}
@media (max-width: 960px) {
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 0; padding: var(--s2) var(--gutter) var(--s4); background: var(--ink); box-shadow: 0 var(--px) 0 var(--dusk); }
  .nav.is-open { display: flex; }
  .nav a { min-height: 48px; font-size: 0.8125rem; }
  .nav-toggle { display: inline-grid; }
  .top__tools { margin-left: auto; }
  .intro { grid-template-columns: 1fr; padding-top: var(--s5); gap: var(--s5); }
  .manual__head, .screens__head { grid-template-columns: 1fr; gap: var(--s3); }
  .party, .download { grid-template-columns: 1fr; gap: var(--s6); }
  .plans { grid-template-columns: 1fr; max-width: 560px; }
  .phones { grid-template-columns: repeat(3, minmax(220px, 1fr)); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: var(--s4); gap: var(--s4); }
  .phone { scroll-snap-align: center; }
  .phone:nth-child(2) { margin-top: 0; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "hero" "log" "quests" "side"; }
  .hero-card { display: grid; grid-template-columns: minmax(0, 1fr); }
  .side { display: block; }
  .side > .panel__head--sub { margin-top: var(--s6); }
  .manual__grid { grid-template-columns: 1fr; gap: var(--s6); }
  .foot__inner { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  :root { --frame: 9px; }
  .top { gap: var(--s3); }
  .top__cta { display: none; }
  .brand__word { font-size: 0.875rem; }
  .intro__copy { padding: var(--s5) var(--s4); }
  .intro__lede { font-size: 1.0625rem; }
  .intro__actions .btn { flex: 1 1 100%; }
  .world__tag { font-size: 0.6875rem; padding: 3px 4px 2px; }
  .world__cap { font-size: 0.875rem; }
  .panel { padding: var(--s4); }
  .hero-card__stage { margin: calc(var(--s4) * -1) calc(var(--s4) * -1) var(--s4); }
    .log { padding: var(--s3) var(--s4); }
  .log__face { width: 36px; height: 30px; }
  .log__text { font-size: 1rem; }
  .quest { grid-template-columns: auto minmax(0, 1fr); }
  .quest__xp { grid-column: 2; }
  .dl-form__row { flex-direction: column; }
  .member { grid-template-columns: 48px minmax(0, 1fr) auto; gap: var(--s3); }
  .member__sprite { width: 48px; height: 48px; }
  .dlg__body { padding: var(--s4); }
  .level__stage { margin: calc(var(--s4) * -1) calc(var(--s4) * -1) 0; }
  .keys { display: none; }
  .dlg__foot .btn { flex: 1 1 auto; }
  .foot__nav { gap: var(--s5); }
}
