/* Zijlijn: live sports broadcast look. One bold element, the scorebug
   (blue score bar with a yellow clock tab); everything around it quiet. */

@font-face {
  font-family: "Saira";
  src: url("/fonts/saira-latin.woff2") format("woff2");
  font-weight: 400 900;
  font-stretch: 50% 125%;
  font-display: swap;
}

:root {
  --blauw: #0a3d7a;   /* stadionblauw: scorebug, header, primary */
  --geel: #ffc20e;    /* signaalgeel: our side, the clock */
  --rood: #e5322d;    /* live-rood: LIVE badge, offline */
  --rood-tekst: #c42620; /* red that passes contrast as text */
  --card: #ffffff;
  --ground: #edf1f6;
  --ink: #13233a;
  --ink-soft: #4a5a70;
  --line: #dce3ec;
  --line-strong: #c9d3e0;
  --ok: #2e7d32;
  --nav-h: 62px;
  --condensed: 75%;
  --narrow: 62%;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: "Saira", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--ground);
  color: var(--ink);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}

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

/* ---------- header ---------- */

header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: var(--blauw);
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-decoration: none;
  font-stretch: var(--condensed);
  font-weight: 800;
  font-size: 24px;
  letter-spacing: 0.01em;
}
.brand::before { content: ""; width: 25px; height: 24px; background: url("/icons/mark.svg") center / contain no-repeat; }

#sync-status {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}
#sync-status.offline { background: var(--rood); }
#sync-status.pending { background: var(--geel); color: var(--ink); }

main { padding: 12px 16px 24px; max-width: 720px; margin: 0 auto; }

h2 { font-stretch: var(--condensed); font-weight: 800; font-size: 22px; margin: 18px 0 8px; }
h3 { font-stretch: var(--condensed); font-weight: 800; font-size: 17px; margin: 14px 0 8px; }

.empty, .hint { color: var(--ink-soft); font-size: 14px; }

/* ---------- controls ---------- */

button {
  font: inherit;
  font-weight: 600;
  border: 1.5px solid var(--line-strong);
  background: var(--card);
  color: var(--ink);
  border-radius: 12px;
  padding: 10px 14px;
  min-height: 46px;
  cursor: pointer;
}
button:disabled { opacity: 0.4; cursor: default; }
button.primary { background: var(--blauw); color: #fff; border-color: var(--blauw); }
button.next { background: var(--ink); color: #fff; border-color: var(--ink); }
button.link { border: none; background: none; padding: 4px 6px; min-height: 0; color: var(--blauw); text-decoration: underline; font-weight: 500; }
button.danger { color: var(--rood-tekst); }

input, select {
  font: inherit;
  padding: 10px 12px;
  border: 1.5px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  min-height: 46px;
  width: 100%;
}

.card {
  display: block;
  background: var(--card);
  border-radius: 16px;
  padding: 12px 12px 14px;
  margin-bottom: 10px;
  color: inherit;
  text-decoration: none;
}

/* ---------- chips ---------- */

.team-chip { background: var(--ink); color: #fff; border-radius: 6px; padding: 2px 8px; font-weight: 700; font-size: 12px; }
.indoor-chip { border: 1px solid var(--line-strong); color: var(--ink-soft); border-radius: 6px; padding: 0 6px; font-weight: 700; font-size: 12px; }
.test-chip { background: var(--geel); color: var(--ink); border-radius: 6px; padding: 2px 8px; font-weight: 700; font-size: 12px; }
.live-dot { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--rood-tekst); font-weight: 800; }
.live-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--rood); }

/* ---------- the scorebug ---------- */

.bugwrap { display: flex; flex-direction: column; align-items: center; }

.bug {
  width: 100%;
  background: var(--blauw);
  color: #fff;
  display: grid;
  align-items: center;
}
.bug .tn {
  font-stretch: var(--condensed);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.bug .n { font-stretch: var(--narrow); font-weight: 900; line-height: 0.95; font-variant-numeric: tabular-nums; }
.bug .dash { opacity: 0.45; font-weight: 700; }

/* Big: match screen */
.bug.big {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  border-radius: 18px;
  padding: 14px 14px 0;
}
.bug.big .side { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.bug.big .tn { font-size: 17px; max-width: 100%; opacity: 0.92; }
.bug.big .n { font-size: clamp(80px, 26vw, 120px); }
.bug.big .dash { font-stretch: var(--narrow); font-size: 44px; padding: 0 4px 30px; }
.bug.big .bar { height: 6px; width: 64px; border-radius: 3px 3px 0 0; }
.bug.big .ours .bar { background: var(--geel); }

/* Mini: cards on Live and Wedstrijden */
.bug.mini {
  grid-template-columns: minmax(0, 1fr) auto auto auto minmax(0, 1fr);
  gap: 8px;
  border-radius: 12px;
  padding: 8px 12px;
}
.bug.mini .tn { font-size: 16px; }
.bug.mini .tn.home { text-align: right; }
.bug.mini .tn.ours { color: var(--geel); }
.bug.mini .n { font-size: 40px; }
.bug.mini .dash { font-size: 22px; }

.clock {
  background: var(--geel);
  color: var(--ink);
  border-radius: 0 0 12px 12px;
  padding: 5px 16px 7px;
  font-stretch: var(--condensed);
  font-weight: 800;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}
.clock span { font-weight: 600; }
.clock.break { background: var(--ink); color: #fff; }
.clock.swap { background: #fff; color: var(--blauw); box-shadow: inset 0 0 0 3px var(--geel); }
.bug.mini + .clock { font-size: 15px; padding: 3px 12px 4px; border-radius: 0 0 9px 9px; }

/* A new goal flips the number once, like a stadium board. */
@keyframes flip {
  from { transform: rotateX(90deg); opacity: 0.2; }
  to { transform: none; opacity: 1; }
}
.bug .n.bump { animation: flip 0.35s ease-out; }
@media (prefers-reduced-motion: reduce) {
  .bug .n.bump { animation: none; }
}

.scorers-line {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 8px;
  font-size: 15px;
  font-weight: 600;
}
.scorers-line em { font-style: normal; font-stretch: var(--condensed); font-weight: 800; color: var(--blauw); margin-left: 4px; }
.scorers-line .unknown { color: var(--ink-soft); }

/* ---------- match cards ---------- */

.match .meta { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--ink-soft); flex-wrap: wrap; padding: 0 2px 8px; }
.match .teams { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 10px; font-size: 16px; font-weight: 600; }
.match .teams span:first-child { text-align: right; }
.match .teams .ours { font-weight: 800; }
.match .teams .dash { color: var(--ink-soft); }
.match .veld { font-size: 13px; color: var(--ink-soft); margin-top: 6px; text-align: center; }
.match.status-cancelled { opacity: 0.5; }

.live-grid { display: grid; gap: 10px; }
@media (min-width: 640px) { .live-grid { grid-template-columns: 1fr 1fr; } }

.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { padding: 6px 14px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--line-strong); color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 600; }
.pill.on { background: var(--ink); border-color: var(--ink); color: #fff; }
button.pill { min-height: 38px; }
.login .lang-picker { margin-bottom: 16px; }

/* ---------- match screen ---------- */

.live-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; color: var(--ink-soft); margin-bottom: 10px; }

.pads { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 10px; }
.plus {
  font-stretch: var(--condensed);
  font-size: 52px;
  font-weight: 900;
  line-height: 1;
  min-height: 27vh;
  border: none;
  border-radius: 18px;
  background: var(--blauw);
  color: #fff;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.25);
  touch-action: manipulation;
}
.plus small { display: block; font-size: 14px; font-weight: 700; font-stretch: 100%; opacity: 0.85; margin-top: 4px; }
.plus.ours { background: var(--geel); color: var(--ink); box-shadow: inset 0 -6px 0 rgba(19, 35, 58, 0.18); }
.plus:active:not(:disabled) { transform: translateY(3px); box-shadow: none; }

.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.actions > .next { flex: 1.3; }
.phase-back { display: block; margin: 6px auto 0; font-size: 14px; }

.log { list-style: none; padding: 0 14px; margin: 0; background: var(--card); border-radius: 14px; }
.log li { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); font-size: 15px; }
.log li:first-child { border-top: none; }
.log .time { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.log .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--blauw); flex: none; }
.log .dot.ours { background: var(--geel); box-shadow: inset 0 0 0 1px rgba(19, 35, 58, 0.25); }
.log .side { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log .other { font-size: 12px; color: var(--ink-soft); }
.log .after { font-stretch: var(--condensed); font-weight: 800; font-variant-numeric: tabular-nums; }
.log li.pending { opacity: 0.6; }
.log li.empty { justify-content: center; }

/* ---------- scorer picker ---------- */

.sheet-backdrop { position: fixed; inset: 0; background: rgba(19, 35, 58, 0.45); z-index: 20; }
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 21;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  max-height: 70vh;
  overflow-y: auto;
}
.sheet h3 { margin-top: 0; font-size: 22px; }
.players { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-bottom: 12px; }
.players button { min-height: 56px; font-weight: 700; font-size: 17px; }

/* ---------- stats ---------- */

.stats { width: 100%; border-collapse: collapse; text-align: center; font-variant-numeric: tabular-nums; }
.stats th { font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.stats td { font-stretch: var(--condensed); font-size: 26px; font-weight: 800; padding: 2px 0; }
.scorers { padding-left: 22px; margin: 0; }
.scorers li { padding: 5px 0; border-bottom: 1px solid var(--line); }
.scorers li:last-child { border-bottom: none; }
.scorers li span { display: inline-block; min-width: 60%; font-weight: 600; }
.scorers li strong { font-stretch: var(--condensed); font-weight: 800; color: var(--blauw); }

/* ---------- settings ---------- */

.roster { list-style: none; padding: 0; margin: 0 0 10px; }
.roster li { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.roster li.inactive > span:first-child { color: var(--ink-soft); text-decoration: line-through; }
.roster .actions { display: flex; gap: 4px; }
.roster form.edit-player { width: 100%; padding: 4px 0; }
form.inline { display: flex; gap: 8px; }
form.inline input { flex: 1; }
form.stack { display: grid; gap: 8px; }
.check { display: flex; gap: 8px; align-items: center; }
.check input { width: auto; min-height: 0; }
.prefs { margin-bottom: 12px; }
.prefs .check { min-height: 40px; }
.prefs .check input { width: 22px; height: 22px; accent-color: var(--blauw); }

/* ---------- login ---------- */

.login { max-width: 360px; margin: 40px auto; }
.login-icon { display: block; border-radius: 18px; margin-bottom: 14px; }
.login h1 { font-stretch: var(--condensed); font-weight: 900; font-size: 44px; margin: 0 0 12px; }
.login form { display: grid; gap: 10px; }
.error { color: var(--rood-tekst); min-height: 1.2em; }

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 14px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  z-index: 30;
  max-width: calc(100% - 32px);
  font-size: 14px;
  font-weight: 600;
}

/* ---------- bottom nav ---------- */

nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--card);
  border-top: 1px solid var(--line);
}
nav[hidden] { display: none; }
nav a { display: flex; align-items: center; justify-content: center; color: var(--ink-soft); text-decoration: none; font-size: 14px; font-weight: 600; }
nav a.on { color: var(--blauw); font-weight: 800; box-shadow: inset 0 3px 0 var(--geel); }
.card > h2:first-child { margin-top: 2px; }

/* Share button on the match screen; the public watch page */
.share-row { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 14px 0 6px; flex-wrap: wrap; }
body.watch { padding-bottom: 24px; }
.watch-note { text-align: center; margin-top: 14px; }
