/* Brücke · Gestaltung. Farben, Abstände und Schrift nur über tokens.css. Ziel: WCAG 2.2 AA, iPhone und Desktop. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 var(--schrift-groesse-3)/var(--schrift-zeile) var(--schrift-familie);
}
a { color: var(--action); text-underline-offset: 0.15em; }
a:hover { color: var(--action-hover); }
:focus-visible { outline: 3px solid var(--action); outline-offset: 2px; border-radius: var(--radius-1); }
code, .mono { font-family: var(--schrift-familie-mono); font-size: 0.92em; }
h1 { font-size: var(--schrift-groesse-5); line-height: 1.2; margin: 0 0 var(--space-2); }
h2 { font-size: var(--schrift-groesse-4); line-height: 1.3; margin: 0 0 var(--space-3); }
h3 { font-size: var(--schrift-groesse-3); margin: 0 0 var(--space-2); }
p { margin: 0 0 var(--space-3); }
.unsichtbar { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.springen { position: absolute; left: var(--space-3); top: -4rem; background: var(--surface); padding: var(--space-2) var(--space-3); z-index: 10; }
.springen:focus { top: var(--space-3); }

/* Kopf und Navigation */
.kopf { background: var(--surface); border-bottom: 1px solid var(--line); }
.kopf__innen { max-width: 72rem; margin: 0 auto; padding: var(--space-3) var(--space-4); display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.marke { font-weight: 700; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--ziel); }
.marke__zeichen { width: 1.75rem; height: 1.75rem; }
.marke__teil { color: var(--brand); }
.z-grund { fill: var(--action); }
.z-rumpf { fill: var(--on-action); }
.z-segel { fill: var(--brand); }
.nav { margin-left: auto; }
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--space-1); }
.nav a { display: inline-flex; align-items: center; min-height: var(--ziel); padding: 0 var(--space-3); border-radius: var(--radius-1); color: var(--ink-2); text-decoration: none; font-weight: 600; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); box-shadow: inset 0 -3px 0 var(--brand); }

main { max-width: 72rem; margin: 0 auto; padding: var(--space-5) var(--space-4) var(--space-7); }
.fuss { max-width: 72rem; margin: 0 auto; padding: 0 var(--space-4) var(--space-6); color: var(--ink-3); font-size: var(--schrift-groesse-1); }
.fuss a { color: var(--ink-2); display: inline-block; min-height: 24px; min-width: 24px; padding: 2px var(--space-1); }
.hinweis { background: var(--surface-2); border-left: 4px solid var(--brand); padding: var(--space-3) var(--space-4); border-radius: var(--radius-1); margin-bottom: var(--space-5); }
.leise { color: var(--ink-3); font-size: var(--schrift-groesse-2); }

/* Karten und Raster */
.raster { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); }
.karte { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-2); padding: var(--space-4); }
.karte > :last-child { margin-bottom: 0; }
.karte__kopf { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-2); }
.schritt { font-weight: 600; }
.knopf { display: inline-flex; align-items: center; justify-content: center; min-height: var(--ziel); padding: 0 var(--space-4);
  border-radius: var(--radius-1); background: var(--action); color: var(--on-action); font-weight: 600; text-decoration: none; border: 0; font: inherit; cursor: pointer; }
.knopf:hover { background: var(--action-hover); color: var(--on-action); }
.knopf--zweit { background: transparent; color: var(--action); border: 2px solid var(--line-strong); }
.knopf--zweit:hover { background: var(--surface-2); color: var(--action-hover); }

/* Ampel: immer Wort plus Form, nie nur Farbe */
.ampel { display: inline-flex; align-items: center; gap: var(--space-2); padding: 2px var(--space-2); border-radius: var(--radius-rund); font-weight: 700; font-size: var(--schrift-groesse-2); }
.ampel::before { content: ""; width: 0.7em; height: 0.7em; border-radius: 50%; border: 2px solid currentColor; }
.ampel--gruen { background: var(--gruen-soft); color: var(--gruen-text); }
.ampel--gruen::before { background: var(--gruen); border-color: var(--gruen); }
.ampel--gelb { background: var(--gelb-soft); color: var(--gelb-text); }
.ampel--gelb::before { background: var(--gelb); border-color: var(--gelb); border-radius: 2px; transform: rotate(45deg); }
.ampel--rot { background: var(--rot-soft); color: var(--rot-text); }
.ampel--rot::before { background: var(--rot); border-color: var(--rot); border-radius: 1px; }
.ampel--grau { background: var(--grau-soft); color: var(--grau-text); }
.ampel--grau::before { background: transparent; border-color: var(--grau); }

/* Stationsleiste 0–9 */
.leiste { list-style: none; margin: 0 0 var(--space-5); padding: 0; display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: var(--space-1); }
.leiste li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-1); padding: var(--space-2) var(--space-1); text-align: center; font-size: var(--schrift-groesse-1); }
.leiste a { display: block; color: var(--ink); text-decoration: none; min-height: var(--ziel); }
.leiste .nr { display: block; font-weight: 700; font-size: var(--schrift-groesse-3); }
.leiste .zeichen { display: block; font-size: 1.1rem; line-height: 1; margin: 2px 0; color: var(--ink-2); }
.leiste .st-aktuell { border: 2px solid var(--brand); }
.leiste .st-fertig .zeichen, .leiste .st-laeuft .zeichen { color: var(--gruen); }
.leiste .st-tor_wartet .zeichen { color: var(--gelb); }
.leiste .st-in_arbeit .zeichen { color: var(--action); }

/* Tabellen */
.tabelle-huelle { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-2); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: var(--schrift-groesse-2); }
th, td { text-align: left; padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface-2); font-weight: 700; white-space: nowrap; }
tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
th a { color: var(--ink); }
dl.zahlen { display: grid; grid-template-columns: auto 1fr; gap: var(--space-1) var(--space-3); margin: 0 0 var(--space-3); font-size: var(--schrift-groesse-2); }
dl.zahlen dt { color: var(--ink-2); }
dl.zahlen dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
ul.knapp { margin: 0 0 var(--space-3); padding-left: 1.2em; font-size: var(--schrift-groesse-2); }
.bahnen { display: grid; gap: var(--space-4); grid-template-columns: repeat(4, minmax(0, 1fr)); }
.anmelden { max-width: 28rem; }
label { display: block; font-weight: 600; margin-bottom: var(--space-1); }
.feld, input[type="password"] { width: 100%; min-height: var(--ziel); padding: 0 var(--space-3); border: 2px solid var(--line-strong); border-radius: var(--radius-1); background: var(--surface); color: var(--ink); font: inherit; margin-bottom: var(--space-3); }

@media (max-width: 60rem) {
  .bahnen { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 40rem) {
  body { padding-bottom: 4.5rem; }
  .kopf__innen { padding: var(--space-2) var(--space-4); }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; background: var(--surface); border-top: 1px solid var(--line-strong); z-index: 5; padding-bottom: env(safe-area-inset-bottom); }
  .nav ul { justify-content: space-around; }
  .nav a { flex-direction: column; font-size: var(--schrift-groesse-1); padding: var(--space-1) var(--space-2); }
  .nav a[aria-current="page"] { box-shadow: inset 0 3px 0 var(--brand); }
  main { padding-top: var(--space-4); }
  .bahnen { grid-template-columns: 1fr; }
  .leiste { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: no-preference) { a, .knopf { transition: background-color 120ms, color 120ms; } }
@media print { .nav, .springen, .fuss { display: none; } }

.raster + details, details.karte { margin-top: var(--space-4); }
summary { cursor: pointer; min-height: var(--ziel); display: flex; align-items: center; font-weight: 600; color: var(--action); }
select.feld { appearance: auto; }
.knopf--gefahr { background: var(--rot-text); color: var(--surface); }
.knopf--gefahr:hover { background: var(--rot); color: var(--surface); }
button.link { background: none; border: 0; padding: 0 var(--space-1); min-height: 24px; color: var(--ink-2); text-decoration: underline; font: inherit; cursor: pointer; }
.abmelden { margin: 0 0 var(--space-2); }
code.schluessel { display: block; padding: var(--space-3); background: var(--surface-2); border-radius: var(--radius-1); overflow-wrap: anywhere; user-select: all; }
