@font-face {
  font-family: 'Saira Stencil One';
  src: url('/fonts/saira-stencil-one.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Schibsted Grotesk';
  src: url('/fonts/schibsted-grotesk.woff2') format('woff2');
  font-weight: 400 900;
  font-display: swap;
}

/* One ground, one ink, one accent, set per city in city.json. Kept calm for long looks. */
:root {
  color-scheme: dark;
  --ground: #10302b;
  --ground-deep: #0a221e;
  --ink: #f3f1e7;
  --ink-soft: #c3d0c8;
  --accent: #f2a65a;
  --on-accent: #10302b;
  --display: 'Saira Stencil One', Impact, 'Arial Black', sans-serif;
  --body: 'Schibsted Grotesk', 'Helvetica Neue', Arial, sans-serif;
  --gutter: clamp(16px, 4vw, 56px);
}
@media (prefers-color-scheme: dark) {
  :root { --ground: #0d2925; --ground-deep: #071a17; --on-accent: #0d2925; }
}

* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--ground);
  color: var(--ink);
  font: 500 1.0625rem/1.45 var(--body);
  font-synthesis: none;
}
html { overflow-x: clip; }
[hidden] { display: none !important; }
a { color: inherit; text-underline-offset: 0.2em; }
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* The home page: the claim on the left, the proof on the right. */
.home {
  flex: 1;
  width: 100%;
  max-width: 1500px;
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(32px, 5vw, 88px);
  padding: clamp(24px, 4vw, 56px) var(--gutter);
  align-items: start;
}
.pitch { position: sticky; top: clamp(24px, 4vw, 56px); container-type: inline-size; }

/* A poster lockup: each line is sized so all three fill the same width. */
h1 {
  font: 400 min(18cqw, 15.5vh)/0.98 var(--display);
  text-transform: uppercase;
}
h1 span, h1 em { display: block; font-style: normal; white-space: nowrap; }
h1 span { font-size: 1.01em; }
h1 .city { color: var(--accent); }
h1 .most { font-size: 2em; line-height: .92; }
h1 .city { font-size: 0.76em; }
.played h1 { font-size: min(9cqw, 9vh); }

.panel { margin-top: clamp(24px, 3vw, 44px); max-width: 34rem; }
.lede { font-size: clamp(1.125rem, 1.6vw, 1.375rem); font-weight: 500; line-height: 1.35; }

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 60px;
  margin-top: 24px;
  padding: 10px 28px;
  border: 0;
  background: var(--accent);
  color: var(--on-accent);
  font: 400 1.375rem/1 var(--display);
  text-transform: uppercase;
  white-space: nowrap;
  text-decoration: none;
  transition: transform 140ms cubic-bezier(.2, .8, .2, 1);
}
.cta:hover { transform: translateY(-2px); }
.cta:active { transform: translateY(1px) scale(.99); }
.cta[disabled] { opacity: .55; cursor: progress; transform: none; }
.cta svg { width: .8em; height: .8em; fill: currentColor; }

.ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  min-height: 48px;
  padding: 8px 16px;
  border: 2px solid currentColor;
  background: none;
  font-weight: 700;
  text-decoration: none;
}
.ghost:hover { background: var(--ink); color: var(--ground); }
.ghost svg { width: 1.1em; height: 1.1em; fill: currentColor; }

/* The result, which replaces the pitch once you have played. */
.title-won {
  font: 400 clamp(2.25rem, 4.6vw, 4rem)/1 var(--display);
  text-transform: uppercase;
  color: var(--accent);
}
.result-line { margin-top: 10px; font-size: 1.125rem; }
.result-line strong { font-weight: 800; }
.grid { display: flex; gap: 6px; margin-top: 16px; }
.grid span {
  width: 44px; height: 44px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
}
.grid svg { width: 22px; height: 22px; fill: currentColor; }
.grid .hit { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.tomorrow { margin-top: 16px; font-weight: 700; }

/* Choosing a name for the table. */
.claim { margin-top: 28px; padding: 20px; background: var(--ground-deep); }
.claim h2 { font: 400 1.5rem/1 var(--display); text-transform: uppercase; }
.claim p { margin-top: 6px; font-size: 1rem; color: var(--ink-soft); }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.fields .wide { grid-column: 1 / -1; }
.fields label { display: block; margin-bottom: 4px; font-size: 0.9375rem; font-weight: 700; }
.fields select {
  width: 100%;
  min-height: 48px;
  padding: 8px 10px;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--ground);
  font-weight: 600;
}
.claim .cta { margin-top: 16px; min-height: 52px; font-size: 1.125rem; }
.claim .error { margin-top: 10px; font-weight: 700; }

/* The table. */
.league { min-width: 0; }
.league-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; }
.league h2 { font: 400 clamp(2rem, 3vw, 2.75rem)/1 var(--display); text-transform: uppercase; }
.tabs { display: flex; gap: 2px; }
.tabs button {
  min-height: 44px;
  padding: 6px 12px;
  border: 0;
  background: var(--ground-deep);
  font-size: 0.9375rem;
  font-weight: 700;
}
.tabs button[aria-pressed='true'] { background: var(--ink); color: var(--ground-deep); }

/* Banner above the play button: an invite or a dare from a mate. */
.invite { margin-top: clamp(20px, 3vw, 36px); padding: 18px 20px; max-width: 34rem; background: var(--ground-deep); border-left: 6px solid var(--accent); }
.invite + .panel { margin-top: 20px; }
.invite strong { display: block; font: 400 1.5rem/1.1 var(--display); text-transform: uppercase; color: var(--accent); }
.invite p { margin-top: 6px; }
.invite .cta { margin-top: 14px; min-height: 52px; font-size: 1.125rem; }
.invite .claim { margin-top: 14px; padding: 0; background: none; }

/* Mate leagues and the area race, inside the table column. */
.note { margin-top: 18px; }
.note strong { font-weight: 800; }
.mates-list { margin-top: 18px; display: grid; gap: 8px; padding: 0; list-style: none; }
.mates-list button {
  width: 100%;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border: 2px solid var(--ink);
  background: none;
  text-align: left;
  font-weight: 800;
}
.mates-list button:hover { background: var(--ink); color: var(--ground); }
.mates-list span { flex: none; font-size: 0.9375rem; font-weight: 600; }
.league-title { margin-top: 18px; font: 400 clamp(1.5rem, 2.4vw, 2rem)/1.1 var(--display); text-transform: uppercase; color: var(--accent); }
.league-meta { margin-top: 4px; color: var(--ink-soft); font-size: 0.9375rem; }
.back-link { min-height: 44px; margin-top: 8px; padding: 8px 0; border: 0; background: none; font-weight: 700; text-decoration: underline; text-underline-offset: 0.2em; }
.switch { display: flex; gap: 2px; margin-top: 14px; }
.switch button { min-height: 44px; padding: 6px 12px; border: 0; background: var(--ground-deep); font-size: 0.9375rem; font-weight: 700; }
.switch button[aria-pressed='true'] { background: var(--ink); color: var(--ground-deep); }
.league-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.quiet { min-height: 44px; padding: 8px 0; border: 0; background: none; color: var(--ink-soft); font-size: 0.9375rem; font-weight: 600; text-decoration: underline; text-underline-offset: 0.2em; }

table { width: 100%; margin-top: 18px; border-collapse: collapse; }
caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
th { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
td { padding: 9px 10px; vertical-align: middle; }
.rank { width: 3.2rem; font: 400 1.5rem/1 var(--display); text-align: right; padding-right: 14px; }
.who { width: 100%; overflow-wrap: anywhere; }
.who b { display: block; font-size: 1.0625rem; font-weight: 800; line-height: 1.2; }
.who span { display: block; font-size: 0.9375rem; color: var(--ink-soft); }
.pts { font: 400 1.375rem/1 var(--display); text-align: right; white-space: nowrap; }

/* Number one is the only row that shouts. */
tr.first td { background: var(--accent); color: var(--on-accent); padding-block: 16px; }
tr.first .rank { font-size: 2.25rem; }
tr.first .pts { font-size: 1.875rem; }
tr.first .who b { font-size: 1.25rem; }
tr.first .who span { color: var(--on-accent); }
tr.you td { background: var(--ground-deep); }
tr.you .who b::after { content: ' (you)'; font-weight: 600; }
tr.first.you td { background: var(--accent); }
tr.gap td { padding: 0; height: 18px; }

.empty, .fail { margin-top: 18px; padding: 28px 20px; background: var(--ground-deep); }
.empty strong { display: block; font: 400 1.625rem/1.05 var(--display); text-transform: uppercase; color: var(--accent); }
.empty p { margin-top: 8px; }
.fail .ghost { margin-top: 12px; }

.skeleton { margin-top: 18px; display: grid; gap: 10px; }
.skeleton span { display: block; height: 52px; background: var(--ground-deep); }

/* The question screen. */
.game { flex: 1; display: flex; flex-direction: column; }
.clock { height: 10px; }
.clock span { display: block; height: 100%; background: var(--accent); transform-origin: left; }
.game-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  width: 100%;
  max-width: 980px;
  margin-inline: auto;
  padding: 18px var(--gutter) 0;
  font: 400 1.125rem/1 var(--display);
  text-transform: uppercase;
}
.seconds { font-size: 2rem; }
.seconds.low { color: var(--accent); }
.game-body {
  flex: 1;
  width: 100%;
  max-width: 980px;
  margin-inline: auto;
  padding: clamp(16px, 4vh, 44px) var(--gutter) 40px;
}
.game h2 {
  font: 800 clamp(1.75rem, 4.2vw, 3.25rem)/1.08 var(--body);
  letter-spacing: -0.015em;
  outline: 0;
  overflow-wrap: break-word;
}
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: clamp(20px, 4vh, 36px); }
.option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 76px;
  padding: 12px 16px;
  border: 2px solid var(--ink);
  background: none;
  text-align: left;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.2;
  transition: transform 120ms cubic-bezier(.2, .8, .2, 1), background-color 120ms, color 120ms;
}
.option:hover:not([disabled]) { background: var(--ink); color: var(--ground); }
.option:active:not([disabled]) { transform: scale(.985); }
.option[disabled] { cursor: default; }
.option svg { flex: none; width: 24px; height: 24px; fill: currentColor; }
.option.right { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.option.wrong { border-style: dashed; }
.option.wrong span { text-decoration: line-through; }
.option.dim { color: var(--ink-soft); border-color: var(--ink-soft); }

.reveal { margin-top: 22px; }
.reveal .verdict { font: 400 1.75rem/1 var(--display); text-transform: uppercase; }
.reveal p { margin-top: 6px; max-width: 42rem; }
.reveal .crowd { color: var(--ink-soft); font-weight: 700; }
.reveal .cta { margin-top: 16px; }

/* Plain pages. */
.page { flex: 1; width: 100%; max-width: 44rem; margin-inline: auto; padding: 40px var(--gutter); }
.page h1 { font-size: clamp(2.75rem, 10vw, 4.5rem); }
.page h2 { margin-top: 28px; font: 400 1.375rem/1.1 var(--display); text-transform: uppercase; }
.page p { margin-top: 10px; }
.page .back { display: inline-block; margin-bottom: 20px; font-weight: 700; }

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 24px;
  padding: 6px var(--gutter);
  font-size: 0.9375rem;
  font-weight: 600;
}
.foot a { display: inline-block; padding-block: 13px; }
.noscript { padding: 16px var(--gutter); font-weight: 700; }

@media (max-width: 860px) {
  .home { grid-template-columns: minmax(0, 1fr); gap: 36px; padding-top: 24px; }
  .pitch { position: static; }
  h1 { font-size: 18cqw; }
  .played h1 { font-size: 9cqw; }
  .cta { width: 100%; }
  .claim .cta { width: 100%; }
}
@media (max-width: 560px) {
  .options { grid-template-columns: 1fr; gap: 8px; }
  .option { min-height: 60px; }
  .rank { width: 2.6rem; padding-inline: 4px 10px; }
  td { padding-inline: 8px; }
  .tabs { width: 100%; }
  .tabs button { flex: 1; padding-inline: 4px; }
}

/* Motion that says something: the title landing, a new row, a correct answer. */
@media (prefers-reduced-motion: no-preference) {
  .stamp { transform-origin: left center; animation: stamp 420ms cubic-bezier(.2, 1.4, .3, 1) both; }
  .rise { animation: rise 420ms cubic-bezier(.16, 1, .3, 1) both; animation-delay: calc(var(--i, 0) * 28ms); }
  .option.right { animation: pop 260ms cubic-bezier(.2, 1.4, .3, 1); }
}
@keyframes stamp { from { opacity: 0; transform: scale(1.06); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { 50% { transform: scale(1.025); } }
