/* Crucial Copy Bot. Leitidee: der Signalweg. Violett/Pink = Signal-Seite (WiFi Money), Gold = Konto-Seite (Crucial, Gold).
   Grün und Rot nur für Gewinn und Verlust. Instrument Serif für große Zahlen und Überschriften, Geist für den Rest. */
@font-face { font-family: Geist; src: url(/fonts/geist-latin-wght-normal.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Instrument Serif'; src: url(/fonts/instrument-serif-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }

:root {
  --plum: #1b1230; --plum-2: #241a3e; --plum-3: #2f2352; --well: #140d26;
  --line: #3b2e5f; --hair: rgba(169, 157, 198, .18);
  --text: #f4effd; --muted: #a99dc6;
  --violet: #a97bff; --pink: #ff7ac3; --gold: #e9c46a; --gold-ink: #2a1d04;
  --gain: #6fe0a6; --loss: #ff7a85;
  --serif: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --sans: Geist, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--plum); color-scheme: dark; }
body { margin: 0; color: var(--text); font: 400 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased;
  background: radial-gradient(1100px 620px at 50% -180px, #3d2678 0%, rgba(61, 38, 120, 0) 70%) no-repeat var(--plum); min-height: 100vh; }
main { max-width: 1080px; margin: 0 auto; padding: 22px 20px 140px; padding-top: max(22px, env(safe-area-inset-top)); }
h1, h2, h3, p, dl, dd, ul { margin: 0; padding: 0; }
ul { list-style: none; }
button, input { font: inherit; color: inherit; }
.num, .figure, dd, input { font-variant-numeric: tabular-nums; }
.pos { color: var(--gain); } .neg { color: var(--loss); }
.label { color: var(--muted); font-size: 13px; }
.quiet { color: var(--muted); font-size: 13px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 6px; }

/* ------------------------------------------------ Knöpfe */
.btn { border: 1px solid var(--line); background: var(--plum-3); border-radius: 12px; padding: 0 18px; min-height: 46px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:disabled { opacity: .5; cursor: default; }
.btn--gold { background: linear-gradient(180deg, #f3d488, var(--gold)); color: var(--gold-ink); border-color: transparent; }
.btn--gold:hover:not(:disabled) { background: linear-gradient(180deg, #f8dea0, #efcc78); }
.btn--quiet { background: transparent; }
.btn--quiet:hover { background: var(--plum-3); }
.btn--danger { background: transparent; color: var(--loss); border-color: rgba(255, 122, 133, .5); }
.btn--danger:hover { background: rgba(255, 122, 133, .1); }
.link { background: none; border: 0; padding: 6px 2px; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.link:hover { color: var(--text); }

/* ------------------------------------------------ Marke und Kopf */
.mark { display: inline-block; width: 34px; height: 34px; border-radius: 10px; background: url(/copy/icon.svg) center / cover; flex: none; box-shadow: 0 0 0 1px var(--line); }
.mark--big { width: 68px; height: 68px; border-radius: 20px; box-shadow: 0 0 0 1px var(--line), 0 18px 50px rgba(169, 123, 255, .28); }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand__name { font: 400 25px/1 var(--serif); letter-spacing: .005em; }
.who { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 14px; }

/* ------------------------------------------------ Anmeldung */
.login { max-width: 380px; margin: 9vh auto 0; text-align: center; }
.login__title { font: 400 44px/1.05 var(--serif); margin-top: 22px; }
.login__sub { color: var(--muted); margin-top: 8px; }
.login__form { display: grid; gap: 14px; margin-top: 28px; text-align: left; background: var(--plum-2); border: 1px solid var(--line); border-radius: 22px; padding: 22px; }
.login label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.login input:not([type=checkbox]) { background: var(--well); border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; min-height: 48px; width: 100%; font-size: 16px; color: var(--text); }
.login label.check { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 14px; }
.login label.check input { width: 18px; height: 18px; accent-color: var(--gold); }
.hint { color: var(--muted); font-size: 13px; }
.hello { font-weight: 500; }
.err { color: var(--loss); margin-top: 14px; min-height: 1.5em; }

/* ------------------------------------------------ Signalweg (das eine starke Objekt der Seite) */
.relay { margin-top: 22px; padding: 44px 36px 36px; text-align: center; border-radius: 30px; border: 1px solid var(--line);
  background: linear-gradient(180deg, #2a1c4c 0%, #20153a 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 30px 80px rgba(8, 4, 20, .45); }
.path { display: grid; grid-template-columns: auto 1fr auto 1fr auto; align-items: center; max-width: 760px; margin: 0 auto; }

.node { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--well); border: 1px solid var(--line); color: #6d5e94; transition: color .3s, border-color .3s, box-shadow .3s; }
.node svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.node .dot { fill: currentColor; stroke: none; }
.node .bar { fill: var(--well); }
.node--src.is-lit { color: var(--violet); border-color: rgba(169, 123, 255, .7); box-shadow: 0 0 0 6px rgba(169, 123, 255, .1), 0 0 34px rgba(169, 123, 255, .35); }
.node--dst.is-lit { color: var(--gold); border-color: rgba(233, 196, 106, .7); box-shadow: 0 0 0 6px rgba(233, 196, 106, .1), 0 0 34px rgba(233, 196, 106, .3); }
.node--dst.is-real.is-lit { color: var(--loss); border-color: rgba(255, 122, 133, .8); box-shadow: 0 0 0 6px rgba(255, 122, 133, .12), 0 0 34px rgba(255, 122, 133, .35); }

.wire { position: relative; height: 2px; margin: 0 2px; background: repeating-linear-gradient(90deg, #4b3d74 0 5px, transparent 5px 11px); }
.wire.is-live { background: linear-gradient(90deg, var(--violet), var(--pink)); box-shadow: 0 0 14px rgba(255, 122, 195, .45); }
.wire--out.is-live { background: linear-gradient(90deg, var(--pink), var(--gold)); box-shadow: 0 0 14px rgba(233, 196, 106, .45); }
.wire i { position: absolute; top: -3px; left: 0; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: #fff; opacity: 0; box-shadow: 0 0 10px 3px rgba(255, 255, 255, .55); }
.wire.is-live i { animation: travel 2.6s linear infinite; }
.wire.is-live i + i { animation-delay: 1.3s; }
.wire--out.is-live i { animation-delay: .65s; }
.wire--out.is-live i + i { animation-delay: 1.95s; }
@keyframes travel { 0% { left: 0; opacity: 0; } 12% { opacity: 1; } 88% { opacity: 1; } 100% { left: 100%; opacity: 0; } }

.switch { position: relative; width: 132px; height: 68px; border-radius: 99px; padding: 0; cursor: pointer; background: var(--well); border: 1px solid var(--line);
  box-shadow: inset 0 3px 10px rgba(0, 0, 0, .5); transition: border-color .3s; }
.switch__knob { position: absolute; top: 6px; left: 6px; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; color: #cfc4ea;
  background: linear-gradient(180deg, #66578f, #493b6e); box-shadow: 0 4px 12px rgba(0, 0, 0, .45); transition: transform .32s cubic-bezier(.3, 1.3, .5, 1), background .3s, box-shadow .3s, color .3s; }
.switch__knob svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.switch__word { position: absolute; top: 50%; right: 20px; transform: translateY(-50%); font-weight: 600; font-size: 15px; color: var(--muted); }
.switch[aria-checked="true"] { border-color: rgba(233, 196, 106, .6); }
.switch[aria-checked="true"] .switch__knob { transform: translateX(64px); color: var(--gold-ink); background: linear-gradient(180deg, #f6dc98, #dcae48);
  box-shadow: 0 0 0 7px rgba(233, 196, 106, .14), 0 0 36px rgba(233, 196, 106, .55); }
.switch[aria-checked="true"] .switch__word { right: auto; left: 24px; color: var(--gold); }
.switch:disabled { cursor: progress; opacity: .7; }

.caps { display: flex; justify-content: space-between; gap: 16px; max-width: 760px; margin: 14px auto 0; }
.cap { display: grid; gap: 1px; align-content: start; font-size: 13px; color: var(--muted); max-width: 50%; }
.cap strong { color: var(--text); font-weight: 600; font-size: 15px; white-space: nowrap; }
.cap--src { text-align: left; }
.cap--dst { text-align: right; }

.relay__title { font: 400 40px/1.1 var(--serif); margin-top: 30px; }
.relay__text { color: var(--muted); max-width: 56ch; margin: 10px auto 0; font-size: 16px; }
.notice { display: inline-block; margin-top: 18px; padding: 10px 16px; border-radius: 12px; font-size: 14px; text-align: left; color: #ffe2a8; background: rgba(233, 196, 106, .1); border: 1px solid rgba(233, 196, 106, .35); }

/* ------------------------------------------------ Konto: steht frei, kein Kasten */
.account { margin-top: 44px; }
.account__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 28px; flex-wrap: wrap; }
.figure { font: 400 72px/1 var(--serif); letter-spacing: -.01em; margin-top: 2px; }
.sub { color: var(--muted); margin-top: 8px; }
.sub.pos { color: var(--gain); } .sub.neg { color: var(--loss); }
.stats { display: grid; grid-template-columns: repeat(4, auto); }
.stats > div { padding: 2px 26px; border-left: 1px solid var(--hair); }
.stats > div:last-child { padding-right: 0; }
.stats dt { color: var(--muted); font-size: 13px; }
.stats dd { font-size: 21px; font-weight: 500; margin-top: 2px; }
.stats small { display: block; color: var(--muted); font-size: 12.5px; }

.chart__bar { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 30px; }
.chart__read { font-size: 13px; color: var(--text); text-align: right; }
.chart { height: 230px; margin-top: 8px; position: relative; touch-action: pan-y; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .grid { stroke: var(--hair); stroke-width: 1; stroke-dasharray: 2 5; }
.chart .ylab { fill: var(--muted); font: 400 11.5px var(--sans); }
.chart .line { fill: none; stroke: var(--gold); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .end { fill: var(--gold); }
.chart .halo { fill: rgba(233, 196, 106, .22); }
.chart .cross { stroke: rgba(244, 239, 253, .45); stroke-width: 1; }
.chart .pick { fill: var(--plum); stroke: var(--gold); stroke-width: 2; }
.chart__empty { height: 100%; display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 14px; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); padding: 0 20px; }

/* ------------------------------------------------ Ergebnis: Zeile mit Haarlinien */
.results { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 26px; border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); }
.results > div { padding: 18px 22px; border-left: 1px solid var(--hair); }
.results > div:first-child { border-left: 0; padding-left: 0; }
.results .v { font: 400 30px/1.15 var(--serif); margin-top: 2px; }
.results small { color: var(--muted); font-size: 13px; }

/* ------------------------------------------------ Flächen */
.panel { margin-top: 28px; padding: 26px 28px 28px; border-radius: 22px; background: rgba(36, 26, 62, .72); border: 1px solid var(--line); }
.panel__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.panel h2, .stop h2 { font: 400 27px/1.15 var(--serif); }
.panel__sub { font: 400 20px/1.2 var(--serif); margin: 22px 0 4px; }
.cols { display: grid; grid-template-columns: 1.15fr 1fr; gap: 22px; align-items: start; }
.cols .panel { margin-top: 22px; }

/* Regeln */
.rules { columns: 2; column-gap: 48px; }
.group { break-inside: avoid; padding-top: 16px; }
.group h3 { font: 400 20px/1.2 var(--serif); color: var(--gold); padding-bottom: 6px; }
.rule { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px; padding: 11px 0; border-top: 1px solid var(--hair); }
.rule__name { font-weight: 500; display: block; }
.rule__name::before { content: ''; display: inline-block; width: 0; height: 7px; border-radius: 50%; background: var(--gold); vertical-align: 2px; transition: width .2s, margin .2s; }
.rule.is-changed .rule__name::before { width: 7px; margin-right: 8px; }
.rule__help { display: block; color: var(--muted); font-size: 13px; line-height: 1.4; }

.step { display: inline-flex; align-items: center; height: 44px; border-radius: 12px; background: var(--well); border: 1px solid var(--line); }
.rule.is-changed .step { border-color: rgba(233, 196, 106, .65); }
.step button { width: 38px; height: 100%; border: 0; background: none; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; border-radius: 11px; }
.step button:hover { color: var(--text); background: var(--plum-3); }
.step input { width: 58px; height: 100%; border: 0; background: none; text-align: right; font-size: 16px; font-weight: 500; padding: 0; outline-offset: -2px; }
.step__unit { color: var(--muted); font-size: 13px; padding-left: 5px; width: 34px; text-align: left; }

.tg { position: relative; width: 54px; height: 32px; border-radius: 99px; background: var(--well); border: 1px solid var(--line); cursor: pointer; padding: 0; }
.tg::after { content: ''; position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; border-radius: 50%; background: #66578f; transition: transform .2s, background .2s; }
.tg[aria-checked="true"] { border-color: rgba(233, 196, 106, .6); background: rgba(233, 196, 106, .12); }
.tg[aria-checked="true"]::after { transform: translateX(22px); background: var(--gold); }

/* Zeilen-Listen */
.rows li { display: grid; grid-template-columns: 1fr auto; gap: 2px 14px; padding: 13px 0; border-top: 1px solid var(--hair); }
.rows li:first-child { border-top: 0; }
.rows .a { font-weight: 500; }
.rows .b { color: var(--muted); font-size: 13px; grid-column: 1; }
.rows .r { text-align: right; font-weight: 500; }
.rows .t { color: var(--muted); font-size: 13px; text-align: right; white-space: nowrap; }
.rows .none { display: block; color: var(--muted); padding: 10px 0 2px; }
.side { display: inline-block; min-width: 42px; text-align: center; padding: 1px 8px; margin-right: 8px; border-radius: 7px; font-size: 13px; font-weight: 600; }
.side--buy { color: var(--gain); background: rgba(111, 224, 166, .12); }
.side--sell { color: var(--loss); background: rgba(255, 122, 133, .12); }

/* Not-Aus */
.stop { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; margin-top: 28px; padding: 24px 28px; border-radius: 22px; border: 1px solid rgba(255, 122, 133, .3); }
.stop p { color: var(--muted); margin-top: 4px; max-width: 58ch; }
.foot { color: var(--muted); font-size: 13px; margin-top: 22px; text-align: center; }

/* ------------------------------------------------ Speichern-Leiste, Rückfrage, Meldung */
.savebar { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translate(-50%, 160%); display: flex; align-items: center; gap: 10px;
  padding: 10px 10px 10px 20px; border-radius: 18px; background: #322559; border: 1px solid #4d3d7c; box-shadow: 0 18px 50px rgba(8, 4, 20, .6); transition: transform .28s cubic-bezier(.3, 1.2, .5, 1); max-width: calc(100% - 24px); z-index: 5; }
.savebar.is-open { transform: translate(-50%, 0); }
.savebar span { font-weight: 500; margin-right: 6px; }

.ask { border: 1px solid var(--line); border-radius: 22px; background: var(--plum-2); color: var(--text); padding: 26px; width: min(440px, calc(100% - 32px)); box-shadow: 0 30px 90px rgba(8, 4, 20, .7); }
.ask::backdrop { background: rgba(14, 8, 28, .72); backdrop-filter: blur(4px); }
.ask h2 { font: 400 28px/1.15 var(--serif); }
.ask p { color: var(--muted); margin-top: 10px; }
.ask__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

.toast { position: fixed; left: 50%; top: max(18px, env(safe-area-inset-top)); transform: translate(-50%, -20px); background: #322559; border: 1px solid #4d3d7c; padding: 11px 18px; border-radius: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); z-index: 6; box-shadow: 0 14px 40px rgba(8, 4, 20, .5); }
.toast.is-open { opacity: 1; transform: translate(-50%, 0); }
.toast.is-bad { border-color: var(--loss); }

/* ------------------------------------------------ schmal */
@media (max-width: 860px) {
  .rules { columns: 1; }
  .cols { grid-template-columns: 1fr; gap: 0; }
  .stats { grid-template-columns: repeat(2, 1fr); width: 100%; row-gap: 18px; }
  .stats > div { padding: 2px 18px; }
  .stats > div:nth-child(odd) { border-left: 0; padding-left: 0; }
}
@media (max-width: 560px) {
  main { padding-left: 16px; padding-right: 16px; }
  .brand__name { font-size: 22px; }
  .who #me { display: none; }
  .relay { padding: 30px 18px 26px; border-radius: 26px; }
  .node { width: 46px; height: 46px; }
  .node svg { width: 22px; height: 22px; }
  .switch { width: 112px; height: 60px; }
  .switch__knob { width: 48px; height: 48px; top: 5px; left: 5px; }
  .switch[aria-checked="true"] .switch__knob { transform: translateX(52px); }
  .switch__word { right: 16px; }
  .switch[aria-checked="true"] .switch__word { left: 18px; }
  .cap strong { font-size: 14px; }
  .relay__title { font-size: 32px; margin-top: 24px; }
  .relay__text { font-size: 15px; }
  .account { margin-top: 34px; }
  .figure { font-size: 56px; }
  .chart { height: 190px; }
  .results { grid-template-columns: repeat(2, 1fr); }
  .results > div { padding: 16px 16px; }
  .results > div:nth-child(odd) { border-left: 0; padding-left: 0; }
  .results > div:nth-child(n+3) { border-top: 1px solid var(--hair); }
  .panel { padding: 22px 18px; }
  .stop { padding: 22px 18px; }
  .step button { width: 34px; }
  .step input { width: 50px; }
  .savebar { width: calc(100% - 24px); }
  .savebar span { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
