/* Badminton-Liveticker DIBVM
   Farbwelt: Vereinsrot (#D82020), Weiß und Schwarz wie auf dibvm.de. Feldlinien als Motiv im Kopf.
   Keine externen Schriften (DSGVO). */
:root {
  --club: #d82020;        /* Vereinsrot */
  --club-deep: #a8161a;
  --club-lift: #e53a3a;
  --club-tint: rgba(216, 32, 32, .12);
  --chalk: #ffffff;
  --ink: #1c1a1a;         /* Schwarz der Trikots */
  --ink-lift: #3a3535;
  --paper: #f4f2f2;
  --muted: #6b6363;
  --rule: #e2dcdc;
  --danger: #d82020;
  --radius-s: 6px;
  --radius-m: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--paper); line-height: 1.45; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--club); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 5px #fff; }
.num { font-variant-numeric: tabular-nums; }
.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 520px; }
h1, h2, h3 { line-height: 1.15; margin: 0; }
code { background: #fff; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--rule); }

/* ---------- Kopf mit Feldlinien ---------- */
.court-head {
  position: relative;
  color: var(--chalk);
  background-color: var(--club);
  /* Aufschlaglinien und Mittellinie eines Badmintonfelds */
  background-image:
    linear-gradient(90deg, transparent calc(50% - 1px), rgba(255,255,255,.6) calc(50% - 1px), rgba(255,255,255,.6) calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(0deg, transparent 7px, rgba(255,255,255,.4) 7px, rgba(255,255,255,.4) 9px, transparent 9px),
    linear-gradient(180deg, transparent 7px, rgba(255,255,255,.4) 7px, rgba(255,255,255,.4) 9px, transparent 9px);
  border-bottom: 4px solid var(--chalk);
  padding: max(18px, env(safe-area-inset-top)) 0 18px;
}
.court-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; }
.brand small { display: block; font-weight: 500; font-size: .85rem; opacity: .8; }
.head-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.head-nav a, .head-nav button {
  color: var(--chalk); text-decoration: none; background: rgba(0,0,0,.18); border: 1px solid rgba(255,255,255,.4);
  border-radius: 999px; padding: 6px 14px; font-size: .9rem; cursor: pointer;
}
.head-nav a:hover, .head-nav button:hover { background: rgba(0,0,0,.3); }

/* ---------- Buttons & Formulare ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 2px solid var(--ink); background: var(--ink); color: var(--chalk);
  border-radius: var(--radius-s); padding: 10px 18px; font-weight: 700; cursor: pointer; text-decoration: none;
  touch-action: manipulation;
}
.btn:hover { background: var(--ink-lift); border-color: var(--ink-lift); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: #fff; color: var(--ink); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-club { background: var(--club); border-color: var(--club); color: #fff; }
.btn-club:hover { background: var(--club-deep); border-color: var(--club-deep); color: #fff; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

label.field { display: block; margin: 0 0 14px; }
label.field span { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=datetime-local] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--rule); border-radius: var(--radius-s); background: #fff;
}
input:focus { border-color: var(--club); outline: none; box-shadow: 0 0 0 3px var(--club-tint); }
.radio-row { display: flex; gap: 18px; margin-bottom: 14px; }
.radio-row label { display: flex; gap: 6px; align-items: center; cursor: pointer; }

.notice { background: #fff; border-left: 4px solid var(--club); padding: 10px 14px; border-radius: var(--radius-s); margin: 14px 0; }
.notice p { margin: 4px 0; }
.notice-error { border-left-color: var(--danger); }

/* ---------- Admin ---------- */
.admin-main { padding: 24px 0 64px; }
.step { background: #fff; border-radius: var(--radius-m); margin-bottom: 18px; border: 1px solid var(--rule); }
.step > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.step > summary::-webkit-details-marker { display: none; }
.step-no {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--club); color: var(--chalk); font-weight: 800;
}
.step > summary h2 { font-size: 1.15rem; }
.step > summary .hint { margin-left: auto; color: var(--muted); font-size: .85rem; }
.step-body { padding: 0 18px 20px; border-top: 1px solid var(--rule); padding-top: 18px; }

.lineup { width: 100%; border-collapse: collapse; }
.lineup th { text-align: left; font-size: .9rem; padding: 6px 4px; }
.lineup td { padding: 4px; vertical-align: middle; }
.lineup tr + tr td { border-top: 1px solid var(--rule); }
.lineup td.code { font-weight: 800; width: 56px; color: var(--club); }
.lineup input { padding: 7px 9px; }
.lineup input + input { margin-top: 4px; }
.lineup-scroll { overflow-x: auto; }
.lineup-scroll table { min-width: 520px; }

.scores td input { width: 3.4em; text-align: center; padding: 7px 4px; }
.scores .set { white-space: nowrap; }
.scores .set span { color: var(--muted); padding: 0 2px; }

.link-list { display: grid; gap: 8px; }
.link-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: var(--radius-s); }
.link-item strong { min-width: 150px; }
.link-item code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 0; background: none; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--paper); border-radius: 999px; padding: 4px 6px 4px 12px; font-size: .9rem; }
.chip button { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 1rem; padding: 0 6px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--chalk);
  padding: 10px 18px; border-radius: 999px; font-weight: 600; z-index: 50; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }
.toast.err { background: var(--danger); }

/* ---------- Liveticker (Fans) ---------- */
.live-main { padding: 0 0 48px; }
.tally {
  background: var(--ink); color: var(--chalk); padding: 22px 0 26px; text-align: center;
}
.tally-meta { opacity: .8; font-size: .95rem; }
.tally-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; margin-top: 10px; }
.tally-row .team { font-weight: 700; font-size: clamp(1rem, 3.5vw, 1.4rem); }
.tally-row .team.home { text-align: right; }
.tally-row .team.away { text-align: left; }
.tally-score { font-size: clamp(3rem, 12vw, 5rem); font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,.35); margin-right: 6px; vertical-align: middle; }
.offline .status-dot { background: var(--ink); }

.games { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 10px; }
.game {
  display: grid; grid-template-columns: 64px 1fr; background: #fff; border-radius: var(--radius-m);
  border: 1px solid var(--rule); overflow: hidden;
}
.game .code {
  display: grid; place-items: center; font-weight: 800; color: var(--ink); background: var(--paper);
  border-right: 2px solid var(--chalk); font-size: .95rem; text-align: center; line-height: 1.1;
}
.game.running .code { background: var(--club); color: var(--chalk); }
.game.running .code small { color: #fff; opacity: .9; }
.game .code small { display: block; font-weight: 600; font-size: .7rem; margin-top: 3px; }
.game .sides { padding: 8px 12px; }
.game .side { display: flex; align-items: center; min-height: 40px; gap: 8px; }
.game .side + .side { border-top: 1px solid var(--rule); }
.game .names { flex: 1; font-size: .95rem; }
.game .names .empty { color: var(--muted); }
.game .side.win .names { font-weight: 700; }
.game .setcol { display: grid; grid-auto-flow: column; grid-auto-columns: 38px; }
.game .setcol .pt { display: grid; place-items: center; min-height: 40px; font-weight: 600; color: var(--muted); }
.game .setcol .pt.cur { color: var(--ink); font-weight: 800; background: var(--club-tint); }
.game .setcol .pt.w { color: var(--ink); font-weight: 800; }

/* ---------- Ticker-Steuerung (Handy) ---------- */
.tk { min-height: 100dvh; display: flex; flex-direction: column; background: var(--paper); color: var(--ink); }
.tk-view { flex: 1; display: flex; flex-direction: column; }
.tk-bar {
  display: flex; align-items: center; gap: 10px; padding: max(10px, env(safe-area-inset-top)) 12px 10px;
  background: var(--club); color: var(--chalk); border-bottom: 3px solid var(--chalk);
}
.tk-bar h1 { font-size: 1rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-bar button { flex: none; background: rgba(0,0,0,.2); color: var(--chalk); border: 1px solid rgba(255,255,255,.4); border-radius: 999px; padding: 6px 10px; font-size: .85rem; cursor: pointer; }
.tk-list { padding: 12px; display: grid; gap: 10px; }
.tk-pick {
  width: 100%; text-align: left; background: #fff; border: 1px solid var(--rule); border-radius: var(--radius-m);
  padding: 0; cursor: pointer; overflow: hidden; display: grid; grid-template-columns: 64px 1fr;
}
.tk-pick .code { display: grid; place-items: center; background: var(--paper); font-weight: 800; color: var(--ink); }
.tk-pick .body { display: block; padding: 10px 12px; }
.tk-pick .pair { display: block; }
.tk-pick .pair { font-size: .95rem; }
.tk-pick .pair span { display: block; }
.tk-pick .pair span + span { border-top: 1px solid var(--rule); margin-top: 4px; padding-top: 4px; }
.tk-pick .state { display: block; font-size: .8rem; color: var(--muted); margin-top: 6px; }
.tk-pick.on .code { background: var(--club); color: var(--chalk); }
.tk-pick.done { opacity: .7; }
.tk-court { background: #fff; border: 2px solid var(--ink); border-radius: var(--radius-m); padding: 22px; font-size: 1.2rem; font-weight: 800; cursor: pointer; text-align: left; display: flex; justify-content: space-between; align-items: center; }
.tk-court { gap: 12px; }
.tk-court > span { white-space: nowrap; }
.tk-court em { font-style: normal; font-weight: 700; color: var(--ink); }
.tk-court.busy { border-color: var(--rule); color: var(--muted); }
.tk-court.busy em { color: var(--danger); text-align: right; }
.tk-court em small { display: block; font-size: .75rem; font-weight: 600; color: var(--muted); margin-top: 2px; }
.tk-sub { color: var(--muted); font-size: .9rem; padding: 0 2px; }

.tk-score { flex: 1; display: flex; flex-direction: column; }
.tk-prev { display: flex; justify-content: center; gap: 14px; padding: 14px 0 0; color: var(--muted); font-weight: 700; min-height: 36px; }
.tk-now { flex: 1; display: grid; grid-template-columns: 1fr 1fr; align-items: center; text-align: center; }
.tk-now .pts { font-size: clamp(5rem, 30vw, 11rem); font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.tk-now .pts.last { color: var(--club); }
.tk-now .sets { font-size: 1rem; color: var(--muted); font-weight: 700; }
.tk-tools { display: flex; justify-content: center; gap: 12px; padding: 8px; }
.tk-tools button { width: 56px; height: 48px; border-radius: var(--radius-s); border: 1px solid var(--rule); background: #fff; color: var(--ink); font-size: 1.4rem; cursor: pointer; touch-action: manipulation; }
.tk-tools button.wide { width: auto; padding: 0 16px; font-size: 1rem; font-weight: 700; }
.tk-tools button[disabled] { opacity: .35; }
.tk-plus { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 10px max(12px, env(safe-area-inset-bottom)); }
.tk-plus button {
  border: 0; border-radius: var(--radius-m); min-height: 34vh; cursor: pointer; touch-action: manipulation;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 12px 8px;
  -webkit-user-select: none; user-select: none;
}
.tk-plus .h { background: var(--club); color: #fff; }
.tk-plus .a { background: var(--ink); color: var(--chalk); }
.tk-plus button:active { filter: brightness(1.25); transform: scale(.985); }
.tk-plus button[disabled] { opacity: .45; cursor: not-allowed; }
.tk-plus button[disabled]:active { filter: none; transform: none; }
.tk-plus .nm { font-size: .85rem; line-height: 1.25; opacity: .9; }
.tk-plus .plus { font-size: 4.5rem; font-weight: 300; line-height: 1; color: #fff; }
.tk-plus .tm { font-size: .8rem; font-weight: 700; opacity: .75; }

.modal { position: fixed; inset: 0; background: rgba(28,26,26,.6); display: grid; place-items: center; z-index: 40; padding: 20px; }
.modal-box { background: #fff; border-radius: var(--radius-m); padding: 22px; max-width: 360px; width: 100%; text-align: center; }
.modal-box h2 { font-size: 1.2rem; margin-bottom: 8px; }
.modal-box p { margin: 6px 0; }
.modal-box { color: var(--ink); }
.modal-box .btn-row { justify-content: center; }
.btn-col { flex-direction: column; }
.btn-col .btn { width: 100%; }
.gate { padding: 40px 20px; text-align: center; }

/* ---------- Anzeigetafel (Beamer) ---------- */
.board-page #root { height: 100%; }
.board-page { margin: 0; background: #000; color: #fff; height: 100vh; height: 100dvh; overflow: hidden; cursor: pointer; }
.board { height: 100%; display: grid; grid-template-columns: 1fr auto minmax(0, 30vw); gap: 2vw; padding: 4vh 3vw; }
.board .teams { display: grid; grid-template-rows: 1fr 1fr; min-width: 0; }
.board .team { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.board .team small { font-size: 3.6vh; color: #b5b5b5; font-weight: 600; }
.board .team .pl { font-size: 11vh; font-weight: 800; line-height: 1.02; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board.single .team .pl { font-size: 14vh; }
.board .mid { display: grid; grid-template-rows: 1fr auto 1fr; text-align: center; align-items: center; }
.board .mid .sw { font-size: 16vh; font-weight: 700; line-height: 1; }
.board .mid .code { font-size: 9vh; font-weight: 800; }
.board .mid .prev { font-size: 3.4vh; color: #b5b5b5; font-weight: 600; }
.board .pts { display: grid; grid-template-rows: 1fr 1fr; gap: 2.4vh; }
.board .pts div { background: #2f2f2f; display: grid; place-items: center; font-size: 34vh; font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.board .pts div.last { background: var(--club); color: #fff; }
.board-idle { height: 100%; display: grid; place-items: center; text-align: center; padding: 4vh; }
.board-idle .big { font-size: 12vh; font-weight: 800; line-height: 1.05; }
.board-idle .sub { font-size: 4.5vh; color: #b5b5b5; margin-top: 2vh; }
.board-idle .sc { font-size: 20vh; font-weight: 800; margin-top: 3vh; }
.vs { height: 100%; display: grid; grid-template-rows: auto 1fr; padding: 5vh 4vw; }
.vs .code { text-align: center; font-size: 6vh; font-weight: 800; color: var(--club-lift); }
.vs .row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 3vw; }
.vs .side small { display: block; font-size: 3.6vh; color: #b5b5b5; font-weight: 600; margin-bottom: 1vh; }
.vs .side { min-width: 0; }
.vs .side div { font-size: 9vh; font-weight: 800; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vs .side.r { text-align: right; }
.vs .x { font-size: 12vh; font-weight: 300; color: #888; }
.board-split { height: 100%; display: grid; grid-template-rows: auto 1fr 1fr; }
.board-split .tot { text-align: center; font-size: 5vh; font-weight: 700; padding: 1.5vh 0; background: var(--club); }
.board-split > section { border-top: 1vh solid #000; min-height: 0; position: relative; }
.board-split .board { padding: 2vh 3vw; }
.board-split .board .team small { font-size: 2.4vh; }
.board-split .board .team .pl { font-size: 5.6vh; }
.board-split .board .mid .sw { font-size: 8vh; }
.board-split .board .mid .code { font-size: 4.5vh; }
.board-split .board .mid .prev { font-size: 2.2vh; }
.board-split .board .pts { gap: 1.2vh; }
.board-split .board .pts div { font-size: 16vh; }
.board-split .board-idle .big { font-size: 7vh; }
.board-split .board-idle .sub { font-size: 3vh; }
.board-split .feldtag { position: absolute; top: 1vh; left: 1vw; font-size: 2.2vh; color: #888; font-weight: 700; }
.board-conn { position: fixed; right: 1vw; bottom: 1vh; font-size: 1.8vh; color: #666; }

/* Auswahlseite der Anzeigetafel */
.pick-main { padding: 26px 0 48px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 14px 0 22px; }
.pick-grid .btn { padding: 22px 14px; font-size: 1.1rem; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--club); }
.check small { display: block; color: var(--muted); }

@media (max-width: 560px) {
  .game { grid-template-columns: 52px 1fr; }
  .game .setcol { grid-auto-columns: 32px; }
  .link-item { flex-wrap: wrap; }
  .link-item strong { min-width: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
