:root {
  --blue: #0a1a8f;
  --blue-2: #1428c8;
  --blue-deep: #050c4a;
  --gold: #ffcc33;
  --text: #ffffff;
  --muted: #b9c2ff;
  --green: #18a957;
  --red: #e0353d;
  --grey: #4a4f6a;
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--blue-deep);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 18px;
  line-height: 1.35;
}

body { padding: 12px 14px 40px; max-width: 900px; margin: 0 auto; touch-action: manipulation; }

h1 { font-size: 1.6rem; margin: 6px 0 12px; letter-spacing: 0.02em; }
h1 .logo { color: var(--gold); text-shadow: 2px 2px 0 #000; font-weight: 900; }
h2 { font-size: 1.15rem; margin: 18px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

button {
  font: inherit;
  border: 0;
  border-radius: var(--radius);
  padding: 14px 18px;
  background: var(--blue-2);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
button:disabled { opacity: 0.4; cursor: default; }
button.gold { background: var(--gold); color: #1a1a1a; }
button.green { background: var(--green); }
button.red { background: var(--red); }
button.ghost { background: transparent; border: 2px solid var(--blue-2); color: var(--muted); }
button.small { padding: 8px 12px; font-size: 0.9rem; border-radius: 10px; }
button.wide { width: 100%; }

input {
  font: inherit;
  font-size: 1.2rem;
  padding: 14px;
  border-radius: var(--radius);
  border: 2px solid var(--blue-2);
  background: #fff;
  color: #111;
  width: 100%;
}

select {
  font: inherit;
  padding: 12px;
  border-radius: var(--radius);
  width: 100%;
}

.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.stack > * + * { margin-top: 10px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.hidden { display: none !important; }

.card {
  background: var(--blue);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 2px 0 rgba(0,0,0,.4);
}

/* -------- scoreboard */
.scores { display: flex; flex-wrap: wrap; gap: 8px; }
.score {
  flex: 1 1 calc(33% - 8px);
  min-width: 96px;
  background: var(--blue);
  border-radius: 12px;
  padding: 8px 10px;
  text-align: center;
  border: 3px solid transparent;
  position: relative;
}
.score .name { font-size: 0.85rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score .pts { font-size: 1.25rem; font-weight: 900; color: var(--gold); }
.score .pts.neg { color: #ff8a8a; }
.score.me { border-color: var(--gold); }
.score.picker::after {
  content: "picks"; position: absolute; top: -9px; right: 6px;
  background: var(--gold); color: #000; font-size: 0.65rem; font-weight: 800;
  padding: 1px 6px; border-radius: 6px; text-transform: uppercase;
}
.score.offline { opacity: 0.55; }
.score.active { background: var(--gold); color: #000; }
.score.active .pts { color: #000; }
.score.locked { opacity: 0.4; }

/* -------- board */
.board {
  display: grid;
  gap: 4px;
  background: #000;
  padding: 4px;
  border-radius: 10px;
}
.board .cat {
  background: var(--blue);
  font-weight: 800;
  font-size: 0.62rem;
  line-height: 1.15;
  text-transform: uppercase;
  text-align: center;
  padding: 6px 2px;
  display: flex; align-items: center; justify-content: center;
  min-height: 52px;
  overflow-wrap: break-word;
  -webkit-hyphens: auto;
  hyphens: auto;
  min-width: 0;
}
.board .cell {
  background: var(--blue);
  color: var(--gold);
  font-weight: 900;
  font-size: 0.95rem;
  text-shadow: 1px 1px 0 #000;
  min-width: 0;
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1.3;
  border-radius: 0;
  padding: 0;
}
.board .cell.used { color: transparent; text-shadow: none; background: #0a1260; }
.board button.cell:not(.used):active { background: var(--blue-2); }
@media (min-width: 600px) {
  .board .cat { font-size: 0.85rem; }
  .board .cell { font-size: 1.5rem; }
}

#main { margin-top: 12px; }

/* -------- clue */
.clue {
  background: var(--blue);
  border-radius: var(--radius);
  padding: 22px 18px;
  text-align: center;
}
.clue .meta { color: var(--muted); font-weight: 700; text-transform: uppercase; font-size: 0.9rem; letter-spacing: .05em; }
.clue .meta b { color: var(--gold); }
.clue .text {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
  line-height: 1.3;
  margin: 14px 0 4px;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #000;
}
.clue .answer {
  margin-top: 14px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 204, 51, .15);
  border: 2px dashed var(--gold);
  color: var(--gold);
  font-weight: 800;
  font-size: 1.2rem;
}
.dd-banner {
  font-size: 2rem; font-weight: 900; color: var(--gold);
  text-shadow: 3px 3px 0 #000; text-align: center; margin: 10px 0;
  animation: pulse 0.8s ease-in-out infinite alternate;
}
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.08); } }

/* -------- buzzer */
.buzzer {
  display: block;
  width: 100%;
  min-height: 42vh;
  margin-top: 14px;
  border-radius: 28px;
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  background: var(--grey);
  color: rgba(255,255,255,.6);
  box-shadow: 0 8px 0 rgba(0,0,0,.45);
  transition: transform 0.05s, box-shadow 0.05s;
  touch-action: none;
}
.buzzer.live { background: var(--red); color: #fff; animation: glow 0.9s ease-in-out infinite alternate; }
.buzzer.live:active, .buzzer.pressed { transform: translateY(6px); box-shadow: 0 2px 0 rgba(0,0,0,.45); }
.buzzer.mine { background: var(--gold); color: #000; animation: none; }
.buzzer.locked { background: #2a2d40; color: rgba(255,255,255,.35); }
.buzzer small { display: block; font-size: 1.05rem; font-weight: 700; letter-spacing: 0; margin-top: 8px; }
@keyframes glow { from { filter: brightness(1); } to { filter: brightness(1.25); } }

.flash-gold { animation: flashgold 0.6s ease-out; }
@keyframes flashgold { from { background: var(--gold); } to { background: var(--blue-deep); } }

/* -------- misc */
.status {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 800;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--blue);
  margin-top: 12px;
}
.status.gold { background: var(--gold); color: #000; }
.status.green { background: var(--green); }
.status.red { background: var(--red); }

.conn {
  position: fixed; top: 0; left: 0; right: 0;
  background: var(--red); color: #fff; text-align: center;
  font-weight: 700; font-size: 0.85rem; padding: 4px; z-index: 50;
}

.list { list-style: none; padding: 0; margin: 0; }
.list li {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; background: var(--blue); border-radius: 10px; margin-bottom: 6px;
}
.list li .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.big-name { font-size: 2.2rem; font-weight: 900; color: var(--gold); text-align: center; text-shadow: 2px 2px 0 #000; }
.timer { font-variant-numeric: tabular-nums; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: #000; color: #fff; padding: 10px 16px; border-radius: 10px;
  font-size: 0.95rem; z-index: 60; max-width: 90vw;
}

.standings li .rank { font-weight: 900; color: var(--gold); width: 2ch; }
.standings li .pts { font-weight: 900; color: var(--gold); }

details { margin-top: 24px; }
details summary { color: var(--muted); cursor: pointer; padding: 8px 0; }
code.url { background: #000; padding: 6px 10px; border-radius: 8px; display: inline-block; word-break: break-all; font-size: 1rem; }

/* -------- big crowds */
.scores.many { gap: 5px; }
.scores.many .score { flex: 1 1 calc(20% - 5px); min-width: 64px; padding: 4px 5px; border-width: 2px; border-radius: 9px; }
.scores.many .score .name { font-size: 0.72rem; }
.scores.many .score .pts { font-size: 0.95rem; }
.compact-scores { background: var(--blue); border-radius: 12px; padding: 8px 12px; }
.compact-scores summary { cursor: pointer; font-size: 1.05rem; }
.compact-scores summary .pts { color: var(--gold); font-weight: 900; }
.compact-scores summary .pts.neg { color: #ff8a8a; }
.compact-scores .standings { max-height: 50vh; overflow-y: auto; margin-top: 8px; }
