:root {
  --bg: #0c1311;
  --bg-2: #121c19;
  --panel: #17221f;
  --line: #263632;
  --text: #eef3ef;
  --muted: #8fa39b;
  --turf: #2f7d4f;
  --chalk: #f4f1e6;
  --accent: #f2c94c;      /* replaced with team color during a game */
  --team: #1f3b2f;        /* team primary */
  --hit: #5fd38d;
  --miss: #ff7a6b;
  --radius: 10px;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgba(255,255,255,.025) calc(10% - 1px) 10%),
    radial-gradient(1200px 600px at 50% -200px, #1b3a2b 0%, transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
}
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.screen { max-width: 1240px; margin: 0 auto; padding: 32px 24px 48px; }

.kicker {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Home ---------- */
.hero { padding: 24px 0 8px; }
.hero h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(48px, 9vw, 96px);
  line-height: .9;
  margin: 6px 0 12px;
  text-transform: uppercase;
  letter-spacing: -.01em;
}
.hero h1 span { color: var(--accent); }
.lede { max-width: 56ch; color: var(--muted); margin: 0; font-size: 18px; }

.options {
  display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center;
  margin: 28px 0 8px; padding: 14px 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.opt { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; }
.opt > span:first-child:not(:only-child) { color: var(--muted); }
.opt select {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px;
}
.opt.check { cursor: pointer; }
.opt input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }

.conferences { display: grid; gap: 28px; margin-top: 24px; }
.conference h2 {
  font-family: var(--display); font-weight: 800; font-size: 28px; letter-spacing: .04em;
  margin: 0 0 12px; text-transform: uppercase;
}
.divisions { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.division { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.division h3 { margin: 0 0 8px 4px; }
.team-list { display: grid; gap: 6px; }

.team-card {
  --c: #333;
  display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px;
  width: 100%; padding: 8px 12px 8px 8px; text-align: left;
  background: var(--bg-2); border: 1px solid transparent; border-left: 4px solid var(--c);
  border-radius: 8px; cursor: pointer; color: var(--text);
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.team-card:hover, .team-card:focus-visible {
  background: #1b2925; border-color: var(--line); border-left-color: var(--c); transform: translateX(2px); outline: none;
}
.team-card img { width: 40px; height: 40px; object-fit: contain; }
.team-card .tname { font-family: var(--display); font-weight: 700; font-size: 20px; line-height: 1.05; }
.team-card .tloc { display: block; font-family: var(--body); font-weight: 500; font-size: 12px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.team-card .best { font-family: var(--display); font-weight: 600; font-size: 14px; color: var(--muted); white-space: nowrap; }
.team-card .best b { color: var(--hit); font-weight: 700; }

.status { color: var(--muted); margin: 16px 0; }
.status.error { color: var(--miss); }
.status button { margin-left: 8px; }
.foot { color: var(--muted); font-size: 13px; margin-top: 36px; }

/* ---------- Buttons ---------- */
button {
  border: 0; border-radius: 8px; padding: 10px 16px; cursor: pointer;
  font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: .05em; text-transform: uppercase;
  background: var(--chalk); color: #10130f;
}
button:disabled { opacity: .4; cursor: not-allowed; }
button.ghost { background: transparent; color: var(--text); border: 1px solid rgba(255,255,255,.25); }
button.ghost:hover { border-color: rgba(255,255,255,.6); }
button.danger { background: transparent; color: var(--miss); border: 1px solid rgba(255,122,107,.5); }
button.danger:hover:not(:disabled) { background: rgba(255,122,107,.12); }

/* ---------- Game header ---------- */
.team-band {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 20px;
  padding: 16px 20px; border-radius: 14px;
  background:
    linear-gradient(100deg, rgba(0,0,0,0) 40%, rgba(0,0,0,.45)),
    var(--team);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.team-id { display: flex; align-items: center; gap: 16px; min-width: 0; }
.team-id img { width: 64px; height: 64px; object-fit: contain; filter: drop-shadow(0 2px 6px rgba(0,0,0,.4)); }
.team-id .kicker { color: rgba(255,255,255,.75); }
.team-id h2 {
  margin: 0; font-family: var(--display); font-weight: 800; font-size: clamp(28px, 4vw, 44px);
  line-height: 1; text-transform: uppercase; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.scoreboard { display: flex; gap: 8px; }
.sb-cell {
  display: grid; justify-items: center; min-width: 96px; padding: 6px 14px;
  background: rgba(0,0,0,.55); border-radius: 8px; border: 1px solid rgba(255,255,255,.1);
}
.sb-label { font-family: var(--display); font-weight: 600; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.65); }
.sb-value { font-family: var(--display); font-weight: 800; font-size: 32px; line-height: 1.05; font-variant-numeric: tabular-nums; color: #fff; }
.sb-value.low { color: var(--miss); }

/* ---------- Input ---------- */
.play-bar { display: flex; gap: 12px; align-items: flex-start; margin: 20px 0 8px; position: sticky; top: 0; z-index: 5; padding: 10px 0; background: linear-gradient(var(--bg) 75%, transparent); }
.input-wrap { flex: 1; }
#guess {
  width: 100%; padding: 14px 18px; font-size: 22px; font-weight: 500;
  background: var(--panel); border: 2px solid var(--line); border-radius: 10px; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
#guess:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
#guess.shake { animation: shake .3s ease; border-color: var(--miss); }
.play-bar > button { height: 58px; }
.feedback { margin: 6px 4px 0; min-height: 1.45em; font-size: 15px; color: var(--muted); }
.feedback.good { color: var(--hit); }
.feedback.bad { color: var(--miss); }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }

/* ---------- Result banner ---------- */
.result {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px;
  margin: 8px 0 16px; padding: 16px 20px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--accent);
}
.result-line { margin: 2px 0 0; font-family: var(--display); font-weight: 700; font-size: 28px; }
.result-actions { display: flex; gap: 10px; }

/* ---------- Board ---------- */
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.group { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.group-head {
  display: flex; justify-content: space-between; align-items: baseline; padding: 10px 14px;
  border-bottom: 1px solid var(--line); background: var(--bg-2);
}
.group-head h3 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 20px; text-transform: uppercase; letter-spacing: .06em; }
.group-head span { font-family: var(--display); font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.slots { list-style: none; margin: 0; padding: 6px; display: grid; gap: 3px; }
.slot {
  display: grid; grid-template-columns: 44px 44px 1fr; align-items: center; gap: 8px;
  min-height: 34px; padding: 3px 8px; border-radius: 6px; background: rgba(255,255,255,.02);
}
.slot .num {
  font-family: var(--display); font-weight: 800; font-size: 20px; text-align: right; color: var(--chalk);
  font-variant-numeric: tabular-nums;
}
.slot .num.none { color: var(--muted); font-weight: 600; }
.slot .pos {
  justify-self: start; font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: .06em;
  padding: 1px 6px; border-radius: 4px; background: rgba(255,255,255,.08); color: var(--muted);
}
.slot .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.slot .name:empty::before { content: ""; display: block; height: 2px; margin-top: 12px; background: rgba(255,255,255,.08); border-radius: 2px; }
.slot.got { background: color-mix(in srgb, var(--hit) 12%, transparent); }
.slot.got .name { color: var(--hit); }
.slot.got .pos { background: color-mix(in srgb, var(--hit) 22%, transparent); color: var(--text); }
.slot.missed .name { color: var(--miss); font-weight: 500; }
.slot.flash { animation: flash .9s ease; }
@keyframes flash { 0% { background: color-mix(in srgb, var(--hit) 55%, transparent); transform: scale(1.02); } 100% { transform: none; } }

@media (max-width: 720px) {
  .screen { padding: 20px 14px 40px; }
  .team-band { grid-template-columns: 1fr; gap: 12px; }
  .team-band #btn-back { justify-self: start; }
  .scoreboard { justify-content: stretch; }
  .sb-cell { flex: 1; }
  .team-id img { width: 48px; height: 48px; }
  #guess { font-size: 18px; }
  .play-bar > button { height: 52px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
