/* ── Reset & base ─────────────────────────────────────────────────── */

/* Ensure [hidden] always wins over any display:flex/grid author rules */
[hidden] { display: none !important; }

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

:root {
  /* ── Level brand base ──────────────────────────────────────────────────
     Phase 1 keeps the current (Gaffer-green) VALUES so nothing shifts on
     screen; Phase 2 flips these token values to the Level palette. Chalk and
     Amber already equal Level's Chalk / Amber Phosphor. */
  --pitch:         #0A2619;   /* primary pitch surface                       */
  --pitch-deep:    #0B1210;   /* deep surface — header / bench / page bg     */
  --pitch-green-l: #1A4030;   /* lighter pitch (gradients)                   */
  --matchday:      #A4CC46;   /* primary action / accent (Signal Lime, muted)*/
  --accent-press:  #8DB537;   /* action pressed state                        */
  --success:       var(--matchday);   /* start-match / sub-in — tracks accent */
  --live:          var(--matchday);   /* live-match indicator — tracks accent */
  --chalk:         #F2F4EE;   /* primary text / off-white (== Level Chalk)   */
  --white:         #fff;      /* pure white on coloured fills                */
  --amber:         #F5B544;   /* warnings / GK / incoming (== Amber Phosphor)*/
  --gold:          #ffd700;   /* goals                                       */
  --coach-blue:    #3E6DA8;   /* in-match advisories                         */
  --danger:        #e74c3c;   /* destructive / removal                       */
  --danger-deep:   #c0392b;   /* stronger red — shirt-number conflict        */
  --danger-soft:   #ef5350;   /* soft red — fairness loss                    */
  --slate:         #1A1F1C;   /* dark text on light chips                    */
  --on-accent:     #0A2619;   /* text / icons on Signal Lime                 */
  --tinker-surface: #4E7E4A;  /* lighter, lime-leaning pitch while Tinkering  */
  --provisional:    #E8D97A;  /* Provisional Chalk — dashed tinker outlines   */
  --toast-bg:      #0B1210;   /* toast / dropdown surface                    */

  /* Legacy aliases (kept so existing var() refs keep resolving) */
  --trophy-amber:  var(--amber);
  --pitch-green:   var(--pitch);
  --pitch-green-d: var(--pitch-deep);

  /* ── Canonical position palette ────────────────────────────────────────
     Reconciled from 5 divergent copies. One hue per position:
     GK = amber, DEF = blue, MID = neutral, FWD = green. Chips use the solid
     colour; badges/pills derive a translucent tint via color-mix. */
  --pos-gk:   #3E8E97;  --pos-gk-fg:  #C4E6EA;
  --pos-def:  #7E5FA8;  --pos-def-fg: #DED2EE;
  --pos-mid:  #AEC93C;  --pos-mid-fg: #E4EDB2;
  --pos-fwd:  #C57A3E;  --pos-fwd-fg: #F4D6BB;

  /* ── Functional / derived ──────────────────────────────────────────────*/
  --pitch-line:    color-mix(in srgb, var(--chalk) 12%, transparent);
  --circle-bg:     var(--chalk);
  --circle-text:   var(--slate);
  --circle-size:   68px;
  --circle-font:   13px;

  --incoming-bg:   var(--amber);
  --incoming-text: var(--slate);
  --outgoing-bg:   var(--danger-deep);
  --outgoing-text: var(--chalk);

  --bench-bg:      var(--pitch-deep);
  --bench-border:  color-mix(in srgb, var(--chalk) 10%, transparent);
  --text-light:    var(--chalk);
  --text-dim:      color-mix(in srgb, var(--chalk) 55%, transparent);

  --btn-primary:   var(--matchday);
  --btn-disabled:  color-mix(in srgb, var(--chalk) 15%, transparent);
  --header-bg:     var(--pitch-deep);

  /* ── Typography (the Level identity — 3 fonts) ──────────────────────────
     Space Mono = display / data / initials; VT323 = live timer only;
     Inter = UI / body fallback. */
  --font-body:    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-timer:   'VT323', ui-monospace, monospace;

  font-family: var(--font-body);
  font-size: 15px;
  font-feature-settings: "tnum";
}

html, body {
  height: 100%;
  background: var(--pitch-green-d);
  color: var(--text-light);
  overscroll-behavior: none;
}

/* ── Layout ───────────────────────────────────────────────────────── */

.app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
}

/* ── Header ───────────────────────────────────────────────────────── */

.header {
  background: var(--header-bg);
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--pitch-line);
}

.match-title {
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}

.slot-label {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.slot-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}
.slot-counter {
  font-size: 12px;
  color: var(--text-dim);
}
.slot-skill {
  font-size: 12px;
  font-weight: 600;
  color: var(--matchday);
  background: color-mix(in srgb, var(--matchday) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--matchday) 25%, transparent);
  border-radius: 10px;
  padding: 1px 7px;
}

/* Progress dots */
.progress-dots {
  display: flex;
  gap: 5px;
  margin-top: 10px;
}

.progress-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  transition: background 0.2s;
}
.progress-dot.done    { background: rgba(255,255,255,0.45); }
.progress-dot.active  { background: var(--white); width: 20px; border-radius: 4px; }
/* The period actually in play — green ring, shows regardless of active/done state */
.progress-dot.live    { box-shadow: 0 0 0 2px var(--matchday); }
/* Final summary dot: small diamond shape */
.progress-dot-final { border-radius: 2px; transform: rotate(45deg); margin-left: 4px; }
.progress-dot-final.active { background: var(--white); width: 10px; height: 10px; border-radius: 2px; }


/* ── Pitch ────────────────────────────────────────────────────────── */

.pitch-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--pitch-green);
  position: relative;

  /* Subtle pitch stripe texture */
  background-image: repeating-linear-gradient(
    180deg,
    transparent,
    transparent 52px,
    rgba(0,0,0,0.06) 52px,
    rgba(0,0,0,0.06) 104px
  );
}

/* Centre circle hint */
.pitch-wrapper::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 80px; height: 80px;
  border: 1px solid var(--pitch-line);
  border-radius: 50%;
  pointer-events: none;
}

/* ── Tinkering mode ────────────────────────────────────────────────── */

/* Tinkering = "modulation, not replacement": the pitch tints one step lighter
   (Ghost Green) and movable tokens flatten and gain a dashed Provisional-Chalk
   outline. No paper, no wobble — the identity lives in the type + the pill. */
.pitch-wrapper.whiteboard {
  background-color: var(--tinker-surface);
}

.pitch-wrapper .circle-avatar {
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

/* Movable tokens invert to a dark coin (chalk text) with a chunky dashed
   Provisional-Chalk outline — a strong, unmistakable "edit mode" shift against
   the lightened Ghost-Green pitch. GK / incoming coins keep their identity
   colour (more specific rules below) but still gain the dashed outline. */
.pitch-wrapper.whiteboard .circle-avatar {
  background: var(--pitch-deep);
  color: var(--chalk);
  border: 2.5px dashed var(--provisional);
  animation: tinkerFadeIn 0.2s ease 0.05s both;
}

@keyframes tinkerFadeIn {
  from { opacity: 0.55; }
  to   { opacity: 1; }
}

/* Remove inset matchday ring on outfield circles in tinkering mode */
.pitch-wrapper.whiteboard .player-circle:not(.is-gk) .circle-avatar {
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Sub arrows, GK gloves, and goal badge sit above the token avatar */
.sub-badge,
.gk-gloves,
.goal-badge {
  z-index: 2;
}

/* ── Live pitch badge ───────────────────────────────────────────── */

.live-pitch-badge {
  display: none;
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 10;
  align-items: center;
  gap: 6px;
  background: color-mix(in srgb, var(--danger) 88%, transparent);
  color: var(--white);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 13px 5px 10px;
  border-radius: 20px;
  pointer-events: none;
}
.live-pitch-badge.visible {
  display: flex;
  animation: badgeFadeIn 0.3s ease;
}
.live-pitch-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--white);
  animation: live-pulse 1.2s ease-in-out infinite;
}

/* ── Goal tip banner ─────────────────────────────────────────────── */

.goal-tip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: color-mix(in srgb, var(--success) 12%, transparent);
  border-top: 1px solid color-mix(in srgb, var(--success) 25%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--success) 25%, transparent);
  padding: 9px 14px;
  animation: badgeFadeIn 0.3s ease;
}
.goal-tip-text {
  font-size: 0.8rem;
  color: var(--text-dim);
  flex: 1;
}
.goal-tip-dismiss {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
  opacity: 0.6;
}
.goal-tip-dismiss:active { opacity: 1; }

/* ── Tinkering pill (status indicator, not a button) ────────────── */

.edit-mode-badge {
  display: none;
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 10;
  align-items: center;
  gap: 6px;
  background: var(--matchday);
  color: var(--on-accent);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 999px;
  pointer-events: none;
}

/* Blinking terminal-block cursor — the one small broadcast-nostalgia nod. */
.edit-mode-badge::after {
  content: "_";
  animation: cursorBlink 1s step-end infinite;
}
@keyframes cursorBlink { 50% { opacity: 0; } }

.edit-mode-badge.visible {
  display: flex;
  animation: badgeFadeIn 0.25s ease;
}

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

.pitch {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 0 24px;
}

.pitch-row {
  display: flex;
  justify-content: center;
  gap: 24px;
}

.pitch-row.multi-row {
  gap: 36px;
}

.pitch-large .player-circle { --circle-size: 52px; --circle-font: 11px; }
.pitch-large .circle-name { font-size: 10px; }
.pitch-large .circle-role { font-size: 9px; }

/* ── Player circle ────────────────────────────────────────────────── */

.player-circle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: default;
}
.player-circle.empty-slot .circle-avatar {
  background: transparent;
  border: 2px dashed rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.4);
}
.player-circle.empty-slot .player-name {
  opacity: 0.4;
  font-size: 10px;
}

.circle-avatar {
  position: relative;
  width: var(--circle-size);
  height: var(--circle-size);
  border-radius: 50%;
  background: var(--circle-bg);
  color: var(--circle-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  border: 3px solid rgba(255,255,255,0.5);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transition: border-color 0.2s, background 0.2s;
  letter-spacing: 0.02em;
  font-family: var(--font-display);
}

/* Outfield inner ring */
.player-circle:not(.is-gk) .circle-avatar {
  box-shadow: 0 2px 8px rgba(0,0,0,0.3), inset 0 0 0 4px var(--matchday);
}

/* Conflicting shirt number — red token */
.circle-avatar.number-conflict {
  background: var(--danger-deep);
  color: var(--white);
}

/* GK amber circle */
.player-circle.is-gk .circle-avatar {
  background: var(--pos-gk);
  color: var(--on-accent);
  border-color: var(--pos-gk-fg);
}

/* Gloves badge */
.gk-gloves {
  position: absolute;
  bottom: -4px; left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}

.player-circle.incoming .circle-avatar {
  background: var(--incoming-bg);
  color: var(--incoming-text);
  border-color: var(--white);
}


.circle-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--white);
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
  letter-spacing: 0.01em;
}

.circle-role {
  font-size: 10px;
  color: rgba(255,255,255,0.65);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Tappable player circles */
.player-circle.tappable {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.circle-avatar {
  transition: transform 0.1s, box-shadow 0.1s;
}

@keyframes holdRing {
  from { box-shadow: 0 2px 8px rgba(0,0,0,0.3), 0 0 0 0 color-mix(in srgb, var(--gold) 60%, transparent); }
  to   { box-shadow: 0 2px 8px rgba(0,0,0,0.3), 0 0 0 10px color-mix(in srgb, var(--gold) 0%, transparent); }
}
.player-circle.tappable:active .circle-avatar {
  animation: holdRing 0.6s ease-out forwards;
}

/* Goal flash animation */
@keyframes goalFlash {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--gold) 80%, transparent); }
  50%  { box-shadow: 0 0 0 12px color-mix(in srgb, var(--gold) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--gold) 0%, transparent); }
}
.player-circle.goal-scored .circle-avatar {
  animation: goalFlash 0.6s ease-out;
}

/* Goal badge on circle */
.goal-badge {
  position: absolute;
  top: -6px; left: -6px;
  background: var(--white);
  color: #1a3a1a;
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 5px;
  border: 2px solid var(--gold);
  white-space: nowrap;
}

/* Sub badge (↑ / ↓ overlay) */
.sub-badge {
  position: absolute;
  top: -4px; right: -4px;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  border: 2px solid var(--white);
}

.sub-badge.sub-in  { background: var(--success); color: var(--on-accent); }
.sub-badge.sub-out { background: var(--danger-deep); color: var(--white); }

/* ── Bench ────────────────────────────────────────────────────────── */

.bench-section {
  background: var(--bench-bg);
  border-top: 1px solid var(--pitch-line);
  padding: 12px 16px;
}

.bench-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.bench-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bench-player {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.07);
  border-radius: 20px;
  padding: 5px 10px 5px 5px;
  font-size: 13px;
  border: 1px solid transparent;
  transition: background 0.2s, border-color 0.2s;
}

.bench-player.incoming {
  background: color-mix(in srgb, var(--gold) 15%, transparent);
  border-color: color-mix(in srgb, var(--gold) 50%, transparent);
}

.bench-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  font-family: var(--font-display);
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
}

.bench-player.incoming .bench-avatar {
  background: var(--incoming-bg);
  color: var(--incoming-text);
}

.bench-name { font-weight: 500; }

.bench-arrow {
  font-size: 11px;
  color: var(--incoming-bg);
  font-weight: 600;
}

/* ── Report ──────────────────────────────────────────────────────── */

.report-section {
  flex: 1;
  background: var(--pitch-green-d);
  overflow-y: auto;
  padding: 12px 16px;
}

.report-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.report-row {
  background: rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 10px 12px;
}

.report-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
}

.report-name {
  font-size: 15px;
  font-weight: 600;
  flex: 1;
}

.report-slots {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
  margin-left: auto;
}

.report-goals {
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
}

/* Per-slot chips */
.slot-chips {
  display: flex;
  gap: 5px;
  flex-wrap: nowrap;
}

.slot-chip {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 6px;
  padding: 4px 2px;
  min-width: 0;
}

.chip-quarter {
  font-size: 9px;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.chip-pos {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

.slot-chip.bench {
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.2);
  font-size: 13px;
  justify-content: center;
}

.slot-chip.pos-gk  { background: var(--pos-gk);  color: var(--pos-gk-fg); }
.slot-chip.pos-def { background: var(--pos-def); color: var(--pos-def-fg); }
.slot-chip.pos-mid { background: var(--pos-mid); color: var(--pos-mid-fg); }
.slot-chip.pos-fwd { background: var(--pos-fwd); color: var(--pos-fwd-fg); }

.report-row-skill { border-top: 1px solid rgba(255,255,255,0.12); margin-top: 4px; padding-top: 4px; }
.slot-chip.skill-chip { background: rgba(255,255,255,0.1); color: var(--gold); }

/* ── Quarter-break changes interstitial ──────────────────────────── */

.changes-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 16px;
}

.changes-in {
  color: var(--incoming-bg);
  font-weight: 600;
}

.changes-for {
  color: var(--text-dim);
  font-size: 13px;
}

.changes-out {
  color: var(--outgoing-bg);
  font-weight: 600;
}

.changes-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-dim);
  font-size: 15px;
}

/* ── Controls ────────────────────────────────────────────────────── */

.controls {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  background: var(--header-bg);
  border-top: 1px solid var(--pitch-line);
}

.btn {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  letter-spacing: 0.01em;
}

.btn-prev {
  background: rgba(255,255,255,0.1);
  color: var(--text-light);
  flex: 0 0 80px;
}
.btn-prev:disabled { opacity: 0.3; cursor: default; }
.btn-prev:not(:disabled):active { background: rgba(255,255,255,0.18); }

.btn-next {
  background: var(--btn-primary);
  color: var(--on-accent);
}
.btn-next:disabled { background: var(--btn-disabled); color: rgba(255,255,255,0.4); cursor: default; }
.btn-next:not(:disabled):active { background: var(--accent-press); }

.btn-adjust {
  background: transparent;
  color: var(--trophy-amber);
  font-size: 11px;
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid var(--trophy-amber);
  border-radius: 6px;
  opacity: 0.75;
}
.btn-adjust:active { opacity: 1; }

.btn-recalc-following {
  display: block;
  width: 100%;
  margin: 8px 0 0;
  background: transparent;
  color: var(--trophy-amber);
  font-size: 12px;
  padding: 8px 10px;
  border: 1px solid var(--trophy-amber);
  border-radius: 6px;
  opacity: 0.85;
  cursor: pointer;
}
.btn-recalc-following:active { opacity: 1; }
.btn-recalc-following[hidden] { display: none; }

/* ── Slot row (slot label + start match button side by side) ─────── */
.slot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.slot-info { flex: 1; min-width: 0; }

/* ── Start Match button (inline in header, review mode only) ─────── */
.start-match-bar {
  flex-shrink: 0;
}
.btn-start-match-cta {
  background: var(--success);
  color: var(--on-accent);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 8px 13px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  animation: pulse-start 1.6s ease-in-out infinite;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-start-match-cta:active { opacity: 0.85; animation: none; }
@keyframes pulse-start {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 45%, transparent); }
  50%       { box-shadow: 0 0 0 10px color-mix(in srgb, var(--success) 0%, transparent); }
}

/* ── "Review the plan" screen ────────────────────────────────────── */
#screen-review { background: var(--pitch-green-d); }

.review-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.review-loading { color: var(--text-dim); text-align: center; padding: 24px 0; }

/* Compact position-row grid (positions down, slots across) */
.plan-grid {
  display: grid;
  gap: 3px;
  align-items: stretch;
}
.plan-grid-stacked { margin-top: 10px; }
.plan-corner { background: transparent; }
.plan-cell, .plan-rowlabel, .plan-head {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  padding: 5px 2px;
  font-size: 11px;
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.plan-head {
  font-size: 9px;
  font-weight: 600;
  color: rgba(255,255,255,0.55);
  padding: 3px 2px;
}
.plan-rowlabel { justify-content: flex-start; padding-left: 6px; font-size: 10px; }
.plan-empty { background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.22); font-weight: 400; }
.plan-cell.pos-gk  { background: var(--pos-gk);  color: var(--pos-gk-fg); }
.plan-cell.pos-def { background: var(--pos-def); color: var(--pos-def-fg); }
.plan-cell.pos-mid { background: var(--pos-mid); color: var(--pos-mid-fg); }
.plan-cell.pos-fwd { background: var(--pos-fwd); color: var(--pos-fwd-fg); }
.plan-rowlabel.pos-gk  { color: var(--pos-gk-fg); }
.plan-rowlabel.pos-def { color: var(--pos-def-fg); }
.plan-rowlabel.pos-mid { color: var(--pos-mid-fg); }
.plan-rowlabel.pos-fwd { color: var(--pos-fwd-fg); }
/* MID's bright lime is light — the solid grid chips need dark token text (the
   light --pos-mid-fg stays for tint badges + row labels on the dark bg). */
.slot-chip.pos-mid, .plan-cell.pos-mid { color: #223007; }
.plan-cell.chip-changed { outline: 1.5px solid color-mix(in srgb, var(--chalk) 80%, transparent); outline-offset: -1.5px; }
.plan-cell.under { box-shadow: inset 0 0 0 1.5px var(--trophy-amber); }
.plan-skill-label, .plan-skill { color: var(--gold); background: rgba(255,255,255,0.08); font-size: 10px; }
.plan-grid .plan-skill-label { background: transparent; }

/* Wrapping "slots per player" strip */
.plan-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  margin-top: 12px;
}
.plan-counts-title { font-size: 11px; color: var(--text-dim); width: 100%; margin-bottom: 2px; }
.plan-count-chip {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
}
.plan-count-chip b { font-weight: 800; }
.plan-count-chip.under { background: color-mix(in srgb, var(--amber) 18%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--amber) 55%, transparent); }

/* Under-slotted / uneven-time warning banner */
.review-warning {
  margin: 10px 16px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--amber) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--amber) 50%, transparent);
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
}
.review-warning-head { font-weight: 700; color: var(--trophy-amber); }
.review-warning-item { color: var(--text-dim); }
.review-warning-card { margin: 0 0 10px; }

/* Per-player row flag + chip highlight (shared report grid) */
.report-row-under { box-shadow: inset 3px 0 0 var(--trophy-amber); }
.report-under-mark { color: var(--trophy-amber); margin-right: 4px; }
.slot-chip.chip-changed { outline: 1.5px solid color-mix(in srgb, var(--chalk) 80%, transparent); outline-offset: -1.5px; }

/* Combined tournament review — one card per match */
.review-card {
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  padding: 12px;
}
.review-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.review-card-title { font-weight: 700; font-size: 14px; flex: 1; }
.review-open-btn { flex-shrink: 0; }

.review-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.review-actions .btn { flex: 1; }
.review-actions .btn-start-match-cta { flex: 1; justify-content: center; }

.btn-review-plan { color: var(--coach-blue) !important; border-color: var(--coach-blue) !important; }

/* ── Live match indicator (in header) ───────────────────────────── */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: color-mix(in srgb, var(--success) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--success) 50%, transparent);
  color: var(--live);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px 2px 5px;
  border-radius: 10px;
}
.live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--live);
  animation: live-pulse 1.2s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

/* ── Removed player bench state ──────────────────────────────────── */
.bench-player.bench-removed {
  opacity: 0.5;
  border-style: dashed;
  cursor: pointer;
}
.bench-removed-badge {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--danger);
  font-weight: 600;
}
.bench-player.bench-removed .bench-name {
  text-decoration: line-through;
}

/* ── Player action overlay ───────────────────────────────────────── */
.player-action-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.reinstate-info {
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
  margin: 4px 0 12px;
}

/* ── Swap overlay ────────────────────────────────────────────────── */

.swap-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: flex-end;
  z-index: 100;
  padding: 16px;
}

.swap-panel {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: var(--pitch);
  border: 1px solid color-mix(in srgb, var(--chalk) 15%, transparent);
  border-radius: 12px;
  padding: 20px 16px;
  max-height: 60vh;
  overflow-y: auto;
}
.swap-panel-wide { max-height: 75vh; }

.swap-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--chalk);
  margin-bottom: 12px;
}

.swap-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.swap-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--chalk) 6%, transparent);
  border-radius: 8px;
  cursor: pointer;
  color: var(--chalk);
  font-size: 15px;
  transition: background 0.1s;
}

.swap-item:active { background: color-mix(in srgb, var(--chalk) 12%, transparent); }
.swap-item .swap-name { flex: 1; font-weight: 500; }
.swap-item .swap-pos { font-size: 12px; color: var(--text-dim); }

/* ── Fairness warnings ───────────────────────────────────────────── */

.fairness-list {
  list-style: none;
  margin-bottom: 12px;
}

.fairness-item {
  padding: 8px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--chalk) 8%, transparent);
  font-size: 14px;
  color: var(--chalk);
}

.fairness-item .fairness-loss { color: var(--danger-soft); font-weight: 600; }
.fairness-item .fairness-gain { color: var(--matchday); font-weight: 600; }

/* ── Edit mode indicators ────────────────────────────────────────── */

.pitch.edit-mode .player-circle { cursor: grab; }
.pitch.edit-mode .player-circle:active { transform: scale(0.95); cursor: grabbing; }
.player-circle.dragging { opacity: 0.4; transform: scale(0.9); }
.player-circle.drag-over { outline: 2px solid var(--matchday); box-shadow: 0 0 0 4px color-mix(in srgb, var(--matchday) 25%, transparent); }

.slot-locked-badge {
  display: inline-block;
  font-size: 10px;
  background: var(--trophy-amber);
  color: var(--slate);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  margin-left: 6px;
}

/* "This is the slot in play" — green (matches the live/matchday semantics). */
.slot-live-badge {
  display: inline-block;
  font-size: 10px;
  background: var(--matchday);
  color: var(--pitch-deep);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  margin-left: 6px;
}

/* "Back to live" — shown when browsing away from the live period. Green = live. */
.jump-live-btn {
  background: color-mix(in srgb, var(--matchday) 16%, transparent);
  border: 1px solid var(--matchday);
  color: var(--matchday);
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  padding: 4px 10px;
  margin-left: 8px;
  cursor: pointer;
}

/* ── Landing screen ──────────────────────────────────────────────── */

.landing {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: linear-gradient(170deg, var(--pitch-deep) 0%, var(--pitch) 60%, var(--pitch-green-l) 100%);
  padding: 0 20px env(safe-area-inset-bottom);
  position: relative;
  overflow: hidden;
}

.landing-bg {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
}

.pitch-svg {
  width: 90%;
  max-width: 360px;
  height: auto;
  opacity: 0.7;
  transform: rotate(-5deg) scale(1.15);
}

.landing-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 40px 0 20px;
  position: relative;
  z-index: 1;
}

.landing-logo {
  width: 260px;
  max-width: 74%;
  margin-bottom: 16px;
  filter: drop-shadow(0 2px 10px rgba(0,0,0,0.3));
}
.landing-lines { width: 100%; height: auto; display: block; }

.logo-svg {
  width: 100%;
  height: 100%;
}

.landing-wordmark {
  margin-bottom: 12px;
  filter: drop-shadow(0 1px 6px rgba(0,0,0,0.3));
}

/* Wordmark rendered as live Space Mono text — transparent, crisp at any size,
   recolours to context. Swap back to <img src="wordmark.svg"> if a bespoke
   transparent lockup is added later. */
.wordmark-text {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--chalk);
  letter-spacing: -0.02em;
  line-height: 1;
  font-size: 40px;
}
.wordmark-text-sm { font-size: 24px; }

.wordmark-svg {
  width: 100%;
  height: auto;
}

.landing-subtitle {
  font-size: 16px;
  color: var(--matchday);
  font-weight: 500;
  margin-bottom: 16px;
}

.landing-desc {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.5;
  max-width: 340px;
}

.squad-onboarding {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 16px 4px 8px;
  position: relative;
  z-index: 1;
}

.squad-onboarding-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--white);
  margin: 0;
}

.squad-onboarding-body {
  font-size: 13px;
  color: rgba(255,255,255,0.65);
  line-height: 1.6;
  margin: 0;
  max-width: 320px;
}

.squad-onboarding-arrow {
  font-size: 24px;
  color: var(--matchday);
  animation: bounce-arrow 1.4s ease-in-out infinite;
}

@keyframes bounce-arrow {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(6px); }
}

.landing-modes {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 32px;
  position: relative;
  z-index: 1;
}

.mode-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 14px;
  row-gap: 6px;
  padding: 16px 20px;
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: 14px;
  background: rgba(255,255,255,0.06);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-align: left;
  position: relative;
}
/* Icon left, title right-justified on the same row; description spans below. */
.mode-card .mode-icon  { grid-column: 1; grid-row: 1; margin: 0; }
.mode-card .mode-title { grid-column: 2; grid-row: 1; text-align: right; }
.mode-card .mode-desc  { grid-column: 1 / -1; grid-row: 2; }

.mode-card:active {
  background: rgba(255,255,255,0.12);
  border-color: var(--btn-primary);
}

.landing--onboarding #btn-season-mode,
.landing--onboarding #btn-tournament-mode {
  opacity: 0.08;
  pointer-events: none;
  filter: grayscale(1);
}

.landing--onboarding #btn-squad-management {
  border-color: var(--matchday);
  background: color-mix(in srgb, var(--matchday) 14%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--matchday) 40%, transparent), 0 8px 32px rgba(0,0,0,0.5);
  animation: pulse-highlight 2s ease-in-out infinite;
}

@keyframes pulse-highlight {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--matchday) 40%, transparent), 0 8px 32px rgba(0,0,0,0.5); }
  50%       { box-shadow: 0 0 0 7px color-mix(in srgb, var(--matchday) 15%, transparent), 0 8px 32px rgba(0,0,0,0.5); }
}

.mode-card.mode-coming-soon {
  opacity: 0.5;
  cursor: default;
}

.mode-card.mode-coming-soon:active {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.15);
}

.mode-icon {
  margin-bottom: 2px;
}

/* Line-style Level mode icons (chalk stroke + lime accent) — landing + tutorial */
.mode-svg { width: 30px; height: 30px; display: block; }

.mode-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--white);
}

.mode-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.4;
}

.mode-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--trophy-amber);
  background: color-mix(in srgb, var(--amber) 15%, transparent);
  padding: 3px 8px;
  border-radius: 6px;
}

.bug-report {
  display: block;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  text-align: center;
  padding: 12px 0 8px;
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: none;
  position: relative;
  z-index: 1;
}

.bug-report:active { color: var(--text-light); }

/* ── Player availability panel ────────────────────────────────────── */

.avail-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-light);
  padding: 0 0 12px;
}

.avail-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.avail-item {
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.avail-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.06);
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  color: var(--text-light);
}

.avail-label input { accent-color: var(--btn-primary); width: auto; }

.avail-name { font-weight: 500; }

.pos-chips {
  display: flex;
  gap: 4px;
  padding: 5px 12px 8px 38px;
}

.pos-chip {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.25);
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: background 0.15s, color 0.15s;
}

.pos-chip:active { opacity: 0.7; }

.pos-chip[data-pos="GK"].active  { background: color-mix(in srgb, var(--pos-gk) 30%, transparent);  color: var(--pos-gk-fg); }
.pos-chip[data-pos="DEF"].active { background: color-mix(in srgb, var(--pos-def) 30%, transparent); color: var(--pos-def-fg); }
.pos-chip[data-pos="MID"].active { background: color-mix(in srgb, var(--pos-mid) 30%, transparent); color: var(--pos-mid-fg); }
.pos-chip[data-pos="FWD"].active { background: color-mix(in srgb, var(--pos-fwd) 30%, transparent); color: var(--pos-fwd-fg); }

.match-item-opponent { display: inline-flex; align-items: center; gap: 4px; }

.match-rename {
  opacity: 0.35;
  font-size: 12px;
  padding: 1px 3px;
  vertical-align: middle;
}

.match-rename:hover,
.match-rename:focus { opacity: 1; }

.avail-actions {
  display: flex;
  gap: 8px;
}

.avail-actions .btn { flex: 1; }

/* ── Stats screen ────────────────────────────────────────────────── */

.stats-list {
  list-style: none;
  padding: 0 16px;
}

.stats-header, .stats-row {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.stats-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stats-row {
  font-size: 14px;
  color: var(--text-light);
}

.stats-name {
  flex: 1;
  font-weight: 500;
}

.stats-col {
  width: 60px;
  text-align: center;
}

.stats-row-tap {
  cursor: pointer;
}
.stats-row-tap:active {
  background: rgba(255,255,255,0.05);
}
.stats-chevron {
  width: 20px;
  text-align: right;
  color: var(--text-dim);
  font-size: 18px;
}

/* ── Player history screen ────────────────────────────────────────── */

.history-totals {
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.history-total-grid {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin-bottom: 12px;
}

.history-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.history-stat-val {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--white);
}

.history-stat-lbl {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.history-pos-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.history-pos-badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.history-pos-badge.pos-gk  { background: color-mix(in srgb, var(--pos-gk) 25%, transparent);  color: var(--pos-gk-fg); }
.history-pos-badge.pos-def { background: color-mix(in srgb, var(--pos-def) 25%, transparent); color: var(--pos-def-fg); }
.history-pos-badge.pos-mid { background: color-mix(in srgb, var(--pos-mid) 25%, transparent); color: var(--pos-mid-fg); }
.history-pos-badge.pos-fwd { background: color-mix(in srgb, var(--pos-fwd) 25%, transparent); color: var(--pos-fwd-fg); }

.history-list {
  list-style: none;
  padding: 0 16px;
  flex: 1;
  overflow-y: auto;
}

.history-match-row {
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.history-match-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 14px;
}

.history-match-date { color: var(--text-dim); font-size: 12px; min-width: 50px; }
.history-match-opp  { flex: 1; color: var(--white); font-weight: 500; }
.history-match-goals { color: var(--text-dim); font-size: 13px; }
.history-match-slots { font-size: 12px; color: var(--text-dim); }

.history-match-pos { display: flex; flex-wrap: wrap; gap: 4px; }
.history-bench { font-size: 12px; color: var(--text-dim); font-style: italic; }

.home-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Screen management ────────────────────────────────────────────── */

.screen { display: flex; flex-direction: column; min-height: 100dvh; }

/* ── Home screen ──────────────────────────────────────────────────── */

.header-home {
  padding: 20px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.app-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-light);
}

.home-actions {
  display: flex;
  gap: 8px;
}

.btn-primary {
  background: var(--btn-primary);
  color: var(--on-accent);
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  flex: 1;
}
.btn-primary:active { background: var(--accent-press); }

.btn-secondary {
  background: rgba(255,255,255,0.12);
  color: var(--text-light);
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  flex: 1;
}
.btn-secondary:active { background: rgba(255,255,255,0.2); }

.btn-full { width: 100%; }

.match-list {
  list-style: none;
  padding: 8px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.match-item {
  background: rgba(255,255,255,0.08);
  border-radius: 10px;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.match-item-main {
  flex: 1;
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.match-item-main:active { background: rgba(255,255,255,0.06); }

.match-item-date {
  font-size: 12px;
  color: var(--text-dim);
}

.match-item-opponent {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-light);
}

.match-badge {
  font-size: 11px;
  background: rgba(255,200,0,0.2);
  color: var(--gold);
  border-radius: 4px;
  padding: 1px 6px;
  align-self: flex-start;
}

.match-badge-done {
  background: color-mix(in srgb, var(--live) 15%, transparent);
  color: var(--live);
  font-weight: 600;
}
.match-badge-live {
  background: color-mix(in srgb, var(--danger) 20%, transparent);
  color: var(--danger);
  font-weight: 600;
}
.match-item-done {
  opacity: 0.8;
}
.match-item-done .match-item-opponent {
  color: var(--text-dim);
}

/* ── End Match bar ───────────────────────────────────────────────── */
.end-match-bar {
  padding: 4px 16px 10px;
}
.btn-end-match {
  width: 100%;
  background: transparent;
  color: var(--danger);
  border: 1.5px solid color-mix(in srgb, var(--danger) 50%, transparent);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px;
  cursor: pointer;
  letter-spacing: 0.02em;
}
.btn-end-match:active { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.btn-return-plan {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.8rem;
  padding: 4px 10px 8px;
  cursor: pointer;
  text-align: center;
  letter-spacing: 0.01em;
}
.btn-return-plan:active { opacity: 0.5; }

.match-delete {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  padding: 14px 16px;
  cursor: pointer;
}
.match-delete:active { color: var(--danger); }

/* Edit pencil sits before delete — give it a clear gap so the two icons don't
   read as one cluster (and a full-height tap target). */
.match-edit {
  padding: 14px 10px;
  margin-right: 2px;
  font-size: 15px;
}

.empty-state {
  color: var(--text-dim);
  text-align: center;
  padding: 32px 16px;
  font-size: 14px;
  list-style: none;
}

.loading { color: var(--text-dim); padding: 24px 16px; list-style: none; font-size: 14px; }

/* ── Sub-screen header ────────────────────────────────────────────── */

.header-sub {
  padding: 16px 16px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.header-sub h2 { font-size: 18px; font-weight: 700; }

/* Export button in a sub-header (Season Stats) — pushed to the right. */
.btn-export-stats {
  margin-left: auto;
  background: transparent;
  color: var(--trophy-amber);
  border: 1px solid var(--trophy-amber);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-export-stats:active { opacity: 0.7; }
.btn-export-stats[hidden] { display: none; }

/* ── Sliding switch (e.g. "show timer") ───────────────────────────── */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex: 0 0 auto;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 26px;
  transition: background 0.2s;
}
.switch-slider::before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  top: 3px;
  background: var(--white);
  border-radius: 50%;
  transition: transform 0.2s;
}
.switch input:checked + .switch-slider { background: var(--trophy-amber); }
.switch input:checked + .switch-slider::before { transform: translateX(20px); }
.switch input:focus-visible + .switch-slider { outline: 2px solid var(--trophy-amber); outline-offset: 2px; }

.btn-back {
  background: none;
  border: none;
  color: var(--btn-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  white-space: nowrap;
}

/* ── New match form ───────────────────────────────────────────────── */

.form-card {
  background: rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 20px 16px;
  margin: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
}

.form-card input:not([type="checkbox"]):not([type="range"]),
.form-card textarea,
.form-card select {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
  color: var(--text-light);
  width: 100%;
  -webkit-appearance: none;
}

.form-card input:not([type="checkbox"]):not([type="range"]):focus,
.form-card textarea:focus,
.form-card select:focus {
  outline: none;
  border-color: var(--btn-primary);
}

.form-card input[type="number"] { width: 80px; }
.form-card input[type="checkbox"] { width: auto; }

/* ── Team size picker ────────────────────────────────────────────── */

.size-picker {
  display: flex;
  gap: 6px;
  margin: 4px 0 8px;
}

.size-btn {
  flex: 1;
  padding: 10px 4px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  color: var(--text-light);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.size-btn.active {
  background: var(--btn-primary);
  border-color: var(--btn-primary);
  color: var(--on-accent);
}

.size-btn:not(.active):active {
  background: rgba(255,255,255,0.1);
}

/* ── Fairness slider ─────────────────────────────────────────────── */

.fairness-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 4px;
}

.fairness-label {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  min-width: 60px;
}

.fairness-label:last-child { text-align: right; }

.fairness-row input[type="range"] {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right, var(--btn-primary), var(--trophy-amber), var(--danger-soft));
  border-radius: 3px;
  outline: none;
}

.fairness-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  cursor: pointer;
}

.fairness-value {
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.fairness-warning {
  text-align: center;
  font-size: 12px;
  color: var(--danger-soft);
  margin: 2px 0 4px;
  font-style: italic;
}

.rotation-options {
  display: flex;
  gap: 8px;
  margin: 6px 0 4px;
}

.rotation-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 6px;
  border: 1px solid var(--pitch-line);
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, border-color 0.15s;
}

.rotation-option input[type="radio"] { display: none; }

.rotation-option:has(input:checked) {
  background: color-mix(in srgb, var(--matchday) 15%, transparent);
  border-color: var(--matchday);
}

.rotation-option-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--chalk);
}

.rotation-option-desc {
  font-size: 11px;
  color: color-mix(in srgb, var(--chalk) 55%, transparent);
  line-height: 1.3;
}

.rotation-option-warn {
  display: none;
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.3;
  color: var(--amber);
}

/* Only show the warning once the coach actually selects that option */
.rotation-option:has(input:checked) .rotation-option-warn {
  display: block;
}

.rotation-clarifier {
  font-size: 11px;
  color: color-mix(in srgb, var(--chalk) 45%, transparent);
  font-style: italic;
  margin: 2px 0 8px;
}

/* ── Position checkboxes (pill toggles) ──────────────────────────── */

.position-checkboxes {
  display: flex;
  gap: 8px;
  margin: 4px 0 8px;
  flex-wrap: wrap;
}

.pos-check {
  display: block;
  cursor: pointer;
}

.pos-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pos-check .pos-label {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  border: 1.5px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: var(--text-dim);
  transition: all 0.15s ease;
  user-select: none;
}

.pos-check input:checked + .pos-label {
  border-color: var(--btn-primary);
  background: rgba(76,175,80,0.2);
  color: var(--white);
}

.pos-check input:checked + .pos-label.pos-gk  { border-color: var(--pos-gk);  background: color-mix(in srgb, var(--pos-gk) 20%, transparent);  color: var(--pos-gk-fg); }
.pos-check input:checked + .pos-label.pos-def { border-color: var(--pos-def); background: color-mix(in srgb, var(--pos-def) 20%, transparent); color: var(--pos-def-fg); }
.pos-check input:checked + .pos-label.pos-mid { border-color: var(--pos-mid); background: color-mix(in srgb, var(--pos-mid) 20%, transparent); color: var(--pos-mid-fg); }
.pos-check input:checked + .pos-label.pos-fwd { border-color: var(--pos-fwd); background: color-mix(in srgb, var(--pos-fwd) 20%, transparent); color: var(--pos-fwd-fg); }

/* ── Size badge on match list ────────────────────────────────────── */

.size-badge {
  background: color-mix(in srgb, var(--matchday) 20%, transparent);
  color: var(--matchday);
  font-weight: 700;
  font-size: 11px;
}

/* ── Best position badge ─────────────────────────────────────────── */

.badge-pos {
  background: rgba(255,255,255,0.1);
  color: var(--text-dim);
}

.badge-pos.badge-best {
  background: rgba(33,150,243,0.25);
  color: #64b5f6;
  font-weight: 700;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

/* ── Squad screen ─────────────────────────────────────────────────── */

.player-list {
  list-style: none;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.player-item {
  background: rgba(255,255,255,0.08);
  border-radius: 10px;
  display: flex;
  align-items: center;
  padding: 12px 14px;
  gap: 12px;
}

.player-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.player-item-name { font-size: 16px; font-weight: 600; }

.player-item-badges { display: flex; gap: 4px; flex-wrap: wrap; }

.badge {
  font-size: 10px;
  font-weight: 700;
  border-radius: 4px;
  padding: 2px 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-number         { background: rgba(255,255,255,0.15); color: var(--chalk); font-variant-numeric: tabular-nums; }
.badge-number-conflict { background: var(--danger-deep); color: var(--white); }

.badge-gk        { background: #1565c0; color: var(--white); }
.badge-gkpref    { background: #1976d2; color: var(--white); }
.badge-gkcan     { background: rgba(255,255,255,0.15); color: var(--text-light); }
.badge-emergency { background: #b71c1c; color: var(--white); }
.badge-def       { background: #e65100; color: var(--white); }

.player-item-actions { display: flex; gap: 6px; }

.btn-sm {
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 6px;
  color: var(--text-light);
  font-size: 13px;
  padding: 6px 10px;
  cursor: pointer;
}
.btn-sm:active { background: rgba(255,255,255,0.2); }


.adjust-status {
  text-align: center;
  font-size: 13px;
  color: var(--trophy-amber);
  padding: 6px 16px;
  letter-spacing: 0.02em;
  animation: pulse-text 1s ease-in-out infinite alternate;
}
@keyframes pulse-text {
  from { opacity: 0.6; }
  to   { opacity: 1; }
}

/* ── Season export bar ───────────────────────────────────────── */

.export-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 16px 28px;
  gap: 6px;
  position: relative;
}

.btn-export-main {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  color: rgba(255,255,255,0.55);
  font-size: 13px;
  padding: 8px 24px;
  cursor: pointer;
  letter-spacing: 0.03em;
}
.btn-export-main:active { background: rgba(255,255,255,0.06); }

.export-dropdown {
  background: var(--toast-bg);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  overflow: hidden;
  width: 200px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.export-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  color: var(--chalk);
  font-size: 14px;
  padding: 14px 16px;
  cursor: pointer;
  text-align: left;
}
.export-option:last-child { border-bottom: none; }
.export-option:active { background: rgba(255,255,255,0.06); }
.export-option.btn-sheets { color: #34A853; }
.export-option .sheets-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border-radius: 2px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--toast-bg);
  color: var(--chalk);
  font-size: 14px;
  padding: 12px 20px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15);
  z-index: 9999;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.toast-text { flex: 1; }

.toast-action {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--amber);  /* trophy-amber accent */
  font-weight: 600;
  font-size: 14px;
  padding: 4px 8px;
  margin: -4px -8px;
  cursor: pointer;
}

.btn-danger { color: var(--danger); }
.btn-danger:active { background: color-mix(in srgb, var(--danger) 15%, transparent); }

.squad-footer {
  padding: 12px 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.btn-manual-slots {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.8rem;
  text-align: center;
  padding: 4px;
  cursor: pointer;
  opacity: 0.7;
}
.btn-manual-slots:active { opacity: 1; }
.btn-manual-slots:disabled { opacity: 0.4; }

/* ── DEF Restricted toggle ────────────────────────────────────────── */

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

.toggle-text {
  font-size: 15px;
  color: var(--text-light);
  flex: 1;
}

.toggle-hint { font-size: 12px; color: var(--text-dim); display: block; margin-top: 2px; }

.toggle-input { position: absolute; opacity: 0; width: 0; height: 0; }

.toggle-wrap { flex-shrink: 0; }

.toggle-track {
  display: block;
  width: 48px;
  height: 28px;
  background: rgba(255,255,255,0.15);
  border-radius: 14px;
  position: relative;
  transition: background 0.2s;
}

.toggle-thumb {
  display: block;
  width: 22px;
  height: 22px;
  background: var(--white);
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.toggle-input:checked + .toggle-track { background: var(--btn-primary); }
.toggle-input:checked + .toggle-track .toggle-thumb { transform: translateX(20px); }

/* ── Player form overlay ──────────────────────────────────────────── */

.form-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: flex-end;
  z-index: 100;
  padding: 16px;
}


.form-overlay .form-card {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: var(--pitch);
  border: 1px solid rgba(255,255,255,0.15);
}

.form-overlay h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 4px;
}

/* ── Pitch header extension ───────────────────────────────────────── */

.header-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.header-top .match-title { font-size: 13px; }

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
  color: var(--text-dim);
}


/* ── Home/Away picker ────────────────────────────────────────────── */

.home-away-picker {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.ha-btn {
  flex: 1;
  padding: 10px;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.ha-btn.active {
  border-color: var(--matchday);
  background: color-mix(in srgb, var(--matchday) 15%, transparent);
  color: var(--chalk);
}

/* ── Team info card (squad screen) ──────────────────────────────── */

.team-info-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.team-logo-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px dashed rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
  transition: border-color 0.15s;
}

.team-logo-btn:hover { border-color: var(--matchday); }

.team-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.team-logo-placeholder {
  font-size: 22px;
  color: rgba(255,255,255,0.3);
  line-height: 1;
}

.team-name-input {
  flex: 1;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--chalk);
  font-size: 15px;
  font-weight: 600;
}

.team-name-input:focus {
  outline: none;
  border-color: var(--matchday);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
}

/* ── Full time screen ─────────────────────────────────────────────── */

.ft-wrapper {
  padding: 20px 16px 40px;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ft-card {
  background: linear-gradient(160deg, var(--pitch-deep) 0%, var(--pitch) 100%);
  border-radius: 18px;
  padding: 28px 20px 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.ft-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--matchday);
  background: color-mix(in srgb, var(--matchday) 15%, transparent);
  padding: 4px 12px;
  border-radius: 20px;
}

.ft-teams {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  justify-content: center;
}

.ft-team-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.ft-team-logo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--chalk);
  overflow: hidden;
}

.ft-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.ft-team-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--chalk);
  text-align: center;
  line-height: 1.2;
}

.ft-scoreline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.ft-score-num {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 900;
  color: var(--chalk);
  line-height: 1;
  min-width: 40px;
  text-align: center;
}

.ft-score-sep {
  font-size: 36px;
  font-weight: 300;
  color: color-mix(in srgb, var(--chalk) 40%, transparent);
}

.ft-meta {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
}

/* Caption under a masked scoreline (FA sub-U12 guidance). */
.ft-hidden-note {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--matchday);
  text-align: center;
  margin-top: -4px;
}

/* "Hide score" toggle row on the Full Time screen (below the card). */
.ft-hide-row {
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 14px;
  color: var(--chalk);
}
.ft-hide-row small {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 400;
}

.ft-scorers-section {
  width: 100%;
  text-align: center;
}

.ft-scorers-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ft-scorers-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.ft-scorer {
  background: color-mix(in srgb, var(--matchday) 15%, transparent);
  color: var(--matchday);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 600;
}

.ft-opp-goals-row {
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  padding: 14px 16px;
}

.ft-opp-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  color: var(--chalk);
  gap: 12px;
}

.ft-opp-input {
  width: 70px;
  padding: 8px;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  color: var(--chalk);
}

.ft-opp-input:focus { outline: none; border-color: var(--matchday); }

.ft-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Tutorial screen ─────────────────────────────────────────────── */

.tutorial-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 40px 24px env(safe-area-inset-bottom);
  min-height: 100dvh;
  background: linear-gradient(170deg, var(--pitch-deep) 0%, var(--pitch) 100%);
}

.tutorial-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tutorial-logo .logo-svg { width: 48px; height: 48px; }
.tutorial-logo .wordmark-svg { height: 28px; width: auto; }

.tutorial-heading {
  font-size: 22px;
  font-weight: 800;
  color: var(--white);
  text-align: center;
  margin: 0;
}

.tutorial-body {
  font-size: 14px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.6;
  max-width: 340px;
  margin: 0;
}

.tutorial-modes {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 380px;
}

.tutorial-mode-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
}

.tutorial-mode-icon { font-size: 24px; }

.tutorial-mode-item strong {
  display: block;
  font-size: 15px;
  color: var(--white);
  margin-bottom: 3px;
}

.tutorial-mode-item p {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.4;
}

.tutorial-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 380px;
}

.tutorial-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--text-dim);
}

.tutorial-optional {
  font-size: 12px;
  color: var(--text-dim);
  opacity: 0.6;
}

.logo-upload-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-preview {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-dim);
  overflow: hidden;
  flex-shrink: 0;
}

.logo-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ── Tournament screens ──────────────────────────────────────────── */

.btn-edit-tournament { margin-left: auto; font-size: 20px; }

.lobby-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 16px 0;
}

.lobby-add-section {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lobby-add-buttons {
  display: flex;
  gap: 10px;
}

.lobby-add-buttons .btn { flex: 1; }

.add-match-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
}

.add-match-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
  margin: 0;
}

.add-match-section-label {
  font-size: 13px;
  color: var(--text-dim);
  margin: 4px 0 0;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.add-match-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.add-match-actions .btn { flex: 1; }

.btn-tournament-stats {
  display: block;
  width: calc(100% - 32px);
  margin: 0 16px 4px;
  padding: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}
.btn-tournament-stats:active { background: rgba(255,255,255,0.1); }

/* Tournament stats overlay rows */
.stats-slots {
  font-size: 13px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stats-goals {
  font-size: 13px;
  color: #f0c040;
  margin-right: 12px;
  white-space: nowrap;
}

.knockout-options {
  padding: 12px;
  background: rgba(255,193,7,0.05);
  border: 1px solid rgba(255,193,7,0.15);
  border-radius: 10px;
}

.add-guest-section { margin-top: 4px; }

.btn-link {
  background: none;
  border: none;
  color: var(--btn-primary);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.guest-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.guest-form input[type="text"],
.guest-form select,
.guest-form input[type="number"] {
  flex: 1;
  min-width: 80px;
}

.avail-guest-tag {
  font-size: 11px;
  background: rgba(255,193,7,0.15);
  color: #ffd048;
  border-radius: 20px;
  padding: 2px 8px;
  font-weight: 600;
  margin-left: auto;
}

.avail-remove-guest {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px 4px;
  font-size: 13px;
  line-height: 1;
}

.avail-remove-guest:active { color: var(--error); }

.avail-skill {
  font-size: 12px;
  color: var(--text-dim);
  margin-left: 4px;
}

.label-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-direction: row;
}

.label-row input[type="checkbox"] {
  width: auto;
  flex-shrink: 0;
}

.form-hint {
  font-size: 13px;
  color: var(--text-dim);
  margin: -4px 0 4px;
}

.inline-pair {
  display: flex;
  gap: 12px;
}

.inline-pair label {
  flex: 1;
}

.inline-pair input[type="number"] {
  width: 100%;
}

.screen-desc {
  font-size: 14px;
  color: var(--text-dim);
  padding: 8px 16px 4px;
  margin: 0;
}

.avail-list.padded {
  padding: 0 16px;
}

.form-section { margin: 8px 0; }

.form-section-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.lobby-guest-section {
  padding: 0 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lobby-guest-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.guest-player-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255,193,7,0.06);
  border: 1px solid rgba(255,193,7,0.15);
  border-radius: 8px;
  font-size: 14px;
}

/* ── Match timer ─────────────────────────────────────────────────────────── */

.match-timer {
  display: flex;
  align-items: center;
  gap: 8px;
}

.timer-display {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  padding: 6px 14px;
  font-family: var(--font-timer);
  font-size: 30px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-light);
  min-width: 92px;
  min-height: 56px;
  text-align: center;
}

.timer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  color: var(--text-light);
  font-size: 24px;
  line-height: 1;
  min-width: 56px;
  min-height: 56px;
  cursor: pointer;
}

/* New-period "reset clock?" prompt */
.new-period-hint {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 16px 0;
  padding: 10px 12px;
  background: rgba(53,113,158,0.14);
  border: 1px solid rgba(53,113,158,0.5);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-light);
}

.new-period-hint-text { flex: 1; min-width: 140px; }

.new-period-hint-btn {
  background: var(--coach-blue);
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-weight: 700;
  color: var(--text-light);
  cursor: pointer;
  min-height: 40px;
}

/* "Browse only" — deliberately a neutral chalk/grey, NOT amber: amber already
   means GK / incoming sub / start-quarter, so the passive option must read
   differently from those. */
.new-period-hint-ghost {
  background: color-mix(in srgb, var(--chalk) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--chalk) 40%, transparent);
  border-radius: 6px;
  padding: 8px 12px;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  min-height: 40px;
}

/* ── Auth screens (multi-user sign-in / invite redeem) ───────────────────────── */
.auth-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--pitch);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 28px 24px;
  text-align: center;
}
.auth-card .landing-wordmark { margin-bottom: 12px; }
.auth-title {
  font-size: 20px;
  margin: 4px 0 6px;
  color: var(--chalk);
}
.auth-sub {
  font-size: 14px;
  color: var(--text-dim);
  margin: 0 0 20px;
}
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--pitch-deep);
  color: var(--chalk);
}
.auth-input:focus { outline: none; border-color: var(--matchday); }
.auth-msg {
  margin: 16px 0 0;
  font-size: 14px;
  color: var(--chalk);
}
.auth-devlink {
  display: inline-block;
  margin-top: 12px;
  font-size: 13px;
  color: var(--matchday);
}
.auth-signout {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.25);
  color: var(--chalk);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}
