@font-face {
  font-family: 'Anton';
  src: url('fonts/anton-400.woff2') format('woff2');
  font-weight: 400;
  font-display: block;
}
@font-face {
  font-family: 'Barlow Condensed';
  src: url('fonts/barlow-condensed-500.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow Condensed';
  src: url('fonts/barlow-condensed-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --floor: #0d2c30;
  --floor-2: #154248;
  --court-line: rgba(244, 241, 234, 0.07);
  --ink: #f4f1ea;
  --muted: #92b1ae;
  --yellow: #ffd23f;
  --red: #ff5a5f;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);
  --word-font: 'Anton', Impact, 'Arial Narrow', sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 70% at 50% 45%, var(--floor-2), var(--floor) 75%),
    var(--floor);
  color: var(--ink);
  font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  font-weight: 500;
}

.court {
  position: fixed;
  inset: 0;
  color: var(--court-line);
  pointer-events: none;
}
.court svg { width: 100%; height: 100%; display: block; }

.top, .clouds, .answer-bar { position: relative; z-index: 1; }

/* ---------- Header ---------- */
.top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 2rem;
  padding: 2.4vh 3vw 0;
}
.eyebrow {
  margin: 0 0 0.2em;
  color: var(--yellow);
  font-weight: 700;
  font-size: clamp(14px, 1.3vw, 24px);
  letter-spacing: 0.32em;
  text-transform: uppercase;
}
h1 {
  margin: 0;
  font-family: var(--word-font);
  font-weight: 400;
  font-size: clamp(30px, 4vw, 76px);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.counter {
  grid-column: 3;
  justify-self: end;
  margin: 0;
  color: var(--muted);
  font-size: clamp(16px, 1.6vw, 30px);
  white-space: nowrap;
}
.counter b {
  display: inline-block;
  margin-right: 0.15em;
  color: var(--ink);
  font-family: var(--word-font);
  font-weight: 400;
  font-size: 1.8em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.counter b.bump { animation: bump 0.6s var(--ease-back); }

/* ---------- Shot clock: counts down until the curtain drops ---------- */
.shot-clock {
  grid-column: 2;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 4px 18px 10px;
  border: 3px solid rgba(244, 241, 234, 0.14);
  border-radius: 14px;
  background: #06171a;
  animation: clock-in 0.4s var(--ease-back);
}
.shot-clock[hidden] { display: none; }
.shot-num {
  min-width: 2ch;
  color: #ff7a6b;
  font-family: var(--word-font);
  font-size: clamp(40px, 4.2vw, 80px);
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px rgba(255, 90, 95, 0.55);
}
.shot-clock.is-final .shot-num {
  color: #ff3b3b;
  text-shadow: 0 0 26px rgba(255, 59, 59, 0.9);
  animation: tick 1s ease-out infinite;
}
.shot-bar {
  display: block;
  width: 100%;
  min-width: 90px;
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(244, 241, 234, 0.12);
}
.shot-bar i {
  display: block;
  height: 100%;
  background: var(--yellow);
  transform-origin: left center;
}

/* ---------- Clouds ---------- */
.clouds {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2vw;
  min-height: 0;
  padding: 2.2vh 3vw;
}
.panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 1.8vh 1.4vw 1.4vh;
  border: 3px solid rgba(244, 241, 234, 0.1);
  border-radius: 22px;
  background: rgba(0, 0, 0, 0.2);
  transition: border-color 0.4s, box-shadow 0.4s;
}
.panel.is-active {
  border-color: var(--yellow);
  box-shadow: 0 0 0 6px rgba(255, 210, 63, 0.12), 0 0 60px rgba(255, 210, 63, 0.08);
}
.q-title {
  display: flex;
  align-items: center;
  gap: 0.55em;
  margin: 0;
  font-weight: 700;
  font-size: clamp(18px, 2vw, 38px);
  line-height: 1.1;
}
.q-num {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 1.6em;
  height: 1.6em;
  border-radius: 50%;
  background: rgba(244, 241, 234, 0.12);
  color: var(--ink);
  font-family: var(--word-font);
  font-weight: 400;
  transition: background 0.4s, color 0.4s;
}
.panel.is-active .q-num { background: var(--yellow); color: var(--floor); }

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  margin-top: 1vh;
  overflow: hidden;
  border-radius: 12px;
}
.cloud {
  position: absolute;
  inset: 0;
  overflow: hidden;
  transition: filter 0.9s var(--ease-out), opacity 0.9s var(--ease-out);
}
.clouds:not(.is-revealed) .cloud { filter: blur(18px); opacity: 0.35; }

/* The "skillevegg": the dividing curtain of a Norwegian sports hall.
   Netting at the top, pleated fabric below. Rolls up to reveal the cloud. */
.curtain {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0 8%;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.35), transparent 14%),
    repeating-linear-gradient(45deg, rgba(244, 241, 234, 0.13) 0 2px, transparent 2px 14px) top / 100% 22% no-repeat,
    repeating-linear-gradient(-45deg, rgba(244, 241, 234, 0.13) 0 2px, transparent 2px 14px) top / 100% 22% no-repeat,
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.22) 0 3px, transparent 3px 22px, rgba(255, 255, 255, 0.05) 22px 24px, transparent 24px 46px) bottom / 100% 78% no-repeat,
    linear-gradient(to bottom, rgba(10, 36, 40, 0.55) 22%, #103a3f 22.3%, #0b2c30);
  box-shadow: inset 0 -10px 0 #ffd23f;
  transform: translateY(0);
  transition: transform 0.9s var(--ease-out);
}
.clouds.is-revealed .curtain { transform: translateY(-102%); }
.curtain-text {
  max-width: 18ch;
  margin: 12% 0 0;
  color: var(--ink);
  font-weight: 700;
  font-size: clamp(22px, 2.4vw, 46px);
  line-height: 1.15;
  text-align: center;
  text-wrap: balance;
}
.cloud-word {
  position: absolute;
  top: 50%;
  left: 50%;
  font-family: var(--word-font);
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
  transition:
    transform 0.9s var(--ease-out),
    font-size 0.9s var(--ease-out),
    opacity 0.5s ease,
    scale 0.7s var(--ease-back);
}
.cloud-word.is-hidden { opacity: 0; scale: 0.2; }
.cloud-word.pulse { animation: pulse 1.6s ease-out; }


/* ---------- Answer bar ---------- */
.answer-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 1.4vw;
  margin: 0 3vw 3vh;
  padding: 1.6vh 1.2vw 1.6vh 1.6vh;
  border-radius: 24px;
  background: var(--ink);
  color: var(--floor);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
}
.step {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  grid-auto-flow: column;
  justify-content: center;
  align-items: baseline;
  min-width: 2.4em;
  padding: 0.12em 0.4em;
  border-radius: 16px;
  background: var(--yellow);
  font-family: var(--word-font);
  font-size: clamp(32px, 3.6vw, 68px);
  line-height: 1.1;
}
.step small { font-size: 0.45em; opacity: 0.6; }
.step span { display: inline-block; }
.step span.flip { animation: flip 0.45s var(--ease-back); }

.answer-bar label {
  grid-column: 2;
  font-weight: 700;
  font-size: clamp(16px, 1.7vw, 32px);
  line-height: 1.1;
}
.answer-bar input {
  grid-column: 2;
  width: 100%;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--floor);
  caret-color: var(--red);
  font-family: var(--word-font);
  font-size: clamp(34px, 4.4vw, 84px);
  line-height: 1.15;
}
.answer-bar input::placeholder { color: rgba(13, 44, 48, 0.22); }
.answer-bar button {
  grid-column: 3;
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: clamp(56px, 5vw, 96px);
  aspect-ratio: 1;
  border: 0;
  border-radius: 18px;
  background: var(--floor);
  color: var(--yellow);
  cursor: pointer;
  transition: transform 0.15s;
}
.answer-bar button:active { transform: scale(0.94); }
.answer-bar button svg { width: 55%; height: 55%; }

.hint {
  position: absolute;
  right: 1.2vw;
  bottom: calc(100% + 0.5em);
  margin: 0;
  padding: 0.2em 0.7em;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-weight: 700;
  font-size: clamp(16px, 1.5vw, 28px);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}
.hint.is-visible { opacity: 1; transform: none; }
.answer-bar.shake { animation: shake 0.45s; }

/* ---------- Thanks (covers the answer bar) ---------- */
.thanks {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  border-radius: inherit;
  background: var(--yellow);
  color: var(--floor);
  font-family: var(--word-font);
  font-size: clamp(32px, 3.8vw, 72px);
  text-transform: uppercase;
  pointer-events: none;
}
.thanks[hidden] { display: none; }
.thanks.play { animation: thanks 1.4s var(--ease-out) forwards; }

/* ---------- Admin ---------- */
.admin {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  width: min(460px, 92vw);
  overflow-y: auto;
  padding: 24px;
  background: #081d20;
  border-left: 3px solid var(--yellow);
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.5);
  font-size: 20px;
}
.admin[hidden] { display: none; }
.admin-head { display: flex; justify-content: space-between; align-items: center; }
.admin h2 { margin: 0; font-family: var(--word-font); font-weight: 400; font-size: 36px; text-transform: uppercase; }
.admin h3 { margin: 24px 0 8px; font-size: 20px; color: var(--yellow); }
.admin button { font: inherit; font-weight: 700; cursor: pointer; }
.admin-close { border: 0; background: none; color: var(--ink); font-size: 28px; }
.admin-warning { padding: 10px 14px; border-radius: 10px; background: var(--red); color: #fff; }
.csv-btn {
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  border: 0;
  border-radius: 12px;
  background: var(--yellow);
  color: var(--floor);
  font-size: 22px;
}
.admin-list { margin: 0; padding: 0; list-style: none; }
.admin-list li {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(244, 241, 234, 0.1);
}
.admin-word { overflow-wrap: anywhere; }
.admin-count { color: var(--muted); font-variant-numeric: tabular-nums; }
.admin-list button {
  padding: 4px 12px;
  border: 1px solid var(--red);
  border-radius: 8px;
  background: none;
  color: var(--red);
}
.admin-list button:hover { background: var(--red); color: #fff; }
.admin-toggle { display: flex; align-items: center; gap: 10px; margin-top: 14px; cursor: pointer; }
.admin-toggle input { width: 22px; height: 22px; accent-color: var(--yellow); }
.admin-list input[type="checkbox"] { width: 20px; height: 20px; margin: 0; accent-color: var(--yellow); }
.merge-btn {
  width: 100%;
  margin-top: 10px;
  padding: 8px;
  border: 2px solid var(--yellow);
  border-radius: 10px;
  background: none;
  color: var(--yellow);
}
.merge-btn:not(:disabled):hover { background: var(--yellow); color: var(--floor); }
.merge-btn:disabled { opacity: 0.4; cursor: default; }
.merges-list { margin: 8px 0 0; padding: 0; list-style: none; font-size: 17px; color: var(--muted); }
.merges-list:empty { display: none; }
.merges-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0; }
.merges-list button {
  padding: 2px 10px;
  border: 1px solid var(--muted);
  border-radius: 8px;
  background: none;
  color: var(--muted);
}
.danger-zone {
  margin-top: 40px;
  padding: 16px;
  border: 2px solid var(--red);
  border-radius: 12px;
}
.admin .danger-zone h3 { margin: 0 0 6px; color: var(--red); }
.danger-zone p { margin: 0 0 12px; color: var(--muted); font-size: 16px; line-height: 1.35; }
.nuke-btn {
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-size: 20px;
}
.admin-help { margin-top: 24px; color: var(--muted); font-size: 16px; }
.admin kbd { padding: 1px 6px; border-radius: 4px; background: rgba(244, 241, 234, 0.12); font-family: inherit; }

/* ---------- Animations ---------- */
@keyframes pulse {
  0%   { text-shadow: 0 0 0 transparent; }
  25%  { scale: 1.35; text-shadow: 0 0 28px currentColor; }
  60%  { scale: 0.95; }
  100% { scale: 1; text-shadow: 0 0 0 transparent; }
}
@keyframes bump {
  40% { transform: scale(1.35); color: var(--yellow); }
}
@keyframes flip {
  from { transform: translateY(40%) scale(0.6); opacity: 0; }
}
@keyframes clock-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.9); }
}
@keyframes tick {
  0% { scale: 1.18; }
  40% { scale: 1; }
}
@keyframes shake {
  20%, 60% { transform: translateX(-10px); }
  40%, 80% { transform: translateX(10px); }
}
@keyframes thanks {
  0%   { opacity: 0; transform: scale(0.9); }
  15%  { opacity: 1; transform: scale(1.03); }
  25%  { transform: scale(1); }
  85%  { opacity: 1; }
  100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Small screens (not the stand, but keep it usable) */
@media (max-width: 800px) {
  body { height: auto; min-height: 100vh; overflow: auto; grid-template-rows: auto auto auto; }
  .top { padding: 16px 16px 0; grid-template-columns: 1fr auto; }
  .shot-clock { display: none; }
  .counter { grid-column: 2; }
  .clouds { grid-template-columns: 1fr; padding: 16px; gap: 16px; }
  .panel { height: 50vh; }
  .answer-bar { position: sticky; bottom: 16px; margin: 0 16px 16px; }
}
