/* ==========================================================================
   SportGala — tactics board
   ========================================================================== */

html:has(.board-page) { height: 100%; }
.board-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

/* ---------- Top bar ---------- */
.board-bar {
  flex: none;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "left score" "actions actions";
  align-items: center;
  gap: 6px 10px;
  padding: 8px 10px;
  padding-top: max(8px, env(safe-area-inset-top));
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  z-index: 20;
}
.bar-left { grid-area: left; display: flex; align-items: center; gap: 6px; }
.bar-brand { display: none; font-size: 22px; gap: 3px; }
.bar-brand .brand-tagline { font-size: 8px; }
.bar-brand .brand-mark { width: 32px; height: 32px; }

.scoreboard {
  grid-area: score;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.bar-actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.bar-actions::-webkit-scrollbar { display: none; }
.bar-sep { width: 1px; height: 24px; background: var(--line-2); margin: 0 4px; flex: none; }

.bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  flex: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.bar-btn:hover { background: var(--surface-2); color: var(--text); }
.bar-btn svg { width: 18px; height: 18px; }
.bar-export { margin-left: auto; flex: none; }

@media (min-width: 900px) {
  .board-bar {
    grid-template-columns: 1fr auto 1fr;
    grid-template-areas: "left score actions";
    height: 64px;
    padding: 0 16px;
  }
  .bar-brand { display: inline-flex; }
  .scoreboard { justify-self: center; }
  .bar-actions { justify-self: end; overflow: visible; }
  .bar-export { margin-left: 8px; }
}
@media (min-width: 900px) and (max-width: 1180px) {
  .bar-btn span { display: none; }
  .bar-btn { padding: 0 10px; }
}

/* Scoreboard */
.sb-team {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 28vw;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--surface);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.sb-team:hover { border-color: #3b4c72; }
.sb-team span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-team i { width: 10px; height: 10px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15); }
.sb-score {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}
.sb-score i { font-style: normal; opacity: 0.55; }
.sb-goal {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px dashed var(--line-2);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  flex: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.sb-goal:hover { color: var(--accent); border-color: var(--accent); }
@media (max-width: 420px) {
  .sb-team { font-size: 15px; padding: 0 8px; max-width: 24vw; }
  .sb-score { font-size: 20px; padding: 0 10px; }
}

/* ---------- Body ---------- */
.board-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
@media (min-width: 760px) { .board-body { flex-direction: row; } }

.stage {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 40%, rgba(22, 163, 74, 0.12), transparent 60%),
    var(--bg);
}

.stage-hint {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  max-width: calc(100% - 24px);
  padding: 2px 10px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.export-container { position: relative; padding: 12px; border-radius: 16px; }
.export-container.is-exporting { background: var(--bg); padding: 20px 20px 40px; }
.export-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 10px 16px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-head);
  text-transform: uppercase;
}
.export-brand { font-size: 22px; font-weight: 800; letter-spacing: 0.04em; }
.export-brand b { color: var(--accent); }
.export-score { display: inline-flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 700; }
.export-score i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.export-score b { padding: 2px 12px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 800; }

/* ---------- Pitch ---------- */
.pitch {
  --ps: 36px;
  position: relative;
  border-radius: 6px;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1), 0 30px 60px rgba(0, 0, 0, 0.5);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.pitch-markings,
.pitch-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.pitch-markings { border-radius: 6px; }
.pitch-overlay { pointer-events: none; z-index: 5; }
.pitch-overlay [data-kind] { cursor: pointer; }
.pitch-players { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
.pitch-players .player { pointer-events: auto; }

.pitch[data-tool="pen"],
.pitch[data-tool="arrow"],
.pitch[data-tool="rect"],
.pitch[data-tool="circle"],
.pitch[data-tool="pen"] .player,
.pitch[data-tool="arrow"] .player,
.pitch[data-tool="rect"] .player,
.pitch[data-tool="circle"] .player { cursor: crosshair; }
.pitch[data-tool="eraser"],
.pitch[data-tool="eraser"] .player,
.pitch[data-tool="eraser"] [data-kind] { cursor: cell; }
.pitch[data-tool="connect"] .player { cursor: pointer; }

/* ---------- Players ---------- */
.player {
  position: absolute;
  transform: translate(-50%, calc(var(--ps) * -0.5));
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
  cursor: grab;
}
.player.is-selected { z-index: 30; }
.player.is-dragging { z-index: 50; cursor: grabbing; }

.jersey-wrap {
  position: relative;
  width: var(--ps);
  height: var(--ps);
  transition: transform 0.15s ease;
}
.player.is-dragging .jersey-wrap,
.player.is-dragging .coach-badge { transform: scale(1.15); }
@media (hover: hover) {
  .pitch[data-tool="move"] .player:hover .jersey-wrap { transform: scale(1.08); }
}

.jersey {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35));
}
.player-num {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding-top: calc(var(--ps) * 0.08);
  font-size: calc(var(--ps) * 0.3);
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.player-name {
  position: relative;
  z-index: 2;
  margin-top: calc(var(--ps) * -0.06);
  padding: 1px 6px;
  max-width: calc(var(--ps) * 3.2);
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 4px;
  background: rgba(3, 7, 18, 0.78);
  color: #fff;
  font-size: max(9px, calc(var(--ps) * 0.27));
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  pointer-events: none;
}
.player-cards {
  position: absolute;
  top: calc(var(--ps) * -0.2);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
  z-index: 3;
  pointer-events: none;
}
.card {
  display: inline-block;
  width: 9px;
  height: 13px;
  border-radius: 2px;
  vertical-align: middle;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.card-yellow { background: #facc15; }
.card-red { background: #dc2626; }
.player-cards .card { width: calc(var(--ps) * 0.2); height: calc(var(--ps) * 0.28); }

.player-goals {
  position: absolute;
  top: calc(var(--ps) * -0.08);
  right: calc(var(--ps) * -0.22);
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 1px 3px;
  border-radius: 999px;
  background: #fff;
  color: #0b1220;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.player-goals svg { width: 10px; height: 10px; }
.player-sub {
  position: absolute;
  bottom: calc(var(--ps) * -0.02);
  right: calc(var(--ps) * -0.45);
  z-index: 3;
  display: inline-flex;
  gap: 3px;
  padding: 1px 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  background: #0b1220;
  color: var(--accent);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
}
.player-sub b { color: #f87171; margin-right: 3px; }

/* Selection / link halo */
.player-halo {
  position: absolute;
  top: calc(var(--ps) * 0.5);
  left: 50%;
  width: calc(var(--ps) * 1.6);
  height: calc(var(--ps) * 1.6);
  border-radius: 50%;
  display: none;
  pointer-events: none;
  background: conic-gradient(from 0deg, #a3e635, #22c55e, #3b82f6, #eab308, #a3e635);
  -webkit-mask: radial-gradient(closest-side, transparent 78%, #000 80%, #000 96%, transparent 98%);
  mask: radial-gradient(closest-side, transparent 78%, #000 80%, #000 96%, transparent 98%);
  animation: halo-spin 3s linear infinite;
}
.player.is-selected .player-halo,
.player.is-linking .player-halo { display: block; }
.player.is-linking .player-halo { background: conic-gradient(from 0deg, #f59e0b, #fde047, #f59e0b); }
@keyframes halo-spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Coach */
.coach-badge {
  display: grid;
  place-items: center;
  width: calc(var(--ps) * 0.85);
  height: calc(var(--ps) * 0.85);
  margin-top: calc(var(--ps) * 0.075);
  border: 2px solid;
  border-radius: 50%;
  background: #1e293b;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease;
}
.coach-badge svg { width: calc(var(--ps) * 0.45); height: calc(var(--ps) * 0.45); }
.coach-tag {
  position: relative;
  z-index: 2;
  margin-top: -5px;
  padding: 0 4px;
  border-radius: 3px;
  color: #fff;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.5;
  pointer-events: none;
}

/* Ball */
.pitch-ball {
  position: absolute;
  z-index: 40;
  width: calc(var(--ps) * 0.5);
  height: calc(var(--ps) * 0.5);
  transform: translate(-50%, -50%);
  cursor: grab;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
  transition: transform 0.12s ease;
}
.pitch-ball svg { width: 100%; height: 100%; }
.pitch-ball.is-dragging { transform: translate(-50%, -50%) scale(1.2); cursor: grabbing; }
.pitch:not([data-tool="move"]) .pitch-ball { pointer-events: none; }

/* ---------- Tool rail ---------- */
.tool-rail {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  overflow-x: auto;
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  scrollbar-width: none;
}
.tool-rail::-webkit-scrollbar { display: none; }
.rail-group { display: flex; gap: 6px; flex: none; }
.rail-sep { width: 1px; height: 40px; background: var(--line-2); flex: none; }

.tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 54px;
  height: 52px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  flex: none;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.tool-btn svg { width: 20px; height: 20px; }
.tool-btn:hover { color: var(--text); border-color: var(--line-2); }
.tool-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 6px 16px rgba(163, 230, 53, 0.25);
}
.tool-btn[hidden] { display: none; }
.tool-danger:hover { color: #fca5a5; border-color: rgba(239, 68, 68, 0.5); }

.rail-colors { align-items: center; }
.swatch {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 2px solid var(--line-2);
  border-radius: 50%;
  background: var(--c);
  flex: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.swatch:hover { transform: scale(1.1); }
.swatch.is-active { border-color: var(--bg); box-shadow: 0 0 0 2px var(--accent); transform: scale(1.1); }

.rail-widths { align-items: center; }
.width-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 30px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  flex: none;
}
.width-btn i { display: block; width: 100%; border-radius: 4px; background: var(--muted); }
.width-btn.is-active { border-color: var(--accent); }
.width-btn.is-active i { background: var(--accent); }

@media (min-width: 760px) {
  .tool-rail {
    flex-direction: column;
    align-items: stretch;
    width: 132px;
    padding: 14px 12px;
    overflow-x: hidden;
    overflow-y: auto;
    border-top: 0;
    border-left: 1px solid var(--line);
  }
  .rail-group { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .rail-colors { grid-template-columns: repeat(3, 1fr); justify-items: center; gap: 8px 6px; }
  .rail-widths { grid-template-columns: repeat(3, 1fr); }
  .rail-sep { width: 100%; height: 1px; margin: 4px 0; }
  .tool-btn { width: auto; height: 50px; }
  .width-btn { width: auto; }
}


/* ---------- Phones in landscape (short screens) ---------- */
@media (orientation: landscape) and (max-height: 520px) {
  .board-bar {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "left score actions";
    height: 46px;
    gap: 6px;
    padding: 0 8px;
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
  }
  .bar-brand { display: none; }
  .scoreboard { justify-self: center; gap: 4px; }
  .bar-actions { justify-self: end; overflow-x: auto; gap: 2px; }
  .bar-sep { display: none; }
  .bar-btn { height: 34px; padding: 0 8px; }
  .bar-btn span, .bar-export span { display: none; }
  .bar-export { min-height: 34px; padding: 0 10px; margin-left: 4px; }
  .board-bar .icon-btn { width: 34px; height: 34px; }
  .sb-team { height: 32px; padding: 0 8px; font-size: 15px; max-width: 16vw; }
  .sb-score { height: 32px; padding: 0 10px; font-size: 20px; }
  .sb-goal { width: 26px; height: 26px; }

  .board-body { flex-direction: row; padding-left: env(safe-area-inset-left); }
  .stage-hint { display: none; }

  .tool-rail {
    flex-direction: column;
    align-items: center;
    width: auto;
    gap: 6px;
    padding: 6px;
    padding-right: max(6px, env(safe-area-inset-right));
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    overflow-x: hidden;
    overflow-y: auto;
    border-top: 0;
    border-left: 1px solid var(--line);
  }
  .rail-group { display: grid; grid-template-columns: repeat(2, 40px); gap: 4px; }
  .rail-colors { grid-template-columns: repeat(3, 24px); gap: 5px; justify-content: center; }
  .rail-widths { grid-template-columns: repeat(3, 26px); gap: 4px; justify-content: center; }
  .rail-sep { width: 100%; height: 1px; margin: 1px 0; }
  .tool-btn { width: 40px; height: 34px; border-radius: 9px; }
  .tool-btn span { display: none; }
  .tool-btn svg { width: 18px; height: 18px; }
  .swatch { width: 22px; height: 22px; }
  .width-btn { width: 26px; height: 22px; padding: 0 4px; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 200;
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow);
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 760px) { .toast { bottom: 28px; } }

/* ---------- Dialog content ---------- */
.modal-inner { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; margin: 0; }

.team-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.team-pill::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--team); }

.field-label { margin: 4px 0 6px; }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-row .check { flex: 1; }
.input-minute { width: 84px; flex: none; min-height: 38px; }
.input:disabled { opacity: 0.4; }

.sub-box {
  margin-top: 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-2);
}
.sub-box > .check svg { color: var(--accent); }
.sub-fields { margin-top: 8px; }
.sub-fields[hidden] { display: none; }
@media (max-width: 480px) { .row-3 { grid-template-columns: 1fr 1fr; } .row-3 > :first-child { grid-column: 1 / -1; } }

.team-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.team-switch button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--bg);
  color: var(--muted);
  font-weight: 700;
}
.team-switch button i { width: 10px; height: 10px; border-radius: 50%; background: var(--team); }
.team-switch button[aria-selected="true"] { color: var(--text); border-color: var(--team); box-shadow: inset 0 0 0 1px var(--team); }

.tabs { display: flex; gap: 4px; margin: 16px 0; border-bottom: 1px solid var(--line); }
.tabs button {
  padding: 10px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  color: var(--muted);
  font-weight: 600;
}
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }

.team-general { display: grid; gap: 20px; }
@media (min-width: 720px) { .team-general { grid-template-columns: 1fr 220px; gap: 28px; } }
.formation-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.formation-btn {
  min-height: 44px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--bg);
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 700;
}
.formation-btn:hover { border-color: #3b4c72; }
.formation-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.muted-note { color: var(--muted); font-size: 13px; margin-top: 8px; }
.jersey-card {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: radial-gradient(circle at 50% 30%, rgba(22, 163, 74, 0.25), var(--bg-2) 70%);
  text-align: center;
}
.jersey-preview { width: 120px; height: 120px; filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.45)); }
.jersey-card strong { font-family: var(--font-head); font-size: 22px; text-transform: uppercase; }
.jersey-card span { color: var(--muted); font-size: 14px; }

.squad-count { margin-bottom: 10px; color: var(--muted); font-size: 14px; }
.squad-count b { color: var(--accent); }
.squad-count.is-warn b { color: var(--warning); }
.squad-list { display: grid; gap: 6px; }
.squad-row { display: grid; grid-template-columns: 64px 1fr 112px; gap: 8px; align-items: center; }
.squad-row .input, .squad-row .select { min-height: 40px; padding: 8px 10px; }
.squad-headings { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.squad-coach { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.coach-label { display: grid; place-items: center; color: var(--accent); }
.squad-coach .muted-note { margin: 0; }

.style-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.style-btn {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--bg);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.style-btn i { display: block; height: 44px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.2); }
.style-grass i { background: #16a34a repeating-linear-gradient(90deg, #1bb053 0 12%, #16a34a 12% 24%); }
.style-plain i { background: #15803d; }
.style-night i { background: #0f172a repeating-linear-gradient(90deg, #131d33 0 12%, #0f172a 12% 24%); }
.style-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--text); }

.slot-list { display: grid; gap: 10px; }
.slot { padding: 14px; border: 1px dashed var(--line-2); border-radius: var(--radius); background: var(--bg-2); }
.slot.is-full { border-style: solid; }
.slot-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.slot-num { font-family: var(--font-head); font-size: 18px; font-weight: 700; text-transform: uppercase; }
.slot-time { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; }
.slot-label { margin: 4px 0 0; font-weight: 600; }
.slot-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.slot-actions .input { flex: 1 1 160px; min-height: 38px; padding: 8px 10px; }

.export-options { display: grid; gap: 10px; }
.export-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--bg-2);
  text-align: left;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.export-option:hover { border-color: var(--accent); background: var(--surface-2); }
.export-option svg { color: var(--accent); flex: none; }
.export-option strong { display: block; font-size: 16px; }
.export-option small { color: var(--muted); font-size: 13px; }

/* ---------- Match report (paper style) ---------- */
.report-sheet {
  padding: 24px;
  border-radius: var(--radius);
  background: #ffffff;
  color: #0f172a;
  font-size: 14px;
  line-height: 1.5;
}
@media (max-width: 560px) { .report-sheet { padding: 16px; } }
.report-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.report-brand { font-family: var(--font-head); font-size: 20px; font-weight: 800; letter-spacing: 0.04em; }
.report-brand b { color: #16a34a; }
.report-date { color: #64748b; font-size: 13px; }

.report-score {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin: 14px 0 20px;
  padding: 16px 0;
  border-top: 2px solid #e2e8f0;
  border-bottom: 2px solid #e2e8f0;
}
.rs-team {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-family: var(--font-head);
  font-size: clamp(18px, 3vw, 28px);
  font-weight: 700;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.rs-away { justify-content: flex-end; text-align: right; }
.rs-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; }
.rs-result { font-family: var(--font-head); font-size: clamp(36px, 6vw, 52px); font-weight: 800; line-height: 1; }
.rs-result span { margin: 0 8px; color: #94a3b8; }

.report-cols { display: grid; gap: 24px; }
@media (min-width: 720px) { .report-cols { grid-template-columns: 1fr 1fr; } }
.report-team h4 { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 20px; text-transform: uppercase; }
.report-team h4 small { color: #64748b; font-size: 14px; font-family: var(--font-body); font-weight: 600; }
.report-team h5 { margin: 14px 0 4px; font-family: var(--font-body); font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: #64748b; }
.lineup { display: grid; }
.lineup li {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid #f1f5f9;
}
.lu-num { font-weight: 700; color: #64748b; font-variant-numeric: tabular-nums; }
.lu-name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.lu-subbed { padding-left: 14px !important; background: #f8fafc; font-size: 13px; }
.lu-marks { display: inline-flex; align-items: center; gap: 5px; }
.lu-goal { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 700; }
.lu-off, .lu-on { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 700; }
.lu-off { color: #dc2626; }
.lu-on { color: #16a34a; }
.lu-bench { color: #334155; }

.report-section { margin-top: 22px; }
.report-section h4 { margin-bottom: 8px; font-size: 20px; text-transform: uppercase; }
.timeline { display: grid; }
.ev {
  display: grid;
  grid-template-columns: 52px 22px 4px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
}
.ev-min { font-weight: 700; font-variant-numeric: tabular-nums; }
.ev-icon { display: grid; place-items: center; }
.ev-goal .ev-icon { color: #16a34a; }
.ev-sub .ev-icon { color: #2563eb; }
.ev-team { width: 4px; height: 20px; border-radius: 2px; }
.ev-text { min-width: 0; overflow-wrap: anywhere; }
.ev-text .ev-sub { color: #64748b; font-size: 13px; }
.ev-in { display: inline-flex; align-items: center; gap: 3px; color: #16a34a; font-weight: 700; }
.ev-out { color: #64748b; }
.ev-remove {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: #94a3b8;
}
.ev-remove:hover { background: #fee2e2; color: #dc2626; }
.report-empty { color: #64748b; }

.report-notes {
  width: 100%;
  min-height: 120px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #0f172a;
  resize: vertical;
  line-height: 1.5;
}
.report-notes:focus { outline: none; border-color: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15); }
.report-notes-print { display: none; white-space: pre-wrap; color: #334155; }
.report-sheet.is-exporting .no-print { display: none; }
.report-sheet.is-exporting .report-notes-print { display: block; }

/* ---------- Print (match report only) ---------- */
@media print {
  @page { margin: 12mm; }
  body.printing-report { display: block; height: auto; overflow: visible; background: #fff; }
  body.printing-report > *:not(#report-dialog) { display: none !important; }
  body.printing-report #report-dialog {
    position: static;
    display: block;
    width: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    border: 0;
    box-shadow: none;
    background: #fff;
    overflow: visible;
    animation: none;
  }
  body.printing-report #report-dialog::backdrop { display: none; }
  body.printing-report #report-dialog .modal-head,
  body.printing-report #report-dialog .modal-foot,
  body.printing-report .no-print { display: none !important; }
  body.printing-report #report-dialog .modal-body { padding: 0; overflow: visible; }
  body.printing-report .report-notes-print { display: block; }
  body.printing-report .report-sheet { padding: 0; border-radius: 0; }
  body.printing-report .report-cols { grid-template-columns: 1fr 1fr; }
  .lineup li, .ev { break-inside: avoid; }
}
