/* Schriften lokal (offline + keine Anfragen an Google) */
@font-face { font-family: 'Big Shoulders'; font-weight: 700 800; font-display: swap; src: url(fonts/BigShoulders.woff2) format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 400; font-display: swap; src: url(fonts/Barlow-400.woff2) format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 600; font-display: swap; src: url(fonts/Barlow-600.woff2) format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 700; font-display: swap; src: url(fonts/Barlow-700.woff2) format('woff2'); }

/* Papier und Tinte, Ligafarben wie Linien auf dem Hallenboden */
:root {
  --paper: #efeadf; --card: #faf8f2; --ink: #1a1813; --muted: #6f685a; --line: #d8d0bf;
  --board: #1a1813; --led: #f6e7a8; --signal: #d9502a; --ok: #2c7a4b; --mark: #ffe064;
  --D: #b02a52; --H: #1f5ea8; --M: #2c7a4b;
  --display: 'Big Shoulders', 'Arial Narrow', sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #13120e; --card: #1c1a15; --ink: #eee8d9; --muted: #9a9281; --line: #322e25;
    --board: #0b0a08; --led: #f6e7a8; --signal: #f07a4f; --ok: #6cc08c; --mark: #6b5a12;
    --D: #e77b99; --H: #74a7ea; --M: #6cc08c;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.45 Barlow, system-ui, sans-serif; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h2, h3 { font-family: var(--display); font-weight: 800; text-transform: uppercase; letter-spacing: .02em; line-height: 1; }
h2 { font-size: 1.7rem; margin: 1.3rem 0 .6rem; }
h3 { font-size: 1.2rem; margin: 0 0 .5rem; }
p { margin: .4rem 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* Kopf */
header.top { position: sticky; top: 0; z-index: 20; background: var(--board); color: var(--paper); padding: calc(10px + env(safe-area-inset-top)) 16px 9px; display: flex; align-items: center; gap: 12px; border-bottom: 3px solid var(--signal); }
header.top h1 { font: 800 1.35rem/1 var(--display); text-transform: uppercase; letter-spacing: .03em; margin: 0; flex: 1; }
@media (prefers-color-scheme: dark) { header.top { color: var(--ink); } }
.pill { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; display: inline-flex; align-items: center; gap: 6px; opacity: .85; }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: #9a9281; }
.pill.live i { background: #6cc08c; animation: blink 2.4s infinite; }
.pill.off i { background: var(--signal); }
@keyframes blink { 50% { opacity: .25; } }

main { max-width: 720px; margin: 0 auto; padding: 4px 16px 28px; }

/* Navigation unten */
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
nav.tabs a { flex: 1; min-width: 0; text-align: center; text-decoration: none; color: var(--muted); font-size: .68rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: 8px 2px 9px; display: flex; flex-direction: column; align-items: center; gap: 3px; border-top: 3px solid transparent; margin-top: -1px; }
nav.tabs a svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
nav.tabs a.on { color: var(--ink); border-top-color: var(--ink); }

/* Umschalter */
.chips { display: flex; gap: 0; overflow-x: auto; margin: 12px 0 4px; scrollbar-width: none; border: 1.5px solid var(--ink); border-radius: 6px; width: max-content; max-width: 100%; }
.chips::-webkit-scrollbar { display: none; }
.chip { border: 0; border-right: 1.5px solid var(--ink); background: transparent; padding: 7px 14px; white-space: nowrap; font: 700 .95rem/1.1 var(--display); text-transform: uppercase; letter-spacing: .05em; }
.chip:last-child { border-right: 0; }
.chip.on { background: var(--ink); color: var(--paper); }
.chip.D.on { background: var(--D); color: #fff; } .chip.H.on { background: var(--H); color: #fff; } .chip.M.on { background: var(--M); color: #fff; }
.chips.spaced { margin-top: 8px; }

/* Karten, Banner */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; margin: 12px 0; }
.banner { background: var(--board); color: #f3eee2; border-radius: 6px; padding: 14px 16px; margin: 14px 0 10px; }
.banner b { display: block; font: 800 1.6rem/1.05 var(--display); text-transform: uppercase; letter-spacing: .02em; }
.banner .sub { color: var(--led); font-size: .92rem; margin-top: 4px; font-variant-numeric: tabular-nums; }
.banner.mine { background: var(--mark); color: #1a1813; }
.banner.mine .sub { color: #4a4330; }
.next { border-left: 4px solid var(--signal); }
.next b { text-transform: uppercase; font-size: .75rem; letter-spacing: .08em; color: var(--signal); display: block; }

/* Rundenkopf: Uhrzeit wie auf dem Aushang */
.round-h { display: flex; align-items: baseline; gap: 10px; margin: 22px 0 8px; }
.round-h::after { content: ""; flex: 1; border-bottom: 1.5px solid var(--ink); transform: translateY(-4px); }
.round-h .time { font: 800 1.9rem/1 var(--display); font-variant-numeric: tabular-nums; }
.round-h .rn { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.hall-h { margin: 16px 0 6px; font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* Spiel */
.game { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: 6px; padding: 9px 10px 10px 12px; margin: 8px 0; position: relative; }
.game.D { border-left-color: var(--D); } .game.H { border-left-color: var(--H); } .game.M { border-left-color: var(--M); }
.game .gh { display: flex; align-items: baseline; gap: 8px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; flex-wrap: wrap; padding-right: 76px; }
.game .gh b { color: var(--ink); }
.game .gh > * + *::before { content: "·"; margin-right: 8px; color: var(--line); }
.game .gh .hall { flex-basis: 100%; margin-top: -3px; font-weight: 600; letter-spacing: .04em; }
.game .gh .hall::before { content: none; }
.lg-D { color: var(--D); } .lg-H { color: var(--H); } .lg-M { color: var(--M); }
.phase { color: var(--ink); }
.phase.hot { color: var(--signal); }
.game .tm { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 2px 0; font-size: 1.06rem; font-weight: 600; }
.game .tm > span:first-child { min-width: 0; }
.game .pt { font: 800 1.3rem/1 var(--display); font-variant-numeric: tabular-nums; min-width: 2.1em; height: 1.45em; display: inline-grid; place-items: center; padding: 0 4px; border-radius: 3px; background: var(--board); color: var(--led); }
.game .pt.empty { background: transparent; color: var(--muted); border: 1px dashed var(--line); }
.game .tm.ph { color: var(--muted); font-weight: 400; }
.game.done .tm.lose { color: var(--muted); font-weight: 400; }
.game.done .tm.lose .pt { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.mine > span:first-child, .ref.mine span { background: linear-gradient(transparent 52%, var(--mark) 52%, var(--mark) 92%, transparent 92%); padding: 0 2px; margin: 0 -2px; }
.game .ref { font-size: .82rem; color: var(--muted); margin-top: 6px; }
.game.flash { animation: flash 2.2s ease-out; }
@keyframes flash { 0%, 35% { box-shadow: 0 0 0 3px var(--ok); } 100% { box-shadow: none; } }
.game.now { border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.game .edit { position: absolute; right: 8px; top: 7px; border: 1.5px solid var(--ink); background: var(--card); border-radius: 4px; padding: 3px 10px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.game.done .edit { border-color: var(--line); color: var(--muted); }

/* Mein Team: Zeitleiste */
.evt { display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: start; }
.evt .t { font: 800 1.25rem/1 var(--display); padding-top: 14px; font-variant-numeric: tabular-nums; }
.evt.pause .t { color: var(--muted); font-weight: 700; font-size: 1rem; padding-top: 6px; }
.evt.pause .body { color: var(--muted); font-size: .88rem; padding: 5px 0; border-bottom: 1px dotted var(--line); }
.evt .refbox { border: 1.5px dashed var(--muted); border-radius: 6px; padding: 9px 12px; margin: 8px 0; font-size: .95rem; }
.evt .refbox b { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 2px; }
.walk { display: block; margin: 8px 0 -4px; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--signal); }
.evt.past { opacity: .5; }
.evt.cur .game, .evt.cur .refbox { border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.day-h { font: 800 1.1rem/1 var(--display); text-transform: uppercase; letter-spacing: .12em; margin: 26px 0 4px; padding-bottom: 6px; border-bottom: 3px double var(--ink); }
.team-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.team-btn { text-align: left; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: 6px; padding: 13px 14px; font-weight: 600; }
.team-btn.D { border-left-color: var(--D); } .team-btn.H { border-left-color: var(--H); } .team-btn.M { border-left-color: var(--M); }
.team-btn:active { background: var(--mark); }
.team-list + h3 { margin-top: 1.6rem; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); border: 1.5px solid var(--ink); border-radius: 6px; margin: 10px 0; }
.kpi { padding: 8px 6px 7px; text-align: center; border-right: 1.5px solid var(--ink); }
.kpi:last-child { border-right: 0; }
.kpi b { display: block; font: 800 1.7rem/1 var(--display); font-variant-numeric: tabular-nums; }
.kpi span { font-size: .66rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

/* Tabellen */
table.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); text-align: right; padding: 6px 5px; border-bottom: 1.5px solid var(--ink); }
.tbl td { padding: 9px 5px; border-bottom: 1px solid var(--line); text-align: right; }
.tbl th:nth-child(2), .tbl td:nth-child(2) { text-align: left; }
.tbl td:first-child { font: 800 1.2rem/1 var(--display); text-align: left; width: 1.9em; }
.tbl td:nth-child(2) { font-weight: 600; line-height: 1.2; }
.tbl tr.mine td:nth-child(2) span { background: linear-gradient(transparent 52%, var(--mark) 52%, var(--mark) 92%, transparent 92%); }
.tbl .tiemark { color: var(--signal); }
.prog { font-size: .8rem; color: var(--muted); margin: -4px 0 8px; }
.note { border-left: 4px solid var(--signal); background: var(--card); padding: 9px 12px; border-radius: 4px; margin: 10px 0; font-size: .9rem; }
.final { list-style: none; padding: 0; margin: 0; }
.final li { display: flex; gap: 12px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--line); font-weight: 600; }
.final li b { font: 800 1.4rem/1 var(--display); width: 1.4em; }
.final li:first-child { font-size: 1.15rem; }
.final li:first-child b { color: var(--signal); }

/* Info, Formulare */
.card ul { padding-left: 1.1rem; margin: .3rem 0; }
.card li { margin: .3rem 0; }
input[type=password], input[type=number] { width: 100%; padding: 12px; border: 1.5px solid var(--ink); border-radius: 6px; background: var(--paper); }
.btn { border: 1.5px solid var(--ink); border-radius: 6px; padding: 11px 18px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: .9rem; background: var(--ink); color: var(--paper); }
.btn.sec { background: transparent; color: var(--ink); }
.btn.danger { background: transparent; color: var(--signal); border-color: var(--signal); }
.btn.wide { width: 100%; }
.btn.mini { padding: 4px 10px; margin-left: 6px; font-size: .75rem; }
.row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.err { color: var(--signal); min-height: 1.3em; font-size: .9rem; }

/* Eingabe-Sheet */
.sheet-bg { position: fixed; inset: 0; background: rgba(15, 13, 9, .55); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); width: 100%; max-width: 560px; border-radius: 10px 10px 0 0; border-top: 3px solid var(--signal); padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); }
.sheet .in { display: grid; grid-template-columns: 1fr 92px; gap: 10px; align-items: center; margin: 10px 0; }
.sheet .in label { font-weight: 700; font-size: 1.08rem; }
.sheet .in input { font: 800 2rem/1 var(--display); text-align: center; padding: 8px 4px; background: var(--board); color: var(--led); border-color: var(--board); }
.sheet .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.sheet .actions .btn.danger { grid-column: 1 / -1; }
.orderlist { list-style: none; padding: 0; margin: 8px 0; }
.orderlist li { display: flex; align-items: center; gap: 8px; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.orderlist li span { flex: 1; font-weight: 600; }
.orderlist button { border: 1.5px solid var(--ink); background: transparent; border-radius: 4px; width: 40px; height: 36px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(76px + env(safe-area-inset-bottom)); background: var(--board); color: var(--led); padding: 10px 16px; border-radius: 6px; z-index: 60; max-width: 90%; font-weight: 600; }
[hidden] { display: none !important; }
