@font-face { font-family: "Marcellus"; src: url("/fonts/Marcellus-400.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("/fonts/SourceSerif4.woff2") format("woff2"); font-weight: 200 900; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/IBMPlexMono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

/* The night temple: the party is usually played in a dim room on a TV */
:root {
  --stone: #141413;
  --recess: #1e1d1b;
  --raised: #282724;
  --rule: #3a3834;
  --ink: #ecebe5;
  --muted: #a9a69c;
  --brass: #d19f72;
  --brass-deep: #8a5a2b;
  --doom: #e2867c;
  --a: #7fb0d8;
  --b: #d8a07f;
  --ok: #8fc79a;
  --carved: "Marcellus", "Trajan Pro", Georgia, serif;
  --scripture: "Source Serif 4", Georgia, serif;
  --ledger: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--stone);
  color: var(--ink);
  font: 18px/1.45 var(--scripture);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
main { min-height: 100dvh; display: flex; flex-direction: column; }
h1, h2, h3, .carved { font-family: var(--carved); font-weight: 400; letter-spacing: .02em; margin: 0; }
p { margin: 0; }
.pad { padding: 20px 16px; }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; }
.grow { flex: 1; }
.hidden { display: none !important; }

button, .btn {
  font: 20px/1 var(--carved);
  letter-spacing: .03em;
  color: var(--stone);
  background: var(--brass);
  border: 0;
  border-radius: 2px;
  padding: 18px 20px;
  min-height: 60px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  touch-action: manipulation;
}
button:active { transform: translateY(1px); filter: brightness(.92); }
button:disabled { background: var(--raised); color: var(--muted); cursor: default; }
button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--rule); }
button.small { font-size: 16px; min-height: 44px; padding: 10px 14px; }
input, textarea {
  font: 22px/1.3 var(--scripture);
  color: var(--ink);
  background: var(--recess);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 14px;
  width: 100%;
}
input:focus, textarea:focus { outline: 2px solid var(--brass); outline-offset: 1px; }
textarea { resize: none; min-height: 110px; }
input.code { font: 34px/1 var(--ledger); letter-spacing: .3em; text-transform: uppercase; text-align: center; }
label { font-size: 15px; color: var(--muted); display: block; margin-bottom: 6px; }
.error { color: var(--doom); min-height: 1.4em; }

/* Landing */
.landing { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 32px; padding: 32px 16px; max-width: 460px; margin: 0 auto; width: 100%; }
.title { text-align: center; }
.title img { width: 96px; height: 96px; image-rendering: auto; }
.title h1 { font-size: 40px; margin-top: 8px; }
.title p { color: var(--muted); margin-top: 6px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 15px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

/* Phone */
.phone { flex: 1; display: flex; flex-direction: column; max-width: 520px; margin: 0 auto; width: 100%; }
.bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--rule); font-size: 15px; color: var(--muted); }
.bar img { width: 32px; height: 32px; }
.bar .me { color: var(--ink); font-family: var(--carved); font-size: 18px; }
.screen { flex: 1; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 18px; }
.screen.mid { justify-content: center; text-align: center; }
.big-face { width: 128px; height: 128px; margin: 0 auto; }
.faces { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.faces button { background: var(--recess); padding: 4px; min-height: 0; aspect-ratio: 1; border: 2px solid transparent; }
.faces button[aria-pressed="true"] { border-color: var(--brass); background: var(--raised); }
.faces img { width: 100%; height: 100%; object-fit: contain; }
.prompt { font-family: var(--carved); font-size: 24px; line-height: 1.3; }
.count { font: 15px var(--ledger); color: var(--muted); }
.timer { height: 6px; background: var(--recess); border-radius: 3px; overflow: hidden; }
.timer i { display: block; height: 100%; background: var(--brass); width: 100%; transform-origin: left; }
.choice { width: 100%; text-align: left; justify-content: flex-start; font: 21px/1.35 var(--scripture); padding: 18px; min-height: 80px; color: var(--ink); background: var(--recess); border: 2px solid var(--rule); }
.choice.a { border-color: var(--a); }
.choice.b { border-color: var(--b); }
.choice[aria-pressed="true"] { background: var(--raised); border-color: var(--brass); }
.choice:disabled { color: var(--muted); }
.verse { font-style: italic; color: var(--muted); font-size: 16px; }

/* Host screen: built for a TV across the room */
.host { flex: 1; display: flex; flex-direction: column; padding: 3vh 4vw; gap: 3vh; font-size: clamp(18px, 1.6vw, 34px); }
.host-top { display: flex; justify-content: space-between; align-items: center; gap: 24px; color: var(--muted); font-size: .8em; }
.host-top .carved { color: var(--ink); font-size: 1.3em; }
.host-body { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 3vh; }
.join-box { display: grid; grid-template-columns: auto 1fr; gap: 4vw; align-items: center; }
.qr { background: #ecebe5; padding: 14px; border-radius: 2px; width: clamp(150px, 17vw, 320px); aspect-ratio: 1; }
.qr svg, .qr img { width: 100%; height: 100%; display: block; }
.join-box .code { font: clamp(56px, 8vw, 160px)/1 var(--ledger); letter-spacing: .12em; color: var(--brass); }
.join-box .url { font-family: var(--ledger); font-size: 1.1em; }
.seats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2vw; }
.seat { display: flex; flex-direction: column; align-items: center; gap: .4em; padding: 1.2vw; background: var(--recess); border-radius: 2px; min-height: 6.5vw; justify-content: center; position: relative; }
.seat img { width: 4.2vw; height: 4.2vw; min-width: 48px; min-height: 48px; }
.seat .name { font-family: var(--carved); text-align: center; word-break: break-word; }
.seat.empty { border: 1px dashed var(--rule); background: transparent; color: var(--rule); }
.seat.away { opacity: .45; }
.seat.done::after { content: "\2713"; position: absolute; top: .4em; right: .6em; color: var(--ok); font-size: 1.2em; }
.seat .score { font-family: var(--ledger); color: var(--brass); }
.kick { position: absolute; top: 4px; right: 4px; background: transparent; color: var(--muted); min-height: 0; padding: 4px 8px; font-size: 16px; }
.host-prompt { font-family: var(--carved); font-size: clamp(32px, 3.6vw, 76px); line-height: 1.2; text-align: center; max-width: 22ch; margin: 0 auto; }
.host-sub { text-align: center; color: var(--muted); }
.face-off { display: grid; grid-template-columns: 1fr 1fr; gap: 3vw; }
.answer { background: var(--recess); border-top: 6px solid var(--a); padding: 3vh 2vw; font-size: 1.5em; min-height: 22vh; display: flex; flex-direction: column; gap: 2vh; justify-content: space-between; }
.answer.b { border-top-color: var(--b); }
.who { display: flex; align-items: center; gap: .5em; font-size: .6em; font-family: var(--carved); color: var(--muted); }
.who img { width: 2em; height: 2em; }
.answer .pts { font: .7em var(--ledger); color: var(--brass); }
.answer.win { background: var(--raised); }
.favour { text-align: center; color: var(--brass); font-family: var(--carved); font-size: 1.2em; }
.voters { display: flex; gap: .3em; flex-wrap: wrap; }
.voters img { width: 1.6em; height: 1.6em; }
.board { display: flex; flex-direction: column; gap: 1.2vh; max-width: 60vw; margin: 0 auto; width: 100%; }
.board .line { display: grid; grid-template-columns: 2em 2.4em 1fr auto; gap: 1em; align-items: center; background: var(--recess); padding: 1vh 1.2vw; }
.board .line img { width: 2.2em; height: 2.2em; }
.board .line .pts { font-family: var(--ledger); color: var(--brass); }
.board .line.first { background: var(--raised); outline: 1px solid var(--brass-deep); }
.finals { display: grid; grid-template-columns: repeat(auto-fit, minmax(22vw, 1fr)); gap: 1.5vw; }
.finals .answer { min-height: 14vh; font-size: 1.15em; border-top-color: var(--brass-deep); }
.host-timer { height: 1vh; min-height: 8px; }
.host-controls { display: flex; justify-content: center; gap: 16px; }
.blink { animation: blink 14s infinite; }
@keyframes blink { 0%, 97%, 100% { transform: scaleY(1); } 98.5% { transform: scaleY(.1); } }
.pop { animation: pop .35s ease-out both; }
@keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pop, .blink { animation: none; } }

@media (max-width: 800px) {
  .host { font-size: 18px; padding: 16px; }
  .join-box { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .seats { grid-template-columns: repeat(2, 1fr); }
  .face-off { grid-template-columns: 1fr; }
  .board { max-width: none; }
}

/* ---------- Battle of the Bands: the same temple, played loud ---------- */
@font-face { font-family: "Metal Mania"; src: url("/fonts/MetalMania-400.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "New Rocker"; src: url("/fonts/NewRocker-400.woff2") format("woff2"); font-display: swap; }
body.metal {
  --stone: #0b0a0a;
  --recess: #171313;
  --raised: #241a1a;
  --rule: #3d2a2a;
  --brass: #d9483b;
  --brass-deep: #7d1f18;
  --a: #c9ccd1;
  --b: #d9483b;
  --carved: "New Rocker", "Marcellus", Georgia, serif;
  background: radial-gradient(ellipse at 50% -20%, #3a0f0c 0%, var(--stone) 60%) fixed var(--stone);
}
body.metal .game-title, body.metal .host-prompt, body.metal .prompt, body.metal h1, body.metal h2 { font-family: "Metal Mania", var(--carved); letter-spacing: .03em; }
body.metal .host-prompt { text-shadow: 0 0 24px rgba(217, 72, 59, .35); }
body.metal button:not(.ghost):not(.choice):not(.kick) { color: #fff; }
body.metal .answer span:first-child { font-family: "New Rocker", var(--scripture); }
.band-inline { font-family: "Metal Mania", serif; font-weight: 400; font-size: 1.2em; }

.covers { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(16vw, 260px), 1fr)); gap: 2vw; }
.cover {
  margin: 0; position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 2px;
  background: hsl(var(--hue) 50% 8%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(255, 255, 255, .06);
  display: flex; align-items: center; justify-content: center;
}
.cover::before { content: ""; position: absolute; inset: 0; }
.cover.sun::before { background: radial-gradient(circle at 78% 24%, hsl(var(--hue) 80% 45%) 0 11%, transparent 11.5%), linear-gradient(hsl(var(--hue) 40% 12%), #050404); }
.cover.void::before { background: repeating-radial-gradient(circle at 50% 45%, hsl(var(--hue) 30% 14%) 0 2px, #050404 3px 9px); }
.cover.fire::before { background: linear-gradient(0deg, hsl(calc(var(--hue) + 20) 90% 40%), hsl(var(--hue) 70% 18%) 45%, #050404 80%); }
.cover.torn::before { background: conic-gradient(from 200deg at 50% 60%, #050404, hsl(var(--hue) 45% 22%), #050404, hsl(var(--hue) 45% 16%), #050404); }
.cover img {
  z-index: 1;
  position: relative; width: 58%; height: 58%; object-fit: contain;
  filter: grayscale(1) contrast(1.8) brightness(.85);
  mix-blend-mode: screen; opacity: .85;
}
.cover figcaption { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 7% 6%; text-align: center; }
.cover .band {
  font-family: "Metal Mania", serif; color: #f1ece4; line-height: 1;
  font-size: clamp(22px, 2.6vw, 52px);
  text-shadow: 0 2px 0 #000, 0 0 18px hsl(var(--hue) 90% 45% / .8);
  word-break: break-word;
}
.cover .album { font-family: "New Rocker", serif; color: hsl(var(--hue) 60% 80%); font-size: clamp(13px, 1.2vw, 24px); text-shadow: 0 1px 0 #000; }
@media (max-width: 800px) { .covers { grid-template-columns: repeat(2, 1fr); } .cover .band { font-size: 22px; } }

/* The Sacrifice */
.fates { grid-template-columns: 1fr auto 1fr; align-items: center; }
.fates .or { font-size: 1.4em; color: var(--muted); }
.fate { font-size: 1.6em; min-height: 26vh; justify-content: center; text-align: center; }
.fate .pts { font: .8em var(--ledger); color: var(--brass); }
.fate .voters { justify-content: center; }
.emo { height: 1.3em; width: auto; vertical-align: -0.25em; }
@media (max-width: 800px) { .fates { grid-template-columns: 1fr; } }

/* The Obituary: a newspaper notice */
.obit {
  background: #ece6d6; color: #1c1b19; max-width: 34em; margin: 0 auto; padding: 2.2vh 2.4vw 2.6vh;
  text-align: center; border-top: 6px double #1c1b19; border-bottom: 6px double #1c1b19;
  font-family: var(--scripture); box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.obit .ob-head { font-family: var(--carved); letter-spacing: .3em; text-transform: uppercase; font-size: .8em; color: #5d5a52; }
.obit .ob-portrait { width: 5em; height: 5em; filter: grayscale(1) contrast(1.2); margin: 1vh auto; display: block; border: 1px solid #1c1b19; }
.obit .ob-name { font-family: var(--carved); font-size: 1.8em; margin: .2em 0 .4em; }
.obit p { margin: .35em 0; }
.obit .ob-life { font-style: italic; }
.obit b { font-family: var(--carved); font-weight: 400; letter-spacing: .05em; }
.obit .emo { filter: grayscale(1); }
.obit .who { color: #5d5a52; margin-top: 1vh; font-size: .8em; }
.obit .who .pts { color: #8a5a2b; }
.obits { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(22vw, 360px), 1fr)); gap: 1.5vw; align-items: start; }
.obit.small { font-size: .62em; padding: 1.4vh 1.2vw; }
.ob-sofar { background: var(--recess); padding: 12px 14px; border-left: 3px solid var(--brass); }
.ob-sofar p { margin: 4px 0; }
.ob-sofar .count { margin: 0 0 6px; }
.choice small { color: var(--muted); font-size: .8em; }
.obit .ob-best { margin-top: 1vh; color: #8a5a2b; font-size: .9em; }
.obits { grid-template-columns: repeat(auto-fit, minmax(min(20vw, 340px), 1fr)); }
.obits.many { grid-template-columns: repeat(4, 1fr); }
.obits.many .obit.small { font-size: .46em; }
.obits.many .ob-portrait { display: none; }
