/*
 * SkribbleInk website: the pages server.mjs makes itself (a game's demo page, templates/play.html; the feedback inbox).
 * In SkribbleInk's colours (his logo's purples, violet,
 * cyan and white on the deep blue-black ground) and in the fonts of the rest of the site (assets/ski.css).
 */
@font-face { font-family: "Big Shoulders Display"; font-weight: 600 900; font-display: swap; src: url("/assets/fonts/big-shoulders-display.woff2") format("woff2"); }
@font-face { font-family: "Hanken Grotesk"; font-weight: 400 700; font-display: swap; src: url("/assets/fonts/hanken-grotesk.woff2") format("woff2"); }

:root {
  color-scheme: dark;
  --ground: #0b0a2b;
  --deep: #13113d;
  --panel: #1c1852;
  --line: #ffffff1c;
  --white: #f8f8f8;
  --mute: #aeacd4;
  --purple: #8c14cc;
  --dusk: #3d0c7c;
  --violet: #d77bff;
  --shade: #1a0f4a;
  --head: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --body: "Hanken Grotesk", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-tap-highlight-color: #8c14cc33; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--ground); color: var(--white); font: 500 16px/1.65 var(--body); overflow-wrap: break-word; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
a, button, select, label, summary { touch-action: manipulation; }
h1, h2, h3 { text-wrap: balance; }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; }
.wrap { width: min(1120px, 100% - 40px); margin-inline: auto; }
.skip { position: absolute; left: 12px; top: -80px; z-index: 10; padding: 12px 18px; border-radius: 8px; background: #fff; color: #000; font-weight: 600; }
.skip:focus { top: 12px; }

/* ---- top bar ---- */
.top { position: sticky; top: 0; z-index: 5; background: #0b0a2be6; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font: 700 17px/1.1 var(--head); letter-spacing: 0.08em; text-transform: uppercase; }
.brand img { flex: none; width: auto; height: 52px; }
.top nav { display: flex; gap: 4px; }
.top nav a { padding: 14px 16px; border-radius: 8px; text-decoration: none; font: 600 15px/1 var(--body); color: var(--mute); transition: color 0.15s, background-color 0.15s; }
.top nav a:hover { color: #fff; background: #ffffff12; }
.top nav a[aria-current="page"] { color: #fff; box-shadow: inset 0 -2px 0 var(--purple); border-radius: 8px 8px 0 0; }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: 0 26px; border: 1px solid transparent; border-radius: 10px; text-decoration: none; cursor: pointer; font: 700 15px/1 var(--head); letter-spacing: 0.1em; text-transform: uppercase; transition: background-color 0.15s, border-color 0.15s, translate 0.08s; }
.btn:active { translate: 0 1px; }
.btn.red { background: linear-gradient(180deg, #a01ee6, var(--dusk)); color: #fff; box-shadow: inset 0 1px 0 #ffffff40, 0 10px 30px #8c14cc38; }
.btn.red:hover { background: linear-gradient(180deg, #c828f8, #5a1199); }
.btn.line { border-color: #ffffff40; color: var(--white); background: #ffffff0a; }
.btn.line:hover { border-color: #fff; background: #ffffff17; }
.btn[disabled] { opacity: 0.5; cursor: default; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

/* ---- sections ---- */
section.band { padding: clamp(48px, 9vh, 96px) 0; border-top: 1px solid var(--line); }
section.band.alt { background: var(--deep); }
h2 { margin: 0 0 14px; font: 700 clamp(26px, 3.4vw, 40px) / 1.15 var(--head); letter-spacing: 0.02em; color: #fff; }
.lede { max-width: 62ch; margin: 0 0 28px; color: var(--mute); }
.page-head { padding: clamp(36px, 7vh, 72px) 0 clamp(24px, 4vh, 40px); background: radial-gradient(ellipse 60% 120% at 50% 0%, var(--shade), var(--ground) 75%); }
.page-head h1 { margin: 0 0 10px; font: 700 clamp(32px, 5vw, 52px) / 1.1 var(--head); color: #fff; }
.page-head p { max-width: 62ch; margin: 0; color: var(--mute); }
section[id], .game[id], h2[id] { scroll-margin-top: 84px; }

/* ---- the games ----
   Each game is its vertical lobby tile (3:4, as Stake Engine shows it; made by make-tiles.py), its words under it.
   Four to a row on a wide screen, two on a phone. One game alone is laid out wide, its tile beside its words.
   Every game shares its row's lines (grid subgrid, 2 November 2026): tile, status, name, buttons, the "About this game"
   dropdown, so the buttons of a row stand level whatever a name's length, and opening a dropdown moves no button. */
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: clamp(26px, 3vw, 36px) clamp(16px, 2.4vw, 28px); }
h2 + .games { margin-top: 26px; }
.game { display: grid; align-content: start; gap: 18px; min-width: 0; }
.game:not(:only-child) { grid-row: span 5; grid-template-rows: subgrid; row-gap: 0; }
.game:not(:only-child) .game-text { display: contents; }
.game:not(:only-child) .plate { margin-bottom: 18px; }
.game:only-child { grid-column: 1 / -1; grid-template-columns: minmax(220px, 340px) 1fr; gap: clamp(22px, 4vw, 52px); align-items: center; }
.game .plate { position: relative; overflow: hidden; border-radius: 12px; background: var(--panel); box-shadow: 0 0 0 1px #ffffff1f, 0 26px 60px #000b; transition: translate 0.2s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 0.2s; }
.game .plate img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
/* the tile is the game's way in (site.js makes it a link to the demo): it lifts under the pointer */
.game .plate a { display: block; border-radius: inherit; }
@media (hover: hover) {
  .game .plate:has(a):hover { translate: 0 -4px; box-shadow: 0 0 0 1px #8c14cc99, 0 30px 64px #000d; }
}
.game h2, .game h3 { margin: 0 0 8px; font: 700 clamp(21px, 2vw, 26px) / 1.15 var(--head); letter-spacing: 0.02em; color: #fff; }
.game .actions { display: grid; grid-template-columns: 1fr; align-content: start; gap: 10px; }
.game .actions .btn { min-height: 46px; padding: 0 12px; font-size: 14px; }
.game .actions .btn.off { cursor: default; color: var(--mute); border-color: var(--line); background: none; }
.game .status { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font: 600 13.5px/1.2 var(--body); color: var(--white); }
/* the game's words: a dropdown under the buttons, shut until it is asked for */
.about { margin-top: 6px; }
.about summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; border-bottom: 1px solid var(--line); list-style: none; cursor: pointer; color: var(--white); font: 600 14px/1.2 var(--body); transition: color 0.15s, border-color 0.15s; }
.about summary::-webkit-details-marker { display: none; }
.about summary::after { content: ""; flex: none; width: 8px; height: 8px; margin: -3px 4px 0 0; border-right: 2px solid var(--violet); border-bottom: 2px solid var(--violet); rotate: 45deg; transition: rotate 0.2s cubic-bezier(0.23, 1, 0.32, 1), margin 0.2s cubic-bezier(0.23, 1, 0.32, 1); }
.about[open] summary::after { rotate: 225deg; margin-top: 3px; }
@media (hover: hover) {
  .about summary:hover { color: #fff; border-color: #ffffff4d; }
}
.about p { margin: 0; padding-top: 12px; color: var(--mute); max-width: 52ch; font-size: 15px; line-height: 1.6; }
@supports (interpolate-size: allow-keywords) {
  .about { interpolate-size: allow-keywords; }
  .about::details-content { block-size: 0; overflow: hidden; transition: block-size 0.22s cubic-bezier(0.23, 1, 0.32, 1), content-visibility 0.22s allow-discrete; }
  .about[open]::details-content { block-size: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .about::details-content, .about summary::after { transition: none; }
}
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--purple); }
.status.development { color: var(--mute); }
.status.development::before { background: var(--purple); box-shadow: 0 0 0 3px #8c14cc33; }
@media (max-width: 560px) {
  .games { grid-template-columns: 1fr 1fr; }
  .game .actions .btn { padding: 0 8px; font-size: 13px; letter-spacing: 0.06em; }
  .about p { font-size: 14px; }
}
.soon { margin: 0; color: var(--mute); }

/* ---- home: how demo mode works ---- */
.split { display: grid; grid-template-columns: 1fr 1.25fr; gap: clamp(24px, 5vw, 72px); align-items: start; }
.points { margin: 0; display: grid; }
.points > div { padding: 18px 0; border-top: 1px solid var(--line); }
.points > div:last-child { border-bottom: 1px solid var(--line); }
.points dt { font: 700 18px/1.3 var(--head); letter-spacing: 0.02em; color: #fff; }
.points dd { margin: 4px 0 0; color: var(--mute); max-width: 56ch; }
.points a { color: var(--white); text-underline-offset: 3px; }
.points a:hover { color: #fff; }

/* ---- a game's own page: a bar that says what it is, and the game under it ---- */
body.play { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.playbar { flex: none; display: flex; align-items: center; gap: 6px 18px; min-height: 52px; padding: 4px max(14px, env(safe-area-inset-right)) 4px max(14px, env(safe-area-inset-left)); border-bottom: 1px solid var(--line); background: var(--ground); font-size: 14px; }
.playbar a, .playbar button { flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--white); font: 600 14px/1 var(--body); text-decoration: none; cursor: pointer; transition: background-color 0.15s, border-color 0.15s; }
.playbar a:hover, .playbar button:hover { background: #ffffff14; color: #fff; }
.playbar .back { border-color: #ffffff33; }
.playbar .back::before { content: ""; width: 8px; height: 8px; margin-right: 9px; border-left: 2px solid; border-bottom: 2px solid; rotate: 45deg; }
.playing { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 14px; }
.playing h1 { margin: 0; font: 700 17px/1.3 var(--head); letter-spacing: 0.06em; text-transform: uppercase; color: #fff; }
.playing p { margin: 0; color: var(--mute); font-size: 13.5px; line-height: 1.35; }
.playbar-actions { flex: none; display: flex; gap: 4px; }
.playbar #full { border-color: #ffffff33; }
body.play main { flex: 1; min-height: 0; background: #000; }
body.play iframe { display: block; width: 100%; height: 100%; border: 0; }
/* ?sfx=1: the game and, beside it, the column its sound desk stands in (play.js; the desk is the game's own) */
body.play.sound-desk main { display: flex; }
body.play.sound-desk iframe { flex: 1; min-width: 0; width: auto; }
#soundDeskHost { flex: none; width: 340px; height: 100%; overflow: hidden; border-left: 1px solid var(--line); background: #0e0c33; }
#soundDeskHost.sd-shut { width: auto; }
@media (max-width: 900px) { #soundDeskHost { width: 280px; } }
/* in the game's place while its demo server starts: one heading and one line, in the middle */
body.play main:has(.wait:not([hidden])) { display: grid; place-items: center; }
.wait { max-width: 34rem; padding: 24px max(20px, env(safe-area-inset-right)) 24px max(20px, env(safe-area-inset-left)); text-align: center; }
.wait h2 { margin: 0 0 10px; font: 700 clamp(20px, 3.4vw, 28px)/1.25 var(--head); letter-spacing: 0.06em; text-transform: uppercase; color: #fff; }
.wait p { margin: 0; color: var(--mute); }
/* a narrow or a short window (a phone on its side): the bar keeps to one line, and the game says the rest */
@media (max-width: 960px), (max-height: 520px) {
  .playing p { display: none; }
  .playbar { gap: 6px 8px; min-height: 48px; }
}
/* a phone held upright: the three buttons fill the bar, so the game's name is kept for screen readers only (the game shows it) */
@media (max-width: 520px) {
  .playing h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
/* the way to the real game (2 December 2026, play.js): Play on Stake / Roobet stands out from the bar's other buttons */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.playbar a.real { border-color: var(--purple); color: #fff; background: #8c14cc22; }
.playbar a.real:hover { background: #8c14cc44; }
/* a narrow bar keeps one Play on ... link and drops the maths link and the bug report (both are a click away on the games page) */
@media (max-width: 760px) {
  .playbar a.maths, .playbar a.real-more { display: none; }
}
@media (max-width: 520px) {
  .playbar-actions:has(a.real) a[href^="/feedback/"] { display: none; }
}

/* ---- feedback form ---- */
.form { display: grid; gap: 20px; width: min(680px, 100%); }
.field { display: grid; gap: 7px; }
.field > span, legend { font-weight: 600; font-size: 14.5px; color: #fff; padding: 0; }
.field small { color: var(--mute); font-size: 13px; }
input[type="text"], input[type="password"], textarea, select {
  width: 100%; padding: 13px 14px; border: 1px solid #ffffff33; border-radius: 10px; background-color: var(--panel); color: #fff; font: 500 16px/1.5 var(--body);
}
textarea { min-height: 170px; resize: vertical; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px #8c14cc66; }
fieldset { margin: 0; padding: 0; border: 0; display: grid; gap: 9px; }
.choice { display: flex; flex-wrap: wrap; gap: 10px; }
.choice label { position: relative; cursor: pointer; }
.choice input { position: absolute; inset: 0; opacity: 0; }
.choice span { display: block; padding: 11px 18px; border: 1px solid #ffffff33; border-radius: 10px; background: var(--panel); font-weight: 600; font-size: 15px; }
.choice input:checked + span { border-color: var(--purple); background: #8c14cc26; color: #fff; }
.choice input:focus-visible + span { outline: 3px solid var(--violet); outline-offset: 2px; }
.trap { position: absolute; left: -5000px; }
.note { padding: 16px 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); }
.note.good { border-color: #1ee8f6; }
.note.bad { border-color: var(--purple); }
.note h2 { margin: 0 0 6px; font: 700 18px/1.3 var(--head); color: #fff; }
.note p { margin: 0 0 10px; color: var(--mute); }
.note pre { margin: 0 0 12px; padding: 12px; max-height: 240px; overflow: auto; border-radius: 8px; background: var(--ground); white-space: pre-wrap; font: 13px/1.5 Consolas, monospace; color: var(--white); }
[hidden] { display: none !important; }

/* ---- inbox ---- */
.inbox { display: grid; gap: 14px; }
.item { padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.item header { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; margin-bottom: 8px; color: var(--mute); font-size: 13px; }
.item header b { color: #fff; font: 700 15px/1 var(--head); letter-spacing: 0.06em; text-transform: uppercase; }
.item p { margin: 0; white-space: pre-wrap; }

/* ---- footer ---- */
footer { padding: 36px 0 44px; border-top: 1px solid var(--line); color: var(--mute); font-size: 14px; }
footer p { margin: 0 0 6px; max-width: 70ch; }

@media (max-width: 820px) {
  .game:only-child { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
  .brand span { display: none; }
  .top nav a { padding: 14px 11px; }
}
/* four tabs since 10 November 2026 (Maths): on a narrow phone the tabs close up and the mark is a little smaller, so
   neither is squeezed (after the 820px rule above, which they must win over) */
@media (max-width: 440px) {
  .top .wrap { gap: 6px; }
  .brand img { width: auto; height: 42px; }
  .top nav { gap: 0; }
  .top nav a { padding: 15px 7px; font-size: 14.5px; }
}
@media (max-width: 370px) {
  .top nav a { padding: 15px 5px; font-size: 14px; }
}
