:root {
  color-scheme: dark;
  --ink: #08090e;
  --ivory: #f5efe8;
  --quiet: rgba(245,239,232,.66);
  --gold: #e8b983;
  --gold-dim: rgba(232,185,131,.42);
  --mono: 'JetBrains Mono', Consolas, 'Courier New', monospace;
  --serif: 'Noto Serif KR', 'Batang', 'AppleMyungjo', Georgia, serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ivory);
  background: var(--ink);
  font-family: var(--serif);
  overflow-x: hidden;
  min-width: 320px;
}
body.has-custom-cursor, body.has-custom-cursor a, body.has-custom-cursor button { cursor: none; }
::selection { background: #d8ac7b; color: #11121a; }
a { color: inherit; }
button { font-family: inherit; }
button:focus-visible, a:focus-visible { outline: 2px solid #fce0ad; outline-offset: 7px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.ambient-fallback, #gl, #fx, .grain, .vignette, .flash {
  position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none;
}
.ambient-fallback {
  z-index: 0;
  background: radial-gradient(ellipse 66% 85% at 54% 50%, #272037 0%, #141726 34%, #07090e 84%);
}
#gl { z-index: 1; display: block; }
#fx { z-index: 3; display: block; }
.grain {
  z-index: 4; opacity: .095; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.72' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.vignette {
  z-index: 5;
  background: radial-gradient(ellipse 74% 69% at center, transparent 40%, rgba(1,3,10,.66) 100%);
}
.flash { z-index: 35; background: #fff6e8; opacity: 0; }
.flash.active { animation: flash-reveal 1.15s ease-out both; }
@keyframes flash-reveal { 0% {opacity:0} 10% {opacity:.7} 18% {opacity:.48} 100% {opacity:0} }

.hud {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 20; display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 79px; padding: 18px clamp(23px,4vw,74px);
  border-bottom: 1px solid rgba(238,220,199,.08);
  font: 400 10px/1.5 var(--mono); letter-spacing: .18em;
  color: rgba(255,247,233,.78);
  background: linear-gradient(to bottom,rgba(7,9,15,.55),transparent);
}
.logo { justify-self: start; text-decoration: none; font-weight: 500; font-size: 11px; letter-spacing: .22em; white-space: nowrap; }
.logo-sep { display: inline-block; margin: 0 8px; color: var(--gold); }
.signal { color: rgba(246,232,210,.67); letter-spacing: .16em; white-space: nowrap; }
.signal-symbol { color: var(--gold); margin-right: 9px; font-size: 14px; vertical-align: -1px; }
#signal { font-size: 14px; color: #f9d8b2; letter-spacing: .03em; font-variant-numeric: tabular-nums; }
.percentage { color: var(--gold-dim); }
.hud-right { display: flex; justify-content: flex-end; align-items: center; gap: 20px; }
.sound-btn {
  background: rgba(10,12,20,.28); border: 1px solid rgba(232,185,131,.42);
  color: #f4d1a4; padding: 8px 12px; border-radius: 3px;
  font: 10px var(--mono); letter-spacing: .2em; transition: background .25s, border-color .25s;
}
.sound-btn:hover { background: rgba(232,185,131,.14); border-color: #f4d1a4; }
.sound-btn:disabled { opacity: .5; cursor: not-allowed; }
#clock { color: rgba(246,232,210,.55); font-variant-numeric: tabular-nums; }
.rail {
  position: fixed; top: 50%; right: clamp(16px,3.1vw,60px); transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 13px;
  z-index: 18; font: 10px var(--mono); color: rgba(234,199,160,.5); letter-spacing: .12em;
}
.rail-track { width: 1px; height: min(24vh,200px); background: rgba(255,242,221,.17); position: relative; overflow: hidden; }
.rail-fill { position: absolute; top: 0; left: 0; height: 0%; width: 100%; background: linear-gradient(#e6ab71,#fff1d4); box-shadow: 0 0 8px #f2c28b; }

main { position: relative; z-index: 8; }
.scene { min-height: 100vh; min-height: 100svh; position: relative; display: flex; align-items: center; padding: 14vh clamp(30px,9vw,180px); }
.scene-shell { position: relative; width: 100%; max-width: 1600px; margin: 0 auto; }
.content { position: relative; max-width: 900px; }
.content.right { margin-left: auto; text-align: right; }
.content.center { margin-inline: auto; text-align: center; }
.content.left { margin-right: auto; text-align: left; }
html.js .scene:not(.is-visible) .content { opacity: 0; transform: translate3d(0,calc(var(--float-y, 0px) + 45px),0); }
.scene .content { opacity: 1; transform: translate3d(0,var(--float-y, 0px),0); transition: opacity 1.2s ease, transform 1.4s cubic-bezier(.19,1,.22,1); }

.label { display: flex; justify-content: flex-start; align-items: center; gap: 12px; margin: 0 0 clamp(30px,4.8vh,60px); font: 400 clamp(9px,.77vw,11px)/1.7 var(--mono); letter-spacing: .21em; color: #d8b28b; white-space: nowrap; }
.right .label { justify-content: flex-end; }
.center .label { justify-content: center; }
.number { font-size: 14px; color: #fff1da; }
.label-line { width: 27px; height: 1px; background: rgba(241,197,146,.64); }
h1, h2 { font-family: var(--serif); font-size: clamp(2.6rem,5vw,6rem); font-weight: 400; line-height: 1.42; letter-spacing: -.075em; word-break: keep-all; margin: 0; text-wrap: balance; text-shadow: 0 3px 28px rgba(3,5,13,.34); }
 .outro h2, .final h2 { text-shadow: 0 2px 22px rgba(5,6,10,.83), 0 1px 5px rgba(3,5,10,.95); }
h1 em, h2 em { font-style: normal; color: #f5c998; }
.huge { font-size: clamp(2.9rem,6.4vw,8rem); }
.body { margin: clamp(22px,4.5vh,60px) 0 0; font-size: clamp(13px,1.12vw,17px); font-weight: 300; line-height: 2.3; color: var(--quiet); letter-spacing: -.04em; word-break: keep-all; }
.body.short { max-width: 520px; }
.right .body { margin-left: auto; }
.micro { font: 10px/1.9 var(--mono); letter-spacing: .04em; color: rgba(244,218,184,.48); margin: 28px 0 0; }
.first h1 { font-size: clamp(2.9rem,5.5vw,6.75rem); }
.first .scene-shell { padding-top: 10vh; }
.edge-caption { position: absolute; top: calc(100% + 7vh); left: 0; margin: 0; font: 9px var(--mono); letter-spacing: .21em; color: rgba(248,231,209,.44); }
.scroll-mark { margin-left: 12px; font-size: 16px; display: inline-block; animation: nudge-down 2.2s ease-in-out infinite; }
@keyframes nudge-down { 50% { transform: translateY(8px); opacity: .5; } }
.start-link, .restart-link {
  display: inline-flex; align-items: center; gap: 28px; margin-top: 44px;
  font: 11px var(--mono); letter-spacing: .14em; text-decoration: none;
  border-bottom: 1px solid rgba(232,185,131,.68); padding-bottom: 14px;
  transition: border-color .3s, gap .3s;
}
.start-link:hover, .restart-link:hover { gap: 36px; border-color: #fff; }
.start-link span, .restart-link span { font-size: 19px; color: var(--gold); }
.fracture-scene .content { max-width: 960px; }
.fracture-button { margin: 33px auto 0; display: inline-flex; align-items: center; gap: 20px; border: 1px solid rgba(255,202,137,.6); background: rgba(12,12,20,.56); backdrop-filter: blur(8px); border-radius: 2px; padding: 16px 24px; color: #ffe5c1; font: 400 12px var(--mono); letter-spacing: .04em; box-shadow: 0 0 35px rgba(241,152,79,.05); transition: background .25s, box-shadow .25s, transform .25s; }
.fracture-button:hover { background: rgba(184,112,61,.24); box-shadow: 0 0 45px rgba(235,164,90,.15); transform: translateY(-2px); }
.button-mark { font-size: 18px; }
.button-arrow { font-size: 15px; color: var(--gold); }
.impact-note { color: #f6ca98; font: 10px var(--mono); min-height: 15px; letter-spacing: .06em; margin-top: 20px; }
.final .content { max-width: 1100px; }
.arrival-symbol { display: block; margin-top: 50px; font-size: 44px; color: #f0cb9c; text-shadow: 0 0 25px rgba(247,168,83,.7); animation: starbreath 5s ease-in-out infinite; }
@keyframes starbreath { 50% { opacity:.55; transform: rotate(45deg) scale(.82); } }
.outro .content { max-width: 1000px; }
.outro { min-height: 108vh; min-height: 108svh; }
.outro .signature { margin-top: clamp(65px,12vh,160px); font: 9px/2 var(--mono); letter-spacing: .16em; color: rgba(248,221,184,.45); }
.signature-star { margin: 0 12px; color: #e3b780; }

.cursor-dot, .cursor-ring { display: none; position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none; border-radius: 50%; transform: translate3d(-100px,-100px,0); mix-blend-mode: screen; }
body.has-custom-cursor .cursor-dot, body.has-custom-cursor .cursor-ring { display: block; }
.cursor-dot { width: 6px; height: 6px; background: #fff2dc; box-shadow: 0 0 15px rgba(255,202,134,.7); }
.cursor-ring { width: 32px; height: 32px; border: 1px solid rgba(255,227,193,.65); background: rgba(238,161,78,.045); transition: width .25s, height .25s, border-color .25s; }
.cursor-ring.pulse { width: 56px; height: 56px; border-color: #ffd69b; }
body.broken { animation: inversion 1s ease-out; }
@keyframes inversion { 0%,100% {filter:invert(0);} 47% {filter:invert(1) hue-rotate(180deg);} }
@media(max-width:900px) {
  .hud { grid-template-columns: 1fr auto; min-height: 68px; padding: 14px 20px; }
  .hud .signal { display: none; }
  .scene { padding-inline: 8vw; }
  .rail { right: 12px; opacity: .75; }
  .label { white-space: normal; gap: 8px; }
  .body { line-height: 2; }
}
@media(max-width:620px) {
  .hud { padding-inline: 17px; }
  .logo { font-size: 9px; letter-spacing: .12em; }
  .logo-sep { margin: 0 4px; }
  .hud-right { gap: 8px; }
  #clock { display: none; }
  .sound-btn { font-size: 9px; }
  .scene { padding: 15vh 8vw; min-height: 100svh; }
  .scene .scene-shell { width: 100%; }
  .content.right, .content.left { text-align: left; margin-left: 0; }
  .right .label { justify-content: flex-start; }
  .right .body { margin-left: 0; }
  .label { font-size: 9px; letter-spacing: .06em; }
  .label-line { width: 16px; }
  h1,h2 { line-height: 1.5; letter-spacing: -.08em; font-size: clamp(2.15rem,8vw,3.5rem); }
  .huge { font-size: clamp(2.3rem,9vw,4rem); }
  .first h1 { font-size: clamp(2.45rem,9.2vw,4rem); }
  .body { font-size: 13px; }
  .edge-caption { font-size: 8px; top: calc(100% + 5vh); }
  .fracture-button { font-size: 11px; padding: 15px 16px; gap: 11px; }
  .outro .signature { font-size: 8px; line-height: 2.3; }
  .rail { display: none; }
}
@media(prefers-reduced-motion:reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
