:root {
  color-scheme: dark;
  --bg: #05090c;
  --panel: rgba(8, 15, 19, 0.76);
  --line: rgba(162, 208, 218, 0.18);
  --text: #f3fbfc;
  --muted: #92a7ad;
  --cyan: #31d8ff;
  --teal: #22b8ae;
  --green: #79d26d;
  --yellow: #ffd44a;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--bg); }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  letter-spacing: -0.012em;
}
button, a { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }

#app { position: relative; width: 100%; height: 100%; background: radial-gradient(circle at 50% 40%, #0b171d 0%, #05090c 58%, #020405 100%); }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; outline: none; }

.ambient { position: absolute; width: 42vw; height: 42vw; border-radius: 50%; filter: blur(90px); opacity: .09; pointer-events: none; }
.ambient-a { left: -10vw; top: 12vh; background: #24d6f3; }
.ambient-b { right: -10vw; bottom: -12vh; background: #78d65b; }
.scanline { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(transparent 50%, rgba(255,255,255,.012) 50%); background-size: 100% 4px; mix-blend-mode: screen; opacity: .35; }

.topbar { position: absolute; z-index: 10; top: 0; left: 0; right: 0; height: 82px; display: flex; align-items: center; justify-content: space-between; padding: 0 34px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, rgba(3,7,9,.83), rgba(3,7,9,.28)); backdrop-filter: blur(10px); }
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid rgba(49,216,255,.65); border-radius: 9px; font-size: 21px; font-weight: 900; color: var(--cyan); box-shadow: inset 0 0 18px rgba(49,216,255,.12), 0 0 24px rgba(49,216,255,.08); }
.brand-copy { display: flex; flex-direction: column; line-height: 1; gap: 5px; }
.brand-copy strong { font-size: 15px; letter-spacing: .14em; }
.brand-copy small, .status-copy { color: var(--muted); font-size: 9px; letter-spacing: .18em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #6ee786; box-shadow: 0 0 12px #6ee786; }
.github-link { margin-left: 12px; border: 1px solid var(--line); border-radius: 999px; padding: 9px 13px; color: #c6d7dc; font-size: 11px; transition: .2s ease; background: rgba(255,255,255,.025); }
.github-link:hover { border-color: rgba(49,216,255,.55); color: #fff; transform: translateY(-1px); }

.story-shell { position: absolute; z-index: 8; left: 112px; top: 112px; bottom: 118px; width: min(430px, 37vw); display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.story-card, .detail-card { pointer-events: auto; border: 1px solid var(--line); background: linear-gradient(145deg, rgba(8,16,20,.84), rgba(5,10,13,.58)); backdrop-filter: blur(14px); box-shadow: 0 26px 80px rgba(0,0,0,.24); }
.story-card { padding: 26px 28px 28px; border-radius: 18px; }
.eyebrow-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.kicker { font-size: 10px; letter-spacing: .2em; color: var(--cyan); font-weight: 800; }
.slide-number { font-size: 10px; letter-spacing: .15em; color: #61747a; }
h1 { margin: 0; font-size: clamp(34px, 4vw, 59px); line-height: .96; letter-spacing: -.055em; max-width: 760px; }
.story-copy { margin: 18px 0 0; max-width: 610px; color: #b7c7cb; font-size: 14px; line-height: 1.65; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin-top: 20px; }
.stat { border-top: 1px solid var(--line); padding-top: 10px; min-height: 52px; }
.stat small { display:block; color: #6f858b; font-size: 8px; letter-spacing:.16em; text-transform: uppercase; }
.stat strong { display:block; margin-top:5px; font-size:14px; font-weight:700; color:#ecf7f8; }
.detail-card { width: 320px; padding: 15px 16px; border-radius: 14px; }
.detail-heading { font-size: 8px; letter-spacing: .2em; color: #597078; }
.detail-title { margin-top: 5px; font-size: 14px; font-weight: 750; }
.detail-copy { margin-top: 4px; color: #8ca0a6; font-size: 11px; line-height: 1.45; }
.legend { display: flex; flex-wrap: wrap; gap: 7px 10px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 8px; text-transform: uppercase; letter-spacing: .08em; color: #758b91; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.swatch { display:inline-block; width:13px; height:2px; border-radius:2px; }
.swatch.water { background: var(--cyan); } .swatch.return { background: var(--teal); } .swatch.air { background: var(--green); } .swatch.feed { background: #99cf58; } .swatch.power { background: var(--yellow); }

.slide-rail { position:absolute; z-index:9; left:32px; top:118px; bottom:138px; width:50px; display:flex; justify-content:center; }
.rail-progress { position:absolute; left:8px; top:0; width:1px; height:100%; background: rgba(151,184,191,.14); }
.rail-progress::after { content:""; position:absolute; top:0; left:0; width:1px; height:var(--progress, 0%); background: linear-gradient(var(--cyan), #6be97b); box-shadow:0 0 12px rgba(49,216,255,.5); transition: height .45s cubic-bezier(.2,.8,.2,1); }
.rail-items { width:100%; height:100%; display:flex; flex-direction:column; justify-content:space-between; align-items:flex-start; }
.rail-item { width: 26px; height: 26px; display:grid; place-items:center; border:0; padding:0; background:transparent; color:#51656c; cursor:pointer; font-size:9px; transition:.2s ease; position:relative; }
.rail-item::before { content:""; position:absolute; left:4px; width:9px; height:9px; border-radius:50%; border:1px solid #465b62; background:#071014; transition:.25s ease; }
.rail-item span { opacity:0; pointer-events:none; }
.rail-item.active::before { border-color:var(--cyan); background:var(--cyan); box-shadow:0 0 15px rgba(49,216,255,.65); transform:scale(1.1); }
.rail-item:hover::before { border-color:#c5f6ff; }

.controls { position:absolute; z-index:10; left:112px; bottom:34px; display:flex; align-items:center; gap:8px; }
.control-button { width:38px; height:38px; display:grid; place-items:center; border:1px solid var(--line); border-radius:10px; background:rgba(6,12,15,.74); backdrop-filter:blur(10px); cursor:pointer; transition:.2s ease; }
.control-button.wide { width:auto; padding:0 14px; font-size:9px; letter-spacing:.16em; color:#8ba1a7; }
.control-button:hover, .control-button[aria-pressed="true"] { border-color:rgba(49,216,255,.55); color:#fff; box-shadow:0 0 25px rgba(49,216,255,.08); }
.control-hint { margin-left:8px; font-size:8px; letter-spacing:.15em; color:#4e6268; }

.metric-strip { position:absolute; z-index:7; right:30px; bottom:30px; display:grid; grid-template-columns: repeat(5, minmax(88px, 1fr)); gap:1px; border:1px solid var(--line); border-radius:13px; overflow:hidden; background:var(--line); backdrop-filter:blur(12px); }
.metric-strip > div { min-width:108px; padding:10px 12px; background:rgba(5,11,14,.78); }
.metric-strip small { display:block; color:#577078; font-size:7px; letter-spacing:.16em; }
.metric-strip strong { display:block; margin-top:4px; color:#b8cbd0; font-size:10px; letter-spacing:.04em; white-space:nowrap; }

.loading { position:absolute; inset:0; z-index:100; display:flex; flex-direction:column; justify-content:center; align-items:center; gap:16px; background:#030607; font-size:8px; letter-spacing:.22em; color:#61747a; transition:opacity .7s ease, visibility .7s ease; }
.loading.done { opacity:0; visibility:hidden; }
.loading-mark { width:58px; height:58px; display:grid; place-items:center; border:1px solid rgba(49,216,255,.5); border-radius:14px; font-size:28px; font-weight:900; color:var(--cyan); box-shadow:0 0 35px rgba(49,216,255,.1); }
.loading-bar { width:160px; height:2px; background:#102028; overflow:hidden; }
.loading-bar span { display:block; width:55%; height:100%; background:linear-gradient(90deg,transparent,var(--cyan),transparent); animation:load 1.1s infinite ease-in-out; }
@keyframes load { from { transform:translateX(-110%); } to { transform:translateX(220%); } }

@media (max-width: 900px) {
  .topbar { height:68px; padding:0 18px; }
  .status-copy { display:none; }
  .story-shell { left:24px; top:90px; width:calc(100vw - 48px); bottom:122px; justify-content:flex-start; }
  .story-card { width:min(430px, 100%); padding:20px; }
  h1 { font-size:38px; max-width:370px; }
  .story-copy { max-width:370px; font-size:12px; }
  .detail-card { display:none; }
  .slide-rail { display:none; }
  .controls { left:24px; bottom:24px; }
  .metric-strip { right:16px; left:16px; bottom:74px; grid-template-columns: repeat(3,1fr); }
  .metric-strip > div { min-width:0; padding:8px 9px; }
  .metric-strip > div:nth-child(4), .metric-strip > div:nth-child(5) { display:none; }
  .control-hint { display:none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior:auto!important; animation-duration:.01ms!important; animation-iteration-count:1!important; transition-duration:.01ms!important; }
}
