:root {
  --bg: #0a1710;
  --bg2: #0f2018;
  --card: #132a1f;
  --card2: #183427;
  --line: #24493a;
  --text: #eaf6ee;
  --muted: #94b3a2;
  --accent: #35e07a;
  --accent-ink: #062611;
  --live: #ff4646;
  --warn: #ffc845;
  --miss: #ff6b6b;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
body { min-height: 100vh; display: flex; flex-direction: column;
  background: radial-gradient(1200px 500px at 50% -200px, #174a2e 0%, transparent 70%), var(--bg); }
a { color: var(--accent); }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
main.wrap { flex: 1; padding-top: 18px; padding-bottom: 32px; }
h2 { font-size: 1.15rem; letter-spacing: .02em; margin: 26px 0 12px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
h2:first-child { margin-top: 4px; }
h3 { margin: 0 0 10px; font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* Kopf */
.top { position: sticky; top: 0; z-index: 20; background: rgba(10, 23, 16, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top-inner { max-width: 1180px; margin: 0 auto; padding: 12px 16px 6px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ball { font-size: 2rem; line-height: 1; }
.brand h1 { margin: 0; font-size: 1.35rem; font-weight: 800; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { display: flex; gap: 10px; font-size: .8rem; color: var(--muted); margin-top: 2px; flex-wrap: wrap; }
.conn::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--muted); vertical-align: 1px; }
.conn.on::before { background: var(--accent); box-shadow: 0 0 0 3px rgba(53, 224, 122, .2); }
.conn.off::before { background: var(--live); }
.admin-box { display: flex; gap: 8px; align-items: center; font-size: .85rem; }
.tabs { max-width: 1180px; margin: 0 auto; padding: 0 10px; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600; padding: 10px 12px 12px; cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tab .dot { display: inline-block; width: 8px; height: 8px; background: var(--live); border-radius: 50%; margin-left: 6px; animation: pulse 1.4s infinite; vertical-align: 1px; }

/* Schaltflächen & Formulare */
.btn { appearance: none; border: 1px solid var(--line); background: var(--card2); color: var(--text); font: inherit; font-weight: 600; padding: 9px 14px; border-radius: 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
.btn:hover { border-color: #3a6d57; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { background: transparent; color: var(--miss); border-color: #6a2b2b; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 10px; font-size: .85rem; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: .85rem; color: var(--muted); }
input[type=text], input[type=password], input[type=number], textarea, select {
  background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font: inherit; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { width: 100%; min-height: 90px; resize: vertical; }
.check { display: flex; gap: 8px; align-items: center; font-size: .95rem; color: var(--text); }

/* Karten */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.grid { display: grid; gap: 14px; }
.grid.cols { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

/* Spiele */
.match { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; position: relative; }
.match.clickable { cursor: pointer; }
.match.clickable:hover { border-color: #3a6d57; }
.match .meta { grid-column: 1 / -1; display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); gap: 8px; }
.match .team { font-weight: 700; overflow-wrap: anywhere; }
.match .team.away { text-align: right; }
.match .team.win { color: var(--accent); }
.match .team.tbd { color: var(--muted); font-weight: 500; font-style: italic; }
.match .score { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.35rem; min-width: 74px; text-align: center; background: var(--bg2); border-radius: 10px; padding: 4px 10px; }
.match .score.pending { color: var(--muted); font-size: 1rem; font-weight: 600; }
.match.live { border-color: var(--live); box-shadow: 0 0 0 1px var(--live) inset; }
.match.live .score { background: #3a1212; }
.match.finished .score { background: #0d2a1c; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 2px 8px; border-radius: 999px; background: var(--card2); color: var(--muted); }
.badge.live { background: var(--live); color: #fff; }
.badge.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: pulse 1.2s infinite; }
.badge.done { background: #0d3a22; color: var(--accent); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.shots { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.shotrow { display: flex; gap: 4px; flex-wrap: wrap; min-height: 14px; }
.shotrow.away { justify-content: flex-end; }
.shot { width: 13px; height: 13px; border-radius: 50%; display: inline-block; }
.shot.hit { background: var(--accent); }
.shot.miss { background: transparent; border: 2px solid var(--miss); position: relative; }

/* Live-Ansicht groß */
.big { padding: 18px 18px 16px; }
.big .team { font-size: 1.35rem; }
.big .score { font-size: 2.4rem; min-width: 120px; padding: 6px 14px; }
.big .shot { width: 18px; height: 18px; }
.champion { text-align: center; padding: 26px 16px; background: linear-gradient(135deg, #1c4a30, #12261b); border: 1px solid #3b7a55; border-radius: var(--radius); }
.champion .trophy { font-size: 3rem; }
.champion .name { font-size: 2rem; font-weight: 900; margin: 6px 0; }
.podium { display: flex; justify-content: center; gap: 24px; flex-wrap: wrap; margin-top: 8px; color: var(--muted); }

/* Tabellen */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 6px; text-align: center; border-bottom: 1px solid var(--line); }
th { font-size: .75rem; color: var(--muted); font-weight: 700; text-transform: uppercase; }
td.name, th.name { text-align: left; width: 100%; font-weight: 600; }
td.pkt { font-weight: 800; }
tr.q td { background: rgba(53, 224, 122, .07); }
tr.q td:first-child { box-shadow: 3px 0 0 var(--accent) inset; }
.hide-sm { }
@media (max-width: 520px) { .hide-sm { display: none; } .big .team { font-size: 1.05rem; } .big .score { font-size: 1.8rem; min-width: 90px; } }

/* Filter-Chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { border: 1px solid var(--line); background: transparent; color: var(--muted); padding: 5px 12px; border-radius: 999px; font: inherit; font-size: .85rem; cursor: pointer; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }

/* K.O.-Baum */
.bracket { display: flex; gap: 18px; overflow-x: auto; padding-bottom: 10px; }
.bround { min-width: 250px; flex: 1; display: flex; flex-direction: column; }
.bround h3 { text-align: center; color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; }
.bmatches { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 12px; }
.bm { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.bm.live { border-color: var(--live); }
.bm.clickable { cursor: pointer; }
.bm .bt { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; align-items: center; }
.bm .bt + .bt { border-top: 1px solid var(--line); }
.bm .bt.win { color: var(--accent); font-weight: 800; }
.bm .bt.lose { color: var(--muted); }
.bm .bt .s { font-weight: 800; font-variant-numeric: tabular-nums; }
.bm .bt .info { color: var(--muted); font-size: .72rem; margin-right: 6px; }
.bm .bl { font-size: .7rem; color: var(--muted); padding: 4px 10px; background: var(--bg2); display: flex; justify-content: space-between; }

/* Admin */
.steps { display: grid; gap: 14px; }
.step h3 { display: flex; align-items: center; gap: 10px; }
.step h3 .n { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: inline-grid; place-items: center; font-size: .85rem; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; align-items: end; }
.groups-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-top: 12px; }
.gcol { background: var(--bg2); border: 1px dashed var(--line); border-radius: 12px; padding: 10px; min-height: 90px; }
.gcol.over { border-color: var(--accent); background: #10301f; }
.gcol h4 { margin: 0 0 8px; font-size: .9rem; display: flex; justify-content: space-between; color: var(--muted); }
.tchip { display: flex; align-items: center; gap: 6px; background: var(--card2); border: 1px solid var(--line); border-radius: 9px; padding: 6px 8px; margin-bottom: 6px; cursor: grab; }
.tchip .nm { flex: 1; font-weight: 600; overflow-wrap: anywhere; }
.tchip select { padding: 3px 4px; font-size: .8rem; border-radius: 6px; }
.tlist { display: grid; gap: 6px; margin-top: 12px; }
.tlist .tr { display: flex; gap: 8px; align-items: center; }
.tlist .tr input { flex: 1; min-width: 0; }

/* Modal (Spielerfassung) */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .65); z-index: 50; display: grid; place-items: center; padding: 12px; }
.modal[hidden] { display: none; }
.modal-card { background: var(--bg2); border: 1px solid var(--line); border-radius: 18px; width: min(640px, 100%); max-height: 94vh; overflow: auto; padding: 18px; position: relative; }
.modal-x { position: absolute; right: 10px; top: 8px; background: none; border: 0; color: var(--muted); font-size: 1.8rem; cursor: pointer; }
.ctrl-head { text-align: center; margin-bottom: 12px; }
.ctrl-score { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; text-align: center; }
.ctrl-score .tn { font-weight: 800; font-size: 1.1rem; overflow-wrap: anywhere; }
.ctrl-score .sc { font-size: 2.8rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.ctrl-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.ctrl-btns .col { display: grid; gap: 8px; }
.ctrl-btns .btn { padding: 14px 8px; font-size: 1rem; }
.btn.hit { background: #145c33; border-color: #1f8a4c; }
.btn.miss { background: #4a1a1a; border-color: #803030; }
.next-hint { text-align: center; color: var(--warn); font-weight: 700; margin-top: 10px; min-height: 1.3em; }
.ctrl-foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; justify-content: center; }
.direct { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.direct .row input { width: 70px; text-align: center; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #3a1212; color: #fff; border: 1px solid var(--live); padding: 10px 16px; border-radius: 10px; z-index: 60; max-width: 90vw; }
.toast.ok { background: #0d3a22; border-color: var(--accent); }
.foot { display: flex; justify-content: space-between; color: var(--muted); font-size: .8rem; padding: 16px; border-top: 1px solid var(--line); }
.login { max-width: 380px; margin: 40px auto; }

/* Großbild /tv */
body.tv { font-size: 22px; }
body.tv .foot, body.tv .tabs { display: none; }
body.tv .wrap, body.tv .top-inner { max-width: 1800px; }
body.tv .tvgrid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; }
@media (max-width: 1000px) { body.tv .tvgrid { grid-template-columns: 1fr; } }
