/* ============================================================
   La Ligue Onche — stadium theme
   ------------------------------------------------------------------
   1. tokens & base          5. teams & players
   2. header / navigation    6. match centre (replay)
   3. hero & matchday strip  7. local tools (editor / generator / live)
   4. fixtures & standings   8. responsive
   ============================================================ */

/* ---------- 1. tokens & base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #080d0a;
  --bg2: #0c130e;
  --panel: #121b15;
  --panel2: #18251c;
  --panel3: #1f3126;
  --line: #26382c;
  --line2: #32503b;
  --text: #eaf3ec;
  --dim: #8ba394;
  --dim2: #64796d;
  --accent: #f5c518;
  --accent2: #ffe27a;
  --green: #34a853;
  --green2: #4ade80;
  --danger: #e5484d;
  --blue: #58b8e0;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --ease: cubic-bezier(.2, .7, .3, 1);
}

body {
  background:
    radial-gradient(1100px 600px at 12% -8%, rgba(52, 168, 83, 0.13), transparent 60%),
    radial-gradient(900px 500px at 92% 4%, rgba(245, 197, 24, 0.09), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; }
a { color: inherit; }
button { font-family: inherit; }
.dim { color: var(--dim); font-size: 13px; }
.hint { color: var(--dim); font-size: 12px; margin-top: 10px; line-height: 1.5; }
/* the editor's export-folder line sits under the toolbar, not inside a panel */
.editor-savedir { margin: 0; padding: 6px 16px; border-bottom: 1px solid var(--line); }
.editor-savedir:empty { display: none; }
.num { font-variant-numeric: tabular-nums; }
.spacer { flex: 1; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
/* cards slide in WITHOUT fading: a staggered fade can leave an element
   invisible if its animation never gets to run (slow device, frozen tab) */
@keyframes slideUp { from { transform: translateY(9px); } to { transform: none; } }
.rise { animation: rise .45s var(--ease) backwards; }

/* ---------- 2. header / navigation ---------- */
header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 24px;
  background: linear-gradient(180deg, rgba(18, 27, 21, .96), rgba(10, 16, 12, .92));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 30;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .5px; }
.logo img {
  display: block;
  height: 42px;
  width: auto;
  max-width: 55vw;
  background: #fff;
  border-radius: 9px;
  padding: 4px 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .4);
}
header nav { display: flex; gap: 6px; margin-left: auto; align-items: center; flex-wrap: wrap; }

.tab {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--dim);
  padding: 8px 15px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: color .16s, border-color .16s, background .16s, transform .16s;
}
.tab:hover { color: var(--text); border-color: var(--line2); transform: translateY(-1px); }
.tab.active { background: var(--green); color: #fff; border-color: var(--green); }
.tab.save { background: var(--accent); color: #141414; font-weight: 700; border-color: var(--accent); }
.tab.danger { color: var(--danger); }

main { padding: 22px 24px 60px; max-width: 1320px; margin: 0 auto; }

/* ---------- panels & buttons ---------- */
.panel {
  background: linear-gradient(180deg, var(--panel), rgba(12, 19, 14, .9));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.panel h2 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 1.4px;
  color: var(--dim); margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
}
.panel h2::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.autoplay { color: var(--dim); font-size: 12.5px; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.autoplay input { accent-color: var(--green); }

.btn {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 8px 15px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 13.5px;
  transition: border-color .16s, background .16s, transform .16s;
}
.btn:hover:not(:disabled) { border-color: var(--line2); background: var(--panel3); transform: translateY(-1px); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 700; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.12); }
.btn.danger { color: var(--danger); }
.mini {
  background: transparent; border: 1px solid var(--line2); color: var(--accent);
  border-radius: 8px; padding: 5px 11px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  white-space: nowrap; transition: background .16s, color .16s, transform .16s;
}
.mini:hover { background: var(--accent); color: #141414; transform: translateY(-1px); }

/* ---------- 3. hero & matchday strip ---------- */
.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 26px 28px;
  margin-bottom: 18px;
  background:
    linear-gradient(120deg, rgba(52, 168, 83, .18), transparent 45%),
    linear-gradient(300deg, rgba(245, 197, 24, .13), transparent 50%),
    var(--panel);
  animation: rise .5s var(--ease) backwards;
}
/* mown-grass stripes behind the hero */
.hero::after {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .022) 0 42px, transparent 42px 84px);
  pointer-events: none;
}
.hero-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; position: relative; }
.hero h1 { font-size: clamp(22px, 3.4vw, 34px); font-weight: 900; letter-spacing: -.5px; }
.hero .sub { color: var(--dim); font-size: 14px; margin-top: 6px; max-width: 62ch; line-height: 1.55; position: relative; }
.hero .cta { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; position: relative; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel2); border: 1px solid var(--line2);
  color: var(--text); font-size: 12px; font-weight: 700;
  padding: 5px 11px; border-radius: 999px; letter-spacing: .3px;
}
.chip.live { background: rgba(229, 72, 77, .16); border-color: #7d2b2e; color: #ffb3b3; }
.chip.gold { background: rgba(245, 197, 24, .14); border-color: #6d5a13; color: var(--accent2); }

/* the matchday selector: a horizontal strip of round chips */
.md-strip {
  display: flex; gap: 8px; flex-wrap: wrap; overflow-x: auto; padding: 4px 2px 10px;
  scrollbar-width: thin; margin-bottom: 6px;
}
.md-chip {
  flex: 0 0 auto;
  background: var(--panel2); border: 1px solid var(--line);
  color: var(--dim); border-radius: 10px; padding: 8px 13px;
  font-size: 12.5px; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: all .16s var(--ease);
}
.md-chip:hover { color: var(--text); border-color: var(--line2); transform: translateY(-1px); }
.md-chip.active { background: var(--green); border-color: var(--green); color: #fff; }
.md-chip.future { opacity: .5; }
.md-chip .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: 6px; vertical-align: 1px; }

/* ---------- 4. fixtures ---------- */
.round { margin-bottom: 22px; }
.round-title {
  font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: 1.4px;
  margin-bottom: 10px; display: flex; align-items: center; gap: 10px;
}
.round-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.fixture-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }

.fixture {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-areas: 'home score away' 'meta meta meta';
  gap: 8px 12px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 14px 11px;
  font-size: 14px;
  transition: border-color .18s, transform .18s var(--ease), box-shadow .18s;
  animation: slideUp .35s var(--ease) both;
}
.fixture:hover { border-color: var(--line2); transform: translateY(-2px); box-shadow: var(--shadow); }
.fixture.playable { cursor: pointer; }
.fixture.playable:hover { border-color: var(--accent); }
.fixture .home { grid-area: home; text-align: right; display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.fixture .away { grid-area: away; text-align: left; display: flex; align-items: center; gap: 8px; min-width: 0; }
.fixture .tname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.fixture .score { grid-area: score; }
.fixture-meta {
  grid-area: meta; display: flex; align-items: center; gap: 8px; justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, .05); padding-top: 9px; margin-top: 3px;
}
.venue { color: var(--dim2); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score {
  font-weight: 800; min-width: 58px; text-align: center; font-size: 19px;
  font-variant-numeric: tabular-nums; letter-spacing: 1px;
}
.score.dim { color: var(--dim2); font-weight: 600; font-size: 14px; letter-spacing: 2px; }
.pens { font-size: 11px; color: var(--dim); font-weight: 500; display: block; }

.jersey {
  width: 22px; height: 22px; border-radius: 7px; flex: 0 0 auto;
  border: 1.5px solid rgba(255, 255, 255, .25);
  box-shadow: inset 0 -6px 10px rgba(0, 0, 0, .25);
}
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid; vertical-align: -1px; margin: 0 6px 0 2px; }
.swatch.big { width: 20px; height: 20px; border-radius: 6px; }

.round-tag {
  font-size: 10px; background: var(--panel2); border: 1px solid var(--line); color: var(--dim);
  padding: 2px 7px; border-radius: 6px; text-transform: uppercase; letter-spacing: .6px;
}

/* spoiler-free note on the landing page */
.spoiler-note {
  font-size: 14px; font-weight: 600; color: var(--accent2);
  background: rgba(245, 197, 24, .08);
  border: 1px solid rgba(245, 197, 24, .3);
  border-radius: 12px; padding: 12px 16px; margin: 0 0 16px; line-height: 1.55;
}
.spoiler-note b { color: var(--accent); }
.spoiler-note a { color: var(--text); font-weight: 700; }
.spoiler-note a:hover { color: var(--accent); }

/* ---------- standings ---------- */
.league-split { display: grid; grid-template-columns: minmax(520px, 1.35fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.league-split > .col { display: grid; gap: 16px; align-content: start; min-width: 0; }
.league-split .panel { overflow-x: auto; }

table.standings { width: 100%; min-width: 520px; border-collapse: collapse; font-size: 13px; }
.standings th, .standings td { padding: 8px 6px; text-align: center; }
.standings th { color: var(--dim); font-weight: 600; border-bottom: 1px solid var(--line); font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; }
.standings td { border-bottom: 1px solid rgba(255, 255, 255, .04); font-variant-numeric: tabular-nums; }
.standings tbody tr { transition: background .15s; }
.standings tbody tr:hover { background: var(--panel2); }
.standings td:nth-child(2) { text-align: left; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.standings .abbr { color: var(--dim); font-weight: 800; font-size: 10.5px; letter-spacing: .5px; margin-right: 4px; }
.standings .pts { font-weight: 900; color: var(--accent); font-size: 15px; }
.standings .pos { color: var(--dim); font-weight: 700; }
.standings tr.pos-1 td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.standings tr.pos-2 td:first-child { box-shadow: inset 3px 0 0 #c9ccd1; }
.standings tr.pos-3 td:first-child { box-shadow: inset 3px 0 0 #cd7f32; }
.standings tr.pos-last td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.cup-tag { font-size: 9px; background: var(--green); color: #fff; padding: 1px 4px; border-radius: 4px; margin-left: 2px; vertical-align: 2px; }

/* form guide: the last five results as dots */
.form-guide { display: inline-flex; gap: 3px; }
.form-dot {
  width: 16px; height: 16px; border-radius: 5px; font-size: 9.5px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center; color: #08120b;
}
.form-dot.W { background: var(--green2); }
.form-dot.D { background: #b9c4bd; }
.form-dot.L { background: #d9575b; color: #fff; }
.form-dot.none { background: var(--panel3); color: var(--dim2); }

/* goal-difference micro bar */
.gd-bar { display: block; height: 4px; border-radius: 2px; margin-top: 3px; background: var(--panel3); overflow: hidden; }
.gd-bar i { display: block; height: 100%; border-radius: 2px; }
.gd-bar i.plus { background: var(--green2); }
.gd-bar i.minus { background: #d9575b; }

/* ---------- 5. teams, players & leaderboards ---------- */
.section-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }

.leader-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.leader-card h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--dim); margin-bottom: 12px; }
.leader-row {
  display: grid; grid-template-columns: 20px 1fr auto; gap: 10px; align-items: center;
  padding: 7px 0; border-bottom: 1px solid rgba(255, 255, 255, .04); font-size: 13.5px;
}
.leader-row:last-child { border-bottom: none; }
.leader-row .rank { color: var(--dim2); font-weight: 800; font-size: 12px; }
.leader-row .who { min-width: 0; }
.leader-row .who b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leader-row .who span { color: var(--dim2); font-size: 11.5px; }
.leader-row .val { font-weight: 900; color: var(--accent); font-variant-numeric: tabular-nums; }
.leader-row.top .val { font-size: 17px; }

.team-card {
  margin-bottom: 12px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; transition: border-color .18s;
  border-left: 4px solid var(--tc, var(--line));
}
.team-card:hover { border-color: var(--line2); }
.team-card-head { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.team-card-head:hover .team-name { color: var(--accent); }
.team-card-title { flex: 1; min-width: 0; }
.team-name { font-weight: 700; font-size: 15.5px; }
.team-tags { color: var(--dim); font-size: 12px; margin-top: 4px; line-height: 1.6; }
.team-tags .kv { display: inline-block; margin-right: 12px; }
.team-tags .kv b { color: var(--text); font-weight: 600; }
.expand-hint { color: var(--dim); font-size: 12px; white-space: nowrap; }
.team-card-body { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .06); animation: fadein .25s; }

.table-scroll { overflow-x: auto; }
.players-table { width: 100%; min-width: 860px; border-collapse: collapse; font-size: 12.5px; }
.players-table th, .players-table td { padding: 6px 7px; text-align: center; border-bottom: 1px solid rgba(255, 255, 255, .04); }
.players-table th { color: var(--dim); font-weight: 600; border-bottom: 1px solid var(--line); font-size: 10px; text-transform: uppercase; letter-spacing: .4px; }
.players-table td.pname { text-align: left; white-space: nowrap; font-weight: 600; }
.players-table td.stat { color: var(--accent); font-variant-numeric: tabular-nums; }
.players-table td.acc { color: var(--green2); font-weight: 700; }
.players-table td.pos { color: var(--dim); }
.players-table tr:last-child td { border-bottom: none; }
.players-table tr:hover td { background: rgba(255, 255, 255, .025); }
.rating-pill {
  display: inline-block; min-width: 34px; padding: 2px 6px; border-radius: 6px;
  font-weight: 800; font-size: 11.5px; color: #08120b; background: var(--dim);
}
.rating-pill.good { background: var(--green2); }
.rating-pill.great { background: var(--accent); }
.rating-pill.poor { background: #d9575b; color: #fff; }

/* ---------- 6. match centre ---------- */
#match-modal {
  position: fixed; inset: 0; z-index: 50;
  /* fully opaque, and NOT animated: a half-faded overlay would let the
     page underneath show through if the animation ever failed to run */
  background: #060b08;
  display: flex; flex-direction: column; padding: 10px;
}
#match-modal[hidden] { display: none !important; }

.scoreboard {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px;
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--line2);
  border-radius: 14px; padding: 12px 24px;
  max-width: 1200px; width: 100%; margin: 0 auto 10px; position: relative;
}
.team-box { display: flex; align-items: center; gap: 12px; min-width: 0; }
/* The away box is written [score][name][colour] in the markup and must be
   READ in that order too: row-reverse flipped it to "Onche United 1", so the
   line came out «Team1 0 – Team2 1» instead of «Team1 0 – 1 Team2». Both
   scores belong in the middle, either side of the clock. */
.team-box.away { justify-content: flex-end; text-align: right; }
.team-color { width: 20px; height: 20px; border-radius: 7px; border: 2px solid rgba(255, 255, 255, .5); flex: 0 0 auto; }
.scoreboard .team-name { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-score { font-size: 36px; font-weight: 900; font-variant-numeric: tabular-nums; margin-left: auto; }
.team-box.away .team-score { margin-left: 0; margin-right: auto; }
.match-info { text-align: center; min-width: 150px; }
.time { font-size: 21px; font-weight: 900; color: var(--accent); font-variant-numeric: tabular-nums; }
.statline { font-size: 11px; color: var(--dim); }
.venue-line { font-size: 11px; color: var(--dim2); margin-top: 2px; }
.close {
  position: absolute; right: 10px; top: 10px; background: none; border: none;
  color: var(--dim); font-size: 20px; cursor: pointer; line-height: 1; padding: 4px 8px; border-radius: 8px;
}
.close:hover { color: var(--text); background: rgba(255, 255, 255, .06); }

.match-body { display: flex; gap: 12px; max-width: 1200px; width: 100%; margin: 0 auto; flex: 1; min-height: 0; }
.pitch-col { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
/* the pitch is bounded by BOTH the column width and the space left on
   screen, so the controls under it are always reachable without scrolling */
.pitch-col canvas {
  width: min(100%, calc((100vh - 260px) * 1.5));
  aspect-ratio: 3 / 2; background: #16241a; margin: 0 auto;
  border-radius: 12px; border: 1px solid var(--line); display: block;
}
.pitch-wrap { position: relative; display: flex; justify-content: center; }

/* timeline of the match's big moments */
.timeline {
  position: relative; height: 30px; margin-top: 8px; flex: 0 0 auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
}
.timeline .progress { position: absolute; inset: 0 auto 0 0; background: rgba(52, 168, 83, .16); width: 0; transition: width .2s linear; }
.timeline .half-line { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line2); }
.tl-mark {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  font-size: 11px; line-height: 1; cursor: default; white-space: nowrap;
}
.tl-mark[data-side="1"] { top: 72%; }
.tl-mark[data-side="0"] { top: 28%; }

.controls { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.speed-group { display: flex; gap: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.speed-btn { background: none; border: none; color: var(--dim); padding: 5px 11px; border-radius: 7px; cursor: pointer; font-size: 13px; font-weight: 600; }
.speed-btn:hover { color: var(--text); }
.speed-btn.active { background: var(--green); color: #fff; }
.goals-summary { color: var(--dim); font-size: 13px; margin-top: 8px; min-height: 18px; line-height: 1.5; }

/* right-hand column with tabs: commentary / stats / line-ups */
.side-col {
  width: 340px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; display: flex; flex-direction: column; min-height: 0;
}
.side-tabs { display: flex; gap: 4px; padding: 10px 10px 0; }
.side-tab {
  flex: 1; background: none; border: none; color: var(--dim);
  padding: 8px 6px; border-radius: 9px 9px 0 0; cursor: pointer;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 2px solid transparent;
}
.side-tab:hover { color: var(--text); }
.side-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.side-pane { flex: 1; overflow-y: auto; padding: 12px 14px 16px; min-height: 0; }
.side-pane[hidden] { display: none; }

#commentary { font-size: 13px; line-height: 1.55; }
.evt { padding: 5px 0; border-bottom: 1px solid rgba(255, 255, 255, .04); animation: rise .25s var(--ease) backwards; }
.evt .t { color: var(--dim2); font-size: 11px; margin-right: 7px; font-variant-numeric: tabular-nums; }
.evt.goal { color: var(--accent); font-weight: 700; }
.evt.card { color: var(--danger); }
.evt.save { color: var(--blue); }
.evt.pass { color: var(--dim); }
.evt.shot { color: var(--accent2); }
.evt.duel { color: #ffa64d; }
.evt.phase { color: #fff; font-weight: 800; text-transform: uppercase; font-size: 11.5px; letter-spacing: 1.2px; background: rgba(255, 255, 255, .05); padding: 6px 8px; border-radius: 7px; margin: 6px 0; }

/* live stat bars */
.statbar { margin-bottom: 12px; }
.statbar .lbl { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--dim); margin-bottom: 4px; }
.statbar .lbl b { color: var(--text); font-variant-numeric: tabular-nums; }
.statbar .track { height: 7px; border-radius: 4px; background: var(--panel3); display: flex; overflow: hidden; }
.statbar .track i { display: block; height: 100%; transition: width .35s var(--ease); }

/* momentum graph */
.momentum { height: 68px; background: var(--panel2); border: 1px solid var(--line); border-radius: 9px; position: relative; overflow: hidden; margin-bottom: 14px; }
.momentum .mid { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line2); }
.momentum svg { display: block; width: 100%; height: 100%; }

.lineup-team { margin-bottom: 16px; }
.lineup-team h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--dim); margin-bottom: 8px; display: flex; align-items: center; gap: 7px; }
.lineup-row { display: grid; grid-template-columns: 22px 1fr auto auto; gap: 8px; align-items: center; font-size: 12.5px; padding: 4px 0; border-bottom: 1px solid rgba(255, 255, 255, .04); }
.lineup-row .n { color: var(--dim2); font-variant-numeric: tabular-nums; text-align: right; }
.lineup-row .ev { color: var(--dim); font-size: 11px; letter-spacing: 1px; }
.lineup-row.off { opacity: .45; text-decoration: line-through; }
.motm { background: rgba(245, 197, 24, .1); border: 1px solid rgba(245, 197, 24, .35); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; }
.motm .ttl { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--accent); font-weight: 800; }
.motm .who { font-size: 15px; font-weight: 700; margin-top: 3px; }
.motm .line { font-size: 12px; color: var(--dim); margin-top: 3px; }

/* big-moment popup over the pitch */
.popup { position: absolute; top: 42%; left: 50%; transform: translate(-50%, -50%); z-index: 60; pointer-events: none; text-align: center; max-width: 92%; }
.popup-main { font-size: clamp(28px, 5vw, 46px); font-weight: 900; letter-spacing: 1px; text-shadow: 0 3px 16px rgba(0, 0, 0, .95); animation: popin .4s cubic-bezier(.2, 1.5, .4, 1); }
.popup-sub { font-size: 17px; font-weight: 600; color: #fff; margin-top: 8px; text-shadow: 0 2px 8px rgba(0, 0, 0, .95); animation: popin .4s cubic-bezier(.2, 1.5, .4, 1) .08s backwards; }
.popup[hidden] { display: none; }
.popup.fade { opacity: 0; transition: opacity .45s ease; }
@keyframes popin { from { opacity: 0; transform: scale(.3); } to { opacity: 1; transform: scale(1); } }

/* ---------- banners & empty state ---------- */
.matchday-banner {
  background: linear-gradient(90deg, rgba(52, 168, 83, .16), transparent);
  border: 1px solid var(--line2); border-left: 4px solid var(--green);
  color: var(--text); border-radius: 12px; padding: 11px 16px; margin-bottom: 16px;
  font-size: 13.5px; font-weight: 600;
}
.matchday-banner:empty { display: none; }
.matchday-banner.warn { border-color: var(--accent); border-left-color: var(--accent); color: var(--accent2); background: linear-gradient(90deg, rgba(245, 197, 24, .12), transparent); }
.matchday-banner.error { border-color: var(--danger); border-left-color: var(--danger); color: #ffb3b3; background: linear-gradient(90deg, rgba(229, 72, 77, .14), transparent); }

.empty-panel { text-align: center; padding: 56px 24px; }
.empty-panel h2 { font-size: 26px; color: var(--text); margin-bottom: 12px; text-transform: none; letter-spacing: 0; }
.empty-panel h2::after { display: none; }
.empty-panel p { color: var(--dim); margin-bottom: 8px; }
.empty-panel a { color: var(--accent); }

/* ---------- 7. local tools (editor / generator / live) ---------- */
.editor-main { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.team-panel { position: sticky; top: 74px; }
.team-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 9px; cursor: pointer; border: 1px solid transparent; }
.team-item:hover { background: var(--panel2); }
.team-item.active { border-color: var(--green); background: var(--panel2); }
.team-item .name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-item .form { color: var(--dim); font-size: 12px; }
.team-actions { display: flex; gap: 6px; margin-top: 12px; }

.form-row { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 12px; align-items: flex-end; }
.form-row label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--dim); }
.form-row label.grow { flex: 1; }
.form-row input[type=text] { background: var(--panel2); border: 1px solid var(--line); color: var(--text); padding: 8px 10px; border-radius: 8px; font-size: 14px; min-width: 170px; }
.form-row label.grow input[type=text] { width: 100%; }
.form-row input[type=text]:focus { outline: none; border-color: var(--green); }
.form-row input[type=color] { width: 52px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); padding: 2px; cursor: pointer; }
.form-row select { background: var(--panel2); border: 1px solid var(--line); color: var(--text); padding: 8px 10px; border-radius: 8px; font-size: 14px; }
.strategy { gap: 26px; }
.strategy label { flex-direction: row; align-items: center; gap: 8px; }
.strategy b { color: var(--accent); min-width: 16px; text-align: center; }
input[type=range] { accent-color: var(--green); }

table.players { border-collapse: collapse; font-size: 13px; width: 100%; }
.players th, .players td { padding: 6px 7px; text-align: center; border-bottom: 1px solid rgba(255, 255, 255, .05); }
.players th { color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; position: sticky; top: 0; background: var(--panel); }
.players td:first-child { color: var(--dim); }
.players td.pos { color: var(--dim); font-size: 12px; }
.players .stat { min-width: 74px; }
.players .stat .val { display: inline-block; width: 16px; color: var(--accent); font-weight: 700; }
.players input.player-name { background: transparent; border: 1px solid transparent; border-radius: 5px; color: var(--text); font: inherit; width: 100%; min-width: 110px; padding: 3px 5px; text-align: center; }
.players input.player-name:hover, .players input.player-name:focus { border-color: var(--line); background: var(--panel2); outline: none; }
.players .budget { font-weight: 700; }
.players .budget.over { color: var(--danger); }

.generator-main { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.generator-main .steps { margin: 6px 0 10px; padding-left: 20px; color: var(--dim); font-size: 13px; line-height: 1.6; }
.generator-main .steps li { margin-bottom: 8px; }
.generator-main .steps b { color: var(--text); }
.team-chips { color: var(--text); font-size: 13px; line-height: 2; }

table.results { border-collapse: collapse; font-size: 13px; width: 100%; }
.results th, .results td { padding: 5px 10px; border-bottom: 1px solid rgba(255, 255, 255, .05); text-align: left; }
.results th { color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; position: sticky; top: 0; background: var(--panel); }
.results td:nth-child(1) { color: var(--dim); }
.results td:nth-child(3) { text-align: right; }
.final-standings { margin-top: 18px; }
.final-standings h3 { font-size: 13px; color: var(--dim); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.key-row { align-items: center; }
#export-notes { margin-top: 10px; padding: 10px 14px; background: var(--panel2); border: 1px solid var(--line); border-radius: 9px; line-height: 1.6; }
.editor-page .table-scroll, .generator-main .table-scroll { max-height: 480px; overflow-y: auto; }

/* live broadcast page (legacy) */
.live-main { max-width: 1280px; margin: 0 auto; padding: 16px 24px; }
.broadcast-header { background: linear-gradient(180deg, #1a0f0f, #140b0b); border-bottom: 2px solid #5e1d1d; }
.header-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.conn-status { font-size: 12px; color: var(--dim); }
.live-badge { display: inline-flex; align-items: center; gap: 8px; background: #d0202a; color: #fff; font-weight: 800; letter-spacing: 1px; font-size: 14px; padding: 6px 14px; border-radius: 9px; animation: badge-glow 1.6s ease-in-out infinite; }
.live-badge[hidden] { display: none; }
.pulse-dot { width: 10px; height: 10px; border-radius: 50%; background: #fff; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes badge-glow { 0%, 100% { box-shadow: 0 0 10px rgba(208, 32, 42, .5); } 50% { box-shadow: 0 0 22px rgba(208, 32, 42, .9); } }
.broadcast-panel { padding: 16px; }
.broadcast-panel .scoreboard { margin-bottom: 12px; }
.pitch-wrap canvas { width: 100%; aspect-ratio: 3 / 2; background: #16241a; border-radius: 12px; border: 1px solid var(--line); display: block; }
.offair-overlay { position: absolute; inset: 0; background: rgba(8, 12, 9, .84); border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; z-index: 40; }
.offair-overlay[hidden] { display: none; }
.offair-title { font-size: 40px; font-weight: 900; letter-spacing: 8px; color: var(--dim); }
.offair-next { font-size: 16px; color: var(--text); }
.live-footer { margin-top: 12px; }
.live-footer .commentary-col, .commentary-col { width: 100%; }
.live-footer .side-col { width: 100%; height: 180px; }
.live-split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }

/* scrollbars */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--line2); }

/* ---------- 8. responsive ---------- */
@media (max-width: 1100px) {
  .league-split { grid-template-columns: 1fr; }
  .side-col { width: 300px; }
}
@media (max-width: 900px) {
  header { padding: 10px 14px; gap: 12px; }
  header nav { width: 100%; margin-left: 0; }
  main { padding: 16px 14px 48px; }
  .hero { padding: 20px 18px; }
  .editor-main, .generator-main, .live-split { grid-template-columns: 1fr; }
  .match-body { flex-direction: column; overflow-y: auto; }
  .pitch-col canvas { width: 100%; }
  .side-col { width: 100%; height: 280px; }
  .team-panel { position: static; }
  .scoreboard { padding: 10px 14px; gap: 10px; }
  .team-score { font-size: 27px; }
  .scoreboard .team-name { font-size: 13px; }
  .fixture-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
