/* ═══ 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 with turquoise primary */
:root, [data-theme="dark"] {
  --teal: #3fb3b8;              /* FFA cyan/turkis — primær */
  --teal-light: #5dc9cd;
  --teal-bright: #7bd5d9;
  --teal-dim: rgba(63,179,184,0.15);
  --teal-glow: rgba(63,179,184,0.35);
  --navy: #0d3d4f;              /* stadig tilgængelig til detaljer */
  --navy-deep: #0a2e3c;
  --black: #0a2733;             /* turkis-hældet mørk baggrund */
  --surface: #0f3442;
  --card: #144050;
  --card2: #1a4d60;
  --border: #236375;
  --border2: #2e7687;
  --text: #e8f5f7;
  --muted: #89b5c0;
  --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: #0d3d4f;              /* Navy becomes primary */
  --teal-light: #3fb3b8;
  --teal-dim: rgba(13,61,79,0.1);
  --teal-glow: rgba(63,179,184,0.3);
  --navy: #0d3d4f;
  --navy-deep: #071a22;
  --black: #f2f7f8;
  --surface: #ffffff;
  --card: #ffffff;
  --card2: #eaf3f5;
  --border: #c9dde1;
  --border2: #a0bec6;
  --text: #0a1f27;
  --muted: #4a6b75;
  --white: #0a1f27;
  --red: #d04545;
  --amber: #e68a1a;
  --amber-dim: rgba(230,138,26,0.12);

  --pitch-grass: #0e7a50;
  --pitch-stripe: #0a6b46;
  --pitch-lines: rgba(255,255,255,0.75);
  --shadow-soft: rgba(0,0,0,0.15);
  --shadow-card: rgba(0,0,0,0.08);
  --grass-dot-shadow: rgba(0,0,0,0.25);
  --purple: #7a5bc4;

  /* In light theme, --teal is dark navy, so text on it must be WHITE */
  --on-teal: #ffffff;
  --on-amber: #0a1a14;     /* amber is still bright, dark text works */
  --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: 28px clamp(20px, 4vw, 48px) 28px;
  margin: 0 calc(-1 * var(--app-pad)) 28px;
  background: linear-gradient(145deg, #071d27 0%, #0d3d4f 55%, #144050 100%);
  border-radius: 0 0 28px 28px;
  box-shadow: 0 10px 36px rgba(0,0,0,0.45), 0 1px 0 var(--border);
  border-bottom: none;
}
.logo {
  width: 56px;
  height: 64px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 14px var(--teal-glow));
}
.logo svg { width: 100%; height: 100%; display: block; }
header h1 { font-family: 'Bebas Neue', cursive; font-size: clamp(22px,5vw,36px); letter-spacing: 2px; line-height:1; color: #e8f5f7; text-shadow: 0 2px 10px rgba(0,0,0,0.4); }
header p { font-size: 12px; color: rgba(232,245,247,0.65); margin-top: 3px; }
.save-dot { display:inline-block; width:6px; height:6px; border-radius:50%; background:var(--teal); margin-left:6px; opacity:0; transition:opacity .3s; }
.save-dot.on { opacity:1; animation: blink 1s infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.2} }

/* 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-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(150px, 18vw, 220px), 1fr));
  gap: 10px; margin-bottom: 28px;
}
.match-card {
  background: var(--card); border: 1.5px solid transparent;
  border-radius: 22px; padding: 16px; cursor: pointer;
  transition: all .25s cubic-bezier(0.2, 0.8, 0.3, 1);
  position: relative; overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.28);
  min-height: 148px;
}
.match-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--teal) 0%, transparent 75%);
  opacity: 0;
  transition: opacity 0.22s;
  border-radius: 22px 22px 0 0;
}
.match-card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(0,0,0,0.38); }
.match-card:hover::before { opacity: 1; }
.match-card.open { border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal), 0 8px 28px rgba(63,179,184,0.22); }
.match-card.open::before { opacity: 1; }
.match-card.confirmed { border-color: rgba(63,179,184,0.5); box-shadow: 0 0 0 1.5px rgba(63,179,184,0.45), 0 4px 18px rgba(0,0,0,0.25); }
.match-card.confirmed::before { opacity: 0.6; }

.mc-badge {
  font-size: 9px; font-weight: 700; padding: 2px 5px; border-radius: 4px;
  position: absolute; top: 9px; right: 9px;
}
.badge-h { background: var(--teal-dim); color: var(--teal); }
.badge-u { background: var(--amber-dim); color: var(--amber); }

.mc-num { font-family: 'Bebas Neue', cursive; font-size: 40px; color: var(--teal); line-height: 1; }
.mc-date { font-size: 10px; color: var(--muted); margin-top: 2px; }
.mc-opp { font-size: 11px; font-weight: 500; color: var(--text); margin-top: 3px; line-height: 1.3; }
.mc-res { font-family: 'Bebas Neue', cursive; font-size: 13px; color: var(--teal); margin-top: 3px; }
.pip-row { display: flex; gap: 3px; margin-top: 8px; flex-wrap: wrap; }
.pip { width: 6px; height: 6px; border-radius: 50%; background: var(--border2); }
.pip.s { background: var(--amber); }
.pip.p { background: var(--teal); }
.mc-status { font-size: 9px; color: var(--muted); margin-top: 4px; }

/* Training match visual differentiation */
.match-card.match-training {
  background: var(--card2);
  border-style: dashed;
  opacity: 0.92;
}
.match-card.match-training .mc-num { color: var(--amber); }
.match-card.match-training::before {
  background: linear-gradient(90deg, var(--amber) 0%, transparent 75%);
}

/* Type badge — small emoji in corner to signal training vs regular match */
.type-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  position: absolute;
  top: 9px;
  left: 9px;
  background: rgba(255,194,102,0.18);
  color: #ffffff;
  border: 1px solid rgba(255,194,102,0.5);
}
[data-theme="light"] .type-badge.type-training {
  background: rgba(204,110,0,0.12);
  color: #cc6e00;
  border-color: #cc6e00;
}

/* 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: keep header dark navy for FFA brand identity */
[data-theme="light"] header {
  background: linear-gradient(145deg, #071d27 0%, #0d3d4f 55%, #144050 100%);
  box-shadow: 0 10px 36px rgba(0,0,0,0.25), 0 1px 0 rgba(0,0,0,0.1);
}
[data-theme="light"] header h1 { color: #e8f5f7; }
[data-theme="light"] header p { color: rgba(232,245,247,0.65); }
[data-theme="light"] .theme-toggle {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
  color: #e8f5f7;
}

/* 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;
}
.key-badge { font-size: 11px; line-height: 1; }

/* 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(13,61,79,0.12);
  color: #0d3d4f;
  border: 1.5px solid #0d3d4f;
}
[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(13,61,79,0.12);
  border-color: #0d3d4f;
  color: #0d3d4f;
}
[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) */
.imp-btn {
  font-size: 11px; padding: 4px 10px; border-radius: 6px;
  border: 1px solid var(--border2); background: var(--card2); color: var(--muted);
  cursor: pointer; transition: all .15s; font-family: 'DM Sans', sans-serif;
}
.imp-btn:hover { border-color: var(--teal); }
.imp-btn.imp-on { background: var(--teal); color: var(--on-teal); border-color: var(--teal); font-weight: 600; }
.imp-btn.imp-imp.imp-on { background: var(--red); color: var(--on-red); border-color: var(--red); }

/* 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;
}

/* Roster meta row: number + display name inputs */
.roster-meta-row {
  display: flex;
  gap: 8px;
  margin-bottom: 2px;
}
.roster-meta-row > label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.roster-field {
  background: var(--card2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
.roster-field:focus { border-color: var(--teal); }
.roster-field-num { width: 62px; min-width: 62px; max-width: 62px; }

.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: linear-gradient(180deg, color-mix(in srgb, var(--card) 86%, var(--teal) 14%) 0%, var(--card) 46%);
  border: 1px solid color-mix(in srgb, var(--border) 82%, var(--teal) 18%);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.3, 1), box-shadow 0.2s cubic-bezier(0.2, 0.8, 0.3, 1), border-color 0.2s ease;
}
.roster-tile::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  border-radius: 14px 14px 0 0;
  background: linear-gradient(90deg, var(--teal), var(--amber));
  opacity: 0.7;
}
.roster-tile:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--border) 64%, var(--teal) 36%);
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.12);
}
.roster-tile.key-hi { border-color: var(--amber); }
.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-line {
  display: grid;
  grid-template-columns: 136px 1fr;
  gap: 8px;
  align-items: baseline;
}
.roster-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-size: 10px;
  font-weight: 700;
}
.roster-value {
  color: var(--text);
  font-weight: 600;
}
.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); }
.roster-select-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.roster-select-row label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 10px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.4px;
}
.roster-select-row select {
  font-size: 13px; padding: 7px 10px;
  width: 100%; box-sizing: border-box;
  background: var(--card2); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; outline: none;
  font-family: 'DM Sans', sans-serif;
  transition: border-color 0.15s;
}
.roster-select-row select:focus { border-color: var(--teal); }
.key-toggle {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 8px;
  background: var(--card2); border: 1px solid var(--border);
  cursor: pointer; transition: all 0.15s;
  font-size: 12px; color: var(--muted);
}
.key-toggle.active {
  background: rgba(240,160,64,0.15); border-color: var(--amber); color: var(--amber);
}
.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) ═══ */
.modal-overlay {
  display: block;
  width: 100%;
}
.modal-overlay.hidden { display: none !important; }

.modal-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); }
}
.modal-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;
}
.modal-close:hover { border-color: var(--teal); color: var(--teal); }
body.modal-open { overflow: auto; }

/* Hide all main views when match is open */
body.modal-open #view-matches,
body.modal-open #view-roster,
body.modal-open #view-stats,
body.modal-open #view-fairplay,
body.modal-open #view-admin,
body.modal-open .nav,
body.modal-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 */
.modal-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-modal-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-modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}
.center-modal {
  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-modal.show {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  pointer-events: auto;
}
.center-modal-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.center-modal-hd strong { color: var(--teal); font-size: 16px; }
.center-modal-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.center-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 4px;
}
.center-modal-danger {
  margin-top: 6px;
  display: flex;
  justify-content: center;
}
.center-modal-danger button {
  background: none;
  border: none;
  color: #e05;
  font-size: 13px;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 8px;
  transition: background 0.15s;
}
.center-modal-danger button:hover { background: rgba(220,0,80,0.1); }

/* 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: 10px;
  margin-bottom: 20px;
}
.stats-leaders-row {
  display: grid;
  grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr));
  gap: 10px;
}
.leader-box {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 10px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.leader-icon { font-size: 22px; line-height: 1; }
.leader-val  { font-family: 'Bebas Neue', cursive; font-size: 28px; line-height: 1; }
.leader-name { font-size: 11px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.leader-lbl  { font-size: 10px; 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;
}

/* Keep old stats-wrap CSS for backwards compatibility if used elsewhere */
.stats-wrap { background: var(--card); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.stats-wrap table { width: 100%; border-collapse: collapse; font-size: 12px; }
.stats-wrap th { padding: 10px 12px; text-align:left; font-family:'Bebas Neue',cursive; font-size:12px; letter-spacing:1px; color:var(--muted); border-bottom:1px solid var(--border); background:var(--card2); }
.stats-wrap td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.stats-wrap tr:last-child td { border-bottom: none; }
.stats-wrap tr:hover td { background: var(--card2); }
.mbar { height:4px; background:var(--border); border-radius:2px; overflow:hidden; width:55px; }
.mfill { height:100%; border-radius:2px; background:var(--teal); }
.mfill.a { background: var(--amber); }

/* 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;
}

/* 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 .modal-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) {
  .matches-grid { grid-template-columns: repeat(2, 1fr); }
  .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   { min-height: 120px; padding: 12px; }
  .tier-btn     { padding: 5px 4px; }
}

/* ── Tablet (481px – 768px) ───────────────────────────────────────── */
@media (min-width: 481px) and (max-width: 768px) {
  .matches-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .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) {
  .matches-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  .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) {
  .matches-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
  .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: linear-gradient(135deg, #0a2733 0%, #0d3d4f 50%, #0e5c3e 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 999; overflow-y: auto;
  padding: 20px;
}

#authScreen.hidden { display: none; }

.auth-card {
  width: 100%; max-width: 480px;
  background: rgba(20, 64, 80, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(63, 179, 184, 0.3);
  border-radius: 24px;
  padding: 48px 40px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255,255,255,0.1);
  position: relative;
  animation: slideUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* Football banner at top of card */
.auth-card::before {
  content: '';
  position: absolute; top: -2px; left: -2px; right: -2px;
  height: 120px;
  background: linear-gradient(90deg, 
    rgba(63, 179, 184, 0) 0%, 
    rgba(63, 179, 184, 0.2) 20%,
    rgba(63, 179, 184, 0.3) 50%,
    rgba(63, 179, 184, 0.2) 80%,
    rgba(63, 179, 184, 0) 100%
  );
  background-image: 
    radial-gradient(circle at 15% 50%, rgba(63, 179, 184, 0.4) 2px, transparent 2px),
    radial-gradient(circle at 25% 30%, rgba(63, 179, 184, 0.3) 2px, transparent 2px),
    radial-gradient(circle at 35% 70%, rgba(63, 179, 184, 0.4) 2px, transparent 2px),
    radial-gradient(circle at 50% 40%, rgba(63, 179, 184, 0.3) 2px, transparent 2px),
    radial-gradient(circle at 65% 60%, rgba(63, 179, 184, 0.4) 2px, transparent 2px),
    radial-gradient(circle at 75% 35%, rgba(63, 179, 184, 0.3) 2px, transparent 2px),
    radial-gradient(circle at 85% 70%, rgba(63, 179, 184, 0.4) 2px, transparent 2px);
  background-size: 100% 100%;
  border-radius: 24px 24px 0 0;
  pointer-events: none;
}

.auth-logo {
  width: 100px; height: 120px;
  margin: 0 auto 32px;
  display: block;
  filter: drop-shadow(0 8px 24px rgba(63, 179, 184, 0.4));
  animation: logoBounce 3s ease-in-out infinite;
}

@keyframes logoBounce {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-12px); }
}

.auth-title {
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: 36px; font-weight: 900;
  text-align: center; letter-spacing: 2px;
  background: linear-gradient(135deg, #ffffff 0%, #3fb3b8 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.auth-subtitle {
  text-align: center; color: var(--muted);
  font-size: 14px; margin-bottom: 32px; letter-spacing: 0.5px;
}

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

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

.auth-field label {
  font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}

.auth-field input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(63, 179, 184, 0.3);
  border-radius: 8px; padding: 12px 14px;
  color: var(--text);
  font-size: 14px; font-family: 'DM Sans', sans-serif;
  transition: all 0.2s;
  backdrop-filter: blur(4px);
}

.auth-field input::placeholder {
  color: rgba(137, 181, 192, 0.5);
}

.auth-field input:focus {
  outline: none;
  border-color: var(--teal);
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 0 0 0 3px rgba(63, 179, 184, 0.2);
}

.auth-submit {
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-light) 100%);
  border: none; border-radius: 8px;
  color: var(--on-teal); font-weight: 600;
  padding: 13px 20px; margin-top: 8px;
  cursor: pointer; font-size: 14px;
  transition: all 0.3s;
  box-shadow: 0 4px 16px rgba(63, 179, 184, 0.3);
  text-transform: uppercase; letter-spacing: 0.5px;
}

.auth-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(63, 179, 184, 0.5);
}

.auth-submit:disabled {
  opacity: 0.7; cursor: not-allowed;
}

.auth-error {
  background: rgba(255, 107, 107, 0.15);
  border: 1px solid rgba(255, 107, 107, 0.4);
  border-radius: 6px; padding: 10px 12px;
  color: #ff9999; font-size: 13px;
  animation: shake 0.3s;
}

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

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

/* 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: 64px; animation: spin 2s linear infinite;
}

.loading-spinner {
  width: 60px; height: 60px;
  border: 4px solid rgba(63, 179, 184, 0.2);
  border-top: 4px solid var(--teal);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.auth-pending h3 {
  font-size: 18px; font-weight: 700; color: var(--text);
}

.auth-pending p {
  font-size: 13px; color: var(--muted); line-height: 1.5;
  max-width: 340px;
}

.auth-link {
  background: rgba(63, 179, 184, 0.2);
  border: 1px solid var(--teal);
  border-radius: 6px; padding: 8px 16px;
  color: var(--teal); font-size: 13px;
  cursor: pointer; transition: all 0.2s;
}

.auth-link:hover {
  background: rgba(63, 179, 184, 0.3);
}

/* User Badge */
.user-badge {
  display: flex; align-items: center; gap: 8px;
  background: rgba(63, 179, 184, 0.15);
  border: 1px solid rgba(63, 179, 184, 0.3);
  border-radius: 20px; padding: 6px 12px;
  cursor: pointer; color: var(--text); font-size: 12px;
  transition: all 0.2s;
  font-weight: 500;
}

.user-badge:hover {
  background: rgba(63, 179, 184, 0.25);
  border-color: var(--teal);
}

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

.role-pill {
  background: rgba(63, 179, 184, 0.3);
  border-radius: 12px; padding: 2px 8px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.3px;
}

.role-pill.role-super {
  background: rgba(255, 107, 107, 0.2);
  color: #ff9999;
}

.role-pill.role-coach {
  background: rgba(255, 184, 77, 0.2);
  color: #ffb84d;
}

.role-pill.role-viewer {
  background: rgba(93, 201, 205, 0.2);
  color: var(--teal-bright);
}

/* 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;
}