/* Ganit — app styles, on top of /learn/_shared/theme.css.
 *
 * Chrome uses the shared --lx-* tokens so the app matches the rest of the learn
 * suite. The per-game accents below are the ONLY new colour, and they live in
 * one block so the whole thing re-themes from here.
 *
 * Accessibility floor: 18px body, ≥32px for the number under focus, ≥44px tap
 * targets, and every colour cue also carries a glyph or a word. */

:root {
  --g-sprint: #3f5fb0;
  --g-sprint-soft: #e8edfa;
  --g-kitchen: #b4622a;
  --g-kitchen-soft: #fbeadd;
  --g-market: #2f7a52;
  --g-market-soft: #e2f2e9;
  --g-floorplan: #4a6572;
  --g-floorplan-soft: #e7eef1;

  --g-paper: #fdfdfb;
  --g-ink-num: #1a2430;
  --g-radius: 18px;
}

body {
  font-size: 18px;
  display: flex;
  flex-direction: column;
}

.g-stage {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 18px 16px calc(28px + env(safe-area-inset-bottom));
}
.g-stage:focus { outline: none; }

/* ── topbar extras ───────────────────────────────────────────────────── */

.g-chip {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--lx-muted);
  background: var(--lx-surface-2);
  border: 1px solid var(--lx-line);
  border-radius: 999px;
  padding: 4px 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.g-chip.is-live { color: var(--lx-accent); border-color: var(--lx-accent-soft); background: var(--lx-accent-soft); }

.g-banner {
  display: none;
  padding: 10px 16px;
  background: #fbeee6;
  border-bottom: 1px solid #eccdb9;
  color: #8a3d20;
  font-weight: 700;
  font-size: 15px;
  text-align: center;
}
.g-banner.show { display: block; }

/* ── buttons ─────────────────────────────────────────────────────────── */

.g-btn {
  font: inherit;
  font-weight: 700;
  font-size: 17px;
  cursor: pointer;
  min-height: var(--lx-tap);
  padding: 0 20px;
  border-radius: 12px;
  background: var(--lx-surface);
  color: var(--lx-ink);
  border: 1.5px solid var(--lx-line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .08s var(--lx-ease), background .15s, border-color .15s;
}
.g-btn:hover { border-color: var(--lx-accent); }
.g-btn:active { transform: translateY(1px); }
.g-btn[disabled] { opacity: .45; cursor: not-allowed; }
.g-btn--go { background: var(--lx-accent); color: #fff; border-color: var(--lx-accent); }
.g-btn--go:hover { filter: brightness(1.06); border-color: var(--lx-accent); }
.g-btn--quiet { background: transparent; border-color: transparent; color: var(--lx-ink-soft); text-decoration: underline; text-underline-offset: 3px; }

/* ── home ────────────────────────────────────────────────────────────── */

.home { max-width: 720px; margin: 0 auto; }
.home-hello { text-align: center; padding: 10px 0 20px; }
.home-title { font-size: 40px; margin: 0 0 6px; letter-spacing: -.02em; }
.home-line { margin: 0; color: var(--lx-ink-soft); font-size: 17px; }
.home-days { margin: 8px 0 0; color: var(--lx-muted); font-size: 14.5px; }

.home-grid { display: grid; gap: 14px; }
.home-card {
  font: inherit;
  text-align: left;
  cursor: pointer;
  display: grid;
  grid-template-columns: 56px 1fr;
  grid-template-areas: 'emoji name' 'emoji line' 'foot foot';
  column-gap: 14px;
  row-gap: 3px;
  padding: 18px;
  border-radius: var(--g-radius);
  background: var(--lx-surface);
  border: 1.5px solid var(--lx-line);
  box-shadow: var(--lx-shadow-sm);
  transition: transform .12s var(--lx-ease), box-shadow .15s, border-color .15s;
}
.home-card:hover { transform: translateY(-2px); box-shadow: var(--lx-shadow); }
.home-card:active { transform: translateY(0); }
.home-card__emoji {
  grid-area: emoji;
  width: 56px; height: 56px;
  display: grid; place-items: center;
  font-size: 28px;
  border-radius: 16px;
  align-self: start;
}
.home-card__name { grid-area: name; font-size: 21px; font-weight: 800; }
.home-card__line { grid-area: line; color: var(--lx-ink-soft); font-size: 15.5px; line-height: 1.35; }
.home-card__foot {
  grid-area: foot;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--lx-line);
}
.home-card__detail { font-size: 13.5px; color: var(--lx-muted); }
.home-card__level {
  font-size: 12.5px; font-weight: 800; padding: 3px 10px; border-radius: 999px;
  background: var(--lx-surface-2); color: var(--lx-ink-soft); white-space: nowrap;
}
.home-card--sprint .home-card__emoji { background: var(--g-sprint-soft); }
.home-card--sprint:hover { border-color: var(--g-sprint); }
.home-card--kitchen .home-card__emoji { background: var(--g-kitchen-soft); }
.home-card--kitchen:hover { border-color: var(--g-kitchen); }
.home-card--market .home-card__emoji { background: var(--g-market-soft); }
.home-card--market:hover { border-color: var(--g-market); }
.home-card--floorplan .home-card__emoji { background: var(--g-floorplan-soft); }
.home-card--floorplan:hover { border-color: var(--g-floorplan); }

.home-foot { text-align: center; margin-top: 22px; }

/* ── the Ask panel (shared by three games) ───────────────────────────── */

.g-ask {
  max-width: 560px;
  margin: 0 auto;
  background: var(--lx-surface);
  border: 1.5px solid var(--lx-line);
  border-radius: var(--g-radius);
  box-shadow: var(--lx-shadow-sm);
  padding: 16px 16px 12px;
}
.g-ask__head { margin-bottom: 12px; }
.g-ask__label {
  margin: 0 0 6px; font-size: 12.5px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--lx-accent); font-weight: 800;
}
.g-prompt { margin: 0; font-size: 19px; line-height: 1.4; color: var(--lx-ink); }
.g-ask__input { display: flex; justify-content: center; padding: 6px 0 12px; }
.g-ask__actions { display: flex; justify-content: center; gap: 10px; margin-top: 6px; }

/* the number under focus is never smaller than 32px */
.g-box {
  font: inherit;
  font-size: 34px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: center;
  width: 84px;
  min-height: 62px;
  padding: 2px 6px;
  color: var(--g-ink-num);
  background: var(--g-paper);
  border: 2px solid var(--lx-line-strong);
  border-radius: 12px;
}
.g-box--wide { width: 200px; }
.g-box:focus-visible { border-color: var(--lx-focus); outline: 3px solid var(--lx-focus); outline-offset: 2px; }
.g-box[disabled] { opacity: .6; }

.g-boxlab {
  display: block; text-align: center; font-size: 11.5px; font-weight: 800;
  letter-spacing: .05em; text-transform: uppercase; color: var(--lx-muted); margin-bottom: 4px;
}

/* A written fraction: the whole number sits on the bar's centre line, the top
   and bottom boxes stack around the bar, and the labels stay outside it. */
.g-frac { display: flex; align-items: center; gap: 14px; }
.g-frac__whole { display: grid; gap: 0; justify-items: center; align-self: center; }
/* mirror the "bottom" label's height underneath, so the whole-number box lines
   up on the fraction bar instead of sitting low */
.g-frac__whole::after { content: '\00a0'; font-size: 11.5px; line-height: 1.45; margin-top: 4px; }
.g-frac__whole .g-box { width: 72px; border-style: dashed; }
.g-frac__part { display: grid; gap: 5px; }
.g-frac__num, .g-frac__den { display: grid; gap: 0; justify-items: center; }
.g-frac__bar { height: 4px; background: var(--g-ink-num); border-radius: 2px; }
.g-frac__den .g-boxlab { margin: 4px 0 0; }
.g-unit { font-size: 17px; font-weight: 700; color: var(--lx-ink-soft); align-self: center; }
.g-prefix { font-size: 30px; font-weight: 800; color: var(--lx-ink-soft); }
.g-value { display: flex; align-items: baseline; gap: 8px; }
.g-readout { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.g-spoons { display: flex; align-items: flex-end; gap: 12px; }
.g-spoons__plus { font-size: 26px; font-weight: 800; color: var(--lx-ink-soft); padding-bottom: 16px; }
.g-spoons__part { display: block; }
.g-seg { display: inline-flex; gap: 4px; background: var(--lx-surface-2); border: 1px solid var(--lx-line); border-radius: 12px; padding: 4px; }
.g-seg__btn {
  font: inherit; font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums;
  min-width: 52px; min-height: 52px; border: 0; border-radius: 9px; background: transparent;
  color: var(--lx-ink-soft); cursor: pointer;
}
.g-seg__btn[aria-checked="true"] { background: var(--lx-surface); color: var(--lx-accent); box-shadow: var(--lx-shadow-sm); }

/* ── number pad ──────────────────────────────────────────────────────── */

/* The dock: a fixed strip below the scrolling stage, so the pad is always under
   the thumb and never covers the answer boxes. */
.g-dock {
  display: none;
  flex: none;
  background: var(--lx-surface);
  border-top: 1px solid var(--lx-line);
  box-shadow: 0 -6px 20px rgba(31, 42, 51, .06);
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
}
.g-dock.show { display: block; }

.g-numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  max-width: 320px;
  margin: 0 auto;
}
.g-key {
  font: inherit;
  font-size: 25px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  min-height: 50px;
  border-radius: 12px;
  background: var(--lx-surface);
  border: 1.5px solid var(--lx-line-strong);
  color: var(--g-ink-num);
  cursor: pointer;
  transition: transform .06s var(--lx-ease), background .12s;
}
.g-key:hover { background: var(--lx-surface-2); }
.g-key:active { transform: translateY(2px); }
.g-key--muted { color: var(--lx-ink-soft); background: var(--lx-surface-2); }
.g-key--blank { visibility: hidden; pointer-events: none; }
.g-key--go {
  grid-column: 1 / -1;
  font-size: 19px;
  background: var(--lx-accent);
  border-color: var(--lx-accent);
  color: #fff;
}
.g-key--go[disabled] { opacity: .4; }

/* ── feedback ────────────────────────────────────────────────────────── */

.g-feedback { min-height: 8px; }
.g-note {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 12px; font-size: 16px; line-height: 1.45;
  border: 1.5px solid;
}
.g-note p { margin: 0; }
.g-note__mark { font-weight: 900; font-size: 18px; line-height: 1.3; flex: none; }
/* every tone carries a glyph AND a word, never colour alone */
.g-note--good { background: var(--lx-good-soft); border-color: #b9dcc6; color: #1f5c3a; }
.g-note--nudge { background: #fdf3e3; border-color: #ecd7b0; color: #7a5316; }
.g-note--look { background: var(--lx-surface-2); border-color: var(--lx-line-strong); color: var(--lx-ink); }
.g-note--band { background: var(--g-sprint-soft); border-color: #c3d0ee; color: #2b3f77; }

.g-worked {
  margin-top: 10px; padding: 12px 14px; border-radius: 10px;
  background: var(--g-paper); border: 1px dashed var(--lx-line-strong);
}
.g-worked h4 { margin: 0 0 8px; font-size: 12.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--lx-muted); }
.g-worked__lines { margin: 0; padding-left: 20px; font-size: 16px; line-height: 1.7; font-variant-numeric: tabular-nums; }
.g-worked__answer { margin: 10px 0 0; font-size: 17px; }

/* ── Tables Sprint ───────────────────────────────────────────────────── */

.sp { max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.sp-bar { display: grid; gap: 8px; }
.sp-timer { height: 8px; border-radius: 999px; background: var(--lx-line); overflow: hidden; }
.sp-timer__fill {
  height: 100%; background: var(--g-sprint); border-radius: 999px;
  transform-origin: left center; transform: scaleX(1);
}
.sp-meta { display: flex; gap: 7px; align-items: baseline; font-size: 14px; color: var(--lx-muted); font-weight: 700; }
.sp-meta__sep { opacity: .5; }
.sp-count { font-variant-numeric: tabular-nums; color: var(--lx-ink-soft); }
.sp-timer__text { font-variant-numeric: tabular-nums; color: var(--g-sprint); }

.sp-stage { min-height: 250px; display: grid; }
.sp-card {
  background: var(--lx-surface); border: 1.5px solid var(--lx-line); border-radius: var(--g-radius);
  box-shadow: var(--lx-shadow-sm); padding: 22px 18px; text-align: center;
  display: grid; align-content: center; gap: 10px;
}
.sp-card--in { animation: sp-in .16s var(--lx-ease); }
@keyframes sp-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.sp-mode { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; font-weight: 800; color: var(--g-sprint); }
.sp-question {
  font-size: clamp(34px, 10vw, 56px); font-weight: 800; font-variant-numeric: tabular-nums;
  color: var(--g-ink-num); line-height: 1.1; letter-spacing: -.01em;
}
.sp-answer {
  font-size: clamp(40px, 12vw, 64px); font-weight: 800; font-variant-numeric: tabular-nums;
  color: var(--g-sprint); min-height: 1.15em; letter-spacing: .02em;
}
/* An empty answer shows a waiting caret rather than nothing, so it is obvious
   where the typing lands. */
.sp-answer--empty::after { content: '_'; opacity: .35; animation: sp-blink 1.1s steps(2) infinite; }
@keyframes sp-blink { 50% { opacity: .08; } }
.sp-card--reveal { background: var(--lx-surface-2); }
.sp-fact { font-size: clamp(30px, 9vw, 46px); font-weight: 800; font-variant-numeric: tabular-nums; color: var(--g-ink-num); }

.sp-summary { text-align: center; background: var(--lx-surface); border: 1.5px solid var(--lx-line); border-radius: var(--g-radius); padding: 22px 18px; }
.sp-summary h2 { margin: 0 0 8px; font-size: 26px; }
.sp-summary__line { color: var(--lx-ink-soft); margin: 0 0 12px; font-size: 16px; }
.sp-summary__missed { text-align: left; background: var(--g-paper); border: 1px dashed var(--lx-line-strong); border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; }
.sp-summary__missed h3 { margin: 0 0 6px; font-size: 12.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--lx-muted); }
.sp-summary__missed ul { margin: 0; padding-left: 20px; font-variant-numeric: tabular-nums; line-height: 1.7; }

/* ── Kitchen ─────────────────────────────────────────────────────────── */

.kx { max-width: 560px; margin: 0 auto; display: grid; gap: 14px; }
.kx-card {
  background: var(--lx-surface); border: 1.5px solid var(--lx-line); border-radius: var(--g-radius);
  padding: 22px; text-align: center; box-shadow: var(--lx-shadow-sm);
}
.kx-card__emoji { font-size: 46px; }
.kx-card__name { margin: 6px 0 4px; font-size: 27px; }
.kx-card__blurb { margin: 0 0 8px; color: var(--lx-ink-soft); font-size: 16px; }
.kx-card__base { margin: 0; font-size: 14.5px; color: var(--lx-muted); }
.kx-ask-title { text-align: center; font-size: 18px; margin: 4px 0 0; }
.kx-scalars { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 10px; }
.kx-scalar {
  font: inherit; cursor: pointer; display: grid; gap: 2px; padding: 14px 8px;
  background: var(--lx-surface); border: 1.5px solid var(--lx-line-strong); border-radius: 14px;
  transition: transform .1s var(--lx-ease), border-color .15s, background .15s;
}
.kx-scalar:hover { border-color: var(--g-kitchen); background: var(--g-kitchen-soft); transform: translateY(-2px); }
.kx-scalar__label { font-size: 26px; font-weight: 800; color: var(--g-kitchen); }
.kx-scalar__note { font-size: 12.5px; color: var(--lx-muted); font-weight: 700; }
.kx-hint { text-align: center; color: var(--lx-muted); font-size: 14.5px; margin: 0; }

.kx-head { display: flex; align-items: center; gap: 12px; }
.kx-head__emoji { font-size: 32px; width: 52px; height: 52px; display: grid; place-items: center; background: var(--g-kitchen-soft); border-radius: 14px; flex: none; }
.kx-head__name { margin: 0; font-size: 20px; }
.kx-head__scale { margin: 0; font-size: 14.5px; color: var(--lx-muted); font-weight: 700; }

.kx-list { display: grid; gap: 2px; background: var(--lx-surface); border: 1.5px solid var(--lx-line); border-radius: var(--g-radius); padding: 8px; }
.kx-row {
  display: grid; grid-template-columns: 20px 1fr auto 18px auto; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 10px; font-size: 15px; color: var(--lx-muted);
}
.kx-row__mark { font-weight: 900; color: var(--lx-line-strong); }
.kx-row__name { font-weight: 700; color: var(--lx-ink-soft); }
.kx-row__base, .kx-row__out { font-variant-numeric: tabular-nums; }
.kx-row__arrow { opacity: .4; }
.kx-row__out { font-weight: 800; }
.kx-row--done { color: var(--lx-ink); }
.kx-row--done .kx-row__mark { color: var(--lx-good); }
.kx-row--done .kx-row__out { color: var(--lx-good); }
.kx-row--active { background: var(--g-kitchen-soft); color: var(--lx-ink); }
.kx-row--active .kx-row__mark { color: var(--g-kitchen); }
.kx-row--active .kx-row__name { color: var(--lx-ink); }
.kx-row--active .kx-row__out { color: var(--g-kitchen); font-size: 18px; }
.kx-progress { text-align: center; color: var(--lx-muted); font-size: 13.5px; margin: 0; }

.kx-sub { text-align: center; margin-bottom: 10px; }
.kx-sub__tag {
  display: inline-block; font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
  font-weight: 800; color: var(--g-kitchen); background: var(--g-kitchen-soft);
  padding: 4px 12px; border-radius: 999px;
}
.kx-sub__note { margin: 8px 0 0; font-size: 13.5px; color: var(--lx-muted); }

.kx-cook { text-align: center; background: var(--lx-surface); border: 1.5px solid var(--lx-line); border-radius: var(--g-radius); padding: 24px 18px; }
.kx-cook h2 { margin: 10px 0 6px; font-size: 23px; }
.kx-cook__line { margin: 0 0 16px; color: var(--lx-ink-soft); font-size: 15.5px; }
.kx-pan { width: min(260px, 70%); height: auto; }
.kx-pan__body { fill: #45505c; }
.kx-pan__rim { fill: #5c6874; }
.kx-pan__handle { fill: #7b5738; }
.kx-pan__food { fill: var(--g-kitchen); opacity: .85; }
.kx-steam path { fill: none; stroke: #c9d2d8; stroke-width: 5; stroke-linecap: round; opacity: .9; }
.kx-steam path:nth-child(1) { animation: kx-steam 2.6s ease-in-out infinite; }
.kx-steam path:nth-child(2) { animation: kx-steam 2.6s ease-in-out .5s infinite; }
.kx-steam path:nth-child(3) { animation: kx-steam 2.6s ease-in-out 1s infinite; }
@keyframes kx-steam {
  0% { opacity: 0; transform: translateY(6px); }
  40% { opacity: .9; }
  100% { opacity: 0; transform: translateY(-14px); }
}

.kx-done, .mk-done, .fp-done { text-align: center; background: var(--lx-surface); border: 1.5px solid var(--lx-line); border-radius: var(--g-radius); padding: 24px 18px; }
.kx-done__emoji, .mk-done__emoji, .fp-done__emoji { font-size: 42px; }
.kx-done h2, .mk-done h2, .fp-done h2 { margin: 8px 0 6px; font-size: 24px; }
.kx-done p, .mk-done p, .fp-done p { color: var(--lx-ink-soft); margin: 0 0 14px; font-size: 16px; }
.kx-done__list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 4px; text-align: left; max-width: 320px; margin-inline: auto; font-size: 15.5px; }
.kx-done__list li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px; border-radius: 8px; background: var(--g-paper); }

/* The level-up offer, shown on the round's closing screen. */
.g-offer {
  background: var(--lx-accent-soft); border: 1.5px solid #bcd9dc; border-radius: 14px;
  padding: 16px; margin: 0 0 16px; text-align: center;
}
.g-offer__lede { margin: 0 0 2px; font-weight: 800; color: var(--lx-accent); font-size: 16px; }
.g-offer__q { margin: 0 0 12px; color: var(--lx-ink-soft); font-size: 15.5px; }
.g-offer__actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ── Market ──────────────────────────────────────────────────────────── */

.mk { max-width: 620px; margin: 0 auto; display: grid; gap: 14px; }
.mk-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.mk-head__title { margin: 0; font-size: 23px; }
.mk-head__sub { margin: 2px 0 0; color: var(--lx-muted); font-size: 14.5px; }
.mk-budget { text-align: right; background: var(--g-market-soft); border-radius: 12px; padding: 8px 14px; flex: none; }
.mk-budget__label { display: block; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; font-weight: 800; color: var(--g-market); }
.mk-budget b { font-size: 20px; font-variant-numeric: tabular-nums; color: var(--g-market); }

.mk-list { list-style: none; margin: 0; padding: 12px 14px; display: grid; gap: 4px; background: var(--lx-surface); border: 1.5px solid var(--lx-line); border-radius: var(--g-radius); }
.mk-list__item { display: flex; align-items: center; gap: 9px; font-size: 16px; color: var(--lx-ink-soft); }
.mk-list__mark { font-weight: 900; color: var(--lx-line-strong); width: 16px; }
.mk-list__item--got { color: var(--lx-muted); text-decoration: line-through; }
.mk-list__item--got .mk-list__mark { color: var(--g-market); text-decoration: none; }
.mk-list__qty { font-size: 13px; color: var(--lx-muted); font-weight: 700; }

.mk-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 9px; }
/* Fixed rows so the price always sits on the same baseline, whatever the name
   wraps to. */
.mk-tile {
  font: inherit; cursor: pointer; display: grid; gap: 3px; justify-items: center; position: relative;
  grid-template-rows: 30px 1fr auto;
  padding: 10px 6px 12px; background: var(--lx-surface); border: 1.5px solid var(--lx-line); border-radius: 14px;
  min-height: 112px; transition: transform .1s var(--lx-ease), border-color .15s;
}
.mk-tile__name { align-self: center; }
.mk-tile:hover { border-color: var(--g-market); transform: translateY(-2px); }
.mk-tile__emoji { font-size: 26px; }
.mk-tile__name { font-size: 12.5px; font-weight: 700; text-align: center; line-height: 1.25; color: var(--lx-ink-soft); }
.mk-tile__price { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--g-ink-num); }
.mk-tile--taken { background: var(--g-market-soft); border-color: var(--g-market); }
.mk-tile__got { position: absolute; top: 6px; right: 8px; color: var(--g-market); font-weight: 900; }
.mk-note { min-height: 20px; text-align: center; color: var(--lx-warn); font-size: 14.5px; font-weight: 700; }
.mk-actions { display: flex; justify-content: center; }

.mk-strip { display: flex; align-items: baseline; gap: 10px; justify-content: center; }
.mk-strip__step { font-size: 12.5px; letter-spacing: .05em; text-transform: uppercase; font-weight: 800; color: var(--lx-muted); }
.mk-strip__title { font-size: 17px; font-weight: 800; color: var(--g-market); }

.mk-basket { background: var(--g-paper); border: 1px dashed var(--lx-line-strong); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.mk-basket__title { margin: 0 0 6px; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--lx-muted); }
.mk-basket__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: 15.5px; }
.mk-basket__list li { display: flex; justify-content: space-between; gap: 12px; }
.mk-basket__price { font-variant-numeric: tabular-nums; font-weight: 700; }

.mk-billwrap { max-width: 400px; margin: 0 auto; text-align: center; display: grid; gap: 16px; justify-items: center; }
.mk-billwrap--in .mk-bill { animation: mk-print .5s var(--lx-ease); }
@keyframes mk-print { from { transform: translateY(-24px); opacity: 0; } to { transform: none; opacity: 1; } }
.mk-bill {
  width: 100%; background: var(--g-paper); padding: 18px 20px 22px;
  box-shadow: var(--lx-shadow); text-align: left;
  --notch: 8px;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--notch)),
    92% 100%, 84% calc(100% - var(--notch)), 76% 100%, 68% calc(100% - var(--notch)), 60% 100%,
    52% calc(100% - var(--notch)), 44% 100%, 36% calc(100% - var(--notch)), 28% 100%,
    20% calc(100% - var(--notch)), 12% 100%, 4% calc(100% - var(--notch)), 0 100%);
}
.mk-bill__head { text-align: center; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; font-size: 13px; color: var(--lx-muted); margin-bottom: 12px; }
.mk-bill__lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-family: var(--lx-mono); font-size: 14.5px; }
.mk-bill__lines li { display: flex; justify-content: space-between; gap: 12px; }
.mk-bill__rule { border-top: 1px dashed var(--lx-line-strong); margin: 12px 0; }
.mk-bill__total { display: flex; justify-content: space-between; font-weight: 800; font-size: 19px; font-variant-numeric: tabular-nums; }

.mk-compare { display: grid; gap: 8px; margin-bottom: 14px; }
.mk-compare__shop { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--g-paper); border: 1.5px solid var(--lx-line); }
.mk-compare__shop--cheap { border-color: var(--g-market); background: var(--g-market-soft); }
.mk-compare__name { flex: 1; font-weight: 700; font-size: 15.5px; }
.mk-compare__total { font-variant-numeric: tabular-nums; font-size: 18px; }

.mk-deal { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px; background: var(--g-paper); border: 1px dashed var(--lx-line-strong); margin-bottom: 14px; }
.mk-deal__emoji { font-size: 24px; }
.mk-deal__name { font-weight: 700; }
.mk-deal__price { font-variant-numeric: tabular-nums; font-weight: 800; }
.mk-deal__tag { margin-left: auto; font-size: 13px; font-weight: 800; color: var(--g-market); background: var(--g-market-soft); padding: 4px 10px; border-radius: 999px; }
.mk-done__band { font-weight: 700; }

/* ── Floor Plan ──────────────────────────────────────────────────────── */

.fp { max-width: 760px; margin: 0 auto; display: grid; gap: 14px; }
/* One panel or two, always centred and never stretched across a desktop. */
.fp-split { display: grid; gap: 12px; justify-content: center; }
@media (min-width: 720px) {
  .fp-split { grid-template-columns: repeat(auto-fit, minmax(280px, 370px)); }
}
.fp-panel { background: var(--lx-surface); border: 1.5px solid var(--lx-line); border-radius: var(--g-radius); padding: 12px 14px 14px; }
.fp-panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.fp-panel__head h3 { margin: 0; font-size: 15px; }
.fp-scale { font-size: 12.5px; font-weight: 800; color: var(--g-floorplan); background: var(--g-floorplan-soft); padding: 3px 10px; border-radius: 999px; }
/* Cap the panels so the room, the paper and the question all stay on one
   phone screen without scrolling. */
.fp-roomwrap, .fp-paperwrap { display: grid; justify-items: center; }
.fp-room, .fp-paper { width: 100%; height: auto; display: block; }
.fp-room { max-height: 24vh; }
.fp-paper { max-height: 32vh; }
@media (min-width: 720px) {
  .fp-room { max-height: 40vh; }
  .fp-paper { max-height: 46vh; }
}

.fp-room__floor { fill: var(--g-floorplan-soft); }
.fp-room__wall { fill: none; stroke: var(--g-floorplan); stroke-linejoin: round; }
.fp-dim line { stroke: var(--lx-muted); }
.fp-dimtext { fill: var(--lx-ink); font-weight: 800; font-family: var(--lx-font); }
.fp-furn rect { fill: var(--g-kitchen); opacity: .55; }
.fp-furn text { fill: var(--lx-ink); }

.fp-paper__bg { fill: #f7fbf9; }
.fp-grid-mm { stroke: #cfe3da; }
.fp-grid-cm { stroke: #8fc0ae; }
.fp-draw { fill: rgba(74, 101, 114, .22); stroke: var(--g-floorplan); stroke-width: .6; }
.fp-origin { fill: var(--g-floorplan); }
.fp-handle { fill: var(--lx-surface); stroke: var(--g-floorplan); stroke-width: 1; cursor: grab; }
.fp-paper { touch-action: none; cursor: crosshair; border-radius: 8px; }
.fp-paper:focus-visible { outline: 3px solid var(--lx-focus); outline-offset: 2px; }
.fp-readout { display: block; text-align: center; margin-top: 8px; font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--g-floorplan); }

.fp-steppers { display: grid; gap: 6px; margin-top: 10px; }
.fp-dockrow { display: grid; gap: 8px; justify-items: stretch; max-width: 420px; margin: 0 auto; }
.fp-dockrow .g-btn { width: 100%; min-height: 50px; }
.fp-dockrow .fp-steppers { margin-top: 0; }
.fp-stepper { display: flex; align-items: center; gap: 6px; }
.fp-stepper__lab { font-size: 12.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--lx-muted); width: 52px; }
.fp-stepper__btn {
  font: inherit; font-size: 18px; font-weight: 800; cursor: pointer; flex: 1;
  min-height: 44px; border-radius: 10px; background: var(--lx-surface-2);
  border: 1.5px solid var(--lx-line-strong); color: var(--lx-ink);
}
.fp-stepper__btn:hover { border-color: var(--g-floorplan); }
.fp-stepper__btn--big { font-size: 14px; }

/* ── wind-down ───────────────────────────────────────────────────────── */

.wind { max-width: 460px; margin: 24px auto 0; text-align: center; }
.wind-mark { font-size: 46px; }
.wind h1 { margin: 10px 0 10px; font-size: 28px; }
.wind-line { color: var(--lx-ink-soft); font-size: 17px; margin: 0 0 14px; }
.wind-list { list-style: none; margin: 0 auto 18px; padding: 0; display: inline-grid; gap: 6px; text-align: left; }
.wind-list li { background: var(--lx-surface); border: 1px solid var(--lx-line); border-radius: 10px; padding: 8px 16px; font-weight: 700; }
.wind-close { color: var(--lx-muted); font-size: 15px; margin: 0 0 22px; }
.wind-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.g-gate__q { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; text-align: center; margin: 14px 0 10px; }
.g-gate .g-box { display: block; margin: 0 auto; }
.g-gate__note { text-align: center; color: var(--lx-warn); font-weight: 700; min-height: 22px; margin: 8px 0; }
.g-gate__actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }

/* ── parent page ─────────────────────────────────────────────────────── */

.pv { max-width: 720px; margin: 0 auto; }
.pv-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.pv-head h1 { margin: 0; font-size: 27px; }
.pv-sec { background: var(--lx-surface); border: 1.5px solid var(--lx-line); border-radius: var(--g-radius); padding: 18px 20px; margin-top: 14px; }
.pv-sec h2 { margin: 0 0 8px; font-size: 19px; }
.pv-sec--caveat { background: var(--lx-surface-2); }
.pv-lede { margin: 0 0 14px; color: var(--lx-ink-soft); font-size: 15.5px; line-height: 1.5; }
.pv-game { margin-top: 16px; }
.pv-game h3 { margin: 0 0 8px; font-size: 16px; display: flex; align-items: baseline; gap: 10px; }
.pv-level { font-size: 12.5px; font-weight: 800; color: var(--lx-muted); background: var(--lx-surface-2); padding: 2px 10px; border-radius: 999px; }
.pv-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.pv-table th, .pv-table td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--lx-line); vertical-align: middle; }
.pv-table thead th { font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--lx-muted); }
.pv-table tbody th { font-weight: 700; color: var(--lx-ink); }
.pv-table td { font-variant-numeric: tabular-nums; color: var(--lx-ink-soft); white-space: nowrap; }
.pv-bar { display: inline-block; width: 68px; height: 8px; border-radius: 999px; background: var(--lx-line); overflow: hidden; vertical-align: middle; margin-right: 8px; }
.pv-bar__fill { display: block; height: 100%; background: var(--lx-accent); border-radius: 999px; }
.pv-num { font-weight: 700; }
.pv-empty { color: var(--lx-muted); font-size: 15px; margin: 0; }
.pv-caveats { margin: 0; padding-left: 20px; color: var(--lx-ink-soft); font-size: 15.5px; line-height: 1.6; display: grid; gap: 8px; }
.pv-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pv-log li { display: grid; gap: 2px; padding: 10px 12px; background: var(--g-paper); border-radius: 10px; border: 1px solid var(--lx-line); }
.pv-log__when { font-size: 12.5px; color: var(--lx-muted); font-variant-numeric: tabular-nums; }
.pv-log__what { font-weight: 700; font-size: 15px; }
.pv-log__why { font-size: 14.5px; color: var(--lx-ink-soft); }
.pv-note { font-size: 14.5px; color: var(--lx-muted); margin: 12px 0 0; }
.pv-seed code { font-family: var(--lx-mono); background: var(--lx-surface-2); padding: 2px 8px; border-radius: 6px; }
.pv-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── reduced motion ──────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .sp-card--in, .mk-billwrap--in .mk-bill { animation: none; }
  .sp-answer--empty::after { animation: none; }
  .kx-steam path { animation: none; opacity: .55; }
  .home-card:hover, .kx-scalar:hover, .mk-tile:hover { transform: none; }
}

/* On a wide screen a physical keyboard is usually there too, so the pad can be
   compact and give the question back its vertical space. */
@media (min-width: 720px) {
  .g-numpad { max-width: 280px; gap: 6px; }
  .g-key { min-height: 44px; font-size: 22px; }
  .g-key--go { min-height: 46px; }
}

/* ── narrow screens ──────────────────────────────────────────────────── */

@media (max-width: 420px) {
  body { font-size: 17px; }
  .g-stage { padding: 14px 12px calc(24px + env(safe-area-inset-bottom)); }
  .home-title { font-size: 34px; }
  .home-card { grid-template-columns: 48px 1fr; }
  .home-card__emoji { width: 48px; height: 48px; font-size: 24px; }
  .g-box { width: 74px; font-size: 30px; min-height: 56px; }
  .g-box--wide { width: 170px; }
  .kx-row { grid-template-columns: 16px 1fr auto 14px auto; gap: 6px; font-size: 14.5px; }
  .mk-shelf { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
}
