:root {
  --bg: #0f1012;
  --surface: #17181b;
  --line: #26282d;
  --text: #e8e6e1;
  --muted: #8b8d93;
  --accent: #d4ff3a;
  --accent-ink: #141600;
  --good: #7ad97a;
  --bad: #ff7a6b;
  --radius: 6px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1, h2, h3 { line-height: 1.15; margin: 0; }
h2 { font-size: 22px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 32px 0 12px; font-weight: 600; }
.muted { color: var(--muted); margin: 4px 0 0; }
.small { font-size: 13px; margin: -6px 0 12px; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.btn {
  display: inline-block; border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--radius); padding: 9px 16px; text-decoration: none; color: var(--text); font-weight: 600;
}
.btn:hover { border-color: #3a3d44; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { filter: brightness(.94); border-color: var(--accent); }
.link { background: none; border: 0; color: var(--muted); padding: 0; text-decoration: underline; }

/* Landing */
.landing { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.hero { max-width: 520px; }
.kicker { color: var(--accent); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: 13px; margin: 0 0 16px; }
.hero h1 { font-size: clamp(32px, 7vw, 48px); letter-spacing: -.02em; }
.lead { color: var(--muted); font-size: 17px; margin: 16px 0 28px; }
.error { color: var(--bad); }

/* App shell */
.top {
  display: flex; align-items: center; gap: 24px; padding: 12px 24px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 2;
}
.logo { font-weight: 800; letter-spacing: -.01em; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tabs button { background: none; border: 0; padding: 8px 12px; border-radius: var(--radius); color: var(--muted); font-weight: 600; }
.tabs button[aria-selected="true"] { color: var(--text); background: var(--surface); }
.user { display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 14px; }
main { max-width: 860px; margin: 0 auto; padding: 28px 24px 64px; }
.row-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 16px; }

/* Training */
.streak { text-align: right; }
.streak strong { display: block; font-size: 28px; line-height: 1; color: var(--accent); }
.streak span { font-size: 12px; color: var(--muted); }
.progress { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin-bottom: 8px; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.drills { list-style: none; margin: 0; padding: 0; }
.drill { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.drill input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.drill .title { flex: 1; }
.drill.done .title { color: var(--muted); text-decoration: line-through; }
.tag { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--muted); }
.del { background: none; border: 0; color: var(--muted); padding: 4px 6px; opacity: .5; }
.del:hover { opacity: 1; color: var(--bad); }

.add { margin: 20px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.add summary { padding: 12px 16px; cursor: pointer; font-weight: 600; }
.form { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 0 16px 16px; align-items: end; }
.form label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.form .wide { grid-column: span 2; }

/* Tiles + Tabellen */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tile { background: var(--surface); padding: 14px 16px; }
.tile .v { font-size: 22px; font-weight: 700; }
.tile .l { font-size: 12px; color: var(--muted); }
.compare { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.compare .col { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); }
.compare .col h4 { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.compare dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 14px; }
.compare dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

.table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 14px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 6px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.table .note { display: block; color: var(--muted); font-size: 12px; }
.pos { color: var(--good); }
.neg { color: var(--bad); }

.chart { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 12px; min-height: 60px; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .empty { color: var(--muted); font-size: 14px; padding: 8px; }
.notice { border: 1px solid #5a4a1e; background: #221d0e; color: #f0d58a; padding: 10px 14px; border-radius: var(--radius); }

@media (max-width: 680px) {
  .top { flex-wrap: wrap; gap: 8px 16px; padding: 10px 16px; }
  .tabs { order: 3; flex-basis: 100%; }
  .user { margin-left: auto; }
  main { padding: 20px 16px 48px; }
  .form { grid-template-columns: 1fr 1fr; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .compare { grid-template-columns: 1fr; }
  .table th:nth-child(3), .table td:nth-child(3) { display: none; }
  .table td, .table th { padding: 8px 4px; }
  .cell-input { width: 50px; }
}
.tiles + .chart { margin-top: 12px; }
.cell-input { width: 72px; padding: 4px 6px; font-size: 14px; background: transparent; border-color: transparent; }
.cell-input:hover { border-color: var(--line); }
.cell-input::placeholder { color: #4a4c52; }
.table .tag { margin-left: 6px; font-size: 11px; }
.table-wrap { overflow-x: auto; }
.ranks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.rank { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 14px 16px; }
.rank-mode { font-size: 12px; color: var(--muted); }
.rank-name { font-size: 20px; font-weight: 700; margin: 2px 0 10px; }
.rank .progress { margin-bottom: 6px; }
.rank-meta { font-size: 12px; color: var(--muted); }
