:root {
  --bg: #0d0f14;
  --surface: #161922;
  --surface-2: #1f232f;
  --border: #2a2f3d;
  --text: #e6e9f0;
  --muted: #8b93a7;
  --accent: #36c2ce;
  --accent-dim: #1d4a4f;
  --gold: #f5c451;
  --gold-dim: #4a3c14;
  --danger: #e5566b;
  --radius: 12px;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 20px 80px; }
.wrap--wide { max-width: 1040px; }

/* top bar */
.topbar {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(var(--surface), var(--bg));
  margin-bottom: 32px;
}
.topbar__inner {
  max-width: 1040px; margin: 0 auto; padding: 16px 20px;
  display: flex; align-items: baseline; gap: 28px; flex-wrap: wrap;
}
.brand {
  font-weight: 800; font-size: 18px; letter-spacing: -0.02em;
  color: var(--text);
}
.brand span { color: var(--accent); }
.nav { display: flex; gap: 20px; }
.nav a {
  color: var(--muted); font-size: 14px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.nav a:hover { color: var(--text); text-decoration: none; }
.nav a.active { color: var(--text); }

/* headings / eyebrows */
.eyebrow {
  text-transform: uppercase; letter-spacing: 0.16em; font-size: 12px;
  font-weight: 700; color: var(--accent); margin: 0 0 6px;
}
h1.page { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 4px; }
.sub { color: var(--muted); margin: 0 0 28px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 600; font-size: 14px;
  padding: 9px 16px; border-radius: 9px; transition: border-color .12s, background .12s;
}
.btn:hover { border-color: var(--accent); }
.btn--primary { background: var(--accent); color: #06222400; color: #062224; border-color: var(--accent); }
.btn--primary:hover { filter: brightness(1.08); }
.btn--ghost { background: transparent; }
.btn--danger { color: var(--danger); }
.btn--danger:hover { border-color: var(--danger); }
.btn:disabled { opacity: .4; cursor: not-allowed; border-color: var(--border); }

input[type=text], input[type=number], select {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  font: inherit; padding: 9px 12px; border-radius: 9px; width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--accent-dim); border-color: var(--accent); }
label.fld { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px; font-weight: 600; }

/* card / list of saved games */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.card + .card { margin-top: 14px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; }
.row--end { justify-content: flex-end; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.saved {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
}
.saved:hover { border-color: var(--accent); }
.saved__title { font-weight: 700; font-size: 17px; }
.saved__meta { color: var(--muted); font-size: 13px; }

.empty {
  border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 40px 24px; text-align: center; color: var(--muted);
}

/* ============ BEAM SCOREBOARD ============ */
.board { position: relative; }
.player {
  display: grid;
  grid-template-columns: 44px 52px 1fr auto auto;
  align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 10px;
  will-change: transform;
}
.player--leader { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 6px 24px -12px var(--gold); }

.rank {
  font-family: var(--mono); font-weight: 700; font-size: 18px;
  color: var(--muted); text-align: center;
}
.player--leader .rank { color: var(--gold); }

.avatar {
  width: 48px; height: 48px; border-radius: 50%; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border);
  display: grid; place-items: center; overflow: hidden; position: relative;
  font-weight: 700; color: var(--muted); font-size: 18px;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar:hover::after {
  content: "↑"; position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(0,0,0,.55); color: #fff; font-size: 18px;
}
.player--leader .avatar { border-color: var(--gold); }

.pname {
  font-weight: 700; font-size: 17px; cursor: text;
  border-bottom: 1px dashed transparent;
}
.pname:hover { border-bottom-color: var(--border); }
.pname__edit { font-size: 17px; font-weight: 700; max-width: 220px; }

.score {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 30px; font-weight: 700; min-width: 64px; text-align: right;
  cursor: pointer;
}
.player--leader .score { color: var(--gold); }
.score.pop { animation: pop .28s ease; }
@keyframes pop { 0%{transform:scale(1)} 40%{transform:scale(1.28)} 100%{transform:scale(1)} }

.sctl { display: flex; gap: 6px; align-items: center; }
.stepper {
  width: 40px; height: 40px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font-size: 22px; font-weight: 700; line-height: 1; display: grid; place-items: center;
}
.stepper:hover { border-color: var(--accent); }
.stepper--minus:hover { border-color: var(--danger); color: var(--danger); }
.xbtn {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 18px; padding: 4px 8px; border-radius: 6px;
}
.xbtn:hover { color: var(--danger); }

.addrow { display: flex; gap: 10px; margin-top: 4px; }
.cap { color: var(--muted); font-size: 13px; margin-top: 10px; }

/* connection dot */
.conn { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); }
.dot.live { background: #3fd07a; box-shadow: 0 0 8px #3fd07a; }

/* ============ DRAFT ============ */
.cols { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
@media (max-width: 880px){ .cols { grid-template-columns: 1fr; } }

table.standings { width: 100%; border-collapse: collapse; }
.standings th, .standings td { padding: 9px 10px; text-align: left; font-size: 14px; }
.standings th {
  color: var(--muted); text-transform: uppercase; letter-spacing: .08em;
  font-size: 11px; border-bottom: 1px solid var(--border);
}
.standings td { border-bottom: 1px solid var(--border); }
.standings tr:first-child td { color: var(--text); }
.standings tr.lead td { color: var(--gold); font-weight: 700; }
.standings .num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: center; }
.deckcell { color: var(--muted); font-size: 13px; }

.round { margin-bottom: 22px; }
.round h3 {
  font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent);
  margin: 0 0 10px; font-weight: 700;
}
.match {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 8px;
}
.match.decided { border-color: var(--accent-dim); }
.match.bye { grid-template-columns: 1fr auto; color: var(--muted); }
.side { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.side.right { align-items: flex-end; text-align: right; }
.side .nm { font-weight: 700; }
.side .dk { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side.win .nm { color: var(--gold); }
.mscore { display: flex; align-items: center; gap: 8px; }
.gw { font-family: var(--mono); font-size: 20px; font-weight: 700; min-width: 18px; text-align: center; }
.mstep {
  width: 28px; height: 28px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font-size: 16px; line-height: 1; display: grid; place-items: center;
}
.mstep:hover { border-color: var(--accent); }
.mstep:disabled { opacity: .3; cursor: not-allowed; }
.vs { color: var(--muted); font-size: 12px; padding: 0 4px; }

.player-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; margin-bottom: 8px; }
.radio-row { display: flex; gap: 18px; margin-bottom: 4px; }
.radio-row label { display: flex; gap: 7px; align-items: center; color: var(--text); font-weight: 600; cursor: pointer; }
hr.div { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.flash { color: var(--danger); font-size: 14px; min-height: 18px; }
