:root {
    --bg: #071018;
    --bg-2: #0d1824;
    --card: #12202d;
    --card-2: #173044;
    --line: rgba(255, 255, 255, 0.08);
    --text: #f4f7f5;
    --muted: #93a3ad;
    /* Sport accents: Football green · Cricket orange */
    --sport-football: #2bd576;
    --sport-football-dim: #1b8a4d;
    --sport-football-ink: #062013;
    --sport-football-focus: #7ee0a8;
    --sport-cricket: #f97316;
    --sport-cricket-dim: #c2410c;
    --sport-cricket-ink: #1a0c04;
    --sport-cricket-focus: #fdba74;
    --pitch: var(--sport-football);
    --pitch-dim: var(--sport-football-dim);
    --pitch-ink: var(--sport-football-ink);
    --gold: #e7c15a;
    --danger: #ff6b6b;
    --warn: #f0b429;
    --focus: var(--sport-football-focus);
    --match-tile-min-width: 108px;
    --match-tile-min-height: 84px;
    --match-tile-gap: 8px;
    --match-tile-padding: 8px;
    --act-goal: var(--sport-football);
    --act-goal-ink: var(--sport-football-ink);
    --act-shot: #0f766e;
    --act-shot-ink: #e6fffa;
    --act-save: #e7c15a;
    --act-save-ink: #1a1404;
    --act-pass: #1d4ed8;
    --act-pass-ink: #f8fbff;
    --act-tackle: #d97706;
    --act-tackle-ink: #1c1002;
    --act-int: #6d28d9;
    --act-int-ink: #f5f0ff;
    --act-assist: #38bdf8;
    --act-assist-ink: #042433;
    --act-foul: #be185d;
    --act-foul-ink: #fff0f6;
    --act-kpass: #0e7490;
    --act-kpass-ink: #ecfeff;
    --act-duel: #c2410c;
    --act-duel-ink: #fff7ed;
    --act-cwon: #047857;
    --act-cwon-ink: #ecfdf5;
    --act-cconc: #9a3412;
    --act-cconc-ink: #fff7ed;
    --act-off: #9a3412;
    --act-off-ink: #ffedd5;
    --act-on: #1d4ed8;
    --act-on-ink: #f8fbff;
    --act-own: #c2410c;
    --act-own-ink: #fff7ed;
    --act-card: #e7c15a;
    --act-card-ink: #1a1404;
    --act-more: #334155;
    --act-more-ink: #f8fafc;
    --act-undo: #b91c1c;
    --act-undo-ink: #fee2e2;
    --act-pause: #e7c15a;
    --act-pause-ink: #1a1404;
    --act-period: #334155;
    --act-period-ink: #f8fafc;
    --radius: 16px;
    --nav: 64px;
    --app: 100%;
    --pad: 16px;
}

/* Active team sport — accents follow current_team_sport_code() body class */
body.sport-football {
    --pitch: var(--sport-football);
    --pitch-dim: var(--sport-football-dim);
    --pitch-ink: var(--sport-football-ink);
    --focus: var(--sport-football-focus);
    --act-goal: var(--sport-football);
    --act-goal-ink: var(--sport-football-ink);
}
body.sport-cricket {
    --pitch: var(--sport-cricket);
    --pitch-dim: var(--sport-cricket-dim);
    --pitch-ink: var(--sport-cricket-ink);
    --focus: var(--sport-cricket-focus);
    --act-goal: var(--sport-cricket);
    --act-goal-ink: var(--sport-cricket-ink);
}

* { box-sizing: border-box; }
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
html, body { margin: 0; min-height: 100%; }
html body {
    background: var(--bg);
    background-color: var(--bg);
    color: var(--text);
    font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", Outfit, system-ui, sans-serif;
    padding-bottom: calc(var(--nav) + env(safe-area-inset-bottom, 0px) + 12px);
    line-height: 1.4;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}
html body a { color: var(--pitch); text-decoration: none; }
button, a, input, select, textarea { touch-action: manipulation; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}
.muted { color: var(--muted); }
.lede { color: var(--muted); margin: 0 0 1rem; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.7rem; color: var(--pitch); margin: 0 0 0.25rem; }
.section-title { margin: 1.25rem 0 0.75rem; font-size: 1rem; }

.app-shell {
    width: 100%;
    max-width: 430px;
    margin: 0 auto;
    padding: calc(12px + env(safe-area-inset-top, 0px)) var(--pad) 20px;
}
.app-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
    position: sticky;
    top: 0;
    z-index: 5;
    background: linear-gradient(var(--bg) 70%, transparent);
    padding-bottom: 8px;
}
.app-top h1 { margin: 0; font-size: 1.55rem; letter-spacing: -0.03em; line-height: 1.15; }
.team-chip {
    background: var(--card);
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 0.8rem;
    white-space: nowrap;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
}
.sport-switch {
    margin: 0 0 12px;
    gap: 8px;
}
.sport-switch .btn-ghost {
    width: auto;
    min-width: 0;
    text-decoration: none;
}
.sport-switch .btn-ghost.is-on {
    background: var(--pitch);
    color: var(--pitch-ink);
    border-color: var(--pitch);
}
/* Sport tabs keep their own colour even if current team is the other sport */
.sport-switch .btn-ghost.is-on[data-sport="FOOTBALL"] {
    background: var(--sport-football);
    color: var(--sport-football-ink);
    border-color: var(--sport-football);
}
.sport-switch .btn-ghost.is-on[data-sport="CRICKET"] {
    background: var(--sport-cricket);
    color: var(--sport-cricket-ink);
    border-color: var(--sport-cricket);
}

.stack { display: grid; gap: 12px; }
.page-actions, .btn-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
}
.btn-row.wrap { flex-direction: column; }
.wrap { flex-wrap: wrap; }

[hidden] { display: none !important; }
label { display: grid; gap: 6px; font-size: 0.9rem; color: var(--muted); }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--bg-2);
    color: var(--text);
    border-radius: 12px;
    padding: 12px;
    min-height: 48px;
    font: inherit;
    font-size: 16px;
}
input::placeholder,
textarea::placeholder {
    color: var(--muted);
    opacity: 0.55;
}
.club-suggest {
    list-style: none;
    margin: -4px 0 0;
    padding: 6px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    max-height: 220px;
    overflow: auto;
}
.club-suggest [role="option"] {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text);
}
.club-suggest [role="option"].is-active,
.club-suggest [role="option"]:hover {
    background: var(--card-2);
}
input[type="date"],
input[type="time"] {
    color-scheme: dark;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.9;
    filter: invert(1);
    width: 1.15rem;
    height: 1.15rem;
}
.check { display: flex; align-items: center; gap: 10px; }
.check input { width: auto; min-height: 0; }
textarea.note-input { min-height: 120px; resize: vertical; }
.note-body { white-space: pre-wrap; margin: 8px 0 0; }
a.resource-card {
    display: block;
    color: inherit;
    text-decoration: none;
}
a.resource-card h3 { margin: 0 0 6px; }

.date-picker-field { display: grid; gap: 6px; }
.date-picker { position: relative; }
.date-picker-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    border: 0 !important;
    white-space: nowrap !important;
    min-height: 0 !important;
    pointer-events: none !important;
}
.date-picker-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    padding: 12px;
    border: 1px solid var(--line);
    background: var(--bg-2);
    color: var(--text);
    border-radius: 12px;
    font: inherit;
    font-size: 16px;
    text-align: left;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}
.date-picker-display.is-empty { color: var(--muted); }
.date-picker-display.is-invalid { border-color: var(--danger); }
.date-picker-display svg {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    stroke: var(--pitch);
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.date-picker-value { min-width: 0; }
.date-picker-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 48;
}
.date-picker-pop {
    position: fixed;
    z-index: 50;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    color: var(--text);
    max-width: calc(100vw - 24px);
}
.date-picker-pop.is-sheet {
    left: 50%;
    right: auto;
    bottom: calc(var(--nav) + env(safe-area-inset-bottom, 0px) + 16px);
    width: min(430px, calc(100vw - 24px));
    transform: translateX(-50%);
    padding: 14px 14px calc(14px + env(safe-area-inset-bottom, 0px));
}
.date-picker-toolbar {
    display: grid;
    grid-template-columns: 44px minmax(0, 1.15fr) 5.6rem 44px;
    gap: 6px;
    align-items: center;
    margin-bottom: 10px;
}
.date-picker-nav {
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg-2);
    color: var(--text);
    font: inherit;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
}
.date-picker-toolbar select {
    min-height: 44px;
    min-width: 0;
    padding: 8px 8px;
    font-size: 0.95rem;
}
.date-picker-week,
.date-picker-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}
.date-picker-week span {
    display: grid;
    place-items: center;
    min-height: 28px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.date-picker-day {
    min-height: 44px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
}
.date-picker-day:hover,
.date-picker-day:focus-visible { background: var(--card-2); }
.date-picker-day.is-muted { color: var(--muted); }
.date-picker-day.is-today { box-shadow: inset 0 0 0 1.5px var(--pitch); }
.date-picker-day.is-selected {
    background: var(--pitch);
    color: #062013;
    font-weight: 700;
}
.date-picker-day:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.date-picker-foot {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
}
.date-picker-foot button {
    flex: 1;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg-2);
    color: var(--text);
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}
.date-picker-foot .date-picker-today {
    background: var(--pitch);
    color: #062013;
    border-color: transparent;
}
html.date-picker-open { overflow: hidden; }

.btn-primary, .btn-ghost, .btn-danger, button.btn-primary, button.btn-ghost, button.btn-danger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    padding: 0 16px;
    border-radius: 14px;
    border: 0;
    font: inherit;
    font-weight: 700;
    font-size: 1rem;
}
.btn-primary { background: var(--pitch); color: var(--pitch-ink); }
.btn-ghost { background: var(--card); color: var(--text); border: 1px solid var(--line); }
.btn-danger { background: #3a1518; color: #ffd5d5; border: 1px solid rgba(255, 107, 107, 0.35); }
.text-danger { color: var(--danger); background: none; border: 0; width: auto; min-height: 44px; }
.panel.danger { border-color: var(--danger); }

.amendment-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.amendment-list p { margin: 0 0 4px; }
.report-amendments { margin-top: 20px; }

.flash { border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; }
.flash-success { background: rgba(43, 213, 118, 0.15); }
.flash-error { background: rgba(255, 107, 107, 0.15); }

.hero-card, .panel, .fixture-card, .stat-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
}
.hero-card h2, .panel h3, .fixture-card h3 { margin: 0 0 6px; font-size: 1.25rem; font-weight: 700; line-height: 1.2; }
.scoreline { font-size: 2rem; font-weight: 800; letter-spacing: -0.04em; margin: 8px 0; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.usage-table-wrap { overflow-x: auto; }
.usage-table { width: 100%; border-collapse: collapse; }
.usage-table th, .usage-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.usage-table thead th { color: var(--muted); font-size: 0.75rem; font-weight: 650; }
.usage-table tbody th { font-weight: 650; }
.usage-table td { font-variant-numeric: tabular-nums; }
.platform-filters { display: grid; gap: 10px; }
@media (min-width: 640px) {
    .platform-filters { grid-template-columns: 1fr 180px auto; align-items: end; }
}
.stat-card span { color: var(--muted); font-size: 0.75rem; }
.app-top-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.admin-chip { border-color: rgba(43, 213, 118, 0.45); color: var(--pitch); }
body.admin-body { padding-bottom: 24px; }
.admin-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.admin-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--text);
    font-weight: 650;
    font-size: 0.9rem;
}
.admin-nav a.active { background: var(--pitch); color: var(--pitch-ink); border-color: var(--pitch); }
.admin-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.admin-kpi strong { display: block; font-size: 1.75rem; font-weight: 800; letter-spacing: -0.03em; margin: 4px 0; }
@media (min-width: 720px) {
    .admin-kpis { grid-template-columns: repeat(3, 1fr); }
}
.stat-card strong { display: block; font-size: 1.45rem; letter-spacing: -0.04em; }
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick-actions a {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px 12px;
    min-height: 56px;
    color: var(--text);
    font-weight: 650;
    display: flex;
    align-items: center;
}
.empty { padding: 28px 12px; text-align: center; color: var(--muted); }
.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.activity-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.activity-item {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
}
.activity-item p { margin: 0; }
.activity-what { font-weight: 700; }
.activity-who { margin-top: 4px; }
.activity-email { font-size: 0.85rem; }
.invite-link-box {
    display: grid;
    gap: 8px;
    margin: 8px 0 12px;
}
.invite-link-box code {
    display: block;
    word-break: break-all;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    font-size: 0.8rem;
    color: var(--text);
}
.invite-name-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.team-checks {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
    display: grid;
    gap: 8px;
    margin: 0;
}
.team-checks legend {
    padding: 0 4px;
    color: var(--muted);
    font-size: 0.9rem;
}
.split { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.soft { border-color: var(--line); }

.player-list { display: grid; gap: 8px; }
.player-row {
    display: grid;
    grid-template-columns: 48px 1fr auto;
    gap: 12px;
    align-items: center;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 10px;
    color: inherit;
    min-height: 64px;
}
.player-row small { display: block; color: var(--muted); }
.shirt { font-style: normal; color: var(--gold); font-weight: 700; }
.avatar, .player-row img, .profile-head img, .squad-card img {
    width: 48px; height: 48px; border-radius: 50%; object-fit: cover; display: grid; place-items: center;
    background: hsl(var(--hue, 150) 40% 28%); font-weight: 700;
}
.avatar.lg, .profile-head img { width: 88px; height: 88px; font-size: 1.6rem; }
.profile-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.player-match-picker { margin-bottom: 14px; display: grid; gap: 8px; }
.player-match-picker label { display: grid; gap: 6px; margin: 0; font-weight: 600; }
.player-match-picker select { width: 100%; }
.player-match-picker .muted { margin: 0; font-size: 0.85rem; font-weight: 400; }
.player-match-selected { outline: 2px solid var(--pitch); }

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
    padding: 10px 14px;
    border-radius: 999px;
    color: var(--muted);
    background: var(--card);
    white-space: nowrap;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
}
.tabs a.active { background: var(--pitch); color: var(--pitch-ink); font-weight: 700; }

.squad-grid { display: grid; gap: 8px; }
.squad-grid:empty { display: none; }
.squad-group h2 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin: 16px 0 8px;
}
.squad-list { display: grid; gap: 8px; }
.match-grid { display: flex; flex-direction: column; gap: 8px; }
.squad-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 10px;
    display: grid;
    grid-template-columns: 48px 1fr;
    column-gap: 10px;
    row-gap: 4px;
    align-items: center;
}
.squad-card strong { display: block; }
.squad-card small { display: block; color: var(--muted); }
.squad-card img, .squad-card .avatar { grid-row: span 2; }
.squad-card.status-STARTING, .match-card.on { border-color: var(--pitch); }
.squad-card.status-SUBSTITUTE { border-color: #4ea1ff; }
.squad-card.status-UNAVAILABLE, .squad-card.status-INJURED { border-color: #6b7787; }
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; grid-column: 1 / -1; }
.pill-row button {
    flex: 1 1 0;
    min-width: 0;
    min-height: 44px;
    border: 0;
    border-radius: 10px;
    background: var(--bg-2);
    color: var(--text);
    font-weight: 800;
    font-size: 0.92rem;
}
.pill-row [data-captain] { flex: 0 0 44px; }
.squad-card.is-captain [data-captain] {
    background: var(--gold);
    color: #1a1404;
}
.squad-card.status-STARTING [data-set="STARTING"] {
    background: var(--pitch);
    color: #062013;
}
.squad-card.status-SUBSTITUTE [data-set="SUBSTITUTE"] {
    background: #1d4ed8;
    color: #f8fbff;
}
.squad-card.status-UNAVAILABLE [data-set="UNAVAILABLE"],
.squad-card.status-INJURED [data-set="UNAVAILABLE"] {
    background: #334155;
    color: #f8fafc;
}
.cap-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.05rem;
    height: 1.05rem;
    margin-left: 4px;
    border-radius: 999px;
    background: var(--gold);
    color: #1a1404;
    font-size: 0.62rem;
    font-weight: 800;
    line-height: 1;
    vertical-align: 0.12em;
}
.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: flex; align-items: center; gap: 6px; background: var(--card); padding: 8px 10px; border-radius: 999px; color: var(--text); }
.chip input { width: auto; min-height: 0; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 calc(var(--pad) * -1); padding: 0 var(--pad); }
table.data { width: 100%; min-width: 480px; border-collapse: collapse; font-size: 0.9rem; }
table.data th, table.data td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.data tfoot .stats-totals-row th,
table.data tfoot .stats-totals-row td {
    border-top: 2px solid var(--line);
    border-bottom: none;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.03);
}
table.data tfoot .stats-totals-row th[scope="row"] {
    font-weight: 800;
    letter-spacing: 0.02em;
}

/* Sticky header, totals footer, and name column for match review / report player stats */
.table-wrap--sticky {
    --sticky-table-bg: var(--bg);
    --sticky-table-totals-bg: var(--bg-2);
    overflow: auto;
    max-height: min(70vh, 560px);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.table-wrap--sticky > table {
    border-collapse: separate;
    border-spacing: 0;
}
.table-wrap--sticky > table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--sticky-table-bg);
    box-shadow: inset 0 -1px 0 var(--line);
}
.table-wrap--sticky > table tbody td:first-child,
.table-wrap--sticky > table thead th:first-child,
.table-wrap--sticky > table tfoot th:first-child,
.table-wrap--sticky > table tfoot td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--sticky-table-bg);
    box-shadow: 1px 0 0 var(--line);
}
.table-wrap--sticky > table thead th:first-child {
    z-index: 3;
}
/* Pin Totals to the bottom of the scrollport so it stays visible with many players. */
.table-wrap--sticky > table tfoot .stats-totals-row th,
.table-wrap--sticky > table tfoot .stats-totals-row td {
    position: sticky;
    bottom: 0;
    z-index: 2;
    background: var(--sticky-table-totals-bg);
    box-shadow: inset 0 1px 0 var(--line);
}
.table-wrap--sticky > table tfoot .stats-totals-row th:first-child,
.table-wrap--sticky > table tfoot .stats-totals-row td:first-child {
    z-index: 3;
    background: var(--sticky-table-totals-bg);
}
@media print {
    .table-wrap--sticky {
        overflow: visible;
        max-height: none;
    }
    .table-wrap--sticky > table thead th,
    .table-wrap--sticky > table tbody td:first-child,
    .table-wrap--sticky > table thead th:first-child,
    .table-wrap--sticky > table tfoot th:first-child,
    .table-wrap--sticky > table tfoot td:first-child,
    .table-wrap--sticky > table tfoot .stats-totals-row th,
    .table-wrap--sticky > table tfoot .stats-totals-row td {
        position: static;
        z-index: auto;
        box-shadow: none;
    }
}
.bar { height: 8px; background: #1b2a33; border-radius: 99px; overflow: hidden; margin: 8px 0; }
.bar span { display: block; height: 100%; background: var(--pitch); }
.panel.warn { border-color: var(--warn); }
.panel.warn-soft { border-color: rgba(240, 180, 41, 0.45); }

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(7, 16, 24, 0.96);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    z-index: 12;
}
.bottom-nav-inner {
    max-width: 430px;
    margin: 0 auto;
    height: var(--nav);
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    padding: 4px 2px 0;
}
.bottom-nav a {
    color: var(--muted);
    display: grid;
    place-items: center;
    align-content: center;
    font-size: 0.65rem;
    gap: 2px;
    min-height: 52px;
    flex: 1 1 0;
    min-width: 0;
    padding: 0 2px;
    text-align: center;
    line-height: 1.1;
}
.bottom-nav-inner:has(> a:nth-child(6)) a {
    font-size: 0.58rem;
}
.bottom-nav a.active { color: var(--pitch); }
.bottom-nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.bottom-nav-inner:has(> a:nth-child(6)) svg {
    width: 20px;
    height: 20px;
}

.auth-body { padding: calc(28px + env(safe-area-inset-top, 0px)) 18px 24px; }
.auth-wrap { max-width: 430px; margin: 0 auto; }
.auth-legal { margin-top: 28px; text-align: center; line-height: 1.75; }
.auth-legal a,
.app-foot a {
    display: inline-block;
    white-space: nowrap;
}
.app-foot {
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    text-align: center;
    font-size: 0.85rem;
    line-height: 1.75;
}
.auth-legal a:not(:last-of-type)::after,
.app-foot a:not(:last-of-type)::after {
    content: "·";
    margin: 0 0.65em;
    color: var(--muted);
    font-weight: 400;
}
.auth-wrap .btn-primary { width: 100%; }
.brand-mark { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; font-size: 1.2rem; }
.brand-mark .ball { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #fff, var(--pitch)); }
.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-decoration: none;
    line-height: 1;
}
.brand-lockup .brand-mark-img {
    display: block;
    border-radius: 10px;
    box-shadow: 0 0 0 1px rgba(43, 213, 118, 0.18);
}
a.brand-lockup:hover { color: var(--text); }
.brand-lockup.is-on-light { color: #071018; }
.brand-lockup.is-on-light:hover { color: #071018; }
.brand-word {
    font-weight: 700;
    letter-spacing: -0.04em;
    font-size: 1.22em;
}
.brand-word span { color: var(--pitch); }
.auth-wrap .brand-lockup { margin-bottom: 18px; font-size: 1.15rem; }
.app-top-brand { margin-bottom: 4px; font-size: 0.92rem; }
.auth-wrap h1 { font-size: 1.7rem; margin: 0 0 16px; }

html.match-html {
    --match-sticky-h: 148px;
}
html.match-html,
html.match-html body.match-body {
    height: 100%;
    max-width: 100%;
    overflow: hidden;
    overscroll-behavior: none;
}
.match-body { padding: 0; background: #06110c; }
.match-app {
    --match-sticky-h: 148px;
    --match-bar-h: calc(64px + env(safe-area-inset-bottom, 0px));
    width: 100%;
    max-width: 1100px;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: var(--match-bar-h);
    scroll-padding-bottom: var(--match-bar-h);
    box-sizing: border-box;
}
.match-app.has-dock { padding-bottom: calc(220px + env(safe-area-inset-bottom, 0px)); }
.match-app.has-assist { padding-bottom: calc(380px + env(safe-area-inset-bottom, 0px)); }
.match-hint {
    flex: 0 0 auto;
    margin: 0 12px 2px;
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.25;
}
@media (max-height: 760px) {
    .match-hint { display: none; }
}
.pitch-board {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 3.6;
    max-height: min(48dvh, 460px);
    background:
        radial-gradient(circle at 50% 50%, rgba(255,255,255,0.08) 0 18px, transparent 19px),
        linear-gradient(#168a42, #0d5c2c);
    border: 2px solid rgba(255,255,255,0.28);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: inset 0 0 0 10px rgba(255,255,255,0.06);
}
.pitch-board::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 72px;
    height: 72px;
    border: 2px solid rgba(255,255,255,0.22);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}
.pitch-slot {
    position: absolute;
    transform: translate(-50%, -50%);
    width: clamp(52px, 17vw, 72px);
    z-index: 1;
}
.pitch-slot.empty {
    width: 44px;
    height: 44px;
    border: 1px dashed rgba(255,255,255,0.35);
    border-radius: 50%;
    color: rgba(255,255,255,0.7);
    font-size: 0.62rem;
    font-weight: 800;
    display: grid;
    place-items: center;
}
.pitch-chip {
    width: clamp(52px, 17vw, 72px);
    background: #0d1b14;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 4px 4px 5px;
    text-align: center;
    color: var(--text);
}
.pitch-chip.gk { border-color: var(--gold); background: #1c2410; }
.pitch-chip.pick-off { box-shadow: inset 0 0 0 2px #ff6b6b; }
.pitch-chip.pickable { box-shadow: inset 0 0 0 2px var(--pitch); }
.pitch-chip.pick-assist-target { box-shadow: inset 0 0 0 2px #4ea1ff; }
.pitch-chip.is-scorer { box-shadow: inset 0 0 0 2px var(--gold); }
.pitch-chip .shirt { display: block; font-size: 0.62rem; color: var(--muted); font-weight: 700; }
.pitch-chip .pname {
    display: block;
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pitch-chip small { display: block; color: var(--muted); font-size: 0.58rem; }
.pitch-chip .slot-code { color: var(--gold); font-weight: 800; }
.pitch-acts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
    gap: 5px;
    margin-top: 4px;
    min-width: 0;
    width: 100%;
}
.pitch-acts button {
    min-height: 40px;
    min-width: 0;
    border: 1px solid rgba(0, 0, 0, 0.28);
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 800;
    background: var(--act-goal);
    color: var(--act-goal-ink);
    padding: 0 4px;
    line-height: 1.1;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.pitch-acts button.off { background: var(--act-off); color: var(--act-off-ink); }
.pitch-acts button.save { background: var(--act-save); color: var(--act-save-ink); }
.pitch-acts button.shot { background: var(--act-shot); color: var(--act-shot-ink); }
.pitch-acts button.goal { background: var(--act-goal); color: var(--act-goal-ink); }
.pitch-acts button.assist { background: var(--act-assist); color: var(--act-assist-ink); }
.pitch-acts button.pass { background: var(--act-pass); color: var(--act-pass-ink); }
.pitch-acts button.tackle { background: var(--act-tackle); color: var(--act-tackle-ink); }
.pitch-acts button.int { background: var(--act-int); color: var(--act-int-ink); }
.pitch-acts button.foul { background: var(--act-foul); color: var(--act-foul-ink); }
.pitch-acts button.kpass { background: var(--act-kpass); color: var(--act-kpass-ink); }
.pitch-acts button.duel { background: var(--act-duel); color: var(--act-duel-ink); }
.bench-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.match-card.bench { align-items: center; padding: 6px 8px; border-radius: 12px; gap: 8px; }
.match-card.bench .who { flex: 1; max-width: none; min-width: 0; }
.match-card.bench .pname { font-size: 0.9rem; }
.match-card.bench .card-actions button { min-height: 40px; min-width: 52px; flex: 0 0 56px; }
.formation-count-row {
    display: grid;
    gap: 6px;
    margin-bottom: 10px;
}
.formation-count-label { margin: 0; font-size: 0.82rem; font-weight: 700; }
.formation-counts { display: flex; flex-wrap: wrap; gap: 8px; }
.formation-count {
    min-height: 40px;
    min-width: 48px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--text);
    border-radius: 12px;
    padding: 0 12px;
    font-weight: 800;
}
/* Squad setup uses "N-a-side" labels; keep them readable on narrow phones. */
#squad-aside-counts .formation-count {
    min-width: 0;
    flex: 1 1 calc(50% - 8px);
    font-size: 0.85rem;
}
.formation-count.is-on { background: var(--pitch); color: var(--pitch-ink); border-color: var(--pitch); }
.extra-player-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(16, 32, 24, 0.55);
}
.extra-player-bar[hidden] { display: none !important; }
.extra-player-bar p {
    margin: 0;
    flex: 1 1 160px;
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.35;
}
.extra-player-bar .btn-primary,
.extra-player-bar .btn-ghost {
    width: auto;
    min-height: 36px;
    min-width: 0;
    padding: 0 12px;
    font-size: 0.78rem;
}
.formation-extra-bar {
    margin: 0 0 10px;
}
.formation-picks { display: flex; flex-wrap: wrap; gap: 8px; }
.formation-pick {
    min-height: 40px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--text);
    border-radius: 12px;
    padding: 0 12px;
    font-weight: 800;
}
.formation-pick.is-on { background: var(--pitch); color: var(--pitch-ink); border-color: var(--pitch); }
.custom-lines {
    display: grid;
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #0d1b14;
}
.custom-lines[hidden] { display: none !important; }
.custom-lines p { margin: 0; }
.custom-code-field {
    display: grid;
    gap: 4px;
}
.custom-code-field span {
    font-size: 0.78rem;
    font-weight: 800;
}
.custom-code {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card);
    color: var(--text);
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-align: center;
    padding: 0 12px;
}
.custom-code:focus {
    outline: 2px solid var(--pitch);
    border-color: var(--pitch);
}
.custom-code.is-invalid {
    border-color: var(--gold);
}
.custom-total { font-weight: 700; }
.custom-total.is-ok { color: #9dffc2; }
.custom-total.is-bad { color: var(--gold); }
.line-editors { display: grid; gap: 6px; }
.line-editor {
    display: grid;
    grid-template-columns: 1fr 44px 36px 44px;
    align-items: center;
    gap: 6px;
}
.line-editor span { font-size: 0.85rem; font-weight: 700; }
.line-editor strong { text-align: center; font-size: 1rem; }
.line-editor button {
    min-height: 44px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--text);
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: 800;
}
.line-editor-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.line-editor-actions .btn-ghost {
    width: auto;
    min-height: 40px;
    min-width: 0;
    padding: 0 12px;
}
.setup-pitch {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 3.4;
    max-height: 420px;
    background: linear-gradient(#168a42, #0d5c2c);
    border: 2px solid rgba(255,255,255,0.28);
    border-radius: 14px;
    /* Do not clip wing slots — 11-a-side RB/RW must stay tappable on phones */
    overflow: visible;
    touch-action: manipulation;
}
.setup-slot {
    position: absolute;
    transform: translate(-50%, -50%);
    width: clamp(56px, 19vw, 80px);
    min-height: 52px;
    border: 1px dashed rgba(255,255,255,0.4);
    background: rgba(6, 20, 12, 0.45);
    color: #e8fff1;
    border-radius: 12px;
    padding: 4px;
    cursor: pointer;
    touch-action: manipulation;
}
.setup-slot.filled { border-style: solid; background: #0d1b14; }
.setup-slot.waiting { box-shadow: 0 0 0 2px var(--gold); }
.setup-code { display: block; color: var(--gold); font-size: 0.65rem; font-weight: 800; }
.setup-who { display: block; font-size: 0.68rem; font-weight: 700; line-height: 1.2; }
.setup-slot.is-picked, .pitch-slot.is-picked, .pitch-chip.is-picked { box-shadow: 0 0 0 2px var(--gold); }
.slot-picker { display: grid; gap: 8px; }
.slot-picker[hidden] { display: none !important; }
.slot-picker p { margin: 0; }
.slot-picker-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.slot-picker-grid button {
    min-height: 48px;
    border: 0;
    border-radius: 12px;
    background: #163d28;
    color: var(--text);
    font-weight: 800;
    padding: 8px;
}
.squad-card.is-target { outline: 2px solid var(--gold); outline-offset: 1px; }
.squad-card.is-target [data-set="STARTING"] {
    background: var(--pitch);
    color: #062013;
    box-shadow: 0 0 0 2px var(--gold);
}
.pill-row { position: relative; z-index: 1; }
.setup-slot.drop-target, .pitch-slot.drop-target { box-shadow: 0 0 0 2px #fff; }
.setup-slot.dragging, .pitch-chip.dragging { opacity: 0.4; }
.setup-pitch, .formation-sheet .pitch-board { touch-action: manipulation; }
.squad-card.is-picked { box-shadow: inset 0 0 0 2px var(--gold); }
.pitch-section { padding: 2px 12px 6px; }
.pitch-section h2 { margin: 4px 0 4px; }
.pitch-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 2px 0 4px;
}
.pitch-heading h2 { margin: 0; flex: 1; }
.formation-open {
    min-height: 36px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--text);
    border-radius: 10px;
    padding: 0 12px;
    font-weight: 800;
    font-size: 0.78rem;
    white-space: nowrap;
}
.formation-toolbar { margin: 0; }
/* Keep Save actions after the formation panel so they do not cover a-side /
   formation picks on short mobile viewports (sticky top overlapped the panel). */
.squad-actions {
    position: static;
    z-index: 1;
    background: transparent;
    padding: 8px 0 4px;
    margin: 0;
}
.formation-panel { display: grid; gap: 8px; }
.formation-panel[hidden] { display: none !important; }
.formation-hint { margin: 0 0 6px; font-size: 0.78rem; }
.on-list { display: flex; flex-direction: column; gap: 4px; }
.formation-overlay {
    position: fixed;
    top: var(--match-sticky-h, 148px);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    background: rgba(0, 0, 0, 0.55);
    display: grid;
    align-items: end;
    pointer-events: auto;
}
.formation-overlay[hidden] {
    display: none !important;
    pointer-events: none !important;
}
.formation-sheet {
    background: #102018;
    border-radius: 20px 20px 0 0;
    padding: 0 12px calc(16px + env(safe-area-inset-bottom, 0px));
    max-height: 100%;
    overflow: auto;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    -webkit-overflow-scrolling: touch;
}
.formation-sheet-top {
    position: sticky;
    top: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
    padding: 12px 0 10px;
    background: #102018;
    box-shadow: 0 10px 14px -12px rgba(0, 0, 0, 0.7);
}
.formation-sheet-top h2 { flex: 1; margin: 0; font-size: 1.05rem; }
.formation-sheet-top .btn-ghost,
.formation-sheet-top .btn-primary {
    width: auto;
    min-height: 44px;
    min-width: 64px;
    padding: 0 14px;
    flex: 0 0 auto;
}
.formation-sheet .pitch-board {
    max-height: min(62dvh, 560px);
    aspect-ratio: 3 / 3.8;
}
.unplaced-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.unplaced-chip {
    min-height: 36px;
    border: 1px dashed rgba(255,255,255,0.35);
    background: #0d1b14;
    color: var(--text);
    border-radius: 10px;
    padding: 0 10px;
    font-weight: 700;
    font-size: 0.78rem;
}
.unplaced-chip.is-picked { box-shadow: 0 0 0 2px var(--gold); }
.unplaced-chip.is-target { box-shadow: 0 0 0 2px var(--gold); background: #163d28; }
.drag-ghost {
    position: fixed;
    z-index: 40;
    pointer-events: none;
    transform: translate(-50%, -120%);
    background: #0d1b14;
    border: 1px solid var(--pitch);
    color: var(--text);
    border-radius: 12px;
    padding: 6px 10px;
    font-weight: 800;
    font-size: 0.78rem;
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.drag-ghost[hidden] { display: none !important; }
.pitch-slot.empty.waiting { box-shadow: 0 0 0 2px var(--gold); }
.match-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 8px 8px 8px 12px;
}
.match-card.on { border-color: var(--pitch); }
.match-card.gk { border-color: var(--gold); background: #1c2410; }
.match-card.pick-off { box-shadow: inset 0 0 0 3px #ff6b6b; }
.match-card.pick-on { box-shadow: inset 0 0 0 3px #4ea1ff; }
.match-card.pickable { box-shadow: inset 0 0 0 3px var(--pitch); cursor: pointer; }
.match-card.pick-assist-target { box-shadow: inset 0 0 0 3px #4ea1ff; }
.match-card.is-scorer { box-shadow: inset 0 0 0 3px var(--gold); }
.pick-label { margin: 10px 8px 0 0; flex: 1; color: var(--muted); font-size: 0.85rem; font-weight: 700; align-self: center; }
.match-card .who { flex: 0 0 34%; max-width: 160px; min-width: 108px; }
.match-card .who strong { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; }
.match-card .who .pname { font-weight: 800; font-size: 1.05rem; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.match-card .who small { display: block; color: var(--muted); font-size: 0.75rem; }
.gk-tag { color: var(--gold); font-size: 0.7rem; margin-left: 0; }
.card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; flex: 1; }
.card-actions button {
    flex: 1 1 calc(25% - 6px);
    min-width: 58px;
    min-height: 48px;
    border: 0;
    border-radius: 12px;
    background: var(--pitch);
    color: #062013;
    font-weight: 800;
    font-size: 0.88rem;
    cursor: pointer;
}
.card-actions button.off { background: var(--act-off); color: var(--act-off-ink); }
.card-actions button.onbtn { background: var(--act-on); color: var(--act-on-ink); }
.card-actions button.save { background: var(--act-save); color: var(--act-save-ink); }
.card-actions button.shot { background: var(--act-shot); color: var(--act-shot-ink); }
.card-actions button.goal { background: var(--act-goal); color: var(--act-goal-ink); }
.card-actions button.assist { background: var(--act-assist); color: var(--act-assist-ink); }
.card-actions button.pass { background: var(--act-pass); color: var(--act-pass-ink); }
.card-actions button.tackle { background: var(--act-tackle); color: var(--act-tackle-ink); }
.card-actions button.int { background: var(--act-int); color: var(--act-int-ink); }
.card-actions button.foul { background: var(--act-foul); color: var(--act-foul-ink); }
.card-actions button.kpass { background: var(--act-kpass); color: var(--act-kpass-ink); }
.card-actions button.duel { background: var(--act-duel); color: var(--act-duel-ink); }
.card-actions button.yel { background: var(--act-card); color: var(--act-card-ink); }
.card-actions button.red { background: var(--act-undo); color: var(--act-undo-ink); }
.card-actions button.inj { background: #173044; color: #d6ecff; }
.card-actions button.og { background: var(--act-own); color: var(--act-own-ink); }
.on-row.match-card {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: center;
    column-gap: 8px;
    row-gap: 4px;
    width: 100%;
    min-width: 0;
    padding: 5px 6px 6px 8px;
    border-radius: 10px;
}
.on-row .shirt {
    display: block;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--muted);
}
.on-row .who,
.match-card.bench .who {
    cursor: pointer;
}
.on-row .who {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 8px;
    row-gap: 0;
    min-width: 0;
    max-width: none;
    flex: none;
}
.on-row .who .pname {
    font-size: 0.88rem;
    font-weight: 800;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
}
.on-row .who small {
    display: inline;
    font-size: 0.68rem;
}
.on-row .slot-code { color: var(--gold); font-weight: 800; }
.on-row .pitch-acts,
.on-row .pick-label {
    grid-column: 1 / -1;
    margin: 0;
    min-width: 0;
}
.on-row .pick-label {
    font-size: 0.72rem;
    flex: none;
    align-self: start;
}
.match-dock {
    position: fixed;
    left: 50%;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    width: 100%;
    max-width: 1100px;
    transform: translateX(-50%);
    background: #102018;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 16px 16px 0 0;
    padding: 10px 12px 12px;
    z-index: 8;
    max-height: min(48dvh, 420px);
    overflow: auto;
    box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.35);
}
.bar-dock-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}
.bar-dock-head .dock-title { margin: 0; }
.bar-dock-close {
    flex: 0 0 40px;
    min-height: 40px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    font-size: 1.4rem;
    line-height: 1;
}
.assist-confirm-name {
    margin: 0 0 10px;
    font-size: 1.15rem;
    font-weight: 800;
}
.match-dock .action-grid { margin-top: 4px; }
.match-dock .action-grid button.them-side,
.match-dock .action-grid button[data-value="OPPOSITION"] {
    background: #4a1d24;
    color: #ffd5d5;
}
.dock-title { margin: 0 0 6px; font-weight: 800; }
.match-dock p { margin: 0 0 6px; }
.dock-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.dock-actions .btn-primary, .dock-actions .btn-ghost { min-height: 48px; flex: 1; width: auto; }
.assist-row { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0 4px; }
.assist-row .player-pick { min-width: 110px; flex: 0 0 auto; }
.assist-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.assist-grid .player-pick { min-height: 48px; }
.match-top-slot {
    display: none;
}
.match-sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 1100px;
    margin-inline: auto;
    /* Above action-screen (28), sheet (20), formation (30); below toast (40). */
    z-index: 36;
    background: #08160f;
    border-bottom: 1px solid var(--line);
}
.match-sticky-spacer { flex: 0 0 auto; min-height: 148px; }
.match-sticky .clock-actions { padding-top: 0; }
.key-actions {
    margin: 0;
    border-top: 1px solid var(--line);
    background: #0a1810;
}
.key-actions-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 4px 12px;
    list-style: none;
    cursor: pointer;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
    user-select: none;
}
.key-actions-toggle::-webkit-details-marker { display: none; }
.key-actions-chevron {
    flex: 0 0 auto;
    width: 0.55rem;
    height: 0.55rem;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(-45deg);
    transition: transform 0.15s ease;
    margin-top: -2px;
}
.key-actions[open] .key-actions-chevron {
    transform: rotate(45deg);
    margin-top: 0;
}
.key-actions-summary {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
}
.key-actions-summary.is-empty { color: var(--muted); font-weight: 600; }
.key-actions-list {
    margin: 0;
    padding: 0 10px 8px;
    list-style: none;
    max-height: min(28dvh, 220px);
    overflow: auto;
    display: grid;
    gap: 4px;
}
.key-actions-list li {
    display: grid;
    grid-template-columns: 3.4rem 1fr;
    gap: 8px;
    align-items: baseline;
    padding: 5px 8px;
    border-radius: 8px;
    background: #0d1b14;
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.78rem;
    line-height: 1.25;
}
.key-actions-time {
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    color: var(--gold);
}
.key-actions-body { min-width: 0; color: var(--text); }
.key-actions-body strong { font-weight: 800; }
.key-actions-list li.is-goal .key-actions-body strong { color: #b8f5c8; }
.key-actions-list li.is-opp .key-actions-body strong { color: #ffd5d5; }
.key-actions-list li.is-card .key-actions-body strong { color: #ffe08a; }
.key-actions-list li.is-red .key-actions-body strong { color: #ff8e8e; }
.key-actions-list li.key-actions-empty {
    display: block;
    margin: 0;
    padding: 4px 8px 2px;
    color: var(--muted);
    font-size: 0.72rem;
    background: transparent;
    border: 0;
}
.match-top {
    position: static;
    width: 100%;
    max-width: none;
    margin: 0;
    z-index: 1;
    display: grid;
    grid-template-columns: 44px 1fr auto;
    gap: 8px;
    align-items: center;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
    background: #08160f;
    border-bottom: 1px solid var(--line);
}
.icon-btn { width: 44px; height: 44px; border-radius: 12px; background: var(--card); color: var(--text); display: grid; place-items: center; font-size: 1.4rem; }
.match-meta { text-align: center; min-width: 0; }
.match-meta .opp { margin: 0; color: var(--muted); font-size: 0.8rem; }
.match-meta .score { margin: 0; font-size: 1.8rem; font-weight: 800; line-height: 1.1; }
.match-meta .period { margin: 0; color: var(--gold); font-size: 0.75rem; }
.clock-block { text-align: right; min-width: 5.5rem; }
.clock {
    margin: 0;
    font-variant-numeric: tabular-nums;
    font-size: 2.15rem;
    font-weight: 800;
    line-height: 0.95;
    color: #fff;
    letter-spacing: -0.03em;
}
.conn { margin: 0; font-size: 0.65rem; color: var(--muted); }
.conn.offline { color: var(--warn); }
.wake-toggle {
    display: block;
    width: 100%;
    margin: 4px 0 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 3px 6px;
    background: var(--card);
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}
.wake-toggle.is-on {
    border-color: var(--pitch);
    color: var(--pitch);
}
.wake-fallback {
    margin: 4px 0 0;
    max-width: 11rem;
    font-size: 0.6rem;
    line-height: 1.25;
    color: var(--muted);
}
.team-stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 12px 10px;
    background: #08160f;
}
.team-stat-row[hidden] { display: none; }
.team-stat-row button {
    flex: 1 1 140px;
    min-height: 44px;
    border: 1px solid rgba(0, 0, 0, 0.28);
    border-radius: 10px;
    font-weight: 800;
    font-size: 0.82rem;
    padding: 4px 10px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.team-stat-row button.cwon { background: var(--act-cwon); color: var(--act-cwon-ink); }
.team-stat-row button.cconc { background: var(--act-cconc); color: var(--act-cconc-ink); }
.team-stat-row button strong {
    font-size: 1.2rem;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}
.clock-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 8px;
    padding: 4px 12px 10px;
    background: #08160f;
}
.clock-actions button,
.clock-actions a.btn-primary {
    min-height: 44px;
    border: 1px solid rgba(0, 0, 0, 0.28);
    border-radius: 12px;
    padding: 0 14px;
    background: var(--card);
    color: var(--text);
    white-space: nowrap;
    font-weight: 800;
    font-size: 0.92rem;
    flex: 1 1 auto;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.clock-actions .btn-primary,
.clock-actions [data-clock="start"] {
    flex: 1 1 100%;
    width: 100%;
    min-height: 56px;
    font-size: 1.15rem;
    font-weight: 800;
    background: var(--act-goal);
    color: var(--act-goal-ink);
    border-color: transparent;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}
.clock-actions [data-clock="next-period"] {
    flex: 1 1 100%;
    width: 100%;
    min-height: 56px;
    font-size: 1.15rem;
    font-weight: 800;
    background: #4338ca;
    color: #eef2ff;
    border-color: transparent;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}
.clock-actions [data-formation-break] {
    flex: 1 1 100%;
    width: 100%;
    min-height: 48px;
    font-size: 1rem;
    font-weight: 800;
    background: var(--act-period);
    color: var(--act-period-ink);
    border-color: transparent;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
    order: -1;
}
.clock-actions [data-clock="resume"] {
    background: var(--act-goal);
    color: var(--act-goal-ink);
}
.clock-actions [data-clock="pause"] {
    background: var(--act-pause);
    color: var(--act-pause-ink);
}
.clock-actions [data-clock="end-period"] {
    background: var(--act-period);
    color: var(--act-period-ink);
}
.clock-actions [data-clock="end"] {
    background: var(--act-off);
    color: var(--act-off-ink);
}
.clock-actions .btn-ghost {
    background: var(--act-period);
    color: var(--act-period-ink);
}
.pitch-section {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 2px 12px 6px;
}
.pitch-section h2 {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin: 4px 0 4px;
}
.pitch-section .pitch-heading {
    flex: 0 0 auto;
    margin: 2px 0 4px;
}
.pitch-section #on-pitch {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.pitch-section #subs-heading {
    flex: 0 0 auto;
    margin: 4px 0 2px;
}
.pitch-section #subs {
    flex: 0 0 auto;
    max-height: min(16dvh, 104px);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}
.player-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--match-tile-min-width), 1fr));
    gap: var(--match-tile-gap);
}
.bench-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    padding-bottom: 2px;
}
.bench-row .player-tile {
    flex: 0 0 auto;
    width: 92px;
    min-height: 52px;
    padding: 4px 6px;
    gap: 1px;
}
.bench-row .player-tile .pname {
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bench-row .player-tile .shirt { font-size: 0.68rem; }
.bench-row .player-tile small {
    font-size: 0.62rem;
    white-space: nowrap;
}
.player-tile {
    display: grid;
    gap: 2px;
    align-content: start;
    min-height: var(--match-tile-min-height);
    padding: var(--match-tile-padding);
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--text);
    text-align: left;
    font: inherit;
    box-sizing: border-box;
}
.player-tile.gk { border-color: var(--gold); }
.player-tile.on { background: #10261a; }
.player-tile.is-selected,
.player-tile.is-target { outline: 2px solid var(--focus); outline-offset: 1px; }
.player-tile .shirt { color: var(--muted); font-size: 0.75rem; font-weight: 800; }
.player-tile .shirt .pos,
.live-pitch-lines .live-icon .shirt .pos {
    color: var(--text);
    font-weight: 800;
    letter-spacing: 0.02em;
    margin-left: 0.35em;
}
.player-tile .pname { font-size: 0.92rem; font-weight: 800; line-height: 1.15; }
.player-tile small { color: var(--muted); font-size: 0.72rem; }
.live-pitch {
    position: relative;
    width: 100%;
    margin: 0;
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
}
.live-pitch::before {
    content: none;
    display: none;
}
.live-pitch-lines {
    flex: 1 1 auto;
    aspect-ratio: auto;
    max-height: none;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    gap: clamp(2px, 0.55dvh, 8px);
    padding: 2px 0;
    overflow: hidden;
    box-sizing: border-box;
}
.live-pitch-lines .live-line {
    flex: 1 1 0;
    max-height: 92px;
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: clamp(4px, 1.2vw, 8px);
    width: 100%;
    min-height: 0;
}
.live-pitch-lines .live-icon {
    position: static;
    transform: none;
    left: auto;
    top: auto;
    z-index: auto;
    flex: 1 1 0;
    width: 0;
    min-width: 0;
    max-width: min(132px, 100%);
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: clamp(2px, 0.55dvh, 6px) clamp(4px, 1.2vw, 8px);
    border: 1px solid var(--line);
    border-radius: 10px;
    border-left-width: 3px;
    text-align: left;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    appearance: none;
    -webkit-appearance: none;
    box-shadow: none;
    display: grid;
    gap: 1px;
    align-content: center;
    box-sizing: border-box;
}
.live-pitch-lines .live-icon .shirt {
    display: block;
    font-size: clamp(0.58rem, 1.55dvh, 0.75rem);
    color: var(--muted);
    font-weight: 800;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.live-pitch-lines .live-icon .pname {
    display: block;
    max-width: 100%;
    font-size: clamp(0.66rem, 1.85dvh, 0.9rem);
    font-weight: 800;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.live-pitch-lines .live-icon.is-target {
    outline: 2px solid var(--focus);
    outline-offset: 1px;
}
.live-pitch-lines .live-icon.line-gk,
.live-pitch-lines .live-icon.gk {
    background: #1a2412;
    border-color: rgba(231, 193, 90, 0.45);
    border-left-color: var(--gold);
}
.live-pitch-lines .live-icon.line-def {
    background: #0f1f28;
    border-color: rgba(56, 189, 248, 0.28);
    border-left-color: var(--act-assist);
}
.live-pitch-lines .live-icon.line-mid {
    background: #10261a;
    border-color: rgba(43, 213, 118, 0.28);
    border-left-color: var(--pitch);
}
.live-pitch-lines .live-icon.line-fwd {
    background: #241810;
    border-color: rgba(231, 193, 90, 0.28);
    border-left-color: var(--warn);
}
.live-pitch-lines .live-icon.empty {
    background: transparent;
    border-style: dashed;
    color: var(--muted);
    align-content: center;
    text-align: center;
}
.live-pitch-lines .live-icon.empty .slot-code {
    font-size: 0.82rem;
    font-weight: 800;
}
.live-pitch-extra {
    flex: 0 0 auto;
    margin-top: 4px;
    max-height: 20%;
    overflow: auto;
}
.action-screen {
    position: fixed;
    top: var(--match-sticky-h, 148px);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 28;
    background: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    overflow: auto;
}
.action-screen[hidden] { display: none !important; }
.action-screen-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg);
}
.action-screen-top h2 { margin: 0; font-size: 1.2rem; min-width: 0; }
.action-screen-top .icon-btn { flex: 0 0 44px; }
.action-screen-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 16px;
}
.action-screen-actions .btn-ghost {
    min-height: 52px;
    flex: 1;
    width: auto;
}
.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
}
.action-grid button {
    min-height: 56px;
    min-width: 0;
    width: 100%;
    border: 0;
    border-radius: 12px;
    background: var(--card-2);
    color: var(--text);
    font-weight: 800;
    font-size: 1rem;
    padding: 8px 10px;
    white-space: normal;
}
.action-grid button.goal { background: var(--act-goal); color: var(--act-goal-ink); }
.action-grid button.shot { background: var(--act-shot); color: var(--act-shot-ink); }
.action-grid button.save { background: var(--act-save); color: var(--act-save-ink); }
.action-grid button.pass { background: var(--act-pass); color: var(--act-pass-ink); }
.action-grid button.tackle { background: var(--act-tackle); color: var(--act-tackle-ink); }
.action-grid button.int { background: var(--act-int); color: var(--act-int-ink); }
.action-grid button.assist { background: var(--act-assist); color: var(--act-assist-ink); }
.action-grid button.foul { background: var(--act-foul); color: var(--act-foul-ink); }
.action-grid button.kpass { background: var(--act-kpass); color: var(--act-kpass-ink); }
.action-grid button.duel { background: var(--act-duel); color: var(--act-duel-ink); }
.action-grid button.sub { background: var(--act-on); color: var(--act-on-ink); }
.clock-actions .phase-btn {
    flex: 2 1 160px;
    min-height: 52px;
    font-size: 1.05rem;
}
.clock-actions .phase-btn:only-child {
    flex: 1 1 100%;
    min-height: 56px;
    font-size: 1.15rem;
}
.match-card .mins { color: var(--pitch); font-weight: 700; }
.match-card .dot { color: var(--pitch); }
.match-bar {
    position: fixed;
    left: 50%;
    bottom: 0;
    width: 100%;
    max-width: 1100px;
    transform: translateX(-50%);
    display: grid;
    grid-template-columns: 1.45fr 1fr 1fr 1fr 1fr;
    background: #07140d;
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    z-index: 9;
}
.match-bar button {
    min-height: 52px;
    border: 1px solid rgba(0, 0, 0, 0.28);
    border-radius: 12px;
    margin: 0 2px;
    background: var(--act-more);
    color: var(--act-more-ink);
    font-weight: 800;
    font-size: 0.85rem;
    letter-spacing: 0;
    padding: 4px 2px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.match-bar button.goal { background: var(--act-goal); color: var(--act-goal-ink); font-size: 0.98rem; }
.match-bar button[data-bar="corner"] { background: var(--act-cwon); color: var(--act-cwon-ink); }
.match-bar button[data-bar="foul"] { background: var(--act-foul); color: var(--act-foul-ink); }
.match-bar button[data-bar="other"] { background: var(--act-more); color: var(--act-more-ink); }
.match-bar button.danger { background: var(--act-undo); color: var(--act-undo-ink); }
.choice.them-side { background: #4a1d24; color: #ffd5d5; border-color: #6a2d34; }

.sheet {
    position: fixed;
    top: var(--match-sticky-h, 148px);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 20;
    display: grid;
    align-items: end;
}
.sheet[hidden], .toast[hidden], .match-dock[hidden] { display: none !important; }
.sheet-card {
    background: #102018;
    border-radius: 20px 20px 0 0;
    padding: 16px 16px calc(24px + env(safe-area-inset-bottom, 0px));
    max-height: 86dvh;
    overflow: auto;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
}
.sheet-close { width: 100%; margin-top: 12px; min-height: 48px; border: 0; border-radius: 12px; background: var(--card); color: var(--text); }
.clock-confirm { margin-top: 14px; gap: 10px; }
.clock-confirm .choice {
    width: 100%;
    min-height: 56px;
    font-size: 1.05rem;
    font-weight: 800;
}
.clock-confirm-yes.clock-confirm-end-period {
    background: var(--act-period);
    color: var(--act-period-ink);
    border-color: transparent;
}
.clock-confirm-yes.clock-confirm-end {
    background: var(--act-off);
    color: var(--act-off-ink);
    border-color: transparent;
}
.clock-confirm-no {
    background: var(--card);
}
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice, .player-pick {
    min-height: 52px; border: 1px solid var(--line); background: #0d1b14; color: var(--text);
    border-radius: 12px; font-weight: 700;
}
.player-pick.selected { border-color: var(--pitch); background: #163d28; }
.sub-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.confirm-box { background: #163d28; border-radius: 14px; padding: 12px; margin-top: 12px; }
.toast {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top, 0px));
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 360px;
    background: #163d28;
    color: #e9fff2;
    padding: 10px 14px;
    border-radius: 12px;
    z-index: 40;
    text-align: center;
}
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.timeline-help { font-size: 0.78rem; margin: 0 0 8px; line-height: 1.35; }
.timeline-dock {
    position: sticky;
    top: calc(52px + env(safe-area-inset-top, 0px));
    z-index: 6;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 6px 10px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 8px 10px;
    margin: 0 0 10px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}
.timeline-dock-title {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--pitch);
    flex: 0 0 100%;
}
.timeline-add {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0;
    flex: 1 1 12rem;
}
.timeline-add label {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    font-size: 0.72rem;
    color: var(--text);
    font-weight: 650;
    white-space: nowrap;
}
.timeline-add select,
.timeline-add input[type="number"] {
    width: auto;
    min-height: 32px;
    height: 32px;
    padding: 2px 6px;
    font-size: 0.8rem;
    border-radius: 8px;
    color: var(--text);
    background: var(--bg-2);
    border: 1px solid var(--line);
}
.timeline-add select[name="event_type"] { max-width: 9.5rem; }
.timeline-add select[name="player_id"],
.timeline-add select[name="related_player_id"] { max-width: 7.5rem; }
.timeline-add select[name="team_side"] { max-width: 6.5rem; }
.timeline-add input[name="display_minute"] { width: 3.1rem; }
.timeline-add input[name="position"] { width: 3.1rem; }
.timeline-add .btn-primary,
.timeline-dock-save .btn-primary {
    width: auto;
    min-width: 0;
    min-height: 32px;
    height: 32px;
    padding: 0 12px;
    font-size: 0.78rem;
    border-radius: 8px;
}
.timeline-dock-save {
    display: none;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
    margin-left: auto;
}
.timeline-js .timeline-dock-save { display: flex; }
.timeline-save-hint {
    margin: 0;
    font-size: 0.7rem;
    line-height: 1.2;
    white-space: nowrap;
}
.timeline-dock.is-dirty .timeline-save-hint { color: var(--gold); }
.timeline-dock-save .btn-primary:disabled {
    opacity: 0.55;
    cursor: default;
}
.timeline-item {
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: 6px;
    padding: 5px 0;
    border-bottom: 1px solid var(--line);
    align-items: start;
    font-size: 0.82rem;
    line-height: 1.25;
}
.timeline-item:not(.timeline-item-edit) { grid-template-columns: 1fr; }
.timeline-item,
#event-results { scroll-margin-top: calc(188px + env(safe-area-inset-top, 0px)); }
.timeline-item-edit { grid-template-columns: 26px 1fr; }
.timeline-body { min-width: 0; position: relative; }
.timeline-item-edit .timeline-body { padding-right: 7.25rem; }
.timeline-line {
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
}
.timeline-num {
    flex: 0 0 auto;
    min-width: 2rem;
    padding: 1px 5px;
    border-radius: 6px;
    background: var(--gold);
    color: #1a1404;
    font-size: 0.7rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
    line-height: 1.35;
    text-align: center;
}
.timeline-clock {
    flex: 0 0 auto;
    min-width: 2.4rem;
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}
.timeline-line p { margin: 0; min-width: 0; color: var(--text); }
.timeline-item.is-dragging {
    opacity: 0.55;
    background: var(--card);
    border-radius: 8px;
}
.timeline-item.is-drop-target { box-shadow: inset 0 2px 0 var(--pitch); }
.timeline-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    min-width: 26px;
    color: var(--muted);
    letter-spacing: -2px;
    font-size: 1rem;
    line-height: 1;
    cursor: grab;
    touch-action: none;
    user-select: none;
}
.timeline-handle:active { cursor: grabbing; }
.timeline-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
    margin-top: 3px;
}
.timeline-move { display: flex; align-items: center; gap: 4px; flex-wrap: nowrap; margin: 0; }
.timeline-move label { display: flex; align-items: center; gap: 4px; font-size: 0.72rem; color: var(--text); white-space: nowrap; }
.timeline-move input[type="number"] { width: 3.1rem; }
.timeline-status {
    min-height: 1.1em;
    font-size: 0.75rem;
    margin: 0 0 6px;
}
.inline-edit { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; margin: 0; }
.timeline-time { display: inline-flex; margin: 0; }
.timeline-time-sep { color: var(--muted); font-weight: 700; }
.timeline-scope {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
    position: absolute;
    top: 0;
    right: 0;
}
.timeline-scope label {
    display: flex;
    align-items: center;
    gap: 3px;
    margin: 0;
    font-size: 0.7rem;
    color: var(--text);
    font-weight: 650;
    white-space: nowrap;
}
.timeline-scope input { width: auto; min-height: 0; margin: 0; accent-color: var(--pitch); }
.timeline-editable input,
.timeline-editable select {
    width: auto;
    min-height: 32px;
    height: 32px;
    padding: 2px 6px;
    font-size: 0.8rem;
    border-radius: 8px;
    color: var(--text);
    background: var(--bg-2);
    border-color: var(--line);
}
.timeline-editable .inline-edit input[name="display_minute"],
.timeline-editable .inline-edit input[name="display_second"] { width: 2.85rem; }
.timeline-editable .inline-edit select { max-width: 7.5rem; }
.timeline-type-wrap { margin: 0; min-width: 0; }
.timeline-type-select {
    width: auto;
    max-width: 9.2rem;
    min-height: 28px;
    height: 28px;
    padding: 0 4px;
    font-size: 0.78rem;
    font-weight: 650;
    border-radius: 8px;
    color: var(--text);
    background: var(--bg-2);
    border: 1px solid var(--line);
}
.timeline-editable .inline-edit select[name="team_side"] { max-width: 6.5rem; }
.timeline-editable .inline-edit select[name="match_position"] { max-width: 5.5rem; }
.timeline-edit-position { display: inline-flex; margin: 0; }
.timeline-editable .btn-ghost,
.timeline-editable .timeline-move .btn-ghost,
.timeline-editable .text-danger {
    width: auto;
    min-width: 0;
    min-height: 32px;
    height: 32px;
    padding: 0 8px;
    font-size: 0.72rem;
    border-radius: 8px;
}
.timeline-js .timeline-save { display: none; }
.timeline-delete { margin: 0; }

@media (max-width: 360px) {
    .clock { font-size: 1.85rem; }
    .squad-grid { grid-template-columns: 1fr; }
    .stat-card strong { font-size: 1.25rem; }
    .match-card { flex-direction: column; align-items: stretch; }
    .match-card .who { flex: none; max-width: none; }
    .card-actions button { min-height: 44px; }
    .on-row.match-card { grid-template-columns: 28px minmax(0, 1fr); }
    .on-row .who { flex: none; max-width: none; }
    .pitch-acts { grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); }
    .pitch-acts button { font-size: 0.72rem; min-height: 38px; }
}

@media (min-width: 760px) {
    .app-shell, .bottom-nav-inner, .auth-wrap { max-width: 760px; }
    .app-shell { padding-top: 28px; }
    .stat-grid { grid-template-columns: repeat(4, 1fr); }
    .squad-grid { grid-template-columns: repeat(3, 1fr); }
    .btn-primary, .btn-ghost { width: auto; min-width: 160px; }
    .timeline-editable .btn-ghost,
    .timeline-editable .timeline-move .btn-ghost,
    .timeline-add .btn-primary,
    .timeline-dock-save .btn-primary { min-width: 0; width: auto; }
    .clock { font-size: 2.5rem; }
    .clock-actions .btn-primary,
    .clock-actions [data-clock="start"],
    .clock-actions [data-clock="next-period"],
    .clock-actions [data-formation-break] {
        width: 100%;
        min-width: 0;
        flex: 1 1 100%;
    }
    .page-actions, .btn-row { flex-direction: row; flex-wrap: wrap; }
    .page-actions > *, .btn-row > * { width: auto; flex: 1; }
    .match-card {
        align-items: center;
        padding: 10px 12px;
    }
    .match-card .who { flex: 0 0 220px; max-width: 240px; }
    .card-actions { flex-wrap: nowrap; }
    .card-actions button { min-height: 52px; font-size: 0.95rem; flex: 1 1 auto; }
    .pitch-board { max-height: 560px; }
    .pitch-chip, .pitch-slot { width: clamp(64px, 12vw, 84px); }
    .bench-grid { grid-template-columns: repeat(3, 1fr); }
    .match-card.bench .who { flex: 1; max-width: none; }
    .on-row.match-card {
        grid-template-columns: 36px minmax(140px, 0.9fr) minmax(0, 1.5fr);
        column-gap: 12px;
        padding: 8px 10px;
    }
    .on-row .who { max-width: none; flex: none; }
    .on-row .pitch-acts,
    .on-row .pick-label { grid-column: auto; }
    .on-row .pitch-acts {
        grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    }
    .on-row .pitch-acts button {
        min-height: 42px;
        font-size: 0.82rem;
    }
}

@media (min-width: 1100px) {
    .app-shell, .bottom-nav-inner { max-width: 980px; }
    .match-app { padding-left: 16px; padding-right: 16px; }
}

.demo-banner {
    background: #3a2a10;
    color: #f0d08a;
    border: 1px solid rgba(240, 176, 41, 0.35);
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 0.8rem;
    margin: 0 0 12px;
}
.inline-form { display: inline; }
.inline-form button { margin-top: 4px; }

.tracking-block { display: grid; gap: 8px; }
.tracking-grid { margin: 4px 0 8px; }
.report-filters { display: grid; gap: 8px; margin-bottom: 12px; padding: 12px; }
.report-filter-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 10px;
}
.report-filter-head .eyebrow,
.report-filter-head .muted { margin: 0; }
.report-filter-head .muted { font-size: 0.8rem; }
.report-filter-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: end;
}
.report-filter-row .btn-primary {
    width: auto;
    min-width: 88px;
    margin: 0;
}
.report-filters .btn-primary { margin-top: 0; }
#report-results {
    scroll-margin-top: calc(72px + env(safe-area-inset-top, 0px));
}
.fixture-picker {
    display: grid;
    gap: 6px;
    max-height: 220px;
    overflow: auto;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg-2);
}
.fixture-picker .check { font-size: 0.85rem; color: var(--text); }
.sort-bar { margin: 12px 0; }
table.data { min-width: 720px; }

.table-key {
    margin: 10px 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card);
}
.table-key h4 {
    margin: 0 0 8px;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}
.table-key dl {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
    margin: 0;
}
.table-key-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 6px;
    align-items: baseline;
    min-width: 0;
}
.table-key dt {
    margin: 0;
    font-weight: 700;
    font-size: 0.8rem;
}
.table-key dd {
    margin: 0;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.25;
}
.table-key-note {
    margin: 8px 0 0;
    font-size: 0.78rem;
}
@media (min-width: 720px) {
    .table-key dl { grid-template-columns: 1fr 1fr 1fr; }
}
.print-wrap .table-key {
    background: #f6f6f6;
    border-color: #ddd;
    color: #111;
}
.print-wrap .table-key h4,
.print-wrap .table-key dd,
.print-wrap .table-key .table-key-note { color: #444; }
@media print {
    .table-key {
        background: #fff;
        border-color: #ddd;
        color: #111;
        break-inside: avoid;
    }
    .table-key h4,
    .table-key dd,
    .table-key .table-key-note { color: #444; }
}

@media (hover: hover) and (pointer: fine) {
    button, a, .player-pick, .choice { cursor: pointer; }
    .card-actions button:hover,
    .pitch-acts button:hover,
    .team-stat-row button:hover,
    .match-bar button:hover,
    .wake-toggle:hover,
    .clock-actions button:hover,
    .btn-primary:hover,
    .btn-ghost:hover,
    .btn-danger:hover,
    .player-pick:hover,
    .choice:hover {
        filter: brightness(1.14);
    }
}

.pitch-acts button:focus-visible,
.card-actions button:focus-visible,
.team-stat-row button:focus-visible,
.match-bar button:focus-visible,
.clock-actions button:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
    box-shadow: 0 0 0 5px rgba(126, 224, 168, 0.55);
}
.pitch-acts button:active,
.card-actions button:active,
.team-stat-row button:active,
.match-bar button:active,
.clock-actions button:active {
    filter: brightness(1.08);
}

.award-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; }
.award-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 4px;
    padding: 0.12em 0.45em;
    border-radius: 999px;
    background: var(--gold);
    color: #1a1404;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1.2;
    vertical-align: 0.12em;
}
.award-badge.is-secondary {
    background: var(--card-2);
    color: var(--text);
    border: 1px solid var(--line);
}
.award-form:not(:has([name="secondary_enabled"]:checked)) .award-secondary-fields {
    display: none;
}
.award-secondary-fields { display: grid; gap: 10px; }

.guide { display: grid; gap: 22px; }
.guide-toc {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 10px;
    margin: 0 0 22px;
}
.guide-toc a {
    color: var(--text);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 600;
}
.guide-toc a:hover { border-color: var(--pitch); color: var(--pitch); }
.guide-section {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin: 0 0 22px;
}
.guide-section h2 { margin: 0 0 10px; }
.guide-section h3, .guide-copy h3 { margin: 14px 0 6px; font-size: 0.95rem; }
.guide-section p, .guide-section li, .guide-copy p, .guide-copy li, .guide-note { color: var(--muted); }
.guide-section ul, .guide-copy ul, .guide-section ol, .guide-copy ol {
    margin: 0 0 12px;
    padding-left: 1.15rem;
    display: grid;
    gap: 6px;
}
.guide-step {
    display: grid;
    gap: 16px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.guide-figure { margin: 0; background: #0a141c; }
.guide-figure img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    background: #0a141c;
}
.guide-copy { padding: 0 18px 18px; }
.guide-copy h2 { margin: 8px 0 8px; }
.guide-note { margin: 16px 0 0; font-size: 0.92rem; }
.guide-actions { margin-top: 20px; }
.guide-page .lede { color: var(--muted); max-width: 40rem; }
.guide-embed {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}
.guide-embed h2 { margin-top: 0; }
.guide-thumbs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 14px 0;
}
.guide-thumbs a {
    display: block;
    color: var(--text);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
}
.guide-thumbs img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: contain;
    background: #0a141c;
}
.guide-thumbs span { display: block; padding: 8px 10px 10px; font-weight: 600; font-size: 0.92rem; }
@media (min-width: 720px) {
    .guide-step { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; }
    .guide-step:nth-child(even) .guide-figure { order: 2; }
    .guide-copy { padding: 18px 22px 18px 8px; }
    .guide-step:nth-child(even) .guide-copy { padding: 18px 8px 18px 22px; }
    .guide-thumbs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
