:root {
  --bg: #101815;
  --bg-2: #18241f;
  --panel: #20302a;
  --line: rgba(236, 220, 186, 0.16);
  --gold: #e4c27a;
  --cream: #f4efe4;
  --ink: #17211c;
  --text: #f3efe6;
  --muted: #b7c4bb;
  --link: #f0d7a2;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  --serif: "Fraunces", "Iowan Old Style", Palatino, Georgia, serif;
  --sans: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  background:
    radial-gradient(1100px 480px at 8% -10%, rgba(228, 194, 122, 0.16), transparent 55%),
    radial-gradient(800px 420px at 110% 0%, rgba(110, 174, 115, 0.12), transparent 46%),
    var(--bg);
}

body::before {
  content: "";
  display: block;
  height: 6px;
  background: linear-gradient(90deg, #f3efd4, #6ea8d9, #d5c6ea, #e07a62, #6eae73);
}

a { color: var(--link); }
a:hover { color: white; }

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

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  background: var(--cream);
  color: var(--ink);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 5;
}

.skip:focus { top: 12px; }

.wrap {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 72px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 14px;
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 560;
  font-size: clamp(2.3rem, 7vw, 3.5rem);
  letter-spacing: -0.03em;
  line-height: 1.02;
}

h2, h3 {
  font-family: var(--serif);
  font-weight: 560;
  letter-spacing: -0.02em;
}

.lede {
  max-width: 40rem;
  color: var(--muted);
  margin: 12px 0 0;
}

.totals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 18px;
}

.stat {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  text-align: left;
}

.stat strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 560;
  line-height: 1.1;
}

.stat span { color: var(--muted); font-size: 14px; }

.stat.button {
  cursor: pointer;
  width: 100%;
}

.stat.button:hover { border-color: var(--gold); }

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 3;
  margin: 18px 0 8px;
  padding: 8px 0;
  background: rgba(16, 24, 21, 0.92);
  backdrop-filter: blur(10px);
}

.tab, .chip {
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
}

.tab[aria-selected="true"] {
  background: var(--cream);
  color: var(--ink);
  border-color: var(--cream);
}

.intro {
  color: var(--muted);
  margin: 8px 0 16px;
}

.night h2 {
  margin: 26px 0 10px;
  font-size: 1.45rem;
}

.game, .pilot, .deck {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  margin: 0 0 12px;
}

.game-meta, .quiet { color: var(--muted); font-size: 14px; }

.winner-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  background: var(--cream);
  color: var(--ink);
  border-radius: 14px;
  padding: 12px;
  margin-top: 8px;
}

.winner-card a { color: #1e4d86; }
.winner-card a:hover { color: #0d2f5c; }

.kicker {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8a6a32;
}

.who-name {
  margin: 2px 0 0;
  font-family: var(--serif);
  font-size: 1.55rem;
  line-height: 1.1;
}

.deck-name { font-weight: 600; }

.cmd { display: block; }

.card-img {
  width: 72px;
  height: auto;
  aspect-ratio: 5 / 7;
  object-fit: cover;
  border-radius: 6px;
  background: #d9d0c2;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.18);
}

.deck .card-img, .candidate img { width: 64px; }

.seat-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.seat {
  display: grid;
  grid-template-columns: 7.2rem 1fr;
  gap: 2px 10px;
  align-items: baseline;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.seat .cmd, .seat .badge, .seat .pips { grid-column: 2; }

.pips { display: inline-flex; gap: 4px; margin-top: 4px; }

.pip {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  color: #1a1a1a;
}

.pip.W { background: #f3efd4; }
.pip.U { background: #6ea8d9; color: #07131d; }
.pip.B { background: #d5c6ea; }
.pip.R { background: #e07a62; color: #2a0d08; }
.pip.G { background: #7db87a; color: #10210f; }
.pip.C { background: #c8c2b6; }

.badge {
  display: inline-block;
  width: fit-content;
  margin-top: 4px;
  border-radius: 999px;
  padding: 2px 8px;
  background: #5c4314;
  color: #f8e7c2;
  font-size: 13px;
}

.badge.info { background: #1d3f46; color: #d7f3ec; }

.banner {
  border: 1px solid #e2b15a;
  background: #2a2112;
  border-radius: 12px;
  padding: 12px 14px;
  margin: 12px 0;
}

.banner ul { margin: 8px 0 0; padding-left: 1.1rem; }

.pilot-top, .deck-top {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
}

.pilot-top > div, .deck-top > div { flex: 1; min-width: 0; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.rank {
  font-family: var(--serif);
  font-size: 1.4rem;
  color: var(--gold);
  min-width: 1.6rem;
}

.record {
  margin: 0 0 0 auto;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: right;
}

.bar {
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  margin: 8px 0;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  width: calc(var(--p) * 1%);
  background: linear-gradient(90deg, #8d6b2f, var(--gold));
}

.deck-pills, .inline-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }

.text-button, .deck-pills button, .inline-actions button {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 999px;
  min-height: 36px;
  padding: 4px 10px;
  cursor: pointer;
}

.text-button:hover, .deck-pills button:hover, .inline-actions button:hover { border-color: var(--gold); }

.toolbar {
  display: grid;
  gap: 10px;
  margin: 4px 0 12px;
}

.search, .sort {
  width: 100%;
  min-height: 44px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.chip { padding: 0 14px; }

.chip[aria-pressed="true"] {
  background: var(--gold);
  color: var(--ink);
  border-color: var(--gold);
}

.deck h3 { margin: 0; font-size: 1.35rem; }
.pilot h3 { margin: 0; font-size: 1.45rem; }

.notes { margin: 8px 0 0; }

details { margin-top: 10px; }

summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.candidates {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 0 8px;
}

.candidate {
  flex: 0 0 110px;
  color: inherit;
  text-decoration: none;
}

.candidate span { display: block; font-size: 13px; margin-top: 4px; }
.candidate:hover span { color: white; }

.site-foot {
  margin-top: 36px;
  color: var(--muted);
  font-size: 14px;
}

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

@media (min-width: 720px) {
  .totals { grid-template-columns: repeat(4, 1fr); }
  .toolbar { grid-template-columns: 1fr 190px; }
  .winner-card .card-img, .game .card-img { width: 84px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
