/* House look: warm dark ground, Space Grotesk, one green that means "you can act here".
   Bars attach to the window edges and the board fills what's left. Portrait phones first.
   A skin can override the colour tokens on #app; it never touches layout. */

@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; }
/* the wordmark's face, Lilita One by Juan Montoreano, OFL */
@font-face { font-family: "Lilita One"; src: url(fonts/lilita-one.woff2) format("woff2"); font-weight: 400; font-display: block; }

:root {
  --bg: #262421; --panel: #21201d; --ink: #e4e1dd; --dim: #98948e; --tile: #4b4741; --edge: #221f1c;
  --go: #81b64c; --go-ink: #11160b; --amber: #d9a13b; --red: #d5553f; --blue: #7c9fd6;
  --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; overscroll-behavior: none; }
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, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

#app { position: fixed; inset: 0; }
.screen, #play { position: absolute; inset: 0; display: none; }
#app[data-screen="title"] #title, #app[data-screen="levels"] #levels { display: flex; }
#app[data-screen="play"] #play { display: flex; }
#app[data-over="brief"] #brief, #app[data-over="death"] #death, #app[data-over="won"] #won,
#app[data-over="paused"] #paused, #app[data-over="debug"] #debug, #app[data-over="dres"] #dres { display: flex; }
/* a counted daily has one attempt: no restart, and the numbers are not the player's to change */
#app[data-run="daily"] #bRestart, #app[data-run]:not([data-run="level"]) #bGearP { display: none; }

/* ---------- type ---------- */
h1 { font-size: clamp(44px, 16vw, 92px); line-height: .92; letter-spacing: -.03em; margin: 0 0 8px; }
h2 { font-size: clamp(24px, 7vw, 34px); line-height: 1.1; letter-spacing: -.02em; margin: 0; overflow-wrap: break-word; }
.lede { color: var(--dim); font-size: 17px; margin: 0; }
.kicker { color: var(--amber); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; font-size: 13px; }

/* ---------- buttons ---------- */
button { background: var(--tile); border: 0; border-radius: 6px; padding: 12px 16px; min-height: 52px; box-shadow: inset 0 -2px 0 var(--edge); }
button:active { filter: brightness(1.15); }
button:focus-visible { outline: 3px solid var(--go); outline-offset: 2px; }
button[disabled] { opacity: .45; }
button.go { background: var(--go); color: var(--go-ink); font-weight: 700; font-size: 20px; min-height: 58px; }
button.ghost { background: none; box-shadow: none; color: var(--dim); min-height: 44px; }
button.icon { background: none; box-shadow: none; min-width: 46px; padding: 8px; font-size: 17px; color: var(--dim); }
button.pill { background: var(--edge); font-weight: 700; }
.col { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1 1 0; }
input, textarea { background: var(--edge); border: 1px solid #332f2a; border-radius: 6px; padding: 12px; width: 100%; min-height: 52px; }
textarea { touch-action: auto; }

/* ---------- screen frames ---------- */
.pad { padding: calc(20px + var(--safe-t)) calc(20px + var(--safe-r)) calc(20px + var(--safe-b)) calc(20px + var(--safe-l)); }
.screen { flex-direction: column; justify-content: center; }
.stack { display: flex; flex-direction: column; gap: 16px; width: 100%; max-width: 460px; margin: 0 auto; }
.stack.wide { max-width: 720px; }
.sheet { background: var(--sheet, rgba(20, 19, 17, .93)); backdrop-filter: blur(3px); }
.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; justify-content: flex-start; }
.scrollinner { flex: 1; }
.facts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; color: var(--dim); }
.facts li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--edge); padding-bottom: 6px; }
.facts b { color: var(--ink); font-weight: 700; }

/* ---------- title: a live paper meadow, the wordmark, one card ---------- */
#title { justify-content: center; align-items: center; background: var(--board, #2f4f35); overflow: hidden; }
#attract { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hero { position: relative; align-items: center; gap: 4px; max-width: 480px; }
#logo { width: min(100%, 520px); aspect-ratio: 640 / 360; display: block; margin-bottom: 6px; }
.card { width: 100%; display: flex; flex-direction: column; gap: 12px; padding: 18px 18px 14px; background: var(--panel);
  border-radius: 6px; box-shadow: 0 2px 0 rgba(0,0,0,.06), 0 14px 34px rgba(40,30,10,.38); transform: rotate(-0.6deg); }
.card .lede { color: var(--ink); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-height: 700px) { #logo { width: min(100%, 360px); } .card { gap: 8px; padding: 14px; } }

/* ---------- play ---------- */
#play { flex-direction: column; }
.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(6px + var(--safe-r)) 0 calc(6px + var(--safe-l)); border-bottom: 1px solid var(--edge); }
.bar .lvl { font-weight: 700; font-size: 16px; flex: 1; min-width: 0; white-space: nowrap; }
.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); font-size: 15px; }
.chip.speed { min-width: 48px; text-align: center; }
.chip.speed.hot { color: var(--go-ink); background: var(--go); }
.chip.hearts { color: var(--red); letter-spacing: 1px; }
.chip.stam { width: 34px; padding: 4px; }
.chip.stam i { display: block; height: 8px; border-radius: 4px; background: var(--blue); transform-origin: left; }
#board { position: relative; flex: 1; min-height: 0; overflow: hidden; background: var(--board, #1b1a18); }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
#toast { position: absolute; left: 0; right: 0; top: 18%; text-align: center; font-size: clamp(34px, 12vw, 64px); font-weight: 700; color: var(--amber); pointer-events: none; text-shadow: 0 3px 0 rgba(0,0,0,.45); }
#toast.big { color: var(--go); transform: scale(1.25); }

/* ---------- stars, scales, segments ---------- */
.stars { font-size: 34px; letter-spacing: 6px; color: var(--amber); }
.stars .off { color: #453f38; }
.seg { display: flex; gap: 8px; }
.seg button { flex: 1 1 0; }
.seg button.on { background: var(--go); color: var(--go-ink); font-weight: 700; }
.looks { flex-wrap: wrap; }
.looks button { flex: 1 1 40%; min-height: 46px; font-size: 15px; }
.lvList button { display: flex; justify-content: space-between; align-items: center; font-weight: 700; text-align: left; }
.lvList .st { color: var(--amber); letter-spacing: 2px; }
.lvList .st i { font-style: normal; color: var(--edge); }

/* ---------- the daily ---------- */
.small { color: var(--dim); font-size: 14px; margin: 0; text-align: center; font-variant-numeric: tabular-nums; }
#title .kicker { margin-top: 4px; }
h2.score { font-size: clamp(34px, 11vw, 52px); }
.strip { font-size: 30px; letter-spacing: 6px; line-height: 1; color: var(--ink); white-space: pre; }
.board { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.board li { display: grid; grid-template-columns: 2.2em 1fr auto; gap: 8px; padding: 6px 8px; border-radius: 6px; background: var(--edge); font-variant-numeric: tabular-nums; }
.board li span:first-child { color: var(--dim); }
.board li b { font-weight: 500; overflow-wrap: anywhere; }
.board li.me { background: var(--go); color: var(--go-ink); }
.board li.me span:first-child { color: inherit; }
.nameRow input { min-height: 48px; }
.nameRow button { flex: 0 0 auto; min-height: 48px; }

/* ---------- debug sliders ---------- */
#debug { background: var(--bg); flex-direction: column; }
.dbGroup { margin: 0 0 22px; }
.dbGroup h3 { margin: 0 0 4px; font-size: 20px; }
.dbGroup .note { color: var(--dim); font-size: 14px; margin: 0 0 12px; }
.dbRow { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--edge); }
.dbRow label { font-size: 15px; }
.dbRow output { color: var(--amber); font-variant-numeric: tabular-nums; font-weight: 700; }
.dbRow input[type=range] { grid-column: 1 / -1; width: 100%; min-height: 34px; accent-color: var(--go); background: none; border: 0; padding: 0; touch-action: none; }
.dbRow .seg { grid-column: 1 / -1; }
.dbRow .seg button { min-height: 42px; font-size: 15px; }

