/* ============================================================
   Theme tokens — dark is the default; [data-theme="light"]
   overrides the same variables.
   ============================================================ */
:root,
:root[data-theme="dark"] {
  --bg-1: #16395e;
  --bg-2: #0b1622;
  --bg-3: #070d15;
  --text: #eaf3fb;
  --text-dim: #b9cbdd;
  --text-faint: #8aa3bd;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-2: rgba(255, 255, 255, 0.06);
  --panel: rgba(7, 18, 30, 0.55);
  --reel-1: #0a2036;
  --reel-2: #07182a;
  --inset: #07182a;
  --line: rgba(255, 255, 255, 0.10);
  --accent: #2fb8ff;
  --accent-press: #1b8fe0;
  --accent-2: #57e0a0;
  --gold: #ffd166;
  --red: #ff4d5e;
  --orange: #ff9f43;
  --on-accent: #04121e;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --rink-red: rgba(255, 77, 94, 0.10);
  --rink-blue: rgba(47, 184, 255, 0.10);
  --rink-circle: clamp(190px, 30vmin, 300px);
  --modal-bg: #11253a;
}

:root[data-theme="light"] {
  --bg-1: #d6e7f7;
  --bg-2: #eaf1f9;
  --bg-3: #dfe9f4;
  --text: #0d1f33;
  --text-dim: #41597a;
  --text-faint: #6b809a;
  --surface: rgba(13, 31, 51, 0.04);
  --surface-2: rgba(13, 31, 51, 0.05);
  --panel: rgba(255, 255, 255, 0.7);
  --reel-1: #ffffff;
  --reel-2: #eef4fb;
  --inset: #eef3f9;
  --line: rgba(13, 31, 51, 0.14);
  --accent: #0d8fe0;
  --accent-press: #0a72b8;
  --accent-2: #16a06d;
  --gold: #d99a00;
  --red: #e23a4a;
  --orange: #e07d12;
  --on-accent: #ffffff;
  --shadow: 0 14px 40px rgba(33, 70, 110, 0.18);
  --rink-red: rgba(196, 16, 33, 0.16);
  --rink-blue: rgba(0, 84, 165, 0.15);
  --modal-bg: #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: "Inter", system-ui, sans-serif;
  color: var(--text);
  /* single, non-tiling fill — the px-sized gradient was repeating and showing a
     seam on tall/scrolling pages (very visible in dark mode) */
  background-color: var(--bg-3);
  background-image: radial-gradient(1200px 800px at 50% -10%, var(--bg-1) 0%, var(--bg-2) 55%, var(--bg-3) 100%);
  background-repeat: no-repeat;
  background-size: cover;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: color 0.25s, background-color 0.25s;
}

.rink-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.rink-line {
  position: absolute;
  top: -2%;
  bottom: -2%;
  width: 6px;
  transform: translateX(-50%);
}
.rink-center { left: 50%; background: var(--rink-red); }
.rink-blue { width: 6px; background: var(--rink-blue); }
/* blue lines anchored outside the centre circle so they never cross it */
.rink-left  { left: calc(50% - var(--rink-circle) / 2 - 60px); }
.rink-right { left: calc(50% + var(--rink-circle) / 2 + 60px); }
.rink-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--rink-circle);
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  border: 5px solid var(--rink-blue);
  border-radius: 50%;
}
.rink-circle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  transform: translate(-50%, -50%);
  background: var(--rink-red);
  border-radius: 50%;
}

.topbar, .screen, .foot { position: relative; z-index: 1; }

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(16px, 4vw, 48px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  transition: opacity 0.15s;
}
.brand:hover { opacity: 0.8; }
.brand-num {
  font-family: "Oswald", sans-serif;
  font-weight: 700;
  font-size: 30px;
  letter-spacing: 1px;
  color: var(--text);
}
.brand-dash { color: var(--accent); }
.brand-sub {
  font-family: "Oswald", sans-serif;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 3px;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 2px 7px;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.ghost-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 9px;
  padding: 9px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
}
.ghost-btn:hover { border-color: var(--accent); color: var(--accent); }

.icon-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 9px;
  width: 40px;
  height: 40px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: 0.15s;
}
.icon-btn:hover { border-color: var(--accent); }

/* ---------- screens ---------- */
.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  align-items: center;
  padding: clamp(10px, 3vw, 30px) clamp(14px, 4vw, 40px) 40px;
}
.screen.active { display: flex; }

.primary-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-press));
  color: var(--on-accent);
  border: none;
  border-radius: 12px;
  padding: 15px 30px;
  font: inherit;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.3px;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(47, 184, 255, 0.35);
  transition: transform 0.12s, box-shadow 0.12s;
}
.primary-btn:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(47, 184, 255, 0.45); }
.primary-btn:active { transform: translateY(0); }

/* ---------- title screen ---------- */
.title-card {
  max-width: 620px;
  text-align: center;
  margin-top: clamp(8px, 3vh, 34px);
}
.logo-emblem {
  display: block;
  width: clamp(170px, 40vw, 248px);
  height: auto;
  margin: 0 auto clamp(8px, 2vh, 16px);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.title-card h1 {
  font-family: "Oswald", sans-serif;
  font-weight: 700;
  font-size: clamp(30px, 6vw, 52px);
  line-height: 1.05;
  text-transform: uppercase;
}
.accent { color: var(--accent); }
.tagline {
  margin: 22px auto 30px;
  max-width: 520px;
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1.6;
}
.rules {
  list-style: none;
  margin: 34px auto 0;
  max-width: 480px;
  display: grid;
  gap: 12px;
  text-align: left;
}
.rules li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px 16px;
  font-size: 14.5px;
  color: var(--text-dim);
}
.r-pos {
  font-family: "Oswald", sans-serif;
  letter-spacing: 1px;
  color: var(--accent);
  font-weight: 600;
}

/* ---------- lineup bar ---------- */
.lineup-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: clamp(14px, 3vh, 28px);
  width: 100%;
  max-width: 760px;
}
.slot-chip {
  flex: 1 1 110px;
  min-width: 96px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 10px 11px;
  text-align: center;
  transition: 0.2s;
  position: relative;
  overflow: hidden;
}
.slot-chip .sc-pos {
  font-family: "Oswald", sans-serif;
  font-size: 12px;
  letter-spacing: 1.5px;
  color: var(--text-faint);
}
.slot-chip .sc-name { font-weight: 700; font-size: 13.5px; margin-top: 4px; line-height: 1.2; color: var(--text); }
.slot-chip .sc-meta { font-size: 11px; color: var(--text-faint); margin-top: 3px; }
.slot-chip.filled { border-color: color-mix(in srgb, var(--accent-2) 50%, transparent); }
.slot-chip.filled::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--accent-2);
}
.slot-chip.open { border-style: dashed; }
.slot-chip.empty .sc-name { color: var(--text-faint); font-weight: 600; }

/* ---------- draft main ---------- */
.draft-main {
  width: 100%;
  max-width: 760px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: clamp(18px, 3vw, 30px);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}
.round-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.round-label {
  font-family: "Oswald", sans-serif;
  letter-spacing: 1px;
  color: var(--text-dim);
  font-size: 15px;
  white-space: nowrap;
}
.filling { font-size: 13px; color: var(--text-faint); text-align: right; }

/* ---------- slot machine ---------- */
.slot {
  display: flex;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 16px;
}
.reel {
  flex: 1;
  background: linear-gradient(180deg, var(--reel-1), var(--reel-2));
  border: 1px solid var(--line);
  border-radius: 14px;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px;
  position: relative;
  overflow: hidden;
}
.reel span {
  font-family: "Oswald", sans-serif;
  font-weight: 600;
  font-size: clamp(18px, 3.4vw, 26px);
  line-height: 1.1;
  color: var(--text);
}
.reel.spinning span { filter: blur(1px); opacity: 0.65; }
.reel.spinning { animation: reelpulse 0.4s linear infinite; }
@keyframes reelpulse { 50% { border-color: var(--accent); } }
.reel.settle { animation: settle 0.4s ease; }
@keyframes settle { 0% { transform: scale(1.06); } 100% { transform: scale(1); } }
.reel-x {
  display: flex;
  align-items: center;
  color: var(--text-faint);
  font-size: 24px;
  font-weight: 300;
}
.reel-team-accent { height: 5px; width: 64px; border-radius: 3px; margin: 8px auto 0; }

/* ---------- respins ---------- */
.respins { display: flex; gap: 10px; margin-bottom: 22px; }
.respin-btn {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 11px;
  font: inherit;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: 0.15s;
}
.respin-btn:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }
.respin-btn:disabled { opacity: 0.38; cursor: not-allowed; }
.respin-btn .count {
  display: inline-block;
  min-width: 18px;
  background: var(--gold);
  color: var(--on-accent);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  margin-left: 4px;
}
.respin-btn .count.gone { background: var(--text-faint); color: var(--panel); }

/* ---------- candidates ---------- */
.pick-prompt {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.candidates { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .candidates { grid-template-columns: 1fr 1fr; } }

.cand {
  text-align: left;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 9px 13px;
  cursor: pointer;
  transition: 0.14s;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
}
.cand:hover { border-color: var(--accent); transform: translateY(-2px); }
.cand-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.5);
}
.cand-disabled:hover { border-color: var(--line); transform: none; }
.cand-ovr {
  font-family: "Oswald", sans-serif;
  font-weight: 700;
  font-size: 22px;
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--inset);
  border: 1px solid var(--line);
}
.cand-body { min-width: 0; flex: 1; }
.cand-name { font-weight: 700; font-size: 15px; color: var(--text); line-height: 1.2; }
.cand-stats {
  font-family: "Oswald", sans-serif;
  letter-spacing: 0.4px;
  font-size: 12px;
  color: var(--accent);
  margin-top: 2px;
}
.cand-pos {
  font-family: "Oswald", sans-serif;
  font-size: 13px;
  letter-spacing: 1px;
  font-weight: 700;
  color: var(--text-dim);
  flex-shrink: 0;
  align-self: center;
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 3px 8px;
}
.cand-pos.pos-filled { color: var(--text-faint); }

.sim-btn { margin-top: 26px; }

/* ---------- results ---------- */
.results-card {
  max-width: 620px;
  width: 100%;
  text-align: center;
  margin-top: clamp(10px, 4vh, 40px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: clamp(24px, 5vw, 42px);
  box-shadow: var(--shadow);
}
.results-kicker { color: var(--text-faint); font-size: 13px; letter-spacing: 2px; text-transform: uppercase; }
.record {
  font-family: "Oswald", sans-serif;
  font-weight: 700;
  font-size: clamp(56px, 14vw, 104px);
  line-height: 1;
  margin: 6px 0 4px;
  letter-spacing: 1px;
  color: var(--text);
}
.points { color: var(--text-dim); font-size: 15px; margin-bottom: 2px; }
.stat-strip {
  display: flex;
  justify-content: center;
  gap: clamp(12px, 4vw, 30px);
  flex-wrap: wrap;
  margin: 4px 0 18px;
}
.stat { display: flex; flex-direction: column; align-items: center; min-width: 48px; }
.stat-num {
  font-family: "Oswald", sans-serif;
  font-weight: 700;
  font-size: clamp(20px, 5vw, 26px);
  line-height: 1;
  color: var(--text);
}
.stat-label {
  font-family: "Oswald", sans-serif;
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--text-faint);
  margin-top: 4px;
}
.tier {
  display: inline-block;
  font-family: "Oswald", sans-serif;
  font-weight: 700;
  letter-spacing: 1px;
  font-size: 19px;
  padding: 8px 20px;
  border-radius: 30px;
  text-transform: uppercase;
  color: var(--on-accent);
}
.tier-blurb { color: var(--text-dim); margin: 14px auto 0; max-width: 440px; line-height: 1.55; font-size: 14.5px; }

.ratings { margin: 24px auto 8px; max-width: 380px; display: grid; gap: 10px; }
.rate-row { display: flex; align-items: center; gap: 12px; }
.rate-name {
  font-family: "Oswald", sans-serif;
  letter-spacing: 1px;
  font-size: 13px;
  color: var(--text-dim);
  width: 64px;
  text-align: left;
  flex-shrink: 0;
}
.rate-bar {
  flex: 1;
  height: 12px;
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
}
.rate-fill {
  height: 100%;
  width: 0;
  border-radius: 20px;
  transition: width 1s ease;
}
.rate-fill.atk { background: linear-gradient(90deg, var(--orange), var(--red)); }
.rate-fill.def { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.rate-num {
  font-family: "Oswald", sans-serif;
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  width: 30px;
  text-align: right;
  flex-shrink: 0;
}

.final-lineup {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 26px 0 28px;
  text-align: left;
}
@media (min-width: 520px) { .final-lineup { grid-template-columns: 1fr 1fr 1fr; } }
.fl-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
}
.fl-pos { font-family: "Oswald", sans-serif; font-size: 11px; letter-spacing: 1px; color: var(--accent); }
.fl-name { font-weight: 700; font-size: 13.5px; line-height: 1.2; margin-top: 2px; color: var(--text); }
.fl-meta { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.fl-stats {
  font-family: "Oswald", sans-serif;
  font-size: 11.5px;
  letter-spacing: 0.3px;
  color: var(--text-dim);
  margin-top: 3px;
}

.results-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* perfect-season celebration */
.perfect .record { color: var(--gold); text-shadow: 0 0 30px rgba(255, 209, 102, 0.6); animation: glow 1.6s ease-in-out infinite; }
@keyframes glow { 50% { text-shadow: 0 0 50px rgba(255, 209, 102, 0.9); } }

/* ---------- footer ---------- */
.foot {
  text-align: center;
  padding: 18px;
  font-size: 12px;
  color: var(--text-faint);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.kofi-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 7px 16px;
  transition: 0.15s;
}
.kofi-link:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.foot-links { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.x-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: 0.15s;
}
.x-link:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.x-link svg { display: block; }
.foot-disclaimer { max-width: 520px; line-height: 1.5; }

/* ---------- support modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 8, 16, 0.6);
  backdrop-filter: blur(4px);
  animation: overlayIn 0.2s ease;
}
.modal-overlay[hidden] { display: none; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  position: relative;
  width: 100%;
  max-width: 384px;
  background: var(--modal-bg);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 34px 30px 28px;
  text-align: center;
  box-shadow: var(--shadow);
  animation: cardIn 0.22s ease;
}
@keyframes cardIn {
  from { transform: translateY(14px) scale(0.97); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.modal-emoji { font-size: 42px; line-height: 1; }
.modal-card h2 {
  font-family: "Oswald", sans-serif;
  font-weight: 700;
  font-size: 26px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 12px 0 8px;
  color: var(--text);
}
.modal-card p {
  color: var(--text-dim);
  font-size: 14.5px;
  line-height: 1.6;
  margin-bottom: 24px;
}
.modal-actions { display: flex; flex-direction: column; gap: 10px; }
.modal-actions .primary-btn { text-decoration: none; }
.modal-actions .ghost-btn { padding: 11px 16px; }
.modal-close {
  position: absolute;
  top: 12px;
  right: 15px;
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--text); }
