/* Layout: eine zentrale Spalte (max. 1320px) – Kopf, Pool-Umschalter, Kennzahlen, Tabelle, Regeln */
:root {
  --bg: #0b0e13;
  --surface: #12171f;
  --surface-2: #171d27;
  --line: #232b37;
  --line-soft: #1b222c;
  --fg: #e6edf3;
  --fg-2: #c5ced9;
  --muted: #9ba7b6;
  --faint: #7d8896;
  --accent: #f7931a;
  --accent-ink: #0b0e13;
  --accent-soft: #221b10;
  --accent-line: #3a2a12;
  --accent-text: #e0b26a;
  --eu: #6ea8fe;
  --eu-bg: #14243d;
  --eu-fg: #9cc3ff;
  --usa: #4fd1c5;
  --usa-bg: #0f2b2a;
  --usa-fg: #7fe3d9;
  --au: #b39dff;
  --au-bg: #221c3d;
  --au-fg: #cbbcff;
  --ok: #3fb950;
  --ok-bg: #10261a;
  --ok-fg: #6fdd8b;
  --warn-bg: #1e1708;
  --warn-line: #5c4313;
  --warn-fg: #f5c66b;
  --bad-bg: #2a1214;
  --bad-fg: #ff9b95;
  --off: #5a6472;
  --font-display: "Space Grotesk", Inter, system-ui, sans-serif;
  --font-body: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { background: var(--bg); }
body {
  margin: 0;
  color: var(--fg);
  font: 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
a:hover { color: #ffb357; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding-block: 24px 56px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 20px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0; }

/* Kopf */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.brand-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--accent); display: grid; place-items: center; flex-shrink: 0; }
.brand-name { font-family: var(--font-display); font-size: 24px; font-weight: 700; line-height: 1.1; }
.brand-sub { font-size: 13px; color: var(--muted); }
.top-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 13px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 13px; color: var(--fg-2);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--off); flex-shrink: 0; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn-fg); }
.dot.bad { background: var(--bad-fg); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--fg);
  font: 500 14px var(--font-body); cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--surface-2); color: var(--fg); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { background: #ffa53d; color: var(--accent-ink); }

/* Navigation */
.nav { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.seg a, .seg button {
  min-height: 40px; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 0; border-radius: 9px;
  background: transparent; color: var(--fg-2); font: 500 14px var(--font-body); text-decoration: none; cursor: pointer;
}
.seg a:hover, .seg button:hover { background: var(--surface-2); color: var(--fg); }
.seg a[aria-current="page"], .seg button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.seg .count { font-family: var(--font-mono); font-size: 12px; opacity: .8; }
.links { position: relative; }
.links summary { list-style: none; }
.links summary::-webkit-details-marker { display: none; }
.links-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 230px; padding: 6px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); display: flex; flex-direction: column;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
}
.links-menu a { padding: 9px 12px; border-radius: 8px; color: var(--fg-2); text-decoration: none; font-size: 14px; display: flex; justify-content: space-between; gap: 12px; }
.links-menu a:hover { background: var(--line-soft); color: var(--fg); }
.links-menu .hint { color: var(--faint); font-size: 12px; }
.links-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }

/* Hinweise */
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: 12px; font-size: 14px; border: 1px solid var(--warn-line); background: var(--warn-bg); color: var(--warn-fg); }
.notice svg { flex-shrink: 0; margin-top: 2px; }
.notice.info { border-color: var(--line); background: var(--surface); color: var(--fg-2); }
.notice.bad { border-color: #5c2226; background: var(--bad-bg); color: var(--bad-fg); }

/* Pool-Kopf */
.pool-head { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 900px) { .pool-head { grid-template-columns: minmax(0, 1fr); } }
.panel { padding: 22px 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.lead { font-size: 15px; color: var(--fg-2); max-width: 65ch; }
.rules { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.rules li { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--fg-2); }
.rules .tag { flex-shrink: 0; min-width: 56px; text-align: center; padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-text); font: 600 12px/1.6 var(--font-mono); }
.addr { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.addr code { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); font: 13px/1.5 var(--font-mono); color: var(--fg); }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--fg-2); overflow-wrap: anywhere; }
.kv code { font: 12px var(--font-mono); color: var(--fg); }

/* Kennzahlen */
.hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(290px, 100%), 1fr)); gap: 16px; }
.card { padding: 22px 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card.gold { border-color: var(--accent-line); background: #17130c; }
.card-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.card.gold .card-label { color: var(--accent-text); }
.big { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.big .v { font: 500 42px/1 var(--font-mono); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.big .u { font-size: 17px; color: var(--muted); }
.big .v.accent { color: var(--accent); }
.bar { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; display: flex; }
.bar > span { height: 100%; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--fg-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.small-note { font-size: 13px; color: var(--fg-2); }
.card.gold .small-note { color: #c9ae84; }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.split > div { padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); }
.split .k { font-size: 12px; color: #c9ae84; }
.split .val { font: 16px var(--font-mono); }
.split .sub { font-size: 12px; color: #c9ae84; font-family: var(--font-mono); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px; }
.kpi { padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); min-width: 0; }
.kpi .k { font-size: 12px; color: var(--muted); }
.kpi .val { font: 500 22px/1.35 var(--font-mono); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi .sub { font-size: 12px; color: var(--faint); }

/* Beste Shares */
.podium { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr)); gap: 12px; }
.pod { padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); display: flex; gap: 14px; align-items: center; min-width: 0; }
.pod .place { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--accent); color: var(--accent); display: grid; place-items: center; font: 15px var(--font-mono); flex-shrink: 0; }
.pod .who { flex: 1 1 auto; min-width: 0; }
.pod .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .who span { font-size: 12px; color: var(--muted); }
.pod .score { text-align: right; }
.pod .score b { font: 500 18px var(--font-mono); display: block; }
.pod .score span { font-size: 12px; color: var(--muted); }

/* Tabelle */
.section { display: flex; flex-direction: column; gap: 14px; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; }
.section-head p { font-size: 13px; color: var(--muted); }
.tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.search { position: relative; flex: 1 1 260px; display: flex; }
.search svg { position: absolute; left: 14px; top: 14px; pointer-events: none; }
.field, .search input, select.field {
  min-height: 44px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  color: var(--fg); font: 14px var(--font-body); width: 100%;
}
.search input { padding-left: 40px; }
.check { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 14px; color: var(--fg-2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.table-box { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; }
table.grid th { font-size: 12px; font-weight: 500; color: var(--muted); text-align: right; padding: 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid th button { all: unset; box-sizing: border-box; display: flex; justify-content: flex-end; align-items: center; gap: 4px; width: 100%; padding: 12px 14px; cursor: pointer; }
table.grid th > span { display: block; padding: 12px 14px; }
table.grid th button:hover { color: var(--fg); }
table.grid th button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
table.grid th.l button { justify-content: flex-start; }
table.grid th[aria-sort="descending"] button, table.grid th[aria-sort="ascending"] button { color: var(--accent); }
table.grid td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); text-align: right; font-size: 14px; white-space: nowrap; vertical-align: middle; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid .l { text-align: left; }
table.grid tbody tr:hover { background: #151b24; }
table.grid tfoot td { font-weight: 600; border-top: 1px solid var(--line); background: var(--surface-2); }
.wname { font-weight: 600; overflow-wrap: anywhere; }
.wsub { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; margin-top: 4px; font-size: 12px; color: var(--muted); }
.wsub .dev { font-size: 12px; }
.wsub .badge { padding: 1px 7px; font-size: 11px; }
table.grid td.c-name { white-space: normal; min-width: 170px; }
table.grid td .sub { margin-top: 3px; font-size: 12px; color: var(--muted); }
table.grid td .sub.low { color: var(--bad-fg); }
select.plain { border: 0; background: transparent; color: var(--fg); font: 500 14px var(--font-body); padding: 6px 2px; cursor: pointer; }
select.plain option { background: var(--surface-2); color: var(--fg); }

/* Schmale Bildschirme: jede Zeile wird eine Karte, nichts scrollt seitwärts */
@media (max-width: 860px) {
  .table-box { overflow-x: visible; }
  table.grid thead { display: none; }
  table.grid, table.grid tbody, table.grid tfoot { display: block; width: 100%; }
  table.grid tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
  table.grid tbody tr:last-child { border-bottom: 0; }
  table.grid td { display: block; padding: 0; border: 0; text-align: left; white-space: normal; min-width: 0; }
  table.grid td::before { content: attr(data-label); display: block; margin-bottom: 2px; font-size: 11px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
  table.grid td.c-name { grid-column: 1 / -1; min-width: 0; }
  table.grid td.c-name::before, table.grid td.c-empty { display: none; }
  table.grid tr { position: relative; }
  table.grid td.c-state { position: absolute; top: 14px; right: 16px; }
  table.grid td.c-state::before { display: none; }
  table.grid tbody td.c-name { padding-right: 96px; }
  table.grid .minibar { margin-left: 0; }
  table.grid tfoot tr { border-top: 1px solid var(--line); }
  table.grid tfoot td { border-top: 0; background: transparent; }
}

@media (min-width: 560px) and (max-width: 860px) {
  table.grid tr { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Big-Pool-Tabelle (eine Spalte mehr): schon bis 1040px als Karten */
@media (min-width: 861px) and (max-width: 1040px) {
  .table-box:has(table.wide) { overflow-x: visible; }
  table.grid.wide thead { display: none; }
  table.grid.wide, table.grid.wide tbody, table.grid.wide tfoot { display: block; width: 100%; }
  table.grid.wide tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 16px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
  table.grid.wide tbody tr:last-child { border-bottom: 0; }
  table.grid.wide td { display: block; padding: 0; border: 0; text-align: left; white-space: normal; min-width: 0; }
  table.grid.wide td::before { content: attr(data-label); display: block; margin-bottom: 2px; font-size: 11px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
  table.grid.wide td.c-name { grid-column: 1 / -1; min-width: 0; }
  table.grid.wide td.c-name::before, table.grid.wide td.c-empty { display: none; }
  table.grid.wide tr { position: relative; }
  table.grid.wide td.c-state { position: absolute; top: 14px; right: 16px; }
  table.grid.wide td.c-state::before { display: none; }
  table.grid.wide tbody td.c-name { padding-right: 96px; }
  table.grid.wide .minibar { margin-left: 0; }
  table.grid.wide tfoot tr { border-top: 1px solid var(--line); }
  table.grid.wide tfoot td { border-top: 0; background: transparent; }
}
.low { color: var(--bad-fg); }
.minibar { margin: 5px 0 0 auto; width: 92px; height: 4px; border-radius: 999px; background: var(--line); overflow: hidden; }
.minibar span { display: block; height: 100%; background: var(--accent); }
.badge { display: inline-block; padding: 3px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.badge.USA { background: var(--usa-bg); color: var(--usa-fg); }
.badge.EU { background: var(--eu-bg); color: var(--eu-fg); }
.badge.AU { background: var(--au-bg); color: var(--au-fg); }
.state { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.state.counts { background: var(--ok-bg); color: var(--ok-fg); }
.state.warm { background: var(--warn-bg); color: var(--warn-fg); }
.state.low { background: var(--bad-bg); color: var(--bad-fg); }
.state.off { background: var(--line-soft); color: var(--muted); }
.dev { color: var(--fg-2); font-size: 13px; }
.dev.unknown { color: var(--faint); font-style: italic; }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.more { align-self: center; }

/* Zwei Spalten unten */
.duo { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 16px; }
.steps { display: flex; flex-direction: column; gap: 16px; }
.step { display: flex; gap: 14px; }
.step > div { min-width: 0; }
.step .n { width: 30px; height: 30px; border-radius: 50%; background: var(--line-soft); color: var(--accent); display: grid; place-items: center; flex-shrink: 0; font: 14px var(--font-mono); }
.step b { display: block; }
.step p { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.devrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
.devrow .name { font-size: 14px; color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.devrow .track { grid-column: 1 / -1; height: 6px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.devrow .track span { display: block; height: 100%; border-radius: 999px; background: var(--eu); }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px 24px; font-size: 13px; }
.summary div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-family: var(--font-mono); text-align: right; }

/* Selfservice */
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-size: 14px; color: var(--fg-2); }
.form .hint { font-size: 12px; color: var(--muted); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.form .actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.msg { font-size: 14px; padding: 10px 14px; border-radius: 10px; }
.msg.ok { background: var(--ok-bg); color: var(--ok-fg); }
.msg.err { background: var(--bad-bg); color: var(--bad-fg); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.owner { border: 1px dashed var(--line); border-radius: 14px; padding: 4px 18px 18px; }
.owner summary { cursor: pointer; padding: 12px 0; font-weight: 600; color: var(--fg-2); }
.lines { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.lines li { font: 13px/1.5 var(--font-mono); color: var(--fg-2); padding: 6px 10px; border-radius: 8px; background: var(--bg); overflow-wrap: anywhere; }

.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-top: 20px; border-top: 1px solid var(--line-soft); font-size: 13px; color: var(--muted); }
.foot nav { display: flex; flex-wrap: wrap; gap: 16px; }

.skeleton { color: var(--faint); }
