:root {
  --night: #0B0D12;
  --fire: #FF5A1F;
  --flame: #FFB238;
  --red: #D7261E;
  --hivis: #E6FF3D;
  --blue: #2F7BFF;
  --text: #F4F1EC;
  --muted: rgba(244, 241, 236, 0.68);
  --glass: rgba(18, 20, 28, 0.55);
  --glass-line: rgba(255, 178, 56, 0.22);
  --display: "Black Han Sans", "Noto Sans KR", sans-serif;
  --body: "Noto Sans KR", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--night); }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
body {
  background: var(--night);
  color: var(--text);
  font-family: var(--body);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.has-cursor, body.has-cursor * { cursor: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; }
kbd {
  display: inline-block;
  min-width: 1.7em;
  padding: 0.05em 0.45em;
  margin: 0 0.12em;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-bottom-width: 3px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.78em;
  text-align: center;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}
.mono { font-family: var(--mono); }

/* ---------- 레이어 ---------- */
#webgl { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; }
#cursor-fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 40; pointer-events: none; }
.vignette {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, 0.7) 100%);
}
.grain {
  position: fixed; inset: -50%; z-index: 2; pointer-events: none; opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.6s steps(4) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 25% { transform: translate(-3%, 2%); }
  50% { transform: translate(2%, -3%); } 75% { transform: translate(-1%, 3%); }
}

/* ---------- 커서 ---------- */
#cursor {
  position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none;
  width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border: 1.5px solid var(--flame); border-radius: 50%;
  transition: width .25s, height .25s, margin .25s, background .25s, border-color .25s;
  display: none;
}
#cursor span { position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; margin: -2.5px; border-radius: 50%; background: var(--fire); }
body.has-cursor #cursor { display: block; }
#cursor.hover { width: 64px; height: 64px; margin: -32px 0 0 -32px; background: rgba(255, 90, 31, 0.15); border-color: var(--fire); }
#cursor.spray { border-color: #7fd3ff; background: rgba(80, 180, 255, 0.15); }

/* ---------- 로딩 ---------- */
#loader {
  position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 18px;
  background: var(--night); transition: opacity .8s ease, visibility .8s;
}
#loader.done { opacity: 0; visibility: hidden; }
.loader-flame { width: 64px; height: 80px; animation: flick 0.35s ease-in-out infinite alternate; transform-origin: 50% 100%; filter: drop-shadow(0 0 18px rgba(255, 90, 31, .7)); }
@keyframes flick { from { transform: scale(1, 1) skewX(-2deg); } to { transform: scale(1.06, 0.94) skewX(3deg); } }
.loader-text { font-family: var(--display); font-size: 20px; letter-spacing: .05em; }
.loader-bar { width: 220px; height: 3px; background: rgba(255, 255, 255, .1); border-radius: 3px; overflow: hidden; }
.loader-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--red), var(--fire), var(--flame)); }

/* ---------- 진행 바 ---------- */
#progress { position: fixed; top: 0; left: 0; right: 0; height: 4px; z-index: 50; background: rgba(255, 255, 255, .06); }
#progress-fill {
  position: relative; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--red), var(--fire), var(--flame));
  box-shadow: 0 0 12px var(--fire);
}
.progress-tip { position: absolute; right: -8px; top: -5px; width: 14px; height: 18px; filter: drop-shadow(0 0 6px var(--fire)); animation: flick .3s infinite alternate; transform-origin: 50% 100%; }

/* ---------- 브랜드 ---------- */
.brand { position: fixed; top: 22px; left: 28px; z-index: 30; display: flex; align-items: center; gap: 10px; pointer-events: none; }
.brand-mark { font-family: var(--display); background: var(--red); padding: 2px 8px; border-radius: 4px; font-size: 16px; box-shadow: 0 0 16px rgba(215, 38, 30, .6); }
.brand-name { font-family: var(--display); letter-spacing: .18em; font-size: 14px; }

/* ---------- 내비 ---------- */
#scene-nav { position: fixed; right: 26px; top: 50%; transform: translateY(-50%); z-index: 30; display: flex; flex-direction: column; gap: 16px; }
#scene-nav button { position: relative; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .45); transition: all .3s; }
#scene-nav button span {
  position: absolute; right: 22px; top: 50%; transform: translate(6px, -50%); white-space: nowrap;
  font-size: 12px; opacity: 0; transition: all .3s; pointer-events: none; color: var(--muted);
}
#scene-nav button:hover span, #scene-nav button:focus-visible span, #scene-nav button.active span { opacity: 1; transform: translate(0, -50%); }
#scene-nav button.active { background: var(--fire); border-color: var(--fire); box-shadow: 0 0 12px var(--fire); transform: scale(1.3); }
#scene-nav button.active span { color: var(--text); }
#scene-nav button:focus-visible { outline: 2px solid var(--hivis); outline-offset: 3px; }

/* ---------- HUD ---------- */
#hud {
  position: fixed; left: 24px; bottom: 24px; z-index: 30; padding: 12px 14px; border-radius: 12px;
  background: var(--glass); border: 1px solid var(--glass-line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: 12px; color: var(--muted); max-width: 280px; transition: box-shadow .4s, transform .4s;
}
#hud.intro { box-shadow: 0 0 0 2px var(--flame), 0 0 30px rgba(255, 178, 56, .5); transform: scale(1.04); }
.hud-context { color: var(--flame); font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.hud-keys { list-style: none; display: grid; gap: 4px; }

#sound-toggle {
  position: fixed; right: 24px; bottom: 24px; z-index: 30; display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 999px; background: var(--glass); border: 1px solid var(--glass-line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-size: 13px; cursor: pointer;
}
#sound-toggle svg { width: 20px; height: 20px; fill: none; stroke: var(--text); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#sound-toggle .spk { fill: var(--text); }
#sound-toggle .on { display: none; }
#sound-toggle[aria-pressed="true"] .on { display: inline; }
#sound-toggle[aria-pressed="true"] .off { display: none; }
#sound-toggle[aria-pressed="true"] { border-color: var(--flame); box-shadow: 0 0 16px rgba(255, 178, 56, .35); }
#sound-toggle:focus-visible { outline: 2px solid var(--hivis); outline-offset: 3px; }

/* ---------- 섹션 ---------- */
#content { position: relative; z-index: 10; }
.scene { height: var(--h); position: relative; }
.scene.last { height: auto; min-height: 100vh; }
.inner {
  position: sticky; top: 0; min-height: 100vh; padding: 110px 8vw 120px;
  display: flex; flex-direction: column; justify-content: center; gap: 18px;
  pointer-events: none;
}
.scene.last .inner { position: relative; }
.inner > * { pointer-events: auto; max-width: 520px; }
.inner.center { align-items: center; text-align: center; }
.inner.center > * { max-width: 900px; }
.inner.right { align-items: flex-end; }
.hero-inner > * { max-width: 760px; }
.hero-inner .scroll-cue { align-items: flex-start; }
.inner.right > * { width: min(460px, 100%); }

.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: .28em; color: var(--flame); text-transform: uppercase; }
h1, h2 { font-family: var(--display); font-weight: 400; line-height: 1.05; text-shadow: 0 4px 40px rgba(0, 0, 0, .6); }
.hero-title { font-size: clamp(48px, 9vw, 128px); }
.hero-title em { font-style: normal; filter: drop-shadow(0 0 24px rgba(255, 90, 31, .45)); }
.hero-title em .char { background: linear-gradient(180deg, var(--flame), var(--fire) 60%, var(--red)); -webkit-background-clip: text; background-clip: text; color: transparent; }
h2 { font-size: clamp(44px, 7vw, 96px); }
.lead { font-size: clamp(15px, 1.4vw, 18px); color: var(--muted); text-shadow: 0 2px 12px rgba(0, 0, 0, .8); }
.lead b { color: var(--text); }
.tip { font-size: 14px; color: var(--muted); }
.char { display: inline-block; will-change: transform; }

.scroll-cue { margin-top: 28px; display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.mouse { width: 24px; height: 38px; border: 2px solid rgba(255, 255, 255, .6); border-radius: 14px; position: relative; }
.mouse i { position: absolute; left: 50%; top: 7px; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px; background: var(--flame); animation: wheel 1.6s infinite; }
@keyframes wheel { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(12px); } }

.big-stat { display: flex; align-items: flex-end; gap: 10px; }
.big-stat b { font-size: 96px; line-height: .9; color: var(--flame); text-shadow: 0 0 30px rgba(255, 178, 56, .5); }
.big-stat span { font-family: var(--display); font-size: 32px; display: flex; flex-direction: column; }
.big-stat small { font-family: var(--body); font-size: 12px; color: var(--muted); }

.steps { list-style: none; display: grid; gap: 10px; counter-reset: s; }
.steps li {
  counter-increment: s; display: grid; grid-template-columns: 42px 1fr; grid-template-rows: auto auto; column-gap: 12px;
  padding: 14px 16px; border-radius: 14px; background: var(--glass); border: 1px solid var(--glass-line); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.steps li::before { content: "0" counter(s); grid-row: span 2; font-family: var(--mono); font-size: 22px; color: var(--fire); align-self: center; }
.steps li b { font-size: 16px; }
.steps li span { font-size: 13px; color: var(--muted); }

.fire-meter { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.meter { height: 8px; border-radius: 8px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.meter i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--flame), var(--fire), var(--red)); transition: width .2s; }
.fire-meter b { color: var(--flame); min-width: 48px; text-align: right; }

.gear-card { padding: 22px 24px; border-radius: 18px; background: var(--glass); border: 1px solid var(--glass-line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.gear-index { font-size: 12px; color: var(--muted); }
.gear-index span { color: var(--flame); font-size: 16px; }
.gear-card h3 { font-family: var(--display); font-weight: 400; font-size: 34px; margin: 6px 0; }
.gear-card p { color: var(--muted); font-size: 14px; min-height: 3.2em; }
.gear-weight { display: flex; justify-content: space-between; margin-top: 12px; padding-top: 12px; border-top: 1px dashed rgba(255, 255, 255, .15); font-size: 13px; color: var(--muted); }
.gear-weight b { color: var(--hivis); }
.gear-dots { display: flex; gap: 6px; margin-top: 14px; }
.gear-dots i { flex: 1; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .15); transition: background .3s; }
.gear-dots i.on { background: var(--fire); box-shadow: 0 0 8px var(--fire); }

.stats { display: grid; gap: 12px; }
.stat { padding: 16px 20px; border-radius: 14px; background: var(--glass); border: 1px solid var(--glass-line); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.stat b { font-size: clamp(26px, 3vw, 38px); color: var(--flame); }
.stat span { font-size: 13px; color: var(--muted); }
.note { font-size: 12px; color: rgba(244, 241, 236, .45); }

.safety { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; width: min(1000px, 100%); margin-top: 10px; max-width: none !important; }
.safety .card { text-align: left; padding: 20px; border-radius: 16px; background: var(--glass); border: 1px solid var(--glass-line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); display: flex; flex-direction: column; gap: 6px; transition: transform .3s, border-color .3s; }
.safety .card:hover { transform: translateY(-6px); border-color: var(--fire); }
.safety .card i { font-style: normal; font-family: var(--mono); width: 30px; height: 30px; display: grid; place-content: center; border-radius: 50%; background: var(--red); font-size: 14px; margin-bottom: 6px; }
.safety .card b { font-size: 16px; }
.safety .card span { font-size: 13px; color: var(--muted); }
.call { margin-top: 26px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.call span { font-size: clamp(72px, 12vw, 150px); font-weight: 700; line-height: 1; color: var(--red); text-shadow: 0 0 40px rgba(215, 38, 30, .8), 0 0 4px #fff; animation: pulse 1.6s ease-in-out infinite; }
.call p { color: var(--muted); }
@keyframes pulse { 50% { text-shadow: 0 0 70px rgba(255, 90, 31, 1), 0 0 6px #fff; } }

/* ---------- 패널 ---------- */
#panel { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; }
#panel[hidden] { display: none; }
.panel-backdrop { position: absolute; inset: 0; background: rgba(5, 6, 10, .55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.panel-box {
  position: relative; width: min(480px, 100%); padding: 30px; border-radius: 22px;
  background: linear-gradient(160deg, rgba(40, 24, 18, .85), rgba(14, 16, 22, .9)); border: 1px solid rgba(255, 178, 56, .35);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 40px rgba(255, 90, 31, .2);
  animation: pop .35s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes pop { from { opacity: 0; transform: translateY(20px) scale(.95); } }
.panel-box h3 { font-family: var(--display); font-weight: 400; font-size: 36px; margin: 6px 0 10px; }
.panel-box p { color: var(--muted); font-size: 15px; }
.panel-box dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 16px 0; font-size: 14px; }
.panel-box dt { color: var(--muted); }
.panel-box dd { color: var(--hivis); font-family: var(--mono); }
.panel-close { position: absolute; top: 14px; right: 16px; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 16px; background: rgba(255, 255, 255, .08); }
.panel-close:hover, .panel-close:focus-visible { background: var(--fire); outline: none; }
.panel-hint { font-size: 12px !important; margin-top: 8px; }

#no-webgl { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); z-index: 70; background: var(--glass); padding: 10px 16px; border-radius: 10px; font-size: 13px; }
body.no-webgl { background: radial-gradient(ellipse at 50% 120%, #4a1608, var(--night) 60%) fixed; }

/* ---------- 반응형 ---------- */
@media (max-width: 1200px) {
  #scene-nav button.active span { opacity: 0; transform: translate(6px, -50%); }
  #scene-nav button:hover span, #scene-nav button:focus-visible span { opacity: 1; transform: translate(0, -50%); }
}
@media (max-width: 900px) {
  .safety { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .brand { top: 16px; left: 16px; }
  .brand-name { display: none; }
  #scene-nav { right: 10px; gap: 12px; }
  #scene-nav button span { display: none; }
  .inner { padding: 80px 16px 120px; justify-content: flex-end; }
  .inner.center { justify-content: center; }
  .hero-inner { align-items: center; text-align: center; }
  .hero-inner .scroll-cue { align-items: center; }
  .inner > *, .inner.right > * { max-width: 100%; width: 100%; }
  .inner.right { align-items: stretch; }
  .big-stat b { font-size: 72px; }
  .safety { grid-template-columns: 1fr; }
  #hud { left: 12px; right: auto; bottom: 12px; max-width: 60vw; padding: 8px 10px; }
  #hud .hud-keys { display: none; }
  #sound-toggle { right: 12px; bottom: 12px; padding: 8px 12px; }
  #sound-toggle span { display: none; }
  .steps li { padding: 10px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .grain, .loader-flame, .progress-tip, .mouse i, .call span { animation: none; }
}
