/* ============================================================
   TRAIDER - Neobrutalist design system
   Thick ink borders, hard offset shadows, flat bright blocks,
   chunky display type. No gradients, no blur, no rounded corners.
   ============================================================ */

:root {
  --paper: #f3efe4;
  --card: #ffffff;
  --ink: #1e1e1c;
  --ink-soft: #57544c;
  --line: #1e1e1c;

  --yellow: #ffd42e;
  --cyan: #4ec8d8;
  --coral: #ff5c39;
  --lilac: #cbb8f2;
  --green: #009a4e;
  --red: #e5321f;

  --bw: 2.5px; /* standard border width */
  --bw-thick: 3.5px; /* headline / card border width */
  --sh: 4px 4px 0 var(--ink);
  --sh-sm: 3px 3px 0 var(--ink);
  --sh-lg: 6px 6px 0 var(--ink);

  --mono: "SFMono-Regular", "SF Mono", "JetBrains Mono", "Courier New", monospace;
  --display: "Arial Black", "Helvetica Neue", Impact, system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--body);
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}
a:hover {
  background: var(--yellow);
}

/* ============================================================
   Decorative furniture (fixed corner accents, behind content)
   ============================================================ */
.deco {
  position: fixed;
  z-index: 0;
  pointer-events: none;
}
.deco-stairs {
  left: 0;
  bottom: 0;
  width: 150px;
  height: 150px;
}
.deco-starburst {
  right: 0;
  bottom: 0;
  width: 190px;
  height: 190px;
}
.deco-circle {
  left: 26px;
  top: 46%;
  width: 46px;
  height: 46px;
  background: var(--cyan);
  border: var(--bw) solid var(--ink);
  border-radius: 50%;
  box-shadow: var(--sh-sm);
}
@media (max-width: 1000px) {
  .deco {
    display: none;
  }
}

/* ============================================================
   Header
   ============================================================ */
.app-header {
  /* Sticky: die Ansatz-Tabs bleiben beim Lesen der Anleitung sichtbar --
     Voraussetzung dafuer, dass das Mitleuchten ueberhaupt etwas nuetzt. */
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 22px;
  background: var(--paper);
  color: var(--ink);
  border-bottom: var(--bw-thick) solid var(--ink);
  flex-wrap: wrap;
}
.app-title {
  font-family: var(--display);
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 0.5px;
  color: var(--paper);
  background: var(--ink);
  padding: 5px 12px;
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-sm);
}
.app-nav {
  flex: 1;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.app-nav a {
  font-weight: 800;
  font-size: 13px;
  color: var(--ink);
  text-decoration: none;
  padding: 6px 14px;
  background: var(--card);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-sm);
  transition: none;
}
.app-nav a:hover {
  background: var(--cyan);
}
.app-nav a.active {
  background: var(--yellow);
  box-shadow: 1px 1px 0 var(--ink);
  transform: translate(2px, 2px);
}
.status-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  background: var(--card);
  padding: 6px 12px;
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-sm);
}
.status-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--ink-soft);
}
.status-dot.status-ok {
  background: var(--green);
}
.status-dot.status-stale {
  background: var(--red);
}

/* ============================================================
   Layout + headings
   ============================================================ */
.app-main {
  position: relative;
  z-index: 2;
  padding: 28px 22px 64px;
  max-width: 1120px;
  margin: 0 auto;
}
.page-title {
  position: relative;
  display: inline-block;
  font-family: var(--display);
  font-weight: 900;
  font-size: 46px;
  line-height: 0.95;
  letter-spacing: -1px;
  text-transform: none;
  margin-bottom: 22px;
  padding-right: 6px;
}
.page-title::after {
  /* yellow underline slab */
  content: "";
  display: block;
  height: 10px;
  margin-top: 4px;
  background: var(--yellow);
  border: var(--bw) solid var(--ink);
}
h2 {
  font-family: var(--display);
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--ink);
  margin: 30px 0 12px;
  display: inline-block;
  background: var(--lilac);
  padding: 5px 12px;
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-sm);
}
h2:first-of-type {
  margin-top: 0;
}
.section {
  margin-bottom: 12px;
}

/* Shared card primitive */
.nb-card {
  background: var(--card);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh);
}

/* ============================================================
   Help box
   ============================================================ */
.help-box {
  background: var(--lilac);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh);
  padding: 12px 16px;
  margin-bottom: 22px;
}
.help-box summary {
  font-family: var(--display);
  font-weight: 900;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}
.help-box summary::-webkit-details-marker {
  display: none;
}
.help-box summary::before {
  content: "\25B8  ";
}
.help-box[open] summary::before {
  content: "\25BE  ";
}
.help-box p {
  margin-top: 10px;
  line-height: 1.55;
  font-size: 12.5px;
  color: var(--ink);
}

/* ============================================================
   Sortable headers / notes / footnotes
   ============================================================ */
.sort-link {
  color: inherit;
  text-decoration: none;
}
.sort-link:hover {
  background: var(--yellow);
}
.sort-link.sort-active {
  background: var(--yellow);
  padding: 1px 4px;
  border: 2px solid var(--ink);
}
.filter-note {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  background: var(--yellow);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-sm);
  padding: 7px 12px;
  margin-bottom: 16px;
}
.filter-note a {
  color: var(--ink);
}
.page-footnote {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-top: 22px;
  padding-top: 10px;
  border-top: var(--bw) dashed var(--ink);
}

/* ============================================================
   Was-waere-wenn panel (hero card)
   ============================================================ */
.wwn-panel {
  background: var(--cyan);
  border: var(--bw-thick) solid var(--ink);
  box-shadow: var(--sh-lg);
  padding: 18px 22px;
  margin-bottom: 24px;
}
.wwn-label {
  font-family: var(--display);
  font-size: 12px;
  font-weight: 900;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.wwn-headline {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.wwn-value {
  font-family: var(--display);
  font-size: 40px;
  font-weight: 900;
  line-height: 1;
  color: var(--ink);
}
.wwn-pnl {
  font-size: 15px;
  font-weight: 800;
  padding: 3px 8px;
  border: 2px solid var(--ink);
  background: var(--card);
}
.compare-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.compare-card {
  flex: 1 1 160px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  text-decoration: none;
  color: var(--ink);
  background: var(--card);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-sm);
}
.compare-card:hover {
  background: var(--cyan);
}
.compare-label {
  font-family: var(--display);
  font-weight: 900;
  font-size: 13px;
  text-transform: uppercase;
}
.compare-value {
  font-size: 20px;
  font-weight: 800;
}
.compare-metric {
  font-size: 11px;
  color: var(--ink-soft);
}
.compare-pnl {
  font-weight: 700;
  font-size: 12px;
}

/* ============================================================
   Stat cards
   ============================================================ */
.stat-row {
  display: flex;
  gap: 14px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.stat {
  flex: 1;
  background: var(--card);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh);
  padding: 12px 16px;
  min-width: 175px;
}
.stat-label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.stat-value {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 900;
  color: var(--ink);
}

/* ============================================================
   Tables
   ============================================================ */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--card);
  border: var(--bw-thick) solid var(--ink);
  box-shadow: var(--sh-lg);
  font-size: 12.5px;
  margin-bottom: 8px;
}
th,
td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 2px solid var(--ink);
  vertical-align: top;
}
th {
  font-family: var(--display);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink);
  font-weight: 900;
  background: var(--yellow);
  border-bottom: var(--bw) solid var(--ink);
  position: sticky;
  top: 0;
}
th + th,
td + td {
  border-left: 2px solid var(--ink);
}
tr:last-child td {
  border-bottom: none;
}
tbody tr:nth-child(even) td,
table tr:nth-child(even) td {
  background: #faf7ef;
}
tr:hover td {
  background: #fff6cc;
}
td.num,
th.num {
  text-align: right;
}
tr:target td {
  background: var(--yellow);
  box-shadow: inset 4px 0 0 var(--coral);
}
.pnl-positive {
  color: var(--green);
  font-weight: 800;
}
.pnl-negative {
  color: var(--red);
  font-weight: 800;
}

/* Cell sub-lines */
.cell-primary {
  display: block;
  font-weight: 700;
}
.cell-sub {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
}
.cell-muted {
  color: var(--ink-soft);
}

/* Confidence: colour bands (red = unsicher -> gruen = sicher).
   The band class sets --band, which both the pill and the filled dots read. */
.conf-lo {
  --band: #f0917f;
}
.conf-mid {
  --band: #f7c948;
}
.conf-hi {
  --band: #9ad27f;
}
.conf-vhi {
  --band: #4fb477;
}
.conf-pill {
  display: inline-block;
  font-weight: 800;
  font-size: 11.5px;
  padding: 0 6px;
  margin-left: 3px;
  border: 2px solid var(--ink);
  background: var(--band, var(--card));
  color: var(--ink);
}
.conf-dots {
  display: flex;
  gap: 3px;
  margin-top: 4px;
}
.conf-dot {
  width: 9px;
  height: 9px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--card);
}
.conf-dot.on {
  background: var(--band, var(--lilac));
}

/* Glossary (help boxes) */
.glossary {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  border-top: 2px solid var(--ink);
}
.glossary li {
  padding: 7px 0;
  font-size: 12px;
  line-height: 1.5;
  border-bottom: 2px dashed var(--ink);
}
.glossary li:last-child {
  border-bottom: none;
}
.glossary b {
  display: inline-block;
  background: var(--yellow);
  border: 2px solid var(--ink);
  padding: 0 6px;
  margin-right: 6px;
  font-weight: 800;
}

/* Kernargumente */
.argument-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
}
.argument-list li {
  position: relative;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 4px;
  padding-left: 16px;
}
.argument-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  width: 8px;
  height: 8px;
  background: var(--coral);
  border: 1.5px solid var(--ink);
}
.argument-list li:last-child {
  margin-bottom: 0;
}

/* ============================================================
   Badges
   ============================================================ */
.badge {
  display: inline-block;
  border: 2px solid var(--ink);
  background: var(--card);
  color: var(--ink);
  font-family: var(--display);
  font-size: 10.5px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  margin: 0 5px 3px 0;
  box-shadow: 2px 2px 0 var(--ink);
}
.badge-trade-yes {
  background: var(--green);
  color: var(--card);
}
.badge-trade-no {
  background: var(--red);
  color: var(--card);
}
.badge-no-trade {
  background: var(--card);
  color: var(--ink);
}
.badge-bought {
  background: var(--ink);
  color: var(--card);
}
.side-none {
  color: var(--ink-soft);
  font-weight: 700;
}
.side-ja {
  color: var(--green);
}
.side-nein {
  color: var(--red);
}

/* Ergebnis-Box: offen = gestrichelt + glimmend, aufgeloest = gefuellt. */
.result-box {
  display: inline-block;
  font-family: var(--display);
  font-size: 12.5px;
  padding: 2px 8px;
  border: 2px solid var(--ink);
  white-space: nowrap;
}
/* Offen: transparenter Hintergrund, farbiger gestrichelter Rand + Zahl; nur
   die Transparenz der Zahl pulsiert (kein Blur), zackig. */
.result-box.live {
  background: transparent;
  border-style: dashed;
}
.result-box.live.flat {
  color: var(--ink-soft);
  border-color: var(--ink-soft);
}
.result-box.live.gain {
  color: var(--green);
  border-color: var(--green);
  animation: pulse-gain 0.8s ease-in-out infinite alternate;
}
.result-box.live.loss {
  color: var(--red);
  border-color: var(--red);
  animation: pulse-loss 0.8s ease-in-out infinite alternate;
}
.result-box.final {
  color: #fff;
}
.result-box.final.gain {
  background: var(--green);
}
.result-box.final.loss {
  background: var(--red);
}
.result-box.final.flat {
  background: var(--ink-soft);
}
@keyframes pulse-gain {
  from {
    color: color-mix(in srgb, var(--green) 22%, transparent);
  }
  to {
    color: var(--green);
  }
}
@keyframes pulse-loss {
  from {
    color: color-mix(in srgb, var(--red) 22%, transparent);
  }
  to {
    color: var(--red);
  }
}
@media (prefers-reduced-motion: reduce) {
  .result-box.live {
    animation: none;
  }
}
.badge-longshot {
  background: var(--coral);
  color: var(--card);
}
.badge-near-certain {
  background: var(--cyan);
  color: var(--ink);
}
.badge-politics {
  background: var(--lilac);
  color: var(--ink);
}

/* urgency emphasis for "Endet in" */
.ends-soon {
  display: inline-block;
  background: var(--coral);
  color: var(--card);
  font-weight: 800;
  padding: 1px 7px;
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
}

/* ============================================================
   Empty states
   ============================================================ */
.empty-state {
  background: var(--card);
  border: var(--bw) dashed var(--ink);
  color: var(--ink);
  font-weight: 600;
  padding: 18px;
  font-size: 12.5px;
}

/* ============================================================
   Charts
   ============================================================ */
.chart {
  display: block;
  width: 100%;
  height: auto;
  background: var(--card);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh);
}
.chart-axis {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  margin-top: 6px;
}
.brier-bars {
  background: var(--card);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh);
  padding: 14px 16px;
}
.brier-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.brier-bar-row:last-child {
  margin-bottom: 0;
}
.brier-bar-label {
  width: 56px;
  font-family: var(--display);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--ink);
  flex-shrink: 0;
}
.brier-bar-track {
  flex: 1;
  background: var(--paper);
  border: 2px solid var(--ink);
  height: 18px;
  padding: 0;
}
.brier-bar-fill {
  height: 100%;
  border-right: 2px solid var(--ink);
}
.brier-bar-system {
  background: var(--cyan);
}
.brier-bar-market {
  background: var(--ink-soft);
}
.brier-bar-value {
  width: 62px;
  text-align: right;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
}
.brier-caption {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-top: 8px;
}
/* Je-Ereignis-Zeile der Kalibrierung: die Pseudoreplikations-korrigierte
   Zahl soll auffallen, ohne ein eigenes Panel zu brauchen. */
.cluster-note {
  font-size: 12px;
  font-weight: 700;
  margin-top: 10px;
  padding: 6px 10px;
  border: 2px solid var(--ink);
  background: var(--yellow);
  display: inline-block;
}
/* Preisband, in dem die Schaetzung nachweislich ausserhalb des
   Wilson-Intervalls liegt. */
.bucket-auffaellig td {
  color: var(--red);
  font-weight: 800;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 720px) {
  .page-title {
    font-size: 34px;
  }
  .wwn-value {
    font-size: 30px;
  }
  .app-main {
    padding: 22px 14px 48px;
  }
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  /* Mobiler Header: kompakt statt gestapelt.

     Vorher bekam jede Nav-Gruppe eine eigene volle Zeile (die Trenner waren
     vollbreite Umbrueche) und Titel, Dev, Status und Abmelden je eine weitere
     -- zusammen fast ein ganzer Handy-Bildschirm, bevor der Inhalt anfing.

     Jetzt: eine Kopfzeile (Titel links, Dev/Status/Abmelden rechts) und
     darunter die Nav, die frei umbricht. Die Trenner bleiben duenne
     senkrechte Striche wie am Desktop, brechen die Zeile aber nicht mehr
     auf. Ergebnis: rund zwei Reihen Knoepfe statt sieben. */
  .app-header {
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
  }
  .app-title {
    order: 1;
    font-size: 15px;
    padding: 4px 8px;
    letter-spacing: 0.3px;
  }
  .dev-link {
    order: 2;
    margin-left: auto;
    font-size: 10px;
    padding: 4px 8px;
  }
  .status-line {
    order: 3;
    margin-left: 0;
    font-size: 10.5px;
    padding: 4px 8px;
    gap: 5px;
  }
  .dev-link + .status-line {
    margin-left: 0;
  }
  /* "Stand HH:MM UTC" ist am Handy Beiwerk -- das Live-Signal und das Alter
     des Herzschlags reichen. */
  .status-extra {
    display: none;
  }
  .logout-form {
    order: 4;
    margin-left: 0;
  }
  .logout-btn {
    font-size: 10px;
    padding: 4px 8px;
  }
  .app-nav {
    order: 5;
    flex: 0 0 100%;
    width: 100%;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
  }
  .app-nav a {
    flex: 0 0 auto;
    font-size: 11px;
    padding: 4px 8px;
    box-shadow: 2px 2px 0 var(--ink);
  }
  .app-nav a.active {
    box-shadow: 1px 1px 0 var(--ink);
  }
  /* Gruppen-Trenner am Handy weglassen: bei umbrechenden Zeilen landen sie
     sonst als verwaiste Striche am Zeilenanfang. Die Gruppierung steckt
     ohnehin in der Reihenfolge -- am Desktop bleiben die Striche. */
  .nav-sep {
    display: none;
  }
  /* Subleiste (Strategie-/Ansichts-Filter) genauso kompakt -- sie steht
     direkt unter der Nav und verdoppelte sonst den Platzverbrauch. */
  .subnav {
    padding: 8px 12px;
    gap: 5px;
  }
  .subnav-link {
    font-size: 10.5px;
    padding: 4px 8px;
  }
  /* Kennzahl-Kacheln zu zweit nebeneinander statt gestapelt: vier volle
     Reihen schoben den eigentlichen Inhalt sonst unter die Falz. */
  .stat-row {
    gap: 10px;
  }
  .stat {
    flex: 1 1 calc(50% - 5px);
    min-width: 0;
    padding: 10px 12px;
  }
  .stat-value {
    font-size: 18px;
  }
}

/* ============================================================
   Anleitung ("Wie funktioniert das?") — Erklaerseite
   ============================================================ */
.expl-thesis {
  font-size: 20px;
  line-height: 1.4;
  font-weight: 500;
  max-width: 34ch;
  margin: 0 0 8px;
}
.expl-thesis b {
  background: var(--cyan);
  padding: 0 4px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.expl p {
  max-width: 62ch;
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 1.6;
}
.expl .hl {
  background: var(--yellow);
  padding: 0 4px;
  font-weight: 700;
}

.expl-prob {
  background: var(--card);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh);
  padding: 18px 20px;
  margin: 6px 0 8px;
}
.expl-prob-q {
  font-family: var(--display);
  font-size: 14px;
  margin-bottom: 4px;
}
.expl-track {
  position: relative;
  height: 44px;
  border: 2.5px solid var(--ink);
  margin: 34px 0 8px;
  background: repeating-linear-gradient(
    90deg, transparent 0, transparent 9.6%,
    #e2ded3 9.6%, #e2ded3 10%
  );
}
.expl-mark {
  position: absolute;
  top: -6px;
  bottom: -6px;
  width: 4px;
  background: var(--ink);
}
.expl-flag {
  position: absolute;
  top: -32px;
  transform: translateX(-50%);
  font-family: var(--display);
  font-size: 11px;
  white-space: nowrap;
  border: 2.5px solid var(--ink);
  padding: 2px 6px;
}
.expl-gap {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 16px;
  background: rgba(255, 92, 57, 0.55);
  border-top: 2.5px solid var(--ink);
  border-bottom: 2.5px solid var(--ink);
}
.expl-scale {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
}

.expl-flow {
  display: flex;
  flex-direction: column;
}
.expl-step {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 16px;
}
.expl-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.expl-num {
  width: 48px;
  height: 48px;
  flex: none;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 20px;
  background: var(--yellow);
  color: var(--ink);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-sm);
}
.expl-step:nth-child(2) .expl-num { background: var(--cyan); }
.expl-step:nth-child(3) .expl-num { background: var(--lilac); }
.expl-step:nth-child(4) .expl-num { background: var(--coral); }
.expl-step:nth-child(6) .expl-num { background: var(--green); color: #fff; }
.expl-linev {
  flex: 1;
  width: 4px;
  background: var(--ink);
  margin: 6px 0;
  min-height: 14px;
}
.expl-step:last-child .expl-linev { display: none; }
.expl-stepbody { padding-bottom: 26px; }
.expl-stepbody h3 {
  font-family: var(--display);
  font-size: 17px;
  margin: 4px 0 6px;
}
.expl-ex {
  margin-top: 10px;
  background: var(--card);
  border: 2.5px solid var(--ink);
  border-left: 8px solid var(--cyan);
  padding: 10px 12px;
  font-size: 14.5px;
}
.expl-ex b { font-family: var(--mono); }

.expl-gloss {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.expl-term {
  background: var(--card);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-sm);
  padding: 14px 16px;
}
.expl-term h4 {
  font-family: var(--display);
  font-size: 15px;
  margin: 0 0 5px;
}
.expl-term p { font-size: 14px; margin: 0; max-width: none; }

.expl-outcome {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 6px;
}
.expl-out {
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-sm);
  padding: 16px 18px;
}
.expl-out.win { background: #d8efdd; }
.expl-out.lose { background: #f7dcd6; }
.expl-out h4 {
  font-family: var(--display);
  font-size: 16px;
  margin: 0 0 5px;
}
.expl-out p { font-size: 14px; margin: 0; max-width: none; }

@media (max-width: 640px) {
  .expl-gloss, .expl-outcome { grid-template-columns: 1fr; }
}

/* ============================================================
   Diagramm-Tabs (Uebersicht) + hypothetische Trefferbilanz
   ============================================================ */
.chart-panel {
  margin-top: 6px;
}
.chart-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.chart-tab {
  font-family: var(--display);
  font-weight: 900;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 4px 11px;
  color: var(--ink);
  text-decoration: none;
  background: var(--card);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-sm);
}
.chart-tab:hover {
  background: var(--cyan);
}
.chart-tab.active {
  background: var(--yellow);
  box-shadow: 1px 1px 0 var(--ink);
  transform: translate(2px, 2px);
}

/* Trefferbilanz: gruene Balken (oben) = lagen richtig, rote (unten) = falsch.
   Offene Maerkte = Mark-to-Market-Schaetzung -> gestrichelt + heller. */
.pnl-chart .pnl-zero {
  stroke: var(--ink);
  stroke-width: 2;
}
.pnl-bar {
  stroke: var(--ink);
  stroke-width: 1.5;
}
.pnl-bar.gain {
  fill: var(--green);
}
.pnl-bar.loss {
  fill: var(--red);
}
.pnl-bar.open {
  fill-opacity: 0.32;
  stroke-dasharray: 3 2;
}
.nav-sep {
  width: 0;
  border-left: var(--bw) solid var(--ink);
  align-self: stretch;
  margin: 0 4px;
  opacity: 0.35;
}
.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 20px;
  border-bottom: var(--bw) solid var(--ink);
  background: var(--paper);
}
.subnav-link {
  font-family: var(--display);
  font-weight: 900;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 4px 11px;
  color: var(--ink);
  text-decoration: none;
  background: var(--card);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-sm);
}
.subnav-link:hover {
  background: var(--cyan);
}
.subnav-link.active {
  background: var(--yellow);
  box-shadow: 1px 1px 0 var(--ink);
  transform: translate(2px, 2px);
}
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.chip {
  font-family: var(--display);
  font-weight: 900;
  font-size: 11px;
  text-transform: uppercase;
  padding: 4px 11px;
  color: var(--ink);
  text-decoration: none;
  background: var(--card);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-sm);
}
.chip:hover {
  background: var(--cyan);
}
.chip.active {
  background: var(--yellow);
  box-shadow: 1px 1px 0 var(--ink);
  transform: translate(2px, 2px);
}

/* Zeitfenster-Umschalter fuer alle PnL-Anzeigen einer Seite (?pnl=). */
.pnl-toggle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
}
.pnl-toggle-label {
  font-family: var(--display);
  font-weight: 900;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin-right: 2px;
}

/* ============================================================
   Scroll-Mitleuchten: markiert den Nav-Tab des Abschnitts, den
   man gerade liest (Anleitung). Rein dekorativ.
   ============================================================ */
.app-nav a.nav-spy-active {
  background: var(--lilac);
  animation: nav-spy-pulse 1.4s ease-in-out 3;
}
@keyframes nav-spy-pulse {
  0%,
  100% {
    box-shadow: var(--sh-sm);
  }
  50% {
    box-shadow: 0 0 0 3px var(--lilac), var(--sh-sm);
  }
}
@media (prefers-reduced-motion: reduce) {
  .app-nav a.nav-spy-active {
    animation: none;
  }
}

/* Abschnitt je Ansatz auf der Anleitungsseite */
.expl-approach {
  scroll-margin-top: 90px;
  margin-top: 30px;
  padding-top: 6px;
}

/* ============================================================
   Dev-Bereich: Button rechts (links neben der Statuszeile) + Changelog
   ============================================================ */
.dev-link {
  margin-left: auto; /* schiebt Dev + Statuszeile nach rechts */
  font-family: var(--display);
  font-weight: 900;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 5px 12px;
  color: var(--ink);
  text-decoration: none;
  background: var(--card);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-sm);
}
.dev-link:hover {
  background: var(--cyan);
}
.dev-link.active {
  background: var(--yellow);
  box-shadow: 1px 1px 0 var(--ink);
  transform: translate(2px, 2px);
}
/* Statuszeile schliesst direkt rechts an den Dev-Button an. */
.dev-link + .status-line {
  margin-left: 12px;
}

/* ============================================================
   Anmeldung: Abmelden-Knopf im Header + Login-Seite
   ============================================================ */
.logout-form {
  margin-left: 12px;
  display: flex;
}
.logout-btn {
  font-family: var(--display);
  font-weight: 900;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 5px 12px;
  color: var(--ink);
  background: var(--card);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-sm);
  cursor: pointer;
}
.logout-btn:hover {
  background: var(--coral);
}
.logout-btn:active {
  box-shadow: 1px 1px 0 var(--ink);
  transform: translate(2px, 2px);
}

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
}
.login-box {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: var(--bw-thick) solid var(--ink);
  box-shadow: var(--sh-lg);
  padding: 26px 24px 22px;
}
.login-title {
  font-family: var(--display);
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.01em;
}
.login-sub {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 6px 0 18px;
}
.login-error {
  background: var(--coral);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-sm);
  padding: 8px 12px;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 600;
}
.login-form {
  display: flex;
  flex-direction: column;
}
.login-label {
  font-family: var(--display);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.login-input {
  font-family: var(--mono);
  /* 16px: alles darunter laesst iOS beim Fokus hineinzoomen. */
  font-size: 16px;
  padding: 10px 12px;
  margin-bottom: 16px;
  background: var(--paper);
  border: var(--bw) solid var(--ink);
  color: var(--ink);
}
.login-input:focus {
  outline: none;
  background: var(--card);
  box-shadow: var(--sh-sm);
}
.login-submit {
  font-family: var(--display);
  font-weight: 900;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 12px;
  margin-top: 4px;
  background: var(--yellow);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh);
  cursor: pointer;
}
.login-submit:active {
  box-shadow: 1px 1px 0 var(--ink);
  transform: translate(3px, 3px);
}
.login-hint {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 14px;
}

.log-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.log-entry {
  background: var(--card);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-sm);
  padding: 10px 14px;
}
.log-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}
.log-date {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
}
.log-pr {
  font-family: var(--display);
  font-weight: 900;
  font-size: 11px;
  padding: 1px 7px;
  color: var(--ink);
  text-decoration: none;
  background: var(--yellow);
  border: 2px solid var(--ink);
}
.log-pr:hover {
  background: var(--cyan);
}
.log-pr-none {
  background: var(--paper);
  color: var(--ink-soft);
}
.log-author {
  font-size: 11px;
  color: var(--ink-soft);
  font-weight: 700;
}
.log-text {
  font-size: 14px;
  margin: 0;
  max-width: 78ch;
}

/* Backlog: ausklappbare Kategorie-Bloecke + Detailseite */
.backlog-group {
  background: var(--card);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-sm);
  margin-bottom: 12px;
  padding: 8px 12px;
}
.backlog-group > summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  list-style: none;
}
.backlog-group > summary::-webkit-details-marker {
  display: none;
}
.backlog-group > summary::before {
  content: "\25B8";
  font-size: 13px;
}
.backlog-group[open] > summary::before {
  content: "\25BE";
}
.backlog-cat {
  font-family: var(--display);
  font-weight: 900;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.backlog-count {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  background: var(--paper);
  border: 2px solid var(--ink);
}
.backlog-title {
  font-weight: 800;
  color: var(--ink);
}
.backlog-title-plain {
  font-weight: 800;
}
/* Plan-Button: ganz klickbar, sitzt oben rechts in der Zeile.
   Aufbau: [Dokument-Icon] Plan [Link-Icon] */
.backlog-plan {
  float: right;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 4px 10px;
  font-family: var(--display);
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 7px;
  color: var(--ink);
  text-decoration: none;
  background: var(--cyan);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
}
.backlog-plan:hover {
  background: var(--yellow);
}
.backlog-plan:active {
  box-shadow: 1px 1px 0 var(--ink);
  transform: translate(1px, 1px);
}
.backlog-plan .ic {
  display: block;
  flex: none;
}

/* Gerenderte Markdown-Detailseite */
.md-body {
  display: block;
  max-width: 78ch;
}
.md-body h2 {
  margin: 22px 0 8px;
}
.md-body h3 {
  font-size: 15px;
  margin: 18px 0 6px;
}
.md-body p {
  font-size: 14px;
  margin: 0 0 10px;
}
.md-body ul {
  margin: 0 0 12px 20px;
}
.md-body li {
  font-size: 14px;
  margin-bottom: 4px;
}
.md-body blockquote {
  margin: 0 0 12px;
  padding: 8px 12px;
  background: var(--card);
  border-left: var(--bw-thick) solid var(--ink);
  font-size: 14px;
}
.md-body code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--paper);
  padding: 1px 4px;
  border: 1px solid var(--ink);
}

/* Backlog-Status: erledigt / laeuft */
.backlog-status {
  font-family: var(--display);
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 1px 6px;
  margin-right: 6px;
  border: 2px solid var(--ink);
  vertical-align: middle;
}
.status-erledigt {
  background: var(--green);
  color: #fff;
}
.status-laeuft {
  background: var(--yellow);
}
.backlog-done {
  opacity: 0.55;
}
.backlog-done .backlog-title,
.backlog-done .backlog-title-plain {
  text-decoration: line-through;
}

/* Anker-Test: blinde Varianten optisch abheben */
.anker-blind {
  background: color-mix(in srgb, var(--lilac) 25%, transparent);
}

/* Aktive Strategie-Kachel auf /mechanical (Auswahl passiert in der Subleiste) */
.stat-aktiv {
  outline: 3px solid var(--ink);
  background: color-mix(in srgb, var(--yellow) 30%, var(--card));
}

/* Profilbilder im Dev-Bereich -- gross, quadratisch, ohne Namen.
   Einheitliche Kantenlaenge, damit Changelog und Backlog gleich wirken. */
:root {
  --avatar-gross: 76px;
}
.avatar-gross {
  display: block;
  width: var(--avatar-gross);
  height: var(--avatar-gross);
  object-fit: cover;
  border: var(--bw) solid var(--ink);
  background: var(--card);
}
.avatar-kuerzel {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 900;
  color: var(--ink);
  background: var(--lilac);
}

/* Changelog: Bild als eigene Spalte ganz links */
.log-entry {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.log-avatar {
  flex: none;
}
.log-body {
  flex: 1;
  min-width: 0;
}

/* Backlog: die Autor-Zelle wird vom Bild bestimmt */
.backlog-avatar {
  width: calc(var(--avatar-gross) + 8px);
  padding: 6px !important;
  text-align: center;
}
.backlog-avatar .avatar-gross {
  margin: 0 auto;
}

@media (max-width: 640px) {
  :root {
    --avatar-gross: 52px;
  }
}

/* ============================================================
   ECHTGELD-BEREICH (/live)

   Der optische Bruch ist hier KEIN Schmuck, sondern die Schutzfunktion:
   Papier und echtes Geld duerfen sich nie verwechseln lassen. Deshalb ist
   dies die eine Stelle, an der die Hausregeln bewusst gebrochen werden --
   dunkler Grund und ein Streifenmuster statt flachem Papier. Der Bruch ist
   der Punkt; in CLAUDE.md steht er als Ausnahme.

   Die neobrutalistischen Knochen bleiben: dicke Rahmen, harte Schatten,
   keine Rundungen, keine Weichzeichnung.
   ============================================================ */
:root {
  --hoelle-grund: #1a0e0e;
  --hoelle-karte: #241414;
  --hoelle-linie: #ff5c39;
  --hoelle-text: #f6ece6;
  --hoelle-weich: #c39b8c;
}

body.echtgeld {
  background-color: var(--hoelle-grund);
  /* Diagonale Streifen statt Verlauf: bleibt flach, wie das System es will,
     und macht den Bereich trotzdem auf einen Blick unverwechselbar. */
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255, 92, 57, 0.07) 0 14px,
    rgba(255, 92, 57, 0) 14px 28px
  );
  color: var(--hoelle-text);
}
body.echtgeld .deco { display: none; }

/* Kopf und Nav ziehen mit -- sonst sieht nur der Inhalt anders aus und man
   koennte den Bereich beim Scrollen fuer normal halten. */
body.echtgeld .app-header {
  background: var(--hoelle-grund);
  border-bottom-color: var(--hoelle-linie);
}
body.echtgeld .app-title {
  background: var(--hoelle-linie);
  color: var(--hoelle-grund);
  border-color: var(--hoelle-linie);
  box-shadow: 3px 3px 0 #7a2413;
}
body.echtgeld .app-nav a,
body.echtgeld .dev-link,
body.echtgeld .status-line,
body.echtgeld .logout-btn {
  background: var(--hoelle-karte);
  color: var(--hoelle-text);
  border-color: var(--hoelle-linie);
  box-shadow: 3px 3px 0 #7a2413;
}
body.echtgeld .app-nav a:hover,
body.echtgeld .dev-link:hover,
body.echtgeld .logout-btn:hover {
  background: var(--hoelle-linie);
  color: var(--hoelle-grund);
}
body.echtgeld .app-nav a.active {
  background: var(--hoelle-linie);
  color: var(--hoelle-grund);
}
body.echtgeld .nav-sep { border-left-color: var(--hoelle-linie); }

body.echtgeld .page-title { color: var(--hoelle-text); }
body.echtgeld .page-title::after {
  background: var(--hoelle-linie);
  border-color: var(--hoelle-linie);
}
body.echtgeld h2 {
  background: var(--hoelle-linie);
  color: var(--hoelle-grund);
  border-color: var(--hoelle-linie);
  box-shadow: 3px 3px 0 #7a2413;
}
body.echtgeld .stat,
body.echtgeld table,
body.echtgeld .empty-state,
body.echtgeld .help-box {
  background: var(--hoelle-karte);
  color: var(--hoelle-text);
  border-color: var(--hoelle-linie);
  box-shadow: 4px 4px 0 #7a2413;
}
body.echtgeld .stat-label,
body.echtgeld .cell-sub { color: var(--hoelle-weich); }
body.echtgeld .stat-value { color: var(--hoelle-text); }
body.echtgeld th {
  background: var(--hoelle-linie);
  color: var(--hoelle-grund);
  border-bottom-color: var(--hoelle-grund);
}
body.echtgeld th + th,
body.echtgeld td + td { border-left-color: rgba(255, 92, 57, 0.4); }
body.echtgeld td { border-bottom-color: rgba(255, 92, 57, 0.4); }
body.echtgeld tbody tr:nth-child(even) td,
body.echtgeld table tr:nth-child(even) td { background: #2c1a1a; }
body.echtgeld tr:hover td { background: #3a2020; }
body.echtgeld .badge {
  background: var(--hoelle-grund);
  color: var(--hoelle-text);
  border-color: var(--hoelle-linie);
  box-shadow: 2px 2px 0 #7a2413;
}
body.echtgeld a { color: var(--hoelle-text); }
body.echtgeld a:hover { background: var(--hoelle-linie); color: var(--hoelle-grund); }
body.echtgeld code:not(pre code) {
  background: var(--hoelle-grund);
  color: var(--hoelle-text);
  border-color: var(--hoelle-linie);
}
body.echtgeld .help-box summary { color: var(--hoelle-text); }
body.echtgeld .pnl-positive { color: #5ddb8f; }
body.echtgeld .pnl-negative { color: #ff7a5c; }

/* Warnleiste ganz oben. */
.hoellen-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--hoelle-linie);
  color: #1a0e0e;
  border: var(--bw-thick) solid #1a0e0e;
  box-shadow: 6px 6px 0 #7a2413;
  padding: 14px 18px;
  margin-bottom: 18px;
}
.hoellen-banner b {
  display: block;
  font-family: var(--display);
  font-size: 17px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.hoellen-banner span { font-size: 12.5px; font-weight: 600; }
.hoellen-banner a { color: #1a0e0e; }
.hoellen-icon { flex: 0 0 auto; color: #1a0e0e; }

/* Schloss-Zeile. */
.schloss-zeile {
  background: var(--hoelle-karte);
  border: var(--bw) solid var(--hoelle-linie);
  box-shadow: 4px 4px 0 #7a2413;
  padding: 10px 14px;
  margin-bottom: 18px;
  font-size: 12.5px;
}
.schloss-badge {
  display: inline-block;
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.05em;
  padding: 2px 9px;
  margin-right: 8px;
  background: #7a2413;
  color: var(--hoelle-text);
  border: 2px solid var(--hoelle-linie);
}
.schloss-badge.scharf { background: #0d7a3f; border-color: #5ddb8f; }
.schloss-liste { margin: 8px 0 0 18px; }
.schloss-liste li { margin-bottom: 3px; }

/* Nav-Eintrag: schon im Papier-Bereich als Grenze erkennbar. */
.nav-echtgeld {
  background: var(--coral) !important;
  color: var(--ink) !important;
}
.nav-echtgeld:hover { background: var(--red) !important; color: #fff !important; }

.tabellen-huelle { overflow-x: auto; }

/* Nulllinie der Trefferquote: leiser als die Quote selbst, aber immer dabei --
   ohne sie ist eine Trefferquote nicht interpretierbar. */
.wr-null {
  color: var(--ink-soft);
  font-weight: 600;
}
body.echtgeld .wr-null { color: var(--hoelle-weich); }

/* --- Bullpen-Strang -------------------------------------------------------
   Rund dreissig Kacheln auf einer Seite. Zwei Zustaende muessen sich auf
   einen Blick unterscheiden lassen, sonst liest man die Seite falsch:
   eine Strategie, die NICHTS GEFUNDEN hat, und eine, die NICHT ARBEITEN
   KANN. Die zweite bekommt deshalb einen eigenen, gedaempften Zustand --
   sie soll sichtbar sein, aber nicht so laut wie ein Ergebnis. */
.stat-blockiert {
  background: repeating-linear-gradient(
    135deg,
    var(--card) 0 10px,
    color-mix(in srgb, var(--ink) 7%, var(--card)) 10px 20px
  );
}
.stat-blockiert .stat-value {
  color: var(--ink-soft);
}
/* Kennzeichnet auf der Papier-Seite die Strategien, die live freigegeben
   sind. Absichtlich auffaellig: es ist die einzige Stelle im Papier-Bereich,
   an der echtes Geld eine Rolle spielt. */
.badge-live {
  background: var(--red);
  color: #fff;
  margin-left: 6px;
}
/* Strategie-Kachel als Link: der Titel filtert die Seite auf diese eine
   Strategie. Ohne eigene Farbe -- die Kachel ist schon der Rahmen. */
.stat-label a {
  color: inherit;
}
