:root {
  --cyan: #53e6ff;
  --ice: #d7fbff;
  --gold: #ffc061;
  --alert: #ff6a78;
  --dim: rgba(150, 198, 216, 0.6);
  --faint: rgba(150, 198, 216, 0.28);
  --bg: #02060a;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --disp: 'Space Grotesk', system-ui, sans-serif;
  --cune: 'Noto Sans Cuneiform', 'Space Grotesk', system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ice);
  font-family: var(--disp);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

#gl { position: fixed; inset: 0; z-index: 0; touch-action: none; display: block; }

/* ---------- boot ---------- */
#boot {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center;
  background: radial-gradient(120% 90% at 50% 60%, #061019 0%, #01040a 70%, #000 100%);
}
.boot-inner { width: min(86vw, 460px); }
.boot-mark {
  font-family: var(--cune); font-size: 13px; letter-spacing: 0.34em; color: var(--cyan);
  text-shadow: 0 0 18px rgba(83, 230, 255, 0.55); margin-bottom: 22px;
}
#boot-log { font-family: var(--mono); font-size: 11.5px; color: var(--dim); min-height: 118px; line-height: 1.9; }
.boot-line::before { content: '› '; color: var(--cyan); }
.boot-track { margin-top: 18px; height: 1px; background: rgba(83, 230, 255, 0.16); overflow: hidden; }
#boot-bar { height: 100%; width: 0; background: linear-gradient(90deg, transparent, var(--cyan)); box-shadow: 0 0 12px var(--cyan); }

/* ---------- brand ---------- */
#brand {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; justify-content: space-between; align-items: center;
  padding: clamp(16px, 3vw, 30px) clamp(18px, 4vw, 46px);
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.28em;
  pointer-events: none; opacity: 0; transition: opacity 1s ease 0.4s;
}
body.ready #brand { opacity: 1; }
.brand-mark { font-family: var(--cune); color: var(--ice); text-shadow: 0 0 14px rgba(83, 230, 255, 0.35); }
.brand-status { color: var(--dim); display: inline-flex; align-items: center; gap: 8px; }
.pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.35; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1.15); } }

/* ---------- HUD (leaders / rig / psi) ---------- */
#hud { position: fixed; inset: 0; z-index: 18; pointer-events: none; }
#leaders { position: fixed; inset: 0; pointer-events: none; overflow: visible; }
.leader { fill: none; stroke: rgba(83, 230, 255, 0.5); stroke-width: 1; }
.leader-dot { fill: var(--cyan); filter: drop-shadow(0 0 5px var(--cyan)); }

#rig {
  position: absolute; top: 0; left: 0; will-change: transform, opacity;
  padding: 12px 14px; border-left: 1px solid rgba(83, 230, 255, 0.35);
  background: linear-gradient(90deg, rgba(6, 20, 28, 0.55), rgba(6, 20, 28, 0));
  backdrop-filter: blur(2px);
}
#rig pre { font-family: var(--mono); font-size: 10.5px; line-height: 1.75; color: var(--cyan); white-space: pre; text-shadow: 0 0 10px rgba(83, 230, 255, 0.3); }
#rig .legend { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; max-width: 320px; }
#rig .legend span { font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.14em; color: var(--dim); border: 1px solid rgba(83, 230, 255, 0.25); padding: 2px 6px; border-radius: 2px; }

#psi-chip {
  position: absolute; top: 0; left: 0; will-change: transform, opacity;
  display: flex; align-items: baseline; gap: 6px; padding-left: 9px;
  border-left: 1px solid rgba(83, 230, 255, 0.4);
}
#psi-chip b { font-family: var(--disp); font-weight: 700; font-size: 22px; line-height: 1; font-variant-numeric: tabular-nums; color: var(--ice); text-shadow: 0 0 14px rgba(83, 230, 255, 0.45); }
#psi-chip i { font-style: normal; font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; color: var(--dim); }
#psi-chip em { font-style: normal; font-family: var(--mono); font-size: 9px; letter-spacing: 0.18em; color: var(--faint); margin-left: 6px; }

/* ---------- copy gallery ---------- */
#gallery { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
.panel {
  position: absolute; inset: 0; display: flex; align-items: center;
  padding-left: clamp(24px, 5vw, 92px); will-change: opacity, filter;
}
.panel-in { position: relative; width: min(46vw, 480px); will-change: transform; }
/* soft feathered scrim so copy stays readable over the bright table */
.panel-in::before {
  content: ''; position: absolute; inset: -38px -52px; z-index: -1; pointer-events: none;
  background: radial-gradient(120% 110% at 34% 50%, rgba(2,6,10,0.72), rgba(2,6,10,0.3) 46%, transparent 74%);
}

.p-eyebrow, .p-no { display: block; font-family: var(--mono); letter-spacing: 0.34em; color: var(--cyan); text-shadow: 0 0 14px rgba(83, 230, 255, 0.5); }
.p-eyebrow { font-size: 11px; margin-bottom: 18px; }
.p-no { font-size: 13px; margin-bottom: 14px; opacity: 0.85; }

.p-title { font-weight: 700; font-size: clamp(26px, 3.6vw, 44px); line-height: 1.02; letter-spacing: -0.015em; color: var(--ice); text-shadow: 0 0 34px rgba(83, 230, 255, 0.22); }
.p-body { margin-top: 16px; font-size: clamp(14px, 1.55vw, 17px); line-height: 1.55; color: rgba(180, 214, 228, 0.72); max-width: 40ch; text-shadow: 0 1px 12px rgba(0, 8, 14, 0.75); }

.p-bullets { margin-top: 20px; list-style: none; display: flex; flex-direction: column; gap: 9px; }
.p-bullets li { font-family: var(--mono); font-size: 12px; letter-spacing: 0.02em; color: var(--ice); display: flex; align-items: center; gap: 10px; text-shadow: 0 1px 10px rgba(0, 8, 14, 0.7); }
.p-bullets li::before { content: ''; width: 12px; height: 1px; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); flex: none; }

/* hero */
.panel-hero .p-headline span { display: block; font-weight: 700; font-size: clamp(42px, 7.4vw, 92px); line-height: 0.94; letter-spacing: -0.025em; color: var(--ice); text-shadow: 0 0 44px rgba(83, 230, 255, 0.25); }
.panel-hero .p-headline span:last-child { color: var(--cyan); }
.panel-hero .p-sub { margin-top: 24px; font-size: clamp(14px, 1.7vw, 18px); color: var(--dim); }
.panel-hero .p-sub .rotor { color: var(--cyan); display: inline-block; min-width: 3.4em; text-shadow: 0 0 14px rgba(83, 230, 255, 0.55); }
.panel-hero .p-foot { margin-top: 28px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.24em; color: var(--dim); text-transform: uppercase; padding-left: 10px; border-left: 1px solid rgba(83, 230, 255, 0.4); }

/* reel caption */
.panel-reel .p-caption { margin-top: 14px; font-size: clamp(14px, 1.7vw, 18px); color: var(--dim); max-width: 30ch; }

/* process steps */
.p-steps { margin-top: 22px; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.p-steps li { display: flex; align-items: baseline; gap: 14px; font-size: clamp(15px, 1.7vw, 19px); color: var(--ice); text-shadow: 0 1px 10px rgba(0, 8, 14, 0.7); }
.p-steps li b { font-family: var(--mono); font-size: 11px; color: var(--cyan); letter-spacing: 0.1em; }

/* ---------- dot index ---------- */
#dots {
  position: fixed; right: clamp(14px, 2.4vw, 32px); top: 50%; transform: translateY(-50%);
  z-index: 30; display: flex; flex-direction: column; gap: 11px; pointer-events: auto;
  opacity: 0; transition: opacity 1s ease 0.6s;
}
body.ready #dots { opacity: 1; }
.dot { width: 7px; height: 7px; padding: 0; border: 0; border-radius: 50%; background: rgba(83, 230, 255, 0.22); cursor: pointer; transition: background 0.3s, box-shadow 0.3s, transform 0.3s; }
.dot:hover { background: rgba(83, 230, 255, 0.5); }
.dot.on { background: var(--cyan); box-shadow: 0 0 10px var(--cyan); transform: scale(1.25); }

/* ---------- signature + hint ---------- */
#signature { position: fixed; left: clamp(18px, 4vw, 46px); bottom: clamp(14px, 3vh, 28px); z-index: 40; pointer-events: auto; opacity: 0; transition: opacity 1s ease 0.8s; }
body.ready #signature { opacity: 1; }
#signature a { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; color: var(--dim); text-decoration: none; transition: color 0.3s, text-shadow 0.3s; }
#signature a:hover { color: var(--ice); text-shadow: 0 0 12px rgba(83, 230, 255, 0.5); }

#hint { position: fixed; bottom: clamp(14px, 3vh, 28px); left: 50%; transform: translateX(-50%); z-index: 40; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.18em; color: var(--dim); opacity: 0; pointer-events: none; text-align: center; }

/* ---------- fallback ---------- */
#fallback { position: fixed; inset: 0; z-index: 100; display: none; place-items: center; text-align: center; background: radial-gradient(120% 90% at 50% 40%, #061019, #000); }
#fallback h2 { font-size: 24px; margin: 12px 0; }
#fallback p { color: var(--dim); }
.ns { position: fixed; inset: 0; display: grid; place-items: center; color: var(--dim); font-family: var(--mono); }

/* ---------- portrait ---------- */
@media (max-width: 760px) {
  #brand { font-size: 9px; letter-spacing: 0.18em; }
  .panel { align-items: flex-end; justify-content: center; padding: 0 24px clamp(150px, 24vh, 230px); }
  .panel-in { width: min(92vw, 540px); }
  .panel-in::before { inset: -28px -26px; background: radial-gradient(130% 96% at 50% 64%, rgba(2,6,10,0.82), rgba(2,6,10,0.4) 52%, transparent 80%); }
  .panel-hero .p-headline span { font-size: clamp(30px, 8.6vw, 52px); }
  .panel-hero .p-sub { margin-top: 16px; }
  .p-bullets, .p-steps { margin-top: 14px; }
  #rig { max-width: 82vw; }
  #rig pre { font-size: 9px; }
  #dots { right: 50%; top: auto; bottom: clamp(42px, 7vh, 68px); transform: translateX(50%); flex-direction: row; gap: 9px; }
  #signature { left: 50%; transform: translateX(-50%); bottom: clamp(16px, 3vh, 26px); }
  #hint { display: none; }
}
