/* Dunkles Grundgerüst; die Akzentfarbe ist dieselbe wie auf der Startseite. */
:root {
  --bg: #05060a;
  --panel: rgba(14, 17, 25, 0.82);
  --line: rgba(148, 163, 184, 0.18);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #03dac6;
  --accent-dim: rgba(3, 218, 198, 0.16);
  --radius: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#stage.dragging { cursor: grabbing; }

/* ------------------------------------------------------------------ Kopfzeile */

#top {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 12px 16px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(5, 6, 10, 0.85), rgba(5, 6, 10, 0));
}

.brand { display: flex; align-items: center; gap: 10px; }

.logo {
  width: 26px; height: 26px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #ffd45e 0 22%, rgba(255, 212, 94, 0) 60%),
    radial-gradient(circle at 84% 22%, var(--accent) 0 14%, rgba(3, 218, 198, 0) 40%),
    radial-gradient(circle at 18% 78%, #5aa9e6 0 12%, rgba(90, 169, 230, 0) 38%);
  flex: none;
}

#top h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
#top .brand p { margin: 1px 0 0; font-size: 11.5px; color: var(--muted); }

#scenarios {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  pointer-events: auto;
}

#scenarios button {
  font: inherit;
  font-size: 12.5px;
  color: var(--muted);
  background: rgba(14, 17, 25, 0.7);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: color .15s, border-color .15s, background .15s;
}
#scenarios button:hover { color: var(--text); border-color: rgba(148, 163, 184, 0.4); }
#scenarios button[aria-current="true"] {
  color: #04121a;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

/* -------------------------------------------------------------- Steuerpaneel */

#panel {
  position: fixed;
  top: 84px;
  right: 14px;
  width: 268px;
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#panel[hidden] { display: none; }

.panel-head h2 { margin: 0; font-size: 14.5px; font-weight: 600; }
.panel-head p { margin: 3px 0 0; font-size: 12px; color: var(--muted); line-height: 1.4; }

/* Herkunft der Startwerte: gemessen, exakt, gemischt oder erfunden. Steht
   bewusst weit oben — bei einer Simulation ist das die erste Frage. */
#scenario-origin {
  margin: 8px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}
#origin-badge {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: 1px;
}
#origin-badge.gemessen { background: rgba(3, 218, 198, 0.18); color: #5ff0e0; }
#origin-badge.exakt    { background: rgba(129, 140, 248, 0.18); color: #a5b4fc; }
#origin-badge.gemischt { background: rgba(251, 191, 36, 0.16); color: #fcd34d; }
#origin-badge.erfunden { background: rgba(248, 113, 113, 0.16); color: #fca5a5; }

.row.buttons { display: flex; gap: 8px; }

button, select {
  font: inherit;
  color: var(--text);
  background: rgba(30, 36, 48, 0.85);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 10px;
  cursor: pointer;
}
button:hover, select:hover { border-color: rgba(148, 163, 184, 0.45); }
button.primary {
  flex: 1;
  background: var(--accent-dim);
  border-color: rgba(3, 218, 198, 0.45);
  color: var(--accent);
  font-weight: 600;
}
.row.buttons button { flex: 1; font-size: 13px; }

.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); }
.field > span { display: flex; justify-content: space-between; align-items: baseline; }
.field output { color: var(--text); font-family: var(--mono); font-size: 12px; }
.field select { width: 100%; }

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; font-size: 12.5px; }
.checks label { display: flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; }
.checks input { accent-color: var(--accent); }

#readout {
  margin: 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 3px;
  font-size: 12px;
}
#readout > div { display: flex; justify-content: space-between; gap: 10px; }
#readout dt { color: var(--muted); }
#readout dd { margin: 0; font-family: var(--mono); font-size: 11.5px; text-align: right; }
#readout dd.warn { color: #ffb454; }

.hint { margin: 0; font-size: 11.5px; line-height: 1.6; color: var(--muted); }
kbd {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 1px 4px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--text);
}

#panel-toggle {
  position: fixed;
  top: 84px;
  right: 14px;
  width: 38px;
  height: 34px;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  background: var(--panel);
  backdrop-filter: blur(10px);
}

/* -------------------------------------------------------------- Erläuterung */

#info {
  position: fixed;
  left: 14px;
  bottom: 44px;
  max-width: min(520px, calc(100vw - 28px));
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

#info-toggle {
  font-size: 12.5px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  border-radius: 999px;
  padding: 6px 14px;
  color: var(--muted);
}
#info-toggle[aria-expanded="true"] { color: var(--accent); border-color: rgba(3, 218, 198, 0.4); }

#info-body {
  max-height: min(46vh, 420px);
  overflow-y: auto;
  padding: 14px 16px;
  font-size: 12.5px;
  line-height: 1.62;
  color: #cbd5e1;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
}
#info-body p { margin: 0 0 10px; }
#info-body p:last-child { margin-bottom: 0; }

#foot {
  position: fixed;
  left: 16px;
  bottom: 16px;
  right: 16px;
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 11.5px;
  color: var(--muted);
  pointer-events: none;
}
#foot a { color: var(--muted); pointer-events: auto; }
#foot a:hover { color: var(--accent); }

/* --------------------------------------------------------------- Schmale Bildschirme */

@media (max-width: 860px) {
  #top { padding: 10px 12px; gap: 8px 12px; }
  #top .brand p { display: none; }
  #scenarios { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  #scenarios::-webkit-scrollbar { display: none; }
  #scenarios button { white-space: nowrap; }

  #panel {
    top: auto;
    bottom: 12px;
    left: 12px;
    right: 12px;
    width: auto;
    max-height: 58vh;
  }
  #panel-toggle { display: flex; top: auto; bottom: 12px; right: 12px; }
  #panel:not([hidden]) + #panel-toggle { bottom: calc(58vh + 20px); }
  #info { bottom: 56px; left: 12px; }
  #info-body { max-height: 32vh; }
  #foot { display: none; }
  .hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
