/* Rose League v2 — brand tokens from design/DESIGN.md.
   70% ground / 20% poison / 5% pitch / 5% flood. Soccer mode: pitch-green
   accent, poison-hot stays for PLAY + live dot. No betting language, no pink,
   no spreadsheets as home.
   Responsive: DESKTOP is the primary surface (1920 / 1440 / 1280), with
   768 tablet and 390 mobile stacked layouts. Mobile behaviour is unchanged
   below 768px: bottom nav, single column, 300px canvas. */
:root {
  --ground: #0A0505;
  --ground-raise: #160A0A;
  --ground-card: #1D0D0D;
  --poison: #C8102E;
  --poison-hot: #FF2A3C;
  --poison-deep: #6E0A1B;
  --pitch: #0E4D3A;
  --pitch-bright: #1B7A5C;
  --flood: #FFFFFF;
  --smoke: #E8DCDC;
  --ember: #FF7A45;
  --radius: 18px;
  --nav-h: 58px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--ground); color: var(--smoke); }
body { font-family: Inter, system-ui, -apple-system, sans-serif; font-size: 15px; line-height: 1.45; }
img, canvas, video { max-width: 100%; }
#app { max-width: 430px; margin: 0 auto; min-height: 100dvh; padding-bottom: 92px; }
h1, h2, h3, .display { font-family: Anton, "Arial Narrow", sans-serif; text-transform: uppercase; letter-spacing: .02em; color: var(--flood); margin: 0; font-weight: 400; }
a { color: var(--flood); }
button { font-family: inherit; cursor: pointer; }
.muted { color: rgba(232,220,220,.65); }
.small { font-size: 12px; }

/* header */
header { position: sticky; top: 0; z-index: 20; background: linear-gradient(#0A0505 85%, transparent); padding: 14px 16px 8px; display: flex; align-items: baseline; justify-content: space-between; }
header .wordmark { font-family: Anton, sans-serif; font-size: 26px; color: var(--flood); text-transform: uppercase; }
header .wordmark em { font-style: normal; color: var(--poison-hot); }
header .tag { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--pitch-bright); }

/* bottom nav (mobile) / top bar (desktop, reordered below) */
nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: min(430px, 100%); display: flex; gap: 6px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: rgba(10,5,5,.96); border-top: 1px solid #2a1214; z-index: 30; }
nav button { flex: 1; min-height: 48px; border: 1px solid #3a1518; background: var(--ground-raise); color: var(--smoke); border-radius: 999px; font-size: 13px; font-weight: 700; }
nav button.active { background: var(--poison); color: var(--flood); border-color: var(--poison); }
nav button .n { display: block; font-size: 10px; font-weight: 400; opacity: .75; }

/* views */
.view { display: none; padding: 6px 16px 16px; }
.view.active { display: block; }
.view h2 { font-size: 30px; margin: 10px 0 4px; }
.view .lede { margin: 0 0 14px; max-width: 34ch; }

/* cards */
.card { background: var(--ground-raise); border: 1px solid #2a1214; border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card.hero { background: linear-gradient(160deg, #2b060d 0%, var(--ground-raise) 55%), var(--ground-raise); border-color: var(--poison-deep); position: relative; overflow: hidden; }
.card.hero::after { content: ""; position: absolute; inset: auto -30% -55% -30%; height: 70%; background: radial-gradient(ellipse at center, rgba(200,16,46,.35), transparent 70%); pointer-events: none; }
.kicker { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--ember); font-weight: 700; }
.matchup { font-family: Anton, sans-serif; font-size: 26px; line-height: 1.1; color: var(--flood); text-transform: uppercase; }
.matchup .vs { color: var(--poison-hot); }
.score-line { font-family: Anton, sans-serif; font-size: 40px; color: var(--flood); }
.score-line span { color: var(--poison-hot); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px; border-radius: 999px; border: none; font-weight: 800; font-size: 15px; }
.btn-primary { background: var(--pitch-bright); color: var(--flood); }
.btn-hot { background: var(--poison-hot); color: var(--flood); }
.btn-ghost { background: transparent; color: var(--flood); border: 1px solid #4a1d22; }
.btn-block { width: 100%; margin-top: 8px; }
.btn:disabled { opacity: .4; cursor: default; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }

/* score bug */
.scorebug { display: inline-flex; align-items: center; gap: 8px; background: #000; border: 1px solid #333; border-radius: 999px; padding: 6px 12px; font-weight: 800; color: var(--flood); font-size: 14px; }
.scorebug .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--poison-hot); animation: pulse 1.2s infinite; }
.scorebug .dot.off { background: #666; animation: none; }
@keyframes pulse { 50% { opacity: .35; } }
.clock { font-variant-numeric: tabular-nums; }

/* draft */
.turn-banner { background: var(--pitch); color: var(--flood); border-radius: 12px; padding: 10px 14px; font-weight: 800; margin-bottom: 12px; }
.turn-banner.ai { background: var(--poison-deep); }
.slot-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.slot { flex: 1 1 44%; background: #0d0707; border: 1px dashed #4a1d22; border-radius: 12px; padding: 8px 10px; min-height: 52px; }
.slot.filled { border-style: solid; border-color: var(--pitch-bright); }
.slot .pos { font-size: 11px; letter-spacing: .15em; color: var(--ember); font-weight: 700; }
.slot .who { font-family: Anton, sans-serif; color: var(--flood); font-size: 17px; text-transform: uppercase; }
.slot .who small { font-family: Inter, sans-serif; font-size: 11px; color: var(--smoke); }
.pool-group h3 { font-size: 15px; margin: 14px 0 6px; color: var(--smoke); letter-spacing: .08em; }
.pick-row { display: flex; align-items: center; gap: 10px; background: var(--ground-card); border: 1px solid #2a1214; border-radius: 12px; padding: 10px 12px; margin-bottom: 6px; }
.pick-row .num { font-family: Anton, sans-serif; font-size: 22px; color: var(--flood); width: 34px; text-align: center; }
.pick-row .who { flex: 1; min-width: 0; }
.pick-row .who b { color: var(--flood); display: block; font-size: 15px; }
.pick-row .who span { font-size: 12px; color: rgba(232,220,220,.65); }
.pick-row button { min-height: 44px; padding: 0 16px; border-radius: 999px; border: none; background: var(--pitch-bright); color: #fff; font-weight: 800; }
.pick-row button:disabled { background: #2a1214; color: #7a6566; }
.pick-row.gone { opacity: .35; }
.draft-log { font-size: 13px; max-height: 150px; overflow: auto; }
.draft-log div { padding: 3px 0; border-bottom: 1px solid #221011; }

/* fixtures */
.fixture { display: flex; gap: 12px; align-items: center; }
.fixture .when { font-size: 12px; color: var(--ember); font-weight: 700; min-width: 74px; }
.fixture .who { flex: 1; min-width: 0; }
.fixture .who b { color: var(--flood); display: block; }
.fixture .who span { font-size: 12px; }

/* match */
.match-layout { display: block; }
.match-stage { min-width: 0; }
.match-side { min-width: 0; }
#matchWrap { position: relative; }
#matchCanvas { width: 100%; height: 300px; display: block; background: #05080f; border-radius: var(--radius); touch-action: none; }
#walkout { position: absolute; inset: 0; border-radius: var(--radius); background: linear-gradient(180deg, rgba(10,5,5,.25), rgba(10,5,5,.88)); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding: 18px; text-align: center; z-index: 5; }
#walkout .wo-name { font-family: Anton, sans-serif; font-size: 42px; color: var(--flood); text-transform: uppercase; line-height: 1; }
#walkout .wo-sub { color: var(--ember); font-weight: 700; letter-spacing: .15em; font-size: 12px; text-transform: uppercase; }
#walkout .wo-count { font-size: 12px; color: var(--smoke); margin-top: 6px; }
/* Rig loading: real progress through the smoke (DESIGN.md), never a spinner on black. */
#woProgress { width: 240px; max-width: 80%; height: 6px; background: #2a1214; border-radius: 999px; margin-top: 10px; overflow: hidden; }
#woProgress i { display: block; height: 100%; background: var(--pitch-bright); border-radius: 999px; transition: width .2s ease-out; }
.commentary { max-height: 190px; overflow: auto; font-size: 14px; }
.commentary div { padding: 7px 2px; border-bottom: 1px solid #221011; }
.commentary div.goal { color: var(--flood); font-weight: 700; }
.commentary div.goal::before { content: "⚽ "; }
.play-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.play-btn { text-align: left; background: var(--ground-card); border: 1px solid #3a1518; border-radius: 14px; padding: 12px; color: var(--smoke); min-height: 64px; }
.play-btn b { display: block; color: var(--flood); font-size: 15px; }
.play-btn span { font-size: 12px; }
.play-btn:active { border-color: var(--pitch-bright); }
.play-btn:disabled { opacity: .4; }
.role-badge { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; background: var(--pitch); color: #fff; border-radius: 999px; padding: 4px 10px; }
.role-badge.owner { background: var(--poison-deep); }
.hl-row { display: flex; gap: 10px; align-items: center; padding: 10px 4px; border-bottom: 1px solid #221011; cursor: pointer; }
.hl-row .min { font-family: Anton, sans-serif; color: var(--flood); font-size: 18px; min-width: 44px; }
.hl-row .txt { flex: 1; font-size: 13px; min-width: 0; }
.hl-row .tag { font-size: 10px; font-weight: 800; letter-spacing: .12em; color: var(--ember); }
.potm { display: flex; gap: 12px; align-items: center; }
.potm .num { font-family: Anton, sans-serif; font-size: 44px; color: var(--poison-hot); }
.potm .who b { color: var(--flood); font-size: 18px; display: block; font-family: Anton, sans-serif; text-transform: uppercase; }
.notice { background: #160a0a; border: 1px solid var(--poison-deep); border-radius: 12px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.formation-line { display: flex; justify-content: space-between; gap: 8px; padding: 8px 2px; border-bottom: 1px solid #221011; }
.formation-line b { color: var(--flood); font-family: Anton, sans-serif; text-transform: uppercase; font-size: 16px; }
.formation-line .pos { color: var(--ember); font-size: 11px; font-weight: 800; width: 34px; }
.formation-line .num { color: var(--flood); font-weight: 800; width: 30px; text-align: right; }
@media (prefers-reduced-motion: reduce) { .scorebug .dot { animation: none; } }

/* ============ 768 tablet: wider shell, taller stage, still stacked ============ */
@media (min-width: 768px) {
  #app { max-width: 960px; padding: 0 24px 92px; }
  header { padding: 18px 8px 10px; }
  header .wordmark { font-size: 32px; }
  .view { padding: 6px 8px 16px; }
  .view h2 { font-size: 36px; }
  .matchup { font-size: 32px; }
  #matchCanvas { height: 420px; }
  #walkout .wo-name { font-size: 56px; }
  .commentary { max-height: 240px; }
  /* Home: hero full width, My Team + Coming up side by side. */
  #view-home.active { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
  #view-home.active #tonightCard { grid-column: 1 / -1; margin-bottom: 0; }
  #view-home.active #myTeamCard, #view-home.active #nextFixturesCard { margin-bottom: 0; }
  #view-home.active > p.small { grid-column: 1 / -1; }
  /* Schedule: two-column fixture cards. */
  #scheduleBody { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
  #scheduleBody .card { margin-bottom: 0; }
}

/* ============ 1280 desktop: top nav, wide grids, stage + side panel ============ */
@media (min-width: 1024px) {
  #app { max-width: 1240px; margin: 0 auto; padding: 0 32px 48px; display: flex; flex-direction: column; }
  header { order: 0; position: static; padding: 22px 0 6px; }
  header .wordmark { font-size: 34px; }
  /* Nav becomes the sticky top bar (it is last in the DOM, so flex order pulls it up). */
  nav { order: 1; position: sticky; top: 0; left: auto; transform: none; width: 100%; max-width: none; padding: 10px 0; background: rgba(10,5,5,.96); border-top: none; border-bottom: 1px solid #2a1214; }
  nav button { flex: 0 1 180px; min-height: 44px; font-size: 14px; }
  nav button .n { display: inline; font-size: 11px; margin-left: 6px; }
  .view { order: 2; padding: 20px 0 16px; }
  .view h2 { font-size: 44px; }
  .view .lede { max-width: 60ch; font-size: 16px; }
  .matchup { font-size: 38px; }
  .score-line { font-size: 56px; }

  /* Home: big hero left (2 rows), My Team + Coming up stacked right. */
  #view-home.active { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 20px; }
  #view-home.active #tonightCard { grid-column: 1; grid-row: 1 / span 2; margin-bottom: 0; display: flex; flex-direction: column; justify-content: center; min-height: 320px; }
  #view-home.active #myTeamCard { grid-column: 2; grid-row: 1; }
  #view-home.active #nextFixturesCard { grid-column: 2; grid-row: 2; }
  #view-home.active > p.small { grid-column: 1 / -1; }

  /* Draft: real board — pool left, both teams + log right. */
  #draftBody { display: flex; flex-wrap: wrap; gap: 0 20px; align-items: flex-start; }
  #draftBody .turn-banner { flex: 1 1 100%; }
  #draftBody > .card { flex: 1 1 46%; min-width: 0; }
  #draftBody .pool-group { flex: 1 1 46%; min-width: 0; }
  #draftBody > .btn { flex: 1 1 100%; }

  /* My Team: proper XI — starters in a two-column sheet. */
  #teamBody .card { max-width: 820px; }
  #teamBody .formation-line { display: grid; grid-template-columns: 44px 1fr 1fr 44px; align-items: baseline; }

  /* Match: stage left, playcalling + commentary in a sticky side panel. */
  .match-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr); gap: 20px; align-items: start; }
  .match-side { position: sticky; top: calc(var(--nav-h) + 12px); max-height: calc(100dvh - var(--nav-h) - 24px); overflow: auto; padding-right: 4px; }
  .match-side .card { margin-bottom: 14px; }
  #matchCanvas { height: 540px; }
  .commentary { max-height: 320px; }
  .play-grid { grid-template-columns: 1fr 1fr; }
}

/* ============ 1440 desktop: roomier shell, taller stage ============ */
@media (min-width: 1440px) {
  #app { max-width: 1360px; }
  #matchCanvas { height: 580px; }
  .match-layout { grid-template-columns: minmax(0, 1.7fr) minmax(340px, 1fr); }
  .matchup { font-size: 42px; }
}

/* ============ 1920 desktop: widest shell, biggest stage ============ */
@media (min-width: 1800px) {
  #app { max-width: 1600px; padding: 0 48px 48px; }
  .view h2 { font-size: 52px; }
  .matchup { font-size: 48px; }
  #matchCanvas { height: 640px; }
  .match-layout { grid-template-columns: minmax(0, 1.75fr) minmax(380px, 1fr); gap: 28px; }
  .commentary { max-height: 380px; }
}
