/* Puzzleberry Lane. Shell: casual-game-shell (header · main · footer, drawer, pages, tokens), from Peanut's
   Memory Legend. Breakpoints change tokens, not selectors. Each house's own parts live under .house-<id>. */
@font-face { font-family: Nunito; src: url("./assets/nunito-latin.woff2") format("woff2"); font-weight: 200 1000; font-display: swap; }

:root {
  --paper: #f5eedf;
  --cream: #fffaf0;
  --ink: #55463d;
  --muted: #84725f;
  --line: #cdb995;
  --primary: #b85068;      /* berry, the lane's own colour (white text 5.6:1) */
  --berry: #e5627e;
  --select: #6f8a68;       /* sage, as in the rest of the family */
  --focus: #627c5c;
  --coin: #f1d98f;
  --coin-ink: #6e4f14;
  --coin-edge: #cfae5a;
  --peach: #ee9f8a;
  --mustard: #e2b443;
  --back: #7c93b5;      /* Peanut's card backs */
  --ctl: 44px;
  --icon: 20px;
  --r-ctl: 10px;
  --gap: 14px;
  --pad: 22px;
  --ctl-shadow: #c3ab86;
  --frame: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 80' preserveAspectRatio='none'%3E%3Crect x='4' y='4' width='192' height='72' rx='10' fill='none' stroke='%23fffaf0' stroke-opacity='.5'/%3E%3Cpath d='M9 16v-4h5m172 0h5v4M9 64v4h5m172 0h5v-4' fill='none' stroke='%239e8057' stroke-opacity='.4'/%3E%3C/svg%3E");
  --card-back: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg fill='%23fffaf0' fill-opacity='.85'%3E%3Cpath d='m10 5 1.6 3.4 3.7.5-2.7 2.6.7 3.7-3.3-1.8-3.3 1.8.7-3.7-2.7-2.6 3.7-.5Z'/%3E%3Cpath d='m30 25 1.6 3.4 3.7.5-2.7 2.6.7 3.7-3.3-1.8-3.3 1.8.7-3.7-2.7-2.6 3.7-.5Z'/%3E%3C/g%3E%3Cg fill='%23fffaf0' fill-opacity='.45'%3E%3Ccircle cx='30' cy='9' r='1.6'/%3E%3Ccircle cx='10' cy='29' r='1.6'/%3E%3C/g%3E%3C/svg%3E");
  font-family: Nunito, ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  color: var(--ink);
  font-synthesis: none;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 700px) { :root { --gap: 10px; --pad: 16px; } }
@media (orientation: landscape) and (max-height: 600px) { :root { --gap: 7px; --pad: 12px; } }
@media (min-width: 701px) and (min-height: 581px) { :root { --gap: 14px; --pad: 28px; } }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  background: var(--paper);
  background-image: radial-gradient(#a3896220 .8px, transparent .8px);
  background-size: 8px 8px;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p, ol, ul { margin: 0; }
b, h1, h2, strong { font-weight: 800; }
svg { display: block; }
img { display: block; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .13em; color: var(--muted); text-transform: uppercase; }
.muted, .note { color: var(--muted); font-weight: 600; }
.note { font-size: 14px; }

/* ===== Controls: game pieces ===== */
button {
  font: inherit; font-weight: 800; color: var(--ink);
  min-height: var(--ctl);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--line); border-radius: var(--r-ctl);
  background-image: var(--frame), linear-gradient(#fffbf0, #f1e4c9);
  background-size: 100% 100%;
  box-shadow: 0 4px var(--ctl-shadow), inset 0 2px #fff9;
  cursor: pointer; touch-action: manipulation; white-space: nowrap;
  transition: transform .13s, filter .13s, box-shadow .13s;
}
button:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px var(--ctl-shadow), inset 0 2px #fff9; }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (hover: hover) { button:not(:disabled):hover { filter: brightness(1.04); transform: translateY(-1px); } button:not(:disabled):active { transform: translateY(3px); } }
button.primary {
  color: #fff;
  background-image: var(--frame), linear-gradient(color-mix(in srgb, var(--primary) 78%, white), var(--primary));
  border-color: color-mix(in srgb, var(--primary) 78%, black);
  box-shadow: 0 4px color-mix(in srgb, var(--primary) 62%, black), inset 0 2px #ffffff4d;
}
button.primary:active:not(:disabled) { box-shadow: 0 1px color-mix(in srgb, var(--primary) 62%, black), inset 0 2px #ffffff4d; }
button[aria-pressed="true"] {
  background-image: var(--frame), linear-gradient(color-mix(in srgb, var(--select) 20%, var(--cream)), color-mix(in srgb, var(--select) 36%, var(--cream)));
  border-color: color-mix(in srgb, var(--select) 80%, white);
  box-shadow: 0 4px color-mix(in srgb, var(--select) 55%, var(--paper)), inset 0 2px #fff9;
}
button > svg { width: var(--icon); height: var(--icon); flex: none; }
.icon-button { position: relative; width: var(--ctl); padding: 0; flex: none; }
button.big { min-height: 48px; font-size: 17px; }

/* ===== Shell: one grid, three rows ===== */
.shell {
  height: 100dvh;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); gap: var(--gap);
  padding:
    max(calc(var(--pad) - 6px), env(safe-area-inset-top))
    max(var(--pad), env(safe-area-inset-right))
    max(calc(var(--pad) - 6px), env(safe-area-inset-bottom))
    max(var(--pad), env(safe-area-inset-left));
}
header, footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.header-actions { display: flex; align-items: center; gap: 12px; flex: none; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: var(--ctl); color: inherit; text-decoration: none; font-size: 19px; line-height: 1.1; border-radius: 10px; }
.brand svg { width: 44px; height: 44px; flex: none; }
.brand span { min-width: 0; display: block; }
.brand b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 900; }
.brand small { display: block; margin-top: 5px; font-size: 10px; font-weight: 800; letter-spacing: .13em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coin-pill {
  min-height: var(--ctl); height: var(--ctl); padding: 0 12px 0 9px; gap: 6px; flex: none;
  border-radius: calc(var(--ctl) / 2); border-color: var(--coin-edge); color: var(--coin-ink); font-weight: 900; font-size: 15px; line-height: 1;
  background-image: linear-gradient(#fbeec0, var(--coin));
  box-shadow: 0 4px #c9a653, inset 0 2px #fff9;
}
.coin-pill:active:not(:disabled) { box-shadow: 0 1px #c9a653, inset 0 2px #fff9; }
.coin-pill.bump { animation: bump .45s ease-out; }
@keyframes bump { 40% { transform: scale(1.12); } }
.update-button::after, #menu-button::after {
  content: ""; position: absolute; top: -3px; right: -3px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--peach); border: 1.5px solid var(--cream); box-shadow: 0 0 0 1px #c9715c55;
}
#menu-button::after { display: none; }
#menu-button.downloading::after { display: block; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.5); opacity: .55; } }

main.main { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
.screen { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
body[data-page] .screen { display: none; }
footer { border-top: 1px solid color-mix(in srgb, var(--line) 55%, transparent); padding-top: 6px; min-height: 28px; font-size: 13px; color: var(--muted); font-weight: 700; }
footer #status { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
footer .tagline { display: none; flex: none; }

.panel { padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); border-radius: 14px; background: #fffdf6; display: flex; flex-direction: column; gap: 6px; }
.card-panel { background: var(--cream); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 4px var(--ctl-shadow), inset 0 2px #fff9; }

/* ===== Home ===== */
.home { min-height: 0; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(290px, .85fr); gap: var(--gap); align-items: center; }
.hero { min-height: 0; height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); align-items: center; justify-items: center; gap: 4px; text-align: center; }
.hero h1 { font-size: clamp(24px, 3.4vw, 34px); line-height: 1.08; font-weight: 900; }
.hero h1 em { font-style: normal; color: var(--primary); }
.mascot { width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.launch { padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.album-pick { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: center; }
.album-pick h2 { font-size: 20px; line-height: 1.15; }
.album-pick p { font-size: 14px; }
.emblem { --size: 72px; position: relative; width: var(--size); height: var(--size); flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 5px; border-radius: 14px; background: var(--tint, #f3ead8); border: 1px solid color-mix(in srgb, var(--line) 80%, transparent); }
.emblem .pic { width: 100%; height: 100%; }
.found-bar { height: 8px; border-radius: 4px; background: #efe4cd; overflow: hidden; margin-top: 6px; }
.found-bar i { display: block; height: 100%; background: var(--select); border-radius: 4px; }
.home-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.home-stats span { display: flex; flex-direction: column; align-items: center; padding: 6px; border-radius: 12px; background: #fffdf6; border: 1px solid color-mix(in srgb, var(--line) 60%, transparent); font-size: 12px; font-weight: 700; color: var(--muted); }
.home-stats b { font-size: 20px; color: var(--ink); line-height: 1.2; }
.start-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.start-actions button { min-height: 48px; padding: 8px 10px; }

/* ===== Play ===== */
.play { min-height: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.play .hud { grid-row: 1; } .play .timebar { grid-row: 2; } .play > .board-wrap { grid-row: 3; } .play .feedback-row { grid-row: 4; }
/* The play bar is information only (score, chips, clock) on its own soft panel; Leave sits at the start of the
   header, so the bar never reads as a second row of header buttons (owner, 2026-10-22). */
.hud { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: calc(var(--ctl) + 10px); padding: 4px 10px; border-radius: calc(var(--r-ctl) + 6px); background: color-mix(in srgb, var(--cream) 75%, transparent); border: 1px solid color-mix(in srgb, var(--line) 55%, transparent); box-shadow: inset 0 1px #fffc; }
.hud .clock-row { margin-left: auto; }
.hud-score { display: flex; align-items: baseline; gap: 6px; min-width: 0; flex: none; }
.hud-score b { font-size: 26px; line-height: 1; }
.hud-score small { font-size: 12px; font-weight: 700; color: var(--muted); }
.hud-mid { flex: 1; min-width: 0; display: flex; gap: 6px; justify-content: flex-end; overflow: hidden; }
.narrow-only { display: none; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 10px; border-radius: 15px; background: #fffdf6; border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); font-size: 13px; font-weight: 800; white-space: nowrap; }
.chip.combo { background: color-mix(in srgb, var(--mustard) 25%, var(--cream)); border-color: color-mix(in srgb, var(--mustard) 60%, white); }
.chip.you { background: color-mix(in srgb, var(--select) 22%, var(--cream)); border-color: color-mix(in srgb, var(--select) 60%, white); }
.chip .rank { color: var(--muted); }
.clock { flex: none; min-width: 64px; height: 36px; display: grid; place-items: center; padding: 0 10px; border-radius: 18px; background: var(--cream); border: 1px solid var(--line); font-size: 18px; font-weight: 900; }
.clock.urgent { color: #b3523e; border-color: var(--peach); background: #fde9e1; }
.timebar { height: 6px; border-radius: 3px; background: #ebdfc6; overflow: hidden; }
.timebar i { display: block; height: 100%; width: 100%; background: var(--primary); border-radius: 3px; transition: width .2s linear; }
.board-wrap { min-height: 0; min-width: 0; display: grid; place-items: center; overflow: hidden; }
/* Every board sits on a soft panel; on phones the panel fills the board area and the grid stays centred (casual-game-shell §10). */
.house-memory .board-wrap { background: #efe3d3; border: 1px solid #e3d2bf; border-radius: 14px; padding: 8px; box-shadow: inset 0 2px 8px #8c6f5310; }
.house-memory .board { --card: 64px; --cols: 4; --board-gap: 10px; display: grid; grid-template-columns: repeat(var(--cols), var(--card)); gap: var(--board-gap); }
.feedback-row { min-height: var(--ctl); display: flex; align-items: center; justify-content: center; gap: 12px; text-align: center; }
.feedback { font-weight: 800; min-width: 0; }
.feedback[data-tone="good"] { color: var(--select); }
.feedback[data-tone="miss"] { color: #b3523e; }
.peek-meter { width: 72px; height: 8px; border-radius: 4px; background: #ebdfc6; overflow: hidden; flex: none; }
.peek-meter i { display: block; height: 100%; background: var(--mustard); border-radius: 4px; transform-origin: left; }

/* Cards: a two-faced flip. The front only holds a picture once that picture may be seen. */
.house-memory button.card { width: var(--card); height: var(--card); min-height: 0; padding: 0; border: 0; border-radius: calc(var(--card) * .16); background: none; box-shadow: none; perspective: 700px; }
.house-memory button.card:active:not(:disabled) { transform: none; box-shadow: none; }
@media (hover: hover) { .house-memory button.card:not(:disabled):hover { transform: none; filter: none; } .house-memory button.card[data-state="down"]:not(:disabled):hover .card-inner { transform: translateY(-2px); } }
.house-memory .card-inner { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .34s cubic-bezier(.3, .7, .3, 1.15); }
.house-memory .card[data-state="up"] .card-inner, .house-memory .card[data-state="miss"] .card-inner, .house-memory .card[data-state="matched"] .card-inner, .house-memory .card[data-state="peek"] .card-inner { transform: rotateY(180deg); }
.house-memory .card[data-state="down"]:active .card-inner { transform: scale(.95); }
.house-memory .face { position: absolute; inset: 0; display: grid; place-items: center; border-radius: inherit; backface-visibility: hidden; -webkit-backface-visibility: hidden; border: 1px solid var(--line); box-shadow: 0 3px var(--ctl-shadow), inset 0 2px #fff9; }
.house-memory .face.back { border-color: color-mix(in srgb, var(--back) 70%, black); background: var(--card-back) center / 70% auto no-repeat, linear-gradient(color-mix(in srgb, var(--back) 82%, white), var(--back)); box-shadow: 0 3px color-mix(in srgb, var(--back) 55%, black), inset 0 0 0 3px #fffaf055; }
.house-memory .face.front { transform: rotateY(180deg); background: var(--cream); }
.house-memory .face.front .pic { width: 80%; height: 80%; }
.house-memory .card[data-state="matched"] .face.front { background: color-mix(in srgb, var(--select) 14%, var(--cream)); border-color: color-mix(in srgb, var(--select) 70%, white); box-shadow: 0 3px color-mix(in srgb, var(--select) 45%, var(--paper)), inset 0 2px #fff9; }
.house-memory .card[data-state="matched"] .pic { opacity: .72; }
.house-memory .card[data-state="matched"].fresh .face.front { animation: pop .42s ease-out; }
.house-memory .card[data-state="miss"] .face.front { background: #fdeee8; border-color: var(--peach); }
.house-memory .card[data-state="miss"] .card-inner { animation: shake .36s ease-in-out .3s; }
@keyframes pop { 45% { transform: rotateY(180deg) scale(1.1); } }
@keyframes shake { 25% { translate: -3px 0; } 75% { translate: 3px 0; } }
.house-memory .board.cleared .card .face.front { animation: pop .5s ease-out; }

/* ===== Friends: room screens and the match strip ===== */
.room { min-height: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 10px; padding: 14px; }
.room-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.room-head h2 { font-size: 22px; }
.steps { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.steps li { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 5px 4px; font-size: 13px; font-weight: 800; color: var(--muted); border-radius: 12px; border: 1px solid transparent; }
.steps li .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #f3e8cf; border: 1px solid var(--line); font-size: 12px; flex: none; }
.steps li[data-state="done"] .n { background: color-mix(in srgb, var(--select) 30%, var(--cream)); }
.steps li[aria-current="step"] { color: var(--ink); background: color-mix(in srgb, var(--select) 14%, var(--cream)); border-color: color-mix(in srgb, var(--select) 55%, white); }
.steps li[aria-current="step"] .n { background: var(--select); border-color: var(--select); color: #fff; }
.room-status { text-align: center; font-weight: 800; padding: 6px 10px; border-radius: 12px; background: #fffdf6; border: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.room-status[data-tone="go"] { background: color-mix(in srgb, var(--select) 14%, var(--cream)); }
.room-status[data-tone="warn"] { background: #fdeee8; border-color: var(--peach); }
.room-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 12px; align-content: start; }
.room-info { display: flex; flex-direction: column; gap: 8px; }
.room-code { font-size: 30px; font-weight: 900; letter-spacing: .14em; line-height: 1.1; }
.room-actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }
.room-actions button { flex: 1 1 140px; max-width: 260px; }
.players { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.players li { min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 4px 10px; border-radius: 12px; background: #fffdf6; border: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.players li.you { border-color: color-mix(in srgb, var(--select) 60%, white); }
.players li[data-state="left"], .players li[data-state="offline"] { color: var(--muted); }
.player-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; font-weight: 800; overflow: hidden; white-space: nowrap; }
.player-name .rank { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #f3e8cf; font-size: 13px; flex: none; }
.host-badge svg { width: 18px; height: 18px; color: var(--mustard); }
.you-badge { padding: 1px 8px; border-radius: 10px; background: var(--select); color: #fff; font-size: 12px; }
.player-status { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--muted); font-size: 14px; }
.player-status svg { width: 18px; height: 18px; }
.player-status .ok { color: var(--select); }
.coin-line { display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 800; color: var(--coin-ink); }
.coin-line svg { width: 20px; height: 20px; }
.race { display: flex; gap: 6px; min-width: 0; }
.countdown { position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; justify-items: center; gap: 10px; background: color-mix(in srgb, var(--paper) 94%, transparent); pointer-events: none; }
.countdown strong { font-size: 120px; line-height: 1; font-weight: 900; color: var(--primary); animation: count .9s ease-out infinite; }
@keyframes count { from { transform: scale(1.25); opacity: .4; } 30% { transform: scale(1); opacity: 1; } }

/* ===== Results ===== */
.results { min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 10px; padding: 16px; }
.results-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 2px; }
.results h2 { font-size: 26px; }
.total { font-size: 54px; font-weight: 900; line-height: 1; color: var(--primary); }
.stats { width: 100%; max-width: 560px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.stats span { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 12px; background: #fffdf6; border: 1px solid color-mix(in srgb, var(--line) 60%, transparent); font-size: 12px; font-weight: 700; color: var(--muted); }
.stats b { font-size: 20px; color: var(--ink); }
.stats .coin-stat b { color: var(--coin-ink); }
.new-finds { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.new-finds .pic { width: 34px; height: 34px; padding: 3px; border-radius: 8px; background: var(--cream); border: 1px solid var(--line); }
.actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; width: 100%; }
.actions button { flex: 1 1 140px; max-width: 240px; }
.results .players { width: 100%; max-width: 520px; text-align: left; }
.results .steps { width: 100%; }
.results .room-status { width: 100%; }

/* ===== Confirm: the one small modal (a yes/no before something is lost) ===== */
.confirm { padding: 0; border: 0; background: none; width: min(380px, calc(100vw - 32px)); max-width: none; color: var(--ink); overflow: visible; }
.confirm::backdrop { background: rgb(62 46 36 / .42); }
.confirm[open] { animation: confirm-in .16s ease-out; }
@keyframes confirm-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.confirm-card {
  display: flex; flex-direction: column; gap: 10px; padding: 20px;
  background: var(--cream); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 5px var(--ctl-shadow), 0 18px 40px rgb(62 46 36 / .22), inset 0 2px #fff9;
}
.confirm h2 { font-size: 21px; line-height: 1.2; }
.confirm-foot { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.confirm-foot button { flex: 1 1 120px; }

/* ===== Pages ===== */
.sheet-page {
  min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 12px;
  padding: 14px; background: var(--cream); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 4px var(--ctl-shadow), inset 0 2px #fff9;
}
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.dialog-head h2 { font-size: 22px; line-height: 1.2; min-width: 0; }
.dialog-head h2:focus { outline: none; }
.dialog-head h2:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sheet-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 12px; }
.sheet-foot { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }
.sheet-foot button { flex: 1 1 140px; max-width: 280px; }
.sheet-body h3 { font-size: 15px; font-weight: 800; }
.steps-list { padding-left: 22px; display: flex; flex-direction: column; gap: 4px; }
.help-step { flex-direction: row; align-items: flex-start; gap: 12px; }
.help-step .help-icon { width: 26px; height: 26px; flex: none; color: var(--primary); margin-top: 2px; }
.toggle-row { width: 100%; justify-content: flex-start; gap: 12px; min-height: 52px; text-align: left; }
.toggle-row .state { margin-left: auto; font-size: 14px; letter-spacing: .04em; color: var(--muted); }
.toggle-row[aria-pressed="true"] .state { color: var(--select); }
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; padding: 2px 2px 6px; }
.album-card { flex-direction: column; justify-content: flex-start; gap: 6px; height: 168px; padding: 12px 8px; text-align: center; white-space: normal; }
.album-card strong { font-size: 15px; line-height: 1.2; }
.album-card .line { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 22px; font-size: 13px; font-weight: 800; color: var(--muted); }
.album-card .line svg { width: 18px; height: 18px; }
.album-card.locked { color: var(--muted); }
.album-card.locked .emblem .pic { filter: grayscale(.85); opacity: .5; }
.lock-badge { display: none; position: absolute; right: -6px; bottom: -6px; width: 26px; height: 26px; border-radius: 50%; background: var(--cream); border: 1px solid var(--line); place-items: center; color: var(--muted); }
.lock-badge svg { width: 16px; height: 16px; }
.locked .lock-badge { display: grid; }
.legend-badge { position: absolute; left: -6px; top: -6px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--mustard); color: #fff; border: 1px solid #c29330; }
.legend-badge svg { width: 15px; height: 15px; }
.unlock-album { display: flex; align-items: center; gap: 14px; }
.unlock-album h3 { font-size: 20px; }
.price-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.price-strip div { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px; border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); border-radius: 14px; background: #fffdf6; font-size: 13px; color: var(--muted); font-weight: 700; }
.price-strip b { display: flex; align-items: center; gap: 5px; font-size: 20px; color: var(--coin-ink); }
.price-strip b svg { width: 20px; height: 20px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.friends-grid, .friends-side { display: flex; flex-direction: column; gap: 12px; }
.name-picks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.name-picks button { padding: 6px 4px; font-size: 15px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 800; }
.field input { font: inherit; font-weight: 700; min-height: var(--ctl); padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: #fffdf6; color: var(--ink); }
.field input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
#room-code { font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.error { color: #b3523e; font-weight: 800; min-height: 1.4em; }
.invite { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; justify-content: center; }
.qr { width: min(200px, 60vw); padding: 8px; background: #fff; border-radius: 12px; border: 1px solid var(--line); cursor: pointer; }
.qr svg { width: 100%; height: auto; }
.invite a { color: var(--primary); font-weight: 700; word-break: break-all; }

/* ===== Menu drawer ===== */
.menu-scrim { position: fixed; inset: 0; z-index: 40; background: #55463d4d; }
.menu-drawer {
  position: fixed; z-index: 41; top: 0; right: 0; bottom: 0; width: min(300px, 86vw);
  display: flex; flex-direction: column; gap: 8px;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) 14px;
  background: radial-gradient(#a389622e .7px, transparent .8px) 0 0 / 8px 8px, var(--cream);
  border-left: 2px solid #cbb48f; box-shadow: -12px 0 40px #55463d33;
  overflow-y: auto; overscroll-behavior: contain;
}
.menu-drawer:not([hidden]) { animation: menu-in .18s ease-out; }
@keyframes menu-in { from { transform: translateX(100%); } }
.menu-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 10px; margin-bottom: 4px; border-bottom: 1px solid #d5bfa0; }
.menu-head h2 { font-size: 20px; font-weight: 900; }
.menu-item { width: 100%; height: 48px; min-height: 48px; flex: none; justify-content: flex-start; gap: 12px; padding: 0 14px; text-align: left; }
.menu-item svg { color: var(--primary); }
.menu-back { margin-bottom: 6px; }
.menu-back span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

#toast { position: fixed; top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 60; max-width: 90%; padding: 10px 18px; border-radius: 12px; background: var(--ink); color: var(--cream); font-weight: 800; box-shadow: 0 4px 15px #0002; pointer-events: none; text-align: center; }
#toast:empty { display: none; }

/* ===== Short screens ===== */
@media (max-height: 690px) {
  .brand small, footer .tagline, .hero .eyebrow { display: none !important; }
}

/* ===== Phone portrait ===== */
@media (max-width: 700px) {
  .brand { font-size: 17px; }
  .brand svg { width: 38px; height: 38px; }
  .header-actions { gap: 8px; }
  footer { font-size: 12px; min-height: 24px; padding-top: 4px; }
  .home { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; align-items: stretch; }
  .hero h1 { font-size: 24px; }
  .launch { padding: 12px; gap: 10px; }
  .emblem { --size: 64px; }
  .room-body { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps li { flex-direction: column; gap: 2px; font-size: 12px; }
  .hud-score b { font-size: 22px; }
  .name-picks button { font-size: 14px; }
  .wide-only { display: none; }
  .narrow-only { display: inline; }
}

/* ===== Narrow portrait floor: the page may scroll rather than squeeze the board ===== */
@media (max-width: 380px) and (orientation: portrait) {
  html, body { height: auto; overflow-x: hidden; overflow-y: auto; }
  .shell { height: 100dvh; min-height: 540px; }
  .brand svg { width: 34px; height: 34px; }
  .brand { gap: 7px; font-size: 16px; }
  .coin-pill { padding: 0 10px 0 8px; font-size: 14px; }
  .hero h1 { font-size: 21px; }
  .start-actions { gap: 10px; }
  .hud { gap: 6px; }
  .clock { min-width: 56px; font-size: 16px; }
  .chip { padding: 0 8px; font-size: 12px; }
  .name-picks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .start-actions button > svg, #ready-peek > svg { display: none; }
  .peek-meter { width: 36px; }
  .feedback-row { gap: 8px; }
}

/* ===== Phone landscape: the HUD moves beside the board ===== */
@media (orientation: landscape) and (max-height: 600px) {
  .brand { font-size: 15px; }
  .brand svg { width: 34px; height: 34px; }
  footer { min-height: 22px; padding-top: 3px; font-size: 12px; }
  .home { grid-template-columns: minmax(0, 1fr) minmax(300px, 1fr); grid-template-rows: minmax(0, 1fr); align-items: center; }
  .steps li { flex-direction: row; gap: 5px; padding: 3px 4px; }
  .steps li .n { width: 20px; height: 20px; font-size: 11px; }
  .room-body { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); }
  .wide-only { display: inline; }
  .narrow-only { display: none; }
  .hero h1 { font-size: 20px; }
  .launch { padding: 10px 12px; gap: 8px; }
  .emblem { --size: 58px; }
  .album-pick h2 { font-size: 17px; }
  .home-stats b { font-size: 16px; }
  .play { grid-template-columns: 168px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 10px; }
  .play-side { grid-row: 1; grid-column: 1; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
  .play .hud { flex-direction: column; align-items: stretch; gap: 6px; }
  .play .hud-mid { flex-direction: column; align-items: flex-start; flex: none; }
  .play .hud-score { justify-content: flex-start; }
  .play .race { flex-direction: column; }
  .play .hud .icon-button { align-self: flex-start; }
  .play .feedback-row { flex-direction: column; align-items: stretch; justify-content: flex-end; margin-top: auto; text-align: left; }
  .play .board-wrap { grid-row: 1; grid-column: 2; }
  .play .clock-row { display: flex; gap: 8px; align-items: center; }
  .sheet-page { padding: 10px 12px; gap: 8px; }
  .dialog-head { padding-bottom: 6px; }
  .dialog-head h2 { font-size: 18px; }
  .room { padding: 10px 12px; gap: 6px; }
  .friends-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .friends-grid .emblem { --size: 48px; }
  .friends-grid .panel { padding: 8px 10px; }
  .room-head h2 { display: none; }
  .room-head { justify-content: stretch; }
  .room-head .steps { flex: 1; }
  .room-code { font-size: 24px; }
  .results { padding: 10px; gap: 6px; }
  .results h2 { font-size: 20px; }
  .total { font-size: 40px; }
  .stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stats span { padding: 4px; }
  .stats b { font-size: 16px; }
  .countdown strong { font-size: 90px; }
}
.play-side { display: contents; }
.clock-row { display: contents; }
@media (orientation: landscape) and (max-height: 600px) { .play-side, .play .clock-row { display: flex; } }

/* ===== Desktop: framed board on a deeper paper table ===== */
@media (min-width: 701px) and (min-height: 581px) {
  body { display: grid; place-items: center; padding: 16px;
    background-color: #e6d6b8;
    background-image: radial-gradient(#8f714a2e .9px, transparent .9px), linear-gradient(#ecdfc6, #dfcca9);
    background-size: 9px 9px, 100% 100%; }
  .shell { position: relative; width: min(980px, 100%); height: min(720px, calc(100dvh - 32px));
    background: var(--paper) radial-gradient(#a3896220 .8px, transparent .8px) 0 0 / 8px 8px;
    border: 3px solid #c3a779; outline: 2px solid #fff9ec; outline-offset: -9px; border-radius: 30px;
    box-shadow: 0 10px 0 #b89a70, 0 26px 60px #55463d33, inset 0 2px #fffc; }
  .shell::before, .shell::after { content: ""; position: absolute; top: 12px; width: 8px; height: 8px; border-radius: 50%; background: #b59a73; box-shadow: inset 0 1px 2px #0003; }
  .shell::before { left: 12px; } .shell::after { right: 12px; }
  footer .tagline { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ===== The lane (home) ===== */
.lane { min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: var(--gap); }
.lane-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); align-items: center; gap: 12px; padding: 10px 16px; border-radius: 20px; background: linear-gradient(135deg, #fde4e6, #f6ecd7 55%, #e6efdc); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); min-height: 0; overflow: hidden; }
.lane-hero h1 { font-size: clamp(24px, 3.6vw, 36px); line-height: 1.05; font-weight: 900; }
.lane-hero h1 em { font-style: normal; color: var(--primary); }
.lane-hero p { margin-top: 6px; font-weight: 700; color: var(--muted); }
.lane-cast { width: 100%; height: 100%; max-height: 210px; min-height: 0; object-fit: contain; }
.houses { min-height: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
button.house-card { min-height: 0; height: 100%; flex-direction: column; justify-content: center; gap: 4px; padding: 10px 8px; text-align: center; white-space: normal; position: relative; }
.house-card .friend-art { height: clamp(56px, 13vh, 120px); }
.house-card strong { font-size: 15px; line-height: 1.15; }
.house-card .line { font-size: 13px; font-weight: 700; color: var(--muted); }
.house-card .next { font-size: 12px; font-weight: 700; color: var(--select); display: flex; align-items: center; gap: 4px; }
.house-card .next svg { width: 14px; height: 14px; }
.house-card .hungry-badge, .friend-chip .hungry-badge { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #fdeee8; border: 1px solid var(--peach); color: #b3523e; }
.hungry-badge svg { width: 16px; height: 16px; }
.house-card .pair { display: flex; justify-content: center; align-items: flex-end; }
.house-card .pair .friend-art + .friend-art { margin-left: -14%; height: clamp(46px, 10vh, 96px); }
.friends-strip { display: flex; align-items: center; gap: 10px; min-width: 0; }
.friends-strip .friend-row { flex: 1; min-width: 0; display: flex; gap: 8px; overflow: hidden; }
.friends-strip > button { min-width: var(--ctl); flex: none; }
button.friend-chip { position: relative; flex: 1 1 0; min-width: 0; padding: 2px 6px; gap: 4px; justify-content: center; }
.friend-chip .friend-art { height: 38px; }
.friend-chip .mini-bars { display: flex; flex-direction: column; gap: 3px; width: 34px; }
.mini-bars i { display: block; height: 5px; border-radius: 3px; background: #ebdfc6; overflow: hidden; }
.mini-bars i b { display: block; height: 100%; border-radius: 3px; }
.mini-bars .hunger b, .need.hunger i { background: var(--mustard); }
.mini-bars .mood b, .need.mood i { background: var(--berry); }
.friend-art { display: block; width: auto; max-width: 100%; object-fit: contain; flex: none; }

/* ===== A house's home ===== */
.house-home { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, .95fr); gap: var(--gap); align-items: center; }
.house-hero { min-height: 0; height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) auto; justify-items: center; align-items: end; gap: 8px; text-align: center; }
.house-hero .friend-art { height: 100%; max-height: 300px; min-height: 0; }
.house-hero .pair { display: flex; align-items: flex-end; justify-content: center; height: 100%; min-height: 0; max-height: 300px; }
.house-hero .pair .friend-art { height: 100%; }
.house-hero .pair .friend-art + .friend-art { height: 82%; margin-left: -8%; }
.house-hero h1 { font-size: clamp(22px, 3vw, 30px); line-height: 1.08; font-weight: 900; }
.house-hero h1 em { font-style: normal; color: var(--primary); }
.milestone { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 800; color: var(--select); }
.milestone span { display: flex; align-items: center; gap: 6px; }
.milestone svg { width: 16px; height: 16px; flex: none; }
.unlock-line { display: flex; align-items: center; gap: 6px; font-weight: 800; color: var(--select); }
.unlock-line svg { width: 18px; height: 18px; }
.house-picks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.house-picks button { justify-content: flex-start; padding: 4px 10px; font-size: 14px; white-space: normal; text-align: left; }
.house-picks .pick-art { height: 32px; }

/* ===== Visit friends (pet care) ===== */
.care-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.care-card { display: grid; grid-template-columns: 96px minmax(0, 1fr); grid-template-rows: auto auto auto; gap: 6px 12px; align-items: center; padding: 10px 12px; border-radius: 16px; background: #fffdf6; border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.care-card .friend-art { grid-row: 1 / 3; height: 96px; justify-self: center; }
.care-card .care-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.care-card .care-actions button { padding: 4px 6px; font-size: 13px; gap: 4px; flex-direction: column; min-height: 52px; line-height: 1.1; white-space: normal; }
.care-card .care-actions button > svg { width: 18px; height: 18px; }
.care-card .price { display: inline-flex; align-items: center; gap: 2px; color: var(--coin-ink); }
.care-card .price svg { width: 14px; height: 14px; }
.care-name { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.care-name b { font-size: 17px; }
.hearts { display: flex; gap: 1px; }
.hearts svg { width: 16px; height: 16px; color: #d9c4a6; }
.needs { display: flex; flex-direction: column; gap: 5px; }
.need { display: grid; grid-template-columns: 54px minmax(0, 1fr); align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
.need span { height: 8px; border-radius: 4px; background: #ebdfc6; overflow: hidden; }
.need i { display: block; height: 100%; border-radius: 4px; transition: width .4s; }
.care-card.eating .friend-art { animation: nibble .5s ease-in-out 2; }
@keyframes nibble { 50% { transform: translateY(-4px) rotate(-3deg); } }
.purse-line { display: flex; align-items: center; gap: 6px; font-weight: 800; color: var(--coin-ink); }
.purse-line svg { width: 20px; height: 20px; }

@media (max-width: 700px) {
  .lane { grid-template-rows: auto minmax(0, 1fr) auto; }
  .lane-hero { grid-template-columns: minmax(0, 1fr); text-align: center; padding: 8px 10px; }
  .lane-cast { max-height: 120px; }
  .houses { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .house-home { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; align-items: stretch; }
  .house-hero .friend-art, .house-hero .pair { max-height: 200px; }
  .friend-chip .mini-bars { display: none; }
  .friends-strip > button { padding: 0 10px; }
}
@media (max-width: 380px) and (orientation: portrait) {
  .lane-cast { max-height: 84px; }
  .lane-hero p { display: none; }
  #visit-friends { display: none; }
  .friends-strip .friend-row { gap: 6px; }
  .house-card .next { display: none; }
  .friend-chip .friend-art { height: 30px; }
}
@media (orientation: landscape) and (max-height: 600px) {
  /* Landscape phones hide the footer to give the boards their height (casual-game-shell §1); Update stays in the header. */
  footer { display: none; }
  .shell { grid-template-rows: auto minmax(0, 1fr); }
  .lane { grid-template-rows: auto minmax(0, 1fr) auto; gap: 6px; }
  .lane-hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); padding: 4px 12px; text-align: left; }
  .lane-hero h1 { font-size: 22px; }
  .lane-hero p { display: none; }
  .lane-cast { max-height: 74px; }
  .houses { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .house-card .friend-art { height: 56px; }
  .house-card .next { display: none; }
  .friend-chip .friend-art { height: 30px; }
  .friend-chip .mini-bars { display: flex; }
  .house-home { grid-template-columns: minmax(0, 1fr) minmax(300px, 1fr); grid-template-rows: minmax(0, 1fr); align-items: center; }
  .house-hero h1 { font-size: 18px; }
  .care-card { grid-template-columns: 72px minmax(0, 1fr); }
  .care-card .friend-art { height: 72px; }
}

/* Miso's Bookshop in the lane: Miso's hex letter board (from Bookworm dist/style.css), tray, dictionary and shelves, scoped. */
.books-play { --hex-width: 18.1818%; --hex-height: 13.333%; min-height: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto; gap: 8px; }
.house-books .level-bar { height: 6px; border-radius: 3px; background: #ebdfc6; overflow: hidden; }
.house-books .level-bar i { display: block; height: 100%; width: 0; background: #aab397; border-radius: 3px; transition: width .3s; }
.house-books .board-slot { position: relative; min-height: 0; min-width: 0; display: flex; align-items: center; justify-content: center; container-type: size; }
.house-books .board-wrap { position: relative; background: #efe3d3; border: 1px solid #e3d2bf; border-radius: 14px; padding: 8px; box-shadow: inset 0 2px 8px #8c6f5310; height: min(100cqh, calc((100cqw - 16px) * 6.495 / 5.5 + 16px)); aspect-ratio: 5.5 / 6.495; box-sizing: border-box; }
.house-books .books-board { position: relative; width: 100%; height: 100%; user-select: none; touch-action: none; isolation: isolate; }
.house-books .tile { position: absolute; width: var(--hex-width); height: var(--hex-height); min-height: 0; padding: 0; background: #c7ac8f; clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); border: 0; border-radius: 0; box-shadow: none; transform: scale(.955); transition: transform .16s; color: #6b5548; outline: none; touch-action: none; display: flex; align-items: center; justify-content: center; }
.house-books .tile::before { content: ''; position: absolute; inset: 1.5px; clip-path: inherit; background: #fff3da; z-index: -1; }
.house-books .tile:disabled { opacity: 1; }
.house-books .tile .letter { font-weight: 900; font-size: clamp(16px, 6.4cqh, 30px); line-height: 1; position: relative; z-index: 2; padding-bottom: 2px; }
.house-books .tile .letter.qu { font-size: clamp(13px, 4.6cqh, 22px); }
.house-books .tile .tile-value { position: absolute; right: 29%; bottom: 13%; font-size: 8px; font-weight: 700; opacity: .6; }
.house-books .tile .tile-mark { position: absolute; top: 10%; left: 45%; font-size: 8px; font-weight: 800; line-height: 1; opacity: .75; }
@media (hover: hover) { .house-books .tile:not(:disabled):hover { transform: scale(1); filter: none; } }
.house-books .tile:focus-visible { background: var(--focus); transform: scale(1); }
.house-books .tile:focus-visible::before { background: #eef2e9; }
.house-books .tile.selected { background: #977471; transform: scale(.99); z-index: 3; color: #654442; }
.house-books .tile.selected::before { background: #edc6bb; }
.house-books .tile.hinted { background: #a385af; }
.house-books .tile.hinted::before { background: #e1d0e6; }
.house-books .tile.green { background: #829a71; } .house-books .tile.green::before { background: #d4e2b9; }
.house-books .tile.gold { background: #ba954e; } .house-books .tile.gold::before { background: #f2d99a; }
.house-books .tile.sapphire { background: #8099b4; } .house-books .tile.sapphire::before { background: #c4daea; }
.house-books .tile.diamond { background: #a195b3; } .house-books .tile.diamond::before { background: #e0d9ef; }
.house-books .tile.fire { background: #b05e50; color: #8d3c30; } .house-books .tile.fire::before { background: #edb39a; }
.house-books .tile.fire .tile-mark { font-size: 12px; top: 6%; left: 42%; color: #ad4632; }
.house-books .tile.fire.danger::before { background: #ee907d; }
.house-books .tile.fire.danger .letter { animation: ember 1.4s ease-in-out infinite; }
@keyframes ember { 50% { opacity: .6; } }
.house-books .connections { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; overflow: visible; }
.house-books .connections polyline { fill: none; stroke: #9c6663; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; opacity: .48; }
.house-books .round-over { position: absolute; inset: 0; z-index: 6; display: grid; place-content: center; justify-items: center; gap: 8px; text-align: center; background: color-mix(in srgb, var(--paper) 88%, transparent); border-radius: 14px; }
.house-books .word-tray { display: flex; gap: 10px; align-items: center; min-width: 0; }
.house-books .word-tray > div { flex: 1; min-width: 0; }
.house-books .word-tray strong { display: block; font-size: 22px; font-weight: 900; letter-spacing: .03em; overflow-wrap: anywhere; line-height: 1.2; }
.house-books .word-tray.empty strong { color: #ad978d; }
.house-books .word-tray.bonus strong { color: var(--primary); }
.house-books #word-detail { display: block; font-size: 12px; font-weight: 700; color: var(--muted); min-height: 1.3em; }
.house-books #word-detail.warning { color: #b3523e; }
.house-books #collect { min-width: 112px; }
/* Hint and Scramble sit right under the word they help with, apart from the header and the play bar. */
.house-books .books-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.house-books .books-foot .feedback { flex: 1 0 100%; min-height: 1.4em; font-size: 13px; font-weight: 700; color: var(--muted); }
.house-books .feedback.success { color: var(--select); } .house-books .feedback.error { color: #b3523e; }
.house-books #fire-warning { font-size: 13px; font-weight: 800; }
.house-books #fire-warning.warm { color: #b0703a; } .house-books #fire-warning.danger { color: #b3523e; }
.house-books .board-actions { display: flex; gap: 8px; flex: none; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-row button { padding: 4px 10px; font-size: 14px; min-width: var(--ctl); }
.house-books .dict-words { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
.house-books .dict-word { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 4px 10px; border-radius: 10px; font-weight: 800; font-size: 14px; overflow: hidden; }
.house-books span.dict-word { background: color-mix(in srgb, var(--select) 14%, var(--cream)); border: 1px solid color-mix(in srgb, var(--select) 50%, white); }
.house-books button.dict-word { letter-spacing: -.05em; color: var(--muted); }
.house-books .word-mark { font-size: 11px; letter-spacing: 0; color: var(--muted); }
.house-books .page-count { align-self: center; font-weight: 700; color: var(--muted); font-size: 13px; }
.house-books .shop-books { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.house-books .shop-book { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 14px; background: #fffdf6; border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.house-books .book-cover { min-height: 84px; display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 10px 12px; border-radius: 6px 12px 12px 6px; background: linear-gradient(90deg, color-mix(in srgb, var(--cover) 70%, #6b5548) 0 7px, var(--cover) 7px); box-shadow: 0 3px 0 color-mix(in srgb, var(--cover) 60%, #6b5548); }
.house-books .book-cover h3 { font-size: 15px; line-height: 1.15; }
.house-books .book-cover span { font-size: 12px; font-weight: 600; color: #6b5548; }
.house-books .shop-book p { font-size: 12px; }
@media (min-width: 701px) and (min-height: 581px) {
  .books-play { grid-template-columns: minmax(0, 1fr) minmax(280px, 340px); grid-template-rows: auto auto minmax(0, 1fr) auto; column-gap: var(--gap); }
  .books-play > .hud, .books-play > .level-bar, .books-play > .timebar { grid-column: 2; }
  .books-play > .board-slot { grid-column: 1; grid-row: 1 / -1; }
  .books-play > .word-tray { grid-column: 2; grid-row: 3; align-self: end; flex-wrap: wrap; }
  .books-play > .books-foot { grid-column: 2; grid-row: 4; }
}
@media (orientation: landscape) and (max-height: 600px) {
  .books-play { grid-template-columns: minmax(0, 1fr) minmax(250px, 300px); grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 6px 10px; }
  .books-play > .hud, .books-play > .level-bar, .books-play > .timebar { grid-column: 2; }
  .books-play > .board-slot { grid-column: 1; grid-row: 1 / -1; }
  .books-play > .word-tray { grid-column: 2; grid-row: 3; align-self: end; flex-wrap: wrap; }
  .books-play > .books-foot { grid-column: 2; grid-row: 4; }
  .house-books .word-tray strong { font-size: 18px; }
  .house-books .books-foot .feedback { font-size: 12px; }
}
@media (max-width: 700px) {
  .house-books .word-tray strong { font-size: 18px; }
  .house-books #collect { min-width: 96px; padding: 8px 10px; }
  .house-books .books-foot .feedback { font-size: 12px; }
}
.house-books #hint-count { margin-left: 2px; color: var(--muted); }
/* Narrow-portrait floor: the Bookshop board keeps readable tiles and the page scrolls instead (casual-game-shell §1). */
@media (max-width: 380px) and (orientation: portrait) {
  body[data-screen="books-play"] .shell { height: auto; }
  body[data-screen="books-play"] .books-play .board-slot { height: 340px; flex: none; }
}
/* Phones: the board's panel fills the width of the screen; the hex grid keeps its proportions, centred inside
   (owner, 2026-10-22: "keep the grid but stretch the panel container to match the device width"). */
@media (max-width: 700px), (orientation: landscape) and (max-height: 600px) {
  .house-books .board-wrap { width: 100%; height: 100%; aspect-ratio: auto; display: grid; place-items: center; container-type: size; }
  .house-books .books-board { width: auto; height: min(100cqh, calc(100cqw * 6.495 / 5.5)); aspect-ratio: 5.5 / 6.495; }
}
/* Landscape phones: the Bookshop home card drops its mode note (the mode buttons carry titles) so every row fits. */
@media (orientation: landscape) and (max-height: 600px) {
  .house-books .launch > p.muted { display: none; }
}

/* Pig & Duck's Clubhouse: Brain Club's puzzle styles, scoped to the house (from BrainClub public/style.css). */
.house-club .puzzle {text-align:center;display:grid;grid-template-rows:auto minmax(0,1fr) 24px;gap:10px}
.house-club .puzzle h2 {font-size:22px;margin:3px 0 5px}
.house-club .puzzle-note {color:var(--muted);font-size:14px;margin:0}
.house-club .challenge-body {min-height:0;display:grid;grid-template-rows:minmax(0,1fr) auto;gap:12px;align-items:center}
.house-club .scene {min-height:0;display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:10px;height:100%;overflow:hidden}
.house-club .scene:empty {display:none}
.house-club .challenge-body:has(.scene:empty) {grid-template-rows:minmax(0,1fr)}
.house-club .response {min-height:0;display:grid;gap:10px;justify-items:center}
.house-club .answers {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;width:100%;max-width:600px;padding-bottom:4px}
.house-club .answers.three {grid-template-columns:repeat(3,minmax(0,1fr))}
.house-club .answer {font-size:28px;min-height:65px;min-width:0;padding:8px;position:relative;line-height:1.1}
.house-club .answer .object-icon, .house-club .answer .arrow-icon, .house-club .answer .rotation-icon {width:44px;height:44px}
.house-club .answer:has(.object-icon) {display:flex;gap:4px;flex-direction:column;font-size:13px}
.house-club .tile-grid {grid-template-columns:repeat(3,1fr);width:max-content;max-width:100%;gap:7px}
.house-club .tile-grid .answer {width:64px;min-height:58px;padding:5px}
.house-club .prompt {font-size:clamp(26px,5vw,62px);font-weight:900;line-height:1.15;letter-spacing:.01em;font-variant-numeric:tabular-nums}
.house-club .feedback {height:24px;font-size:14px;line-height:24px;font-weight:800;color:var(--select);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.house-club .feedback.wrong {color:#a25345}
.house-club .selection-tray {display:flex;align-items:center;justify-content:center;gap:6px;width:100%}
.house-club .selection-tray>span {display:grid;place-items:center;width:40px;height:40px;background:#ede3cf;border-radius:8px;font-size:20px;font-weight:800}
.house-club .selection-tray .object-icon {width:32px;height:32px}
.house-club .selection-tray .undo {min-height:44px;padding:6px 12px;font-size:13px}
.house-club .scene:has(.selection-tray) {align-content:center}
.house-club .scene-label {display:flex;align-items:center;justify-content:center;gap:18px;font-size:19px}
.house-club .scene-label .object-icon, .house-club .scene-label .rotation-icon {width:65px;height:65px}
.house-club .object-icon {width:50px;height:50px;flex-shrink:0}
.house-club .object-icon.silhouette * {fill:#574335!important;stroke:#574335!important}
.house-club .object-row {display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:12px;max-width:100%}
.house-club .object-row>span {display:grid;justify-items:center}
.house-club .object-row.many {display:grid;grid-template-columns:repeat(6,1fr);gap:10px}
.house-club .object-row.many .object-icon {width:42px;height:42px}
.house-club .memory-grid, .house-club .step-grid {display:grid;grid-template-columns:repeat(3,44px);gap:4px}
.house-club .memory-cell {width:44px;height:44px;border:1px solid #ceb795;border-radius:7px;background:#f1e5cf;display:grid;place-items:center}
.house-club .memory-cell .object-icon {width:36px;height:36px}
.house-club .step-grid {grid-template-columns:repeat(2,50px);gap:7px}
.house-club .step-cell {display:grid;place-items:center;width:50px;height:50px;border:2px solid #c6b08c;background:#eee2c9;border-radius:12px;font-size:20px;font-weight:800}
.house-club .step-cell.lit {background:#91ae78;border-color:#536e45;box-shadow:inset 0 0 0 3px #f7eccc}
.house-club .preview-note {width:100%;font-size:13px;color:var(--muted)}
.house-club .cup-stage {width:252px;height:100px;position:relative}
.house-club .moving-cup {position:absolute;left:0;top:0;width:84px;height:96px;display:grid;place-items:center;transition:transform .65s ease-in-out}
.house-club .moving-cup>.object-icon {width:65px;height:65px}
.house-club .cup-acorn {position:absolute;bottom:0;left:30px}
.house-club .cup-acorn .object-icon {width:25px;height:25px}
.house-club .arrow-scene {display:grid;width:180px;height:110px;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr)}
.house-club .arrow-scene .arrow-icon {grid-column:var(--arrow-col);grid-row:var(--arrow-row);width:36px;height:36px}
.house-club .overlap-scene {max-width:100%;width:260px;height:125px}
.house-club .basket-row {display:grid;grid-template-columns:repeat(4,1fr);gap:10px;width:100%}
.house-club .basket {border-bottom:5px solid #bd9b6f;border-radius:8px;background:#f0e4ca;padding:6px;font-size:18px}
.house-club .basket small {display:block;font-size:12px}
.house-club .basket>div {display:grid;justify-items:center}
.house-club .basket .object-icon {width:35px;height:35px}
.house-club .fraction {display:grid;gap:8px;width:100%}
.house-club .fraction-bar {height:12px;display:flex;border:1px solid #8d9c72}
.house-club .fraction-bar i {flex:1;border-right:1px solid #8d9c72}
.house-club .fraction-bar i.filled {background:#8d9c72}
.house-club .scale-scene {display:flex;align-items:center;gap:10px;font-size:25px;font-weight:800}
.house-club .scale-scene>svg {width:90px;height:75px}
.house-club .scale-pan {display:flex;align-items:center;gap:6px}
.house-club .maze-grid {display:grid;grid-template-columns:repeat(4,44px);grid-template-rows:repeat(4,44px);gap:0}
.house-club .maze-cell {min-height:44px;min-width:44px;width:44px;height:44px;padding:2px;border-style:solid;border-radius:0;background:#f6eddb;box-shadow:none}
.house-club .maze-cell:disabled {opacity:1}
.house-club .maze-cell.visited {background:#e0e8cc}
.house-club .maze-cell .object-icon {width:34px;height:34px}
.house-club .pond {width:28px;height:22px;border-radius:50%;background:#a7c8ca;border:3px solid #87b2b4}
.house-club .round-summary {display:grid;gap:4px;font-size:13px;margin:10px 0}
.house-club .round-summary span {display:flex;justify-content:space-between;gap:12px}
@media(max-width:700px) {
.house-club .puzzle {gap:7px}
.house-club .puzzle h2 {font-size:20px}
.house-club .puzzle-note {font-size:13px}
.house-club .answers {gap:8px}
.house-club .answer {min-height:56px;font-size:24px;padding:5px}
.house-club .answer .object-icon, .house-club .answer .arrow-icon, .house-club .answer .rotation-icon {width:35px;height:35px}
.house-club .tile-grid .answer {width:58px;min-height:52px}
.house-club .prompt {font-size:31px}
.house-club .basket-row {gap:5px}
.house-club .basket {font-size:15px;padding:4px}
.house-club .scene-label {font-size:16px;gap:10px}
.house-club .object-row {gap:6px}
.house-club .object-row .object-icon {width:42px;height:42px}
.house-club .object-row.many {gap:6px}
.house-club .object-row.many .object-icon {width:34px;height:34px}
.house-club .feedback {font-size:12px}
.house-club .scale-scene {font-size:21px;gap:6px}
.house-club .scale-pan .object-icon {width:35px;height:35px}
.house-club .scale-scene>svg {width:60px}
}
@media(orientation:landscape) and (max-height:600px) {
.house-club .puzzle {gap:5px;grid-template-rows:auto minmax(0,1fr) 20px}
.house-club .puzzle h2 {font-size:18px;margin:0 0 2px}
.house-club .puzzle-note {font-size:12px}
.house-club .puzzle .eyebrow {font-size:12px}
.house-club .challenge-body {grid-template-columns:minmax(0,1fr) minmax(0,1fr);grid-template-rows:minmax(0,1fr);gap:12px}
.house-club .challenge-body:has(.scene:empty) {grid-template-columns:minmax(0,1fr)}
.house-club .answers {gap:7px;grid-template-columns:repeat(2,minmax(0,1fr));padding:0}
.house-club .answers.three {grid-template-columns:repeat(3,minmax(0,1fr))}
.house-club .answer {font-size:23px;min-height:48px;padding:4px}
.house-club .answer .object-icon, .house-club .answer .arrow-icon, .house-club .answer .rotation-icon {width:34px;height:34px}
.house-club .tile-grid {grid-template-columns:repeat(3,1fr)}
.house-club .tile-grid .answer {width:48px;min-height:44px;height:44px}
.house-club .prompt {font-size:30px}
.house-club .feedback {height:20px;font-size:12px;line-height:20px}
.house-club .object-row {gap:5px;flex-wrap:wrap}
.house-club .object-row .object-icon {width:38px;height:38px}
.house-club .object-row.many {grid-template-columns:repeat(6,1fr);gap:3px}
.house-club .object-row.many .object-icon {width:27px;height:27px}
.house-club .basket-row {grid-template-columns:repeat(2,1fr);gap:5px}
.house-club .basket>div {display:flex;justify-content:center;gap:5px}
.house-club .basket .object-icon {width:25px;height:25px}
.house-club .basket {font-size:15px;padding:3px}
.house-club .scene-label {font-size:15px;gap:9px}
.house-club .scene-label .rotation-icon {width:52px;height:52px}
.house-club .selection-tray {gap:4px}
.house-club .selection-tray>span {width:30px;height:30px;font-size:16px}
.house-club .selection-tray .undo {padding:5px 8px}
.house-club .selection-tray .object-icon {width:26px;height:26px}
.house-club .scene:has(.step-grid), .house-club .scene:has(.cup-stage) {align-content:center;gap:3px}
.house-club .step-cell {height:44px;width:44px}
.house-club .step-grid {grid-template-columns:repeat(2,44px);gap:5px}
.house-club .cup-stage {height:75px}
.house-club .moving-cup {height:73px}
.house-club .moving-cup>.object-icon {height:52px;width:52px}
.house-club .preview-note {font-size:12px}
.house-club .overlap-scene {height:100px}
.house-club .puzzle:has(.board-layout) {grid-template-columns:minmax(140px,.8fr) minmax(0,1.2fr);grid-template-rows:minmax(0,1fr) 20px}
.house-club .puzzle:has(.board-layout) .puzzle-heading {grid-column:1;grid-row:1;align-self:center}
.house-club .puzzle:has(.board-layout) .challenge-body {grid-column:2;grid-row:1/3;grid-template-columns:1fr;grid-template-rows:minmax(0,1fr) auto;gap:5px}
.house-club .puzzle:has(.board-layout) .challenge-body:has(.scene:empty) {grid-template-rows:1fr}
.house-club .puzzle:has(.board-layout) .feedback {grid-column:1;grid-row:2}
.house-club .board-layout .memory-grid {grid-template-columns:repeat(3,40px);gap:3px}
.house-club .board-layout .memory-cell {width:40px;height:40px}
.house-club .board-layout .memory-cell .object-icon {width:32px;height:32px}
.house-club .board-layout .scene-label .object-icon {width:34px;height:34px}
.house-club .board-layout .scene-label {font-size:14px}
.house-club .round-summary {display:grid;grid-template-columns:1fr 1fr;gap:3px 18px;font-size:12px;margin:6px 0}
}
.house-club .answers, .house-club .tile-grid {gap:12px}
.house-club .selection-tray .undo {margin-left:8px}
.house-club .response {gap:14px}
.house-club .object-row.change-preview {display:grid;grid-template-columns:repeat(3,64px);gap:12px}
.house-club .change-preview>span {height:58px;border:1px solid #ceb795;border-radius:12px;background:#f1e5cf;place-items:center}
@media(max-width:700px) {
.house-club .object-row.change-preview {grid-template-columns:repeat(3,58px)}
.house-club .change-preview>span {height:52px}
}
@media(orientation:landscape) and (max-height:600px) {
.house-club .object-row.change-preview {grid-template-columns:repeat(3,48px)}
.house-club .change-preview>span {height:44px}
}
.house-club .puzzle-heading .puzzle-note {margin-left:auto;margin-right:auto}
/* The Clubhouse in the lane shell. */
.club-play { min-height: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr); gap: 8px; }
.house-club .puzzle { min-height: 0; padding: 12px; }
.club-emblem { position: relative; width: 64px; height: 64px; flex: none; display: grid; place-items: center; border-radius: 16px; background: #f6e3dc; border: 1px solid color-mix(in srgb, var(--line) 80%, transparent); color: var(--primary); }
.club-emblem .club-glyph { width: 34px; height: 34px; }
.album-card .club-emblem { width: 58px; height: 58px; }
.album-card.locked .club-emblem { color: var(--muted); background: #efe7da; }
.house-club .album-card .line { font-weight: 600; font-size: 12px; line-height: 1.25; }
.category-rail { display: flex; gap: 8px; flex-wrap: wrap; }
.category-rail button { padding: 6px 12px; gap: 6px; }
.category-rail .club-glyph { width: 18px; height: 18px; }
@media (orientation: landscape) and (max-height: 600px) {
  .club-play { gap: 5px; }
  .house-club .puzzle { padding: 8px 10px; }
}

/* Buddy's Number Nook in the lane: Number Nook's board, tiles and hex grid (from NumberNook src/style.css), scoped. */
.nook-play { min-height: 0; display: grid; grid-template-columns: minmax(250px, 300px) minmax(0, 1fr); gap: var(--gap); }
.house-nook .nook-side { min-height: 0; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; overscroll-behavior: contain; }
.house-nook .hud { flex-wrap: wrap; }
.house-nook .target-card { position: relative; text-align: center; display: flex; flex-direction: column; align-items: center; padding: 12px; background: linear-gradient(140deg, #f5e3bf, #f4e8d1); border: 3px double #bc9c72; border-radius: 14px; box-shadow: 0 4px 0 #e2d0b7, inset 0 0 0 6px #fff5df88; }
.house-nook #target { font-size: 64px; line-height: 1.05; font-weight: 900; color: #84613f; letter-spacing: -.03em; }
.house-nook .turn-label { font-size: 12px; font-weight: 700; color: var(--muted); }
.house-nook .tray { display: flex; align-items: center; gap: 8px; min-width: 0; }
.house-nook .equation-wrap { flex: 1; min-width: 0; }
.house-nook #equation { font-size: 18px; font-weight: 800; line-height: 1.35; overflow-wrap: anywhere; max-height: 2.8em; overflow-y: auto; }
.house-nook #match { min-width: 104px; }
.house-nook .feedback { min-height: 2.6em; font-size: 14px; font-weight: 700; color: var(--muted); }
.house-nook .board-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: auto; }
.house-nook .board-slot { min-height: 0; min-width: 0; display: flex; align-items: center; justify-content: center; container-type: size; }
.house-nook .board-frame { height: min(100cqh, 100cqw); aspect-ratio: 1; position: relative; background: #e9dcc7; padding: 9px; border-radius: 14px; box-shadow: inset 0 2px 6px #8c6f5320, 0 2px 0 #d3bea3; }
.house-nook .board-square { position: relative; width: 100%; height: 100%; }
.house-nook #nook-board { display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(5, 1fr); gap: 7px; height: 100%; user-select: none; touch-action: none; }
.house-nook .tile { position: relative; min-width: 0; min-height: 0; width: 100%; height: 100%; padding: 0; font-size: clamp(20px, 6cqw, 34px); font-weight: 900; border-radius: 9px; background: linear-gradient(145deg, #fff8e5, #f4e3bc); color: #745b40; border: 1px solid #c8af83; box-shadow: inset 0 0 0 2px #fff9e48c, 0 3px 0 #c1a580; touch-action: none; }
.house-nook .tile:active:not(:disabled) { transform: none; }
.house-nook .tile:disabled { opacity: 1; }
@media (hover: hover) { .house-nook .tile:not(:disabled):hover { transform: none; filter: brightness(1.03); } }
.house-nook .tile.negative { background: linear-gradient(145deg, #f7e3dd, #ebccc2); color: #965d59; border-color: #c89e91; box-shadow: inset 0 0 0 2px #fff0e875, 0 3px 0 #bd9485; }
.house-nook .tile.selected { background: linear-gradient(#dce9c7, #bccc9e); border-color: #84966f; color: #455739; box-shadow: inset 0 0 0 2px #e9f0dc, 0 2px 0 #7c8c68; transform: translateY(1px); }
.house-nook .tile.hinted { outline: 3px solid #a389b1; outline-offset: -4px; }
.house-nook .tile .order { position: absolute; top: 3px; right: 5px; font-size: 10px; font-weight: 800; color: #637354; }
.house-nook .connections { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; fill: none; stroke: #657c54; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; opacity: .3; }
.house-nook .tile.bonus-2 { border-color: #a5823e; box-shadow: inset 0 0 0 2px #dfbf73, 0 3px 0 #aa8c53; }
.house-nook .tile.bonus-3 { border-color: #8a709d; box-shadow: inset 0 0 0 2px #b8a2c9, 0 3px 0 #8a709d; }
.house-nook .bonus-badge { position: absolute; left: 3px; top: 3px; font-size: 10px; font-weight: 900; line-height: 1; background: #b6954e; color: #fffaf0; border-radius: 3px; padding: 3px; pointer-events: none; }
.house-nook .bonus-3 .bonus-badge { background: #967aab; }
.house-nook .tile.selected.bonus-2, .house-nook .tile.selected.bonus-3 { box-shadow: inset 0 0 0 2px #e9f0dc, 0 2px 0 #7c8c68; }
.house-nook #nook-board.hex-board { display: block; position: relative; }
.house-nook .hex-board .tile { position: absolute; left: calc(8.675% + var(--col) * 13.05%); top: calc(1.025% + var(--row) * 15.069% + var(--offset) * 7.5345%); width: 17.4%; height: 15.069%; clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); border: 0; border-radius: 0; background: #c8af83; box-shadow: none; isolation: isolate; font-size: clamp(16px, 4.6cqw, 28px); }
.house-nook .hex-board .tile::before { content: ''; position: absolute; inset: 2px; clip-path: inherit; background: linear-gradient(145deg, #fff8e5, #f4e3bc); z-index: -1; }
.house-nook .hex-board .tile.negative { background: #b78a7b; }
.house-nook .hex-board .tile.negative::before { background: linear-gradient(145deg, #f7e3dd, #ebccc2); }
.house-nook .hex-board .tile.bonus-2 { background: #a5823e; }
.house-nook .hex-board .tile.bonus-2::before { background: linear-gradient(#fff2c7, #e9cd83); }
.house-nook .hex-board .tile.bonus-3 { background: #8a709d; }
.house-nook .hex-board .tile.bonus-3::before { background: linear-gradient(#f0e5f6, #cfbbdf); }
.house-nook .hex-board .tile.selected { background: #6c8657; transform: none; }
.house-nook .hex-board .tile.selected::before { background: linear-gradient(#dce9c7, #bccc9e); }
.house-nook .hex-board .tile.hinted { background: #846093; outline: none; }
.house-nook .hex-board .tile.hinted::before { inset: 4px; }
.house-nook .hex-board .tile:focus-visible { background: #5f7256; outline: none; }
.house-nook .hex-board .bonus-badge { left: 50%; top: 2px; transform: translateX(-50%); padding: 1px 3px; font-size: 9px; }
.house-nook .hex-board .tile .order { top: auto; bottom: 2px; right: 46%; font-size: 8px; }
.mode-picks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-picks [aria-disabled="true"] { color: var(--muted); }
.mode-picks svg { width: 16px; height: 16px; }
@media (max-width: 700px) {
  .nook-play { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .house-nook .nook-side { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "target hud" "tray tray" "feedback feedback" "actions actions"; gap: 6px 10px; overflow: visible; }
  .house-nook .nook-side .target-card { grid-area: target; padding: 6px 10px; }
  .house-nook #target { font-size: 42px; }
  .house-nook .nook-side .hud { grid-area: hud; }
  .house-nook .nook-side .timebar { grid-column: 1 / -1; }
  .house-nook .nook-side .tray { grid-area: tray; }
  .house-nook .nook-side .feedback { grid-area: feedback; min-height: 1.4em; font-size: 13px; }
  .house-nook .nook-side .board-actions { grid-area: actions; }
  .house-nook #equation { font-size: 15px; }
  .house-nook #match { min-width: 88px; padding: 8px 10px; }
  .house-nook .board-slot { grid-row: 2; }
}
@media (orientation: landscape) and (max-height: 600px) {
  .nook-play { grid-template-columns: minmax(230px, 280px) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .house-nook .nook-side { display: flex; gap: 6px; }
  .house-nook .target-card { padding: 4px 8px; flex-direction: row; justify-content: space-between; gap: 8px; }
  .house-nook #target { font-size: 34px; }
  .house-nook .feedback { min-height: 1.4em; font-size: 12px; }
  .house-nook #equation { font-size: 14px; }
  .house-nook .board-slot { grid-row: 1; }
  .house-nook .board-frame { padding: 6px; }
  .house-nook #nook-board { gap: 5px; }
}
/* Phones: the board panel fills the board area; the square grid keeps its shape, centred (casual-game-shell §10). */
@media (max-width: 700px), (orientation: landscape) and (max-height: 600px) {
  .house-nook .board-slot { align-items: stretch; justify-content: stretch; }
  .house-nook .board-frame { width: 100%; height: 100%; aspect-ratio: auto; display: grid; place-items: center; container-type: size; }
  .house-nook .board-square { width: auto; height: min(100cqh, 100cqw); aspect-ratio: 1; }
}
