/* ===== Design-Tokens: hier Farben und Schatten zentral ändern ===== */
:root {
  --bg: #efe9df;
  --bg-2: #f6f2ea;
  --surface: #f3eee5;
  --ink: #2b2926;
  --muted: #7b746a;
  --line: #d9d1c4;
  --accent: #3a3631;

  --shadow-dark: rgba(128, 112, 90, 0.28);
  --shadow-light: rgba(255, 255, 255, 0.95);
  --raised: 8px 8px 18px var(--shadow-dark), -8px -8px 18px var(--shadow-light);
  --raised-s: 4px 4px 9px var(--shadow-dark), -4px -4px 9px var(--shadow-light);
  --inset: inset 4px 4px 9px var(--shadow-dark), inset -4px -4px 9px var(--shadow-light);
  --inset-s: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light);

  --font-head: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;

  /* werden von js/szene.js laufend gesetzt */
  --hero-o: 1; --tipp-o: 0; --hint-o: 0;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  background: radial-gradient(ellipse at 70% 40%, var(--bg-2) 0%, var(--bg) 70%) fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ===== 3D-Bühne und Scroll-Strecke ===== */
#stage { position: fixed; inset: 0; z-index: 0; opacity: 0; transition: opacity .8s ease; }
#stage.is-ready { opacity: 1; }
#stage canvas { display: block; width: 100%; height: 100%; }
#scroll-track { height: 400vh; }       /* bestimmt, wie lange gescrollt werden kann */

/* ===== Oberfläche (liegt fest über der Bühne; Maus geht durch, außer auf Bedienelementen) ===== */
.page { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
.page > * { pointer-events: auto; }
.page > .topbar, .page > .raum-label, .page > .tipp, .page > .scrollhint { pointer-events: none; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 28px clamp(24px, 5vw, 64px);
  letter-spacing: 0.22em; text-transform: uppercase; font-size: 0.72rem; color: var(--muted);
}
.gesamt { letter-spacing: 0.08em; text-transform: none; font-size: 0.78rem; font-variant-numeric: tabular-nums; }

.hero {
  position: absolute; left: clamp(24px, 5vw, 64px); top: 50%; transform: translateY(-50%);
  max-width: 400px; padding: 40px 38px; border-radius: 28px;
  background: var(--surface); box-shadow: var(--raised);
  opacity: var(--hero-o); transition: opacity .3s ease;
}
body[data-gescrollt="0"] .hero, body.has-selection .hero { pointer-events: none; }
body.has-selection .hero { opacity: 0; }
.eyebrow { margin: 0 0 14px; font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }
.hero h1 { margin: 0 0 16px; font-family: var(--font-head); font-weight: 500; font-size: clamp(2rem, 3.4vw, 2.9rem); line-height: 1.1; }
.hero p { margin: 0; color: var(--muted); line-height: 1.65; font-size: 0.98rem; }

/* Scroll-Hinweis und Tipp */
.scrollhint {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-size: 0.9rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted);
  opacity: var(--hint-o);
}
.scrollhint i { width: 1px; height: 34px; background: linear-gradient(var(--muted), transparent); transform-origin: top; animation: hint 2.2s ease-in-out infinite; }
@keyframes hint { 0%, 100% { transform: scaleY(0.35); opacity: .5; } 50% { transform: scaleY(1); opacity: 1; } }
.tipp {
  position: fixed; left: clamp(24px, 5vw, 64px); bottom: 36px; max-width: 280px; margin: 0;
  font-size: 0.82rem; line-height: 1.5; color: var(--muted); opacity: var(--tipp-o);
}

/* Namensschild über dem Raum */
.raum-label {
  position: fixed; left: 0; top: 0; padding: 6px 14px; border-radius: 999px; font-size: 0.78rem; letter-spacing: 0.04em;
  background: var(--surface); box-shadow: var(--raised-s); color: var(--ink); white-space: nowrap;
  opacity: 0; transition: opacity .2s ease;
}
.raum-label.is-visible { opacity: 1; }

/* Raumleiste */
.raumnav {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  display: flex; gap: 6px; padding: 8px; border-radius: 999px; max-width: calc(100vw - 24px);
  background: var(--surface); box-shadow: var(--raised); overflow-x: auto; scrollbar-width: none;
}
.raumnav::-webkit-scrollbar { display: none; }
.pill {
  display: flex; align-items: center; gap: 8px; white-space: nowrap; cursor: pointer;
  padding: 10px 16px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 0.85rem;
  transition: color .2s ease, box-shadow .25s ease;
}
.pill:hover { color: var(--ink); }
.pill:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.pill[aria-pressed="true"] { color: var(--ink); box-shadow: var(--inset); }
.pill .count { font-size: 0.72rem; opacity: .7; font-variant-numeric: tabular-nums; }
.pill.is-done .count { opacity: 1; color: var(--accent); font-weight: 600; }

/* Checklisten-Panel */
.panel {
  position: fixed; right: clamp(20px, 3vw, 48px); top: 50%; width: min(360px, calc(100vw - 40px));
  max-height: min(620px, calc(100vh - 190px)); overflow: auto; padding: 28px 28px 22px; border-radius: 26px;
  background: var(--surface); box-shadow: var(--raised);
  opacity: 0; visibility: hidden; transform: translate(24px, -50%);
  transition: opacity .3s ease, transform .35s ease, visibility 0s linear .35s;
}
.panel.is-open { opacity: 1; visibility: visible; transform: translate(0, -50%); transition-delay: 0s; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.panel-title { margin: 0; font-family: var(--font-head); font-weight: 500; font-size: 1.7rem; line-height: 1.15; outline: none; }
.close {
  flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%; cursor: pointer; font-size: 1.3rem; line-height: 1;
  background: var(--surface); box-shadow: var(--raised-s); color: var(--muted); transition: box-shadow .2s ease, color .2s ease;
}
.close:hover { color: var(--ink); }
.close:active { box-shadow: var(--inset-s); }
.panel-summary { margin: 10px 0 12px; font-size: 0.82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.meter { height: 8px; border-radius: 999px; box-shadow: var(--inset-s); overflow: hidden; margin-bottom: 18px; }
.meter i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--accent); transition: width .35s ease; }

.tasks { list-style: none; margin: 0; padding: 0; }
.task label { display: flex; align-items: center; gap: 14px; padding: 11px 0; cursor: pointer; font-size: 0.94rem; line-height: 1.4; }
.task + .task { border-top: 1px solid var(--line); }
.task input {
  appearance: none; -webkit-appearance: none; flex: none; width: 22px; height: 22px; margin: 0; cursor: pointer;
  border-radius: 7px; background: var(--surface) center / 14px no-repeat; box-shadow: var(--inset-s);
  transition: background-color .2s ease, box-shadow .2s ease;
}
.task input:checked {
  background-color: var(--accent); box-shadow: 2px 2px 5px var(--shadow-dark);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M2.5 7.5l3 3 6-7' fill='none' stroke='%23f3eee5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.task input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.task.is-done .task-text { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line); }
.panel-foot { margin-top: 14px; }
.link { border: 0; background: none; padding: 4px 0; cursor: pointer; font-size: 0.8rem; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--ink); }

/* Status: Laden / Fehler */
.status {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  padding: 10px 20px; border-radius: 999px; font-size: 0.8rem; color: var(--muted);
  background: var(--surface); box-shadow: var(--raised);
}
.status[hidden] { display: none; }
.status.is-error { color: #4a2f2a; width: max-content; max-width: min(520px, 90vw); border-radius: 18px; line-height: 1.5; text-align: center; }

/* ===== Schmale Bildschirme: Text oben, Checkliste als Karte unten ===== */
@media (max-width: 860px) {
  .hero { top: 76px; transform: none; left: 20px; right: 20px; max-width: none; padding: 24px; }
  .hero p { font-size: 0.9rem; }
  .gesamt { display: none; }
  .tipp { display: none; }
  .raumnav { bottom: 14px; }
  .scrollhint { bottom: 84px; }
  .status { bottom: 84px; }
  .panel {
    left: 12px; right: 12px; top: auto; bottom: 78px; width: auto; max-height: 50vh; padding: 22px 22px 16px;
    transform: translateY(24px);
  }
  .panel.is-open { transform: translateY(0); }
}

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

/* ===== Hilfsseite (Konverter) und Modell-Bericht ===== */
.tool { position: relative; z-index: 1; max-width: 600px; margin: 0 auto; padding: 56px 24px 80px; }
.tool .card { padding: 34px; border-radius: 26px; background: var(--surface); box-shadow: var(--raised); margin-bottom: 28px; }
.tool h1 { font-family: var(--font-head); font-weight: 500; font-size: 2rem; margin: 0 0 12px; }
.tool p, .tool li { color: var(--muted); line-height: 1.65; font-size: 0.95rem; }
.tool ol { padding-left: 1.2rem; }
.dropzone { display: block; text-align: center; padding: 38px 20px; border-radius: 20px; cursor: pointer; color: var(--muted); box-shadow: var(--inset); transition: color .2s ease; }
.dropzone:hover, .dropzone.is-over { color: var(--ink); }
.dropzone input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.dropzone:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.btn { font-size: 0.9rem; color: var(--ink); background: var(--surface); border: 0; cursor: pointer; padding: 12px 26px; border-radius: 999px; box-shadow: var(--raised); transition: box-shadow .2s ease; }
.btn:hover { box-shadow: var(--raised-s); }
.btn:active { box-shadow: var(--inset); }
.btn[disabled] { opacity: .45; cursor: default; }
.result { margin-top: 18px; font-size: 0.9rem; color: var(--ink); }
.result.is-error { color: #4a2f2a; }
.debug {
  position: fixed; right: 20px; top: 70px; z-index: 5; width: min(420px, 90vw); max-height: 70vh; overflow: auto;
  padding: 18px 20px; border-radius: 18px; background: var(--surface); box-shadow: var(--raised);
  font: 0.74rem/1.5 ui-monospace, Menlo, Consolas, monospace; color: var(--ink); white-space: pre-wrap;
}
