/* Honkbal Live – basisstijl. Geen build-stap: gewone CSS met custom properties. */

:root {
    --navy: #0b2545;
    --navy-2: #13315c;
    --red: #b3001b;
    --green: #1f7a3a;
    --dirt: #c68b59;
    --bg: #f3f5f8;
    --surface: #ffffff;
    --text: #14181f;
    --muted: #5a6473;
    --border: #d5dbe3;
    --focus: #ffb000;
    --success-bg: #e7f6ec;
    --error-bg: #fdecee;
    --info-bg: #e8f0fb;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(11, 37, 69, .08), 0 2px 8px rgba(11, 37, 69, .06);
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0d1117;
        --surface: #161c25;
        --text: #e8edf3;
        --muted: #9aa6b6;
        --border: #2b3544;
        --success-bg: #12301d;
        --error-bg: #3a1419;
        --info-bg: #142640;
        --shadow: none;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
}

a { color: inherit; }
main a:not(.btn):not(.game-row) { color: var(--navy-2); text-underline-offset: 2px; }
@media (prefers-color-scheme: dark) { main a:not(.btn):not(.game-row) { color: #8db7ff; } }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

h1 { font-size: 1.6rem; line-height: 1.2; margin: 1rem 0; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-bottom: 3rem; }

.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link { position: absolute; left: -9999px; top: 0; background: var(--focus); color: #000; padding: .5rem 1rem; z-index: 10; }
.skip-link:focus { left: 1rem; }

.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* Header ----------------------------------------------------------- */
.site-header { background: var(--navy); color: #fff; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 56px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; text-decoration: none; font-size: 1.1rem; }
.brand-ball {
    width: 22px; height: 22px; border-radius: 50%; background: #fff; position: relative;
    box-shadow: inset 4px 0 0 -2px var(--red), inset -4px 0 0 -2px var(--red);
}
.nav { list-style: none; display: flex; gap: .25rem; margin: 0; padding: 0; flex-wrap: wrap; }
.nav a, .link-button {
    display: inline-block; padding: .5rem .75rem; border-radius: 6px; text-decoration: none; color: #fff;
    background: none; border: 0; font: inherit; cursor: pointer;
}
.nav a:hover, .link-button:hover, .nav a[aria-current="page"] { background: var(--navy-2); }
.nav form { margin: 0; }

/* Kaarten, knoppen, formulieren ----------------------------------- */
.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1rem; margin-bottom: 1rem; box-shadow: var(--shadow);
}
.card.narrow { max-width: 420px; margin: 2rem auto; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.actions, .btn-row, .row-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.btn-row { margin-top: .75rem; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
    min-height: 44px; padding: .5rem 1rem; border-radius: 8px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text); font: inherit; font-weight: 600;
    text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--navy-2); }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-danger { color: var(--red); border-color: currentColor; }
@media (prefers-color-scheme: dark) { .btn-danger { color: #ff8a98; } }
.btn-small { min-height: 36px; padding: .25rem .65rem; font-size: .875rem; }

.form .field, .field { margin-bottom: .9rem; display: flex; flex-direction: column; gap: .3rem; }
.field.check { flex-direction: row; align-items: center; gap: .5rem; }
.field.grow { flex: 1 1 220px; }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
label { font-weight: 600; }
input, select, textarea {
    font: inherit; color: var(--text); background: var(--surface);
    border: 1px solid #8a94a3; border-radius: 6px; padding: .55rem .65rem; min-height: 44px; max-width: 100%;
}
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; accent-color: var(--navy); }
input[type="color"] { padding: 2px; width: 64px; }
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: .75rem 1rem; margin: 0 0 1rem; min-width: 0; }
legend { font-weight: 700; padding: 0 .25rem; }

.alert { border-radius: 8px; padding: .75rem 1rem; margin: 1rem 0; border: 1px solid transparent; }
.alert p, .alert ul { margin: 0; }
.alert-success { background: var(--success-bg); border-color: var(--green); }
.alert-error { background: var(--error-bg); border-color: var(--red); }
.alert-info { background: var(--info-bg); border-color: var(--navy-2); }

.badge {
    display: inline-block; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    padding: .15rem .5rem; border-radius: 999px; background: #e3e8ef; color: #2b3440;
}
.badge-live { background: var(--red); color: #fff; }
.badge-final { background: #2b3440; color: #fff; }

/* Tabellen ---------------------------------------------------------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table, .stats, .linescore { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th, .table td, .stats th, .stats td, .linescore th, .linescore td {
    padding: .45rem .5rem; border-bottom: 1px solid var(--border); text-align: left;
}
.stats td, .stats thead th:not(:first-child), .linescore td, .linescore thead th { text-align: center; }
.stats th[scope="row"] { font-weight: 500; white-space: nowrap; }
.stats tr.sub th { font-style: italic; }
.linescore td.total { font-weight: 800; border-left: 2px solid var(--border); }
.linescore td.current { background: var(--info-bg); font-weight: 700; }
.linescore th[scope="row"] { font-weight: 800; }

/* Openbaar overzicht ---------------------------------------------- */
.game-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.game-row {
    display: grid; grid-template-columns: auto 1fr auto; gap: .75rem; align-items: center;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: .85rem 1rem; text-decoration: none; box-shadow: var(--shadow);
}
.game-row:hover { border-color: var(--navy-2); }
.game-row-teams { display: grid; gap: .2rem; }
.team-line { display: flex; align-items: center; gap: .5rem; }
.team-line .score { margin-left: auto; font-size: 1.15rem; }
.game-row-meta { text-align: right; color: var(--muted); font-size: .875rem; display: grid; gap: .2rem; justify-items: end; }
.stream-tag { font-size: .7rem; font-weight: 700; color: var(--red); text-transform: uppercase; }
.team-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--team); flex: none; border: 1px solid rgba(0,0,0,.2); }
.team-dot.big { width: 28px; height: 28px; }

.team-list { list-style: none; padding: 0; display: grid; gap: .5rem; }
.team-card { display: flex; align-items: center; gap: .75rem; margin: 0; }

.player-legend, .player-row { display: grid; grid-template-columns: 4rem 1fr 1fr 4rem 2rem auto; gap: .5rem; align-items: center; }
.player-legend { margin: 0 0 .25rem; font-weight: 600; }
.player-legend span:last-child { grid-column: 5; }
.player-list { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .5rem; }
.player-list input { min-width: 0; width: 100%; }
.player-list input[type="checkbox"] { width: 22px; }
@media (max-width: 720px) {
    .player-legend { display: none; }
    .player-row { grid-template-columns: 4rem 1fr 1fr; }
    .player-row .row-actions { grid-column: 1 / -1; }
}

.lineup-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.lineup-list { padding-left: 1.75rem; margin: 0 0 1rem; display: grid; gap: .4rem; }
.lineup-row { display: grid; grid-template-columns: 1fr 5.5rem; gap: .4rem; }
.lineup-row select { width: 100%; }

/* Live-pagina ------------------------------------------------------ */
.scoreboard {
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem;
    background: var(--navy); color: #fff; border: 0; margin-top: 1rem;
}
.sb-team { display: flex; align-items: center; gap: .75rem; border-left: 6px solid var(--team); padding-left: .75rem; }
.sb-home { justify-content: flex-end; border-left: 0; border-right: 6px solid var(--team); padding: 0 .75rem 0 0; }
.sb-name { font-weight: 700; font-size: 1.05rem; }
.sb-score { font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.sb-mid { display: grid; justify-items: center; gap: .3rem; }
.sb-inning { font-weight: 700; }
.scoreboard .badge:not(.badge-live) { background: rgba(255,255,255,.15); color: #fff; }
@media (max-width: 560px) {
    .sb-name { font-size: .9rem; }
    .sb-team { flex-direction: column-reverse; align-items: flex-start; gap: .25rem; }
    .sb-home { align-items: flex-end; flex-direction: column; }
    .sb-score { font-size: 2.1rem; }
}

.live-grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 860px) { .live-grid { grid-template-columns: minmax(0, 1fr); } .live-side { order: -1; } }

.video { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 6px; overflow: hidden; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.situation-grid { display: flex; align-items: center; gap: 1rem; }
.count { display: grid; gap: .25rem; margin: 0; }
.count div { display: flex; gap: .5rem; align-items: baseline; }
.count dt { color: var(--muted); width: 2.5rem; font-size: .875rem; }
.count dd { margin: 0; font-weight: 800; font-size: 1.25rem; font-variant-numeric: tabular-nums; }

.diamond .infield { fill: var(--green); opacity: .18; stroke: var(--green); stroke-width: 1.5; }
.diamond .base { fill: var(--surface); stroke: var(--muted); stroke-width: 1.5; }
.diamond .base.on { fill: var(--red); stroke: var(--red); }
.diamond .home-plate { fill: var(--surface); stroke: var(--muted); stroke-width: 1.5; }

.pbp { list-style: none; padding: 0; margin: 0; display: grid; gap: .1rem; max-height: 28rem; overflow-y: auto; }
.pbp li { padding: .45rem 0; border-bottom: 1px solid var(--border); }
.pbp-inning { display: inline-block; min-width: 2.5rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.pbp-system { color: var(--muted); font-style: italic; }

/* Scoorscherm ------------------------------------------------------ */
.scorer { max-width: 720px; margin: 0 auto; }
.scorer.is-busy .pad, .scorer.is-busy .btn { opacity: .6; pointer-events: none; }
.scorer-top {
    display: grid; grid-template-columns: auto auto 1fr; grid-template-areas:
        "score inning diamond" "count count diamond" "who1 who1 who1" "who2 who2 who2";
    align-items: center; gap: .25rem 1rem; margin-top: 1rem;
}
.st-score { grid-area: score; display: grid; gap: .1rem; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.st-score strong { font-size: 1.4rem; margin-left: .35rem; }
.st-inning { grid-area: inning; font-size: 1.3rem; font-weight: 800; }
.st-diamond { grid-area: diamond; justify-self: end; }
.scorer-top .count { grid-area: count; grid-auto-flow: column; gap: 1rem; }
.st-who { margin: 0; }
.st-who:nth-of-type(1) { grid-area: who1; }
.st-who:nth-of-type(2) { grid-area: who2; }
.st-who .muted { display: inline-block; width: 4.5rem; }

.btn-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.btn-grid.small { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.pad {
    min-height: 72px; border-radius: 12px; border: 2px solid var(--border); background: var(--surface); color: var(--text);
    font: inherit; font-size: 1.1rem; font-weight: 700; cursor: pointer; line-height: 1.15; padding: .5rem;
}
.btn-grid.small .pad { min-height: 56px; font-size: 1rem; }
.pad small { font-weight: 500; font-size: .8rem; color: var(--muted); }
.pad:active { transform: scale(.98); }
.pad-ball { border-color: var(--green); }
.pad-strike { border-color: var(--red); }
.pad-play { background: var(--navy); color: #fff; border-color: var(--navy); }
.pad-hit { border-color: var(--navy-2); }
.pad[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--focus); }
.btn-undo { margin-left: auto; }
.panel { margin-top: 1rem; }
.move select { width: 100%; }
.scorer-game .btn-row { margin-top: 0; }

@media (max-width: 560px) {
    .stats th, .stats td, .linescore th, .linescore td { padding: .35rem .25rem; font-size: .875rem; }
    .card { padding: .85rem; }
}

/* Synchronisatiestatus scoorscherm -------------------------------- */
.sync-bar { margin: .75rem 0; }
.sync { margin: 0; padding: .5rem .75rem; border-radius: 8px; font-weight: 600; border: 1px solid transparent; }
.sync::before { content: ""; display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .5rem; background: currentColor; vertical-align: middle; }
.sync-ok { background: var(--success-bg); border-color: var(--green); }
.sync-ok::before { background: var(--green); }
.sync-busy { background: var(--info-bg); border-color: var(--navy-2); }
.sync-offline { background: #fff4d6; border-color: #b07800; color: #4a3300; }
.sync-offline::before { background: #b07800; }
.sync-problem { background: var(--error-bg); border-color: var(--red); }
.sync-problem::before { background: var(--red); }
@media (prefers-color-scheme: dark) { .sync-offline { background: #3a2c08; color: #ffe2a0; } }
.sync-bar .btn-row { margin-top: .5rem; }
