@font-face { font-family: "Kenney Future"; src: url("/fonts/kenney-future.ttf") format("truetype"); 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 {
  --ink: #07061a;
  --night: #140c33;
  --paper: #fff8e7;
  --hot: #ffd43b;
  --hot-dark: #c98a00;
  --cool: #4fd8ff;
  --cool-dark: #1b7fb0;
  --bad: #ff5a4a;
  --good: #7dff6a;
  /* one TV unit: 1/100 of a 16:9 frame that fits the window */
  --u: min(1vw, 1.7778vh);
  --safe: calc(var(--u) * 2.5);
  --display: "Kenney Future", "Space Grotesk", system-ui, sans-serif;
  --body: "Space Grotesk", system-ui, sans-serif;
  color-scheme: dark;
}
/* old TV browsers have no min(): a plain vw unit, and a 16:9 TV makes that the same thing */
@supports not (width: min(1px, 2px)) {
  :root { --u: 1vw; --safe: 2.5vw; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--paper); font-family: var(--body); overflow: hidden; }
body { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
#stage { position: fixed; top: 0; right: 0; bottom: 0; left: 0; display: block; aspect-ratio: auto; }
.screen { position: fixed; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; }
.screen > * { pointer-events: auto; }

/* ---- buttons: chunky, a hard shadow, they squish when pressed ---- */
.btn {
  font-family: var(--display); font-size: calc(var(--u) * 1.6); letter-spacing: 0.02em; text-transform: uppercase;
  color: var(--ink); background: var(--hot); border: 0.18em solid var(--ink); border-radius: 0.5em;
  padding: 0.55em 1.1em 0.5em; cursor: pointer; box-shadow: 0 0.28em 0 var(--hot-dark), 0 0.4em 0 var(--ink);
  transform: translateY(0) rotate(var(--tilt, -1.2deg)); transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-2px) rotate(var(--tilt, -1.2deg)) scale(1.03); }
.btn:active { transform: translateY(0.24em) rotate(var(--tilt, -1.2deg)) scale(0.97, 0.94); box-shadow: 0 0.04em 0 var(--hot-dark), 0 0.14em 0 var(--ink); }
.btn:focus-visible { outline: 0.18em solid #fff; outline-offset: 0.25em; }
.btn.cool { background: var(--cool); box-shadow: 0 0.28em 0 var(--cool-dark), 0 0.4em 0 var(--ink); --tilt: 1deg; }
.btn.cool:active { box-shadow: 0 0.04em 0 var(--cool-dark), 0 0.14em 0 var(--ink); }
.btn.big { font-size: calc(var(--u) * 2.2); }
.btn:disabled { filter: grayscale(0.9) brightness(0.6); cursor: default; }
.textlink { background: none; border: 0; color: rgba(255, 248, 231, 0.75); font: 700 calc(var(--u) * 1.1) var(--body); text-decoration: underline; text-underline-offset: 0.25em; cursor: pointer; }
.chip { position: fixed; right: var(--safe); top: var(--safe); z-index: 20; font: 700 calc(var(--u) * 1.1) var(--body); background: var(--hot); color: var(--ink); border: 3px solid var(--ink); border-radius: 99px; padding: 0.5em 1em; cursor: pointer; }

/* ---- the door ---- */
body.tv #door { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(var(--u) * 1.6); padding: var(--safe); background: radial-gradient(ellipse at 50% 42%, rgba(7, 6, 26, 0.75), rgba(7, 6, 26, 0.1) 60%); }
.wordmark { max-width: 92vw; height: auto; filter: drop-shadow(0 0.4em 1.2em rgba(0, 0, 0, 0.6)); }
.door-line { margin: 0; font: 700 calc(var(--u) * 1.6) var(--body); text-align: center; text-shadow: 0 2px 10px var(--ink); max-width: 90vw; }
.door-buttons { display: flex; gap: calc(var(--u) * 2.4); align-items: center; flex-wrap: wrap; justify-content: center; margin-top: calc(var(--u) * 1); }
.join-row { display: flex; gap: calc(var(--u) * 0.8); align-items: center; }
.join-row input {
  width: 5.2em; font: 400 calc(var(--u) * 2.2) var(--display); text-align: center; letter-spacing: 0.15em; text-transform: uppercase;
  background: var(--paper); color: var(--ink); border: 0.18em solid var(--ink); border-radius: 0.5em; padding: 0.45em 0.3em 0.4em; box-shadow: 0 0.3em 0 var(--ink);
}
.join-row input::placeholder { color: rgba(7, 6, 26, 0.35); }
.shake { animation: shake 0.35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
#door .shelf { width: min(92vw, 1100px); max-height: 22vh; overflow: hidden; }
#door #creditsOpen { margin-top: calc(var(--u) * 0.5); }
body.touch #hostBtn { order: 2; --tilt: 0deg; font-size: calc(var(--u) * 1.6); background: rgba(255, 255, 255, 0.12); color: var(--paper); box-shadow: none; border-color: rgba(255, 255, 255, 0.4); }

/* ---- the TV landing: name, QR and the line on the left, the clip as the biggest thing on the right ---- */
/* margins, not flex gap: TV browsers before Chromium 84 (Tizen 6, older webOS) have no gap on flex, and the line sat on the QR */
body.tv #lobby { display: flex; align-items: center; justify-content: center; padding: var(--safe); }
.lobby-join { flex: 0 0 calc(var(--u) * 32); display: flex; flex-direction: column; align-items: center; min-width: 0; margin-right: calc(var(--u) * 4); }
.lobby-join > * + * { margin-top: calc(var(--u) * 2.6); }
#lobbyMark { max-width: 100%; }
.join-cta { font: 700 calc(var(--u) * 2.1) var(--body); text-transform: uppercase; letter-spacing: 0.06em; line-height: 1.1; white-space: nowrap; }
.qr { width: calc(var(--u) * 18); height: calc(var(--u) * 18); aspect-ratio: 1; background: #fff; border: 0.5em solid #fff; border-radius: 0.8em; box-shadow: 0 0 0 0.35em var(--ink), 0 0.9em 0 var(--hot); transform: rotate(-2deg); }
.qr svg { width: 100%; height: 100%; display: block; }
.preview { flex: 0 0 calc(var(--u) * 58); width: calc(var(--u) * 58); height: calc(var(--u) * 32.625); object-fit: cover; display: block; background: var(--ink); border: calc(var(--u) * 0.45) solid var(--ink); border-radius: calc(var(--u) * 0.8); }
.join-code { font: 400 calc(var(--u) * 7) var(--display); letter-spacing: 0.12em; color: var(--hot); text-shadow: 0 0.08em 0 var(--hot-dark), 0 0.14em 0 var(--ink); line-height: 1; }
.team { display: flex; flex-direction: column; gap: calc(var(--u) * 0.6); padding: calc(var(--u) * 0.8); border: 3px solid var(--c); border-radius: 0.8em; background: rgba(7, 6, 26, 0.55); }
.team h3 { margin: 0; font: 400 calc(var(--u) * 1.5) var(--display); color: var(--c); display: flex; justify-content: space-between; }
.team h3 small { font: 700 1em var(--body); background: var(--c); color: var(--ink); border-radius: 99px; padding: 0 0.6em; }
.pcard { position: relative; display: flex; align-items: center; gap: 0.5em; background: rgba(7, 6, 26, 0.7); border: 3px solid var(--c); border-radius: 0.7em; padding: 0.3em 0.7em 0.3em 0.3em; font: 700 calc(var(--u) * 1.35) var(--body); min-height: calc(var(--u) * 4.4); animation: pop 0.35s cubic-bezier(.2, 1.6, .5, 1); }
.pcard canvas { width: calc(var(--u) * 3.6); height: calc(var(--u) * 3.3); flex: none; }
.pcard span { overflow-wrap: anywhere; }
.pcard.off { opacity: 0.45; }
.pcard .boss { position: absolute; top: -0.8em; right: 0.5em; font: 400 0.6em var(--display); background: var(--hot); color: var(--ink); border-radius: 99px; padding: 0.15em 0.6em; }
.pcard.wait { opacity: 0.4; border-style: dashed; animation: none; }
.empty { opacity: 0.55; font: 700 calc(var(--u) * 1.2) var(--body); padding: 0.4em; }
@keyframes pop { from { transform: scale(0.4) rotate(-8deg); opacity: 0; } }

/* ---- the match HUD ---- */
.topbar { position: absolute; left: var(--safe); right: var(--safe); top: calc(var(--safe) * 0.6); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; pointer-events: none; }
.round { font: 400 calc(var(--u) * 3) var(--display); text-shadow: 0 0.08em 0 var(--ink); }
.round small { font-size: 0.5em; opacity: 0.75; }
.wind { display: flex; flex-direction: column; align-items: center; }
.wind canvas { width: calc(var(--u) * 20); height: calc(var(--u) * 5); }
.wind-label { font: 400 calc(var(--u) * 1.6) var(--display); margin-top: -0.2em; text-shadow: 0 0.1em 0 var(--ink); }
.clock { justify-self: end; font: 400 calc(var(--u) * 6) var(--display); color: var(--hot); text-shadow: 0 0.06em 0 var(--hot-dark), 0 0.12em 0 var(--ink); min-width: 2ch; text-align: right; line-height: 1; }
.clock.hurry { color: var(--bad); animation: throb 1s infinite; }
@keyframes throb { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.18); } }
.offer { position: absolute; top: calc(var(--u) * 8.2); left: 50%; transform: translateX(-50%); display: flex; gap: calc(var(--u) * 1.2); }
.shot { display: flex; align-items: center; gap: 0.4em; background: rgba(7, 6, 26, 0.75); border: 3px solid rgba(255, 255, 255, 0.35); border-radius: 0.7em; padding: 0.2em 0.9em 0.2em 0.3em; font: 400 calc(var(--u) * 1.35) var(--display); animation: pop 0.4s cubic-bezier(.2, 1.6, .5, 1) backwards; }
.shot:nth-child(2) { animation-delay: 0.08s; } .shot:nth-child(3) { animation-delay: 0.16s; }
.shot canvas { width: calc(var(--u) * 3.4); height: calc(var(--u) * 3.4); }
.banner { position: absolute; top: 40%; left: 0; right: 0; text-align: center; font: 400 calc(var(--u) * 6) var(--display); color: var(--good); text-shadow: 0 0.08em 0 var(--ink), 0 0 0.6em rgba(125, 255, 106, 0.6); opacity: 0; pointer-events: none; }
.banner.on { animation: bannerIn 1.8s both; }
@keyframes bannerIn { 0% { opacity: 0; transform: scale(2.2) rotate(-6deg); } 15% { opacity: 1; transform: scale(1) rotate(-3deg); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(0.9) rotate(-3deg); } }

.board { position: absolute; left: var(--safe); right: var(--safe); bottom: calc(var(--safe) * 0.5); display: grid; grid-template-columns: repeat(var(--n, 6), minmax(0, 1fr)); gap: calc(var(--u) * 0.5); }
.board.teams { display: flex; justify-content: center; }
.chip-p { position: relative; display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; column-gap: 0.45em; align-items: center; min-width: 0; background: rgba(7, 6, 26, 0.82); border: 3px solid var(--c); border-radius: 0.6em; padding: 0.25em 0.6em; font: 700 calc(var(--u) * 1.15) var(--body); transition: transform 0.2s; }
.chip-p .light { grid-row: 1 / 3; width: 0.8em; height: 0.8em; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.5); background: rgba(255, 255, 255, 0.12); }
.chip-p.locked .light { background: var(--good); border-color: #eaffdf; box-shadow: 0 0 0.7em var(--good); }
.chip-p .nm { grid-row: 1 / 3; color: var(--c); overflow-wrap: anywhere; min-width: 0; line-height: 1.1; }
.chip-p .sc { grid-row: 1 / 3; grid-column: 3; font: 400 1.9em var(--display); }
.chip-p .kd { grid-column: 2; font-size: 0.8em; opacity: 0.7; }
.chip-p.off { opacity: 0.5; }
.chip-p .delta { position: absolute; top: -1.1em; right: -0.4em; font: 400 1.2em var(--display); font-style: normal; padding: 0 0.35em; border-radius: 0.4em; border: 2px solid var(--ink); animation: pop 0.4s cubic-bezier(.2, 1.6, .5, 1); }
.chip-p .delta.up { background: var(--good); color: var(--ink); }
.chip-p .delta.down { background: var(--bad); color: var(--ink); }
.teamcol { display: flex; flex-direction: column; gap: 0.3em; border: 3px solid var(--c); border-radius: 0.7em; padding: 0.3em; background: rgba(7, 6, 26, 0.5); }
.teamhead { display: flex; justify-content: space-between; gap: 1em; font: 400 calc(var(--u) * 1.3) var(--display); color: var(--c); padding: 0 0.3em; }
.teamhead b { color: var(--paper); }
.teamchips { display: flex; gap: 0.3em; flex-wrap: wrap; }
.teamcol .chip-p { min-width: calc(var(--u) * 9); }

/* ---- callouts ---- */
/* one slot, in the strip above the level where no tank sits: a new call replaces the last, never stacks */
.callouts { position: fixed; left: var(--safe); right: var(--safe); top: calc(var(--u) * 8.1); display: flex; justify-content: center; pointer-events: none; z-index: 5; }
body[data-screen="end"] .callouts { display: none; }
.callout { text-align: center; transform: rotate(var(--tilt)); animation: slam 2.2s both; }
.callout span { display: inline-block; font: 400 calc(var(--u) * 3 * var(--s)) var(--display); color: var(--c); text-transform: uppercase; -webkit-text-stroke: calc(var(--u) * 0.25) var(--ink); paint-order: stroke fill; text-shadow: 0 0.08em 0 var(--ink), 0 0 0.5em rgba(0, 0, 0, 0.5); line-height: 1.05; max-width: 92vw; }
.callout small { display: block; font: 400 calc(var(--u) * 1.4) var(--display); color: var(--paper); -webkit-text-stroke: calc(var(--u) * 0.15) var(--ink); paint-order: stroke fill; margin-top: 0.1em; }
@keyframes slam { 0% { opacity: 0; transform: scale(3) rotate(var(--tilt)); } 10% { opacity: 1; transform: scale(0.92) rotate(var(--tilt)); } 16% { transform: scale(1.04) rotate(var(--tilt)); } 22% { transform: scale(1) rotate(var(--tilt)); } 85% { opacity: 1; } 100% { opacity: 0; transform: translateY(-0.6em) rotate(var(--tilt)); } }

/* ---- end of match ---- */
body.tv #end { display: flex; align-items: center; justify-content: flex-end; padding: var(--safe); }
.end-card { width: min(46vw, calc(var(--u) * 46)); max-height: 90vh; overflow: hidden; background: rgba(7, 6, 26, 0.88); border: 4px solid var(--hot); border-radius: 1em; padding: calc(var(--u) * 1.6); box-shadow: 0 0.6em 0 var(--ink); display: flex; flex-direction: column; gap: calc(var(--u) * 0.8); }
.end-title { font: 400 calc(var(--u) * 3.6) var(--display); color: var(--hot); text-shadow: 0 0.08em 0 var(--hot-dark), 0 0.14em 0 var(--ink); line-height: 1.1; animation: pop 0.6s cubic-bezier(.2, 1.6, .5, 1); }
.end-table { display: flex; flex-direction: column; gap: 0.25em; overflow: auto; }
.erow { display: grid; grid-template-columns: 2em minmax(0, 1fr) auto auto; column-gap: 0.6em; align-items: baseline; font: 700 calc(var(--u) * 1.35) var(--body); border-left: 0.35em solid var(--c); padding: 0.15em 0.6em; background: rgba(255, 255, 255, 0.05); border-radius: 0.3em; }
.erow em { font: 400 1em var(--display); font-style: normal; opacity: 0.6; }
.erow span { color: var(--c); }
.erow b { font: 400 1.5em var(--display); }
.erow small { grid-column: 3; grid-row: 1; font-size: 0.75em; opacity: 0.7; white-space: nowrap; }
.erow b { grid-column: 4; min-width: 1.6em; text-align: right; }
.erow.team { grid-template-columns: minmax(0, 1fr) auto auto; font-size: calc(var(--u) * 1.6); }
.erow.team span { grid-column: 1; }
.erow.team small { grid-column: 2; }
.erow.team b { grid-column: 3; }
.end-hint { font: 700 calc(var(--u) * 1.25) var(--body); color: var(--cool); }
.replay-tag { position: absolute; left: var(--safe); top: var(--safe); font: 400 calc(var(--u) * 1.6) var(--display); background: var(--bad); color: var(--ink); border: 3px solid var(--ink); padding: 0.25em 0.7em; border-radius: 0.4em; transform: rotate(-2deg); }
.replay-tag:empty { display: none; }

/* ---- credits sheet ---- */
.sheet-wrap { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 30; display: grid; place-items: center; background: rgba(7, 6, 26, 0.7); padding: 16px; }
.sheet { width: min(640px, 100%); max-height: 86vh; overflow: auto; background: var(--night); border: 4px solid var(--hot); border-radius: 18px; padding: 20px 22px; box-shadow: 0 10px 0 var(--ink); }
.sheet h2 { margin: 0 0 12px; font: 400 28px var(--display); color: var(--hot); }
.crow { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.1); font-size: 15px; }
.crow b a { color: var(--cool); }
.crow small { grid-column: 1 / 3; opacity: 0.65; }
.sheet .btn { margin-top: 16px; font-size: 18px; }

@media (prefers-reduced-motion: reduce) {
  .callout, .banner.on, .pcard, .shot { animation-duration: 0.01s; }
}
/* Kenney Future's zero reads as a box: numbers are set in the body face */
.round, .chip-p .sc, .erow b, .teamhead b, .clock, .join-code { font-variant-numeric: tabular-nums; }
.round, .chip-p .sc, .erow b, .teamhead b, .clock { font-family: var(--body); font-weight: 700; }
.clock { font-size: calc(var(--u) * 6.4); }

/* ---- the speaker ---- */
.chip.sound { padding: 0.45em; line-height: 0; }
.chip.sound svg { width: calc(var(--u) * 2.4); height: calc(var(--u) * 2.4); fill: currentColor; display: block; }
/* off the lobby the clock has the top right corner: the button sits under it */
body:not([data-screen="lobby"]) .chip.sound { top: calc(var(--safe) + var(--u) * 7); }
/* the landing shows no speaker: any key, click or tap turns the sound on */
body[data-screen="lobby"] .chip.sound { display: none; }

/* ---- the way back to the gameaday.xyz TV shelf ---- */
.backlink { display: none; }
body[data-screen="lobby"] .backlink { display: inline-block; position: fixed; right: var(--safe); bottom: var(--safe); z-index: 21;
  font: 700 calc(var(--u) * 1.4) var(--body); color: var(--field, #ffd000); background: var(--ink); text-decoration: none;
  padding: 0.6em 1.1em; border-radius: 99px; outline: none; }
.backlink:focus, .backlink:focus-visible, .backlink:hover { box-shadow: 0 0 0 0.22em var(--field, #ffd000), 0 0 0 0.42em var(--ink); }

/* ---- the door on a phone: the same page, sized for a thumb ---- */
@media (max-width: 760px) {
  body.tv #door { --u: 3.3vw; justify-content: flex-start; padding-top: max(10vh, env(safe-area-inset-top)); overflow-y: auto; pointer-events: auto; }
  body.tv .door-line { font-size: 16px; }
  body.tv .door-buttons { flex-direction: column; width: 100%; max-width: 420px; gap: 14px; }
  body.tv .join-row { width: 100%; }
  body.tv .join-row input { flex: 1; width: auto; min-width: 0; font-size: 24px; }
  body.tv #door { padding-left: 16px; padding-right: 16px; }
  body.tv .join-row .btn { font-size: 22px; }
  body.tv #hostBtn { width: 100%; font-size: 18px; }
  body.tv #door .shelf { width: 100%; max-height: none; }
  body.tv #door #creditsOpen { font-size: 14px; }
}

/* ---- ?tweaks ---- */
.tweaks { position: fixed; left: 12px; bottom: 12px; z-index: 60; background: rgba(7, 6, 26, 0.92); border: 2px solid var(--hot); border-radius: 12px; padding: 10px 12px; font: 700 12px var(--body); display: flex; flex-direction: column; gap: 6px; }
.tweaks b { font: 400 13px var(--display); color: var(--hot); display: flex; justify-content: space-between; align-items: center; }
.tw-x { background: none; border: 0; color: var(--paper); font: 700 20px var(--body); cursor: pointer; padding: 0 4px; line-height: 1; }
.tw-row { display: flex; gap: 4px; align-items: center; }
.tw-row span { width: 54px; opacity: 0.7; }
.tw-row button { font: 700 12px var(--body); background: rgba(255, 255, 255, 0.08); color: var(--paper); border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 6px; padding: 4px 8px; cursor: pointer; }
.tw-row button.on { background: var(--hot); color: var(--ink); }

/* GIFs thrown from phones */
.gifs { position: fixed; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; z-index: 6; }
.gifs figure { position: absolute; margin: 0; width: calc(var(--u) * 22); transform: rotate(var(--r)); animation: gifIn 0.5s cubic-bezier(.2, 1.6, .5, 1), gifOut 0.5s ease-in forwards var(--out); }
.gifs img { width: 100%; display: block; border: 0.5em solid #fff; border-bottom-width: 2.4em; border-radius: 0.4em; box-shadow: 0 0.6em 0 rgba(0, 0, 0, 0.4); background: #fff; }
.gifs figcaption { position: absolute; left: 0; right: 0; bottom: 0.35em; text-align: center; font: 400 calc(var(--u) * 1.3) var(--display); color: var(--c); -webkit-text-stroke: 0.08em var(--ink); paint-order: stroke fill; }
@keyframes gifIn { from { transform: translateY(60vh) rotate(calc(var(--r) * -3)) scale(0.4); } }
@keyframes gifOut { to { transform: translateY(-10vh) rotate(calc(var(--r) * 2)) scale(0.6); opacity: 0; } }
.tweaks.folded { padding: 0; border: 0; background: none; }
.tweaks.folded > :not(.tw-pill) { display: none; }
.tweaks:not(.folded) .tw-pill { display: none; }
.tw-pill { font: 700 12px var(--body); background: rgba(7, 6, 26, 0.8); color: var(--hot); border: 2px solid var(--hot); border-radius: 99px; padding: 5px 12px; cursor: pointer; opacity: 0.7; }
.tw-pill:hover { opacity: 1; }
/* the games shelf on the door, with our own close */
.shelfbox { position: relative; }
.shelf-x { position: absolute; right: -16px; top: -16px; z-index: 2; width: 40px; height: 40px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.4); background: rgba(7, 6, 26, 0.85); color: var(--paper); font: 700 22px/1 var(--body); cursor: pointer; }
.shelf-x:hover, .shelf-x:focus-visible { background: var(--hot); color: var(--ink); outline: none; }

/* the corner block (M4): the invite QR and host/CODE, small and dim, top left on the HUD and the end screen
   (under the round, and under the replay tag) */
.corner { position: fixed; z-index: 4; left: var(--safe); top: calc(var(--safe) * 0.6 + var(--u) * 5.2); opacity: 0.62; pointer-events: none; }
.corner-join { display: flex; align-items: center; }
.corner-qr { width: calc(var(--u) * 4.6); height: calc(var(--u) * 4.6); display: block; image-rendering: pixelated; border-radius: 0.25em; margin-right: 0.6em; }
.corner-addr { font: 700 calc(var(--u) * 1.05) var(--body); color: var(--paper, #fff8e7); text-shadow: 0 2px 6px var(--ink); white-space: nowrap; }
.corner-addr b { font-size: 1.25em; letter-spacing: 0.08em; }

/* the line (M23): a quiet mark once it has been down 1.5 s; a room at rest (M6) dims the screen */
.linemark { position: fixed; z-index: 30; left: calc(var(--safe) * 0.4); bottom: calc(var(--safe) * 0.4); width: 10px; height: 10px; border-radius: 50%; background: var(--bad, #ff5a4a); opacity: 0.6; pointer-events: none; }
body.rest #stage, body.rest .screen, body.rest .corner, body.rest .callouts, body.rest .gifs { opacity: 0.18; transition: opacity 2s; }
body.rest .corner { display: none; }
.oldtv { position: fixed; z-index: 99998; left: 0; top: 0; right: 0; bottom: 0; background: var(--ink); color: var(--paper); font: 700 32px system-ui, sans-serif; padding: 15vh 10vw; }

/* ==== the flat look (default; ?tweaks look=night turns it off) ==============================================
   After Floor Melt: one colour pair, hazard yellow and ink. Ink panels with yellow type, ink outlines, the
   house green only where you can act. No gradients, no glow, no tilt, one face (Space Grotesk). */
html.flat {
  --field: #ffd000; --ink: #111111; --paper: #fff8e7; --shade: #e0a800; --act: #81b64c;
  --hot: #111111; --hot-dark: #111111; --cool: #111111; --good: #81b64c; --bad: #ff3b30;
  --display: "Space Grotesk", system-ui, sans-serif;
  color-scheme: light;
}
html.flat, html.flat body { background: var(--field); color: var(--ink); }
html.flat .btn {
  font: 700 calc(var(--u) * 1.5) var(--body); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--field); background: var(--ink); border: 0.14em solid var(--ink); border-radius: 0.35em;
  padding: 0.7em 1.4em; box-shadow: none; transform: none; transition: transform 0.08s, background 0.12s;
}
html.flat .btn:hover { filter: none; transform: translateY(-2px); }
html.flat .btn:active { transform: translateY(1px) scale(0.98); box-shadow: none; }
html.flat .btn:focus-visible { outline: 0.16em solid var(--ink); outline-offset: 0.22em; }
html.flat .btn.cool { background: transparent; color: var(--ink); box-shadow: none; }
html.flat .btn.cool:active { box-shadow: none; }
html.flat .btn.act, html.flat .lockbtn { background: var(--act); color: var(--ink); border-color: var(--act); }
html.flat .btn:disabled { filter: none; opacity: 0.35; }
html.flat .textlink { color: var(--ink); opacity: 0.8; }
html.flat .chip { background: var(--ink); color: var(--field); border: 0; font-family: var(--body); }

/* the door */
html.flat body.tv #door { background: none; }
html.flat .wordmark { filter: none; max-width: 92vw; }
html.flat .door-line { text-shadow: none; font-weight: 500; }
html.flat .join-row input { font: 700 calc(var(--u) * 1.5) var(--body); letter-spacing: 0.3em; background: transparent; color: var(--ink); border: 0.14em solid var(--ink); border-radius: 0.35em; box-shadow: none; padding: 0.7em 0.4em 0.7em 0.7em; }
html.flat .join-row input::placeholder { color: rgba(17, 17, 17, 0.4); }
html.flat body.touch #hostBtn { background: transparent; color: var(--ink); border-color: var(--ink); }

/* the lobby */
html.flat .join-cta { color: var(--ink); }
html.flat .qr { background: var(--paper); border-color: var(--paper); border-radius: 0.4em; box-shadow: 0 0 0 0.3em var(--ink); transform: none; }
html.flat .join-code { font: 700 calc(var(--u) * 6.4) var(--body); color: var(--field); background: var(--ink); text-shadow: none; letter-spacing: 0.22em; padding: 0.08em 0.1em 0.08em 0.32em; border-radius: 0.12em; display: inline-block; }
html.flat .tvseg { background: transparent; border: 3px solid var(--ink); border-radius: 0.4em; }
html.flat .tvseg button { color: var(--ink); border-radius: 0.2em; }
html.flat .tvseg button.on { background: var(--ink); color: var(--field); }
html.flat .tvseg button:focus-visible { outline-color: var(--ink); }
html.flat .team { background: transparent; border: 3px solid var(--ink); border-radius: 0.4em; }
html.flat .team h3 { font: 700 calc(var(--u) * 1.4) var(--body); color: var(--ink); letter-spacing: 0.04em; }
html.flat .team h3::before { content: ""; width: 0.8em; height: 0.8em; background: var(--c); display: inline-block; margin-right: 0.4em; vertical-align: -0.05em; }
html.flat .team h3 { justify-content: flex-start; }
html.flat .team h3 small { margin-left: auto; background: var(--ink); color: var(--field); }
html.flat .pcard { background: var(--ink); color: var(--field); border: 0; border-radius: 0.35em; animation: flatpop 0.3s ease-out; }
html.flat .pcard .boss { font: 700 0.62em var(--body); letter-spacing: 0.1em; text-transform: uppercase; background: var(--field); color: var(--ink); border: 2px solid var(--ink); border-radius: 0.3em; top: -0.75em; }
html.flat .empty { opacity: 0.7; font-weight: 500; }
@keyframes flatpop { from { transform: translateY(0.6em); opacity: 0; } }

/* the match HUD */
html.flat .round, html.flat .wind-label, html.flat .clock { text-shadow: none; color: var(--ink); }
html.flat .wind-label { font: 700 calc(var(--u) * 1.3) var(--body); letter-spacing: 0.14em; text-transform: uppercase; }
html.flat .clock { color: var(--ink); }
html.flat .clock.hurry { color: var(--field); background: var(--ink); border-radius: 0.12em; padding: 0 0.12em; animation: none; }
html.flat .shot { background: var(--ink); color: var(--field); border: 0; border-radius: 0.35em; font: 700 calc(var(--u) * 1.25) var(--body); letter-spacing: 0.04em; animation: flatpop 0.3s ease-out backwards; }
html.flat .shot canvas { background: var(--field); border-radius: 0.25em; }
html.flat .banner { color: var(--ink); text-shadow: none; font: 700 calc(var(--u) * 6) var(--body); letter-spacing: 0.04em; text-transform: uppercase; }
@keyframes flatBanner { 0% { opacity: 0; transform: scale(1.4); } 12% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
html.flat .banner.on { animation: flatBanner 1.8s both; }
html.flat .chip-p { background: var(--ink); color: var(--field); border: 0; border-top: 0.32em solid var(--c); border-radius: 0.3em; }
html.flat .chip-p .nm { color: var(--paper); }
html.flat .chip-p.inkseat { border-top-style: dashed; border-top-color: var(--paper); }
html.flat .erow.inkseat { border-left-style: dashed; border-left-color: var(--paper); }
html.flat .chip-p .light { border: 2px solid var(--field); background: transparent; }
html.flat .chip-p.locked .light { background: var(--act); border-color: var(--act); box-shadow: none; }
html.flat .chip-p .kd { opacity: 0.85; }
html.flat .chip-p .sc { color: var(--field); }
html.flat .chip-p.off { opacity: 0.45; }
html.flat .chip-p .delta { font: 700 1.1em var(--body); border: 0; border-radius: 0.25em; }
html.flat .chip-p .delta.up { background: var(--act); }
html.flat .chip-p .delta.down { background: var(--bad); color: var(--paper); }
html.flat .teamcol { background: transparent; border: 3px solid var(--ink); border-radius: 0.4em; }
html.flat .teamhead { color: var(--ink); font: 700 calc(var(--u) * 1.3) var(--body); }
html.flat .teamhead b { color: var(--ink); }

/* callouts: an ink slab, the player's colour as the bar under it, level */
html.flat .callout { transform: none; animation: flatSlam 2.2s both; display: flex; align-items: center; gap: 0.8em; white-space: nowrap; }
html.flat .callout span { font: 700 calc(var(--u) * (1.2 + 0.8 * var(--s))) var(--body); line-height: 1.1; letter-spacing: 0.02em; color: var(--field); background: var(--ink); -webkit-text-stroke: 0; text-shadow: none; padding: 0.12em 0.4em 0.08em; border-bottom: 0.16em solid var(--c); }
html.flat .callout small { font: 700 calc(var(--u) * 1.2) var(--body); color: var(--ink); -webkit-text-stroke: 0; margin: 0; letter-spacing: 0.12em; text-transform: uppercase; }
@keyframes flatSlam { 0% { opacity: 0; transform: scale(1.6); } 8% { opacity: 1; transform: scale(0.96); } 14% { transform: scale(1); } 85% { opacity: 1; } 100% { opacity: 0; transform: translateY(-0.4em); } }

/* the end */
html.flat .end-card { background: var(--ink); color: var(--field); border: 0; border-radius: 0.5em; box-shadow: none; }
html.flat .end-title { color: var(--field); text-shadow: none; font: 700 calc(var(--u) * 3.4) var(--body); animation: flatpop 0.4s ease-out; }
html.flat .erow { background: transparent; border-left-color: var(--c); color: var(--paper); border-radius: 0; border-bottom: 1px solid rgba(255, 208, 0, 0.18); }
html.flat .erow span { color: var(--paper); }
html.flat .erow b { color: var(--field); }
html.flat .end-hint { color: var(--field); font-weight: 500; }
html.flat .replay-tag { font: 700 calc(var(--u) * 1.3) var(--body); letter-spacing: 0.1em; text-transform: uppercase; background: var(--ink); color: var(--field); border: 0; transform: none; }

/* sheets, tweaks, the shelf close, the corner */
html.flat .sheet-wrap { background: rgba(17, 17, 17, 0.5); }
html.flat .sheet { background: var(--field); color: var(--ink); border: 4px solid var(--ink); border-radius: 0.5em; box-shadow: none; }
html.flat .sheet h2 { font: 700 28px var(--body); color: var(--ink); }
html.flat .crow { border-bottom-color: rgba(17, 17, 17, 0.2); }
html.flat .crow b a { color: var(--ink); }
html.flat .tweaks { background: var(--ink); border-color: var(--ink); color: var(--paper); }
html.flat .tweaks b { font-family: var(--body); color: var(--field); }
html.flat .tw-row button.on { background: var(--field); color: var(--ink); }
html.flat .tw-pill { background: var(--ink); color: var(--field); border-color: var(--ink); }
html.flat .shelf-x { background: var(--ink); color: var(--field); border-color: var(--ink); }
html.flat .corner { opacity: 0.8; }
html.flat .corner-addr { color: var(--ink); text-shadow: none; }
html.flat .gifs img { border-color: var(--paper); background: var(--paper); box-shadow: 0.35em 0.35em 0 var(--ink); border-radius: 0.2em; }
html.flat .gifs figcaption { font: 700 calc(var(--u) * 1.2) var(--body); color: var(--ink); -webkit-text-stroke: 0; }
html.flat body.rest #stage, html.flat body.rest .screen { opacity: 0.35; }
html.flat .pcard { background: var(--paper); color: var(--ink); }
html.flat .pcard canvas { width: calc(var(--u) * 3.4); height: calc(var(--u) * 3.1); }
html.flat .btn:disabled { background: transparent; color: var(--ink); border-color: var(--ink); opacity: 0.3; }
html.flat input:focus-visible, html.flat input:focus { outline: 3px solid var(--ink); outline-offset: 2px; }
/* flat door: the shelf shows whole cards and the demo plays below the column (frame() measures it) */
html.flat #door .shelf { max-height: none; overflow: visible; }
html.flat body.tv #door { justify-content: flex-start; padding-top: max(var(--safe), 4vh); gap: calc(var(--u) * 1.3); overflow-y: auto; }
html.flat .shot canvas { width: calc(var(--u) * 5.2); height: calc(var(--u) * 5.2); }

/* the flat field can change (?bg): the phone's look sheet follows it where the browser can mix colours */
html.flat body .look { background: color-mix(in srgb, var(--field) 92%, transparent); }

/* ---- Back mid-game asks first: the Leave panel over the game (spec 10-09) ----
   No flex gap, inset or :focus-visible (Chromium 56 TVs): margins and a .on class carry the focus ring. */
.leave-wrap { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(17, 17, 17, 0.55); }
.leave-wrap[hidden] { display: none; }
.leave { background: var(--ink); color: var(--field, #ffd000); border-radius: calc(var(--u) * 1.2); padding: calc(var(--u) * 3.2) calc(var(--u) * 4); text-align: center; box-shadow: calc(var(--u) * 0.6) calc(var(--u) * 0.6) 0 rgba(0, 0, 0, 0.35); }
.leave h2 { margin: 0 0 calc(var(--u) * 2.6); font: 700 calc(var(--u) * 4.2) var(--display); color: var(--field, #ffd000); line-height: 1.1; white-space: nowrap; }
.leave-row { display: flex; justify-content: center; }
.leave-btn { margin: 0 calc(var(--u) * 0.9); font: 700 calc(var(--u) * 2) var(--body); letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap;
  padding: 0.7em 1.4em; border-radius: 0.35em; border: calc(var(--u) * 0.25) solid var(--field, #ffd000); cursor: pointer; outline: none; }
.leave-btn.stay { background: var(--field, #ffd000); color: var(--ink); }
.leave-btn.go { background: transparent; color: var(--field, #ffd000); }
.leave-btn.on { box-shadow: 0 0 0 calc(var(--u) * 0.35) var(--ink), 0 0 0 calc(var(--u) * 0.75) var(--paper, #fff8e7); }

/* /solo: the board on top of one phone. Nobody else joins, so no QR, room code, invite or way back
   to the TV shelf; the lobby is only there for the second it takes the match to start */
body.solo #lobby .qr, body.solo #lobby .join-cta, body.solo #backLink, body.solo #preview, body.solo #corner { display: none !important; }

/* Play now: one phone against the bots (/solo), first and widest on the door */
#soloBtn { order: -1; text-decoration: none; text-align: center; display: inline-block; }
@media (max-width: 760px) { body.tv #soloBtn { width: 100%; font-size: 22px; } }
/* the gameaday shelf is switched off in every game; its box and close button go with it */
.shelfbox:has(> #shelf:empty) { display: none !important; }
/* the TV landing's way into a one-screen game against the bots, under the QR */
.solo-link { margin-top: calc(var(--u) * 1.4); text-decoration: none; display: inline-block; font-size: calc(var(--u) * 1.1); }
body.solo .solo-link { display: none !important; }
