/* ═══ THEME SYSTEM ═══ */
html { color-scheme: dark light; }

/* Responsive horizontal padding — used by .app and header bleed */
:root { --app-pad: clamp(14px, 4vw, 48px); }

/* DARK THEME (default) — FFA brand identity, aligned with FFA mobile app */
:root, [data-theme="dark"] {
  --teal: #2dd4db;              /* FFA cyan/turkis — primær, vibrant */
  --teal-light: #55dde3;
  --teal-bright: #7de8ec;
  --teal-dim: rgba(45,212,219,0.15);
  --teal-glow: rgba(45,212,219,0.35);
  --navy: #0d3d4f;              /* stadig tilgængelig til detaljer */
  --navy-deep: #071929;
  --black: #0a1929;             /* ren mørk navy — som FFA app */
  --surface: #0d2137;
  --card: #102840;
  --card2: #163350;
  --border: #1e3d58;
  --border2: #2a5070;
  --text: #e8f4f8;
  --muted: #7aaabb;
  --white: #ffffff;
  --red: #ff6b6b;
  --amber: #ffb84d;
  --amber-dim: rgba(255,184,77,0.15);

  --pitch-grass: #0e5c3e;
  --pitch-stripe: #0a5236;
  --pitch-lines: rgba(255,255,255,0.5);
  --shadow-soft: rgba(0,0,0,0.5);
  --shadow-card: rgba(0,0,0,0.3);
  --grass-dot-shadow: rgba(0,0,0,0.5);
  --purple: #b094f0;

  /* Semantic "text color for element sitting on X background" */
  --on-teal: #0a1a14;       /* dark text on bright teal */
  --on-amber: #0a1a14;      /* dark text on amber */
  --on-red: #ffffff;        /* white text on red */
}

/* LIGHT THEME — FFA brand */
[data-theme="light"] {
  --teal: #15456a;              /* Navy — primary interactive: buttons, active nav */
  --teal-light: #1a5580;
  --teal-bright: #1dd3d3;       /* Cyan — used ONLY for focus rings & rare accents */
  --teal-dim: rgba(21,69,106,0.08);
  --teal-glow: rgba(21,69,106,0.18);
  --navy: #15456a;
  --navy-deep: #0d2d47;
  --black: #f0f3f5;             /* Page background — neutral grey */
  --surface: #f8fafc;           /* Slightly off-white surface */
  --card: #ffffff;              /* Cards: pure white */
  --card2: #f1f4f7;             /* Secondary: light grey */
  --border: #e2e8ed;            /* Borders: subtle grey */
  --border2: #c8d4dc;
  --text: #111827;              /* Body text: near-black */
  --muted: #4b6070;             /* Secondary text: dark grey */
  --white: #111827;
  --red: #c0392b;
  --amber: #b45309;
  --amber-dim: rgba(180,83,9,0.1);

  --pitch-grass: #0e7a50;
  --pitch-stripe: #0a6b46;
  --pitch-lines: rgba(255,255,255,0.75);
  --shadow-soft: rgba(0,0,0,0.08);
  --shadow-card: rgba(0,0,0,0.05);
  --grass-dot-shadow: rgba(0,0,0,0.18);
  --purple: #5b3fa0;

  /* Navy button → white text */
  --on-teal: #ffffff;
  --on-amber: #ffffff;
  --on-red: #ffffff;
}

html { color-scheme: dark; }
[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--black) !important;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  min-height: 100vh;
}
html { background: var(--black); }
body::before {
  content: ''; position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 70% 40% at 85% 10%, rgba(0,184,150,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 5% 90%, rgba(0,184,150,0.04) 0%, transparent 60%);
  pointer-events: none; z-index: 0;
}
.app {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--app-pad) 100px;
  background: var(--black);
  min-height: 100vh;
}

/* HEADER */
header {
  display: flex; align-items: center; gap: 16px;
  padding: 14px clamp(20px, 4vw, 48px);
  margin: 0 calc(-1 * var(--app-pad)) 24px;
  background: linear-gradient(135deg, #071929 0%, #0d3347 60%, #0f3d52 100%);
  border-radius: 0 0 20px 20px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

/* Brand: logo + title */
.header-brand {
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
}
.header-logo {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(29,211,211,0.4);
  flex-shrink: 0;
}
.header-titles {
  display: flex; align-items: center; gap: 6px;
}
.header-title {
  font-family: 'Bebas Neue', cursive;
  font-size: clamp(16px, 3vw, 26px);
  letter-spacing: 2px;
  color: #ffffff;
  line-height: 1;
  white-space: nowrap;
}
.save-dot { display:inline-block; width:6px; height:6px; border-radius:50%; background:#1dd3d3; margin-left:2px; opacity:0; transition:opacity .3s; vertical-align: middle; }
.save-dot.on { opacity:1; animation: blink 1s infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.2} }

/* Legacy selectors — keep for old refs */

/* Theme toggle button */
.theme-toggle {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 14px;
  width: 44px; height: 44px;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.theme-toggle:hover {
  border-color: var(--teal);
  transform: translateY(-1px);
}
.theme-toggle:active { transform: scale(0.95); }
.tt-icon { display: block; transition: transform 0.3s; }
.theme-toggle:hover .tt-icon { transform: rotate(20deg); }

/* NAV */
.nav {
  display: flex; gap: 4px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 18px; padding: 5px;
  width: fit-content; margin-bottom: 28px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.18);
}
.nav-btn {
  background: none; border: none; color: var(--muted);
  font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 500;
  padding: 9px 20px; border-radius: 13px; cursor: pointer; transition: all .2s; white-space: nowrap;
}
.nav-btn.active { background: var(--teal); color: var(--on-teal); font-weight: 700; box-shadow: 0 4px 14px var(--teal-glow); }
.nav-btn:hover:not(.active) { color: var(--text); background: var(--card2); }

/* MATCH GRID */
/* ═══ MATCHES LIST ═════════════════════════════════════════════════ */
.matches-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 28px;
}

.match-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  position: relative;
  overflow: hidden;
}
.match-card::after {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--teal);
  opacity: 0;
  transition: opacity 0.15s;
  border-radius: 14px 0 0 14px;
}
.match-card:hover {
  background: var(--card2);
  border-color: var(--border2);
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}
.match-card:hover::after { opacity: 1; }
.match-card.open {
  border-color: var(--teal);
  background: var(--card2);
  box-shadow: 0 0 0 1px var(--teal);
}
.match-card.open::after { opacity: 1; }
.match-card.confirmed { border-color: rgba(45,212,219,0.4); }
.match-card.confirmed::after { opacity: 0.5; }

/* Left column — round number + H/U */
.mc-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  width: 36px;
}
.mc-num {
  font-family: 'Bebas Neue', cursive;
  font-size: 28px;
  color: var(--teal);
  line-height: 1;
}
.match-card.match-training .mc-num { color: var(--amber); }

.mc-venue {
  font-size: 9px; font-weight: 700; padding: 1px 5px;
  border-radius: 4px; line-height: 1.6;
}
.venue-h { background: var(--teal-dim); color: var(--teal); }
.venue-u { background: var(--amber-dim); color: var(--amber); }

/* Middle — opponent + date + pips */
.mc-mid { flex: 1; min-width: 0; }
.mc-opp {
  font-size: 14px; font-weight: 600;
  color: var(--text); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mc-type-tag {
  font-size: 10px; font-weight: 600;
  color: var(--amber); margin-left: 6px;
  background: var(--amber-dim); padding: 1px 6px;
  border-radius: 4px; vertical-align: middle;
}
.mc-date { font-size: 11px; color: var(--muted); margin-top: 2px; }
.pip-row { display: flex; gap: 3px; margin-top: 7px; flex-wrap: wrap; }
.pip { width: 6px; height: 6px; border-radius: 50%; background: var(--border2); }
.pip.s { background: var(--amber); }
.pip.p { background: var(--teal); }

/* Right — result + status */
.mc-right { flex-shrink: 0; text-align: right; }
.mc-res {
  font-family: 'Bebas Neue', cursive;
  font-size: 20px; color: var(--teal); line-height: 1;
  letter-spacing: 1px;
}
.mc-res-pending { color: var(--border2); font-size: 18px; }
.mc-status { font-size: 10px; color: var(--muted); margin-top: 3px; white-space: nowrap; }

/* Training style */
.match-card.match-training { border-style: dashed; opacity: 0.9; }
.match-card.match-training::after { background: var(--amber); }

/* Legacy — keep for fallback */
.mc-badge { display: none; }
.type-badge { display: none; }
[data-theme="light"] .type-badge.type-training { display: none; }

/* Filter chips — above match grid */
.filter-chips {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  grid-column: 1 / -1;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.chip:hover { border-color: var(--teal); transform: translateY(-1px); }
.chip.active {
  background: var(--teal);
  color: var(--on-teal);
  border-color: var(--teal);
  font-weight: 700;
  box-shadow: 0 4px 14px var(--teal-glow);
}
.chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  background: rgba(0,0,0,0.12);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}
.chip.active .chip-count {
  background: rgba(0,0,0,0.2);
}
[data-theme="light"] .chip:not(.active) .chip-count { background: rgba(0,0,0,0.06); }

/* Light theme nav: navy active, white card bg */
[data-theme="light"] .nav {
  background: #ffffff;
  border-color: #e2e8ed;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
/* Cyan accent: active step tab number only */
[data-theme="light"] .step-tab.active .snum,
[data-theme="light"] .step-tab.done .snum { color: #1dd3d3; }
/* Light match card: clean white with grey border */
[data-theme="light"] .match-card {
  background: #ffffff;
  border-color: #e2e8ed;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
[data-theme="light"] .match-card:hover {
  background: #f8fafc;
  border-color: #c8d4dc;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}
[data-theme="light"] .match-card.open {
  border-color: #15456a;
  background: #f8fafc;
  box-shadow: 0 0 0 1px #15456a;
}
[data-theme="light"] .match-card::after { background: #15456a; }
[data-theme="light"] .match-card.match-training::after { background: #b45309; }
/* Cyan used for match result number — one special detail */
[data-theme="light"] .mc-res { color: #1dd3d3; }
[data-theme="light"] .mc-res.mc-res-pending { color: #c8d4dc; }
[data-theme="light"] .mc-num { color: #15456a; }
[data-theme="light"] .venue-h { background: rgba(21,69,106,0.1); color: #15456a; }
/* Roster tiles in light mode */
[data-theme="light"] .roster-tile {
  background: #ffffff;
  border-color: #e2e8ed;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
[data-theme="light"] .roster-tile:hover {
  background: #f8fafc;
  border-color: #c8d4dc;
  box-shadow: 0 3px 12px rgba(0,0,0,0.07);
}
[data-theme="light"] .rt-num { color: #15456a; }
[data-theme="light"] .rt-chip-fav { background: rgba(29,211,211,0.12); color: #0d8f8f; border-color: rgba(29,211,211,0.3); }
/* Tier badges in light mode: keep legible on white */

/* Light theme: header stays dark navy — same in both themes */
[data-theme="light"] header {
  background: linear-gradient(135deg, #071929 0%, #0d3347 60%, #0f3d52 100%);
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}
[data-theme="light"] .theme-toggle {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
}

/* Add match button — top of matches view */
.add-match-btn-top {
  font-size: 14px;
  padding: 10px 18px;
  min-height: 40px;
  border-radius: 12px;
  flex-shrink: 0;
}

/* Empty state */
.empty-state {
  grid-column: 1 / -1;
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* Edit match button — in match panel header */
.edit-match-btn {
  background: var(--card2);
  border: 1px solid var(--border2);
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  transition: all 0.15s;
  flex-shrink: 0;
}
.edit-match-btn:hover { border-color: var(--teal); }

/* Match form modal fields */
.match-form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.match-form-row > label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.match-form-row input,
.match-form-row select {
  background: var(--card2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  outline: none;
  width: 100%;
}
.match-form-row input:focus,
.match-form-row select:focus { border-color: var(--teal); }
.match-form-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.match-form-type-btns {
  display: flex;
  gap: 8px;
}
.match-form-type-btns button {
  flex: 1;
  padding: 12px;
  background: var(--card2);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.match-form-type-btns button.active {
  border-color: var(--teal);
  background: rgba(63,179,184,0.12);
  color: var(--teal);
}
.match-form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.match-form-actions .btn-primary,
.match-form-actions .btn-secondary { flex: 1; }
.match-form-danger {
  background: rgba(224,85,85,0.12);
  color: var(--red);
  border: 1px solid rgba(224,85,85,0.4);
  padding: 10px;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  cursor: pointer;
  margin-top: 12px;
  width: 100%;
  text-align: center;
  font-weight: 600;
}
.match-form-danger:hover { background: rgba(224,85,85,0.2); }

/* MATCH PANEL */
#matchPanel { scroll-margin-top: 16px; }

.panel-header {
  background: var(--card); border: none;
  border-radius: 24px; padding: 20px 24px; margin-bottom: 20px;
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
  position: relative;
  box-shadow: 0 6px 28px rgba(0,0,0,0.28);
}
.ph-num { font-family: 'Bebas Neue', cursive; font-size: 52px; color: var(--teal); line-height: 1; }
.ph-info { flex: 1; min-width: 160px; }
.ph-fixture { font-weight: 600; font-size: 15px; line-height: 1.4; color: var(--text); }
.ph-fixture .vs { color: var(--muted); font-weight: 400; font-size: 12px; }
.ph-sub { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.7; }
.ph-result {
  font-family: 'Bebas Neue', cursive; font-size: 34px; color: var(--teal);
  background: var(--teal-dim); border: 1px solid rgba(0,184,150,.2);
  border-radius: 10px; padding: 6px 16px;
}
.ph-result-live {
  display: inline-flex;
  align-items: center;
  min-width: 72px;
  justify-content: center;
}
.ri-wrap { display: flex; align-items: center; gap: 8px; }
.ri-wrap label { font-size: 11px; color: var(--muted); }
.ri {
  background: var(--card2); border: 1px solid var(--border2); color: var(--text);
  font-family: 'DM Sans',sans-serif; font-size: 13px; padding: 7px 10px;
  border-radius: 8px; width: 90px; outline: none; transition: border-color .2s;
}
.ri:focus { border-color: var(--teal); }
.hw-badge { font-size: 10px; font-weight: 700; padding: 4px 10px; border-radius: 8px; }

/* STEPS */
.steps-row {
  display: flex; background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; overflow: hidden; margin-bottom: 22px;
  box-shadow: 0 3px 14px rgba(0,0,0,0.16);
}
.step-tab {
  flex: 1; padding: 12px 8px; text-align: center; cursor: pointer;
  border: none; background: none; color: var(--muted);
  font-family: 'DM Sans',sans-serif; font-size: 12px; font-weight: 500;
  transition: all .2s; border-right: 1px solid var(--border); position: relative;
}
.step-tab:last-child { border-right: none; }
.step-tab .snum { font-family: 'Bebas Neue', cursive; font-size: 22px; display: block; color: var(--border2); margin-bottom: 1px; }
.step-tab.active { background: var(--card2); color: var(--text); }
.step-tab.active .snum { color: var(--teal); }
.step-tab.done { color: var(--muted); }
.step-tab.done .snum { color: var(--teal); }
.step-tab.done::after { content:'✓'; position:absolute; top:6px; right:8px; font-size:10px; color:var(--teal); }

/* SECTION LABEL */
.sec-lbl { font-family: 'Bebas Neue', cursive; font-size: 19px; letter-spacing: 2px; color: var(--teal); margin-bottom: 14px; }

/* PLAYER GRID */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(148px, 16vw, 200px), 1fr)); gap: 8px; margin-bottom: 20px; }
.ptile {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 7px;
  transition: border-color .15s;
}
.ptile.hi-teal { border-color: var(--teal); box-shadow: 0 0 10px var(--teal-glow); }
.ptile.hi-amber { border-color: var(--amber); }
.ptile.dimmed { opacity: .42; }
.pstats { display: flex; gap: 5px; }
.sp { background: var(--card2); border-radius: 5px; padding: 2px 6px; font-size: 10px; color: var(--muted); }
.sp b { color: var(--text); }
.dtag { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 5px; align-self: flex-start; }
.dp { background: var(--teal-dim); color: var(--teal); }
.dn { background: rgba(224,85,85,.12); color: var(--red); }
.dz { background: var(--card2); color: var(--muted); }
.tog {
  width: 100%; padding: 6px; border-radius: 7px; border: 1px solid var(--border);
  background: none; color: var(--muted); font-family: 'DM Sans',sans-serif;
  font-size: 11px; font-weight: 500; cursor: pointer; transition: all .15s;
}
.tog.on-a { background: var(--amber-dim); border-color: var(--amber); color: var(--amber); }
.tog.on-t { background: var(--teal-dim); border-color: var(--teal); color: var(--teal); }

/* Position chips */
.pname-row { display: flex; align-items: flex-start; gap: 5px; }
.pname { font-weight: 600; font-size: 13px; flex: 1; min-width: 0; line-height: 1.35; }
.pname-row .tier-badge { flex-shrink: 0; margin-top: 1px; }
.pos-row { display: flex; gap: 4px; flex-wrap: wrap; }
.pos-chip {
  font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 4px;
  letter-spacing: 0.5px; line-height: 1.4;
}

/* TIER BADGES */
.tier-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 6px;
  font-family: 'Bebas Neue', cursive;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  flex-shrink: 0;
  line-height: 1;
}
.tier-badge-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  border-radius: 4px;
  font-family: 'Bebas Neue', cursive;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  flex-shrink: 0;
  line-height: 1;
  margin-left: 4px;
  vertical-align: middle;
}
/* Tier badges — theme-aware for contrast, scoped to badges only */
[data-theme="dark"] .tier-badge.tier-A,
[data-theme="dark"] .tier-badge-mini.tier-A,
[data-theme="dark"] .pp-tier.tier-A {
  background: rgba(125,220,225,0.28);
  color: #7ddce1;
  border: 1.5px solid #7ddce1;
}
[data-theme="dark"] .tier-badge.tier-B,
[data-theme="dark"] .tier-badge-mini.tier-B,
[data-theme="dark"] .pp-tier.tier-B {
  background: rgba(255,194,102,0.25);
  color: #ffc266;
  border: 1.5px solid #ffc266;
}
[data-theme="dark"] .tier-badge.tier-C,
[data-theme="dark"] .tier-badge-mini.tier-C,
[data-theme="dark"] .pp-tier.tier-C {
  background: rgba(200,180,255,0.28);
  color: #c8b4ff;
  border: 1.5px solid #c8b4ff;
}

[data-theme="light"] .tier-badge.tier-A,
[data-theme="light"] .tier-badge-mini.tier-A,
[data-theme="light"] .pp-tier.tier-A {
  background: rgba(21,69,106,0.1);
  color: #15456a;
  border: 1.5px solid #15456a;
}
[data-theme="light"] .tier-badge.tier-B,
[data-theme="light"] .tier-badge-mini.tier-B,
[data-theme="light"] .pp-tier.tier-B {
  background: rgba(204,110,0,0.12);
  color: #cc6e00;
  border: 1.5px solid #cc6e00;
}
[data-theme="light"] .tier-badge.tier-C,
[data-theme="light"] .tier-badge-mini.tier-C,
[data-theme="light"] .pp-tier.tier-C {
  background: rgba(100,70,170,0.12);
  color: #6446aa;
  border: 1.5px solid #6446aa;
}

/* Fallback for badges if no theme is set */
.tier-badge.tier-A, .tier-badge-mini.tier-A, .pp-tier.tier-A {
  background: rgba(125,220,225,0.28); color: #7ddce1; border: 1.5px solid #7ddce1;
}
.tier-badge.tier-B, .tier-badge-mini.tier-B, .pp-tier.tier-B {
  background: rgba(255,194,102,0.25); color: #ffc266; border: 1.5px solid #ffc266;
}
.tier-badge.tier-C, .tier-badge-mini.tier-C, .pp-tier.tier-C {
  background: rgba(200,180,255,0.28); color: #c8b4ff; border: 1.5px solid #c8b4ff;
}

/* Tier badge on pitch jersey */
.pp-tier {
  position: absolute;
  top: -7px;
  right: 2px;
  width: 16px; height: 16px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bebas Neue', cursive;
  font-size: 10px;
  font-weight: 700;
  z-index: 6;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.8));
  border: 1.5px solid;
}
.pp-tier.tier-A { background: #3fb3b8; color: #0a1a14; border-color: #7bd5d9; }
.pp-tier.tier-C { background: #b094f0; color: #1a0a2a; border-color: #d4c0ff; }

/* Tier selector in roster */
.tier-selector {
  display: flex;
  gap: 4px;
  width: 100%;
}
.tier-btn {
  flex: 1;
  padding: 7px 4px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--card2);
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.tier-btn .tier-letter {
  font-family: 'Bebas Neue', cursive;
  font-size: 18px;
  line-height: 1;
}
[data-theme="dark"] .tier-btn.active.tier-A {
  background: rgba(125,220,225,0.28);
  border-color: #7ddce1;
  color: #7ddce1;
}
[data-theme="dark"] .tier-btn.active.tier-B {
  background: rgba(255,194,102,0.25);
  border-color: #ffc266;
  color: #ffc266;
}
[data-theme="dark"] .tier-btn.active.tier-C {
  background: rgba(200,180,255,0.28);
  border-color: #c8b4ff;
  color: #c8b4ff;
}
[data-theme="light"] .tier-btn.active.tier-A {
  background: rgba(21,69,106,0.1);
  border-color: #15456a;
  color: #15456a;
}
[data-theme="light"] .tier-btn.active.tier-B {
  background: rgba(204,110,0,0.12);
  border-color: #cc6e00;
  color: #cc6e00;
}
[data-theme="light"] .tier-btn.active.tier-C {
  background: rgba(100,70,170,0.12);
  border-color: #6446aa;
  color: #6446aa;
}
.tier-btn:hover:not(.active) { border-color: var(--teal); color: var(--text); }

/* Dual Yes/No sign-up buttons */
.dual-btns { display: flex; gap: 4px; }
.tog-mini {
  flex: 1; padding: 6px 4px; border-radius: 6px; border: 1px solid var(--border);
  background: none; color: var(--muted); font-family: 'DM Sans', sans-serif;
  font-size: 11px; font-weight: 500; cursor: pointer; transition: all 0.15s;
}
.tog-mini.on-a { background: var(--teal-dim); border-color: var(--teal); color: var(--teal); }
.tog-mini.on-r { background: rgba(224,85,85,.12); border-color: var(--red); color: var(--red); }

/* Importance buttons (LEGACY - kept in case used elsewhere) */

/* Formation picker — prominent, user-friendly */
.formation-picker {
  background: var(--card);
  border: none;
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.formation-picker-label {
  font-family: 'Bebas Neue', cursive;
  font-size: 13px; letter-spacing: 2px;
  color: var(--muted);
  margin-bottom: 10px;
}
.formation-buttons {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
@media(max-width: 700px) {
  .formation-buttons { grid-template-columns: repeat(3, 1fr); }
}
@media(max-width: 400px) {
  .formation-buttons { grid-template-columns: repeat(2, 1fr); }
}
.formation-btn {
  background: var(--card2);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 14px 10px;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.formation-btn:hover {
  border-color: var(--border2);
  background: var(--card);
  transform: translateY(-1px);
}
.formation-btn.active {
  background: var(--teal-dim);
  border-color: var(--teal);
  box-shadow: 0 0 16px var(--teal-glow);
}
.formation-btn.active .fb-num { color: var(--teal); }
.fb-num {
  font-family: 'Bebas Neue', cursive;
  font-size: 24px;
  letter-spacing: 2px;
  line-height: 1;
}
.fb-desc {
  font-size: 11px;
  color: var(--muted);
}
.formation-btn.active .fb-desc { color: var(--text); }

/* Squad summary stats row */
.squad-summary {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}
.squad-summary strong { color: var(--text); }

/* ═══ PITCH VISUALIZATION ═══ */
.pitch-container {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}
.pitch-title {
  font-family: 'Bebas Neue', cursive;
  font-size: 14px;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin-bottom: 12px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.pt-shield {
  display: inline-block;
  width: 26px;
  height: 30px;
  vertical-align: middle;
}
.pt-shield svg { width: 100%; height: 100%; display: block; }

/* Watermark shield on the pitch */
.pitch-watermark {
  position: absolute;
  top: 50%; left: 50%;
  width: 40%;
  aspect-ratio: 100 / 110;
  transform: translate(-50%, -50%);
  z-index: 1;
  pointer-events: none;
}
.pitch-watermark svg {
  width: 100%;
  height: 100%;
  display: block;
}
.pitch {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  max-width: 380px;
  margin: 0 auto;
  background: linear-gradient(180deg,
    var(--pitch-grass) 0%,
    var(--pitch-grass) 49%,
    var(--pitch-stripe) 49.5%,
    var(--pitch-grass) 50%,
    var(--pitch-grass) 100%);
  border: 2px solid var(--pitch-lines);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 0 40px var(--shadow-card);
}
/* Stripes for grass effect */
.pitch::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    0deg,
    transparent 0,
    transparent 7%,
    rgba(255,255,255,0.04) 7%,
    rgba(255,255,255,0.04) 14%
  );
  pointer-events: none;
}
/* Center circle */
.pitch::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 28%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 2px solid var(--pitch-lines);
  border-radius: 50%;
  pointer-events: none;
}
/* Penalty boxes */
.pitch-box {
  position: absolute;
  left: 20%;
  width: 60%;
  height: 16%;
  border: 2px solid var(--pitch-lines);
  pointer-events: none;
}
.pitch-box.top    { top: 0;    border-top: none; }
.pitch-box.bottom { bottom: 0; border-bottom: none; }
/* Goal box (6yd) */
.pitch-goalbox {
  position: absolute;
  left: 35%;
  width: 30%;
  height: 7%;
  border: 2px solid var(--pitch-lines);
  pointer-events: none;
}
.pitch-goalbox.top    { top: 0;    border-top: none; }
.pitch-goalbox.bottom { bottom: 0; border-bottom: none; }


/* Player marker on pitch — compact jersey icon + name tag below */
.pitch-player {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  z-index: 5;
  cursor: pointer;
}
.pitch-player:hover .pp-dot { filter: drop-shadow(0 3px 8px rgba(63,179,184,0.8)); }

/* Compact jersey icon - NO text inside */
.pp-dot {
  width: 34px;
  height: 38px;
  flex-shrink: 0;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,0.6));
  clip-path: polygon(
    30% 0%, 70% 0%,
    85% 8%,
    100% 22%, 100% 35%,
    82% 35%,
    82% 100%,
    18% 100%,
    18% 35%,
    0% 35%, 0% 22%,
    15% 8%
  );
  position: relative;
  background: #0d3d4f;
  border-top: 3px solid #3fb3b8;
  transition: filter 0.15s;
}
.pp-dot.gk  { background: linear-gradient(180deg, #d48a00 0%, #b87200 100%); border-top-color: #ffd480; }
.pp-dot.def { background: linear-gradient(180deg, #0d3d4f 0%, #0a2e3c 100%); border-top-color: #3fb3b8; }
.pp-dot.mid { background: linear-gradient(180deg, #1a6b70 0%, #144f54 100%); border-top-color: #5dc9cd; }
.pp-dot.att { background: linear-gradient(180deg, #2a4a5a 0%, #1d3540 100%); border-top-color: #ffffff; }
.pp-dot.empty {
  background: rgba(255,255,255,0.15);
  border-top-color: rgba(255,255,255,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  clip-path: polygon(
    30% 0%, 70% 0%,
    85% 8%,
    100% 22%, 100% 35%,
    82% 35%,
    82% 100%,
    18% 100%,
    18% 35%,
    0% 35%, 0% 22%,
    15% 8%
  );
}

/* Hide label inside jersey - name is below */
.pp-label { display: none; }

/* Jersey number inside the jersey shape */
.pp-jersey-num {
  position: absolute;
  bottom: 5px;
  left: 0; right: 0;
  text-align: center;
  font-family: 'Bebas Neue', cursive;
  font-size: 13px;
  color: rgba(255,255,255,0.95);
  line-height: 1;
  pointer-events: none;
  z-index: 1;
  letter-spacing: 0;
}

/* Jersey number badge in player lists */
.jersey-num {
  font-family: 'Bebas Neue', cursive;
  font-size: 16px;
  color: var(--teal);
  min-width: 22px;
  text-align: right;
  flex-shrink: 0;
  line-height: 1;
}


.pp-key {
  position: absolute;
  top: -7px;
  right: 2px;
  font-size: 13px;
  z-index: 6;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.8));
}

/* Name tag below jersey — the star of the show */
.pp-name-tag {
  background: rgba(0,0,0,0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 3px 7px;
  border-radius: 5px;
  text-align: center;
  max-width: 82px;
  line-height: 1.1;
  border: 1px solid rgba(255,255,255,0.12);
}
.pp-name {
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.1px;
}
.pp-pos {
  font-size: 8px;
  font-weight: 600;
  color: #5dc9cd;
  display: block;
  letter-spacing: 0.5px;
  margin-top: 1px;
  line-height: 1;
}

/* Active slot glow */
.pitch-player.slot-active { z-index: 10; }
.pp-dot.slot-glow {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
  filter: drop-shadow(0 0 14px rgba(255,184,77,0.8)) !important;
}

/* Player roster editor */
.roster-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(240px, 26vw, 340px), 1fr));
  gap: 12px;
}
.roster-add-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 140px auto;
  gap: 10px;
  margin: 12px 0 14px;
}
.roster-add-row .btn-primary {
  white-space: nowrap;
}
.roster-tile {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.roster-tile:hover {
  border-color: var(--border2);
  background: var(--card2);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.roster-tile.key-hi { border-color: var(--amber); }

/* Header row: number + name/pos + tier badge */
.rt-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.rt-num {
  font-family: 'Bebas Neue', cursive;
  font-size: 36px;
  line-height: 1;
  color: var(--teal);
  min-width: 36px;
  text-align: center;
  flex-shrink: 0;
}
.match-card.match-training .rt-num { color: var(--amber); }
.rt-info { flex: 1; min-width: 0; }
.rt-name {
  font-size: 15px; font-weight: 700;
  color: var(--text); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rt-pos {
  font-size: 11px; color: var(--muted);
  margin-top: 2px; font-weight: 500;
}
.rt-injured {
  font-size: 10px; font-weight: 700;
  color: #bb224e; background: rgba(187,34,78,0.1);
  border: 1px solid rgba(187,34,78,0.3);
  padding: 1px 6px; border-radius: 4px;
  margin-left: 6px; vertical-align: middle;
}

/* Meta chips — secondary/fav position */
.rt-meta {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  min-height: 0;
}
.rt-chip {
  font-size: 10px; font-weight: 600;
  padding: 3px 8px; border-radius: 6px;
  background: var(--card2); color: var(--muted);
  border: 1px solid var(--border);
  letter-spacing: 0.2px;
}
.rt-chip-fav {
  background: var(--teal-dim);
  color: var(--teal);
  border-color: rgba(45,212,219,0.25);
}

/* Tier-coloured left border */
.roster-tile.tier-A-tile { border-left: 3px solid rgba(45,212,219,0.5); }
.roster-tile.tier-B-tile { border-left: 3px solid rgba(255,184,77,0.5); }
.roster-tile.tier-C-tile { border-left: 3px solid rgba(176,148,240,0.5); }
.roster-name {
  font-weight: 700;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.25;
}
.roster-name-text { flex: 1; min-width: 0; line-height: 1.3; }
.roster-name .tier-badge { flex-shrink: 0; margin-top: 2px; }
.roster-player-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.roster-player-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--teal) 55%, transparent);
  background: color-mix(in srgb, var(--teal) 13%, transparent);
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.roster-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
}
.roster-injured {
  margin-top: 2px;
  align-self: flex-start;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #bb224e;
  border: 1px solid rgba(187, 34, 78, 0.35);
  background: rgba(187, 34, 78, 0.1);
}
.roster-edit-btn {
  background: none;
  border: none;
  color: var(--teal);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.15s;
  flex-shrink: 0;
  margin-left: auto;
}
.roster-edit-btn:hover { background: var(--teal); color: var(--on-teal); }
.injury-toggle {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 8px;
  width: 100%; box-sizing: border-box;
  background: var(--card2); border: 1px solid var(--border);
  cursor: pointer; transition: all 0.15s;
  font-size: 12px; color: var(--muted);
  font-family: 'DM Sans', sans-serif;
}
.injury-toggle.active {
  background: rgba(224,85,85,0.15); border-color: var(--red); color: var(--red);
}
.injured-tile { border-color: rgba(224,85,85,0.3) !important; }

/* Stats input for step 3 */
.stat-input {
  background: var(--card2); border: 1px solid var(--border);
  color: var(--text); font-family: 'DM Sans', sans-serif;
  font-size: 12px; padding: 4px 6px; border-radius: 6px;
  width: 40px; text-align: center; outline: none;
  transition: border-color 0.15s;
}
.stat-input:focus { border-color: var(--teal); }
.stat-input:hover:not(:focus) { border-color: var(--border2); }

.stat-row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 4px; margin-top: 4px;
}
.stat-label {
  font-size: 9px; color: var(--muted); text-align: center;
  font-weight: 600; letter-spacing: 0.3px; margin-bottom: 2px;
}
.motm-star {
  background: none; border: 1px solid var(--border);
  color: var(--muted); padding: 4px 8px; border-radius: 6px;
  cursor: pointer; font-size: 12px; width: 100%;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.15s;
}
.motm-star.active {
  background: rgba(240,160,64,0.15); border-color: var(--amber); color: var(--amber);
  font-weight: 600;
}
.motm-star:hover:not(.active) { border-color: var(--amber); color: var(--amber); }

.card-pill {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; padding: 1px 5px; border-radius: 4px; font-weight: 700;
}
.card-y { background: #f0c040; color: #000; }
.card-r { background: #e05555; color: #fff; }

/* ═══ STEP 3 PLAYED LIST (full width horizontal rows) ═══ */
#playedGrid { width: 100%; }

.played-totals {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.pt-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 8px;
  text-align: center;
  transition: border-color 0.2s;
}
.pt-card.starters.ok { border-color: var(--teal); background: rgba(0,184,150,0.08); }
.pt-card.starters.warn { border-color: var(--red); background: rgba(224,85,85,0.08); }
.pt-card.subs { border-color: var(--border2); }
.pt-card.subs.warn { border-color: var(--red); background: rgba(224,85,85,0.08); }
.pt-card.subs.warn .pt-num { color: var(--red); }
.pt-card.total { border-color: var(--teal); }
.pt-num {
  font-family: 'Bebas Neue', cursive;
  font-size: 32px;
  line-height: 1;
  color: var(--text);
  margin-bottom: 4px;
}
.pt-num span {
  font-size: 18px;
  color: var(--muted);
}
.pt-card.starters.ok .pt-num { color: var(--teal); }
.pt-card.starters.warn .pt-num { color: var(--red); }
.pt-card.total .pt-num { color: var(--teal); }
.pt-lbl {
  font-family: 'Bebas Neue', cursive;
  font-size: 11px;
  letter-spacing: 1.3px;
  color: var(--muted);
}

/* Role tag: XI (starter) or IND (substitute) */
.role-tag {
  font-size: 9px;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.role-tag.starter { background: var(--teal); color: var(--on-teal); }
.role-tag.sub     { background: var(--amber); color: var(--on-amber); }

.count-warn {
  background: rgba(224,85,85,0.12);
  border: 1px solid var(--red);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 10px;
  line-height: 1.5;
}
.count-warn strong { color: var(--red); font-weight: 700; }
.pc-num {
  font-family: 'Bebas Neue', cursive;
  font-size: 40px;
  color: var(--teal);
  line-height: 1;
  min-width: 36px;
  text-align: center;
}
.pc-lbl {
  font-family: 'Bebas Neue', cursive;
  font-size: 14px;
  letter-spacing: 2px;
  color: var(--muted);
}

.played-list {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 12px;
}
.pl-row {
  border-bottom: 2px solid var(--border2);
  transition: background 0.15s;
}
.pl-row:last-child { border-bottom: none; }
.pl-row.played { background: rgba(0,184,150,0.06); }
.pl-row.muted { opacity: 0.5; }

.pl-main {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
  min-height: 40px;
}
.pl-main:hover { background: var(--card2); }
.pl-main:active { background: var(--card2); }

.pl-check {
  width: 22px; height: 22px;
  border-radius: 5px;
  border: 2px solid var(--border2);
  background: var(--card2);
  display: flex; align-items: center; justify-content: center;
  color: var(--on-teal);
  font-weight: 900;
  font-size: 13px;
  flex-shrink: 0;
  transition: all 0.15s;
}
.pl-check.on {
  background: var(--teal);
  border-color: var(--teal);
}

.pl-name {
  flex: 1;
  font-weight: 500;
  font-size: 15px;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pl-row.muted .pl-name { color: var(--muted); }

.pl-status {
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.pl-quick-stats {
  display: flex;
  gap: 6px;
  font-size: 12px;
  align-items: center;
  white-space: nowrap;
}
.pl-quick-stats span { font-weight: 600; color: var(--text); }

.pl-expand-btn {
  background: var(--card2);
  border: 1px solid var(--border2);
  color: var(--muted);
  width: 28px; height: 28px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 300;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
  font-family: 'DM Sans', sans-serif;
}
.pl-expand-btn:hover {
  border-color: var(--teal);
  color: var(--teal);
}
.pl-expand-btn.open {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--on-teal);
  font-size: 20px;
}

/* Expanded stats panel */
.pl-expand {
  padding: 10px 12px;
  background: rgba(0,184,150,0.04);
  border-top: 1px solid var(--border);
}

.pl-stats-compact {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.pl-stat-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  padding-bottom: 6px;
}
.pl-stat-mini-label {
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
  text-align: center;
  padding: 4px 4px 2px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.pl-stat-mini-controls {
  display: flex;
  align-items: center;
  width: 100%;
  height: 36px;
  border-top: 1px solid var(--border);
}
.mini-btn {
  background: var(--card2);
  border: none;
  color: var(--text);
  width: 28px;
  height: 100%;
  cursor: pointer;
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
  transition: background 0.1s;
  font-family: 'DM Sans', sans-serif;
  flex-shrink: 0;
}
.mini-btn:hover { background: var(--border2); }
.mini-btn:active { background: var(--teal); color: var(--on-teal); }
.mini-btn.minus { border-right: 1px solid var(--border); }
.mini-btn.plus  { border-left:  1px solid var(--border); }

.mini-val {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 15px;
  color: var(--text);
}
.mini-val span { font-size: 13px; }
.mini-val b { font-weight: 700; font-variant-numeric: tabular-nums; }

.pl-motm {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0 14px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'DM Sans', sans-serif;
  height: 36px;
  width: 100%;
  margin-top: 6px;
}
.pl-motm:hover { border-color: var(--amber); color: var(--amber); }
.pl-motm.active {
  background: rgba(240,160,64,0.15);
  border-color: var(--amber);
  color: var(--amber);
}

.played-summary {
  font-size: 12px;
  color: var(--muted);
  padding: 8px 4px;
  text-align: center;
  line-height: 1.6;
}
.played-summary strong { color: var(--teal); }
.played-summary b { color: var(--teal); font-weight: 700; }

/* Player history modal */
.history-overlay {
  display: block;
  width: 100%;
  animation: fadeIn 0.18s;
}
.history-overlay.hidden { display: none !important; }
.history-window {
  background: var(--black);
  width: 100%;
  padding: 16px 0 40px;
  position: relative;
  animation: slideUp 0.2s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.hist-match {
  display: grid; grid-template-columns: 32px 1fr auto auto;
  gap: 8px; align-items: center;
  padding: 9px 12px; border-radius: 8px;
  font-size: 13px; border-bottom: 1px solid var(--border);
}
.hist-match:last-child { border-bottom: none; }
.hist-match:hover { background: var(--card2); }
.hist-match .hmn { font-family: 'Bebas Neue', cursive; color: var(--muted); font-size: 15px; }
.hist-match .hpos { font-size: 10px; padding: 2px 5px; border-radius: 4px; font-weight: 700; }
.hist-match .hstatus { font-size: 10px; }
.hist-match .hopp { font-size: 12px; color: var(--text); }
.hist-match .hdt { font-size: 10px; color: var(--muted); }
.hist-stats-inline { display: flex; gap: 6px; font-size: 11px; }
.hist-stat-chip { background: var(--card2); padding: 2px 6px; border-radius: 5px; color: var(--text); }

.stat-summary {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 8px; text-align: center;
}
.ss-num {
  font-family: 'Bebas Neue', cursive; font-size: 26px;
  line-height: 1; color: var(--text); margin-bottom: 2px;
}
.ss-lbl { font-size: 10px; color: var(--muted); font-weight: 500; }

/* BUTTONS */
.cta {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--teal); color: var(--on-teal);
  font-family: 'Bebas Neue',cursive; font-size: 17px; letter-spacing: 1px;
  padding: 11px 26px; border-radius: 10px; border: none; cursor: pointer;
  transition: all .2s; box-shadow: 0 4px 18px var(--teal-glow);
  font-weight: 600;
}
.cta:hover { transform: translateY(-1px); box-shadow: 0 6px 26px var(--teal-glow); }
.cta.sec {
  background: var(--card2); color: var(--text); border: 1px solid var(--border2); box-shadow: none;
}
.cta.sec:hover { border-color: var(--teal); }
.cta-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }

/* ═══ NEW: STICKY ACTION BAR (best-practice mobile UX) ═══ */
.action-bar {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 4px calc(14px + env(safe-area-inset-bottom, 0px));
  margin: 24px -12px 0;
  background: linear-gradient(to top, var(--black) 70%, rgba(10,39,51,0));
  z-index: 50;
}
[data-theme="light"] .action-bar {
  background: linear-gradient(to top, #f2f7f8 70%, rgba(242,247,248,0));
}
.action-bar-left, .action-bar-right {
  display: flex;
  gap: 10px;
  align-items: center;
}
.action-bar-right { margin-left: auto; }

/* Primary action — big, prominent, teal */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--teal);
  color: var(--on-teal);
  font-family: 'Bebas Neue', cursive;
  font-size: 16px;
  letter-spacing: 0.8px;
  padding: 13px 26px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.3, 1);
  box-shadow: 0 4px 18px var(--teal-glow);
  font-weight: 700;
  min-height: 48px;
}
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 26px var(--teal-glow); }
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.38; cursor: not-allowed; }

/* Secondary action — outline, less emphasis */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--card);
  color: var(--text);
  font-family: 'Bebas Neue', cursive;
  font-size: 14px;
  letter-spacing: 0.6px;
  padding: 11px 20px;
  border-radius: 12px;
  border: 1px solid var(--border2);
  cursor: pointer;
  transition: all 0.18s;
  font-weight: 500;
  min-height: 44px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}
.btn-secondary:hover { border-color: var(--teal); color: var(--teal); transform: translateY(-1px); }

/* Regenerate row — inline button + description */
.regen-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}


/* ═══ MODAL OVERLAY (opens as new window over the match list) ═══ */
.vsal-overlay {
  display: block;
  width: 100%;
}
.vsal-overlay.hidden { display: none !important; }

.vsal-window {
  background: var(--black);
  width: 100%;
  padding: 16px 12px 80px;
  min-height: 100vh;
  position: relative;
  animation: fadeIn 0.18s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.vsal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--card2);
  border: 1px solid var(--border2);
  color: var(--text);
  width: 36px; height: 36px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  transition: all 0.15s;
  line-height: 1;
  padding: 0;
  font-family: 'DM Sans', sans-serif;
}
.vsal-close:hover { border-color: var(--teal); color: var(--teal); }
body.vsal-open { overflow: auto; }

/* Hide all main views when match is open */
body.vsal-open #view-matches,
body.vsal-open #view-roster,
body.vsal-open #view-stats,
body.vsal-open #view-fairplay,
body.vsal-open #view-admin,
body.vsal-open .nav,
body.vsal-open header {
  display: none !important;
}

/* Hide main views when player history is open */
body.history-open #view-matches,
body.history-open #view-roster,
body.history-open #view-stats,
body.history-open #view-fairplay,
body.history-open #view-admin,
body.history-open .nav,
body.history-open header {
  display: none !important;
}
body.history-open .app { min-height: auto; padding-bottom: 0; }

/* Panel header in match view */
.vsal-window .panel-header { padding-right: 16px; }

/* SQUAD DISPLAY */
.squad-cols {
  display: grid;
  grid-template-columns: minmax(260px, 380px) 1fr;
  gap: 14px;
  align-items: start;
  margin-bottom: 20px;
}
.sq-list-cols {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  align-items: start;
}
@media(max-width: 1100px) { .sq-list-cols { grid-template-columns: 1fr 1fr; } }
@media(max-width: 720px)  { .squad-cols   { grid-template-columns: 1fr; } .sq-list-cols { grid-template-columns: 1fr 1fr; } }
@media(max-width: 500px)  { .sq-list-cols { grid-template-columns: 1fr; } }
.sq-list-wrap {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden;
}
.sq-col {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden;
}
.sq-col-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px 6px; border-bottom: 1px solid var(--border);
}
.sq-section-hd {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px 6px;
  border-top: 1px solid var(--border);
}
.sq-section-hd:first-child { border-top: none; }
.sq-section-label { font-family: 'Bebas Neue', cursive; font-size: 13px; letter-spacing: 1px; color: var(--muted); }
.sq-section-count { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--teal); color: var(--on-teal); }
.sq-section-count.a { background: var(--amber); color: #000; }
.sq-section-count.r { background: var(--red); color: #fff; }
.cnt-badge { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--teal); color: var(--on-teal); }
.cnt-badge.a { background: var(--amber); }
.cnt-badge.r { background: var(--red); color: var(--white); }
.sq-rows { padding: 5px; }
.sq-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: 7px; transition: background .1s;
}
.sq-row[draggable="true"] { cursor: grab; }
.sq-row.dragging {
  opacity: 0.55;
  background: rgba(63,179,184,0.1);
}
.sq-row:hover { background: var(--card2); }
.sq-rk { font-family:'Bebas Neue',cursive; font-size:17px; color:var(--muted); width:18px; flex-shrink:0; }
.sq-rk.top { color: var(--teal); }
.sq-nm { flex: 1; font-size: 13px; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sq-debt { font-size: 10px; padding: 2px 5px; border-radius: 5px; font-weight: 600; }


/* CENTER MODAL */
.center-vsal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.22s ease;
  pointer-events: none;
}
.center-vsal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}
.center-vsal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -46%) scale(0.96);
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  width: min(440px, calc(100vw - 32px));
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  z-index: 9999;
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.3, 1), opacity 0.22s ease;
  pointer-events: none;
}
.center-vsal.show {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  pointer-events: auto;
}
.center-vsal-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.center-vsal-hd strong { color: var(--teal); font-size: 16px; }
.center-vsal-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.center-vsal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 4px;
}
.center-vsal-danger {
  margin-top: 6px;
  display: flex;
  justify-content: center;
}
.center-vsal-danger button {
  background: none;
  border: none;
  color: #e05;
  font-size: 13px;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 8px;
  transition: background 0.15s;
}
.center-vsal-danger button:hover { background: rgba(220,0,80,0.1); }
#playerFormModal {
  max-height: 96vh;
}

/* SLOT PICKER */
/* SLOT PICKER — Bottom sheet modal */
.slot-picker-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.slot-picker-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}
.slot-picker {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--card);
  border-top: 2px solid var(--teal);
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -8px 30px rgba(0,0,0,0.4);
  max-height: 75vh;
  display: flex;
  flex-direction: column;
  z-index: 9999;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.slot-picker.show {
  transform: translateY(0);
}
.slot-picker::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  background: var(--border2);
  border-radius: 2px;
}
.slot-picker-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 18px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text);
  flex-shrink: 0;
}
.slot-picker-hd strong { color: var(--teal); font-size: 15px; }
.slot-pick-close {
  background: var(--card2);
  border: 1px solid var(--border2);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}
.slot-pick-close:hover { border-color: var(--teal); color: var(--teal); }
.slot-pick-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: env(safe-area-inset-bottom, 8px);
}
.slot-pick-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.slot-pick-row:last-child { border-bottom: none; }
.slot-pick-row:hover { background: var(--card2); }
.slot-pick-row.on-field { background: rgba(63,179,184,0.06); }
.slot-pick-row.on-field:hover { background: rgba(63,179,184,0.14); }
.slot-pick-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.slot-on-field-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--teal-dim);
  color: var(--teal);
  border: 1px solid var(--teal);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Active slot glow on pitch */
.pitch-player.slot-active { z-index: 10; }
.pp-dot.slot-glow {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
  box-shadow: 0 0 16px rgba(255,184,77,0.6);
}

/* SWAP UI */
.swap-btn {
  width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--border2);
  background: var(--card2); color: var(--muted); font-size: 14px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.15s;
}
.swap-btn:hover { border-color: var(--teal); color: var(--teal); }
.swap-btn.active {
  background: var(--amber); border-color: var(--amber);
  color: var(--on-amber); font-size: 16px;
}
.swap-in-btn {
  font-size: 10px; font-weight: 700; padding: 3px 7px;
  border-radius: 6px; border: 1px solid var(--teal);
  background: var(--teal); color: var(--on-teal);
  cursor: pointer; flex-shrink: 0; transition: all 0.15s;
  white-space: nowrap;
}
.swap-in-btn:hover { opacity: 0.85; }
.sq-row.swap-target {
  background: rgba(255,184,77,0.12);
  border-radius: 8px;
  outline: 1px solid var(--amber);
}
.sq-row.swap-candidate {
  background: rgba(63,179,184,0.08);
  border-radius: 8px;
}
.sq-row.swap-candidate:hover { background: rgba(63,179,184,0.18); }
.sq-row.drag-over,
.sq-col.drag-over {
  background: rgba(63,179,184,0.14);
  outline: 1px dashed var(--teal);
  outline-offset: -2px;
}
.swap-hint {
  font-size: 11px; color: var(--teal); font-weight: 600;
  padding: 6px 10px; letter-spacing: 0.3px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

/* INFO BOX */
.info-box {
  background: var(--card);
  border: 1px solid var(--teal);
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 16px;
  line-height: 1.6;
  box-shadow: 0 2px 12px rgba(63,179,184,0.1);
}
.info-box strong { color: var(--teal); font-weight: 700; }

/* STATS LEADERS */
.stats-leaders {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.stats-leaders-row {
  display: grid;
  grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr));
  gap: 6px;
}
.leader-box {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 10px;
  display: flex; flex-direction: row; align-items: center; gap: 8px;
}
.leader-icon { font-size: 20px; line-height: 1; flex-shrink: 0; }
.leader-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.leader-val  { font-family: 'Bebas Neue', cursive; font-size: 22px; line-height: 1; }
.leader-name { font-size: 11px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leader-lbl  { font-size: 9px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.5px; font-weight: 600; }

/* STATS */
/* STATS (card-based, mobile-friendly) */
.stats-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.stat-card:hover { border-color: var(--teal); background: var(--card2); }
.stat-card:active { transform: scale(0.99); }

.stat-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.sc-rank {
  font-family: 'Bebas Neue', cursive;
  font-size: 20px;
  color: var(--muted);
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}
.sc-name {
  flex: 1;
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sc-debt { font-size: 11px; padding: 3px 8px; font-weight: 700; }

.stat-card-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(75px, 1fr));
  gap: 10px;
  padding-top: 10px;
}
.sc-metric {
  text-align: center;
  background: var(--card2);
  border-radius: 8px;
  padding: 8px 6px;
}
.sc-metric.sc-empty {
  grid-column: 1 / -1;
  background: transparent;
  padding: 4px;
}
.sc-val {
  font-family: 'Bebas Neue', cursive;
  font-size: 22px;
  line-height: 1;
  color: var(--text);
  margin-bottom: 3px;
  letter-spacing: 0.5px;
}
.sc-val .sc-den {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0;
}
.sc-lbl {
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.3px;
}


/* Toast notification */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--teal);
  color: #0a1a14;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  z-index: 99999;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  max-width: calc(100% - 40px);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
[data-theme="light"] .toast {
  background: #0d3d4f;
  color: #ffffff;
}

/* Pulse highlight when card moves */
.roster-tile-pulse {
  animation: rosterPulse 1.6s ease-out;
}
@keyframes rosterPulse {
  0%   { box-shadow: 0 0 0 0 rgba(63,179,184,0.9), 0 0 0 0 rgba(63,179,184,0.4); border-color: var(--teal); }
  30%  { box-shadow: 0 0 0 6px rgba(63,179,184,0.3), 0 0 20px 4px rgba(63,179,184,0.35); border-color: var(--teal); }
  100% { box-shadow: 0 0 0 0 rgba(63,179,184,0), 0 0 0 0 rgba(63,179,184,0); }
}

.hidden { display: none !important; }
select {
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  font-family: 'DM Sans',sans-serif; font-size: 13px; padding: 7px 12px;
  border-radius: 8px; cursor: pointer; outline: none;
}
select:focus { border-color: var(--teal); }

/* Played list section dividers */
.pl-section-divider {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px 4px;
  margin-top: 4px;
}
.pl-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.8px;
  color: var(--muted); text-transform: uppercase;
}
.pl-section-count {
  font-size: 10px; font-weight: 700;
  background: var(--card2); color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 0px 6px;
  font-family: 'Bebas Neue', cursive; font-size: 12px;
}
.pl-section-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.pl-section-note {
  font-size: 11px; color: var(--muted); padding: 2px 12px 6px;
  font-style: italic;
}

/* ═══ FAIR PLAY VIEW ════════════════════════════════════════════════ */
.fp-filters {
  display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap;
}
.fp-filter-btn {
  background: var(--card); border: 1px solid var(--border);
  color: var(--muted); font-size: 12px; font-weight: 600;
  padding: 6px 14px; border-radius: 99px; cursor: pointer;
  transition: all .15s; letter-spacing: 0.3px;
}
.fp-filter-btn.active { background: var(--teal); color: var(--on-teal); border-color: var(--teal); }
.fp-filter-btn:hover:not(.active) { border-color: var(--teal); color: var(--teal); }

.fp-table {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden;
}
.fp-header {
  display: grid;
  grid-template-columns: 32px 1fr 48px 80px 60px 80px;
  gap: 8px; padding: 10px 16px;
  background: var(--card2); border-bottom: 1px solid var(--border);
  font-size: 10px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.6px;
}
.fp-row {
  display: grid;
  grid-template-columns: 32px 1fr 48px 80px 60px 80px;
  gap: 8px; padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  align-items: center; transition: background .1s;
}
.fp-row:last-child { border-bottom: none; }
.fp-row:hover { background: var(--card2); }
.fp-rank { font-family: 'Bebas Neue', cursive; font-size: 18px; color: var(--muted); text-align: center; }
.fp-rank.top3 { color: var(--teal); }
.fp-name { font-size: 13px; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-ratio { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fp-debt {
  font-size: 13px; font-weight: 700; text-align: center;
  padding: 3px 8px; border-radius: 7px;
}
.fp-debt.high { background: rgba(224,85,85,0.15); color: var(--red); }
.fp-debt.mid  { background: rgba(240,160,64,0.15); color: var(--amber); }
.fp-debt.ok   { background: rgba(63,179,184,0.12); color: var(--teal); }
.fp-debt.zero { background: transparent; color: var(--muted); }
.fp-status { font-size: 11px; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.fp-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.fp-dot.red    { background: var(--red); }
.fp-dot.amber  { background: var(--amber); }
.fp-dot.green  { background: var(--teal); }
.fp-dot.grey   { background: var(--muted); }

.fp-summary {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 10px; margin-bottom: 16px;
}
@media(max-width: 500px) { .fp-summary { grid-template-columns: repeat(2, 1fr); } }
.fp-stat-box {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px; text-align: center;
}
.fp-stat-val { font-family: 'Bebas Neue', cursive; font-size: 32px; color: var(--teal); line-height: 1; }
.fp-stat-lbl { font-size: 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }

@media(max-width: 600px) {
  .fp-header, .fp-row { grid-template-columns: 28px 1fr 44px 60px 44px; }
  .fp-status { display: none; }
  .fp-summary { grid-template-columns: repeat(3, 1fr); }
}

/* ═══ ADMIN VIEW ════════════════════════════════════════════════════ */
.admin-user-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-user-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.admin-user-card.pending {
  border-color: var(--amber);
  background: var(--amber-dim);
}
.admin-user-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--teal-dim);
  border: 2px solid var(--teal);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: var(--teal);
  flex-shrink: 0;
}
.admin-user-info {
  flex: 1;
  min-width: 0;
}
.admin-user-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-user-email {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-role-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.admin-role-btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--border2);
  background: var(--card2);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.admin-role-btn:hover { border-color: var(--teal); color: var(--teal); }
.admin-role-btn.active-super { background: rgba(63,179,184,0.2); border-color: var(--teal); color: var(--teal); }
.admin-role-btn.active-coach { background: rgba(176,148,240,0.2); border-color: var(--purple); color: var(--purple); }
.admin-role-btn.active-viewer { background: rgba(137,181,192,0.15); border-color: var(--muted); color: var(--muted); }
.admin-role-btn.active-none { background: rgba(255,107,107,0.1); border-color: var(--red); color: var(--red); }
.admin-role-btn:disabled { opacity: 0.5; cursor: default; }
.admin-section-lbl {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin: 16px 0 8px;
}

.admin-create-row {
  margin-bottom: 12px;
}

.admin-create-form {
  background: var(--card2);
  border: 1px solid var(--border2);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.admin-create-form.hidden { display: none; }
.admin-create-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Hide admin nav for non-admins via CSS */
body:not(.role-super_admin) .nav-btn-admin { display: none; }

/* ─── VIEWER: READ-ONLY ──────────────────────────────────────────────
   Strategi:
   1. Alle input/select/textarea blokeres bredt (altid dataindtastning).
   2. Kendte skrive-knapper blokeres ved klasse/id.
   3. Navigation, faner, luk-kryds og expand-knapper er IKKE berørt.
   → Nye datafaner og visningsknapper virker automatisk.
   → Nye skrive-knapper skal tilføjes listen herunder.
─────────────────────────────────────────────────────────────────── */

/* 1. Blokér alle dataindtastningsfelter */
body.role-viewer input,
body.role-viewer select,
body.role-viewer textarea {
  pointer-events: none !important;
  cursor: default !important;
  opacity: 0.5 !important;
}

/* 2. Skjul knapper der KUN giver mening for skriveroller */
body.role-viewer .add-match-btn,
body.role-viewer .add-match-btn-top,
body.role-viewer .edit-match-btn,
body.role-viewer .match-form-danger,
body.role-viewer .add-player-btn { display: none !important; }

/* 3. Blokér kendte skrive-handlingsknapper og klikbare divs */
body.role-viewer .tog-mini,
body.role-viewer .tier-btn,
body.role-viewer .injured-toggle,
body.role-viewer .pl-motm,
body.role-viewer .pl-stat-mini-controls button,
body.role-viewer .pl-main,
body.role-viewer #regenBtn,
body.role-viewer #clearStartersBtn,
body.role-viewer #saveBtn,
body.role-viewer .pgrid .player-tile,
body.role-viewer .slot-pick-row {
  pointer-events: none !important;
  opacity: 0.45 !important;
  cursor: default !important;
}

/* 5. Kun-visning badge i modal */
body.role-viewer .vsal-window::before {
  content: '👁️ Kun visning';
  display: block;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.6px;
  padding: 6px 0 0;
  text-transform: uppercase;
}

/* ═══ RESPONSIVE BREAKPOINTS ═══════════════════════════════════════ */

/* ── Mobile (< 480px) ─────────────────────────────────────────────── */
@media (max-width: 480px) {
  .pgrid        { grid-template-columns: repeat(2, 1fr); }
  .roster-grid  { grid-template-columns: 1fr; }
  .squad-cols   { grid-template-columns: 1fr; }
  .nav-btn      { padding: 8px 13px; font-size: 12px; }
  header h1     { font-size: 18px; }
  header p      { font-size: 11px; }
  .panel-header { padding: 14px 16px; }
  .match-card   { padding: 10px 12px; gap: 10px; }
  .mc-num       { font-size: 22px; }
  .tier-btn     { padding: 5px 4px; }
}

/* ── Tablet (481px – 768px) ───────────────────────────────────────── */
@media (min-width: 481px) and (max-width: 768px) {
  .pgrid        { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); }
  .roster-grid  { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}

/* ── Desktop (> 1024px) ───────────────────────────────────────────── */
@media (min-width: 1024px) {
  .pgrid        { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .roster-grid  { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .pitch-wrap   { max-width: 460px; }
}

/* ── Wide (> 1280px) ──────────────────────────────────────────────── */
@media (min-width: 1280px) {
  .pgrid        { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  .roster-grid  { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
  .pitch-wrap   { max-width: 500px; }
}

/* ═══ AUTH SCREEN ════════════════════════════════════════════════════ */
#authScreen {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: #071929;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 999; overflow-y: auto;
  padding: 24px 20px; gap: 24px;
}

/* Subtle animated radial glow in background */
#authScreen::before {
  content: '';
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(45,212,219,0.08) 0%, transparent 65%),
    radial-gradient(ellipse 50% 60% at 80% 100%, rgba(45,212,219,0.05) 0%, transparent 60%);
}

[data-theme="light"] #authScreen {
  background: #f0f4f6;
}
[data-theme="light"] #authScreen::before {
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(8,145,178,0.07) 0%, transparent 65%),
    radial-gradient(ellipse 50% 60% at 80% 100%, rgba(8,145,178,0.04) 0%, transparent 60%);
}

#authScreen.hidden { display: none; }

/* Theme toggle */
.auth-theme-btn {
  position: absolute; top: 16px; right: 16px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50%; width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px; transition: all 0.2s;
  z-index: 2;
}
.auth-theme-btn:hover { background: rgba(255,255,255,0.15); }
[data-theme="light"] .auth-theme-btn {
  background: rgba(0,0,0,0.06); border-color: rgba(0,0,0,0.12);
}
[data-theme="light"] .auth-theme-btn:hover { background: rgba(0,0,0,0.1); }

/* Brand section — logo circle + name */
.auth-brand {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  position: relative; z-index: 1;
  animation: fadeDown 0.5s ease both;
}

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Ring around logo — fixes the square PNG look */
.auth-logo-ring {
  width: 96px; height: 96px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(135deg, rgba(45,212,219,0.6) 0%, rgba(45,212,219,0.1) 100%);
  box-shadow: 0 0 0 1px rgba(45,212,219,0.15), 0 12px 40px rgba(0,0,0,0.4);
  flex-shrink: 0;
}
[data-theme="light"] .auth-logo-ring {
  background: linear-gradient(135deg, rgba(21,69,106,0.55) 0%, rgba(21,69,106,0.1) 100%);
  box-shadow: 0 0 0 1px rgba(21,69,106,0.2), 0 8px 28px rgba(0,0,0,0.1);
}

.auth-logo {
  width: 100%; height: 100%;
  border-radius: 50%;
  display: block;
  object-fit: cover;
}

.auth-brand-name {
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: 32px; letter-spacing: 6px; line-height: 1;
  color: #e8f4f8;
}
[data-theme="light"] .auth-brand-name { color: #111827; }

.auth-brand-tagline {
  font-size: 11px; font-weight: 500; letter-spacing: 3px;
  text-transform: uppercase; color: rgba(45,212,219,0.8);
}
[data-theme="light"] .auth-brand-tagline { color: #15456a; opacity: 0.8; }

/* Login card */
.auth-card {
  width: 100%; max-width: 400px;
  background: #0d2137;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 20px;
  padding: 36px 32px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.05);
  position: relative; z-index: 1;
  animation: slideUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}

[data-theme="light"] .auth-card {
  background: #ffffff;
  border: 1px solid #e2e8ec;
  box-shadow: 0 4px 6px rgba(0,0,0,0.04), 0 16px 48px rgba(0,0,0,0.08);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-title {
  font-size: 20px; font-weight: 700;
  color: #e8f4f8;
  margin-bottom: 4px; text-align: center;
}
[data-theme="light"] .auth-title { color: #0a1929; }

.auth-subtitle {
  text-align: center; font-size: 13px; margin-bottom: 28px;
  color: rgba(122,170,187,0.85);
}
[data-theme="light"] .auth-subtitle { color: #52717d; }

#authForm { display: flex; flex-direction: column; gap: 14px; }

.auth-field { display: flex; flex-direction: column; gap: 5px; }

.auth-field label {
  font-size: 12px; font-weight: 600; color: rgba(122,170,187,0.9);
  letter-spacing: 0.4px;
}
[data-theme="light"] .auth-field label { color: #52717d; }

.auth-field input {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px; padding: 11px 14px;
  color: #e8f4f8;
  font-size: 14px; font-family: 'DM Sans', sans-serif;
  transition: border-color 0.2s, box-shadow 0.2s;
}
[data-theme="light"] .auth-field input {
  background: #f6f8f9;
  border: 1px solid #dde5e8;
  color: #0a1929;
}

.auth-field input::placeholder { color: rgba(122,170,187,0.4); }
[data-theme="light"] .auth-field input::placeholder { color: #9bb5be; }

.auth-field input:focus {
  outline: none;
  border-color: rgba(45,212,219,0.6);
  box-shadow: 0 0 0 3px rgba(45,212,219,0.12);
  background: rgba(255,255,255,0.07);
}
[data-theme="light"] .auth-field input:focus {
  border-color: #0891b2;
  box-shadow: 0 0 0 3px rgba(8,145,178,0.1);
  background: #ffffff;
}

.auth-submit {
  background: #2dd4db;
  border: none; border-radius: 10px;
  color: #071929; font-weight: 700;
  padding: 13px 20px; margin-top: 6px;
  cursor: pointer; font-size: 14px;
  transition: all 0.2s;
  letter-spacing: 0.3px;
}
.auth-submit:hover:not(:disabled) {
  background: #55dde3;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(45,212,219,0.35);
}
.auth-submit:active:not(:disabled) { transform: translateY(0); }
.auth-submit:disabled { opacity: 0.6; cursor: not-allowed; }

/* Light mode: input focus uses cyan accent, not navy glow */
[data-theme="light"] .auth-field input:focus {
  border-color: #1dd3d3;
  box-shadow: 0 0 0 3px rgba(29,211,211,0.15);
  background: #ffffff;
}
[data-theme="light"] .auth-submit { background: #15456a; color: #ffffff; }
[data-theme="light"] .auth-submit:hover:not(:disabled) {
  background: #1a5580;
  box-shadow: 0 6px 20px rgba(21,69,106,0.25);
}

.auth-error {
  background: rgba(255,107,107,0.12);
  border: 1px solid rgba(255,107,107,0.35);
  border-radius: 8px; padding: 10px 12px;
  color: #ff9999; font-size: 13px;
  animation: shake 0.3s;
}
[data-theme="light"] .auth-error { color: #c0392b; background: rgba(192,57,43,0.08); border-color: rgba(192,57,43,0.3); }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.auth-error.hidden { display: none; }

.auth-forgot-link {
  display: block;
  width: 100%;
  margin-top: 10px;
  background: none;
  border: none;
  color: var(--teal);
  font-size: 13px;
  cursor: pointer;
  text-align: center;
  padding: 4px 0;
  opacity: 0.85;
}
.auth-forgot-link:hover { opacity: 1; text-decoration: underline; }

/* Pending and Loading Views */
.auth-pending {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 24px; padding: 40px 20px;
}
.auth-pending-icon { font-size: 56px; animation: spin 2s linear infinite; }
.loading-spinner {
  width: 52px; height: 52px;
  border: 3px solid rgba(45,212,219,0.15);
  border-top: 3px solid #2dd4db;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.auth-pending h3 { font-size: 17px; font-weight: 700; color: var(--text); }
.auth-pending p { font-size: 13px; color: var(--muted); line-height: 1.5; max-width: 320px; }

.auth-link {
  background: rgba(45,212,219,0.1);
  border: 1px solid rgba(45,212,219,0.3);
  border-radius: 8px; padding: 8px 16px;
  color: #2dd4db; font-size: 13px;
  cursor: pointer; transition: all 0.2s;
}
.auth-link:hover { background: rgba(45,212,219,0.18); }
[data-theme="light"] .auth-link { color: #0891b2; border-color: rgba(8,145,178,0.3); background: rgba(8,145,178,0.08); }


/* User Badge — always on dark header so needs fixed contrast */
.user-badge {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 999px; padding: 5px 12px 5px 5px;
  cursor: pointer; color: #ffffff; font-size: 13px;
  transition: all 0.2s; font-weight: 500;
  flex-shrink: 0;
}
.user-badge:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.35);
}
.user-badge.hidden { display: none; }

/* Avatar circle with initials */
.user-badge-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #1dd3d3;
  color: #071929;
  font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; text-transform: uppercase; line-height: 1;
}

.role-pill {
  border-radius: 6px; padding: 2px 7px;
  font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.5px;
  background: rgba(255,255,255,0.15);
  color: #ffffff;
}
.role-pill.role-super {
  background: rgba(255,107,107,0.25);
  color: #ffaaaa;
}
.role-pill.role-coach {
  background: rgba(255,184,77,0.25);
  color: #ffd080;
}
.role-pill.role-viewer {
  background: rgba(29,211,211,0.2);
  color: #1dd3d3;
}

/* User Menu */
.user-menu {
  position: absolute; top: 60px; right: var(--app-pad);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 100;
  min-width: 200px;
}

.user-menu.hidden { display: none; }

.user-menu-info {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

.user-menu-name {
  font-weight: 600; font-size: 13px; color: var(--text);
  margin-bottom: 2px;
}

.user-menu-email {
  font-size: 11px; color: var(--muted);
}

.user-menu-btn {
  width: 100%; border: none; background: none;
  padding: 10px 16px; text-align: left;
  color: var(--text); font-size: 12px;
  cursor: pointer; transition: all 0.2s;
  font-weight: 500;
}

.user-menu-btn:hover {
  background: rgba(63, 179, 184, 0.2);
  color: var(--teal);
}

.user-menu-btn.logout:hover {
  background: rgba(255, 107, 107, 0.15);
  color: #ff9999;
}