/* Zen house look: warm dark ground, Space Grotesk, one green that means "you can act here",
   amber for an action about to waste something. Bars attach to the window edges; the board fills. */

@font-face { font-family: "Space Grotesk"; src: url(fonts/space-grotesk-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url(fonts/space-grotesk-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url(fonts/space-grotesk-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #262421; --panel: #21201d; --ink: #e4e1dd; --dim: #98948e; --tile: #4b4741; --edge: #221f1c;
  --go: #81b64c; --go-ink: #11160b; --amber: #d9a13b; --red: #d5553f;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); overflow: hidden; }
body { font: 500 16px/1.35 "Space Grotesk", system-ui, sans-serif; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; touch-action: none; }
button { font: inherit; color: inherit; cursor: pointer; }

#app { position: fixed; inset: 0; }
.screen, #play { position: absolute; inset: 0; display: none; }
#app[data-screen="title"] #title,
#app[data-screen="levels"] #levels,
#app[data-screen="loadout"] #loadout,
#app[data-screen="how"] #how,
#app[data-screen="credits"] #credits { display: flex; }
#app[data-screen="play"] #play,
#app[data-screen="paused"] #play,
#app[data-screen="result"] #play { display: flex; }
#app[data-screen="paused"] #paused,
#app[data-screen="result"] #result { display: flex; }

/* ---------- buttons ---------- */
button { background: var(--tile); border: 0; border-radius: 6px; padding: 12px 16px; min-height: 48px; box-shadow: inset 0 -2px 0 var(--edge); }
button:hover { filter: brightness(1.1); }
button:focus-visible { outline: 3px solid var(--go); outline-offset: 2px; }
button.go { background: var(--go); color: var(--go-ink); font-weight: 700; font-size: 20px; min-height: 56px; }
button.icon { background: none; box-shadow: none; min-width: 48px; padding: 8px; font-size: 18px; color: var(--dim); }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > button { flex: 1 1 0; }

/* ---------- bars ---------- */
.bar { display: flex; align-items: center; gap: 8px; background: var(--panel); flex: none; }
.bar.top { height: calc(52px + var(--safe-t)); padding: var(--safe-t) calc(8px + var(--safe-r)) 0 calc(8px + var(--safe-l)); border-bottom: 1px solid var(--edge); }
.bar .lvl { font-weight: 700; font-size: 18px; flex: 1; min-width: 0; }
.bar .lvl #lvlNum { color: var(--dim); }
.chips { display: flex; gap: 6px; align-items: center; }
.chip { font-variant-numeric: tabular-nums; color: var(--dim); padding: 4px 8px; border-radius: 6px; background: var(--edge); }
.chip.keys:empty { display: none; }
.chip.keys img { width: 18px; height: 12px; image-rendering: pixelated; vertical-align: middle; margin: 0 2px; }

/* ---------- play ---------- */
#play { flex-direction: column; }
#board { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #1b1a18; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; touch-action: none; }

/* level briefing: a dialogue bar across the bottom of the board, portrait standing on its left edge */
#brief { position: absolute; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: auto 1fr auto; align-items: end; gap: 14px; padding: 12px calc(14px + var(--safe-r)) 14px calc(8px + var(--safe-l)); background: rgba(20,19,17,.96); border-top: 1px solid var(--edge); }
#brief img { width: clamp(96px, 22vmin, 180px); height: auto; image-rendering: pixelated; display: block; align-self: end; margin: calc(-12px - 3vmin) 0 -14px; border-radius: 4px 4px 0 0; }
#brief .txt { padding-bottom: 4px; min-width: 0; }
#brief .who { color: var(--amber); font-weight: 700; font-size: 15px; margin-bottom: 4px; }
#brief p { margin: 0; font-size: 18px; line-height: 1.35; }
#brief .go { min-width: 96px; }
@media (max-width: 560px) { #brief { grid-template-columns: auto 1fr; } #brief .go { grid-column: 1 / -1; } #brief p { font-size: 16px; } }
#flash { position: absolute; inset: 0; background: rgba(213,85,63,.35); display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; pointer-events: none; }
#flash span { background: rgba(20,19,17,.9); padding: 10px 18px; border-radius: 6px; }
[hidden] { display: none !important; }

#controls {
  display: grid; gap: 8px; align-items: center;
  padding: 8px calc(10px + var(--safe-r)) calc(8px + var(--safe-b)) calc(10px + var(--safe-l));
  border-top: 1px solid var(--edge);
  grid-template-columns: 1fr auto; grid-template-areas: "tray acts";
}
#dpad { grid-area: dpad; display: none; }
#tray { grid-area: tray; display: flex; gap: 6px; min-width: 0; flex-wrap: wrap; }
#acts { grid-area: acts; display: grid; grid-template-columns: repeat(6, auto); gap: 6px; }

.act { min-width: 72px; padding: 8px 10px; font-weight: 700; color: var(--dim); background: var(--edge); box-shadow: none; }
.act.on { background: var(--go); color: var(--go-ink); }
.act.toggle.active { background: var(--amber); color: var(--go-ink); }
.act.reveal { position: relative; overflow: hidden; }
.act.reveal svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.act.reveal .ring { fill: none; stroke: var(--ink); stroke-width: 3; opacity: 0; transform: rotate(-90deg); transform-origin: 50% 50%; }
.act.reveal.cooling .ring { opacity: .35; }
.act.reveal.showing { background: #7c9fd6; color: #0e1420; }
.act.reveal span { position: relative; }

.item { display: flex; align-items: center; gap: 6px; padding: 6px 10px; min-height: 48px; background: var(--edge); box-shadow: none; color: var(--ink); }
.item img { width: 28px; height: 28px; image-rendering: pixelated; }
.item b { font-variant-numeric: tabular-nums; }
.item.sel { outline: 3px solid var(--go); }
.item.worn { color: var(--amber); }
.item[disabled] { opacity: .45; }

/* touch: d-pad on the left, actions in a block on the right */
.touch #controls { grid-template-columns: auto 1fr; grid-template-areas: "tray tray" "dpad acts"; }
.touch #dpad { display: block; position: relative; width: 150px; height: 150px; border-radius: 50%; background: var(--edge); touch-action: none; }
.touch #acts { grid-template-columns: repeat(3, 1fr); justify-self: end; width: min(100%, 300px); }
.touch .act { min-height: 64px; min-width: 0; font-size: 15px; }
#dpad .arm { position: absolute; width: 50px; height: 50px; background: var(--tile); border-radius: 6px; }
#dpad .arm.n { left: 50px; top: 4px; } #dpad .arm.s { left: 50px; bottom: 4px; }
#dpad .arm.w { top: 50px; left: 4px; } #dpad .arm.e { top: 50px; right: 4px; }
#dpad .hub { position: absolute; left: 50px; top: 50px; width: 50px; height: 50px; background: var(--tile); }
#dpad .arm.lit { background: var(--go); }

/* ---------- screens ---------- */
.screen { flex-direction: column; background: var(--bg); overflow-y: auto; }
.screen.over { background: rgba(20,19,17,.72); align-items: center; justify-content: center; padding: 16px; }
.panel { width: 100%; max-width: 560px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.over .panel { background: var(--panel); border-top: 3px solid var(--go); }
h1, h2 { margin: 0; font-weight: 700; line-height: 1.1; }
h2 { font-size: 28px; }

/* title: the key art fills the window, the wordmark sits in its dark sky, the menu is a bar */
#title { align-items: stretch; justify-content: space-between; background: #0f1418; }
/* the key art fills the space above the menu bar, so nothing important hides behind it */
#title .art { position: absolute; left: 0; right: 0; top: 0; bottom: var(--menu-h, 0px); background: url(brand/hero.jpg) center 60% / cover no-repeat; }
@media (orientation: portrait) { #title .art { background-image: url(brand/tall.jpg); background-position: center bottom; } }
#title .hero { flex: 1; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; padding: calc(20px + var(--safe-t)) calc(20px + var(--safe-r)) 0 calc(56px + var(--safe-l)); }
@media (orientation: portrait) { #title .hero { align-items: center; padding-left: calc(16px + var(--safe-l)); } }
#title h1 { margin: 0; line-height: 0; }
#title h1 img { width: min(86vw, 560px); height: auto; filter: drop-shadow(0 6px 0 rgba(0,0,0,.45)); }
#title .menu { background: rgba(33,32,29,.94); border-top: 1px solid var(--edge); padding: 16px calc(16px + var(--safe-r)) calc(16px + var(--safe-b)) calc(16px + var(--safe-l)); display: flex; flex-direction: column; gap: 8px; }
#title .menu > * { width: 100%; max-width: 560px; margin: 0 auto; }
#title .mode { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#title .mode button { background: var(--edge); color: var(--dim); box-shadow: none; }
#title .mode button.on { background: var(--tile); color: var(--ink); box-shadow: inset 0 -3px 0 var(--amber); }
#title .mode-note { margin: 0 auto; color: var(--dim); font-size: 14px; text-align: center; }

.resArt { width: 100%; height: auto; max-height: 30vh; object-fit: cover; display: block; image-rendering: pixelated; border-radius: 4px; }
#flash img { display: block; width: min(70vw, 360px); height: auto; image-rendering: pixelated; margin-bottom: 8px; }
#flash .card { background: rgba(20,19,17,.92); padding: 10px; border-radius: 6px; text-align: center; }

#levelList { list-style: none; margin: 0; padding: 12px calc(12px + var(--safe-r)) calc(12px + var(--safe-b)) calc(12px + var(--safe-l)); display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
#levelList button { width: 100%; height: 100%; text-align: left; display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; gap: 8px; align-items: center; background: var(--panel); padding: 8px 10px 10px; }
#levelList .thumb { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; background: #1b1a18; border-radius: 4px; height: 150px; overflow: hidden; }
#levelList .thumb canvas { max-width: 100%; max-height: 150px; image-rendering: pixelated; }
#levelList .name { font-weight: 700; }
#levelList .moon { color: #ffcf7a; font-weight: 400; }
#levelList .n { color: var(--dim); font-variant-numeric: tabular-nums; }
#levelList .best { color: var(--dim); font-variant-numeric: tabular-nums; }
#levelList .best.ghost { color: var(--go); }
#levelList button[disabled] { opacity: .4; cursor: default; }

.lo-h { margin: 0; font-size: 28px; }
.lo-sub { margin: 0; color: var(--dim); }
#loBag { display: flex; gap: 10px; flex-wrap: wrap; }
#loBag .slot { width: 64px; height: 64px; min-width: 0; padding: 0; display: grid; place-items: center; background: var(--edge); box-shadow: inset 0 0 0 2px var(--tile); border-radius: 8px; }
#loBag .slot.full { background: var(--tile); box-shadow: inset 0 -3px 0 var(--edge); }
#loBag .slot[disabled] { opacity: 1; cursor: default; }
#loBag .slot img { width: 40px; height: 40px; image-rendering: pixelated; }
#loShelf { display: grid; gap: 8px; }
#loShelf .offer { display: grid; grid-template-columns: 44px 1fr auto; grid-template-areas: "img nm left" "img what what"; gap: 2px 12px; align-items: center; text-align: left; padding: 10px 12px; background: var(--panel); color: var(--ink); }
#loShelf .offer img { grid-area: img; width: 40px; height: 40px; image-rendering: pixelated; }
#loShelf .offer .nm { grid-area: nm; font-weight: 700; font-size: 17px; }
#loShelf .offer .what { grid-area: what; color: var(--dim); font-weight: 400; font-size: 14px; }
#loShelf .offer .left { grid-area: left; color: var(--go); font-size: 13px; font-weight: 700; }
#loShelf .offer[disabled] { opacity: .45; }
#loShelf .offer[disabled] .left { color: var(--dim); }

#resRank { font-size: 64px; font-weight: 700; line-height: 1; color: var(--go); }
#resStats { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; margin: 0; }
#resStats dt { color: var(--dim); }
#resStats dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
#resStats .total { color: var(--ink); font-weight: 700; border-top: 1px solid var(--tile); padding-top: 6px; }

.prose p { margin: 0; color: var(--ink); }
.prose h3 { margin: 12px 0 0; font-size: 18px; }
.prose .dim, .keysHelp { color: var(--dim); font-size: 15px; }
.prose ul { margin: 0; padding-left: 20px; }
.prose a { color: var(--go); }
.keysHelp { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; }
.keysHelp kbd { font: inherit; color: var(--ink); }

@media (max-width: 520px) {
  .bar .lvl { font-size: 16px; }
  .touch #dpad { width: 132px; height: 132px; }
  .touch #dpad .arm, .touch #dpad .hub { width: 44px; height: 44px; }
  .touch #dpad .arm.n, .touch #dpad .arm.s, .touch #dpad .hub { left: 44px; }
  .touch #dpad .arm.w, .touch #dpad .arm.e, .touch #dpad .hub { top: 44px; }
}

/* touch, landscape phone: d-pad left of the board, actions right, so the board keeps the height */
@media (orientation: landscape) and (max-height: 540px) {
  html.touch #app #play { display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto 1fr auto; grid-template-areas: "top top top" "dpad board acts" "tray board acts"; }
  html.touch #app:not([data-screen="play"]):not([data-screen="paused"]):not([data-screen="result"]) #play { display: none; }
  .touch #play > .bar.top { grid-area: top; height: calc(44px + var(--safe-t)); }
  .touch #board { grid-area: board; }
  .touch #controls { display: contents; }
  .touch #dpad { grid-area: dpad; align-self: center; margin: 8px 8px 8px calc(44px + var(--safe-l)); }
  .touch #tray { grid-area: tray; flex-direction: column; padding: 0 8px 8px calc(36px + var(--safe-l)); }
  .touch #acts { grid-area: acts; grid-template-columns: repeat(2, 1fr); width: 200px; align-self: center; padding: 8px calc(8px + var(--safe-r)) 8px 8px; }
  .touch .act { min-height: 56px; }
  .touch #bAct { grid-column: 1 / -1; }
}
.touch #keysHelp { display: none; }

/* ---------- keyboard / controller: no on-screen buttons, just prompts for what you can do now ---------- */
kbd.glyph { display: none; font: 700 13px/1 "Space Grotesk", sans-serif; color: var(--ink); background: var(--tile); border-radius: 4px; padding: 4px 6px; min-width: 22px; text-align: center; box-shadow: inset 0 -2px 0 var(--edge); }
html:not(.touch) kbd.glyph { display: inline-block; }
html[data-input="pad"] kbd.glyph { border-radius: 10px; }
html:not(.touch) #controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 6px calc(12px + var(--safe-r)) calc(6px + var(--safe-b)) calc(48px + var(--safe-l)); }
html:not(.touch) #acts { display: flex; gap: 18px; align-items: center; }
html:not(.touch) .act { background: none; box-shadow: none; min-width: 0; min-height: 0; padding: 4px 0; display: none; align-items: center; gap: 8px; color: var(--ink); font-weight: 500; pointer-events: none; }
html:not(.touch) .act.on, html:not(.touch) .act.shown, html:not(.touch) .act.always { display: inline-flex; }
html:not(.touch) .act.on kbd.glyph { background: var(--go); color: var(--go-ink); box-shadow: inset 0 -2px 0 #4f7a27; }
html:not(.touch) .act.on .lbl { color: var(--ink); }
html:not(.touch) .act.always:not(.on) { color: var(--dim); }
html:not(.touch) .act.toggle.active { background: none; color: var(--amber); }
html:not(.touch) .act.toggle.active kbd.glyph { background: var(--amber); color: var(--go-ink); }
html:not(.touch) .act.reveal svg { display: none; }
html:not(.touch) .act.reveal { position: relative; }
html:not(.touch) .act.reveal.cooling::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 3px; background: var(--edge); }
html:not(.touch) .act.reveal.cooling::before { content: ""; position: absolute; left: 0; bottom: -2px; height: 3px; width: calc((1 - var(--left, 0)) * 100%); background: var(--dim); z-index: 1; }
html:not(.touch) .act.reveal.showing { background: none; color: #9fbcf0; }
html:not(.touch) .act.reveal.showing kbd.glyph { background: #7c9fd6; color: #0e1420; }
.prompt-use { display: none; }
html:not(.touch) .prompt-use.on { display: inline-flex; }
html:not(.touch) .prompt-use .lbl + kbd { margin-left: 6px; }
html:not(.touch) #tray .item { min-height: 40px; padding: 4px 10px 4px 6px; }
html:not(.touch) #tray .item img { width: 24px; height: 24px; }

/* ---------- how to play ---------- */
#howBody { width: 100%; max-width: 1120px; margin: 0 auto; padding: 16px calc(16px + var(--safe-r)) calc(32px + var(--safe-b)) calc(16px + var(--safe-l)); }
.how-lead { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 20px; align-items: center; margin-bottom: 8px; }
.how-lead img { width: 100%; border-radius: 6px; image-rendering: pixelated; display: block; }
.how-lead h2 { font-size: clamp(24px, 4vw, 34px); margin-bottom: 8px; }
.how-lead p { margin: 0; color: var(--dim); font-size: 17px; }
.how-h { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--amber); margin: 28px 0 12px; }
.demos { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.demo { margin: 0; background: var(--panel); border-radius: 6px; overflow: hidden; display: flex; flex-direction: column; }
.demo-cv { position: relative; aspect-ratio: 9 / 6; background: #1b1a18; }
.demo-cv canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.demo-tag { position: absolute; left: 8px; top: 8px; font-size: 12px; font-weight: 700; background: rgba(20,19,17,.85); padding: 3px 8px; border-radius: 4px; }
.demo-tag:empty { display: none; }
.demo figcaption { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.demo figcaption b { font-size: 17px; }
.demo figcaption span { color: var(--dim); font-size: 15px; line-height: 1.4; }
.roster { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.guard-card { display: grid; grid-template-columns: 96px 1fr; gap: 12px; background: var(--panel); border-radius: 6px; padding: 10px; }
.guard-card img { width: 96px; height: 96px; image-rendering: pixelated; border-radius: 4px; }
.guard-txt b { font-size: 17px; }
.guard-txt p { margin: 2px 0 8px; color: var(--dim); font-size: 14px; line-height: 1.35; }
.stat { display: grid; grid-template-columns: 58px 1fr; align-items: center; gap: 6px; font-size: 12px; color: var(--dim); margin-top: 3px; }
.stat i { display: block; height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--ink) calc(var(--v) * 100%), var(--edge) 0); }
.guard-txt .tag { display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 700; color: var(--go); }
.how-note { color: var(--dim); font-size: 14px; margin: 10px 0 0; }
.rows { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.row-i { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: center; background: var(--panel); border-radius: 6px; padding: 10px 12px; }
.row-i img, .row-i .wicon { width: 40px; height: 40px; image-rendering: pixelated; border-radius: 4px; object-fit: cover; }
.row-i b { display: block; font-size: 16px; }
.row-i span { color: var(--dim); font-size: 14px; line-height: 1.35; }
.wicon { display: block; background-repeat: no-repeat; background-size: 100% 100%; }
.wicon-key { background-image: url(art/items/GoldKey.png); background-size: 80% auto; background-position: center; background-color: var(--edge); }
.wicon-chest { background: var(--edge) url(art/items/LittleTreasureChest.png) 0 50% / 200% 100% no-repeat; }
.wicon-hide { background: var(--edge) url(art/items/Crate.png) center / 80% auto no-repeat; }
.wicon-ring { background: var(--edge) radial-gradient(circle, transparent 7px, #fff 8px, #fff 10px, transparent 11px); }
.controls-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.ctl-col { background: var(--panel); border-radius: 6px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.ctl-col.now { outline: 2px solid var(--go); }
.ctl-col > b em { font-style: normal; font-weight: 500; font-size: 13px; color: var(--go); margin-left: 6px; }
.ctl-row { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 10px; font-size: 15px; }
.ctl-row span { color: var(--dim); }
kbd.cap { justify-self: start; font: 700 13px/1 "Space Grotesk", sans-serif; color: var(--ink); background: var(--tile); border-radius: 4px; padding: 5px 8px; box-shadow: inset 0 -2px 0 var(--edge); }
kbd.cap.pad { border-radius: 12px; }
.tbtn { justify-self: start; font-weight: 700; font-size: 13px; color: var(--ink) !important; background: var(--edge); border-radius: 6px; padding: 5px 8px; }
@media (max-width: 640px) { .how-lead { grid-template-columns: 1fr; } .demos, .rows, .roster, .controls-grid { grid-template-columns: 1fr; } }

/* ---------- phone review fixes ---------- */
/* touch: controls you can always press look pressable; context ones stay dim until they light */
.touch .act.always { background: var(--tile); color: var(--ink); box-shadow: inset 0 -2px 0 var(--edge); }
.touch .act.always.on { background: var(--go); color: var(--go-ink); }
/* touch: a button you can't use right now is plainly greyed (Act with nothing next to you, Reveal cooling);
   Crouch can always be pressed so it never greys */
.touch .act:not(.on):not(.toggle):not(.showing) { opacity: .35; background: var(--edge); color: var(--dim); box-shadow: none; }
/* short landscape screens: the wordmark and the result art must not push the buttons off screen */
@media (max-height: 520px) {
  #title h1 img { max-height: 42vh; width: auto; }
  .resArt { display: none; }
  /* result: title, rank and buttons on the left, the numbers on the right */
  #result .panel { max-width: 760px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); column-gap: 24px; row-gap: 10px; align-items: start; }
  #result .panel > * { grid-column: 1; }
  #result #resStats { grid-column: 2; grid-row: 1 / span 4; }
  #resRank { font-size: 48px; }
}
/* level select: two across on a phone instead of one very long column */
@media (max-width: 520px) {
  #levelList { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  #levelList .thumb { height: 110px; }
  #levelList .thumb canvas { max-height: 110px; }
  #levelList button { padding: 6px 8px 8px; gap: 6px; }
  #levelList .best { grid-column: 1 / -1; }
}
/* the house tray tab sits on the left edge: keep text on the menu screens clear of it on phones */
@media (max-width: 700px) {
  #howBody, #levelList { padding-left: calc(30px + var(--safe-l)); }
  .screen:not(.over) .panel { padding-left: calc(30px + var(--safe-l)); }
}

/* title movement: the fx canvas sits on the key art, under the wordmark and menu */
#title { position: absolute; }
#title .title-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#title .hero, #title .menu { position: relative; z-index: 1; }
/* a katana glint that sweeps the wordmark every few seconds */
#title h1 { position: relative; display: inline-block; }
#title h1::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 42%, rgba(255,255,255,.75) 50%, transparent 58%) no-repeat;
  background-size: 300% 100%; background-position: 150% 0;
  -webkit-mask: url(brand/logo-sm.webp) center / 100% 100% no-repeat; mask: url(brand/logo-sm.webp) center / 100% 100% no-repeat;
  animation: glint 5.5s ease-in-out 1.2s infinite; }
@keyframes glint { 0% { background-position: 150% 0; } 22%, 100% { background-position: -50% 0; } }
@media (prefers-reduced-motion: reduce) { #title h1::after { animation: none; display: none; } }

#levelList li.chapter { grid-column: 1 / -1; font-weight: 700; font-size: 20px; margin: 14px 0 0; }
#levelList li.chapter:first-child { margin-top: 0; }
#levelList li.chapter span { color: var(--amber); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; margin-right: 8px; }
