:root {
  /* Eendracht Buggenhout: yellow #f6ce47, black, navy ring #153347 */
  --green: #111111; --green-dark: #000000; --green-soft: #fff4c2;
  --yel: #f6ce47; --yel-dark: #e0b62a; --navy: #153347;
  --ink: #111111; --muted: #5b5b56; --line: #dcdcd4; --bg: #f7f6f1; --card: #ffffff;
  --warn: #c2410c; --danger: #b91c1c; --yellow: #f5c518; --tap: 56px; --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 18px; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.35; padding-bottom: env(safe-area-inset-bottom); }
a { color: var(--ink); text-decoration: none; }
h1 { font-size: 1.25rem; margin: 0; } h2 { font-size: 1.05rem; margin: 1.2rem 0 .5rem; } h3 { font-size: 1rem; margin: .6rem 0 .4rem; }
p { margin: .5rem 0; }
.muted { color: var(--muted); } .tiny { font-size: .8rem; } .ok { color: #1a7f37; font-weight: 700; }
.top { display: flex; align-items: center; gap: .75rem; padding: max(.6rem, env(safe-area-inset-top)) 1rem .6rem; background: var(--ink); color: #fff; border-bottom: 4px solid var(--yel); position: sticky; top: 0; z-index: 5; }
.crest { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #fff; flex: none; }
.top h1 { flex: 1; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .back { color: #fff; font-size: 1.3rem; min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; }
.top .btn { color: var(--yel); border-color: rgba(246,206,71,.6); }
.page { padding: .75rem 1rem 2rem; max-width: 720px; margin: 0 auto; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; } .row-between { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; } .grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .6rem; }
.player-grid { grid-template-columns: 2fr 1fr 1.6fr; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: var(--tap); padding: .5rem 1rem; border-radius: var(--radius); border: 2px solid var(--green); background: #fff; color: var(--green); font: inherit; font-weight: 700; font-size: 1rem; cursor: pointer; text-align: center; }
.btn.primary { background: var(--yel); color: var(--ink); border-color: var(--yel); } .btn.primary:active { background: var(--yel-dark); }
.btn.ghost { border-color: var(--line); color: var(--ink); background: transparent; }
.btn.danger { border-color: var(--danger); color: var(--danger); } .btn.danger.primary { background: var(--danger); }
.btn.warn { border-color: var(--warn); color: var(--warn); }
.btn.yellow { border-color: var(--yellow); background: var(--yellow); color: var(--ink); }
.btn.them { border-color: var(--muted); color: var(--ink); }
.btn.small { min-height: 48px; padding: .3rem .8rem; font-size: .9rem; }
.btn.big { width: 100%; min-height: 64px; font-size: 1.15rem; }
.btn.on { background: var(--yel); color: var(--ink); border-color: var(--yel); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.seg { display: flex; } .seg .btn { flex: 1; border-radius: 0; } .seg .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); } .seg .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.icon-btn { min-width: 48px; min-height: 48px; border: 0; background: transparent; color: var(--muted); font-size: 1.1rem; cursor: pointer; }

.form label { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: .6rem; }
.form input, .form select, textarea { display: block; width: 100%; margin-top: .25rem; min-height: 48px; padding: .5rem .7rem; font: inherit; font-size: 1.05rem; color: var(--ink); border: 2px solid var(--line); border-radius: 10px; background: #fff; }
.form input:focus, .form select:focus, textarea:focus { outline: none; border-color: var(--yel-dark); }
.form.inline { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; margin-top: .75rem; }
.presets { display: flex; gap: .5rem; align-items: center; margin-bottom: .75rem; flex-wrap: wrap; }
textarea { margin: .5rem 0; }
details.import { margin-top: 1.5rem; } details.import summary { cursor: pointer; color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-color: var(--yel); min-height: 44px; display: flex; align-items: center; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .5rem; overflow: hidden; }
.list li > a, .list .row-btn { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 0 .6rem; padding: .7rem .9rem; min-height: var(--tap); color: var(--ink); background: transparent; border: 0; font: inherit; text-align: left; cursor: pointer; }
.list li > a strong { width: 100%; } .list li > a small, .row-btn small { color: var(--muted); font-size: .8rem; }
.list.compact li { padding: .4rem .8rem; gap: .5rem; min-height: 40px; }
.num { display: inline-flex; align-items: center; justify-content: center; min-width: 2rem; height: 2rem; padding: 0 .4rem; border-radius: 8px; background: var(--ink); color: var(--yel); font-weight: 800; font-size: .95rem; }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.chip { display: inline-flex; align-items: center; gap: .4rem; min-height: 52px; padding: .3rem .8rem .3rem .4rem; border-radius: 999px; border: 2px solid var(--line); background: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.chip.on { border-color: var(--yel-dark); background: var(--green-soft); }

/* live */
.live-top h1 { font-size: 1.05rem; }
.scoreboard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; text-align: center; }
.teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .5rem; }
.tname { font-weight: 700; font-size: .95rem; text-align: left; line-height: 1.15; } .tname.right { text-align: right; }
.score { font-size: 2.6rem; font-weight: 900; letter-spacing: .02em; line-height: 1; font-variant-numeric: tabular-nums; } .score b { color: var(--muted); font-weight: 400; padding: 0 .15em; }
.clockline { display: flex; justify-content: space-between; align-items: baseline; margin: .5rem 0 .6rem; }
.status { color: var(--muted); font-weight: 600; }
.clock { font-size: 1.8rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .75rem; }
.pitch { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: .5rem; }
.pl { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem; min-height: 72px; padding: .4rem .3rem; border-radius: var(--radius); border: 2px solid var(--ink); background: var(--green-soft); color: var(--ink); font: inherit; cursor: pointer; }
.pl .num { background: var(--ink); color: var(--yel); }
.pl .nm { font-weight: 700; font-size: .9rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pitch.bench .pl { background: #fff; border-color: var(--line); } .pitch.bench .pl .num { background: var(--muted); color: #fff; }
.pl .yc { position: absolute; top: 6px; right: 6px; width: 10px; height: 14px; background: var(--yellow); border-radius: 2px; }
.pl .g { position: absolute; top: 4px; left: 6px; font-size: .7rem; font-style: normal; }
.events { list-style: none; margin: 0; padding: 0; } .events li { display: flex; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.min { min-width: 2.6rem; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; }

/* report */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin: .75rem 0; }
.rlist { list-style: none; margin: 0; padding: 0; } .rlist li { display: flex; gap: .6rem; padding: .35rem 0; }
.minutes { border-collapse: collapse; width: 100%; } .minutes td:first-child { width: 3rem; } .minutes td { padding: .35rem .4rem; border-bottom: 1px solid var(--line); } .minutes td.r { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* sheet + toast */
#sheet { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.sheet-panel { width: 100%; max-width: 560px; max-height: 85vh; overflow: auto; background: #fff; border-radius: 20px 20px 0 0; padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom)); }
.sheet-panel h3 { margin: 0 0 .6rem; }
.sheet-options { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-bottom: .6rem; }
.sheet-options .btn { flex-direction: column; min-height: 60px; } .sheet-options .btn small { font-weight: 400; color: var(--muted); }
.sheet-cancel { width: 100%; }
#toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 20px); background: var(--ink); color: var(--yel); padding: .6rem 1rem; border-radius: 999px; opacity: 0; transition: .2s; z-index: 30; pointer-events: none; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media print {
  body { background: #fff; color: #000; font-size: 12pt; }
  .top, .no-print, .btn { display: none !important; }
  .page { max-width: none; padding: 0; }
  .scoreboard { border: 0; padding: 0; text-align: left; }
  .teams { grid-template-columns: auto auto auto; justify-content: start; gap: 1rem; }
  .score { font-size: 24pt; }
  .rlist li, .minutes td { break-inside: avoid; }
}
@page { margin: 14mm; }

/* own-goal correction bar */
.ownbar { display: flex; align-items: center; justify-content: space-between; gap: .5rem; background: var(--green-soft); border: 1px solid var(--yel-dark); border-radius: var(--radius); padding: .4rem .6rem; margin-top: .5rem; }

/* landscape pitch view */
body.pitch-mode { overflow: hidden; }
.pv { display: flex; flex-direction: column; height: 100dvh; background: var(--bg); }
.pv-top { display: flex; align-items: center; gap: .6rem; padding: .3rem .6rem; background: var(--ink); color: #fff; border-bottom: 3px solid var(--yel); }
.pv-top .back { color: #fff; font-size: 1.3rem; min-width: 44px; min-height: 48px; display: inline-flex; align-items: center; justify-content: center; }
.pv-top .btn { min-height: 48px; padding: .3rem .9rem; font-size: .95rem; }
.pv-top .btn.primary { background: var(--yel); color: var(--ink); border-color: var(--yel); }
.pv-top .btn.warn { background: var(--warn); color: #fff; border-color: var(--warn); }
.pv-top .btn.ghost { color: var(--yel); border-color: rgba(246,206,71,.6); }
.pv-score { display: flex; align-items: center; gap: .5rem; flex: 1; min-width: 0; }
.pv-score .tname { font-size: .85rem; line-height: 1.1; max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-score .score { font-size: 1.7rem; } .pv-score .score b { color: var(--yel); }
.pv-clock { display: flex; flex-direction: column; align-items: flex-end; line-height: 1; }
.pv-clock .status { color: rgba(255,255,255,.8); font-size: .75rem; } .pv-clock .clock { font-size: 1.5rem; color: #fff; }
.pv-field { flex: 1; display: grid; grid-template-columns: 3fr 2fr; gap: 0; min-height: 0; padding: .4rem .6rem 0; }
.half { position: relative; background: #1d8a4a; border: 3px solid #fff; color: #fff; cursor: pointer; overflow: hidden; -webkit-user-select: none; user-select: none; }
.half.us { border-radius: 14px 0 0 14px; background: linear-gradient(90deg, #1d8a4a 0 20%, #229551 20% 40%, #1d8a4a 40% 60%, #229551 60% 80%, #1d8a4a 80%); border-color: var(--yel); }
.half.them { border-left: 0; border-radius: 0 14px 14px 0; background: #17743e; display: flex; flex-direction: column; border-color: #fff; }
.half.them .them-score { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 4rem; font-weight: 900; color: rgba(255,255,255,.85); }
.half.idle { opacity: .75; cursor: default; }
.half-label { position: absolute; top: .3rem; left: .6rem; right: .6rem; font-weight: 800; font-size: .9rem; text-shadow: 0 1px 2px rgba(0,0,0,.4); display: flex; justify-content: space-between; gap: .5rem; }
.half-label small { font-weight: 500; opacity: .85; }
.half.them .half-label { position: static; padding: .3rem .6rem 0; }
.chips-field { position: absolute; inset: 2rem .5rem .5rem; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: .45rem; }
.chips-field .pl { min-height: 56px; min-width: 88px; max-width: 120px; flex: 1 1 88px; background: #fff; border-color: #fff; color: var(--ink); }
.chips-field .pl .num { background: var(--ink); color: var(--yel); }
.pv-bottom { display: grid; grid-template-columns: 3fr 2fr; gap: .6rem; align-items: center; padding: .4rem .6rem calc(.4rem + env(safe-area-inset-bottom)); }
.pv-bench { display: flex; align-items: center; gap: .4rem; overflow-x: auto; }
.pv-bench .lbl { font-weight: 700; color: var(--muted); font-size: .8rem; margin-right: .2rem; }
.pv-bench .pl { flex-direction: row; min-height: 52px; min-width: 88px; padding: .2rem .6rem .2rem .3rem; gap: .35rem; background: #fff; border-color: var(--line); }
.pv-bench .pl .num { background: var(--muted); color: #fff; }
.pv-bench .pl.armed { border-color: var(--yel-dark); background: var(--green-soft); box-shadow: 0 0 0 3px rgba(246,206,71,.6); }
.pv-last { font-size: .9rem; min-height: 52px; display: flex; align-items: center; gap: .3rem; overflow: hidden; }
.pv-last .hint { color: var(--ink); font-weight: 700; background: var(--yel); padding: .2rem .5rem; border-radius: 8px; }
.pv-done { flex: 1; display: flex; align-items: center; justify-content: center; padding: 1rem; }
@media (max-height: 420px) { .chips-field .pl { min-height: 50px; } .pv-bench .pl { min-height: 48px; } }
/* pitch-view top bar: never wrap the score; last-event line single-line; own-goal bar overlays it */
.pv-score .score { white-space: nowrap; flex-shrink: 0; }
.pv-score .tname { flex: 0 1 auto; }
.pv-top .btn { white-space: nowrap; flex-shrink: 0; }
.pv-last { position: relative; white-space: nowrap; text-overflow: ellipsis; display: block; line-height: 52px; }
.pv-last .ownbar { position: absolute; inset: 0; margin: 0; line-height: 1.1; }
.pv-last .ownbar .btn { white-space: normal; }
@media (max-width: 900px) { .pv-score .tname { max-width: 6.5rem; } }
.ownbar[hidden] { display: none; }
