:root {
  --bg: #0b0a14;
  --bg2: #15132a;
  --card: rgba(255, 255, 255, 0.055);
  --card2: rgba(255, 255, 255, 0.09);
  --text: #f3eee6;
  --muted: rgba(243, 238, 230, 0.6);
  --amber: #f2b880;
  --lilac: #b9a7e8;
  --mint: #8fd3c7;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
body {
  font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 19px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

.screen {
  position: fixed; inset: 0;
  opacity: 0; pointer-events: none;
  transition: opacity 0.9s ease;
}
.screen.active { opacity: 1; pointer-events: auto; }

#fluss { background: var(--bg); }
#flussCanvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }

.toast {
  position: absolute; top: calc(var(--safe-t) + 22%); left: 0; right: 0;
  text-align: center; font-size: 28px; letter-spacing: 0.12em; text-transform: lowercase;
  color: var(--text); opacity: 0; transition: opacity 1.2s ease; pointer-events: none;
}
.toast.show { opacity: 0.85; }

.hint {
  position: absolute; bottom: calc(var(--safe-b) + 110px); left: 0; right: 0;
  text-align: center; font-size: 15px; color: var(--muted);
  opacity: 1; transition: opacity 2s ease; pointer-events: none;
}
.hint.gone { opacity: 0; }

.scroll {
  position: absolute; inset: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: calc(var(--safe-t) + 24px) 18px calc(var(--safe-b) + 120px);
  display: flex; flex-direction: column; gap: 14px;
}

#anker { background: radial-gradient(120% 80% at 50% 0%, #1b1733 0%, var(--bg) 70%); }
#wir   { background: radial-gradient(120% 80% at 50% 100%, #122826 0%, var(--bg) 70%); }

.card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 24px;
  padding: 22px 20px;
}
.card.okay { text-align: center; padding: 34px 22px 28px; }
h1 { margin: 0 0 12px; font-size: 40px; font-weight: 600; letter-spacing: -0.01em; }
h2 { margin: 0 0 8px; font-size: 28px; font-weight: 600; }
.calm { margin: 0; font-size: 21px; color: var(--muted); min-height: 2.9em; transition: opacity 1.5s ease; }
.calm.fade { opacity: 0; }

.muted { color: var(--muted); font-size: 17px; margin: 10px 0 0; }
.tiny { color: var(--muted); font-size: 14px; margin-top: 12px; }
.label { font-size: 14px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 4px; }
.big { font-size: 28px; font-weight: 600; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.right { text-align: right; }

/* breathing */
.breath { display: flex; flex-direction: column; align-items: center; text-align: center; }
.breathRing { position: relative; width: 230px; height: 230px; display: grid; place-items: center; }
.breathCircle {
  position: absolute; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, var(--lilac), #5a4aa8 70%, transparent 100%);
  box-shadow: 0 0 60px rgba(185, 167, 232, 0.35);
  transform: scale(1);
  opacity: 0.8;
}
.breathCircle.idle { animation: idleBreath 7s ease-in-out infinite; }
@keyframes idleBreath { 0%, 100% { transform: scale(0.95); } 50% { transform: scale(1.08); } }
.breathLabel { position: relative; font-size: 22px; font-weight: 600; text-shadow: 0 2px 12px rgba(0,0,0,0.6); }

/* timeline arc */
.arc { position: relative; height: 14px; border-radius: 7px; background: rgba(255,255,255,0.08); margin: 16px 0 6px; overflow: hidden; }
.arcFill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 7px;
  background: linear-gradient(90deg, var(--mint), var(--lilac) 45%, var(--amber)); transition: width 2s ease; }
.arcMarks { position: absolute; inset: 0; }
.arcMarks span { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(11,10,20,0.7); }
.arcMarks span:nth-child(1) { left: 18%; }
.arcMarks span:nth-child(2) { left: 64%; }

/* buttons */
button, .pill { font: inherit; color: inherit; }
.pill {
  display: inline-block; text-align: center; text-decoration: none;
  background: var(--card2); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px; padding: 14px 22px; font-size: 18px; font-weight: 600;
  min-height: 52px; cursor: pointer;
}
.pill:active { background: rgba(255,255,255,0.16); }
.pill.wide { display: block; width: 100%; }
.contact .pill.wide { background: linear-gradient(135deg, rgba(242,184,128,0.25), rgba(185,167,232,0.25)); border-color: rgba(242,184,128,0.4); }
.ghost {
  background: transparent; border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px; padding: 10px 18px; font-size: 16px; cursor: pointer; color: var(--muted);
}
.ghost.small { margin-top: 12px; }
.contact .ghost.small { margin-top: 10px; }

/* chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 0 18px 4px; margin: 0 -18px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; background: transparent; border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px; padding: 8px 16px; font-size: 15px; color: var(--muted); cursor: pointer;
}
.chip.active { background: var(--card2); color: var(--text); border-color: rgba(255,255,255,0.3); }

/* prompt deck */
.deck { flex: 1; display: flex; align-items: center; min-height: 50vh; }
.card.prompt {
  width: 100%; min-height: 46vh; display: flex; flex-direction: column; justify-content: center;
  text-align: center; padding: 34px 26px; background: var(--card2);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.card.prompt.swap { opacity: 0; transform: translateY(8px); }
.card.prompt .cat { font-size: 13px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--mint); margin-bottom: 14px; }
.card.prompt p { margin: 0; font-size: 24px; line-height: 1.4; font-weight: 500; }
.wirActions { display: flex; justify-content: center; }

/* overlays */
.overlay { position: fixed; inset: 0; background: var(--bg); z-index: 50; }
.overlay.hidden { display: none; }
#drawCanvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.drawBar {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 12px 16px calc(var(--safe-b) + 16px);
  display: flex; gap: 10px; align-items: center; justify-content: center;
  background: linear-gradient(to top, rgba(11,10,20,0.9), transparent);
}
.drawBar .ghost.small { margin-top: 0; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.swatch.active { border-color: #fff; }

.setupBox {
  position: absolute; inset: 0; overflow-y: auto;
  padding: calc(var(--safe-t) + 48px) 24px calc(var(--safe-b) + 40px);
  display: flex; flex-direction: column; gap: 10px; max-width: 480px; margin: 0 auto;
}
.setupBox p { margin: 0 0 18px; color: var(--muted); }
.setupBox .label { margin-top: 14px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid .pill.sel, .grid .ghost.sel { outline: 2px solid var(--amber); }
.grid .ghost { grid-column: span 2; }
input {
  font: inherit; color: var(--text); background: var(--card); border: 1px solid rgba(255,255,255,0.14);
  border-radius: 14px; padding: 14px 16px; width: 100%; outline: none;
}
input:focus { border-color: var(--lilac); }
#setupDone { margin-top: 18px; }

/* nav orbs */
#nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: center; gap: 34px;
  padding: 14px 0 calc(var(--safe-b) + 16px);
  transition: opacity 1.5s ease;
}
#nav.dim { opacity: 0.18; }
.orb {
  width: 58px; height: 58px; border-radius: 50%; border: none; cursor: pointer; position: relative;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.35), rgba(255,255,255,0.06) 60%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15);
  transition: box-shadow 0.8s ease, transform 0.3s ease;
}
.orb:active { transform: scale(0.94); }
.orb span { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); font-size: 11px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 2px; }
.orb[data-target="fluss"].active { box-shadow: 0 0 34px rgba(185,167,232,0.6), inset 0 0 0 1px rgba(185,167,232,0.7); }
.orb[data-target="anker"].active { box-shadow: 0 0 34px rgba(242,184,128,0.6), inset 0 0 0 1px rgba(242,184,128,0.7); }
.orb[data-target="wir"].active   { box-shadow: 0 0 34px rgba(143,211,199,0.6), inset 0 0 0 1px rgba(143,211,199,0.7); }

@media (prefers-reduced-motion: reduce) {
  .breathCircle.idle { animation: none; }
}
