/* Kallefornia Boys – Dark Mode im Bowling-Scoreboard-Look */
:root {
  --bg: #15100e;            /* Kegelbahn bei Nacht: warmes Schwarzbraun */
  --panel: #1f1815;
  --panel-2: #291f1a;
  --line: #3a2d25;
  --ink: #f3ece2;
  --ink-dim: #b3a596;
  --red: #be1622;           /* Vereinsrot aus dem Logo */
  --red-hi: #e02534;
  --gold: #d9a521;          /* Krone / Führender */
  --green: #79b45e;         /* bezahlt */
  --wood-1: #6a4a2f;        /* Bahnholz-Streifen */
  --wood-2: #7d5838;
  --radius: 14px;
  --font-display: 'Anton', 'Arial Narrow', sans-serif;
  --font-body: 'Barlow', system-ui, sans-serif;
  --font-num: 'Barlow Condensed', 'Barlow', sans-serif;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.45;
  min-height: 100dvh; display: flex; flex-direction: column;
}

/* ---------- Kopfzeile ---------- */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px; position: sticky; top: 0; z-index: 40;
  background: rgba(21,16,14,.92); backdrop-filter: blur(8px);
  border-bottom: 3px solid var(--red);
}
/* Bahnholz-Signatur unter der roten Linie */
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -8px; height: 5px;
  background: repeating-linear-gradient(90deg, var(--wood-1) 0 26px, var(--wood-2) 26px 52px);
  opacity: .5; pointer-events: none;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-logo { height: 46px; width: 46px; }
.brand-name {
  font-family: var(--font-display); font-size: 15px; line-height: 1.02;
  letter-spacing: .06em; text-transform: uppercase;
}
.brand-name em { font-style: normal; color: var(--red-hi); }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  color: var(--ink-dim); text-decoration: none; padding: 8px 12px; border-radius: 10px;
  font-weight: 700; font-size: 15px;
}
.nav a.active { color: var(--ink); background: var(--panel-2); box-shadow: inset 0 -2px 0 var(--red); }
.topbar-tools { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--ink);
  border-radius: 10px; padding: 7px 10px; font-size: 16px; cursor: pointer;
}
.sync-dot { width: 10px; height: 10px; border-radius: 50%; background: #666; }
.sync-dot.on { background: var(--green); }
.sync-dot.off { background: var(--red-hi); }

.offline-banner {
  background: #4a1015; color: #ffd9dc; padding: 8px 16px; font-size: 14px; text-align: center;
}

/* ---------- Layout ---------- */
.app { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 22px 14px 60px; }
.footer { text-align: center; color: var(--ink-dim); font-size: 12px; padding: 14px; border-top: 1px solid var(--line); }
h1, h2 { font-family: var(--font-display); font-weight: 400; letter-spacing: .04em; text-transform: uppercase; }
h1 { font-size: clamp(26px, 5vw, 38px); margin: 6px 0 4px; }
h2 { font-size: 19px; margin: 26px 0 10px; color: var(--ink-dim); }
.sub { color: var(--ink-dim); margin: 0 0 18px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; }
.stack { display: grid; gap: 12px; }

/* ---------- Bedienelemente ---------- */
.btn {
  font: 700 15px var(--font-body); color: var(--ink);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 16px; cursor: pointer; text-decoration: none; display: inline-flex;
  align-items: center; gap: 8px; transition: transform .05s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--red); border-color: var(--red-hi); }
.btn.primary:hover { background: var(--red-hi); }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 9px; }
.btn.danger { border-color: var(--red); color: #ffb9bf; }
input, select {
  font: 600 15px var(--font-body); color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
input:focus, select:focus, .btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
label.field { display: grid; gap: 5px; font-size: 13px; color: var(--ink-dim); font-weight: 700; }
.chip {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  border-radius: 999px; padding: 8px 14px; font-weight: 700; cursor: pointer; font-size: 14px;
}
.chip.on { background: var(--red); border-color: var(--red-hi); }

/* ---------- Abend-Liste ---------- */
.event-card {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: var(--ink);
}
.event-card:hover { border-color: var(--red); }
.event-date {
  font-family: var(--font-num); font-size: 22px; font-weight: 700; color: var(--gold);
  min-width: 92px;
}
.event-meta { flex: 1; }
.event-loc { font-weight: 700; font-size: 17px; }
.event-sub { color: var(--ink-dim); font-size: 13px; }
.event-total { font-family: var(--font-num); font-size: 22px; font-weight: 700; }

/* ---------- Live-Abend: Spielerkarten ---------- */
.player-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.player-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: var(--panel-2); border-bottom: 1px solid var(--line); cursor: pointer;
}
.player-name { font-family: var(--font-display); font-size: 20px; letter-spacing: .04em; }
.crown { font-size: 20px; filter: drop-shadow(0 0 6px rgba(217,165,33,.7)); }
.player-total { margin-left: auto; font-family: var(--font-num); font-size: 24px; font-weight: 700; color: var(--gold); }
.paid-pill { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 10px; }
.paid-pill.open { background: var(--red); color: #fff; }
.paid-pill.done { background: var(--green); color: #10200b; }

.counters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; padding: 12px 14px; }
.counter { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; }
.counter .c-label { font-size: 12px; font-weight: 700; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .05em; }
.counter .c-price { font-size: 11px; color: var(--ink-dim); }
.counter .c-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 6px; }
.counter .c-val {
  font-family: var(--font-num); font-size: 34px; font-weight: 700; min-width: 52px;
  font-variant-numeric: tabular-nums;
}
.counter input.c-val { width: 70px; text-align: center; font-size: 24px; padding: 4px; }
.cbtn {
  width: 46px; height: 46px; border-radius: 12px; border: 1px solid var(--line);
  font: 700 24px var(--font-body); cursor: pointer; color: var(--ink); background: var(--panel-2);
  touch-action: manipulation;
}
.cbtn.plus { background: var(--red); border-color: var(--red-hi); }
.cbtn.plus:active { background: var(--red-hi); transform: scale(.94); }
.cbtn:disabled { opacity: .35; cursor: default; }
.counter.hot { animation: pop .3s; }
@keyframes pop { 0% { box-shadow: 0 0 0 0 rgba(224,37,52,.7); } 100% { box-shadow: 0 0 0 14px rgba(224,37,52,0); } }

.player-extra { border-top: 1px dashed var(--line); padding: 12px 14px; display: grid; gap: 10px; }
.sonst-item { display: flex; gap: 8px; align-items: center; }
.sonst-item input[type="text"] { flex: 1; min-width: 90px; }
.sonst-item input[type="number"] { width: 96px; }

.totals-bar {
  position: sticky; bottom: 0; margin-top: 18px; padding: 12px 16px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; gap: 16px; align-items: center; font-family: var(--font-num); font-size: 20px; font-weight: 700;
}

/* ---------- Statistik ---------- */
.leader-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.leader-box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; text-align: center; }
.leader-box .lb-cat { font-size: 12px; color: var(--ink-dim); text-transform: uppercase; font-weight: 700; letter-spacing: .05em; }
.leader-box .lb-name { font-family: var(--font-display); font-size: 18px; margin-top: 3px; }
.leader-box .lb-val { font-family: var(--font-num); font-size: 22px; font-weight: 700; color: var(--gold); }
.leader-box.king { border-color: var(--gold); box-shadow: 0 0 14px rgba(217,165,33,.15); }

table.stats { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.stats th, table.stats td { padding: 9px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.stats th { color: var(--ink-dim); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; cursor: pointer; }
table.stats th.sorted { color: var(--gold); }
table.stats td:first-child, table.stats th:first-child { text-align: left; }
table.stats td:first-child { font-weight: 700; }
table.stats tr.first td { color: var(--gold); }
.table-wrap { overflow-x: auto; }
.chart-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.chart-box h3 { margin: 0 0 8px; font-size: 14px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .05em; }
.charts { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 860px) { .charts { grid-template-columns: 1fr 1fr; } .charts .wide { grid-column: 1 / -1; } }

/* ---------- Admin ---------- */
.admin-grid { display: grid; gap: 14px; }
.cost-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
table.edit { width: 100%; border-collapse: collapse; }
table.edit th, table.edit td { padding: 6px; border-bottom: 1px solid var(--line); text-align: center; }
table.edit input { width: 72px; text-align: center; padding: 6px; }
table.edit td:first-child { text-align: left; font-weight: 700; }

.empty { text-align: center; color: var(--ink-dim); padding: 40px 10px; }
.msg { padding: 10px 14px; border-radius: 10px; font-weight: 600; }
.msg.ok { background: #1d3313; color: #cdeebb; }
.msg.err { background: #4a1015; color: #ffd9dc; }

@media (max-width: 560px) {
  .nav a { padding: 8px 9px; font-size: 14px; }
  .brand-name { display: none; }
  .counters { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
