/* PEILUNG — Grundsystem „Okular & Messing“ */
@font-face { font-family: 'Funnel Display'; src: url('../fonts/funnel-display.woff2') format('woff2'); font-weight: 300 800; font-display: swap; }
@font-face { font-family: 'Mona Sans'; src: url('../fonts/mona-sans.woff2') format('woff2'); font-weight: 200 900; font-display: swap; }
@font-face { font-family: 'Ubuntu Sans Mono'; src: url('../fonts/ubuntu-sans-mono.woff2') format('woff2'); font-weight: 400 700; font-display: swap; }
/* metrisch angeglichene Fallbacks gegen Layoutsprung */
@font-face { font-family: 'Mona Fallback'; src: local('Arial'); size-adjust: 98%; ascent-override: 92%; descent-override: 24%; }
@font-face { font-family: 'Funnel Fallback'; src: local('Arial'); size-adjust: 96%; ascent-override: 96%; descent-override: 24%; }

:root {
  /* Welt: Okular (Dunkelheit im Tubus), Fassung, Gravur, Skala, Messing */
  --okular: #0d0d12;
  --tubus: #14141b;
  --tubus-2: #1a1a23;
  --fassung: #262632;
  --fassung-hell: #34343f;
  --gravur: #9a99ab;      /* gedämpfter Text, AA auf --tubus */
  --skala: #ecebf2;       /* Haupttext */
  --skala-2: #c7c6d3;
  --messing: #d9a441;     /* Marke, primäre Aktion */
  --messing-hell: #f0c46a;
  --messing-tief: #8a6420;
  /* Daten (validiert gegen #12151c, siehe SPEC) */
  --steigt: #19b07a;      /* steigend — Kerze hohl */
  --faellt: #e66767;      /* fallend — Kerze gefüllt */
  --faecher: #9085e9;     /* Prognose */
  --s1: #c98500; --s2: #3987e5; --s3: #d55181; --s4: #9085e9;
  --warn: #e8a33a;
  --font-display: 'Funnel Display', 'Funnel Fallback', system-ui, sans-serif;
  --font-body: 'Mona Sans', 'Mona Fallback', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Ubuntu Sans Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --r-s: 6px; --r-m: 12px; --r-l: 18px;
  --ease: cubic-bezier(.25, .8, .25, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0; background: var(--okular); color: var(--skala);
  font: 400 16px/1.55 var(--font-body); font-feature-settings: 'tnum' 1, 'cv01' 1;
  overflow-wrap: break-word; -webkit-font-smoothing: antialiased; overflow-x: clip;
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: var(--messing-hell); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--messing); }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.08; letter-spacing: -.01em; margin: 0 0 .5em; text-wrap: balance; }
p { margin: 0 0 1em; }
code, .mono { font-family: var(--font-mono); font-size: .92em; }
:focus-visible { outline: 2px solid var(--messing-hell); outline-offset: 2px; border-radius: 4px; }
::selection { background: rgba(217, 164, 65, .35); color: #fff; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--messing); color: #111; padding: 10px 14px; border-radius: 8px; z-index: 100; font-weight: 600; text-decoration: none; }
.skip:focus { top: 12px; }

/* Knöpfe */
.btn {
  --bg: var(--tubus-2); --fg: var(--skala); --bd: var(--fassung-hell);
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--bd);
  background: var(--bg); color: var(--fg); font: 600 15px/1 var(--font-body); text-decoration: none; cursor: pointer;
  transition: transform .15s var(--ease), background .2s, border-color .2s, color .2s; white-space: nowrap;
}
.btn:hover { --bd: var(--gravur); color: var(--fg); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn--primaer { --bg: var(--messing); --fg: #17120a; --bd: var(--messing); }
.btn--primaer:hover { --bg: var(--messing-hell); --bd: var(--messing-hell); }
.btn--klein { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn--geist { --bg: transparent; --bd: transparent; color: var(--skala-2); }
.btn--geist:hover { --bg: var(--tubus-2); --bd: var(--fassung); }
.btn--gefahr { --fg: #ffb4b4; --bd: #5a2a2e; }
.btn--gefahr:hover { --bg: #3a1a1e; --bd: var(--faellt); }
.icon-btn { width: 40px; height: 40px; padding: 0; border-radius: 10px; }

/* Formulare */
label { display: block; font-size: 14px; font-weight: 600; color: var(--skala-2); margin: 0 0 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--fassung-hell);
  background: var(--okular); color: var(--skala); font: 400 16px/1.4 var(--font-body);
  transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--messing); box-shadow: 0 0 0 3px rgba(217, 164, 65, .18); }
textarea { resize: vertical; }
.feld { margin-bottom: 16px; }
.hinweis { font-size: 13px; color: var(--gravur); margin-top: 6px; }
.fehler { color: #ff9b9b; font-size: 14px; margin-top: 8px; }
.ok-text { color: #6ee0b0; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; color: var(--skala-2); font-size: 14px; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--messing); flex: none; }

/* Gravur-Label (Mono, versal, gesperrt) */
.gravur { font: 500 11.5px/1.2 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--gravur); }
.zahl { font-family: var(--font-mono); font-feature-settings: 'tnum' 1; }
.steigt { color: #4fd39f; } .faellt { color: #ff8f8f; }

/* Karten & Panels */
.panel { background: var(--tubus); border: 1px solid var(--fassung); border-radius: var(--r-l); }
.pille { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--fassung-hell); font: 500 12.5px/1.6 var(--font-body); color: var(--skala-2); white-space: nowrap; }
.pille--steigt { border-color: rgba(25, 176, 122, .5); color: #6ee0b0; }
.pille--faellt { border-color: rgba(230, 103, 103, .5); color: #ffa3a3; }
.pille--messing { border-color: rgba(217, 164, 65, .55); color: var(--messing-hell); }
.pille--faecher { border-color: rgba(144, 133, 233, .55); color: #c4bdff; }

/* Toast */
.toast-wrap { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; width: min(92vw, 440px); pointer-events: none; }
.toast { background: var(--tubus-2); border: 1px solid var(--fassung-hell); border-radius: 12px; padding: 12px 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, .45); animation: toast-in .3s var(--ease-out); pointer-events: auto; }
.toast--fehler { border-color: #6a2f34; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* Öffentliche Seiten: Kopf/Fuß */
.kopf { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 16px; padding: 12px clamp(16px, 4vw, 40px); background: rgba(13, 13, 18, .82); backdrop-filter: blur(12px); border-bottom: 1px solid transparent; transition: transform .3s var(--ease), border-color .3s; }
.kopf.gescrollt { border-bottom-color: var(--fassung); }
.kopf.weg { transform: translateY(-100%); }
.marke { display: inline-flex; align-items: center; gap: 10px; color: var(--skala); text-decoration: none; font: 700 19px/1 var(--font-display); letter-spacing: .14em; }
.marke svg { width: 28px; height: 28px; }
.kopf nav { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.kopf nav a.nav { color: var(--skala-2); text-decoration: none; padding: 10px 12px; border-radius: 8px; font-weight: 500; }
.kopf nav a.nav:hover { color: var(--skala); background: var(--tubus-2); }
.fuss { border-top: 1px solid var(--fassung); padding: 40px clamp(16px, 4vw, 40px) 32px; color: var(--gravur); font-size: 14px; }
.fuss-innen { max-width: 1200px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: flex-start; justify-content: space-between; }
.fuss nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.fuss a { color: var(--skala-2); text-decoration: none; }
.fuss a:hover { color: var(--messing-hell); }
.disclaimer { max-width: 620px; }

/* Textseiten */
.text-seite { max-width: 760px; margin: 0 auto; padding: 48px clamp(16px, 4vw, 32px) 80px; }
.text-seite h1 { font-size: clamp(34px, 6vw, 52px); }
.text-seite h2 { font-size: 22px; margin-top: 2em; }
.text-seite p, .text-seite li { color: var(--skala-2); }

/* Auth-Karten */
.auth { min-height: calc(100svh - 160px); display: grid; place-items: center; padding: 32px 16px; }
.auth-karte { width: min(100%, 440px); padding: 32px clamp(20px, 5vw, 36px); }
.auth-karte h1 { font-size: 32px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Chart (auch auf öffentlichen Seiten) */
.chart-canvas { touch-action: pan-y; cursor: crosshair; }
.chart-tip { position: absolute; left: 0; top: 0; z-index: 5; min-width: 180px; padding: 10px 12px; border-radius: 10px; background: rgba(20, 20, 27, .96); border: 1px solid var(--fassung-hell); box-shadow: 0 12px 32px rgba(0, 0, 0, .45); pointer-events: none; font-size: 12.5px; }
.tip-head { font-weight: 600; margin-bottom: 6px; color: var(--skala); }
.tip-row { display: flex; justify-content: space-between; gap: 16px; color: var(--gravur); line-height: 1.6; }
.tip-row b { color: var(--skala); font: 500 12.5px/1.6 var(--font-mono); }
.tip-note { margin-top: 6px; color: #c4bdff; font-size: 11.5px; }
