/* FINAL WHISTLE — design system.
   Ink base, lime accent, cream type. One layout that scales from 360px to desktop. */

:root {
  color-scheme: dark;
  --ink: #07110d;
  --ink-2: #0d1a14;
  --panel: rgba(9, 21, 16, 0.86);
  --panel-solid: #102019;
  --line: rgba(255, 255, 255, 0.14);
  --line-strong: rgba(255, 255, 255, 0.26);
  --cream: #f2ecd9;
  --lime: #ccff4a;
  --muted: #94a89b;
  --red: #ff8b7d;
  --gold: #f4c95d;
  --radius: 16px;
  --gutter: clamp(14px, 3.4vw, 34px);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #030705;
  color: var(--cream);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

body { min-height: 100dvh; }

/* ── backdrop ─────────────────────────────────────────────── */

#backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #030705;
}

#backdrop canvas,
#backdrop video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 420ms ease;
}

#backdrop video { opacity: 0; }
body[data-cinematic="on"] #backdrop video { opacity: 1; }
body[data-cinematic="on"] #backdrop canvas { opacity: 0; }

/* ── shell ────────────────────────────────────────────────── */

#app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + 14px) var(--gutter) calc(env(safe-area-inset-bottom) + 32px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.wordmark { font-size: 17px; font-weight: 900; letter-spacing: 0.06em; }
.wordmark span { color: var(--lime); }

.eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--lime);
}
.eyebrow.dim { color: var(--muted); }

h1 { font-size: clamp(34px, 8vw, 64px); line-height: 0.98; margin: 0; font-weight: 900; letter-spacing: -0.02em; }
h2 { font-size: clamp(22px, 4.6vw, 34px); line-height: 1.06; margin: 0; font-weight: 850; letter-spacing: -0.01em; }
h3 { font-size: 15px; margin: 0; font-weight: 800; letter-spacing: 0.02em; }
p { margin: 0; line-height: 1.5; color: #cdd6cf; font-size: clamp(14px, 2.6vw, 17px); }

.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 22px; }
.spacer { flex: 1; }

/* ── buttons ──────────────────────────────────────────────── */

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

.btn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  text-align: left;
  padding: 16px 20px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1.5px solid var(--line-strong);
  transition: background 140ms ease, border-color 140ms ease, transform 90ms ease;
  min-height: 60px;
  justify-content: center;
}
.btn:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(204, 255, 74, 0.6); }
.btn:active { transform: scale(0.99); }
.btn strong { font-size: clamp(16px, 3.4vw, 19px); font-weight: 800; letter-spacing: -0.01em; }
.btn small { font-size: clamp(12px, 2.4vw, 13.5px); color: var(--muted); font-weight: 550; }

.btn.primary { background: var(--lime); border-color: var(--lime); color: var(--ink); }
.btn.primary:hover { background: #dcff72; }
.btn.primary small { color: #3b4a2c; }

.btn.ghost { background: transparent; border-color: var(--line); min-height: 48px; }
.btn.center { text-align: center; align-items: center; }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-row > .btn { width: auto; flex: 1 1 200px; }

.chip {
  padding: 11px 15px;
  border-radius: 12px;
  background: rgba(7, 17, 13, 0.8);
  border: 1.5px solid var(--line-strong);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
  transition: background 120ms ease;
  white-space: nowrap;
}
.chip:hover { background: rgba(255, 255, 255, 0.1); }
.chip[aria-pressed="true"] { background: var(--lime); border-color: var(--lime); color: var(--ink); }
.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── panels ───────────────────────────────────────────────── */

.panel {
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: 20px;
  padding: clamp(16px, 3.2vw, 24px);
  backdrop-filter: blur(14px);
}
.panel.flat { background: var(--panel-solid); backdrop-filter: none; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field > label { font-size: 11px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }

input[type="text"], input[type="search"] {
  width: 100%;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  color: var(--cream);
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid var(--line-strong);
  border-radius: 12px;
  letter-spacing: 0.02em;
}
input:focus { outline: none; border-color: var(--lime); }
input::placeholder { color: #66756c; }

.stepper { display: flex; align-items: stretch; gap: 8px; }
.stepper output {
  flex: 1;
  display: grid;
  place-items: center;
  min-width: 70px;
  font-size: 21px;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid var(--line-strong);
  border-radius: 12px;
}
.stepper .chip { min-width: 52px; text-align: center; font-size: 20px; }

/* ── HUD ──────────────────────────────────────────────────── */

.hud {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px 16px;
  align-items: center;
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: 20px;
  padding: 14px 16px;
  backdrop-filter: blur(14px);
}

.ovr {
  width: 62px; height: 62px;
  border-radius: 50%;
  background: var(--lime);
  color: var(--ink);
  display: grid;
  place-content: center;
  text-align: center;
  line-height: 1;
}
.ovr b { font-size: 24px; font-weight: 900; display: block; }
.ovr span { font-size: 9px; font-weight: 800; letter-spacing: 0.14em; }

.hud-id { min-width: 0; }
.hud-id .name { font-size: clamp(18px, 4vw, 23px); font-weight: 900; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-id .meta { font-size: 12.5px; color: var(--muted); font-weight: 650; margin-top: 3px; }
.hud-id .club { font-size: 14.5px; font-weight: 800; margin-top: 5px; display: flex; align-items: center; gap: 7px; }

.crest { width: 10px; height: 18px; border-radius: 3px; flex: none; }

.hud-stats {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.stat { text-align: left; }
.stat span { display: block; font-size: 9.5px; font-weight: 800; letter-spacing: 0.13em; color: var(--muted); text-transform: uppercase; }
.stat b { font-size: 17px; font-weight: 850; }
.stat b.accent { color: var(--lime); }

.bars { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.bar > span { font-size: 9.5px; font-weight: 800; letter-spacing: 0.13em; color: var(--muted); text-transform: uppercase; display: flex; justify-content: space-between; }
.bar .track { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.13); margin-top: 5px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--lime); border-radius: 3px; transition: width 500ms ease; }
.bar .fill.warn { background: var(--red); }

/* ── decision ─────────────────────────────────────────────── */

.decision { display: flex; flex-direction: column; gap: 16px; }
.decision .tone {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.15em; text-transform: uppercase; color: var(--lime);
}
.decision .tone::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.decision[data-tone="risk"] .tone, .decision[data-tone="scandal"] .tone { color: var(--red); }

.options { display: grid; gap: 10px; }

/* ── season reveal ────────────────────────────────────────── */

.seasons-out { display: grid; gap: 10px; }
.season-card {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 13px 16px;
  border-radius: 14px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  animation: rise 420ms cubic-bezier(0.2, 0.7, 0.3, 1) backwards;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.season-card .age { font-size: 19px; font-weight: 900; color: var(--lime); }
.season-card .where { font-size: 15px; font-weight: 800; min-width: 0; }
.season-card .where small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.season-card .line { font-size: 13px; font-weight: 700; color: #c2ccc4; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.season-card .honours { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }

.trophy-tag {
  font-size: 11px; font-weight: 800; letter-spacing: 0.04em;
  padding: 5px 10px; border-radius: 20px;
  background: rgba(244, 201, 93, 0.14); color: var(--gold);
  border: 1px solid rgba(244, 201, 93, 0.4);
}
.trophy-tag.plain { background: rgba(204, 255, 74, 0.12); color: var(--lime); border-color: rgba(204, 255, 74, 0.34); }

.outcome-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 10px; }
.outcome-cards div {
  padding: 12px 14px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line);
}
.outcome-cards span { display: block; font-size: 9.5px; font-weight: 800; letter-spacing: 0.13em; color: var(--muted); }
.outcome-cards b { font-size: 20px; font-weight: 850; }
.outcome-cards b.up { color: var(--lime); }
.outcome-cards b.down { color: var(--red); }

/* ── table ────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 14px; border: 1px solid var(--line); max-height: 340px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 460px; }
thead th {
  text-align: left; padding: 10px 12px;
  font-size: 9.5px; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; color: var(--muted);
  background: #0b1712;
  position: sticky; top: 0;
}
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody td { padding: 9px 12px; border-top: 1px solid rgba(255, 255, 255, 0.07); font-weight: 650; }
tbody tr:hover { background: rgba(255, 255, 255, 0.04); }
td.dim { color: var(--muted); font-weight: 550; }

/* ── timeline ─────────────────────────────────────────────── */

.timeline { display: flex; align-items: center; padding: 6px 2px 0; }
.timeline .node { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; position: relative; }
.timeline .node::before {
  content: ""; position: absolute; top: 5px; left: -50%; width: 100%; height: 2px;
  background: rgba(255, 255, 255, 0.16);
}
.timeline .node:first-child::before { display: none; }
.timeline .node.done::before { background: var(--lime); }
.timeline .dot { width: 12px; height: 12px; border-radius: 50%; background: #47564d; z-index: 1; }
.timeline .node.done .dot { background: var(--lime); }
.timeline .node.now .dot { box-shadow: 0 0 0 4px rgba(204, 255, 74, 0.22); }
.timeline .node b { font-size: 10.5px; font-weight: 750; color: var(--muted); }
.timeline .node.now b { color: var(--cream); }

/* ── nationality picker ───────────────────────────────────── */

.nation-list {
  max-height: 236px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(182px, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
}
.nation {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 11px; border-radius: 9px;
  font-size: 13px; font-weight: 700; text-align: left;
  border: 1px solid transparent;
}
.nation:hover { background: rgba(255, 255, 255, 0.08); }
.nation[aria-pressed="true"] { background: var(--lime); color: var(--ink); }
.nation .flag { font-size: 16px; line-height: 1; }
.nation .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nation .conf { margin-left: auto; font-size: 9px; font-weight: 800; letter-spacing: 0.08em; color: var(--muted); }
.nation[aria-pressed="true"] .conf { color: rgba(7, 17, 13, 0.62); }

/* ── avatar ───────────────────────────────────────────────── */

.avatar { width: 100%; max-width: 200px; margin: 0 auto; display: block; }

/* ── cinematic ────────────────────────────────────────────── */

.cinematic { min-height: 58dvh; display: flex; flex-direction: column; justify-content: flex-end; gap: 14px; }
.cine-progress { height: 4px; background: rgba(255, 255, 255, 0.2); border-radius: 2px; overflow: hidden; }
.cine-progress i { display: block; height: 100%; background: var(--lime); width: 0; }

/* ── summary ──────────────────────────────────────────────── */

.verdict {
  border: 1.5px solid rgba(204, 255, 74, 0.4);
  background: rgba(204, 255, 74, 0.08);
  border-radius: 18px;
  padding: 18px 20px;
}
.honours-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.honour {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 14px; border-radius: 12px;
  background: var(--panel-solid); border: 1px solid var(--line);
  font-size: 13.5px; font-weight: 750;
}
.honour b { color: var(--gold); font-weight: 900; }
.honour.award b { color: var(--lime); }

.spells { display: grid; gap: 8px; }
.spell {
  display: grid; grid-template-columns: 58px 1fr auto; gap: 12px; align-items: center;
  padding: 11px 14px; border-radius: 12px; background: var(--panel-solid); border: 1px solid var(--line);
}
.spell .years { font-size: 12px; font-weight: 850; color: var(--lime); }
.spell .club { font-size: 14.5px; font-weight: 800; min-width: 0; }
.spell .club small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.spell .out { font-size: 12.5px; color: var(--muted); font-weight: 700; white-space: nowrap; }

/* ── misc ─────────────────────────────────────────────────── */

.hint { font-size: 12px; color: #7f8f86; font-weight: 600; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (min-width: 900px) {
  .split { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 22px; align-items: start; }
  .hud { grid-template-columns: auto 1fr auto; }
  .hud-stats { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
