:root {
  --bg: #0d1117;
  --card: #161b22;
  --line: #2a323d;
  --ink: #e8edf4;
  --dim: #94a3b8;
  --blue: #2f6fe4;
  --red: #c60c30;
  --good: #3fb950;
  --warn: #d29922;
  --radius: 14px;
}

* { box-sizing: border-box; }

/* Several rules below set display on elements that toggle with [hidden]. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  padding-bottom: 3rem;
}

/* ---------- header ---------- */

header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 1.25rem clamp(1rem, 4vw, 2.5rem);
  background: linear-gradient(90deg, #00338d 0%, #0d1117 70%);
  border-bottom: 3px solid var(--red);
}

.brand h1 { margin: 0; font-size: 1.6rem; letter-spacing: -0.02em; }
.brand p { margin: 0; color: #b9c7de; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.12em; }

.season-pick { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }
.season-pick label { color: #b9c7de; font-size: 0.9rem; }

.total { text-align: right; }
.total strong { display: block; font-size: 2.1rem; line-height: 1; font-variant-numeric: tabular-nums; }
.total span { color: #b9c7de; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; }

/* ---------- layout ---------- */

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem);
  display: grid;
  gap: 1.25rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1rem, 3vw, 1.5rem);
}

.card h2 { margin: 0 0 0.75rem; font-size: 1.15rem; }
.card h3 { margin: 0 0 0.25rem; font-size: 1.05rem; }

.hint { margin: 0 0 1rem; color: var(--dim); font-size: 0.9rem; }
.empty { color: var(--dim); padding: 0.75rem 0; }

/* ---------- forms ---------- */

label { display: block; margin-bottom: 0.75rem; color: var(--dim); font-size: 0.85rem; }

input, select, button {
  font: inherit;
  color: var(--ink);
  background: #0b0f15;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0.6rem 0.7rem;
  width: 100%;
  margin-top: 0.3rem;
}

input:focus, select:focus { outline: 2px solid var(--blue); outline-offset: 1px; }

button {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
  width: auto;
  padding: 0.6rem 1.2rem;
}
button:hover { filter: brightness(1.12); }
button:disabled { opacity: 0.5; cursor: default; }

button.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--dim);
  font-weight: 500;
}

.game-row { display: flex; gap: 0.75rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.game-row select { flex: 1 1 14rem; width: auto; margin-top: 0; }
.game-row button { margin-top: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0 1rem; align-items: end; margin-bottom: 1rem; }
.grid button { grid-column: 1 / -1; justify-self: start; }

.panel {
  background: #0b0f15;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  max-width: 34rem;
}

.qty-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr)); gap: 0 0.75rem; }
.qty-row input { font-size: 1.3rem; font-variant-numeric: tabular-nums; }

/* ---------- tables ---------- */

.scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child,
th.lead, td.lead { text-align: left; font-variant-numeric: normal; }
th { color: var(--dim); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.07em; font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }
td.lead { font-weight: 700; }
td strong { font-size: 1.05rem; }
.pos { color: var(--good); }
.neg { color: #ff7b72; }
.rank { color: var(--dim); width: 2rem; }

/* ---------- chart ---------- */

#chart svg { width: 100%; height: auto; display: block; }
.bar { fill: var(--blue); }
.axis { fill: var(--dim); font-size: 10px; }
.chart-note { color: var(--dim); font-size: 0.85rem; margin-top: 0.5rem; }

/* ---------- messages ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--good);
  border-radius: 10px;
  padding: 0.7rem 1.1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 10;
  max-width: min(90vw, 30rem);
}
.toast.error { border-left-color: var(--red); }

footer { text-align: center; padding: 1rem; }
