:root {
  --grund: #0b0d10; --flaeche: #15181d; --flaeche2: #1c2027; --linie: #262b33; --text: #eef1f4; --leise: #8b939d;
  --akzent: #f7931a; --gruen: #4ade80; --rot: #ff8a80; --radius: 18px; color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--grund); color: var(--text); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { min-height: 100vh; padding-bottom: env(safe-area-inset-bottom); touch-action: manipulation; }
body.offen { overflow: hidden; }
button { font: inherit; color: inherit; }
input { font: inherit; color: var(--text); }
[hidden] { display: none !important; }
.zahl { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

header { position: sticky; top: 0; z-index: 5; background: var(--grund); display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 8px; }
h1 { margin: 0; font-size: 22px; letter-spacing: -0.01em; flex: 1; display: flex; align-items: center; gap: 10px; }
h1::before { content: "₿"; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--akzent); color: #fff; font-size: 16px; font-weight: 700; }
.leise { background: none; border: 0; color: var(--leise); font-size: 13px; padding: 8px 6px; cursor: pointer; }
.rund { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--flaeche2); display: grid; place-items: center; cursor: pointer; }
.rund svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

main { padding: 6px 16px 110px; max-width: 720px; margin: 0 auto; }
.total { background: radial-gradient(120% 140% at 0% 0%, #2a1d0b 0%, var(--flaeche) 55%); border: 1px solid var(--linie); border-radius: 24px; padding: 18px 18px 12px; }
.etikett { color: var(--leise); font-size: 13px; }
.betrag { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; margin: 2px 0; font-variant-numeric: tabular-nums; }
.unter { color: var(--leise); font-size: 15px; display: flex; gap: 10px; flex-wrap: wrap; }
.unter #total-chf { color: var(--text); font-weight: 600; }
#kurve { width: 100%; height: 90px; margin-top: 12px; display: block; overflow: visible; }
.bereiche { display: flex; gap: 6px; margin-top: 8px; }
.bereiche button { border: 0; background: transparent; color: var(--leise); border-radius: 999px; padding: 4px 10px; font-size: 13px; cursor: pointer; }
.bereiche button.aktiv { background: var(--flaeche2); color: var(--text); }
.karte-kopf { display: flex; align-items: center; justify-content: space-between; }
.waehrung { display: flex; background: rgba(0, 0, 0, .25); border-radius: 999px; padding: 2px; }
.waehrung button { border: 0; background: transparent; color: var(--leise); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; cursor: pointer; }
.waehrung button.aktiv { background: var(--flaeche2); color: var(--text); }
.gewinn-zeile { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; margin-top: 4px; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.gewinn-karte { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--linie); border: 1px solid var(--linie); border-radius: 16px; overflow: hidden; margin-top: 4px; }
.gewinn-zeile .etikett { font-weight: 400; }
.kennzahl { background: var(--flaeche); padding: 12px 14px; }
.kennzahl .gross { font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.verdeckt .wert { filter: blur(9px); user-select: none; }

.tabs { display: flex; gap: 6px; margin: 18px 0 8px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 1px solid var(--linie); background: transparent; border-radius: 999px; padding: 7px 14px; cursor: pointer; color: var(--leise); white-space: nowrap; flex: none; }
.tabs button.aktiv { background: var(--text); color: var(--grund); border-color: var(--text); }
.tabs span { opacity: .7; }

.monat { color: var(--leise); font-size: 12px; text-transform: uppercase; letter-spacing: .07em; margin: 16px 4px 6px; }
.zeile-e { display: flex; align-items: center; gap: 12px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 14px;
  padding: 11px 14px; margin: 6px 0; text-decoration: none; color: inherit; cursor: pointer; width: 100%; text-align: left; }
.zeile-e:active { transform: scale(.99); }
.punkt { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.punkt.eingang { background: rgba(74, 222, 128, .14); color: var(--gruen); }
.punkt.ausgang { background: rgba(255, 138, 128, .14); color: var(--rot); }
.punkt.intern { background: rgba(139, 147, 157, .16); color: var(--leise); }
.punkt.adr { background: rgba(247, 147, 26, .15); color: var(--akzent); }
.mitte-e { flex: 1; min-width: 0; }
.titel-e { font-weight: 600; }
.unter-e { color: var(--leise); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rechts { text-align: right; flex: none; }
.rechts .gross { font-variant-numeric: tabular-nums; font-weight: 600; }
.rechts .klein { color: var(--leise); font-size: 12px; font-variant-numeric: tabular-nums; }
.plus { color: var(--gruen); } .minus { color: var(--rot); } .neutral { color: var(--leise); }
.offen-marke { background: rgba(247, 147, 26, .16); color: var(--akzent); border-radius: 6px; padding: 0 6px; font-size: 11px; font-weight: 600; margin-left: 6px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.hinweis, .leer { color: var(--leise); text-align: center; margin: 30px 10px; font-size: 14px; }
.hinweis { margin: 12px 0 0; }

.fab { position: fixed; right: 18px; bottom: calc(22px + env(safe-area-inset-bottom)); width: 60px; height: 60px; border-radius: 20px; border: 0;
  background: linear-gradient(135deg, #ffb547, #f7931a); color: #fff; font-size: 34px; line-height: 1; box-shadow: 0 6px 22px rgba(247, 147, 26, .35); cursor: pointer; z-index: 6; }

.vollbild { position: fixed; inset: 0; background: var(--grund); z-index: 30; display: grid; place-items: center; padding: 24px; }
.mitte { max-width: 420px; text-align: center; }
.logo { width: 72px; height: 72px; margin: 0 auto 12px; border-radius: 22px; background: url(/icon.svg) center/cover; }
.mitte p { color: var(--leise); }
.zeile { display: flex; gap: 8px; margin-top: 16px; }
.zeile input { flex: 1; min-width: 0; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--linie); background: var(--flaeche); outline: none; font-size: 16px; }
.zeile button { border: 0; border-radius: 12px; background: var(--akzent); color: #14181e; padding: 0 18px; font-weight: 700; cursor: pointer; }

.blatt { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 20; display: flex; align-items: flex-end; }
.blatt-innen { background: var(--flaeche); width: 100%; max-width: 720px; margin: 0 auto; border-radius: 26px 26px 0 0; border: 1px solid var(--linie);
  padding: 20px 18px calc(16px + env(safe-area-inset-bottom)); max-height: 85vh; overflow: auto; }
.blatt h2 { margin: 0 0 14px; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.blatt h2::before { content: ""; width: 4px; height: 18px; border-radius: 2px; background: var(--akzent); }
.feld { width: 100%; padding: 13px 14px; border-radius: 14px; border: 0; background: var(--flaeche2); outline: none; font-size: 16px; margin-bottom: 10px; }
.feld:focus { box-shadow: 0 0 0 2px var(--akzent); }
.pruefung { font-size: 13px; margin: -2px 2px 10px; }
.knoepfe { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.knoepfe .platz { flex: 1; }
.knopf { border: 0; border-radius: 14px; padding: 12px 20px; font-weight: 700; cursor: pointer; background: linear-gradient(135deg, #ffb547, #f7931a); color: #14181e; }
.knopf:disabled { background: var(--flaeche2); color: var(--leise); }
.text-knopf { border: 0; background: none; color: var(--leise); padding: 12px 8px; cursor: pointer; }
.text-knopf.gefahr { color: var(--rot); font-weight: 600; }
.notiz { color: var(--leise); font-size: 12px; margin: 10px 2px 0; }

.meldung { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--text); color: var(--grund);
  padding: 10px 16px; border-radius: 999px; font-size: 15px; z-index: 40; max-width: calc(100vw - 32px); }

/* Ziehen zum Aktualisieren */
.ziehen { position: fixed; left: 50%; top: 0; z-index: 4; width: 40px; height: 40px; margin-left: -20px; border-radius: 50%;
  background: var(--flaeche2); border: 1px solid var(--linie); display: grid; place-items: center; pointer-events: none;
  transform: translateY(-60px); opacity: 0; box-shadow: 0 4px 14px rgba(0,0,0,.4); }
.ziehen.zurueck { transition: transform .25s ease, opacity .25s ease; }
.ziehen .kreis { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--linie); border-top-color: var(--akzent); }
.ziehen.bereit .kreis { border-color: var(--akzent); border-top-color: var(--akzent); }
.ziehen.dreht .kreis { border-color: var(--linie); border-top-color: var(--akzent); animation: drehen .8s linear infinite; }
@keyframes drehen { to { transform: rotate(360deg); } }
main.gezogen { transition: transform .25s ease; }

/* Power Law */
.pl-karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 16px; padding: 14px; margin-top: 4px; }
.pl-kopf { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pl-abw { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pl-band { position: relative; height: 10px; border-radius: 999px; margin: 16px 0 6px;
  background: linear-gradient(90deg, #1f6f43 0%, #4ade80 30%, #8b939d 49%, #f7931a 75%, #ff5a4d 100%); }
.pl-band .fair { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--text); opacity: .6; }
.pl-band .marke { position: absolute; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%;
  background: var(--text); border: 3px solid var(--grund); box-shadow: 0 0 0 1px var(--text); }
.pl-skala { display: flex; justify-content: space-between; color: var(--leise); font-size: 12px; font-variant-numeric: tabular-nums; }
.pl-skala span:nth-child(2) { text-align: center; } .pl-skala span:last-child { text-align: right; }
.pl-titel { color: var(--leise); font-size: 12px; text-transform: uppercase; letter-spacing: .07em; margin: 20px 4px 6px; }
.pl-chart { width: 100%; height: 180px; display: block; }
.pl-achse { display: flex; justify-content: space-between; color: var(--leise); font-size: 11px; margin-top: 4px; }
.pl-legende { display: flex; gap: 14px; flex-wrap: wrap; color: var(--leise); font-size: 12px; margin-top: 8px; }
.pl-legende i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.pl-tabelle { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14px; }
.pl-tabelle th { color: var(--leise); font-weight: 500; font-size: 12px; text-align: right; padding: 6px 4px; }
.pl-tabelle td { text-align: right; padding: 8px 4px; border-top: 1px solid var(--linie); }
.pl-tabelle th:first-child, .pl-tabelle td:first-child { text-align: left; }

/* Modelle */
.m-zeile { display: grid; grid-template-columns: 10px 1fr auto; grid-template-areas: "p n a" ". w w"; column-gap: 10px; align-items: center;
  width: 100%; background: none; border: 0; border-top: 1px solid var(--linie); color: var(--text); font: inherit; text-align: left; padding: 10px 0; cursor: pointer; }
.m-zeile:first-of-type { margin-top: 8px; }
.m-punkt { grid-area: p; width: 10px; height: 10px; border-radius: 50%; }
.m-name { grid-area: n; font-weight: 600; }
.m-wert { grid-area: w; color: var(--leise); font-size: 13px; }
.m-ampel { grid-area: a; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.m-punkt.gruen { background: var(--gruen); } .m-punkt.rot { background: var(--rot); } .m-punkt.grau { background: var(--leise); }
.m-ampel.gruen { color: var(--gruen); background: rgba(74,222,128,.14); } .m-ampel.rot { color: var(--rot); background: rgba(255,138,128,.14); }
.m-ampel.grau { color: var(--leise); background: rgba(139,147,157,.16); }
.pl-band.fng { background: linear-gradient(90deg, #4ade80 0%, #d6e04a 35%, #8b939d 50%, #f7931a 70%, #ff5a4d 100%); }
.pl-karte .gewinn-karte { margin: 12px 0; }
.pl-karte .pl-chart { margin-top: 12px; }
.rb-liste { margin-top: 10px; }
.rb-zeile { display: flex; align-items: center; gap: 10px; padding: 5px 6px; border-radius: 8px; font-size: 14px; color: var(--leise); }
.rb-zeile i { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.rb-zeile .rb-preis { margin-left: auto; font-variant-numeric: tabular-nums; font-size: 13px; }
.rb-zeile.aktiv { background: var(--flaeche2); color: var(--text); font-weight: 600; }
.hv-balken { height: 10px; border-radius: 999px; background: var(--flaeche2); margin: 16px 0 6px; overflow: hidden; }
.hv-balken div { height: 100%; background: linear-gradient(90deg, #4ade80, #f7931a); border-radius: 999px; }
.hv-lage { font-size: 14px; margin: 10px 2px 0; line-height: 1.45; }

/* Sperre */
.finger-knopf { display: block; width: 100%; margin-top: 18px; padding: 15px 20px; font-size: 16px; }
body.gesperrt header, body.gesperrt main, body.gesperrt .fab, body.gesperrt #ziehen { visibility: hidden; }
#schloss svg { width: 20px; height: 20px; stroke: var(--leise); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#schloss.an svg { stroke: var(--akzent); }
.einstellung { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 2px; border-top: 1px solid var(--linie); }
.einstellung .titel-e { font-weight: 600; }
.einstellung select { background: var(--flaeche2); color: var(--text); border: 0; border-radius: 10px; padding: 8px 10px; font: inherit; }
.status-an { color: var(--gruen); font-weight: 600; } .status-aus { color: var(--leise); }
.platz-klein { height: 16px; }
#sperre .text-knopf { margin-top: 14px; font-size: 14px; }

/* Frische / mehr laden */
#total-karte .betrag, #total-karte .unter, #total-karte .gewinn-zeile { transition: opacity .3s ease; }
#total-karte.veraltet .betrag, #total-karte.veraltet .unter, #total-karte.veraltet .gewinn-zeile { opacity: .4; }
.mehr-knopf { display: block; width: 100%; margin: 14px 0 4px; padding: 12px; border-radius: 14px; border: 1px solid var(--linie);
  background: var(--flaeche); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.mehr-knopf:disabled { color: var(--leise); }

/* Power-Law-Zoom */
.pl-chips { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; margin-top: 14px; }
.pl-chips::-webkit-scrollbar { display: none; }
.pl-chips button { white-space: nowrap; flex: none; }
.zoom-huelle { position: relative; margin-top: 8px; touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.zoom-flaeche { position: relative; margin: 0 0 20px 0; }
.zoom-flaeche .pl-chart { margin-top: 0; }
.zoom-y { position: absolute; left: 2px; transform: translateY(-110%); font-size: 10px; color: var(--leise); font-variant-numeric: tabular-nums; pointer-events: none; text-shadow: 0 0 3px var(--flaeche); }
.zoom-x { position: absolute; top: 100%; transform: translateX(-50%); margin-top: 3px; font-size: 11px; color: var(--leise); white-space: nowrap; pointer-events: none; }
.zoom-heute { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed rgba(247,147,26,.5); pointer-events: none; }
.zoom-linie { position: absolute; top: 0; height: 220px; width: 0; border-left: 1px solid var(--text); opacity: .6; pointer-events: none; }
.zoom-tipp { position: absolute; top: 6px; min-width: 190px; white-space: nowrap; background: rgba(21,24,29,.95); border: 1px solid var(--linie); border-radius: 12px;
  padding: 8px 10px; font-size: 12px; pointer-events: none; box-shadow: 0 6px 18px rgba(0,0,0,.4); z-index: 2; }
.zoom-datum { font-weight: 700; margin-bottom: 4px; }
.zoom-zeile { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }
.zoom-zeile span { color: var(--leise); }
.zoom-hinweis { color: var(--leise); font-size: 11px; margin-top: 4px; }

/* Hopium */
.hop-held { background: radial-gradient(120% 120% at 100% 0%, #2a1d0b 0%, var(--flaeche) 60%); }
.hop-gross { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; }
.hop-satz { margin: 6px 0 4px; font-size: 15px; line-height: 1.45; }
.hop-zahl { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 4px; }
.hop-crash { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 2px; border-top: 1px solid var(--linie); }
.hop-crash:first-child { border-top: 0; }
.hop-minus { color: var(--rot); font-weight: 700; font-variant-numeric: tabular-nums; }
.pl-tabelle td.plus { color: var(--gruen); } .pl-tabelle td.minus { color: var(--rot); }

/* Demo-Modus */
.demo-knopf { border: 1px solid var(--linie); background: none; color: var(--leise); border-radius: 999px; padding: 6px 11px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
body.demo .demo-knopf { background: var(--akzent); border-color: var(--akzent); color: #14181e; }
.demo-band { position: sticky; top: 0; z-index: 4; margin: 0 16px; padding: 7px 12px; border-radius: 0 0 12px 12px; background: rgba(247,147,26,.15);
  color: var(--akzent); font-size: 12px; font-weight: 600; text-align: center; }
body.demo #schloss { display: none; }

/* Ausgang: Empfänger / vergessene eigene Adresse */
.ziel { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; padding: 10px 12px; margin-bottom: 8px; border-radius: 12px; background: var(--flaeche2); }
.ziel .text-knopf { grid-column: 1 / -1; justify-self: start; padding: 6px 0 0; color: var(--akzent); font-weight: 600; }
.ziel.zurueck { box-shadow: inset 0 0 0 1px var(--akzent); }
.hinweis-e { color: var(--akzent); font-size: 12px; margin-top: 2px; }
.ziel .unter-e { white-space: normal; overflow: visible; text-overflow: clip; }
.notiz.mono { word-break: break-all; }

/* Tab «Quanten»: Gefährdungsbalken, Marken, Schätz-Regler */
.q-bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; margin: 10px 0 4px; background: var(--flaeche2); }
.q-bar-teil { height: 100%; }
.q-marke { display: inline-block; border-radius: 6px; padding: 1px 7px; font-size: 11px; font-weight: 600; margin-top: 3px; }
.q-marke.rot { background: rgba(255, 138, 128, .16); color: var(--rot); }
.q-marke.gruen { background: rgba(74, 222, 128, .16); color: var(--gruen); }
.q-marke.grau { background: rgba(139, 147, 157, .16); color: var(--leise); }
.q-ergebnis { text-align: center; padding: 10px 0 4px; }
.q-ergebnis .gross { font-size: 24px; font-weight: 700; }
.q-ergebnis .etikett { margin-top: 2px; }
.q-regler { margin: 14px 2px 2px; }
.q-regler-kopf { display: flex; justify-content: space-between; align-items: baseline; color: var(--leise); font-size: 13px; margin-bottom: 6px; }
.q-regler-kopf .wert { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.q-regler input[type=range] { width: 100%; accent-color: var(--akzent); }

body.nur-demo #demo { display: none; }
