/* ProStats V2 – Look "Nachtparkett": dunkel, ruhig, ein Akzent. */
:root {
  --bg: #0A0E0D; --panel: #111715; --panel2: #161E1B; --panel3: #1C2622;
  --line: rgba(232, 238, 234, 0.08); --line2: rgba(232, 238, 234, 0.14);
  --text: #E8EEEA; --muted: #9AA8A1; --dim: #7D8B84;
  --accent: #6EE7B7; --accent-ink: #0A0E0D; --warn: #F5B94A; --bad: #F07A6E;
  --home: #6EE7B7; --away: #7CC4FF;
  --radius: 16px;
  --font: Inter, system-ui, -apple-system, sans-serif;
  --display: 'Space Grotesk', Inter, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; }
a { color: var(--muted); } a:hover { color: var(--text); }
button, input, select { font: inherit; color: inherit; }
.boot { padding: 40px; color: var(--muted); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 24px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.icon { display: inline-flex; }

/* Kopfzeile */
.topbar { display: flex; align-items: center; gap: 14px; padding: 12px 24px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 18px; text-decoration: none; color: var(--text); }
.brand .logo { width: 28px; height: 28px; border-radius: 9px; background: var(--accent); display: inline-flex; align-items: center; justify-content: center; }
.topbar .spacer { flex: 1; }
.badge { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: color-mix(in srgb, var(--accent) 15%, transparent); border-color: transparent; color: var(--accent); }
.badge.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); border-color: transparent; color: var(--warn); }
.badge.bad { background: color-mix(in srgb, var(--bad) 16%, transparent); border-color: transparent; color: var(--bad); }

/* Buttons und Felder */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--line2); background: var(--panel2); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: rgba(232, 238, 234, 0.28); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.icon-only { width: 40px; padding: 0; }
.btn.danger { color: var(--bad); }
.btn.sm { min-height: 32px; padding: 0 10px; font-size: 13px; border-radius: 9px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select {
  min-height: 40px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--line2); background: var(--panel2); outline: none;
}
input:focus, select:focus, .btn:focus-visible { border-color: var(--accent); outline: none; }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); width: 18px; height: 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; flex-wrap: wrap; }
.seg button { min-height: 36px; padding: 0 12px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-weight: 600; font-size: 13px; }
.seg button[aria-pressed=true] { background: var(--text); color: var(--bg); }

/* Login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login .card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 14px; }
.msg { font-size: 13px; padding: 10px 12px; border-radius: 10px; background: var(--panel2); color: var(--muted); }
.msg.err { color: var(--bad); } .msg.ok { color: var(--accent); }

/* Spieleliste */
.page { max-width: 1100px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.game-card { text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 10px; }
.game-card:hover { border-color: var(--line2); }
.game-card .teams { font-family: var(--display); font-size: 17px; font-weight: 600; }
.steps { display: flex; gap: 6px; flex-wrap: wrap; }
.step-dot { font-size: 11px; padding: 3px 8px; border-radius: 999px; background: var(--panel2); color: var(--dim); }
.step-dot.done { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.new-game { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; align-items: end; }
.banner { padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--warn) 10%, transparent); color: var(--warn); font-size: 13px; line-height: 1.45; }

/* Spielansicht */
.game-head { display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.game-head h1 { font-size: 19px; }
.workspace { display: flex; flex-wrap: wrap; gap: 18px; padding: 18px 24px 40px; align-items: flex-start; }
.player-col { flex: 3 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 10px; position: sticky; top: 10px; }
.side-col { flex: 2 1 380px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.stage { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.stage canvas.overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.stage.drawing canvas.overlay { pointer-events: auto; cursor: crosshair; }
.stage .empty { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; color: var(--muted); text-align: center; padding: 20px; }
.stage.dragover { outline: 2px dashed var(--accent); outline-offset: -8px; }
.transport { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.transport .time { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 120px; }
.seekbar { flex: 1 1 200px; }
.tabs { display: flex; gap: 2px; padding: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
.tabs button { flex: 1; min-height: 40px; padding: 0 10px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-weight: 600; font-size: 13px; white-space: nowrap; }
.tabs button[aria-selected=true] { background: var(--panel3); color: var(--text); }
.tabs button .n { display: inline-block; width: 18px; height: 18px; line-height: 18px; border-radius: 50%; background: var(--panel3); font-size: 11px; margin-right: 6px; }
.tabs button.done .n { background: var(--accent); color: var(--accent-ink); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.panel p { margin: 0; line-height: 1.5; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.5; }

/* Kalibrierung */
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.field-btn { text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line2); background: var(--panel2); cursor: pointer; display: flex; flex-direction: column; gap: 3px; }
.field-btn[aria-pressed=true] { border-color: var(--accent); }
.field-btn .v { font-family: var(--display); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.preview { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.preview canvas { background: #000; border-radius: 8px; image-rendering: pixelated; max-width: 100%; }
.preview .big { font-family: var(--display); font-size: 40px; font-weight: 700; min-width: 80px; font-variant-numeric: tabular-nums; }
.sliders { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.sliders label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }

/* Scan */
.progress { height: 10px; background: var(--panel3); border-radius: 5px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width 0.3s; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { background: var(--panel2); border-radius: 12px; padding: 10px 12px; }
.stat .v { font-family: var(--display); font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12px; color: var(--muted); }
canvas.chart { width: 100%; height: 140px; background: var(--panel2); border-radius: 12px; cursor: pointer; }

/* Tabellen */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; max-height: 60vh; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--dim); font-weight: 500; font-size: 12px; position: sticky; top: 0; background: var(--panel); z-index: 1; }
tr.sel td { background: var(--panel3); }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: var(--panel2); }
td .play { width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--panel3); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.team-home { color: var(--home); } .team-away { color: var(--away); }
tr.ignored td { opacity: 0.4; text-decoration: line-through; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; background: var(--panel3); border: 1px solid var(--line2); padding: 10px 16px; border-radius: 12px; transition: all 0.25s; z-index: 100; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.err { color: var(--bad); } #toast.ok { color: var(--accent); }

@media (max-width: 760px) {
  .player-col { position: static; }
  .workspace, .page, .topbar, .game-head { padding-left: 14px; padding-right: 14px; }
  .sliders, .fields { grid-template-columns: 1fr; }
}
