:root {
  --bg: #0b1020;
  --bg-2: #131b35;
  --bg-3: #1b2547;
  --ink: #eef1ff;
  --muted: #98a3c7;
  --gold: #f5c542;
  --gold-2: #c9961a;
  --green: #34c46b;
  --amber: #f2b33d;
  --red: #ef5a5a;
  --line: rgba(255, 255, 255, 0.1);
  --pitch-a: #2f8d40;
  --pitch-b: #2a8039;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background: radial-gradient(800px 420px at 50% -10%, rgba(245, 197, 66, 0.16), transparent 70%), var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* hub tabs */
.hub-tabs { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: rgba(11, 16, 32, 0.9); overflow-x: auto; }
.hub-tabs[hidden] { display: none; }
.hub-brand { font-weight: 900; text-decoration: none; color: var(--ink); margin-right: 8px; white-space: nowrap; }
.hub-brand span, .logo span { color: var(--gold); }
.hub-tab { text-decoration: none; color: var(--muted); font-weight: 700; font-size: 13px; padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.hub-tab[aria-current="page"] { background: var(--gold); color: #1a1400; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; max-width: 760px; margin: 0 auto; }
.logo { background: none; border: 0; font-size: 22px; font-weight: 900; letter-spacing: 0.04em; text-transform: uppercase; padding: 0; }
.top-actions { display: flex; gap: 6px; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); font-weight: 800; }
.sound-toggle[aria-pressed="false"] { opacity: 0.4; }

main { max-width: 760px; margin: 0 auto; padding: 0 16px 48px; }

.btn { border: 1px solid var(--line); background: var(--bg-2); border-radius: 12px; padding: 10px 16px; font-weight: 800; }
.btn:hover:not(:disabled) { border-color: var(--gold); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { background: var(--gold); color: #1a1400; border-color: var(--gold); }
.btn.big { width: 100%; padding: 14px; font-size: 17px; }
.muted { color: var(--muted); }

/* home */
.hero { text-align: center; padding: 26px 0 18px; }
.hero h1 { margin: 0; font-size: clamp(40px, 11vw, 72px); line-height: 0.95; font-weight: 900; letter-spacing: -0.01em; }
.hero h1 span { color: var(--gold); }
.hero .tag { font-size: 18px; color: #cfd6f3; margin: 12px 0 0; }
.record-chip { display: inline-block; margin-top: 14px; font: 900 34px/1 ui-monospace, monospace; letter-spacing: 0.04em; padding: 8px 16px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.modes { display: grid; gap: 12px; margin-top: 14px; }
.mode { background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: grid; gap: 10px; }
.mode h2 { margin: 0; font-size: 19px; display: flex; align-items: center; gap: 8px; }
.mode p { margin: 0; color: var(--muted); font-size: 14px; }
.field { display: grid; gap: 6px; font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.input { font: 600 16px system-ui, sans-serif; color: var(--ink); background: var(--bg); border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 10px; padding: 10px 12px; letter-spacing: normal; text-transform: none; }
.row { display: flex; gap: 8px; }
.row .input { flex: 1; min-width: 0; }
.code-input { text-transform: uppercase; letter-spacing: 0.3em; font-weight: 900; }
.code { font: 900 28px/1 ui-monospace, monospace; letter-spacing: 0.25em; color: var(--gold); background: var(--bg); padding: 6px 10px; border-radius: 8px; display: inline-block; margin: 4px 0; }
.err { color: var(--red); }
.badge-done { font-size: 12px; font-weight: 800; color: #0b1020; background: var(--green); border-radius: 999px; padding: 2px 8px; }

/* draft */
.draft-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0 12px; flex-wrap: wrap; }
.round-pill { font-weight: 900; background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; }
.skips { display: flex; gap: 6px; }
.skip { font-size: 13px; padding: 7px 10px; }

.slot-machine {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; padding: 12px; border-radius: 18px;
  background: linear-gradient(180deg, #2a2210, #18130a); border: 2px solid var(--gold-2);
  box-shadow: 0 0 0 4px rgba(245, 197, 66, 0.12), 0 18px 40px rgba(0, 0, 0, 0.5);
}
.reel {
  height: 86px; border-radius: 12px; overflow: hidden; position: relative; background: #fbf6e7; color: #1a1400;
  box-shadow: inset 0 8px 14px rgba(0, 0, 0, 0.35), inset 0 -8px 14px rgba(0, 0, 0, 0.35);
}
.reel-label { position: absolute; top: 5px; left: 0; right: 0; text-align: center; font-size: 10px; font-weight: 900; letter-spacing: 0.14em; color: #8a7a4a; z-index: 2; }
.reel-face { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 900; font-size: 20px; padding: 14px 8px 0; text-align: center; line-height: 1.1; }
.reel.spinning .reel-face { filter: blur(1.5px); }
.club-dot { width: 30px; height: 30px; border-radius: 50%; flex: none; border: 2px solid rgba(0, 0, 0, 0.25); }
.decade { font: 900 30px/1 ui-monospace, monospace; }

.pitch {
  margin: 14px 0; border-radius: 16px; padding: 14px 10px; position: relative; overflow: hidden;
  background: repeating-linear-gradient(0deg, var(--pitch-a) 0 44px, var(--pitch-b) 44px 88px);
  display: grid; grid-template-rows: repeat(4, auto); gap: 10px; justify-items: center;
}
.pitch::before { content: ""; position: absolute; inset: 8px; border: 2px solid rgba(255, 255, 255, 0.55); border-radius: 8px; pointer-events: none; }
.pitch-row { display: flex; gap: 10px; justify-content: center; width: 100%; position: relative; }
.pslot {
  width: min(42%, 170px); min-height: 56px; border-radius: 12px; padding: 6px 8px; text-align: center;
  background: rgba(11, 16, 32, 0.55); border: 2px dashed rgba(255, 255, 255, 0.45);
  display: grid; align-content: center; gap: 2px; font-size: 13px;
}
.pslot.filled { border-style: solid; border-color: rgba(255, 255, 255, 0.85); background: rgba(11, 16, 32, 0.85); }
.pslot.open { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(245, 197, 66, 0.35); }
.pslot .pos { font-size: 11px; font-weight: 900; letter-spacing: 0.1em; color: var(--muted); }
.pslot .pname { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pslot .pmeta { font-size: 11px; color: var(--muted); }

.candidates { display: grid; gap: 8px; }
.cand {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; text-align: left;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; width: 100%;
}
.cand:hover:not(:disabled) { border-color: var(--gold); }
.cand:disabled { opacity: 0.45; cursor: not-allowed; }
.pos-chip { font-size: 11px; font-weight: 900; border-radius: 6px; padding: 3px 6px; color: #0b1020; }
.pos-GK { background: #f2b33d; } .pos-DEF { background: #5fb3ff; } .pos-MID { background: #7ee08c; } .pos-FWD { background: #ff7a7a; }
.cand-name { font-weight: 800; }
.cand-why { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.ratings { display: flex; gap: 6px; font: 800 12px ui-monospace, monospace; }
.rt { display: grid; text-align: center; min-width: 34px; background: var(--bg); border-radius: 6px; padding: 3px 4px; }
.rt b { font-size: 15px; }
.rt i { font-style: normal; font-size: 9px; color: var(--muted); letter-spacing: 0.06em; }
.hint { color: var(--muted); font-size: 14px; margin: 6px 0 10px; }

.opp-strip { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--muted); margin: 6px 0; }
.opp-strip .chip { background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; color: var(--ink); }

/* result */
.result { text-align: center; padding-top: 6px; }
.big-record { font: 900 clamp(64px, 20vw, 120px)/1 ui-monospace, monospace; letter-spacing: -0.02em; margin: 6px 0; }
.big-record.perfect { color: var(--gold); text-shadow: 0 0 30px rgba(245, 197, 66, 0.55); }
.result .sub { color: var(--muted); }
.strip { display: grid; grid-template-columns: repeat(19, 1fr); gap: 4px; margin: 16px 0; }
.dot { aspect-ratio: 1; border-radius: 4px; background: var(--bg-3); transform: scale(0.6); opacity: 0.3; transition: transform 0.2s, opacity 0.2s; }
.dot.show { transform: none; opacity: 1; }
.dot.W { background: var(--green); } .dot.D { background: var(--amber); } .dot.L { background: var(--red); }
.bars { display: grid; gap: 8px; text-align: left; margin: 14px 0; }
.bar { display: grid; grid-template-columns: 96px 1fr 42px; gap: 8px; align-items: center; font-size: 14px; }
.bar .track { display: block; height: 10px; border-radius: 6px; background: var(--bg-3); overflow: hidden; }
.bar .fill { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-2), var(--gold)); border-radius: 6px; }
.bar b { text-align: right; font-variant-numeric: tabular-nums; }
.squad-list { display: grid; gap: 6px; text-align: left; margin: 12px 0; }
.squad-item { display: flex; align-items: center; gap: 8px; background: var(--bg-2); border-radius: 10px; padding: 8px 10px; font-size: 14px; }
.squad-item .club { margin-left: auto; color: var(--muted); font-size: 12px; text-align: right; }
.actions { display: grid; gap: 8px; margin-top: 14px; }
.h2h { background: var(--bg-2); border: 1px solid var(--gold-2); border-radius: 16px; padding: 14px; margin: 14px 0; }
.h2h .score { font: 900 44px/1 ui-monospace, monospace; margin: 8px 0; }
.h2h .names { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; font-weight: 800; }
.matches { text-align: left; font-size: 13px; color: var(--muted); max-height: 220px; overflow: auto; background: var(--bg-2); border-radius: 12px; padding: 8px 10px; }
.matches li { display: flex; gap: 8px; }
.matches li b { width: 14px; }

/* modal + toast */
.modal-back { position: fixed; inset: 0; background: rgba(4, 8, 20, 0.75); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: var(--bg-2); border: 1px solid var(--line); border-radius: 18px; padding: 20px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; }
.modal h2 { margin-top: 0; }
.modal ul { padding-left: 18px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); font-weight: 800; padding: 10px 16px; border-radius: 999px; z-index: 60; }
.toast[hidden] { display: none; }

@keyframes pop { from { transform: scale(0.7); opacity: 0; } }
.pop { animation: pop 0.25s ease-out; }
@media (prefers-reduced-motion: reduce) { .pop { animation: none; } .dot { transition: none; } }

/* blind mode */
.blind-toggle { display: flex; align-items: center; gap: 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; cursor: pointer; font-size: 14px; }
.blind-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { flex: none; width: 46px; height: 26px; border-radius: 999px; background: var(--bg-3); border: 1px solid var(--line); position: relative; transition: background 0.2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: transform 0.2s, background 0.2s; }
.blind-toggle input:checked + .switch { background: var(--gold); }
.blind-toggle input:checked + .switch::after { transform: translateX(20px); background: #1a1400; }
.blind-toggle input:focus-visible + .switch { outline: 3px solid var(--gold); outline-offset: 2px; }
.hidden-rt { min-width: 52px; color: var(--muted); }

/* opponent squad comparison */
.cmp-stats { display: grid; gap: 6px; margin-bottom: 12px; }
.cmp-stat { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; background: var(--bg); border-radius: 10px; padding: 6px 10px; font-variant-numeric: tabular-nums; }
.cmp-stat span { color: var(--muted); font-size: 13px; text-align: center; min-width: 80px; }
.cmp-stat b:last-child { text-align: right; }
.cmp-stat .better { color: var(--gold); }
.cmp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cmp-col h3 { margin: 0; font-size: 16px; }
.cmp-record { font: 900 22px/1.2 ui-monospace, monospace; color: var(--gold); margin-bottom: 6px; }
.cmp-player { display: flex; gap: 8px; align-items: flex-start; background: var(--bg); border-radius: 10px; padding: 8px; margin-bottom: 6px; font-size: 13px; line-height: 1.3; }
.cmp-player .muted { font-size: 11px; }
.cmp-r { font: 12px ui-monospace, monospace; }
@media (max-width: 420px) { .cmp-player { flex-direction: column; } }
