:root {
  color-scheme: dark;
  --bg: #05060d;
  --bg-2: #0a0c18;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.16);
  --text: #eef0ff;
  --muted: #8b90b3;
  --faint: #555a7a;
  --accent: #00f0ff;
  --sing: #d7b8ff;
  --good: #8dff3a;
  --warn: #ffb84d;
  --radius: 14px;
  --font: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --stage-h: 42dvh;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}

body, button {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

[hidden] { display: none !important; }

.num { font-variant-numeric: tabular-nums; }

#app {
  height: 100dvh;
  display: grid;
  grid-template-rows: var(--stage-h) 1fr;
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}

@media (max-height: 700px) { :root { --stage-h: 36dvh; } }
body.compact { --stage-h: 30dvh; }

/* ---------- Bühne ---------- */

#stage {
  position: relative;
  overflow: hidden;
  touch-action: none;
}

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

.hud {
  position: absolute;
  top: calc(var(--safe-top) + 10px);
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
}

.hud-main { display: flex; flex-direction: column; gap: 2px; }

.energy {
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px rgba(0, 240, 255, 0.35);
}
.energy .unit { font-size: 15px; color: var(--muted); margin-left: 6px; font-weight: 500; }

.rate {
  font-size: 13px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  opacity: 0.9;
}

.hud-side { display: flex; gap: 8px; align-items: center; pointer-events: auto; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(10, 12, 24, 0.6);
  border: 1px solid var(--line-2);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 14px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.chip.sing { color: var(--sing); }
.sing-glyph { text-shadow: 0 0 10px var(--sing); }

.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
  background: rgba(10, 12, 24, 0.6);
  border: 1px solid var(--line);
}

.zoom {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-40%);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.zoom[hidden], .zoom-label[hidden] { display: none; }
.zoom .icon-btn { font-size: 20px; line-height: 1; color: var(--text); }
.zoom .icon-btn:disabled { opacity: 0.3; }

.zoom-label {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  max-width: 34%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
  pointer-events: none;
}

.zoom-flash {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  text-shadow: 0 0 18px currentColor, 0 0 3px #000;
}
.zoom-flash b { white-space: nowrap; font-size: 30px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.zoom-flash span { font-size: 13px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.85; }
.zoom-flash.go { animation: zflash 2.2s ease-out; }
@keyframes zflash { 0% { opacity: 0; transform: translate(-50%, -40%) scale(0.9); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -54%) scale(1.04); } }

.stage-meta {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
}

.aeon-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.mutator {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: none;
  font-weight: 500;
  color: var(--warn);
}

.entropy { position: relative; text-align: center; pointer-events: auto; display: flex; flex-direction: column; align-items: center; }
.entropy svg { width: 44px; }
.entropy .tick { stroke: var(--sing); stroke-width: 2.5; stroke-linecap: round; }
.entropy.ready .entropy-cap { color: var(--sing); }
.entropy svg { width: 44px; height: 44px; transform: rotate(-90deg); display: block; margin: 0 auto; }
.entropy .track { fill: none; stroke: rgba(255, 255, 255, 0.1); stroke-width: 3; }
.entropy .fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 113.1;
  stroke-dashoffset: 113.1;
  transition: stroke 0.6s;
}
.entropy-text {
  position: absolute;
  top: 0;
  left: 50%;
  width: 44px;
  margin-left: -22px;
  height: 44px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.entropy-text small { font-size: 10px; color: var(--muted); margin-left: 1px; }
.entropy-text { grid-auto-flow: column; justify-content: center; align-items: center; }
.entropy-cap { font-size: 10px; letter-spacing: 0.08em; white-space: nowrap; text-transform: uppercase; color: var(--muted); margin-top: 2px; }

.boost {
  position: absolute;
  top: calc(var(--safe-top) + 64px);
  left: 16px;
  font-size: 12px;
  font-weight: 600;
  color: #ffe53b;
  text-shadow: 0 0 12px rgba(255, 229, 59, 0.7);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.stage-hint {
  position: absolute;
  left: 50%;
  bottom: 58px;
  transform: translateX(-50%);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--text);
  background: rgba(10, 12, 24, 0.7);
  border: 1px solid var(--line-2);
  white-space: nowrap;
  pointer-events: none;
  animation: hint 2.4s ease-in-out infinite;
}
@keyframes hint { 50% { opacity: 0.55; } }

.toasts {
  position: absolute;
  top: calc(var(--safe-top) + 78px);
  left: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  max-width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(10, 12, 24, 0.82);
  border: 1px solid var(--line-2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 13px;
  line-height: 1.35;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.35s cubic-bezier(.2, .9, .3, 1.2);
  pointer-events: auto;
}
.toast b { display: block; font-size: 13px; margin-bottom: 2px; }
.toast.pill { padding: 6px 12px; border-radius: 999px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast.pill b { display: inline; font-size: 12px; margin: 0 6px 0 0; }
#stage .toasts.bottom { top: auto; bottom: 62px; }
#stage.tc-on #toasts { opacity: 0; transition: opacity 0.2s; }
.sources { pointer-events: auto; cursor: pointer; }
.toast.info { max-width: 340px; }
.toast.out { animation: toast-out 0.4s forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) scale(0.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px); } }

body.seq .hud, body.seq .stage-meta, body.seq #panel, body.seq .stage-hint, body.seq .zoom, body.seq .zoom-label { opacity: 0.08; pointer-events: none; transition: opacity 0.6s; }
body.seq .hud-side, body.seq .entropy { pointer-events: none; }
.hud, .stage-meta, #panel { transition: opacity 0.8s; }

.title-card {
  position: absolute;
  top: 30%;
  left: 16px;
  right: 16px;
  text-align: center;
  pointer-events: none;
  animation: tc 0.9s cubic-bezier(.2, .9, .3, 1);
}
.title-card.out { animation: tc-out 0.6s forwards; }
.tc-title { font-size: 34px; font-weight: 700; letter-spacing: 0.04em; color: var(--c, #fff); text-shadow: 0 0 24px var(--c, #fff), 0 0 60px var(--c, #fff); }
.tc-sub { margin: 8px auto 0; max-width: 320px; font-size: 13px; line-height: 1.45; color: #c9cce6; text-shadow: 0 1px 8px #000; }
@keyframes tc { from { opacity: 0; transform: scale(1.25); letter-spacing: 0.3em; } }
@keyframes tc-out { to { opacity: 0; transform: translateY(-10px); } }

/* Energiequellen */
.sources { display: flex; width: 132px; height: 3px; border-radius: 2px; overflow: hidden; margin-top: 5px; background: rgba(255, 255, 255, 0.08); }
.sources i { display: block; height: 100%; transition: width 0.6s; box-shadow: 0 0 6px currentColor; }

/* ---------- Panel ---------- */

#panel {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 0;
  background: linear-gradient(180deg, rgba(10, 12, 24, 0.0), var(--bg-2) 40px);
  border-top: 1px solid var(--line);
}

.tab-views { min-height: 0; overflow: hidden; position: relative; }

.view {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 12px 18px;
  overscroll-behavior: contain;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-bottom);
  background: rgba(5, 6, 13, 0.92);
}

.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 2px 8px;
  min-height: 54px;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: color 0.2s;
}
.tab svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.tab.active { color: var(--text); }
.tab.active svg { filter: drop-shadow(0 0 6px var(--accent)); stroke: var(--accent); }
.badge {
  position: absolute;
  top: 6px;
  left: calc(50% + 8px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sing);
  box-shadow: 0 0 10px var(--sing);
  animation: pulse 1.6s infinite;
}
.badge.hot { background: #ff2bd6; box-shadow: 0 0 10px #ff2bd6; }
@keyframes pulse { 50% { transform: scale(1.35); opacity: 0.6; } }

.buymodes {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  position: sticky;
  top: -10px;
  z-index: 2;
  padding: 10px 0 6px;
  margin-top: -10px;
  background: var(--bg-2);
}
.buymodes button {
  flex: 1;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
}
.buymodes button.active { color: var(--text); border-color: var(--accent); box-shadow: inset 0 0 12px rgba(0, 240, 255, 0.15); }

.list { display: flex; flex-direction: column; gap: 8px; }
#tier-list { gap: 0; }
#tier-list .tier { margin-top: 8px; }
#tier-list .tier:first-child { margin-top: 0; }

/* Verbindung zwischen zwei Stufen */
.link { position: relative; height: 22px; margin: 0 0 -8px; padding-left: 64px; display: flex; align-items: center; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; z-index: 1; }
.link i { position: absolute; left: 35px; top: -14px; bottom: -14px; width: 2px; border-radius: 1px; background: linear-gradient(0deg, var(--c2), var(--c1)); box-shadow: 0 0 8px var(--c2); }
.link i::after { content: ''; position: absolute; left: -3px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--c1); box-shadow: 0 0 8px var(--c1); animation: flow 1.2s linear infinite; }
@keyframes flow { from { top: 100%; opacity: 0; } 20% { opacity: 1; } to { top: 0; opacity: 0; } }
.link span { background: var(--bg-2); padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link + .tier { margin-top: 0 !important; }
.link.pulse span { animation: linkpulse 0.7s ease-out; }
@keyframes linkpulse { 0% { border-color: var(--c2); color: #fff; box-shadow: 0 0 12px var(--c2); } 100% { border-color: var(--line); box-shadow: none; } }

/* Erklärungen */
.q { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line-2); color: var(--muted); font-weight: 700; font-size: 14px; background: var(--surface); }
.buymodes .q { flex: none; }
.view-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 2px 10px; }
.view-head b { display: block; font-size: 17px; }
.view-head span { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.explain .ex-diagram { margin: -4px 0 8px; padding: 10px; border-radius: 14px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); }
.diagram { width: 100%; height: auto; display: block; font-family: var(--font); }
.explain h2 { color: var(--c); text-shadow: 0 0 18px var(--c); }
.lex-hero { padding: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 8px; }
.lex-hero p { margin: 6px 0 0; font-size: 13px; color: var(--muted); text-align: center; }
.lex { text-align: left; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); border-left: 2px solid var(--c); }
.lex b { display: block; font-size: 14px; }
.lex span { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* Strukturzeile */
.tier {
  --c: #fff;
  position: relative;
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 10px 10px 8px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
}
.tier.new { animation: tier-new 1.2s ease-out; }
@keyframes tier-new { from { box-shadow: 0 0 0 1px var(--c), 0 0 30px var(--c); } }

.tier-icon {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.tier-icon canvas { width: 56px; height: 56px; display: block; }
.tier-icon .tap-hint {
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 1.5px solid var(--c);
  opacity: 0;
  pointer-events: none;
}
.tier.manual.ready .tier-icon .tap-hint { animation: ring 1.3s ease-out infinite; }
@keyframes ring { 0% { opacity: 0.9; transform: scale(0.85); } 100% { opacity: 0; transform: scale(1.18); } }

.tier-body { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.tier-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.tier-name { font-weight: 600; font-size: 15px; white-space: nowrap; flex: none; }
.tier-count { font-variant-numeric: tabular-nums; color: var(--c); font-weight: 600; font-size: 14px; white-space: nowrap; flex: none; }
.tier-grow { font-size: 11px; font-weight: 600; color: var(--c); border: 1px solid var(--c); border-radius: 8px; padding: 0 5px; line-height: 16px; white-space: nowrap; flex: none; opacity: 0.85; }
.tier-grow[hidden] { display: none; }
.tier-auto { font-size: 11.5px; color: var(--muted); margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; font-variant-numeric: tabular-nums; }
.tier-auto.on { color: var(--muted); }

.bar { position: relative; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--c); border-radius: 3px; box-shadow: 0 0 8px var(--c); }
.bar.stream i { width: 100% !important; background: repeating-linear-gradient(90deg, var(--c) 0 10px, transparent 10px 16px); background-size: 16px 100%; animation: stream 0.35s linear infinite; opacity: 0.8; }
@keyframes stream { to { background-position: 16px 0; } }

.tier-sub { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 0; }
.tier-sub .payout { flex: none; }
.tier-sub .ms { min-width: 0; overflow: hidden; text-overflow: ellipsis; text-align: left; font-size: 12px; color: var(--muted); order: -1; }
.tier-sub .payout { color: var(--c); opacity: 0.8; font-size: 11px; }
.ms-bar { height: 3px; }
.ms-bar i { box-shadow: none; opacity: 0.55; }

.tier-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; width: 98px; }

.btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 5px 10px;
  border-radius: 11px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  font-weight: 600;
  font-size: 13px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  transition: transform 0.08s, border-color 0.2s, box-shadow 0.2s, opacity 0.2s;
}
.btn small { font-size: 11px; font-weight: 500; color: var(--muted); }
.btn:active { transform: scale(0.96); }
.btn.can { border-color: var(--c, var(--accent)); box-shadow: 0 0 14px -4px var(--c, var(--accent)), inset 0 0 14px -8px var(--c, var(--accent)); }
.btn.can small { color: var(--text); }
.btn:disabled, .btn.no { opacity: 0.45; }
.btn.auto { min-height: 34px; font-size: 11px; padding: 3px 6px; }
.btn.auto small { font-size: 10px; }
.btn.wide { width: 100%; }
.btn.big { min-height: 56px; font-size: 16px; }

.tier.locked { opacity: 0.5; }
.tier.locked .tier-name { color: var(--muted); }
.tier.silhouette { border-style: dashed; }

/* Katalysatoren */
.upg {
  --c: var(--accent);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}
.upg-name { font-weight: 600; }
.upg-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.upg .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); margin-right: 7px; vertical-align: 1px; }
.upg .btn { min-width: 108px; }
.upg.special { border-color: rgba(215, 184, 255, 0.35); background: rgba(215, 184, 255, 0.05); }
.blueprint { display: flex; flex-direction: column; gap: 2px; }
.gen-row { --c: var(--accent); display: grid; grid-template-columns: 104px 1fr 30px; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.gen-row span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gen-row b { font-weight: 600; color: var(--c); text-align: right; font-variant-numeric: tabular-nums; }
.gen-row svg { width: 100%; height: 22px; overflow: visible; }
.gen-row path { fill: none; stroke: var(--c); stroke-width: 1.2; opacity: 0.45; }
.gen-row line.off { stroke: var(--c); stroke-width: 1; opacity: 0.18; }
.gen-row line.on { stroke: #fff4d8; stroke-width: 2.2; filter: drop-shadow(0 0 3px var(--c)); }
.gen-row.sphere path.off { opacity: 0.2; }
.gen-row.sphere path.on { opacity: 1; stroke: #fff4d8; stroke-width: 2; filter: drop-shadow(0 0 3px var(--c)); }
.gen-row.thread line.off { stroke: var(--c); stroke-width: 1.2; opacity: 0.22; }
.gen-row circle { fill: var(--c); opacity: 0.6; }
.gen-row rect.off { fill: none; stroke: var(--c); opacity: 0.3; }
.gen-row rect.on { fill: var(--c); filter: drop-shadow(0 0 4px var(--c)); }
.gen-row text { font-size: 10px; font-weight: 700; text-anchor: middle; font-family: inherit; }
.gen-row text.off { fill: var(--c); opacity: 0.4; }
.gen-row rect + text.on { fill: #0a0c18; }
.gen-row text.glyph { font-size: 14px; font-weight: 500; }
.gen-row text.glyph.on { fill: #fff4d8; filter: drop-shadow(0 0 3px var(--c)); }
.plan-head { display: flex; align-items: baseline; gap: 8px; margin: 8px 0 2px; font-size: 12px; }
.plan-head b { font-weight: 700; color: var(--text); }
.plan-head span { color: var(--faint); font-size: 11px; }

.section-title {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 12px 4px 2px;
}
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 24px 12px; line-height: 1.5; }

/* Urknall */
.bang-card {
  padding: 18px 16px;
  border-radius: 18px;
  background: radial-gradient(120% 100% at 50% 0%, rgba(215, 184, 255, 0.1), transparent 60%), var(--surface);
  border: 1px solid var(--line);
  text-align: center;
}
.bang-gain { font-size: 44px; font-weight: 700; color: var(--sing); text-shadow: 0 0 24px rgba(215, 184, 255, 0.6); font-variant-numeric: tabular-nums; line-height: 1.1; }
.bang-gain small { font-size: 16px; font-weight: 500; color: var(--muted); }
.bang-mult { margin: 8px 0 14px; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.bang-mult b { color: var(--text); }
.bang-text { font-size: 13px; color: var(--muted); line-height: 1.5; margin: 0 0 14px; }
.gate { margin: 4px 0 16px; text-align: left; }
.gate-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.gate .bar { height: 7px; }
.gate .bar i { background: linear-gradient(90deg, var(--accent), var(--sing)); box-shadow: 0 0 10px var(--sing); }
.btn.collapse { --c: var(--sing); width: 100%; min-height: 58px; font-size: 17px; letter-spacing: 0.02em; }
.btn.collapse.can { background: rgba(215, 184, 255, 0.08); animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 30px -4px var(--sing), inset 0 0 20px -8px var(--sing); } }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.stat { padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.stat small { display: block; font-size: 11px; color: var(--faint); letter-spacing: 0.04em; margin-bottom: 3px; }
.stat b { font-variant-numeric: tabular-nums; font-weight: 600; }

/* Konstanten */
.konst-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: rgba(215, 184, 255, 0.06);
  border: 1px solid rgba(215, 184, 255, 0.2);
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--muted);
}
.konst-head b { color: var(--sing); font-size: 18px; font-variant-numeric: tabular-nums; }
.konst {
  --c: var(--sing);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}
.pips { display: flex; gap: 3px; margin: 5px 0 4px; flex-wrap: wrap; }
.pips i { width: 12px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.1); }
.pips i.on { background: var(--sing); box-shadow: 0 0 6px var(--sing); }
.konst .btn { min-width: 92px; }
.konst.maxed .btn { opacity: 0.5; }

/* Chronik */
.achv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.achv {
  padding: 10px 8px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  text-align: center;
  font-size: 11.5px;
  line-height: 1.25;
  color: var(--faint);
  min-height: 74px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.achv svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.achv.got { color: var(--text); border-color: rgba(255, 255, 255, 0.18); }
.achv.got svg { stroke: var(--c, var(--accent)); filter: drop-shadow(0 0 5px var(--c, var(--accent))); }
.fact {
  padding: 10px 12px;
  border-left: 2px solid var(--c);
  background: var(--surface);
  border-radius: 0 10px 10px 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}
.fact b { color: var(--text); display: block; font-size: 12px; margin-bottom: 2px; }

/* ---------- Sheet / Dialoge ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 20;
  animation: fade 0.25s;
}
.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(560px, 100%);
  max-height: 86dvh;
  overflow-y: auto;
  z-index: 21;
  background: #0c0e1c;
  border: 1px solid var(--line-2);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  padding: 20px 18px calc(20px + var(--safe-bottom));
  animation: sheet-in 0.35s cubic-bezier(.2, .9, .3, 1);
}
@keyframes sheet-in { from { transform: translate(-50%, 100%); } }
@keyframes fade { from { opacity: 0; } }
.sheet h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -0.01em; }
.sheet p { color: var(--muted); line-height: 1.5; font-size: 14px; margin: 0 0 14px; }
.sheet .big-num { font-size: 36px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; margin: 6px 0 14px; text-shadow: 0 0 20px rgba(0, 240, 255, 0.45); }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.setting small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.toggle { width: 46px; height: 28px; border-radius: 14px; background: rgba(255, 255, 255, 0.12); position: relative; flex: none; transition: background 0.2s; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.toggle.on { background: var(--accent); }
.toggle.on::after { transform: translateX(18px); }
.sheet textarea {
  width: 100%;
  height: 90px;
  background: rgba(0, 0, 0, 0.4);
  color: var(--text);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 8px;
  font: 11px ui-monospace, monospace;
  resize: none;
  -webkit-user-select: text;
  user-select: text;
}
.row-btns { display: flex; gap: 8px; margin-top: 10px; }
.row-btns .btn { flex: 1; }
.btn.danger { --c: #ff3b5c; color: #ff8095; }

.curtain {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  background: transparent;
}
.curtain .ending {
  max-width: 420px;
  animation: fade 2.5s;
}
.curtain h1 { font-size: 44px; letter-spacing: 0.3em; margin: 0 0 18px; font-weight: 500; text-shadow: 0 0 30px #fff; }
.curtain p { color: #c9cce6; line-height: 1.7; font-size: 16px; margin: 0 0 26px; }

/* ---------- Ewige Wiederkehr & Finale ---------- */

.boost.wk { top: calc(var(--safe-top) + 78px); color: #fff; text-shadow: 0 0 12px rgba(255, 255, 255, 0.8); }
.curtain:has(.credits) { background: radial-gradient(120% 90% at 50% 40%, rgba(12, 14, 30, 0.97), rgba(3, 4, 9, 0.99)); }
.wk-card {
  margin: 0 0 14px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: radial-gradient(120% 140% at 50% 0%, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.02));
  box-shadow: 0 0 24px rgba(255, 255, 255, 0.08) inset;
  text-align: center;
}
.wk-title { font-size: 18px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; text-shadow: 0 0 16px #fff; margin-bottom: 8px; }
.wk-card p { color: #c9cce6; font-size: 14px; line-height: 1.5; margin: 0 0 10px; }
.wk-card .wk-warn { color: var(--faint); font-size: 12px; }

.story {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 16%;
  text-align: center;
  font-size: 19px;
  line-height: 1.45;
  font-weight: 500;
  color: #fff;
  text-shadow: 0 0 18px rgba(0, 0, 0, 0.9), 0 0 4px rgba(0, 0, 0, 0.9);
  opacity: 0;
  pointer-events: none;
  z-index: 5;
}
.story.go { animation: story 4.6s ease-in-out forwards; }
@keyframes story { 0% { opacity: 0; transform: translateY(8px); } 15% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; } }

body.finale #app { grid-template-rows: 1fr; grid-template-columns: 1fr; max-width: none; }
body.finale #panel, body.finale .hud, body.finale .stage-meta, body.finale .zoom, body.finale .zoom-label, body.finale .boost { display: none; }

.curtain .credits { max-width: 440px; padding: 24px 20px; max-height: 100dvh; overflow-y: auto; }
.curtain .credits p { font-size: 15px; margin: 0 0 18px; }
.curtain .credits .reveal { color: #fff; font-size: 17px; font-weight: 500; text-shadow: 0 0 18px rgba(255, 255, 255, 0.6); }
.curtain .credits .credit-stats { color: var(--faint); font-size: 13px; font-variant-numeric: tabular-nums; }
.curtain .credits .motto { letter-spacing: 0.14em; text-transform: uppercase; font-size: 12px; color: #d7b8ff; }
.curtain .credits .btn { display: block; margin-left: auto; margin-right: auto; }
.curtain .credits .credit-note { color: var(--faint); font-size: 12px; margin: 10px 0 14px; }

/* ---------- Desktop ---------- */

@media (min-width: 900px) {
  #app {
    max-width: none;
    grid-template-rows: 1fr;
    grid-template-columns: 1fr 460px;
  }
  #panel { border-top: 0; border-left: 1px solid var(--line); }
  .energy { font-size: 44px; }
  body.compact { --stage-h: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .badge, .stage-hint, .btn.collapse.can, .tier.manual.ready .tier-icon .tap-hint { animation: none; }
}
