:root {
  /* Typography compliance tokens: Space Mono** from Google Fonts */
  --carbon: #050505;
  --paper: #F7F7F2;
  --phosphor: #B9B9AE;
  --graphite: #1D1D1A;
  --fog: #E1E0D6;
  --ink: #0B0B0A;
  --display: "Black Han Sans", "Arial Black", system-ui, sans-serif;
  --kr: "Noto Sans KR", system-ui, sans-serif;
  --mono: "Space Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --pen: "Nanum Pen Script", cursive;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--carbon);
}

body {
  margin: 0;
  color: var(--paper);
  background: var(--carbon);
  font-family: var(--kr);
  cursor: none;
  overflow-x: hidden;
}

a, button { cursor: none; }

.crt-shell {
  position: relative;
  min-height: 100vh;
  background:
    radial-gradient(circle at 65% 16%, rgba(225,224,214,.18), transparent 24rem),
    linear-gradient(180deg, var(--ink), var(--carbon) 38%, #050505);
  isolation: isolate;
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  background: repeating-linear-gradient(180deg, rgba(247,247,242,.055) 0 1px, transparent 1px 5px);
  mix-blend-mode: screen;
  opacity: .42;
}

.scanlines::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 46%, rgba(5,5,5,.72) 100%);
}

.cursor-reticle {
  position: fixed;
  left: 0;
  top: 0;
  width: 54px;
  height: 54px;
  border: 1px solid var(--fog);
  border-radius: 50%;
  pointer-events: none;
  z-index: 50;
  transform: translate3d(-50%, -50%, 0);
  box-shadow: 0 0 18px rgba(225,224,214,.22), inset 0 0 18px rgba(225,224,214,.08);
  mix-blend-mode: difference;
}

.cursor-reticle::before,
.cursor-reticle::after {
  content: "";
  position: absolute;
  background: var(--fog);
  opacity: .7;
}

.cursor-reticle::before { width: 74px; height: 1px; left: -10px; top: 26px; }
.cursor-reticle::after { width: 1px; height: 74px; left: 26px; top: -10px; }
.cursor-reticle span { position: absolute; inset: 19px; border: 1px dashed var(--paper); border-radius: 50%; }

.hardware-nav {
  position: fixed;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  width: 112px;
  padding: 12px 10px;
  border: 1px solid var(--phosphor);
  background: rgba(29,29,26,.78);
  box-shadow: inset 0 0 0 4px var(--ink), 0 20px 60px rgba(0,0,0,.5);
  z-index: 20;
  backdrop-filter: blur(4px);
}

.nav-title {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .16em;
  color: var(--fog);
  margin-bottom: 14px;
}

.chapter-dot {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 7px;
  color: var(--phosphor);
  text-decoration: none;
  margin: 9px 0;
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
}

.chapter-dot b {
  display: grid;
  place-items: center;
  height: 30px;
  border: 1px solid var(--phosphor);
  background: var(--carbon);
  color: var(--paper);
  font-family: var(--display);
  font-size: 15px;
  transition: transform .35s ease, background .35s ease, color .35s ease;
}

.chapter-dot.active b,
.chapter-dot:hover b {
  transform: translateX(6px) rotate(-4deg);
  background: var(--paper);
  color: var(--carbon);
}

.trail-progress {
  position: absolute;
  right: -10px;
  top: 12px;
  bottom: 12px;
  width: 2px;
  background: rgba(185,185,174,.24);
}

.trail-progress i {
  display: block;
  width: 100%;
  height: 0;
  background: var(--paper);
  box-shadow: 0 0 10px var(--fog);
}

.scene {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 9vh 8vw 9vh 170px;
  border-bottom: 1px solid rgba(185,185,174,.18);
}

.scene::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(225,224,214,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(225,224,214,.035) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 55% 50%, black, transparent 72%);
  pointer-events: none;
}

.scene-copy {
  position: relative;
  z-index: 4;
  max-width: 760px;
  mix-blend-mode: normal;
}

.scene-copy.offset-right { margin-left: auto; max-width: 630px; }
.scene-copy.offset-left { margin-right: auto; max-width: 610px; }
.scene-copy.narrow { max-width: 560px; align-self: flex-end; margin-bottom: 7vh; }
.final-copy { margin: 0 auto; text-align: center; max-width: 780px; }

.coordinate,
.code-readout,
.assembly-label {
  font-family: var(--mono);
  color: var(--phosphor);
  letter-spacing: .15em;
  text-transform: uppercase;
  font-size: 12px;
}

h1, h2 {
  margin: 0;
  color: var(--paper);
  font-family: var(--display);
  font-weight: 400;
  line-height: .84;
  letter-spacing: -.045em;
  text-wrap: balance;
}

h1 { font-size: clamp(64px, 10.8vw, 168px); max-width: 1100px; }
h2 { font-size: clamp(58px, 9vw, 138px); }

.scene-copy p:not(.coordinate) {
  max-width: 610px;
  color: var(--fog);
  font-size: clamp(18px, 2vw, 25px);
  line-height: 1.48;
  margin: 26px 0 0;
}

.guide-note {
  display: inline-block;
  margin-top: 28px;
  color: var(--paper);
  font-family: var(--pen);
  font-size: clamp(28px, 4vw, 48px);
  transform: rotate(-3deg);
  text-shadow: 0 0 12px rgba(247,247,242,.18);
}

.guide-note.bright { color: var(--fog); }

.giant-glyph {
  position: absolute;
  z-index: 1;
  font-family: var(--display);
  font-size: clamp(260px, 52vw, 840px);
  line-height: .75;
  color: rgba(247,247,242,.105);
  letter-spacing: -.12em;
  user-select: none;
  transition: transform .9s cubic-bezier(.2,.8,.2,1), color .9s ease;
}

.scene.in-view .giant-glyph { transform: translate3d(var(--lock-x, 0), var(--lock-y, 0), 0) rotate(var(--lock-r, 0deg)); color: rgba(247,247,242,.16); }
.glyph-left { left: -7vw; bottom: -8vh; --lock-x: 2vw; --lock-y: -1vh; --lock-r: -2deg; }
.glyph-right { right: -8vw; top: 6vh; --lock-x: -2vw; --lock-y: 2vh; --lock-r: 2deg; }
.glyph-center { left: 50%; top: 49%; transform: translate(-50%, -50%); font-size: clamp(220px, 44vw, 720px); color: rgba(247,247,242,.08); }
.scene.in-view .glyph-center { transform: translate(-50%, -50%) scale(1.035); }
.outline { color: transparent; -webkit-text-stroke: 2px rgba(247,247,242,.22); }
.small-crop { font-family: var(--mono); font-weight: 700; font-size: clamp(140px, 28vw, 420px); letter-spacing: -.08em; }

.parallax { position: absolute; pointer-events: none; will-change: transform; }
.ridge-line {
  left: -10vw;
  bottom: 4vh;
  width: 130vw;
  color: var(--graphite);
  font-family: var(--display);
  font-size: 19vw;
  letter-spacing: -.18em;
  opacity: .95;
}
.ridge-line.soft { opacity: .35; top: 0; bottom: auto; }

.grid-field {
  inset: 15vh 4vw auto 26vw;
  height: 52vh;
  border: 1px solid rgba(225,224,214,.16);
  background:
    repeating-linear-gradient(90deg, rgba(247,247,242,.08) 0 1px, transparent 1px 42px),
    repeating-linear-gradient(180deg, rgba(247,247,242,.07) 0 1px, transparent 1px 42px);
  transform: skewY(-8deg) rotate(-3deg);
  opacity: .36;
}
.grid-field.diagonal { inset: 20vh 18vw auto 8vw; transform: rotate(13deg) skewX(-8deg); }
.terminal-grid { inset: 8vh 3vw 8vh auto; width: 58vw; height: auto; transform: perspective(700px) rotateY(-26deg) rotateX(8deg); opacity: .28; }
.pale-clouds { top: 12vh; left: 24vw; color: rgba(225,224,214,.32); font-family: var(--mono); font-size: 5vw; letter-spacing: .5em; }

.mountain {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 34vh;
  background: var(--graphite);
  clip-path: polygon(0 72%, 9% 48%, 16% 62%, 27% 28%, 37% 58%, 45% 34%, 54% 66%, 66% 26%, 76% 57%, 85% 42%, 100% 70%, 100% 100%, 0 100%);
}
.mountain-a { opacity: .88; }
.mountain-b { clip-path: polygon(0 58%, 12% 36%, 22% 54%, 32% 30%, 44% 50%, 57% 20%, 68% 53%, 80% 32%, 100% 62%, 100% 100%, 0 100%); opacity: .74; }
.mountain-c { background: var(--ink); opacity: .92; height: 28vh; }

.icon-constellation {
  position: absolute;
  z-index: 8;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.top-right { top: 12vh; right: 7vw; width: 230px; }
.lower-left { left: 180px; bottom: 18vh; width: 260px; }
.orbit-ring { right: 12vw; top: 17vh; width: 240px; height: 240px; border: 1px dashed rgba(225,224,214,.32); border-radius: 50%; align-content: space-between; justify-content: center; padding: 34px; animation: slowSpin 24s linear infinite; }
.tool-belt { right: 8vw; bottom: 16vh; width: 300px; }
.sky-tools { left: 50%; bottom: 12vh; transform: translateX(-50%); }

.trail-icon {
  width: 58px;
  height: 58px;
  border: 1px solid var(--phosphor);
  background: rgba(5,5,5,.78);
  color: var(--paper);
  font-family: var(--display);
  font-size: 25px;
  box-shadow: inset 0 0 0 4px rgba(29,29,26,.8), 0 0 20px rgba(225,224,214,.06);
  transition: transform .24s ease, background .24s ease, color .24s ease, border-color .24s ease;
}
.trail-icon:hover,
.trail-icon.magnetized {
  background: var(--paper);
  color: var(--carbon);
  border-color: var(--paper);
}
.trail-icon::after {
  content: attr(data-piece);
  position: absolute;
  margin: 38px 0 0 -8px;
  color: var(--phosphor);
  font: 10px var(--mono);
  opacity: .75;
}

.assembly-panel {
  position: absolute;
  z-index: 7;
  left: 12vw;
  top: 18vh;
  width: 360px;
  min-height: 210px;
  padding: 18px;
  border: 1px solid var(--fog);
  background: rgba(11,11,10,.74);
  box-shadow: inset 0 0 0 6px rgba(29,29,26,.8);
}
.assembly-panel span,
.assembly-panel strong {
  display: inline-grid;
  place-items: center;
  width: 70px;
  height: 70px;
  margin: 24px 4px 0;
  border: 1px solid var(--phosphor);
  font-family: var(--display);
  font-size: 42px;
}
.assembly-panel strong {
  width: 92px;
  height: 92px;
  background: var(--paper);
  color: var(--carbon);
  vertical-align: middle;
  transition: transform .35s ease;
}
.assembly-panel.assembled strong { transform: scale(1.12) rotate(2deg); }

.block-diagram {
  position: absolute;
  right: 10vw;
  bottom: 15vh;
  z-index: 6;
  display: grid;
  grid-template-columns: repeat(2, 110px);
  grid-template-rows: repeat(2, 110px);
  border: 1px solid var(--fog);
  background: rgba(29,29,26,.6);
}
.cell {
  display: grid;
  place-items: center;
  border: 1px solid rgba(225,224,214,.45);
  font-family: var(--display);
  font-size: 62px;
  color: var(--paper);
}
.cell.result { grid-column: 1 / 3; background: var(--paper); color: var(--carbon); font-size: 82px; }

.code-readout {
  display: inline-block;
  margin-top: 26px;
  padding: 13px 16px;
  border: 1px solid var(--phosphor);
  background: var(--ink);
  color: var(--fog);
  text-transform: none;
  letter-spacing: 0;
}

.terminal-window {
  position: absolute;
  right: 8vw;
  top: 18vh;
  z-index: 5;
  width: min(520px, 42vw);
  border: 1px solid var(--fog);
  background: rgba(5,5,5,.88);
  box-shadow: 24px 24px 0 var(--graphite), inset 0 0 38px rgba(225,224,214,.05);
}
.terminal-top { padding: 12px 14px; border-bottom: 1px solid var(--phosphor); font: 12px var(--mono); color: var(--phosphor); }
.terminal-top span { display: inline-block; width: 9px; height: 9px; margin-right: 7px; border: 1px solid var(--fog); }
pre { margin: 0; padding: 24px; white-space: pre-wrap; color: var(--paper); font: clamp(14px, 1.4vw, 18px)/1.7 var(--mono); }

.night-sky {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.night-sky span {
  position: absolute;
  font-family: var(--display);
  color: rgba(247,247,242,.2);
  text-shadow: 0 0 20px rgba(225,224,214,.18);
}
.night-sky span:nth-child(1) { left: 10%; top: 18%; font-size: 56px; }
.night-sky span:nth-child(2) { left: 82%; top: 13%; font-size: 44px; }
.night-sky span:nth-child(3) { left: 28%; top: 72%; font-size: 74px; }
.night-sky span:nth-child(4) { left: 68%; top: 66%; font-size: 92px; }
.night-sky span:nth-child(5) { left: 48%; top: 21%; font-size: 38px; }
.night-sky span:nth-child(6) { left: 17%; top: 47%; font-size: 42px; }
.night-sky span:nth-child(7) { left: 76%; top: 46%; font-size: 52px; }

.observatory-dome {
  position: absolute;
  left: 50%;
  bottom: -15vw;
  transform: translateX(-50%);
  z-index: 0;
  font-family: var(--display);
  font-size: 48vw;
  color: transparent;
  -webkit-text-stroke: 2px rgba(247,247,242,.18);
}

.chalk-dot {
  position: fixed;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--fog);
  pointer-events: none;
  z-index: 45;
  opacity: .45;
  animation: fadeChalk 900ms ease forwards;
}

@keyframes slowSpin {
  to { transform: rotate(360deg); }
}

@keyframes fadeChalk {
  to { transform: scale(2.4); opacity: 0; }
}

@media (max-width: 820px) {
  body { cursor: auto; }
  a, button { cursor: pointer; }
  .cursor-reticle { display: none; }
  .hardware-nav { left: 10px; width: 86px; }
  .chapter-dot { grid-template-columns: 26px; }
  .chapter-dot span { display: none; }
  .scene { padding-left: 112px; padding-right: 22px; }
  .terminal-window, .assembly-panel, .block-diagram { position: relative; inset: auto; width: 100%; margin: 30px 0; }
  .scene { display: block; padding-top: 14vh; }
  .icon-constellation { opacity: .8; transform: scale(.86); }
  .top-right, .lower-left, .tool-belt { right: 18px; left: auto; bottom: 8vh; top: auto; }
}
