/* ── Dagenham & Redbridge FC Stats Hub ── */
/* Aesthetic: bold sports editorial — red/black/white, condensed type */

:root {
  --red: #C8102E;
  --red-dark: #9a0c22;
  --red-light: #e8253f;
  --black: #0e0e0e;
  --dark: #1a1a1a;
  --mid: #2a2a2a;
  --panel: #f5f4f2;
  --border: #e0ddd8;
  --text: #1a1a1a;
  --muted: #6b6662;
  --white: #ffffff;
  --win: #1e8a4a;
  --draw: #b07d10;
  --loss: #b01c1c;
  --radius: 6px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Barlow', sans-serif;
  background: #f0ede8;
  color: var(--text);
  min-height: 100vh;
}

/* ── NAV ── */
.topnav {
  background: var(--black);
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0 2rem;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 3px solid var(--red);
}
.brand {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  line-height: 1;
  margin-right: 1rem;
}
.brand-dag {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: 1.4rem;
  color: var(--red);
  letter-spacing: 0.02em;
}
.brand-sub {
  font-size: 0.55rem;
  color: #888;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.nav-links { display: flex; gap: 0; }
.nav-link {
  color: #aaa;
  text-decoration: none;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0 1.2rem;
  height: 60px;
  display: flex;
  align-items: center;
  border-bottom: 3px solid transparent;
  margin-bottom: -3px;
  transition: color .15s, border-color .15s;
}
.nav-link:hover { color: var(--white); }
.nav-link.active { color: var(--white); border-bottom-color: var(--red); }
.admin-link { margin-left: 1rem; color: #666; }
.admin-link:hover { color: #aaa; }
.nav-logout {
  margin-left: auto;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: .82rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #666;
  text-decoration: none;
  padding: .3rem .85rem;
  border: 1px solid #444;
  border-radius: var(--radius);
  transition: all .15s;
}
.nav-logout:hover { color: #fff; border-color: var(--loss); background: var(--loss); }
.season-select {
  margin-left: auto;
  background: var(--mid);
  color: var(--white);
  border: 1px solid #444;
  border-radius: var(--radius);
  padding: .35rem .8rem;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

/* ── MAIN ── */
main {
  max-width: 1300px;
  margin: 0 auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── HERO STATS ── */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: .75rem;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1rem .75rem;
  text-align: center;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--border);
  transition: transform .15s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card.accent { background: var(--red); border-top-color: var(--red-dark); }
.stat-card.accent .stat-label { color: rgba(255,255,255,0.7); }
.stat-card.accent .stat-big { color: var(--white); }
.stat-card.win { border-top-color: var(--win); }
.stat-card.win .stat-big { color: var(--win); }
.stat-card.draw { border-top-color: var(--draw); }
.stat-card.draw .stat-big { color: var(--draw); }
.stat-card.loss { border-top-color: var(--loss); }
.stat-card.loss .stat-big { color: var(--loss); }
.stat-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat-big {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--black);
  line-height: 1.1;
  margin-top: .2rem;
}

/* ── CARDS ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.card-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--black);
  margin-bottom: 1rem;
  padding-bottom: .6rem;
  border-bottom: 2px solid var(--red);
  display: inline-block;
}

/* ── GRIDS ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

/* ── FORM GUIDE ── */
.form-guide { display: flex; flex-direction: column; gap: .75rem; }
.form-group { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.form-group-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  min-width: 130px;
}
.form-badges { display: flex; gap: .4rem; flex-wrap: wrap; }
.form-badge {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.1rem;
  font-weight: 900;
  width: 40px; height: 40px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  position: relative;
}
.form-badge[data-r="W"] { background: var(--win); color: #fff; }
.form-badge[data-r="D"] { background: var(--draw); color: #fff; }
.form-badge[data-r="L"] { background: var(--loss); color: #fff; }
.form-badge:hover .form-tooltip { opacity: 1; pointer-events: auto; }
.form-tooltip {
  position: absolute;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--black);
  color: #fff;
  font-size: .7rem;
  font-family: 'Barlow', sans-serif;
  font-weight: 400;
  white-space: nowrap;
  padding: .4rem .7rem;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  z-index: 10;
}

/* ── LEADERBOARD ── */
.leaderboard { display: flex; flex-direction: column; gap: .4rem; }
.lb-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem .6rem;
  border-radius: 4px;
  transition: background .1s;
}
.lb-row:hover { background: var(--panel); }
.lb-rank {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: 1.1rem;
  color: var(--muted);
  min-width: 24px;
  text-align: right;
}
.lb-rank.gold { color: #c8941a; }
.lb-rank.silver { color: #888; }
.lb-rank.bronze { color: #b06e40; }
.lb-bar-wrap { flex: 1; }
.lb-name {
  font-weight: 600;
  font-size: .95rem;
  color: var(--text);
}
.lb-sub { font-size: .8rem; color: var(--muted); }
.lb-bar {
  height: 4px;
  background: var(--panel);
  border-radius: 2px;
  margin-top: .3rem;
  overflow: hidden;
}
.lb-fill { height: 100%; background: var(--red); border-radius: 2px; transition: width .5s ease; }
.lb-val {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: 1.3rem;
  color: var(--red);
  min-width: 32px;
  text-align: right;
}

/* ── MATCH LIST ── */
.match-list { display: flex; flex-direction: column; gap: .4rem; }
.match-row {
  display: grid;
  grid-template-columns: 90px 1fr auto 1fr 60px;
  align-items: center;
  gap: .75rem;
  padding: .65rem .75rem;
  border-radius: 4px;
  font-size: .9rem;
  border-left: 3px solid transparent;
  transition: background .1s;
}
.match-row:hover { background: var(--panel); }
.match-row.win { border-left-color: var(--win); }
.match-row.draw { border-left-color: var(--draw); }
.match-row.loss { border-left-color: var(--loss); }
.match-date { color: var(--muted); font-size: .82rem; }
.match-home, .match-away { font-weight: 600; }
.match-home { text-align: right; }
.match-score {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: 1.2rem;
  text-align: center;
  color: var(--black);
  background: var(--panel);
  border-radius: 4px;
  padding: .1rem .5rem;
  min-width: 52px;
}
.match-comp { font-size: .75rem; color: var(--muted); text-align: right; }

/* ── TABLES ── */
.match-table-wrap, .players-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.match-table-wrap table  { min-width: 520px; }
.players-table-wrap table { min-width: 640px; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  padding: .5rem .75rem;
  text-align: left;
  white-space: nowrap;
}
td {
  padding: .55rem .75rem;
  border-bottom: 1px solid var(--panel);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--panel); }
.badge {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .78rem;
  font-weight: 700;
  padding: .15rem .45rem;
  border-radius: 3px;
  text-transform: uppercase;
}
.badge-w { background: #d4edda; color: var(--win); }
.badge-d { background: #fff3cd; color: var(--draw); }
.badge-l { background: #f8d7da; color: var(--loss); }

/* ── CARD TITLE ROW (title + inline control) ── */
.card-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.card-title-row .card-title { margin-bottom: 0; }
.comp-filter-select {
  font-family: 'Barlow', sans-serif;
  font-size: .78rem;
  padding: .25rem .5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

/* ── COMPETITION BREAKDOWN ── */
.comp-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.comp-table { min-width: 480px; }
.comp-table td { text-align: center; }
.comp-table td.comp-name { text-align: left; font-weight: 600; }
.comp-table td.win  { color: var(--win); font-weight: 600; }
.comp-table td.draw { color: var(--draw); font-weight: 600; }
.comp-table td.loss { color: var(--loss); font-weight: 600; }
.comp-table th { text-align: center; }
.comp-table th:first-child { text-align: left; }

/* ── PAGE HEADER ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: .5rem;
}
.page-header h1 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 2rem;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--black);
}
.filter-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.filter-btn {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: .82rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .35rem .9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
}
.filter-btn:hover { border-color: var(--red); color: var(--red); }
.filter-btn.active { background: var(--red); color: #fff; border-color: var(--red); }
.search-input {
  font-family: 'Barlow', sans-serif;
  font-size: .88rem;
  padding: .35rem .8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text);
  width: 200px;
}
.search-input:focus { outline: none; border-color: var(--red); }

/* ── ADMIN FORMS ── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; }
.tab-btn {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: .88rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: .65rem 1.4rem;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--red); border-bottom-color: var(--red); }
.hidden { display: none !important; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
label {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
.form-input {
  font-family: 'Barlow', sans-serif;
  font-size: .9rem;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text);
  transition: border-color .15s;
}
.form-input:focus { outline: none; border-color: var(--red); }
.btn-primary {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: .9rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: var(--red);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  padding: .65rem 1.75rem;
  cursor: pointer;
  transition: background .15s;
}
.btn-primary:hover { background: var(--red-dark); }
.btn-secondary {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: .9rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .65rem 1.75rem;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
  display: inline-block;
}
.btn-secondary:hover { background: var(--border); }
.form-msg {
  margin-top: .75rem;
  font-size: .88rem;
  min-height: 1.2rem;
}
.form-msg.ok { color: var(--win); }
.form-msg.err { color: var(--loss); }
.import-section { padding: 1.25rem 0; border-bottom: 1px solid var(--panel); }
.import-section:last-child { border-bottom: none; }
.import-section h3 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: .95rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .5rem;
}
.helper-text { font-size: .82rem; color: var(--muted); margin-bottom: .75rem; }
.squad-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .5rem;
  margin-top: .75rem;
}
.squad-card {
  background: var(--panel);
  border-radius: 4px;
  padding: .6rem .75rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
}
.squad-num {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: 1.2rem;
  color: var(--red);
  min-width: 28px;
}
.squad-pos {
  font-size: .72rem;
  color: var(--muted);
  text-transform: uppercase;
}

/* ── GRIDS (extended) ── */
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.5rem; }

/* ── PITCH MAP ── */
.pitch-wrap {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  flex-wrap: wrap;
}
.pitch-svg-container {
  flex: 0 0 auto;
  position: relative;
  cursor: crosshair;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  max-width: 100%;
}
.pitch-svg-container svg { display: block; }

/* Dashboard pitch — grid gives the container a concrete width the SVG can fill */
#pitchMapWrap {
  display: grid;
  grid-template-columns: 1fr;
  gap: .75rem;
}
#dashPitchContainer {
  cursor: default;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.22);
}
#dashPitchContainer svg {
  width: 100%;
  height: auto;
  display: block;
}
#pitchMapLegend {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: .75rem 1.5rem;
}

.pitch-legend {
  flex: 1;
  min-width: 160px;
  font-size: .82rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.pitch-legend-item { display: flex; align-items: center; gap: .5rem; }
.pitch-legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── SQUAD FORMATION ── */
.formation-pitch {
  background: linear-gradient(to bottom, #2e6b2e 0%, #3d7a3d 40%, #3d7a3d 60%, #2e6b2e 100%);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-x: auto;
}
.formation-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
}
.formation-row-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: .7rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
}
.formation-players {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .4rem;
}
.formation-chip {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 20px;
  padding: .28rem .65rem;
  display: flex;
  align-items: center;
  gap: .3rem;
  cursor: default;
  transition: background .15s;
}
.formation-chip:hover { background: rgba(255,255,255,0.22); }
.formation-chip-pos {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: rgba(255,255,255,0.45);
  margin-left: .1rem;
}
.formation-chip-num {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: .88rem;
  color: rgba(255,255,255,0.5);
  min-width: 14px;
  text-align: right;
}
.formation-chip-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: .88rem;
  color: #fff;
  white-space: nowrap;
}
.formation-divider {
  height: 1px;
  background: rgba(255,255,255,0.12);
  width: 100%;
}

/* ── GOAL ENTRY LIST (admin) ── */
.goal-entry-list { display: flex; flex-direction: column; gap: .4rem; margin-top: 1rem; }
.goal-entry {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .55rem .75rem;
  border-radius: 4px;
  background: var(--panel);
  font-size: .88rem;
}
.goal-entry-min {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: 1rem;
  color: var(--red);
  min-width: 36px;
}
.goal-entry-detail { flex: 1; }
.goal-entry-name { font-weight: 600; }
.goal-entry-meta { font-size: .75rem; color: var(--muted); }
.btn-danger {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: .8rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: none;
  color: var(--loss);
  border: 1px solid var(--loss);
  border-radius: var(--radius);
  padding: .25rem .65rem;
  cursor: pointer;
  transition: all .15s;
}
.btn-danger:hover { background: var(--loss); color: #fff; }

/* ── HOME / AWAY RECORD ── */
.ha-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .5rem;
  margin-bottom: .75rem;
}
.ha-stat {
  text-align: center;
  padding: .4rem .25rem;
  border-radius: 4px;
  background: var(--panel);
}
.ha-stat.win .ha-val { color: var(--win); }
.ha-stat.draw .ha-val { color: var(--draw); }
.ha-stat.loss .ha-val { color: var(--loss); }
.ha-val {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: 1.35rem;
  color: var(--black);
  line-height: 1.1;
}
.ha-lbl {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
}
.ha-pts {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: .85rem;
  color: var(--muted);
  text-align: right;
  letter-spacing: .04em;
}

/* ── COMEBACK / GAME STATE ── */
.cb-section-head {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: .35rem;
}
.cb-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .2rem 0;
  font-size: .88rem;
  border-bottom: 1px solid var(--panel);
}
.cb-row:last-child { border-bottom: none; }
.cb-label { color: var(--text); }
.cb-val { font-family: 'Barlow Condensed', sans-serif; font-weight: 900; font-size: 1.05rem; }

/* ── FIRST / SECOND HALF SPLIT ── */
.half-split {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  margin-top: .75rem;
  padding-top: .75rem;
  border-top: 1px solid var(--panel);
}
.half-split-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
}
.half-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  min-width: 62px;
}
.half-scored { font-weight: 600; color: var(--red); }
.half-conceded { font-weight: 600; color: var(--muted); }
.half-sep { color: var(--border); }

/* ── AGE PROFILE ── */
.age-avg {
  display: flex;
  align-items: baseline;
  gap: .4rem;
  margin-bottom: .75rem;
}
.age-avg-num {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: 2.4rem;
  color: var(--black);
  line-height: 1;
}
.age-avg-lbl {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

/* ── MATCH DETAIL ── */
.match-detail-header {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2rem 1.5rem 1.5rem;
  box-shadow: var(--shadow);
  text-align: center;
  border-top: 4px solid var(--red);
  margin-bottom: 0;
}
.match-detail-header.win { border-top-color: var(--win); }
.match-detail-header.draw { border-top-color: var(--draw); }
.match-detail-header.loss { border-top-color: var(--loss); }
.match-detail-teams {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.match-detail-team {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 1.35rem;
  flex: 1;
  min-width: 140px;
}
.match-detail-team-home { text-align: right; }
.match-detail-team-away { text-align: left; }
.match-detail-score {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: 3rem;
  color: var(--black);
  background: var(--panel);
  border-radius: var(--radius);
  padding: .2rem 1.5rem;
  min-width: 130px;
  text-align: center;
  white-space: nowrap;
  flex-shrink: 0;
}
.match-detail-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  font-size: .85rem;
  color: var(--muted);
  flex-wrap: wrap;
}
.formation-badge {
  display: inline-block;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: .82rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: var(--red);
  color: var(--white);
  border-radius: 20px;
  padding: .2rem .85rem;
}

/* Bench */
.lineup-bench {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .6rem;
}
.bench-chip {
  background: var(--panel);
  border-radius: 4px;
  padding: .4rem .65rem;
  display: flex;
  align-items: center;
  gap: .45rem;
}
.bench-num {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: 1rem;
  color: var(--muted);
  min-width: 20px;
}
.bench-name { font-weight: 600; font-size: .85rem; }
.bench-pos { font-size: .72rem; color: var(--muted); text-transform: uppercase; }

/* Substitutions */
.sub-list { display: flex; flex-direction: column; gap: .4rem; margin-top: .5rem; }
.sub-event {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .9rem;
  padding: .35rem .5rem;
  border-radius: 4px;
  transition: background .1s;
}
.sub-event:hover { background: var(--panel); }
.sub-min {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: .95rem;
  color: var(--muted);
  min-width: 38px;
}
.sub-icon { font-weight: 900; font-size: 1.1rem; color: var(--muted); }
.sub-out { color: var(--muted); }
.sub-in { font-weight: 600; }

/* Goals in match detail */
.match-goal-row {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .5rem .6rem;
  border-left: 3px solid var(--border);
  margin-bottom: .35rem;
  border-radius: 0 4px 4px 0;
  font-size: .9rem;
  transition: background .1s;
}
.match-goal-row:hover { background: var(--panel); }
.goal-min {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: 1rem;
  color: var(--red);
  min-width: 36px;
  padding-top: .05rem;
}
.goal-tag {
  display: inline-block;
  font-size: .7rem;
  background: var(--panel);
  color: var(--muted);
  border-radius: 3px;
  padding: .1rem .35rem;
  margin-right: .25rem;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.goal-location-tile {
  display: inline-block;
  margin: .45rem 0 .1rem;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
}

/* Clickable table rows */
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #ede9e3 !important; }

/* ── TOP SECTION (Twitter + Stats) ── */
.top-section {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.5rem;
  align-items: start;
}
.twitter-panel { padding: 1.25rem; }

/* ── SOCIAL / FOLLOW CARD ── */
.social-links {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  margin-bottom: 1rem;
}
.social-btn {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-decoration: none;
  padding: .75rem 1.25rem;
  border-radius: var(--radius);
  transition: opacity .15s;
}
.social-btn:hover { opacity: .85; }
.social-x {
  background: #000;
  color: #fff;
}
.social-timeline-link {
  font-size: .88rem;
  color: var(--red);
  font-weight: 600;
  text-decoration: none;
  padding: .25rem 0;
}
.social-timeline-link:hover { text-decoration: underline; }
.social-note {
  font-size: .78rem;
  color: var(--muted);
  line-height: 1.5;
  border-top: 1px solid var(--border);
  padding-top: .75rem;
  margin-top: .25rem;
}

/* ── CLUB RECORDS ── */
.records-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-bottom: .75rem; }
.record-box { background: var(--panel); border-radius: var(--radius); padding: .75rem; }
.record-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: .25rem; }
.record-main { font-family: 'Barlow Condensed', sans-serif; font-weight: 900; font-size: 1.6rem; line-height: 1; }
.record-sub { font-size: .75rem; color: var(--muted); margin-top: .25rem; }
.streak-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.streak-item { background: var(--panel); border-radius: var(--radius); padding: .55rem .4rem; text-align: center; }
.streak-val { font-family: 'Barlow Condensed', sans-serif; font-weight: 900; font-size: 1.6rem; line-height: 1; }
.streak-lbl { font-size: .65rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: .2rem; line-height: 1.3; }

/* ── SCORING FIRST ── */
.sf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.sf-box { background: var(--panel); border-radius: var(--radius); padding: .65rem .75rem; }
.sf-head { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: .45rem; }
.sf-row { display: flex; justify-content: space-between; align-items: baseline; font-size: .85rem; padding: .18rem 0; }
.sf-label { color: var(--text); }
.sf-pct { font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: .95rem; }
.sf-pct small { font-size: .72rem; color: var(--muted); font-weight: 500; }

/* ── SCORELINES ── */
.scorelines-wrap { display: flex; flex-wrap: wrap; gap: .45rem; }
.sl-chip { padding: .35rem .7rem; border-radius: var(--radius); font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 1rem; border: 2px solid transparent; }
.sl-win  { background: rgba(30,138,74,.09);  border-color: rgba(30,138,74,.25);  color: var(--win); }
.sl-draw { background: rgba(176,125,16,.08); border-color: rgba(176,125,16,.25); color: var(--draw); }
.sl-loss { background: rgba(200,16,46,.07);  border-color: rgba(200,16,46,.2);   color: var(--loss); }
.sl-count { font-size: .75rem; font-weight: 600; color: var(--muted); margin-left: .2rem; }

/* ── HAT-TRICKS TABLE ── */
.ht-row { display: flex; align-items: center; gap: .75rem; padding: .5rem 0; border-bottom: 1px solid var(--border); font-size: .87rem; }
.ht-row:last-child { border-bottom: none; }
.ht-badge { display: inline-block; padding: .15rem .5rem; border-radius: var(--radius); font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.ht-badge.hat-trick { background: rgba(200,16,46,.1); color: var(--red); }
.ht-badge.brace { background: rgba(26,94,168,.1); color: #1a5ea8; }
.ht-name { font-weight: 600; min-width: 120px; }
.ht-detail { color: var(--muted); font-size: .82rem; }
.ht-goals { font-family: 'Barlow Condensed', sans-serif; font-weight: 900; font-size: 1.1rem; color: var(--red); min-width: 22px; }

/* ── CARD CHIPS (player table) ── */
.card-chip { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 26px; border-radius: 3px; font-size: .78rem; font-weight: 700; }
.card-y { background: #f5c518; color: #333; }
.card-r { background: #C8102E; color: white; }

/* ── RESPONSIVE ── */

/* ── Tablet (≤ 900px) ── */
@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .hero-stats { grid-template-columns: repeat(5, 1fr); }
  .top-section { grid-template-columns: 1fr; }
  main { padding: 1.25rem; gap: 1.1rem; }
}

/* ── Mobile (≤ 768px) ── */
@media (max-width: 768px) {
  /* Nav: brand + season on row 1, links scroll on row 2 */
  .topnav {
    height: auto;
    flex-wrap: wrap;
    padding: .45rem .9rem;
    gap: .3rem .5rem;
    align-items: center;
  }
  .brand { order: 1; margin-right: 0; }
  .season-select { order: 2; margin-left: auto; }
  .nav-logout { order: 2; margin-left: .5rem; }
  .nav-links {
    order: 3;
    flex: 0 0 100%;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 0;
    margin: .2rem -.9rem 0;
    padding: .25rem .9rem 0;
    border-top: 1px solid rgba(255,255,255,.1);
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-link {
    height: 34px;
    padding: 0 .8rem;
    font-size: .78rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Layout */
  main { padding: .75rem; gap: .85rem; }
  .card { padding: 1rem; }

  /* Hero stats: 3 across */
  .hero-stats { grid-template-columns: repeat(3, 1fr); gap: .5rem; }
  .stat-big { font-size: 2rem; }
  .stat-card { padding: .85rem .5rem; }

  /* Page headers */
  .page-header { flex-direction: column; align-items: flex-start; gap: .4rem; }
  .page-header h1 { font-size: 1.6rem; }
  .search-input { width: 100%; max-width: 340px; }

  /* Recent match rows: drop home team + competition, show date / score / away */
  .match-row { grid-template-columns: 68px auto 1fr; gap: .4rem; }
  .match-home, .match-comp { display: none; }
  .match-away { text-align: left; }

  /* Admin tabs: horizontal scroll */
  .tabs {
    overflow-x: auto;
    scrollbar-width: none;
    margin-left: -1rem;
    margin-right: -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab-btn { white-space: nowrap; padding: .55rem 1rem; font-size: .8rem; }

  /* Match detail: smaller score display */
  .match-detail-score { font-size: 2.2rem; min-width: 90px; padding: .2rem .9rem; }
  .match-detail-team { font-size: 1.1rem; min-width: 100px; }
  .match-detail-teams { gap: .85rem; }

  /* Leaderboard: tighter */
  .lb-row { padding: .4rem .35rem; gap: .5rem; }
}

/* ── Small mobile (≤ 480px) ── */
@media (max-width: 480px) {
  main { padding: .5rem; gap: .65rem; }
  .card { padding: .8rem; }

  /* Hero: keep 3 cols but compact */
  .hero-stats { grid-template-columns: repeat(3, 1fr); gap: .3rem; }
  .stat-big { font-size: 1.65rem; }
  .stat-label { font-size: .64rem; }
  .stat-card { padding: .65rem .3rem; }

  /* Records: stack to 1 col */
  .records-grid { grid-template-columns: 1fr; }
  .streak-grid { grid-template-columns: repeat(2, 1fr); }

  /* Scoring first: stack */
  .sf-grid { grid-template-columns: 1fr; gap: .5rem; }

  /* HA grid: tighter */
  .ha-grid { gap: .3rem; }
  .ha-val { font-size: 1.1rem; }
  .ha-lbl { font-size: .6rem; }

  /* Formation chips */
  .formation-chip { padding: .22rem .5rem; }
  .formation-chip-name { font-size: .8rem; }
  .formation-chip-num { font-size: .82rem; }

  /* Pitch map */
  .pitch-wrap { justify-content: center; }
  #pitchMapWrap { grid-template-columns: 1fr; }

  /* Match detail */
  .match-detail-score { font-size: 1.8rem; min-width: 70px; padding: .15rem .6rem; }
  .match-detail-team { font-size: 1rem; min-width: 80px; }
  .match-detail-teams { gap: .5rem; }
  .match-detail-header { padding: 1.25rem 1rem 1rem; }

  /* Card title smaller */
  .card-title { font-size: .9rem; margin-bottom: .75rem; }

  /* Scoreline chips: smaller */
  .sl-chip { font-size: .88rem; padding: .28rem .55rem; }

  /* Bench chips wrap nicely */
  .bench-chip { padding: .3rem .5rem; }
  .bench-name { font-size: .8rem; }
}
