/* Quick Games shell: one look for every small game. Same warm dark arena as Turf and the Games Lab. */
@font-face { font-family: 'Lilita One'; src: url(fonts/lilita-one.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: Nunito; src: url(fonts/nunito-700.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: Nunito; src: url(fonts/nunito-800.woff2) format('woff2'); font-weight: 800; font-display: swap; }

:root {
  color-scheme: dark;
  --floor: #15110D; --panel: #272019; --panel-up: #342B22; --line: #4A3E32;
  --cream: #FFF4E0; --soft: #CDBDA6; --gold: #FFB81F; --gold-side: #B87C00; --ink: #20180F; --side: #0D0A07;
  --good: #1FBF7A; --bad: #F2543D;
  --tint: var(--gold);            /* each game sets its own play colour on <body style="--tint:..."> */
  --spring: cubic-bezier(.32, .72, 0, 1);
  --display: 'Lilita One', Nunito, ui-rounded, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--floor); color: var(--cream); font: 700 16px/1.5 Nunito, ui-rounded, system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; }
h1, h2, p, ol, ul { margin: 0; padding: 0; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--cream); outline-offset: 3px; }

.qg { max-width: 560px; margin: 0 auto; padding: 16px 16px max(28px, env(safe-area-inset-bottom)); display: grid; gap: 18px; }
.back { justify-self: start; display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px 1px; border-radius: 999px; background: var(--panel); color: var(--soft); text-decoration: none; font-size: 14px; font-weight: 800; }
.back:hover { color: var(--cream); }

/* Card: an outer tray with the real panel sitting inside it. */
.card { padding: 6px; border-radius: 30px; background: rgb(255 244 224 / .045); box-shadow: inset 0 0 0 1px rgb(255 244 224 / .07); animation: rise .6s var(--spring) both; }
.core { border-radius: 24px; background: var(--panel); box-shadow: inset 0 1px 0 rgb(255 244 224 / .08), 0 8px 0 var(--side); padding: 26px 22px 24px; display: grid; gap: 14px; }
@keyframes rise { from { transform: translateY(18px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Only one screen shows at a time. */
.qg[data-state="start"] .play, .qg[data-state="start"] .result,
.qg[data-state="play"] .start, .qg[data-state="play"] .result, .qg[data-state="play"] .about, .qg[data-state="play"] .back,
.qg[data-state="result"] .start, .qg[data-state="result"] .play { display: none; }

.start h1 { font: 400 clamp(40px, 13vw, 58px)/.95 var(--display); letter-spacing: .01em; }
.start h1 em { font-style: normal; color: var(--tint); }
.blurb { color: var(--soft); font-size: 17px; max-width: 34ch; }
.how { list-style: none; display: grid; gap: 8px; counter-reset: step; }
.how li { counter-increment: step; display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; }
.how li::before { content: counter(step); width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; background: var(--floor); color: var(--tint); font: 400 16px var(--display); }
.best { color: var(--soft); font-size: 14px; font-weight: 800; }
.best b { color: var(--cream); }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 56px; padding: 0 26px 2px; border-radius: 18px; background: var(--gold); color: var(--ink); box-shadow: 0 5px 0 var(--gold-side); font: 400 22px var(--display); white-space: nowrap; transition: transform .15s var(--spring), box-shadow .15s var(--spring); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--gold-side); }
.btn.ghost { background: var(--panel-up); color: var(--cream); box-shadow: 0 5px 0 var(--side); }
.btn.ghost:active { box-shadow: 0 1px 0 var(--side); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* The play area. Games draw inside .stage and can use the helper classes below. */
.play .core { padding: 0; overflow: hidden; }
.stage { position: relative; min-height: min(68dvh, 620px); display: grid; place-items: center; padding: 20px; text-align: center; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.stage .hud { position: absolute; inset: 14px 16px auto; display: flex; justify-content: space-between; color: var(--soft); font-size: 14px; font-weight: 800; pointer-events: none; }
.stage .hud b { color: var(--cream); }
.stage .big { font: 400 clamp(56px, 20vw, 104px)/1 var(--display); font-variant-numeric: tabular-nums; }
.stage .msg { color: var(--soft); font-size: 18px; max-width: 26ch; }
.quit { justify-self: center; min-height: 40px; padding: 0 16px; color: var(--soft); font-size: 14px; font-weight: 800; }

.result .core { text-align: center; justify-items: center; }
.result .label { color: var(--soft); font-size: 14px; font-weight: 800; }
.result .score { font: 400 clamp(44px, 15vw, 96px)/1 var(--display); white-space: nowrap; color: var(--tint); font-variant-numeric: tabular-nums; animation: pop .5s var(--spring) both; }
.result .verdict { font-size: 19px; max-width: 24ch; }
.result .newbest { padding: 4px 12px 5px; border-radius: 999px; background: var(--good); color: var(--ink); font-size: 13px; font-weight: 800; }
.result .row { width: 100%; margin-top: 6px; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }

.about { padding: 6px 6px 0; display: grid; gap: 8px; color: var(--soft); font-size: 15px; }
.about h2 { font: 400 22px var(--display); color: var(--cream); }
.about p { max-width: 60ch; }

@media (min-width: 700px) { .qg { padding-top: 40px; } .core { padding: 34px 32px 30px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
