/* ============================================================
   surreal – Ambient-Design mit vier umschaltbaren Themes
   HTML/CSS/JS strikt getrennt. Keine externen Ressourcen / kein CDN.
   ============================================================ */

:root {
  --ink:      #eaf6fb;
  --ink-dim:  rgba(234, 246, 251, .72);
  --raft:     rgba(9, 24, 38, .55);
  --raft-brd: rgba(160, 220, 240, .28);
  --accent:   #7fd8cc;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #04121f;
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---- Bühne: Canvas füllt den Container, wird pro Theme neu erzeugt ---- */
.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  touch-action: none;
  cursor: crosshair;
}

.scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ---- Theme-Switcher ---- */
.switcher {
  position: fixed;
  z-index: 3;
  top: clamp(16px, 3vw, 28px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(4, 18, 31, .55);
  border: 1px solid var(--raft-brd);
  backdrop-filter: blur(10px);
}

.switcher__btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-dim);
  font: inherit;
  font-size: .9rem;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}

.switcher__btn:hover:not(:disabled) { color: var(--ink); }

.switcher__btn.is-active {
  background: var(--accent);
  color: #04121f;
  font-weight: 700;
}

.switcher__btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.switcher__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- KPI-Flöße/Karten ---- */
.kpi-layer {
  position: fixed;
  inset: 0;
  z-index: 1;
  perspective: 900px;
  pointer-events: none;
}

.kpi {
  position: absolute;
  left: 0;
  top: 0;
  width: clamp(140px, 19vw, 200px);
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--raft);
  border: 1px solid var(--raft-brd);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45);
  backdrop-filter: blur(8px);
  transform-style: preserve-3d;
  will-change: transform, opacity;
  transition: opacity .4s ease;
}

.kpi__label {
  margin: 0 0 6px;
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
}

.kpi__value {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  font-weight: 800;
  line-height: 1;
}

.kpi__unit { font-size: .55em; font-weight: 600; color: var(--ink-dim); margin-left: 2px; }

/* ---- HUD (Titel/Navigation/Hinweis) ---- */
.hud {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(20px, 4vw, 48px);
}
.hud a, .hud button { pointer-events: auto; }

.hud__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }

.brand {
  font-size: clamp(1.5rem, 4vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -.02em;
  margin: 0;
  text-shadow: 0 2px 24px rgba(0, 0, 0, .5);
}
.brand small {
  display: block;
  font-size: .42em;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 6px;
}

.back-link {
  color: var(--ink);
  text-decoration: none;
  font-size: .9rem;
  padding: 8px 14px;
  border: 1px solid var(--raft-brd);
  border-radius: 999px;
  background: rgba(4, 18, 31, .4);
  backdrop-filter: blur(6px);
  transition: background .2s ease, border-color .2s ease;
}
.back-link:hover, .back-link:focus-visible {
  background: rgba(4, 18, 31, .7);
  border-color: var(--accent);
  outline: none;
}

.hint {
  align-self: center;
  font-size: .9rem;
  color: var(--ink-dim);
  text-shadow: 0 1px 12px rgba(0, 0, 0, .6);
  margin: 0;
}

.compat-hint {
  align-self: center;
  max-width: 40ch;
  text-align: center;
  font-size: .85rem;
  color: #ffd7a8;
  background: rgba(60, 30, 0, .5);
  border: 1px solid rgba(255, 180, 100, .35);
  padding: 8px 14px;
  border-radius: 12px;
}

/* ---- Themenspezifische Karten-Akzente (data-theme am Body) ---- */
body[data-theme="gas"] .kpi {
  --accent: #c9a6ff;
  border-color: rgba(201, 166, 255, .4);
  box-shadow: 0 0 26px rgba(150, 90, 255, .35), 0 18px 40px rgba(0, 0, 0, .45);
}
body[data-theme="space"] .kpi {
  --accent: #a8c7ff;
  border-color: rgba(168, 199, 255, .35);
  box-shadow: 0 0 20px rgba(120, 150, 255, .25), 0 18px 40px rgba(0, 0, 0, .5);
}
body[data-theme="magnetic"] .kpi {
  --accent: #ff9e6d;
  border-color: rgba(255, 158, 109, .4);
}

@media (prefers-reduced-motion: reduce) {
  .kpi { transition: none; }
}
