:root {
  --bg: #0f0f14; --panel: #17171f; --panel2: #1f1f2a; --line: #2c2c3a; --text: #f1f1f4; --muted: #9a9aab;
  --red: #e10600; --red2: #ff2a1f; --yellow: #ffcc00; --green: #22c55e; --radius: 10px;
  font-family: "Titillium Web", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { min-height: 100vh; font-size: 15px; line-height: 1.5; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Kopfzeile */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px; padding: 0 28px; height: 64px; background: #0a0a0e; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand .logo { background: var(--red); color: #fff; font-weight: 900; font-style: italic; letter-spacing: -1px; padding: 4px 10px; border-radius: 4px; transform: skewX(-12deg); font-size: 18px; }
.brand b { display: block; font-size: 17px; line-height: 1.1; text-transform: uppercase; letter-spacing: .5px; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
nav { display: flex; gap: 4px; margin-left: auto; }
nav a { text-decoration: none; padding: 8px 14px; border-radius: 6px; color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 13px; letter-spacing: .6px; position: relative; }
nav a:hover { color: var(--text); background: var(--panel); }
nav a.on { color: var(--text); }
nav a.on::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -13px; height: 3px; background: var(--red); border-radius: 2px; }
.menu-btn { display: none; margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; font-size: 18px; cursor: pointer; }
.stripe { height: 4px; background: repeating-linear-gradient(90deg, var(--red) 0 40px, transparent 40px 48px); opacity: .85; }

main { max-width: 1180px; margin: 0 auto; padding: 32px 28px 80px; }
h1 { font-size: 34px; margin: 0 0 4px; text-transform: uppercase; font-weight: 900; font-style: italic; letter-spacing: -.5px; }
h2 { font-size: 18px; margin: 0 0 14px; text-transform: uppercase; letter-spacing: .6px; }
.sub { color: var(--muted); margin: 0 0 28px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Karten und Raster */
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: 1fr 1fr; } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card h2 { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card h2 a { font-size: 12px; color: var(--muted); text-decoration: none; letter-spacing: .4px; }
.card h2 a:hover { color: var(--text); }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; border-left: 4px solid var(--red); }
.stat b { display: block; font-size: 30px; font-weight: 900; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }

.hero { background: linear-gradient(115deg, #1a0b0b 0%, #17171f 55%); border: 1px solid var(--line); border-radius: 14px; padding: 30px 32px; margin-bottom: 22px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -60px; top: 0; bottom: 0; width: 320px; background: repeating-linear-gradient(115deg, rgba(225,6,0,.16) 0 14px, transparent 14px 30px); }
.hero .label { color: var(--red2); font-weight: 700; text-transform: uppercase; font-size: 12px; letter-spacing: 1.5px; }
.hero h1 { position: relative; z-index: 1; }
.hero p { position: relative; z-index: 1; margin: 6px 0 0; color: var(--muted); }

/* Tabellen */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--panel2); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pos { width: 34px; font-weight: 800; color: var(--muted); font-style: italic; }
.teamdot { display: inline-block; width: 4px; height: 18px; border-radius: 2px; vertical-align: middle; margin-right: 10px; }
.pts { display: inline-block; min-width: 38px; text-align: center; font-weight: 800; padding: 2px 8px; border-radius: 5px; background: var(--panel2); font-variant-numeric: tabular-nums; }
.pts.warn { background: rgba(255,204,0,.16); color: var(--yellow); }
.pts.ban { background: rgba(225,6,0,.2); color: var(--red2); }
.pts.neg { color: var(--green); }
.bar { height: 6px; background: var(--panel2); border-radius: 3px; overflow: hidden; min-width: 80px; }
.bar i { display: block; height: 100%; background: var(--red); border-radius: 3px; }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 4px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.tag.red { color: #fff; background: var(--red); border-color: var(--red); }
a.tag { text-decoration: none; } a.tag:hover { color: var(--text); border-color: var(--muted); }
.carnum { font-weight: 900; font-style: italic; color: var(--muted); margin-right: 6px; }
.empty { color: var(--muted); padding: 18px 0; text-align: center; }

/* Tabs/Filter */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.seg button { background: none; border: none; padding: 6px 14px; border-radius: 6px; cursor: pointer; color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--red); color: #fff; }

/* Formulare */
input, select, textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 9px 12px; width: 100%; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--red); }
textarea { resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 13px; line-height: 1.55; }
label { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 12px; }
label > input, label > select, label > textarea { margin-top: 5px; text-transform: none; letter-spacing: 0; font-size: 15px; }
.row { display: flex; gap: 12px; } .row > * { flex: 1; }
.btn { background: var(--red); border: none; color: #fff; font-weight: 700; padding: 9px 18px; border-radius: 7px; cursor: pointer; text-transform: uppercase; font-size: 13px; letter-spacing: .5px; white-space: nowrap; }
.btn:hover { background: var(--red2); }
.btn.ghost { background: var(--panel2); border: 1px solid var(--line); color: var(--text); }
.btn.ghost:hover { border-color: var(--muted); }
.btn.small { padding: 5px 10px; font-size: 11px; }
.btn.danger { background: transparent; border: 1px solid #5a1e1e; color: #ff6b6b; }
.icon-btn { background: none; border: none; color: var(--muted); cursor: pointer; padding: 4px 6px; border-radius: 5px; font-size: 14px; }
.icon-btn:hover { color: var(--text); background: var(--panel2); }
.err { color: #ff6b6b; font-size: 14px; min-height: 20px; }
input[type=color] { padding: 2px; height: 40px; cursor: pointer; }

/* Regelwerk */
.rules { display: grid; grid-template-columns: 270px 1fr; gap: 26px; align-items: start; }
.toc { position: sticky; top: 90px; max-height: calc(100vh - 110px); overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.toc a { display: block; text-decoration: none; color: var(--muted); padding: 5px 10px; border-radius: 6px; font-size: 14px; border-left: 3px solid transparent; }
.toc a:hover { color: var(--text); background: var(--panel2); }
.toc a.l2 { padding-left: 22px; font-size: 13px; }
.toc a.l3 { padding-left: 34px; font-size: 12.5px; }
.toc a.on { color: var(--text); border-left-color: var(--red); background: var(--panel2); }
.search { position: relative; margin-bottom: 18px; }
.search input { padding-left: 38px; font-size: 16px; padding-top: 12px; padding-bottom: 12px; }
.search::before { content: "⌕"; position: absolute; left: 13px; top: 50%; transform: translateY(-52%); color: var(--muted); font-size: 20px; }
.doc { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 30px 30px; }
.doc h3 { font-size: 22px; text-transform: uppercase; font-style: italic; font-weight: 900; margin: 30px 0 12px; padding-bottom: 8px; border-bottom: 2px solid var(--red); scroll-margin-top: 90px; }
.doc h4 { font-size: 17px; margin: 22px 0 8px; scroll-margin-top: 90px; }
.doc h5 { font-size: 15px; margin: 18px 0 6px; color: #d6d6de; scroll-margin-top: 90px; }
.doc .para { display: flex; gap: 14px; padding: 7px 10px; margin: 0 -10px; border-radius: 6px; scroll-margin-top: 90px; }
.doc .para:target, .doc h3:target, .doc h4:target { background: rgba(225,6,0,.12); }
.doc .para .nr { flex: 0 0 auto; min-width: 46px; font-weight: 700; color: var(--red2); font-variant-numeric: tabular-nums; text-decoration: none; }
.doc .para .nr:hover { text-decoration: underline; }
.doc .para p { margin: 0; }
.doc p.plain { margin: 8px 0; }
.doc ul { margin: 6px 0 6px 10px; padding-left: 20px; } .doc li { margin: 3px 0; }
.doc .hit-count { color: var(--muted); font-size: 13px; padding-top: 16px; }
.doc .used { margin-left: 8px; }
mark { background: var(--yellow); color: #000; border-radius: 2px; padding: 0 1px; }

/* Verwaltung */
.admin-tabs { margin-bottom: 20px; }
.list-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: none; }
.list-item .grow { flex: 1; min-width: 0; }

/* Dialog und Meldung */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px; z-index: 50; overflow: auto; }
.modal[hidden] { display: none; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--red); border-radius: var(--radius); width: 100%; max-width: 520px; padding: 22px 24px; }
.modal-box h2 { margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line); border-left: 4px solid var(--green); padding: 10px 18px; border-radius: 8px; z-index: 60; box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.toast.bad { border-left-color: var(--red); }

@media (max-width: 900px) {
  .g3, .g4 { grid-template-columns: 1fr 1fr; } .g2 { grid-template-columns: 1fr; }
  .rules { grid-template-columns: 1fr; } .toc { position: static; max-height: 260px; }
}
@media (max-width: 720px) {
  .top { padding: 0 16px; }
  .menu-btn { display: block; }
  nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; background: #0a0a0e; border-bottom: 1px solid var(--line); padding: 8px; }
  nav.open { display: flex; }
  nav a.on::after { display: none; } nav a.on { background: var(--panel); }
  main { padding: 22px 14px 60px; } h1 { font-size: 26px; }
  .doc { padding: 6px 16px 20px; } .hide-sm { display: none; }
  .row { flex-direction: column; gap: 0; }
}

/* ---------- EFL-Ausbau ---------- */
.plain-link { text-decoration: none; }
.plain-link:hover { text-decoration: underline; }
.hero-links { display: flex; gap: 10px; margin-top: 18px; position: relative; z-index: 1; flex-wrap: wrap; }
.hero-links .btn { text-decoration: none; }
.stat.dpp { border-left-color: #ff4d6d; } .stat.tpp { border-left-color: #a78bfa; } .stat.money { border-left-color: var(--green); }
.stat.money b { font-size: 24px; line-height: 1.35; }

/* Farbige Marken für Strafen */
.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap; margin: 1px 0; border: 1px solid transparent; line-height: 1.55; }
.chip.time { background: rgba(255,204,0,.13); color: var(--yellow); border-color: rgba(255,204,0,.3); }
.chip.qban { background: rgba(255,135,0,.14); color: #ff9a3c; border-color: rgba(255,135,0,.35); }
.chip.ban { background: rgba(225,6,0,.2); color: #ff5a52; border-color: rgba(225,6,0,.45); }
.chip.dpp { background: rgba(255,77,109,.13); color: #ff7b93; border-color: rgba(255,77,109,.35); }
.chip.tpp { background: rgba(167,139,250,.14); color: #b9a6ff; border-color: rgba(167,139,250,.38); }
.chip.money { background: rgba(34,197,94,.12); color: #4ade80; border-color: rgba(34,197,94,.32); }
.pts.dppc { background: rgba(255,77,109,.14); color: #ff7b93; }
.pts.tppc { background: rgba(167,139,250,.15); color: #b9a6ff; }
.tag.ef { background: rgba(167,139,250,.15); color: #b9a6ff; border-color: rgba(167,139,250,.35); font-size: 10.5px; padding: 0 5px; vertical-align: 2px; }
.tag.series { font-size: 11px; padding: 0 6px; vertical-align: 1px; }

/* Eskalationsleiste */
.ladder { padding: 4px 0 22px; }
.ladder.compact { padding: 6px 0; }
.ladder-track { position: relative; height: 8px; background: var(--panel2); border-radius: 4px; }
.ladder.compact .ladder-track { height: 6px; }
.ladder-track > i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #ff8700, var(--red)); border-radius: 4px; }
.ladder-mark { position: absolute; top: -4px; width: 2px; height: 16px; background: #4a4a5c; transform: translateX(-1px); }
.ladder.compact .ladder-mark { top: -3px; height: 12px; }
.ladder-mark.hit { background: #fff; }
.ladder-mark b { position: absolute; top: 19px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--muted); }
.ladder-mark.hit b { color: var(--red2); }
.alert { margin-top: 12px; padding: 8px 12px; border-radius: 7px; background: rgba(255,204,0,.08); border: 1px solid rgba(255,204,0,.25); color: var(--yellow); font-size: 13.5px; }
.alert a { color: inherit; }
.stages { display: grid; gap: 8px; }
.stage { display: grid; grid-template-columns: 64px 1fr; align-items: center; column-gap: 12px; padding: 8px 12px; background: var(--panel2); border-radius: 8px; border-left: 3px solid #ff4d6d; }
.stage.team { border-left-color: #a78bfa; }
.stage b { font-size: 22px; font-weight: 900; font-style: italic; line-height: 1; grid-row: span 2; }
.stage span { display: none; }
.stage p { margin: 0; font-size: 14px; grid-row: span 2; }

/* Strafenkatalog */
.cat-group { margin-bottom: 16px; padding: 16px 18px; }
.cat-row { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(220px, 1.2fr) auto; gap: 14px; align-items: center; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.cat-row:last-child { border-bottom: none; }
.cat-label { font-weight: 600; }
.cat-pen { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; color: var(--muted); font-size: 13.5px; }
.doc .cat-row.in-doc { padding: 8px 10px; margin: 0 -10px; border-radius: 6px; scroll-margin-top: 90px; }
.doc .cat-row.in-doc:hover { background: var(--panel2); }
.secnr { display: inline-block; background: var(--red); color: #fff; font-style: italic; font-weight: 900; padding: 1px 10px; border-radius: 5px; margin-right: 12px; transform: skewX(-10deg); font-size: .9em; }
.card h2 .secnr { font-size: 13px; padding: 1px 8px; margin-right: 8px; }
.card h2 { justify-content: flex-start; } .card h2 > a { margin-left: auto; }
.subnr { color: var(--red2); font-variant-numeric: tabular-nums; }

/* Regelwerk */
.rules-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.legend { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 28px; }
.doc h3.sec { display: flex; align-items: center; border-bottom: none; padding: 14px 0 10px; margin-top: 36px; position: relative; }
.doc h3.sec::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: linear-gradient(90deg, var(--red), transparent); }
.doc h3.sec .used { margin-left: auto; }
.doc h6 { font-size: 13px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); margin: 18px 0 6px; }
.doc li { padding: 3px 0; }
.doc li b { color: #fff; }
.doc li.sub { margin-left: 22px; list-style: circle; color: #d6d6de; }
.doc li::marker { color: var(--red); }
.doc hr { border: none; border-top: 1px solid var(--line); margin: 26px 0 14px; }
.doc .plain b { color: #fff; }
.rtable th { background: var(--panel2); }
.rtable td, .rtable th { border: 1px solid var(--line); }
.flash { animation: flash 1.8s ease-out; }
@keyframes flash { 0%, 30% { background: rgba(225,6,0,.25); } 100% { background: transparent; } }
.toc a.l1 { color: #d6d6de; font-weight: 600; margin-top: 4px; }

/* Diagramm je Rennen */
.chart { display: flex; align-items: flex-end; gap: 4px; height: 130px; padding-top: 6px; }
.chart > div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.chart span { font-size: 13px; font-weight: 700; }
.chart i { width: 100%; max-width: 26px; border-radius: 3px 3px 0 0; }
.chart small { color: var(--muted); font-size: 11px; }

/* Formular-Breiten */
.modal-box { max-width: 600px; }
.modal-box label.w2 { display: inline-block; width: calc(50% - 6px); }
.modal-box label.w2 + label.w2 { margin-left: 12px; }
.modal-box label.w3 { display: inline-block; width: calc(33.33% - 8px); }
.modal-box label.w3 + label.w3 { margin-left: 12px; }
.modal-box label.w2 + label.w2 + label.w2 { margin-left: 0; }
.modal-box label.w2 + label.w2 + label.w2 + label.w2 { margin-left: 12px; }
@media (max-width: 720px) {
  .cat-row { grid-template-columns: 1fr; gap: 6px; }
  .modal-box label.w2, .modal-box label.w3 { width: 100%; margin-left: 0 !important; }
  .legend { margin-bottom: 14px; }
}
