/* ═══════════════════════════════════════════════════════
   334DIGITALZONE // demo_a.css  (self-contained, not shared)
   ═══════════════════════════════════════════════════════ */
:root {
  --hot: #ff2d78;
  --cyan: #00ffe7;
  --yellow: #ffe600;
  --purple: #b400ff;
  --bg: #05000a;
  --ink: #d9fffb;
  /* driven by JS */
  --lvl: 0;        /* mic level 0..1 */
  --hue: 0deg;     /* global hue drift */
  --ghost: 0;      /* ghost closeness 0..1 (only while ghost is on screen) */
  --mx: 0; --my: 0;
  --mono: 'Share Tech Mono', ui-monospace, monospace;
  --pix: 'VT323', ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: hidden; }
html.reduce { scroll-behavior: auto; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 17px;
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}
html.booting body { overflow: hidden; }
::selection { background: var(--hot); color: #000; }
a { color: var(--cyan); }
button { font: inherit; color: inherit; }
code, kbd { font-family: var(--mono); }
.hot { color: var(--hot); }

.skip-link {
  position: fixed; left: 12px; top: -60px; z-index: 200;
  background: var(--cyan); color: #000; padding: 8px 14px; font-family: var(--pix); font-size: 1.2rem;
}
.skip-link:focus { top: 12px; }
:focus-visible { outline: 2px dashed var(--yellow); outline-offset: 4px; }

/* ─────────── background layers ─────────── */
#bg {
  position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0;
}
/* only filter the canvas while audio is driving it (filters on a full-screen canvas are costly) */
html.pulse #bg { filter: hue-rotate(var(--hue)) saturate(calc(1 + var(--lvl) * 1.2)) brightness(calc(1 + var(--lvl) * .6)); }
.scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 60;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,.22) 2px 3px);
}
.scanlines::after { /* slow rolling CRT band */
  content: ""; position: absolute; left: 0; right: 0; height: 22vh; top: -22vh;
  background: linear-gradient(to bottom, transparent, rgba(0,255,231,.045), transparent);
  animation: roll 7s linear infinite;
}
html.reduce .scanlines::after { animation: none; display: none; }
@keyframes roll { to { transform: translateY(125vh); } }

#vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 55;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(0,0,0,.95) 100%);
  opacity: calc(.35 + var(--ghost) * .65);
  transition: opacity .25s;
}
#vignette::after { /* dark red bleed as the ghost closes in */
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 20%, rgba(90,0,30,.9) 110%);
  opacity: calc(var(--ghost) * var(--ghost));
}
#static {
  position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 56;
  image-rendering: pixelated; opacity: 0; mix-blend-mode: screen; visibility: hidden;
}
#static.on { visibility: visible; }
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 90; }

/* ─────────── custom cursor ─────────── */
#cursor, #cursor-ring { display: none; }
html.has-cursor, html.has-cursor * { cursor: none !important; }
html.has-cursor #cursor, html.has-cursor #cursor-ring {
  display: block; position: fixed; left: 0; top: 0; pointer-events: none; z-index: 120;
  will-change: transform;
}
#cursor {
  width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 10px var(--cyan), 0 0 20px var(--cyan);
}
#cursor-ring {
  width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%;
  border: 1.5px solid var(--hot); box-shadow: 0 0 12px var(--hot), inset 0 0 8px var(--hot);
  transition: width .2s, height .2s, margin .2s, border-color .2s, background .2s;
}
#cursor-ring.hover { width: 64px; height: 64px; margin: -32px 0 0 -32px; border-color: var(--cyan); background: rgba(0,255,231,.08); }
#cursor-ring.down { width: 24px; height: 24px; margin: -12px 0 0 -12px; }

/* ─────────── dock (motion / sound / terminal) ─────────── */
.dock {
  position: fixed; right: 14px; bottom: 14px; z-index: 110;
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end;
}
.dock-btn {
  font-family: var(--pix); font-size: 1.25rem; letter-spacing: 1px;
  background: rgba(5,0,10,.82); border: 2px solid var(--cyan); color: var(--cyan);
  padding: 6px 14px; cursor: pointer;
  box-shadow: 0 0 14px rgba(0,255,231,.35), inset 0 0 10px rgba(0,255,231,.12);
  transition: background .2s, color .2s, box-shadow .2s;
}
.dock-btn b { color: var(--yellow); font-weight: normal; }
.dock-btn[aria-pressed="true"] { border-color: var(--hot); color: var(--hot); box-shadow: 0 0 18px rgba(255,45,120,.5); }
.dock-btn:hover { background: var(--cyan); color: #000; }
.dock-btn:hover b { color: #000; }
.dock-term { border-color: var(--purple); color: #d9a0ff; }

/* ─────────── page ─────────── */
.page { position: relative; z-index: 10; max-width: 1100px; margin: 0 auto; padding: 0 20px 120px; overflow-x: hidden; overflow-x: clip; }
html.booting .page { visibility: hidden; }
.page.drop-in { animation: dropIn 1s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes dropIn {
  0% { transform: translateY(-40px) scale(1.04); opacity: 0; filter: blur(8px) brightness(3); }
  60% { opacity: 1; filter: blur(0) brightness(1.4); }
  100% { transform: none; filter: none; }
}

header.top {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  padding: 18px 0 12px; border-bottom: 1px solid rgba(0,255,231,.25);
}
.brand { font-family: var(--pix); font-size: 2rem; color: #fff; text-decoration: none; letter-spacing: 3px; text-shadow: 0 0 8px var(--cyan); }
nav { display: flex; gap: 6px; flex-wrap: wrap; }
nav a {
  display: inline-block; font-family: var(--pix); font-size: 1.3rem; color: var(--cyan); text-decoration: none;
  padding: 2px 10px; border: 1px solid transparent; transition: color .15s, border-color .15s, background .15s, text-shadow .15s;
}
nav a:hover, nav a:focus-visible { color: #000; background: var(--cyan); box-shadow: 0 0 16px var(--cyan); }
nav a.nav-home { color: var(--hot); border-color: var(--hot); }
nav a.nav-home:hover { background: var(--hot); color: #000; box-shadow: 0 0 16px var(--hot); }

/* glitch text (RGB split via pseudo elements) */
.glitch { position: relative; display: inline-block; }
.glitch::before, .glitch::after {
  content: attr(data-text); position: absolute; left: 0; top: 0; width: 100%; overflow: hidden; pointer-events: none;
}
.glitch::before { color: var(--hot); transform: translate(-2px,0); mix-blend-mode: screen; animation: gl1 2.6s infinite steps(1); }
.glitch::after  { color: var(--cyan); transform: translate(2px,0); mix-blend-mode: screen; animation: gl2 3.1s infinite steps(1); }
html.reduce .glitch::before, html.reduce .glitch::after { animation: none; opacity: .4; }
@keyframes gl1 { 0%,100%{clip-path:inset(0 0 0 0)} 10%{clip-path:inset(20% 0 55% 0);transform:translate(-4px,1px)} 12%{clip-path:inset(70% 0 5% 0);transform:translate(3px,-1px)} 14%{clip-path:inset(0 0 0 0);transform:translate(-2px,0)} 60%{clip-path:inset(40% 0 40% 0);transform:translate(-6px,0)} 62%{clip-path:inset(0 0 0 0);transform:translate(-2px,0)} }
@keyframes gl2 { 0%,100%{clip-path:inset(0 0 0 0)} 20%{clip-path:inset(60% 0 10% 0);transform:translate(5px,0)} 22%{clip-path:inset(5% 0 80% 0);transform:translate(-3px,1px)} 24%{clip-path:inset(0 0 0 0);transform:translate(2px,0)} 75%{clip-path:inset(30% 0 50% 0);transform:translate(6px,-1px)} 77%{clip-path:inset(0 0 0 0);transform:translate(2px,0)} }

/* ─────────── hero ─────────── */
.hero {
  min-height: calc(100vh - 80px); min-height: calc(100svh - 80px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  position: relative; padding: 40px 0 70px;
}
.hero-kicker { font-size: .85rem; letter-spacing: 3px; color: rgba(0,255,231,.75); margin-bottom: 10px; }
.blink { color: var(--hot); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero-title {
  position: relative; margin: 0; width: 100%;
  font-family: var(--pix); font-weight: normal; line-height: 1;
  font-size: clamp(3rem, 13vw, 10rem); letter-spacing: .02em;
  height: 1.15em;
  display: flex; align-items: center; justify-content: center;
}
.hero-title-text {
  color: #fff;
  text-shadow: -3px 0 var(--hot), 3px 0 var(--cyan), 0 0 30px rgba(0,255,231,.6);
  transition: opacity .6s;
}
/* when particle canvas is live, keep text in the DOM for a11y but hide visually */
.hero-title.particles .hero-title-text { opacity: 0; }
#title-canvas { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); pointer-events: none; }
.hero-sub { font-size: clamp(1.05rem, 2.6vw, 1.5rem); margin: 18px 0 4px; color: #fff; }
.hero-sub em { color: var(--hot); font-style: normal; text-shadow: 0 0 10px var(--hot); }
.hero-hint { font-size: .85rem; color: rgba(217,255,251,.6); margin: 4px 0 28px; }
.cta {
  font-family: var(--pix); font-size: 1.8rem; letter-spacing: 3px; text-decoration: none; color: #000;
  background: linear-gradient(90deg, var(--cyan), var(--hot)); padding: 8px 34px;
  box-shadow: 0 0 24px rgba(0,255,231,.6), 0 0 60px rgba(255,45,120,.35);
  clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%);
  display: inline-block; transition: filter .2s;
}
.cta:hover { filter: brightness(1.3) saturate(1.3); }
.scroll-cue { position: absolute; bottom: 14px; font-size: .75rem; letter-spacing: 4px; color: rgba(0,255,231,.6); display: flex; flex-direction: column; align-items: center; }
.scroll-cue span { animation: bob 1.4s ease-in-out infinite; font-size: 1.2rem; }
html.reduce .scroll-cue span { animation: none; }
@keyframes bob { 50% { transform: translateY(6px); } }

/* ─────────── marquee ─────────── */
.marquee { margin: 10px -20px 60px; transform: rotate(-2deg); }
.marquee-row { overflow: hidden; white-space: nowrap; border-block: 2px solid var(--hot); background: rgba(255,45,120,.12); padding: 6px 0; }
.marquee-row.rev { border-color: var(--cyan); background: rgba(0,255,231,.1); transform: rotate(3deg) translateY(-6px); }
.marquee-track { display: inline-flex; animation: marq 26s linear infinite; font-family: var(--pix); font-size: 1.6rem; letter-spacing: 2px; }
.marquee-row .marquee-track { color: var(--yellow); text-shadow: 0 0 8px rgba(255,230,0,.6); }
.marquee-row.rev .marquee-track { animation-direction: reverse; animation-duration: 32s; color: var(--cyan); text-shadow: 0 0 8px rgba(0,255,231,.6); }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track span { padding-right: 1ch; }
html.reduce .marquee-track { animation-duration: 120s; }
@keyframes marq { to { transform: translateX(-50%); } }

/* ─────────── panels ─────────── */
.panel {
  position: relative; margin: 0 0 56px; padding: 30px 30px 26px;
  background: linear-gradient(160deg, rgba(20,0,35,.86), rgba(0,10,20,.8));
  border: 1px solid rgba(0,255,231,.35);
  box-shadow: 0 0 0 1px rgba(255,45,120,.12), 0 20px 60px rgba(0,0,0,.6), inset 0 0 40px rgba(180,0,255,.08);
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 22px 100%, 0 calc(100% - 22px));
}
.panel::before { /* corner accent */
  content: ""; position: absolute; right: 0; top: 0; width: 32px; height: 32px;
  background: linear-gradient(225deg, var(--hot) 0 50%, transparent 50%); opacity: .85;
}
.panel h2 {
  font-family: var(--pix); font-weight: normal; font-size: clamp(2rem, 5vw, 3rem); margin: 0 0 12px;
  color: var(--cyan); letter-spacing: 2px; text-shadow: 0 0 12px rgba(0,255,231,.7), 2px 2px 0 rgba(255,45,120,.6);
}
.panel p { margin: 0 0 12px; }
.note { font-size: .82rem; color: rgba(0,255,231,.55); }
.panel-xl { border-color: var(--hot); box-shadow: 0 0 40px rgba(255,45,120,.25), 0 20px 60px rgba(0,0,0,.6); }

/* reveal: 3D swing-in */
html.js .reveal { opacity: 0; transform: perspective(900px) rotateX(18deg) translateY(60px) scale(.96); transition: opacity .9s ease, transform .9s cubic-bezier(.2,.9,.3,1.2); }
html.js .reveal.visible { opacity: 1; transform: none; }
html.reduce .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }

/* ─────────── typing ─────────── */
.term-window { background: rgba(0,0,0,.72); border: 1px solid rgba(0,255,231,.4); margin: 6px 0 12px; }
.term-bar { display: flex; align-items: center; gap: 6px; padding: 6px 10px; background: rgba(0,255,231,.12); border-bottom: 1px solid rgba(0,255,231,.3); font-size: .78rem; color: rgba(217,255,251,.7); }
.term-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--hot); display: inline-block; }
.term-bar i:nth-child(2) { background: var(--yellow); }
.term-bar i:nth-child(3) { background: var(--cyan); }
.term-bar span { margin-left: 8px; }
.typing-line { padding: 16px; font-family: var(--pix); font-size: clamp(1.5rem, 4vw, 2.3rem); line-height: 1.2; min-height: 2.4em; margin: 0 !important; word-break: break-word; }
.prompt { color: var(--hot); }
#typing-output { color: var(--cyan); text-shadow: 0 0 10px rgba(0,255,231,.7); }
#typing-output.glitchy { color: var(--yellow); text-shadow: -2px 0 var(--hot), 2px 0 var(--cyan); }
.caret { display: inline-block; width: .55em; height: .95em; background: var(--cyan); vertical-align: -.1em; margin-left: 2px; animation: blink .8s steps(1) infinite; box-shadow: 0 0 10px var(--cyan); }

/* ─────────── sparks ─────────── */
.spark-pad {
  margin: 14px 0; height: 130px; display: grid; place-items: center; cursor: pointer;
  border: 2px dashed rgba(255,230,0,.55); background: repeating-linear-gradient(45deg, rgba(255,230,0,.05) 0 12px, transparent 12px 24px);
  font-family: var(--pix); font-size: 1.7rem; color: var(--yellow); text-shadow: 0 0 10px rgba(255,230,0,.7); user-select: none;
  transition: background-color .2s;
}
.spark-pad:hover { background-color: rgba(255,230,0,.08); }

/* ─────────── mic viz ─────────── */
.viz-wrap { position: relative; margin: 14px 0; }
#viz-canvas { display: block; width: 100%; height: 320px; background: radial-gradient(ellipse at center, #140022, #030006 70%); border: 1px solid rgba(0,255,231,.35); cursor: pointer; }
.viz-meter { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255,255,255,.06); }
.viz-meter span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--yellow), var(--hot)); box-shadow: 0 0 10px var(--hot); }
.viz-status { font-size: .85rem; color: rgba(217,255,251,.7); }
.viz-status b { color: var(--yellow); font-weight: normal; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.btn {
  font-family: var(--pix); font-size: 1.35rem; letter-spacing: 1px; padding: 6px 18px; cursor: pointer;
  background: var(--cyan); color: #000; border: 2px solid var(--cyan);
  box-shadow: 0 0 16px rgba(0,255,231,.5); transition: background .15s, color .15s, box-shadow .15s;
}
.btn:hover { background: #fff; box-shadow: 0 0 26px rgba(0,255,231,.9); }
.btn.on { background: var(--hot); border-color: var(--hot); box-shadow: 0 0 22px rgba(255,45,120,.8); }
.btn-alt { background: transparent; color: var(--cyan); }
.btn-alt:hover { background: var(--cyan); color: #000; }
.btn-alt.on { color: #000; }

/* mic level shake applied to hero title by JS (transform) */

/* ─────────── cards ─────────── */
.card-hint { font-size: .85rem; color: rgba(217,255,251,.6); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px; perspective: 1000px; margin-top: 14px; }
.card {
  --rx: 0deg; --ry: 0deg; --px: 50%; --py: 50%; --flip: 0deg;
  position: relative; height: 170px; padding: 0; border: 0; background: none; cursor: pointer;
  transform-style: preserve-3d; transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .15s ease-out;
}
.card-in {
  position: absolute; inset: 0; display: block; transform-style: preserve-3d;
  transform: rotateY(var(--flip)); transition: transform .7s cubic-bezier(.3,1.5,.5,1);
}
.card.flipped { --flip: 180deg; }
.card-front, .card-back {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border: 2px solid var(--cyan); background: linear-gradient(145deg, rgba(0,40,50,.9), rgba(30,0,50,.9));
  box-shadow: 0 0 18px rgba(0,255,231,.3), inset 0 0 22px rgba(0,255,231,.12);
}
.card-back { transform: rotateY(180deg); border-color: var(--hot); padding: 14px; font-size: .95rem; color: #fff; text-align: center; box-shadow: 0 0 22px rgba(255,45,120,.4); }
.card-ico { font-size: 2.6rem; filter: drop-shadow(0 0 10px rgba(255,255,255,.6)); transform: translateZ(40px); }
.card-label { font-family: var(--pix); font-size: 1.8rem; letter-spacing: 2px; color: var(--cyan); text-shadow: 0 0 10px var(--cyan); transform: translateZ(30px); }
.card .shine {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .25s; mix-blend-mode: color-dodge;
  background:
    radial-gradient(circle at var(--px) var(--py), rgba(255,255,255,.85), rgba(255,255,255,0) 38%),
    linear-gradient(115deg, transparent 20%, rgba(255,45,120,.55) 35%, rgba(255,230,0,.5) 45%, rgba(0,255,231,.55) 55%, rgba(180,0,255,.55) 65%, transparent 80%);
  background-size: 100% 100%, 250% 250%;
  background-position: 0 0, var(--px) var(--py);
  transform: translateZ(1px);
}
.card:hover .shine, .card.active .shine { opacity: .75; }
.card:hover .card-front, .card.active .card-front { border-color: #fff; box-shadow: 0 0 30px rgba(0,255,231,.7), inset 0 0 30px rgba(0,255,231,.25); }
/* flip-in on reveal */
html.js .cards .card { opacity: 0; transform: rotateY(-100deg) translateZ(-80px); }
html.js .cards.in .card { opacity: 1; transform: rotateX(var(--rx)) rotateY(var(--ry)); transition: transform .9s cubic-bezier(.2,1.3,.4,1) calc(var(--i) * 110ms), opacity .4s calc(var(--i) * 110ms); }
html.js .cards.in.done .card { transition: transform .15s ease-out; }
html.reduce .cards .card { opacity: 1 !important; transform: none !important; transition: none !important; }
html.reduce .card-in { transition: none; }

/* ─────────── konami ─────────── */
kbd { display: inline-block; min-width: 1.8em; text-align: center; padding: 0 5px; margin: 0 2px; border: 1px solid var(--cyan); border-bottom-width: 3px; color: var(--yellow); background: rgba(0,0,0,.5); font-size: .9rem; }
.konami-progress { display: flex; gap: 6px; margin: 12px 0; }
.konami-progress span { flex: 1; height: 8px; background: rgba(255,255,255,.08); border: 1px solid rgba(0,255,231,.3); transition: background .15s, box-shadow .15s; }
.konami-progress span.lit { background: var(--hot); box-shadow: 0 0 10px var(--hot); }
#konami-msg { display: none; font-family: var(--pix); font-size: 1.8rem; color: var(--yellow); text-shadow: 0 0 12px var(--yellow); margin: 10px 0; animation: pulse .5s ease-in-out infinite alternate; }
#konami-msg.show { display: block; }
@keyframes pulse { to { transform: scale(1.04); text-shadow: 0 0 22px var(--hot); } }
.linkish { background: none; border: 0; padding: 0; color: var(--hot); text-decoration: underline; cursor: pointer; font-size: inherit; }

/* ─────────── ghost ─────────── */
.ghost-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 24px; align-items: stretch; }
.ghost-stage {
  position: relative; min-height: 360px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 100%, rgba(180,0,255,.35), transparent 60%), linear-gradient(#000, #0b0016);
  border: 1px solid rgba(180,0,255,.5);
  box-shadow: inset 0 0 calc(40px + var(--gc, 0) * 120px) rgba(0,0,0, calc(.5 + var(--gc, 0) * .5));
}
.ghost-fog {
  position: absolute; inset: -20%; opacity: calc(.25 + var(--gc, 0) * .6);
  background: radial-gradient(circle at 30% 70%, rgba(200,255,255,.18), transparent 40%), radial-gradient(circle at 70% 60%, rgba(255,45,120,.15), transparent 40%);
  animation: fog 9s ease-in-out infinite alternate;
}
html.reduce .ghost-fog { animation: none; }
@keyframes fog { to { transform: translate(8%, -4%) scale(1.15); } }
.ghost-fig {
  position: absolute; left: 50%; bottom: 6%; width: 52%; max-width: 250px;
  transform-origin: 50% 100%;
  transform: translateX(-50%) translateY(calc((1 - var(--gc, 0)) * -30px)) scale(calc(.2 + var(--gc, 0) * 1.05));
  filter: blur(calc((1 - var(--gc, 0)) * 3px)) drop-shadow(0 0 calc(10px + var(--gc, 0) * 40px) rgba(0,255,231,.8));
  opacity: calc(.35 + var(--gc, 0) * .65);
  transition: transform .15s ease-out;
}
.ghost-svg { display: block; width: 100%; animation: float 3s ease-in-out infinite; }
html.reduce .ghost-svg { animation: none; }
@keyframes float { 50% { transform: translateY(-10px) rotate(2deg); } }
.ghost-eye { fill: #000; }
.ghost-stage.near .ghost-eye { fill: var(--hot); filter: drop-shadow(0 0 6px var(--hot)); }
.ghost-mouth { fill: #000; opacity: calc(var(--gc, 0) * 1.2); }
.ghost-stage.near .ghost-fig { animation: jitter .12s steps(2) infinite; }
html.reduce .ghost-stage.near .ghost-fig { animation: none; }
@keyframes jitter { 50% { margin-left: 2px; margin-bottom: -1px; } }
.ghost-dist { position: absolute; left: 12px; top: 8px; font-family: var(--pix); font-size: 2.6rem; color: var(--cyan); text-shadow: 0 0 10px var(--cyan); }
.ghost-stage.near .ghost-dist { color: var(--hot); text-shadow: 0 0 14px var(--hot); }
.warn { font-size: .88rem; color: var(--yellow); border-left: 3px solid var(--yellow); padding-left: 10px; }
.slider { display: block; margin: 14px 0; }
.slider > span { display: block; margin-bottom: 4px; }
.slider b { color: var(--yellow); font-weight: normal; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; background: linear-gradient(90deg, var(--hot), var(--purple), var(--cyan)); box-shadow: 0 0 10px rgba(180,0,255,.6); }
input[type=range]::-moz-range-track { height: 6px; background: linear-gradient(90deg, var(--hot), var(--purple), var(--cyan)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; background: #fff; border: 3px solid var(--hot); border-radius: 0; transform: rotate(45deg); box-shadow: 0 0 12px var(--hot); }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; background: #fff; border: 3px solid var(--hot); border-radius: 0; box-shadow: 0 0 12px var(--hot); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-size: .82rem; margin-top: 10px; }
.stats div { display: flex; justify-content: space-between; border-bottom: 1px dotted rgba(0,255,231,.25); padding: 2px 0; color: rgba(217,255,251,.7); }
.stats div > span { color: var(--cyan); }

/* ─────────── footer + reels ─────────── */
.foot { text-align: center; padding: 30px 0 10px; border-top: 1px solid rgba(0,255,231,.25); font-size: .95rem; }
.foot p { margin: 6px 0; }
.counter-line { font-family: var(--pix); font-size: 1.6rem; display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.hash { color: var(--hot); }
.reels { display: inline-flex; gap: 3px; }
.reel { display: inline-block; width: 1.05em; height: 1.35em; overflow: hidden; background: linear-gradient(#111, #2a0038 50%, #111); border: 1px solid var(--yellow); box-shadow: inset 0 0 8px #000, 0 0 8px rgba(255,230,0,.4); position: relative; }
.reel-strip { display: block; transform: translateY(0); will-change: transform; }
.reel-strip i { display: block; height: 1.35em; line-height: 1.35em; text-align: center; font-style: normal; color: var(--yellow); text-shadow: 0 0 6px var(--yellow); }
.reel.sep { width: auto; border: 0; background: none; box-shadow: none; color: var(--yellow); line-height: 1.35em; }
.counter-note { font-size: .75rem; color: rgba(217,255,251,.5); }

/* ─────────── boot intro ─────────── */
#boot { display: none; }
html.booting #boot {
  display: block; position: fixed; inset: 0; z-index: 1000; background: #000; overflow: hidden;
}
.boot-screen { position: absolute; inset: 0; pointer-events: none; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.boot-screen::after { /* scanlines + flicker */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,.04) 0 1px, transparent 1px 3px), radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.85));
  animation: flick .09s steps(2) infinite;
}
@keyframes flick { 50% { opacity: .82; } }
.boot-line { position: absolute; left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px; background: #fff; box-shadow: 0 0 30px #fff, 0 0 60px var(--cyan); transform: scaleX(0); opacity: 0; }
#boot.s1 .boot-line { animation: powerOn .75s cubic-bezier(.7,0,.3,1) forwards; }
@keyframes powerOn {
  0% { transform: scaleX(0) scaleY(1); opacity: 1; }
  45% { transform: scaleX(1) scaleY(1); opacity: 1; }
  100% { transform: scaleX(1) scaleY(400); opacity: 0; }
}
#boot-text {
  position: absolute; left: 4vw; top: 4vh; right: 4vw; bottom: 4vh; margin: 0; overflow: hidden;
  font-family: var(--pix); font-size: clamp(.95rem, 2.2vw, 1.35rem); line-height: 1.15; color: #9fffe9; text-shadow: 0 0 6px rgba(0,255,231,.8);
  white-space: pre-wrap; opacity: 0;
}
#boot.s2 #boot-text { opacity: 1; }
#boot.s3 #boot-text { opacity: .18; filter: blur(1px); transition: opacity .3s, filter .3s; }
#boot-text .ok { color: var(--cyan); } #boot-text .d { color: rgba(159,255,233,.35); } #boot-text .warn2 { color: var(--yellow); } #boot-text .hot { color: var(--hot); }
.boot-logo {
  position: relative; font-family: var(--pix); font-size: clamp(3rem, 12vw, 9rem); color: #fff; letter-spacing: .05em; opacity: 0;
  text-shadow: 0 0 20px rgba(255,255,255,.6);
}
.boot-logo::before, .boot-logo::after { content: attr(data-text); position: absolute; inset: 0; mix-blend-mode: screen; }
.boot-logo::before { color: #f0f; transform: translate(-8px, 2px); animation: rgbA .35s steps(3) infinite; }
.boot-logo::after { color: #0ff; transform: translate(8px, -2px); animation: rgbB .3s steps(3) infinite; }
#boot.s3 .boot-logo { opacity: 1; animation: logoIn .9s steps(8) forwards; }
@keyframes logoIn { 0% { transform: scale(1.6) skewX(20deg); filter: blur(6px); } 40% { transform: scale(.95) skewX(-8deg); filter: blur(0); } 60% { transform: scale(1.02) skewX(4deg); } 100% { transform: none; } }
@keyframes rgbA { 0% { clip-path: inset(0 0 60% 0); transform: translate(-10px, 0); } 33% { clip-path: inset(40% 0 20% 0); transform: translate(6px, 2px); } 66% { clip-path: inset(75% 0 0 0); transform: translate(-4px, -2px); } 100% { clip-path: inset(10% 0 70% 0); transform: translate(-8px, 1px); } }
@keyframes rgbB { 0% { clip-path: inset(50% 0 20% 0); transform: translate(9px, 0); } 33% { clip-path: inset(0 0 75% 0); transform: translate(-6px, 1px); } 66% { clip-path: inset(30% 0 40% 0); transform: translate(5px, -1px); } 100% { clip-path: inset(80% 0 0 0); transform: translate(10px, 2px); } }
.boot-bar { width: min(420px, 70vw); height: 10px; border: 1px solid var(--cyan); margin-top: 26px; opacity: 0; }
.boot-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--hot)); box-shadow: 0 0 12px var(--hot); }
#boot.s3 .boot-bar { opacity: 1; }
#boot.s3 .boot-bar span { transition: width 1.2s cubic-bezier(.6,0,.3,1); width: 100%; }
#boot.off { animation: crtOff .55s cubic-bezier(.7,0,.8,.3) forwards; }
@keyframes crtOff {
  0% { transform: none; filter: brightness(1); }
  40% { transform: scaleY(.008) scaleX(1); filter: brightness(4); }
  100% { transform: scaleY(.004) scaleX(0); filter: brightness(8); opacity: 0; }
}
#boot-skip {
  position: absolute; right: 18px; bottom: 18px; z-index: 5; font-family: var(--pix); font-size: 1.3rem; letter-spacing: 2px;
  background: transparent; color: var(--cyan); border: 1px solid var(--cyan); padding: 6px 16px; cursor: pointer;
}
#boot-skip:hover, #boot-skip:focus-visible { background: var(--cyan); color: #000; }

/* ─────────── CHAOS MODE ─────────── */
#chaos-layer { display: none; position: fixed; inset: 0; z-index: 300; pointer-events: none; }
html.chaos #chaos-layer { display: block; }
#chaos-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.chaos-banner {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%,-50%) rotate(-6deg); white-space: nowrap;
  font-family: var(--pix); font-size: clamp(3rem, 14vw, 11rem); color: var(--yellow);
  text-shadow: -5px 0 var(--hot), 5px 0 var(--cyan), 0 0 40px var(--hot);
  animation: chaosBanner .4s ease-in-out infinite alternate;
}
.chaos-sub { position: absolute; left: 0; right: 0; top: calc(40% + 9vw); text-align: center; font-family: var(--pix); font-size: 1.8rem; color: #fff; text-shadow: 0 0 10px var(--hot); }
@keyframes chaosBanner { to { transform: translate(-50%,-50%) rotate(6deg) scale(1.12); } }
html.chaos .page { animation: chaosFlip 10s ease-in-out both; transform-origin: 50% 30vh; }
html.chaos body { animation: chaosBg .25s steps(1) infinite; }
@keyframes chaosBg { 0% { background: #1a0010; } 33% { background: #001a18; } 66% { background: #140020; } }
@keyframes chaosFlip {
  0% { transform: none; }
  8% { transform: rotate(180deg) scale(.9); }
  16% { transform: rotate(170deg) skewX(10deg) scale(.95); }
  24% { transform: rotate(190deg) skewX(-10deg); }
  32% { transform: rotate(180deg) skewY(6deg) scale(1.05); }
  40% { transform: rotate(360deg) scale(.85); }
  48% { transform: rotate(355deg) skewX(12deg) translateX(20px); }
  56% { transform: rotate(365deg) skewX(-12deg) translateX(-20px); }
  64% { transform: rotate(360deg) scale(1.1) skewY(-5deg); }
  72% { transform: rotate(350deg) scale(.95); }
  80% { transform: rotate(370deg) skewX(8deg); }
  90% { transform: rotate(360deg) scale(1.02); }
  100% { transform: rotate(360deg); }
}
html.chaos.reduce .page, html.chaos.reduce body, html.chaos.reduce .chaos-banner { animation: none; }

/* ─────────── matrix ─────────── */
#matrix { display: none; position: fixed; inset: 0; width: 100%; height: 100%; z-index: 280; pointer-events: none; }
#matrix.on { display: block; }

/* ─────────── terminal ─────────── */
#terminal {
  position: fixed; left: 50%; top: 0; z-index: 400; width: min(760px, 96vw); height: min(60vh, 460px);
  transform: translate(-50%, -105%); transition: transform .35s cubic-bezier(.3,1.4,.5,1);
  background: rgba(2,0,6,.95); border: 2px solid var(--cyan); border-top: 0;
  box-shadow: 0 0 40px rgba(0,255,231,.4), 0 30px 80px rgba(0,0,0,.8);
  display: flex; flex-direction: column; font-size: .95rem;
  visibility: hidden;
}
#terminal.open { transform: translate(-50%, 0); visibility: visible; }
html.reduce #terminal { transition: none; }
#term-out { flex: 1; overflow-y: auto; padding: 10px 14px; white-space: pre-wrap; word-break: break-word; color: #b8fff5; line-height: 1.45; }
#term-out .c { color: var(--hot); } #term-out .y { color: var(--yellow); } #term-out .d { color: rgba(217,255,251,.5); }
#term-form { display: flex; gap: 8px; padding: 8px 14px; border-top: 1px solid rgba(0,255,231,.3); align-items: center; }
#term-out .kv { display: flex; gap: 1ch; } #term-out .kv span:first-child { flex: 0 0 15em; color: var(--cyan); padding-left: 2ch; }
@media (max-width: 560px) { #term-out .kv span:first-child { flex-basis: 9.5em; } }
#term-in { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--cyan); font-family: var(--mono); font-size: 1rem; caret-color: var(--hot); }

/* ─────────── responsive ─────────── */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .page { padding: 0 14px 130px; }
  header.top { justify-content: center; text-align: center; }
  nav { justify-content: center; }
  nav a { font-size: 1.2rem; padding: 2px 7px; }
  .panel { padding: 22px 18px 18px; }
  .ghost-grid { grid-template-columns: minmax(0, 1fr); }
  .ghost-stage { min-height: 280px; }
  .stats { grid-template-columns: 1fr; }
  #viz-canvas { height: 240px; }
  .cards { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .card { height: 140px; }
  .dock { left: 10px; right: 10px; bottom: 10px; justify-content: center; }
  .dock { flex-wrap: nowrap; gap: 6px; }
  .dock-btn { font-size: 1.05rem; padding: 4px 8px; }
  .dock .long { display: none; }
  .marquee { margin: 0 -14px 44px; }
  .marquee-track { font-size: 1.3rem; }
}
@media (hover: none) { .card .shine { opacity: 0; } }
