:root {
  --bg: #121214;
  --bg-2: #1a1a1d;
  --ink: #f3eee6;
  --muted: #9a948c;
  --red: #a02337;
  --a: #e21b3c;
  --b: #1368ce;
  --c: #d89e00;
  --d: #26890c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

body { min-height: 100dvh; }

button, input {
  font: inherit;
  color: inherit;
}

.hidden { display: none !important; }

.kicker {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 700;
  color: #c43a4e;
}

h1 {
  font-family: Georgia, "Iowan Old Style", Palatino, serif;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.pin {
  font-size: clamp(64px, 12vw, 160px);
  font-weight: 800;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
}

.sub { color: var(--muted); }

.houses {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.house {
  padding: 14px 16px;
  min-height: 72px;
}

.house b { display: block; font-size: 22px; }
.house span { color: rgba(255,255,255,.82); font-size: 13px; }

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.choice {
  border: 0;
  min-height: 16vh;
  padding: 16px;
  color: #fff;
  font-weight: 700;
  font-size: clamp(15px, 3.6vw, 26px);
  text-align: left;
  cursor: pointer;
}

.choice:disabled { cursor: default; }

.choice.A { background: var(--a); }
.choice.B { background: var(--b); }
.choice.C { background: var(--c); }
.choice.D { background: var(--d); }

.numpad {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.numpad button {
  border: 0;
  min-height: 14vh;
  background: var(--bg-2);
  color: #fff;
  font-weight: 800;
  font-size: clamp(28px, 8vw, 48px);
  cursor: pointer;
}
.numpad button.hit { background: var(--d); }
.numpad button.miss { background: var(--a); }

.sprint-digit {
  font-size: clamp(80px, 18vw, 200px);
  font-weight: 800;
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
}

.sprint-board {
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) 1.25fr;
  gap: 3vw;
  align-items: stretch;
  min-height: calc(100dvh - 110px);
}

.sprint-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.hit-chart {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  min-height: 52vh;
  height: 100%;
}

.hit-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 100%;
}

.hit-val {
  font-size: clamp(24px, 3.4vw, 44px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.hit-track {
  flex: 1;
  width: 100%;
  min-height: 180px;
  background: #2a2a2e;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.hit-fill {
  width: 100%;
  height: 0%;
  transition: height 0.16s ease-out;
}

.hit-col.lead .hit-val {
  color: #fff;
}

.hit-name {
  font-size: clamp(13px, 1.5vw, 18px);
  font-weight: 700;
  text-align: center;
}

@media (max-width: 800px) {
  .sprint-board { grid-template-columns: 1fr; min-height: auto; }
  .hit-chart { min-height: 36vh; }
}
.choice.correct { outline: 3px solid #fff; outline-offset: 2px; }
.choice.picked { outline: 3px solid #fff; outline-offset: -3px; }

.timer {
  font-size: clamp(40px, 8vw, 84px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.bar {
  height: 8px;
  background: #2a2a2e;
}
.bar > i {
  display: block;
  height: 100%;
  background: var(--red);
  width: 0%;
}

.btn {
  background: var(--red);
  color: #fff;
  border: 0;
  padding: 12px 18px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.btn.ghost {
  background: var(--bg-2);
}

.btn:disabled { opacity: 0.4; cursor: default; }

input[type="text"], input[type="password"] {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid #2e2e32;
  padding: 14px 16px;
  font-size: 18px;
}

.rank {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid #2a2a2e;
  font-size: 22px;
}

.host-shell {
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 100dvh;
}

.stage-wrap {
  position: relative;
  min-height: 0;
}

.stage { padding: 4vh 5vw 2vh; }

.count-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  background: var(--bg);
  text-align: center;
}

.count-overlay .timer {
  font-size: clamp(96px, 22vw, 240px);
  line-height: 0.9;
}

.count-overlay.zero .timer {
  color: var(--a);
}

.count-bar {
  width: min(70vw, 720px);
  height: 10px;
}

.count-bar > i {
  width: 100%;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 5vw 16px;
  background: #0c0c0e;
  border-top: 1px solid #2a2a2e;
}

.qr {
  width: min(42vw, 340px);
  background: #fff;
  padding: 10px;
}

.lobby-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 4vw;
  align-items: center;
  min-height: 70vh;
}

.play-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 24px 20px 28px;
  gap: 18px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.play-shell.bleed {
  padding: 0;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.tag {
  display: inline-block;
  padding: 6px 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

@media (max-width: 800px) {
  .lobby-grid { grid-template-columns: 1fr; }
  .qr { width: min(70vw, 280px); }
  .choice { min-height: 12vh; font-size: 15px; padding: 12px; }
  .controls { position: sticky; bottom: 0; }
}
