/* Layout breakpoints: see js/config.js → BREAKPOINTS (touch 768, mazeMenu 719). */

:root {
  --text-fluid-xs: clamp(0.72rem, 0.66rem + 0.28vw, 0.8125rem);
  --text-fluid-sm: clamp(0.84rem, 0.78rem + 0.32vw, 0.9375rem);
  --text-fluid-base: clamp(0.95rem, 0.88rem + 0.38vw, 1.0625rem);
  --text-fluid-md: clamp(1.05rem, 0.96rem + 0.45vw, 1.1875rem);
  --text-fluid-lg: clamp(1.15rem, 1.02rem + 0.55vw, 1.3125rem);
  --bg: #080a10;
  --bg-elevated: #0e121c;
  --surface: rgba(14, 18, 28, 0.72);
  --surface-strong: rgba(18, 24, 38, 0.92);
  --border: rgba(255, 248, 235, 0.09);
  --border-strong: rgba(255, 248, 235, 0.16);
  --text: #f6f0e8;
  --muted: rgba(246, 240, 232, 0.72);
  --copper: #e8a849;
  --copper-dim: rgba(232, 168, 73, 0.18);
  --dl: #9b7bff;
  --iot: #2dffb3;
  --ros: #ff7555;
  --pai: #ffd56a;
  --accent: var(--copper);
  --project: var(--dl);
  --font-display: "Unbounded", sans-serif;
  --font-game: "Orbitron", "Unbounded", sans-serif;
  --font-body: "Pretendard Variable", "Pretendard", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --text-xs: 0.8125rem;
  --text-sm: 0.9375rem;
  --text-base: 1.0625rem;
  --text-md: 1.1875rem;
  --text-lg: 1.3125rem;
  --line-body: 1.65;
  --line-relaxed: 1.75;
  --touch-min: 2.75rem;
  --neon-glow: 0 0 20px color-mix(in srgb, var(--project) 45%, transparent);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --radius-sm: 6px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --app-height: 100vh;
  --app-width: 100vw;
  --viewport-offset-top: 0px;
  --viewport-offset-left: 0px;
  --ui-scale: 1;
  --space-inline: clamp(0.75rem, calc(0.5rem + 2vw), 2.5rem);
  --chrome-pad: clamp(0.65rem, calc(0.45rem + 1.2vmin), 1.35rem);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --ink: var(--text);
  --warm-highlight: rgba(255, 248, 235, 0.07);
  --glass-ring: color-mix(in srgb, var(--copper) 22%, var(--border));
}

@supports (height: 100dvh) {
  :root {
    --app-height: 100dvh;
  }
}

html {
  font-size: clamp(15px, calc(14px + 0.28vw), 18px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

html,
body {
  margin: 0;
  width: var(--app-width);
  height: var(--app-height);
  min-height: var(--app-height);
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--line-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Korean: break at word boundaries only — never split 실|물, 됩니|다, etc. */
:lang(ko) {
  word-break: keep-all;
  overflow-wrap: break-word;
  line-break: strict;
}

:focus-visible {
  outline: 2px solid var(--project);
  outline-offset: 3px;
}

body[data-project="dl"] {
  --project: var(--dl);
  --accent: var(--dl);
}
body[data-project="iot"] {
  --project: var(--iot);
  --accent: var(--iot);
}
body[data-project="ros"] {
  --project: var(--ros);
  --accent: var(--ros);
}
body[data-project="pai"] {
  --project: var(--pai);
  --accent: var(--pai);
}

/* ── Ambient layers ── */
.ambient {
  position: fixed;
  top: var(--viewport-offset-top);
  left: var(--viewport-offset-left);
  width: var(--app-width);
  height: var(--app-height);
  max-height: var(--app-height);
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.ambient__mesh {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(ellipse 55% 45% at 15% 20%, rgba(155, 123, 255, 0.14), transparent 55%),
    radial-gradient(ellipse 50% 40% at 85% 75%, rgba(232, 168, 73, 0.1), transparent 50%),
    radial-gradient(ellipse 40% 35% at 60% 10%, rgba(45, 255, 179, 0.06), transparent 45%);
  animation: mesh-drift 22s ease-in-out infinite alternate;
}

.ambient__grid {
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 45%, black 20%, transparent 75%);
}

.ambient__vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(0, 0, 0, 0.65) 100%);
}

@keyframes mesh-drift {
  from {
    transform: translate(0, 0) scale(1);
  }
  to {
    transform: translate(-2%, 3%) scale(1.04);
  }
}

#canvas-root {
  position: fixed;
  top: var(--viewport-offset-top);
  left: var(--viewport-offset-left);
  width: var(--app-width);
  height: var(--app-height);
  max-height: var(--app-height);
  z-index: 1;
  transition: opacity 0.55s var(--ease-out);
}

body.detail-mode #canvas-root,
body.about-mode #canvas-root,
body.journey-mode #canvas-root {
  display: none;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

body.perf-low .grain,
body.perf-low .scanlines,
body.perf-low .cursor-glow {
  display: none;
}

body.perf-low .ambient__mesh {
  animation: none;
}

body.perf-medium .grain {
  opacity: 0.12;
}

body.perf-low .hero__panel,
body.perf-medium .hero__panel,
body.perf-low .timeline-btn,
body.perf-medium .timeline-btn,
body.perf-low .lang-btn,
body.perf-medium .lang-btn,
body.perf-low .detail-top,
body.perf-medium .detail-top,
body.perf-low .mobile-joystick__base,
body.perf-medium .mobile-joystick__base,
body.perf-low .mobile-btn,
body.perf-medium .mobile-btn {
  backdrop-filter: none;
}

body.perf-medium.touch-ui .ambient__mesh {
  animation: none;
}

#canvas-root canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.grain {
  pointer-events: none;
  position: fixed;
  top: var(--viewport-offset-top);
  left: var(--viewport-offset-left);
  width: var(--app-width);
  height: var(--app-height);
  max-height: var(--app-height);
  z-index: 2;
  opacity: 0.22;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

.scanlines {
  pointer-events: none;
  position: fixed;
  top: var(--viewport-offset-top);
  left: var(--viewport-offset-left);
  width: var(--app-width);
  height: var(--app-height);
  max-height: var(--app-height);
  z-index: 3;
  opacity: 0.06;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.35) 2px,
    rgba(0, 0, 0, 0.35) 4px
  );
}

body.intro .ambient__mesh {
  background:
    radial-gradient(ellipse 60% 50% at 20% 15%, rgba(232, 168, 73, 0.16), transparent 58%),
    radial-gradient(ellipse 50% 42% at 82% 78%, rgba(155, 123, 255, 0.11), transparent 52%),
    radial-gradient(ellipse 45% 38% at 55% 45%, rgba(45, 255, 179, 0.05), transparent 48%);
}

body.maze-mode .ambient__mesh {
  opacity: 1;
  background:
    radial-gradient(ellipse 55% 45% at 25% 20%, rgba(45, 255, 179, 0.12), transparent 55%),
    radial-gradient(ellipse 50% 40% at 75% 80%, rgba(100, 160, 255, 0.1), transparent 50%),
    radial-gradient(ellipse 40% 35% at 50% 50%, rgba(255, 107, 44, 0.05), transparent 45%);
}

body.maze-mode .brand__text {
  color: rgba(45, 255, 179, 0.85);
}

body.maze-mode .scanlines {
  opacity: 0.09;
}

.cursor-glow {
  position: fixed;
  width: 280px;
  height: 280px;
  margin: -140px 0 0 -140px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 3;
  background: radial-gradient(
    circle,
    color-mix(in srgb, var(--project) 12%, transparent) 0%,
    transparent 68%
  );
  opacity: 0;
  transition: opacity 0.35s ease;
}

@media (hover: hover) and (pointer: fine) {
  body:not(.detail-mode) .cursor-glow {
    opacity: 1;
  }
}

/* ── Intro stagger ── */
body.intro .hero__panel,
body.intro .timeline-btn,
body.intro .hud,
body.intro .dock,
body.intro .top-bar,
body.intro .minimap,
body.intro .quest-banner {
  opacity: 0;
  transform: translateY(18px);
}

body:not(.intro) .hero__panel {
  animation: rise 0.85s var(--ease-out) 0.1s both;
}
body:not(.intro) .hud {
  animation: rise 0.85s var(--ease-out) 0.2s both;
}
body:not(.intro) .timeline-btn:nth-child(1) {
  animation: rise 0.7s var(--ease-out) 0.28s both;
}
body:not(.intro) .timeline-btn:nth-child(2) {
  animation: rise 0.7s var(--ease-out) 0.36s both;
}
body:not(.intro) .timeline-btn:nth-child(3) {
  animation: rise 0.7s var(--ease-out) 0.44s both;
}
body:not(.intro) .timeline-btn:nth-child(4) {
  animation: rise 0.7s var(--ease-out) 0.52s both;
}
body:not(.intro) .dock {
  animation: rise 0.85s var(--ease-out) 0.55s both;
}
body:not(.intro) .top-bar {
  animation: rise 0.7s var(--ease-out) 0.05s both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Orbit UI ── */
.ui {
  position: fixed;
  top: var(--viewport-offset-top);
  left: var(--viewport-offset-left);
  width: var(--app-width);
  height: var(--app-height);
  max-height: var(--app-height);
  z-index: 4;
  pointer-events: none;
  transition:
    opacity 0.45s ease,
    transform 0.45s var(--ease-out);
}

.ui.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-12px) scale(0.985);
}

.ui > * {
  pointer-events: auto;
}

.top-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  padding: 1.35rem clamp(1.25rem, 3vw, 2.5rem);
}

.top-bar__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
}

body:not(.maze-mode) .top-bar > .quest-banner {
  display: none;
}

.top-bar__status {
  display: none;
  align-items: center;
  gap: 0.55rem;
  margin-left: auto;
  margin-right: 0.25rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
}

.top-bar__status-num {
  color: var(--project);
  font-family: var(--font-game);
  font-size: var(--text-md);
  font-weight: 500;
}

.top-bar__status-phase {
  color: var(--muted);
  text-transform: uppercase;
}

.top-bar__status-progress {
  display: none;
  width: 100%;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  line-height: 1.2;
}

.top-bar__tools {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-min);
  height: var(--touch-min);
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--project);
  font-size: 1.15rem;
  cursor: pointer;
  transition:
    transform 0.2s,
    border-color 0.2s,
    color 0.2s,
    box-shadow 0.2s;
}

.icon-btn:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.icon-btn[aria-pressed="true"] {
  color: var(--muted);
  opacity: 0.7;
  text-decoration: line-through;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-mono);
  font-size: var(--text-fluid-sm);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  min-width: 0;
}

.brand__text {
  display: inline-flex;
  min-width: 0;
  max-width: 100%;
  overflow: visible;
  text-overflow: clip;
}

.brand__label {
  display: none;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

.brand__text[data-tier="full"] .brand__label--full,
.brand__text:not([data-tier]) .brand__label--short {
  display: inline;
}

.brand__text[data-tier="short"] .brand__label--short {
  display: inline;
}

.brand__text[data-tier="micro"] .brand__label--micro {
  display: inline;
}

.brand__text[data-tier="short"] {
  letter-spacing: 0.07em;
}

.brand__mark {
  color: var(--project);
  font-size: 1rem;
  transition: color 0.4s ease;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: var(--touch-min);
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(16px) saturate(140%);
  color: var(--text);
  padding: 0.55rem 1.15rem 0.55rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.04em;
  transition:
    border-color 0.25s,
    transform 0.25s,
    box-shadow 0.25s;
}

.lang-btn__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--project);
  box-shadow: 0 0 12px color-mix(in srgb, var(--project) 80%, transparent);
  transition:
    background 0.4s,
    box-shadow 0.4s;
}

.lang-btn:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

/* ── Hero ── */
.hero {
  position: absolute;
  left: var(--space-inline);
  top: clamp(40%, 50%, 48%);
  transform: translateY(-48%);
  max-width: min(32rem, 42vw, calc(var(--app-width) * 0.46));
  max-height: calc(var(--app-height) - clamp(5rem, 14vmin, 9rem));
  z-index: 1;
}

.hero__panel {
  position: relative;
  max-height: inherit;
  overflow: auto;
  padding: clamp(1.15rem, 2.8vmin, 1.75rem) clamp(1.2rem, 3vmin, 1.85rem)
    clamp(1.05rem, 2.5vmin, 1.65rem);
  background: color-mix(in srgb, var(--surface) 88%, var(--copper) 4%);
  border: 1px solid var(--glass-ring);
  backdrop-filter: blur(20px) saturate(130%);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 28px), calc(100% - 28px) 100%, 0 100%);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 var(--warm-highlight),
    0 0 36px color-mix(in srgb, var(--project) 6%, transparent);
}

.hero__panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(180deg, var(--project), transparent 85%);
  transition: background 0.45s ease;
}

.hero__eyebrow {
  margin: 0 0 0.85rem;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.14em;
  color: var(--project);
  transition: color 0.4s ease;
}

.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2.6rem, 5.5vw, 4.2rem);
  line-height: 0.92;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.hero__alias {
  display: block;
  margin-top: 0.45rem;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(0.95rem, 2vw, 1.15rem);
  color: var(--copper);
  letter-spacing: 0.04em;
}

.hero__role {
  margin: 1.1rem 0 0.55rem;
  color: var(--muted);
  font-size: var(--text-md);
  line-height: var(--line-body);
}

.hero__tagline {
  margin: 0;
  line-height: var(--line-relaxed);
  color: rgba(246, 240, 232, 0.9);
  font-size: var(--text-md);
  max-width: 28rem;
}

.hero__lab-notes {
  margin: 0.65rem 0 0;
  min-height: 1.35em;
  max-width: 28rem;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.05em;
  line-height: 1.45;
  color: color-mix(in srgb, var(--copper) 72%, var(--muted));
  transition: opacity 0.45s var(--ease-out);
}

.hero__lab-notes--pulse {
  opacity: 0.35;
}

.intro-card__return:not(.hidden, :empty) {
  margin: 0 0 0.85rem;
  padding: 0.55rem 0.75rem;
  border-left: 3px solid var(--copper);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: var(--line-relaxed);
  color: color-mix(in srgb, var(--copper) 55%, var(--text));
  background: color-mix(in srgb, var(--copper) 8%, transparent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.journey-card__manifesto {
  margin: 0.85rem 0 0;
  padding: 0.75rem 0.9rem;
  border-left: 3px solid color-mix(in srgb, var(--pai) 55%, var(--copper));
  font-size: var(--text-sm);
  font-style: normal;
  line-height: var(--line-relaxed);
  color: rgba(246, 240, 232, 0.88);
  background: color-mix(in srgb, var(--pai) 6%, rgba(8, 12, 20, 0.55));
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.hero__rule {
  margin-top: 1.25rem;
  height: 1px;
  background: linear-gradient(90deg, var(--project), transparent);
  opacity: 0.55;
  transition: background 0.4s ease;
}

html[data-viewport="ultrawide"] .hero {
  max-width: min(28rem, 34vw);
}

html[data-viewport="tall"] .hero {
  top: clamp(36%, 44%, 46%);
  max-width: min(30rem, 88vw);
}

/* 짧은 창 — 모바일·태블릿만 (데스크톱 웹은 고정 스케일 유지) */
@media (max-height: 680px) and (min-width: 600px) and (max-width: 719px) {
  .hero {
    top: auto;
    bottom: clamp(0.85rem, 5vmin, 2rem);
    transform: none;
    max-height: calc(var(--app-height) - clamp(3.5rem, 10vmin, 5rem));
  }

  .hero h1 {
    font-size: clamp(2rem, 4.8vmin, 3rem);
  }

  .hero__role,
  .hero__tagline {
    font-size: var(--text-sm);
  }
}

.ui-menu-btn {
  display: none;
}

.ui-menu-btn__icon {
  position: relative;
  display: block;
  width: 1.1rem;
  height: 2px;
  margin: 0 auto;
  background: currentColor;
  border-radius: 1px;
  transition:
    background 0.2s,
    transform 0.25s var(--ease-out);
}

.ui-menu-btn__icon::before,
.ui-menu-btn__icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}

.ui-menu-btn__icon::before {
  top: -0.36rem;
}

.ui-menu-btn__icon::after {
  top: 0.36rem;
}

body.ui-menu-open .ui-menu-btn__icon {
  background: transparent;
  transform: rotate(45deg);
}

body.ui-menu-open .ui-menu-btn__icon::before,
body.ui-menu-open .ui-menu-btn__icon::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}

body.ui-menu-open .ui-menu-btn__icon::after {
  transform: rotate(-90deg);
}

.ui-drawer__backdrop {
  display: none;
}

.ui-drawer__head {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.ui-drawer__title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.ui-drawer__close {
  flex-shrink: 0;
  font-size: 1rem;
}

.ui-drawer__meta {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex-shrink: 0;
}

.ui-drawer__meta:empty {
  display: none;
}

.ui-drawer__meta .top-bar__status {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 0.38rem 0.72rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(12, 16, 24, 0.82);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.ui-drawer__meta .top-bar__status-num {
  color: var(--project);
  font-family: var(--font-game);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1;
}

.ui-drawer__meta .top-bar__status-phase,
.ui-drawer__meta .top-bar__status-progress {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1;
}

.ui-drawer__meta .top-bar__status-phase {
  text-transform: uppercase;
}

.ui-drawer__meta .top-bar__status-phase::before,
.ui-drawer__meta .top-bar__status-progress::before {
  content: "·";
  margin-right: 0.35rem;
  opacity: 0.55;
}

.ui-drawer__meta .top-bar__status-progress {
  display: inline;
}

.ui-drawer__meta .quest-banner {
  position: static;
  left: auto;
  bottom: auto;
  transform: none;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--border) 90%, transparent);
  background: rgba(10, 14, 22, 0.82);
  font-size: var(--text-xs);
  line-height: 1.4;
  text-align: left;
  white-space: normal;
  pointer-events: none;
}

.ui-drawer__meta .quest-banner:not(.quest-banner--active) {
  display: none;
}

.ui-drawer__meta .quest-banner--active {
  transform: none;
  color: var(--text);
  border-color: color-mix(in srgb, var(--project) 38%, var(--border));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--project) 12%, transparent);
}

.ui-drawer__quick-tools {
  display: flex;
  align-items: stretch;
  gap: 0.45rem;
  width: 100%;
}

/* ── Maze HUD: edge chrome only — center stays clear for the 3D lab ── */
body.maze-mode .ui {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "bar"
    "stage"
    "chrome";
  align-content: stretch;
}

body.maze-mode .ui-drawer {
  grid-area: chrome;
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 6;
}

body.maze-mode .ui-drawer__panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.maze-mode .top-bar {
  position: relative;
  grid-area: bar;
  z-index: 7;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: calc(0.65rem + var(--safe-top)) calc(0.75rem + var(--safe-right)) 0.55rem
    calc(0.75rem + var(--safe-left));
  background: rgba(8, 10, 16, 0.94);
  border-bottom: 1px solid var(--border);
}

body.maze-mode .top-bar__row {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto;
  grid-template-areas: "brand . status tools";
  align-items: center;
  gap: 0.4rem 0.5rem;
  width: 100%;
}

body.maze-mode .brand {
  grid-area: brand;
  flex-shrink: 1;
  min-width: 0;
  max-width: 100%;
  overflow: visible;
}

body.maze-mode .brand__text {
  overflow: visible;
  text-overflow: clip;
  max-width: none;
  min-width: 0;
}

body.maze-mode .top-bar__status {
  grid-area: status;
  display: inline-flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  margin-left: auto;
  width: fit-content;
  max-width: 100%;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(12, 16, 24, 0.72);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  white-space: nowrap;
}

body.maze-mode .top-bar__status-num {
  color: var(--project);
  font-family: var(--font-game);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1;
}

body.maze-mode .top-bar__status-phase,
body.maze-mode .top-bar__status-progress {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1;
}

body.maze-mode .top-bar__status-phase {
  text-transform: uppercase;
}

body.maze-mode .top-bar__status-phase::before,
body.maze-mode .top-bar__status-progress::before {
  content: "·";
  margin-right: 0.35rem;
  opacity: 0.55;
}

body.maze-mode .top-bar__tools {
  grid-area: tools;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

body.maze-mode .top-bar__status-progress {
  display: none;
}

@media (max-width: 900px) {
  body.maze-mode:not(.maze-menu-chrome) .minimap {
    display: none !important;
  }

  body.maze-mode .top-bar__status-progress {
    display: inline;
    flex-basis: auto;
    width: auto;
    text-align: inherit;
  }
}

body.maze-mode .hero,
body.maze-mode .hud {
  display: none !important;
}

body.maze-mode .quest-banner {
  position: relative;
  left: auto;
  bottom: auto;
  transform: none;
  flex-shrink: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0.42rem 0.75rem;
  text-align: center;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--border) 90%, transparent);
  background: rgba(10, 14, 22, 0.72);
  font-size: var(--text-xs);
  line-height: 1.35;
  color: var(--muted);
  pointer-events: none;
}

body.maze-mode .quest-banner:not(.quest-banner--active) {
  display: none;
}

body.maze-mode .quest-banner--active {
  transform: none;
  color: var(--text);
  border-color: color-mix(in srgb, var(--project) 38%, var(--border));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--project) 12%, transparent);
}

/* Wide maze: center mission pill; balance brand / status / tools row */
@media (min-width: 720px) {
  body.maze-mode .top-bar {
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.65rem;
  }

  body.maze-mode .top-bar__row {
    max-width: min(72rem, 100%);
    margin-inline: auto;
    grid-template-columns: 1fr auto 1fr;
    grid-template-areas: "brand status tools";
    column-gap: 1rem;
  }

  body.maze-mode .brand {
    justify-self: start;
    min-width: 0;
    max-width: 100%;
  }

  body.maze-mode .top-bar__status {
    grid-area: status;
    justify-self: center;
    margin: 0;
  }

  body.maze-mode .top-bar__tools {
    justify-self: end;
  }

  body.maze-mode .quest-banner {
    width: fit-content;
    max-width: min(46rem, calc(100% - 2rem));
    margin-inline: auto;
    padding: clamp(0.45rem, 0.35rem + 0.35vmin, 0.55rem) clamp(1rem, 0.75rem + 1.2vmin, 1.35rem);
    font-size: clamp(0.84rem, calc(0.8rem + 0.22vmin), var(--text-sm));
    line-height: 1.45;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    text-align: center;
    border-radius: 999px;
    letter-spacing: 0.02em;
    word-break: keep-all;
    overflow-wrap: break-word;
  }

  body.maze-mode .quest-banner--active {
    box-shadow:
      inset 0 0 0 1px color-mix(in srgb, var(--project) 12%, transparent),
      0 0 22px color-mix(in srgb, var(--project) 16%, transparent);
  }

  /* 하단 E 배지가 뜨면 상단 중복 배너는 숨김 */
  body.maze-mode:not(.touch-ui) .top-bar > .quest-banner.quest-banner--active {
    display: none;
  }
}

@media (min-width: 1280px) {
  body.maze-mode .quest-banner {
    max-width: min(42rem, 52vw);
  }
}

body.maze-mode .timeline {
  position: relative;
  top: auto;
  right: auto;
  left: auto;
  bottom: auto;
  transform: none;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0.55rem calc(0.85rem + var(--safe-right)) 0.55rem calc(0.85rem + var(--safe-left));
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  background: linear-gradient(180deg, rgba(10, 13, 20, 0.97), rgba(8, 10, 16, 0.94));
  border-top: 1px solid var(--border);
  flex: 0 0 auto;
}

body.maze-mode .timeline-btn {
  flex: 0 0 auto;
  min-width: clamp(7.25rem, calc(6.25rem + 10vw), 9.75rem);
  scroll-snap-align: center;
  padding: clamp(0.5rem, calc(0.45rem + 0.35vmin), 0.62rem)
    clamp(0.75rem, calc(0.65rem + 0.8vmin), 0.95rem);
  border-radius: 999px;
}

body.maze-mode .timeline-btn::before {
  display: none;
}

body.maze-mode .timeline-btn:hover {
  transform: translateY(-2px);
}

body.maze-mode .timeline-btn.active {
  transform: translateY(-2px);
}

body.maze-mode .timeline-btn .phase {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.12rem;
  font-size: 0.68rem;
}

body.maze-mode .timeline-btn .phase__order {
  font-family: var(--font-game);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--btn-accent, var(--muted));
}

body.maze-mode .timeline-btn .phase__tag {
  letter-spacing: 0.1em;
}

body.maze-mode .timeline-btn .phase__name {
  font-size: var(--text-sm);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

body.maze-mode .minimap {
  position: relative;
  right: auto;
  bottom: auto;
  left: auto;
  grid-area: stage;
  justify-self: start;
  align-self: end;
  z-index: 5;
  margin: auto auto calc(clamp(5.25rem, 12vmin, 6.5rem) + var(--safe-bottom))
    calc(0.65rem + var(--safe-left));
  padding: 0.45rem 0.5rem;
  pointer-events: none;
  opacity: 0.92;
  transform: scale(clamp(0.78, calc(0.72 + var(--ui-scale) * 0.18), 0.94));
  transform-origin: bottom left;
  border-radius: var(--radius-sm);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--project) 18%, transparent),
    0 8px 28px rgba(0, 0, 0, 0.35);
}

body.maze-mode .minimap::before {
  font-size: 0.62rem;
  margin-bottom: 0.2rem;
}

body.maze-mode .minimap canvas {
  width: clamp(5rem, calc(4.5rem + 3.2vmin * var(--ui-scale)), 7rem);
  height: auto;
  aspect-ratio: 120 / 88;
}

body.maze-mode .minimap__progress {
  font-size: 0.58rem;
  margin-top: 0.2rem;
}

body.maze-mode .dock {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
  padding: 0.45rem calc(1rem + var(--safe-right)) calc(0.65rem + var(--safe-bottom))
    calc(1rem + var(--safe-left));
  background: rgba(8, 10, 16, 0.96);
  border-top: 1px solid var(--border);
  max-width: min(72rem, 100%);
  margin-inline: auto;
  width: 100%;
}

body.maze-mode .dock__hint {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: var(--text-xs);
  line-height: 1.4;
  color: var(--muted);
  text-align: right;
}

body.maze-mode .dock__link {
  flex-shrink: 0;
}

/* Wide: project rail on the right — still off the play area */
@media (min-width: 1280px) {
  body.maze-mode .minimap {
    margin-bottom: calc(0.75rem + var(--safe-bottom));
  }

  body.maze-mode .ui {
    grid-template-columns: minmax(0, 1fr) clamp(13.25rem, 13.5vw, 16.75rem);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "bar bar"
      "stage sidebar"
      "footer footer";
  }

  body.maze-mode .ui-drawer,
  body.maze-mode .ui-drawer__panel {
    display: contents;
  }

  body.maze-mode .ui-drawer__head,
  body.maze-mode .ui-drawer__backdrop {
    display: none !important;
  }

  body.maze-mode .timeline {
    grid-area: sidebar;
    flex-direction: column;
    align-self: stretch;
    justify-self: stretch;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0.65rem;
    border-top: none;
    border-left: 1px solid var(--border);
    background: rgba(8, 10, 16, 0.9);
    scroll-snap-type: none;
  }

  body.maze-mode .dock {
    grid-area: footer;
  }

  body.maze-mode .timeline-btn {
    min-width: 0;
    width: 100%;
    border-radius: var(--radius-sm);
    padding: 0.72rem 0.85rem 0.78rem;
    text-align: left;
  }

  body.maze-mode .timeline-btn:hover,
  body.maze-mode .timeline-btn.active {
    transform: translateX(-4px);
  }

  body.maze-mode .timeline-btn .phase__tag {
    display: inline;
  }

  /* 1행: 번호·페이즈 / 2행: 프로젝트 전체 이름 */
  body.maze-mode .timeline-btn .phase {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 0.35rem;
    row-gap: 0.12rem;
    width: 100%;
  }

  body.maze-mode .timeline-btn .phase__name {
    flex: 0 0 100%;
    width: 100%;
    margin-top: 0.1rem;
    font-size: clamp(0.8125rem, calc(0.78rem + 0.18vmin), var(--text-sm));
    line-height: 1.35;
    white-space: normal;
    word-break: keep-all;
    overflow-wrap: anywhere;
  }

  body.maze-mode .timeline-btn .phase__name::before {
    display: none;
  }

  body.maze-mode .dock__hint {
    display: none;
  }
}

@media (min-width: 900px) and (max-width: 1279px) {
  body.maze-mode .timeline-btn .phase__tag {
    display: none;
  }

  body.maze-mode .timeline-btn {
    min-width: 8.5rem;
    padding: 0.58rem 0.9rem;
  }

  body.maze-mode .timeline-btn .phase {
    margin-bottom: 0.08rem;
  }
}

/* Compact: hamburger drawer — maze stays full screen */
@media (max-width: 719px) {
  body.maze-mode .ui {
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      "bar"
      "stage";
  }

  body.maze-mode .ui-menu-btn {
    display: inline-flex;
  }

  body.maze-mode .lang-btn__label {
    display: none;
  }

  body.maze-mode .lang-btn {
    min-width: 2.45rem;
    padding: 0;
  }

  body.maze-mode .top-bar {
    gap: 0.3rem;
    padding: calc(0.45rem + var(--safe-top)) calc(0.65rem + var(--safe-right)) 0.42rem
      calc(0.65rem + var(--safe-left));
    background: rgba(8, 10, 16, 0.9);
    backdrop-filter: blur(12px);
  }

  body.maze-mode .top-bar__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
  }

  body.maze-mode .brand {
    display: none;
  }

  body.maze-mode .top-bar__status {
    margin-left: 0;
    justify-content: flex-start;
    padding: 0.28rem 0.58rem;
    gap: 0.28rem;
    flex: 0 1 auto;
    min-width: 0;
    max-width: min(48vw, 9.5rem);
  }

  body.maze-mode .top-bar__status-num {
    font-size: 0.82rem;
  }

  body.maze-mode .top-bar__status-phase,
  body.maze-mode .top-bar__status-progress {
    font-size: 0.62rem;
  }

  body.maze-mode .top-bar__status-progress {
    display: inline;
    flex-basis: auto;
    width: auto;
  }

  body.maze-mode .top-bar__tools {
    flex: 0 0 auto;
    gap: 0.28rem;
  }

  body.maze-mode .icon-btn,
  body.maze-mode .lang-btn {
    width: 2.35rem;
    height: 2.35rem;
    min-width: 2.35rem;
    min-height: 2.35rem;
  }

  body.maze-mode .quest-banner {
    position: static;
    transform: none;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0.32rem 0.55rem;
    font-size: 0.66rem;
    line-height: 1.25;
    border-radius: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body.maze-mode .quest-banner--active {
    transform: none;
  }

  body.maze-mode.maze-menu-chrome .ui {
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: "stage";
  }

  body.maze-mode.maze-menu-chrome .top-bar {
    position: fixed;
    top: calc(0.45rem + var(--safe-top));
    right: calc(0.65rem + var(--safe-right));
    left: auto;
    width: auto;
    z-index: 12;
    gap: 0;
    padding: 0;
    background: transparent;
    border: none;
    backdrop-filter: none;
    pointer-events: none;
    transform: none;
  }

  body.maze-mode.maze-menu-chrome .minimap {
    display: block !important;
    position: fixed;
    top: calc(0.45rem + var(--safe-top));
    left: calc(0.65rem + var(--safe-left));
    right: auto;
    bottom: auto;
    z-index: 12;
    margin: 0;
    width: clamp(5.25rem, 26vw, 7.75rem);
    padding: clamp(0.28rem, 1.1vw, 0.42rem) clamp(0.32rem, 1.2vw, 0.45rem);
    transform: none;
    opacity: 0.94;
    border-radius: var(--radius-sm);
  }

  body.maze-mode.maze-menu-chrome .minimap::before {
    font-size: clamp(0.48rem, 2.1vw, 0.6rem);
    margin-bottom: 0.12rem;
    letter-spacing: 0.1em;
  }

  body.maze-mode.maze-menu-chrome .minimap canvas {
    width: 100%;
    height: auto;
    aspect-ratio: 120 / 88;
  }

  body.maze-mode.maze-menu-chrome .minimap__progress {
    font-size: clamp(0.48rem, 2vw, 0.58rem);
    margin-top: 0.12rem;
    line-height: 1.2;
  }

  body.maze-mode.maze-menu-chrome .top-bar__row {
    display: block;
  }

  body.maze-mode.maze-menu-chrome .top-bar__tools {
    pointer-events: auto;
  }

  body.maze-mode.maze-menu-chrome .ui-menu-btn {
    background: rgba(8, 10, 16, 0.84);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.38);
  }

  body.maze-mode.maze-menu-chrome .ui-drawer__quick-tools .icon-btn {
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
    min-width: 2.5rem;
    min-height: 2.5rem;
  }

  body.maze-mode.maze-menu-chrome .ui-drawer__quick-tools .lang-btn {
    flex: 1 1 auto;
    width: auto;
    min-width: 6.5rem;
    height: 2.5rem;
    min-height: 2.5rem;
    padding: 0 1rem 0 0.8rem;
    justify-content: center;
    border-radius: 999px;
  }

  body.maze-mode.maze-menu-chrome .ui-drawer__quick-tools .lang-btn__label {
    display: inline;
    font-size: var(--text-xs);
    letter-spacing: 0.05em;
    white-space: nowrap;
  }

  body.maze-mode.maze-menu-chrome .ui-drawer__meta {
    align-items: stretch;
  }

  body.maze-mode.maze-menu-chrome .dock {
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
    padding: 0.55rem 0.75rem calc(0.7rem + var(--safe-bottom));
    text-align: center;
  }

  body.maze-mode.maze-menu-chrome .dock__link,
  body.maze-mode.maze-menu-chrome .dock__hint {
    text-align: center;
  }

  body.maze-mode.maze-menu-chrome .mobile-controls {
    bottom: 0;
    padding: 1.75rem calc(0.65rem + var(--safe-right)) calc(0.55rem + var(--safe-bottom))
      calc(0.65rem + var(--safe-left));
    background: linear-gradient(
      180deg,
      transparent 0%,
      rgba(6, 8, 12, 0.42) 38%,
      rgba(6, 8, 12, 0.72) 100%
    );
  }

  body.maze-mode.ui-menu-open .mobile-controls,
  body.maze-mode .mobile-controls.mobile-controls--suppressed {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate3d(0, 110%, 0) scale(0.94);
    z-index: 1;
  }

  body.maze-mode.ui-menu-open .mobile-controls .mobile-joystick,
  body.maze-mode.ui-menu-open .mobile-controls .mobile-actions,
  body.maze-mode .mobile-controls.mobile-controls--suppressed .mobile-joystick,
  body.maze-mode .mobile-controls.mobile-controls--suppressed .mobile-actions {
    pointer-events: none;
  }

  body.maze-mode .ui-drawer {
    position: fixed;
    inset: 0;
    z-index: 28;
    grid-area: unset;
    pointer-events: none;
    visibility: hidden;
  }

  body.maze-mode.ui-menu-open .ui-drawer {
    pointer-events: auto;
    visibility: visible;
  }

  body.maze-mode .ui-drawer__backdrop {
    display: block;
    position: absolute;
    inset: 0;
    background: rgba(6, 8, 12, 0.72);
    backdrop-filter: blur(6px);
  }

  body.maze-mode .ui-drawer__head {
    display: flex;
    flex-shrink: 0;
  }

  body.maze-mode .ui-drawer__meta {
    padding: 0.15rem 0.75rem 0.7rem;
    border-bottom: 1px solid var(--border);
  }

  body.maze-mode .ui-drawer__panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(92vw, 19rem);
    max-height: var(--app-height);
    background: var(--surface-strong);
    border-left: 1px solid var(--border);
    box-shadow: -12px 0 48px rgba(0, 0, 0, 0.45);
    transform: translateX(105%);
    transition: transform 0.35s var(--ease-out);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.maze-mode.ui-menu-open .ui-drawer__panel {
    transform: translateX(0);
  }

  body.maze-mode.maze-menu-chrome .ui-drawer {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(0.75rem, var(--safe-top)) max(0.65rem, var(--safe-right))
      max(0.75rem, var(--safe-bottom)) max(0.65rem, var(--safe-left));
  }

  body.maze-mode.maze-menu-chrome .ui-drawer__panel {
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    bottom: auto;
    width: min(92vw, 21rem);
    max-height: min(86dvh, calc(var(--app-height) - 1.5rem - var(--safe-top) - var(--safe-bottom)));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 22px 58px rgba(0, 0, 0, 0.5);
    transform: scale(0.96);
    opacity: 0;
    transition:
      transform 0.35s var(--ease-out),
      opacity 0.28s ease;
  }

  body.maze-mode.maze-menu-chrome.ui-menu-open .ui-drawer__panel {
    transform: scale(1);
    opacity: 1;
  }

  body.maze-mode .timeline {
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: visible;
    scroll-snap-type: none;
    padding: 0.5rem 0.65rem;
    border-top: none;
  }

  body.maze-mode .timeline-btn {
    min-width: 0;
    width: 100%;
    scroll-snap-align: unset;
  }

  body.maze-mode .timeline-btn:hover,
  body.maze-mode .timeline-btn.active {
    transform: translateX(-4px);
  }

  body.maze-mode .timeline-btn .phase {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
  }

  body.maze-mode .timeline-btn .phase__name {
    white-space: normal;
  }
}

/* ── HUD ── */
.hud {
  position: absolute;
  left: clamp(1.25rem, 3vw, 2.5rem);
  bottom: clamp(5.5rem, 12vh, 7rem);
  display: flex;
  align-items: flex-end;
  gap: 1.25rem;
  font-family: var(--font-mono);
}

.hud__block {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.hud__label,
.hud__value {
  font-family: var(--font-game);
}

.hud__label {
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  color: var(--muted);
}

.hud__value {
  font-size: 1.85rem;
  font-weight: 500;
  color: var(--project);
  line-height: 1;
  transition: color 0.4s ease;
}

.hud__value--sm {
  font-size: var(--text-md);
  letter-spacing: 0.08em;
}

.hud__rail {
  width: 88px;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.35rem;
}

.hud__rail-fill {
  height: 100%;
  width: var(--rail, 0%);
  background: var(--project);
  box-shadow: 0 0 14px color-mix(in srgb, var(--project) 70%, transparent);
  transition:
    width 0.35s var(--ease-out),
    background 0.4s ease;
}

/* ── Timeline ── */
.timeline {
  position: absolute;
  right: clamp(1.25rem, 3vw, 2.5rem);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.timeline-btn {
  position: relative;
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(16px);
  color: var(--text);
  padding: 1rem 1.1rem 1rem 2.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  min-width: 14rem;
  min-height: var(--touch-min);
  overflow: hidden;
  transition:
    transform 0.3s var(--ease-out),
    border-color 0.3s,
    box-shadow 0.3s,
    background 0.3s;
}

.timeline-btn::before {
  content: attr(data-num);
  position: absolute;
  left: 0.95rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--muted);
  transition: color 0.3s;
}

.timeline-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    color-mix(in srgb, var(--btn-accent, var(--dl)) 14%, transparent),
    transparent 55%
  );
  opacity: 0;
  transition: opacity 0.3s;
}

.timeline-btn[data-key="dl"] {
  --btn-accent: var(--dl);
}
.timeline-btn[data-key="iot"] {
  --btn-accent: var(--iot);
}
.timeline-btn[data-key="ros"] {
  --btn-accent: var(--ros);
}
.timeline-btn[data-key="pai"] {
  --btn-accent: var(--pai);
}

.timeline-btn:hover {
  transform: translateX(-6px);
  border-color: var(--border-strong);
}

.timeline-btn.active {
  transform: translateX(-8px);
  border-color: var(--btn-accent);
  box-shadow:
    -4px 0 0 var(--btn-accent),
    0 12px 36px rgba(0, 0, 0, 0.35);
}

.timeline-btn.active::before {
  color: var(--btn-accent);
}
.timeline-btn.active::after {
  opacity: 1;
}

.timeline-btn .phase {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.35rem;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0;
}

.timeline-btn .phase__order {
  font-family: var(--font-game);
  color: var(--btn-accent, var(--muted));
}

.timeline-btn .phase__tag {
  letter-spacing: 0.1em;
}

.timeline-btn .phase__name {
  position: relative;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-md);
  letter-spacing: -0.02em;
  text-transform: none;
  color: var(--text);
}

.timeline-btn .phase__name::before {
  content: "·";
  margin-right: 0.35rem;
  color: var(--muted);
  font-weight: 400;
}

/* ── Dock ── */
.dock {
  position: absolute;
  left: clamp(1.25rem, 3vw, 2.5rem);
  right: clamp(1.25rem, 3vw, 2.5rem);
  bottom: 1.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.dock__link {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.04em;
  color: var(--muted);
  text-decoration: none;
  padding: 0.35rem 0;
  transition: color 0.2s;
}

.dock__link:hover {
  color: var(--project);
}

.dock__hint {
  display: none;
}

/* ── Detail view ── */
.detail {
  position: fixed;
  top: var(--viewport-offset-top);
  left: var(--viewport-offset-left);
  width: var(--app-width);
  z-index: 12;
  height: var(--app-height);
  max-height: var(--app-height);
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transform: translateY(24px);
  transition:
    opacity 0.5s var(--ease-out),
    transform 0.5s var(--ease-out);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
}

.detail.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.detail__accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--project), transparent 70%);
  z-index: 2;
}

.detail__watermark {
  position: absolute;
  right: -0.08em;
  top: 0.05em;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(8rem, 22vw, 16rem);
  line-height: 0.85;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.04);
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.detail-top {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  padding: 0.95rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--border);
  background: var(--surface-strong);
  backdrop-filter: blur(18px);
  flex-shrink: 0;
}

.detail-meta {
  flex: 1 1 12rem;
  min-width: 0;
}

.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: var(--touch-min);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.03em;
  flex-shrink: 0;
  transition:
    border-color 0.25s,
    color 0.25s,
    transform 0.25s;
}

.detail-back:hover {
  border-color: var(--project);
  color: var(--project);
  transform: translateX(-3px);
}

.detail-3d-toggle {
  display: none;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  min-height: var(--touch-min);
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  color: var(--project);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    border-color 0.2s,
    background 0.2s;
}

.detail-3d-toggle:hover {
  border-color: var(--project);
  background: color-mix(in srgb, var(--project) 12%, transparent);
}

.detail-3d-toggle[aria-expanded="false"] {
  color: var(--muted);
}

.detail-meta h1 {
  margin: 0.2rem 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.65rem, 3.5vw, 2.6rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.detail-phase {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--project);
}

.detail-subtitle {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: var(--text-md);
  line-height: var(--line-body);
}

.detail-body {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, min(44vw, 420px)) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.detail-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  border-right: 1px solid var(--border);
  background:
    radial-gradient(
      ellipse 80% 60% at 50% 40%,
      color-mix(in srgb, var(--project) 8%, transparent),
      transparent
    ),
    var(--bg-elevated);
}

.detail-visual__frame {
  flex: 1 1 auto;
  min-height: 10rem;
  max-height: min(52vh, 520px);
  height: auto;
  margin: 1.25rem;
  border: 1px solid color-mix(in srgb, var(--project) 35%, var(--border));
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow:
    inset 0 0 50px rgba(0, 0, 0, 0.45),
    var(--neon-glow);
  background: radial-gradient(
    ellipse 70% 60% at 50% 45%,
    color-mix(in srgb, var(--project) 6%, #0a0e16),
    #080a10
  );
}

.detail-visual canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  object-fit: contain;
}

.detail-visual__caption {
  margin: 0 1.25rem 1rem;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.detail-content-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  background: var(--bg);
  isolation: isolate;
}

.detail-scroll-progress {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 4px;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  background: rgba(255, 255, 255, 0.06);
}

.detail-scroll-progress--active {
  opacity: 1;
}

.detail-scroll-progress::after {
  content: "";
  display: block;
  width: 100%;
  height: var(--scroll, 0%);
  min-height: 12%;
  background: linear-gradient(
    180deg,
    var(--project),
    color-mix(in srgb, var(--project) 55%, transparent)
  );
  border-radius: 4px 0 0 4px;
  box-shadow: 0 0 12px color-mix(in srgb, var(--project) 45%, transparent);
}

.detail-scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  z-index: 2;
  transform: translateX(-50%);
  margin: 0;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(8, 10, 18, 0.92);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  color: var(--muted);
  pointer-events: none;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

.detail-scroll-hint--hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(6px);
}

.detail-content {
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 1.5rem clamp(1.25rem, 3vw, 2.25rem) 3rem;
  scroll-padding-bottom: 2rem;
  scroll-behavior: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  outline: none;
}

body.detail-mode .detail-content:focus-visible {
  outline: none;
}

.quest-banner {
  position: fixed;
  left: 50%;
  bottom: 5.5rem;
  z-index: 8;
  transform: translateX(-50%);
  margin: 0;
  padding: 0.85rem 1.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(8, 10, 18, 0.92);
  backdrop-filter: blur(14px);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.45;
  text-transform: none;
  color: var(--muted);
  max-width: min(92vw, 28rem);
  text-align: center;
  pointer-events: none;
  transition:
    border-color 0.25s,
    color 0.25s,
    box-shadow 0.25s,
    transform 0.25s;
}

.quest-banner--active {
  color: var(--text);
  border-color: var(--project);
  box-shadow: var(--neon-glow);
  transform: translateX(-50%) scale(1.02);
}

.visual-aids {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.visual-aid {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(8, 10, 16, 0.5);
}

.visual-aid--diagram {
  cursor: zoom-in;
  position: relative;
  transition:
    border-color 0.25s,
    box-shadow 0.25s;
}

.visual-aid--diagram:hover {
  border-color: color-mix(in srgb, var(--project) 45%, var(--border));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

.visual-aid--diagram::after {
  content: "⤢";
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 1.55rem;
  height: 1.55rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  background: rgba(6, 10, 16, 0.72);
  color: #fff;
  font-size: 0.82rem;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}

.visual-aid--diagram:hover::after,
.visual-aid--diagram:focus-visible::after {
  opacity: 1;
}

.visual-aid--diagram:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--project) 70%, #fff);
  outline-offset: 2px;
}

.visual-aid--diagram img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 200px;
  object-fit: cover;
  pointer-events: none;
}

.visual-aid figcaption,
.visual-aid--flow p {
  margin: 0;
  padding: 0.75rem 0.95rem;
  font-size: var(--text-base);
  line-height: var(--line-body);
  color: var(--muted);
}

.visual-aid--flow h3 {
  margin: 0;
  padding: 0.85rem 0.95rem 0.4rem;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--project);
}

.flow-steps {
  list-style: none;
  margin: 0;
  padding: 0.65rem 0.85rem 0.95rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.flow-steps li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.75rem 0.4rem 0.4rem;
  font-size: var(--text-sm);
  color: rgba(246, 240, 232, 0.95);
  background: color-mix(in srgb, var(--project) 9%, rgba(8, 12, 18, 0.55));
  border: 1px solid color-mix(in srgb, var(--project) 30%, transparent);
  border-radius: 999px;
}

.flow-step__n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.32rem;
  height: 1.32rem;
  border-radius: 50%;
  background: var(--project);
  color: #06080c;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.6rem;
  flex: none;
  box-shadow: 0 0 10px color-mix(in srgb, var(--project) 50%, transparent);
}

.flow-step__arrow {
  color: var(--project);
  margin: 0 0.02rem;
  opacity: 0.65;
  font-size: 0.92rem;
}

body.maze-mode #canvas-root {
  display: block;
  visibility: visible;
  opacity: 1;
  filter: none;
  pointer-events: auto;
}

body:not(.cutscene-mode) #cutscene[hidden] {
  display: none !important;
}

/* ── Intro / About overlays ── */
.overlay {
  position: fixed;
  top: var(--viewport-offset-top);
  left: var(--viewport-offset-left);
  width: var(--app-width);
  height: var(--app-height);
  max-height: var(--app-height);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1rem, var(--safe-top)) max(1rem, var(--safe-right)) max(1rem, var(--safe-bottom))
    max(1rem, var(--safe-left));
  background: rgba(6, 8, 12, 0.88);
  backdrop-filter: blur(12px);
  pointer-events: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.overlay.hidden {
  display: none;
}

body.intro #intro-overlay.overlay {
  background:
    radial-gradient(ellipse 120% 80% at 50% -8%, rgba(232, 168, 73, 0.14), transparent 52%),
    radial-gradient(ellipse 85% 65% at 8% 92%, rgba(155, 123, 255, 0.09), transparent 56%),
    rgba(6, 8, 12, 0.9);
  backdrop-filter: blur(16px) saturate(118%);
}

.intro-card.overlay__card {
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: min(640px, 96vw);
  max-height: min(92dvh, 92vh, calc(var(--app-height) * 0.92));
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-ring);
  background: linear-gradient(
    152deg,
    color-mix(in srgb, var(--surface-strong) 94%, var(--copper) 6%),
    var(--surface-strong) 48%
  );
  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.52),
    inset 0 1px 0 var(--warm-highlight),
    0 0 52px color-mix(in srgb, var(--project) 9%, transparent);
}

.intro-card__frame {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  border-radius: inherit;
}

.intro-card__frame::before {
  content: "";
  position: absolute;
  top: 13px;
  left: 13px;
  width: 18px;
  height: 18px;
  border-color: color-mix(in srgb, var(--copper) 58%, transparent);
  border-style: solid;
  border-width: 2px 0 0 2px;
  opacity: 0.8;
}

.intro-card__frame::after {
  content: "";
  position: absolute;
  right: 13px;
  bottom: 13px;
  width: 18px;
  height: 18px;
  border-color: color-mix(in srgb, var(--copper) 58%, transparent);
  border-style: solid;
  border-width: 0 2px 2px 0;
  opacity: 0.8;
}

.intro-card__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: clamp(1.75rem, 4vw, 2.5rem);
  padding-right: calc(clamp(1.75rem, 4vw, 2.5rem) + 0.35rem);
}

.overlay__card:not(.intro-card) {
  max-width: 560px;
  width: 100%;
  max-height: min(calc(var(--app-height) * 0.92), 920px);
  overflow-y: auto;
  padding: clamp(1.75rem, 4vw, 2.5rem);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface-strong);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.about-card.overlay__card,
.about-overlay .overlay__card {
  max-width: min(720px, 96vw);
}

.about-card__header {
  display: flex;
  align-items: flex-start;
  gap: 1.15rem;
  margin-bottom: 1.1rem;
}

.about-card__photo {
  width: 108px;
  height: 134px;
  flex: none;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid color-mix(in srgb, var(--project) 35%, var(--border));
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.38);
}

.about-card__identity {
  min-width: 0;
  flex: 1;
}

.about-card__header .about-card__eyebrow {
  margin-bottom: 0.35rem;
}

.about-card__header .about-card__title {
  margin-bottom: 0.35rem;
}

.about-card__header .about-card__role {
  margin-bottom: 0;
}

@media (max-width: 480px) {
  .about-card__header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .about-card__photo {
    width: 96px;
    height: 120px;
  }
}

.intro-card__eyebrow:empty {
  display: none;
  margin: 0;
}

.intro-card__eyebrow,
.about-card__eyebrow {
  margin: 0 0 0.5rem;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--project);
}

.intro-card__title,
.about-card__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 2.75rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  background: linear-gradient(
    108deg,
    var(--text) 0%,
    color-mix(in srgb, var(--text) 80%, var(--copper) 20%) 52%,
    color-mix(in srgb, var(--project) 42%, var(--text) 58%) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.intro-card__alias {
  display: block;
  margin: 0.25rem 0 0.75rem;
  font-family: var(--font-mono);
  font-size: var(--text-md);
  color: var(--muted);
}

.intro-card__role,
.about-card__role {
  margin: 0 0 1rem;
  font-size: var(--text-lg);
  color: var(--project);
}

.intro-card__lead,
.about-card__bio,
.about-card__list {
  margin: 0 0 1rem;
  font-size: var(--text-md);
  line-height: var(--line-relaxed);
  color: rgba(246, 240, 232, 0.92);
  word-break: keep-all;
  overflow-wrap: break-word;
}

.intro-card__edu {
  margin: 0 0 1.25rem;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.04em;
  color: var(--muted);
}

.intro-card__edu:empty,
.intro-card__edu[hidden] {
  display: none;
  margin: 0;
}

.intro-card__stations {
  margin: 0 0 1.15rem;
}

.intro-card__stations-label {
  margin: 0 0 0.65rem;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.intro-station-chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.intro-station-chip {
  --station-color: var(--dl);

  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0;
  padding: 0.65rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--station-color) 28%, var(--border));
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--station-color) 12%, transparent),
      transparent 62%
    ),
    rgba(6, 10, 18, 0.72);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--station-color) 18%, transparent);
}

.intro-station-chip[data-project="dl"] {
  --station-color: var(--dl);
}
.intro-station-chip[data-project="iot"] {
  --station-color: var(--iot);
}
.intro-station-chip[data-project="ros"] {
  --station-color: var(--ros);
}
.intro-station-chip[data-project="pai"] {
  --station-color: var(--pai);
}

.intro-station-chip__index {
  flex: none;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: color-mix(in srgb, var(--station-color) 85%, var(--muted));
  padding-top: 0.12rem;
}

.intro-station-chip__body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.intro-station-chip__phase {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--station-color);
}

.intro-station-chip__name {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.25;
}

.intro-station-chip__codename {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.intro-card:not(.intro-card--revealed) .intro-card__scroll > * {
  opacity: 0;
  transform: translateY(14px);
}

.intro-card.intro-card--revealed .intro-card__scroll > * {
  animation: intro-card-reveal 0.58s var(--ease-out) both;
}

.intro-card.intro-card--revealed .intro-card__scroll > *:nth-child(1) {
  animation-delay: 0.04s;
}
.intro-card.intro-card--revealed .intro-card__scroll > *:nth-child(2) {
  animation-delay: 0.09s;
}
.intro-card.intro-card--revealed .intro-card__scroll > *:nth-child(3) {
  animation-delay: 0.14s;
}
.intro-card.intro-card--revealed .intro-card__scroll > *:nth-child(4) {
  animation-delay: 0.19s;
}
.intro-card.intro-card--revealed .intro-card__scroll > *:nth-child(5) {
  animation-delay: 0.24s;
}
.intro-card.intro-card--revealed .intro-card__scroll > *:nth-child(6) {
  animation-delay: 0.29s;
}
.intro-card.intro-card--revealed .intro-card__scroll > *:nth-child(7) {
  animation-delay: 0.34s;
}
.intro-card.intro-card--revealed .intro-card__scroll > *:nth-child(8) {
  animation-delay: 0.39s;
}
.intro-card.intro-card--revealed .intro-card__scroll > *:nth-child(9) {
  animation-delay: 0.44s;
}
.intro-card.intro-card--revealed .intro-card__scroll > *:nth-child(10) {
  animation-delay: 0.49s;
}
.intro-card.intro-card--revealed .intro-card__scroll > *:nth-child(11) {
  animation-delay: 0.54s;
}

.intro-card.intro-card--revealed .intro-station-chip {
  animation: intro-chip-pop 0.5s var(--ease-out) both;
  animation-delay: calc(0.38s + var(--chip-i, 0) * 0.055s);
}

@keyframes intro-card-reveal {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes intro-chip-pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .intro-card:not(.intro-card--revealed) .intro-card__scroll > *,
  .intro-card.intro-card--revealed .intro-card__scroll > *,
  .intro-card.intro-card--revealed .intro-station-chip {
    opacity: 1;
    transform: none;
    animation: none !important;
  }
}

.btn--intro-cta {
  padding-inline: 1.65rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  background: linear-gradient(
    132deg,
    color-mix(in srgb, var(--project) 88%, white 12%),
    var(--project) 58%,
    color-mix(in srgb, var(--project) 78%, black 6%)
  );
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--project) 45%, transparent),
    0 10px 32px color-mix(in srgb, var(--project) 22%, transparent);
}

.btn--intro-cta::after {
  content: "→";
  margin-left: 0.45em;
  display: inline-block;
  transition: transform 0.2s var(--ease-out);
}

.btn--intro-cta:hover::after {
  transform: translateX(3px);
}

.intro-lang {
  margin: 0 0 1.25rem;
}

.intro-lang__label {
  margin: 0 0 0.5rem;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.intro-lang__options {
  display: inline-flex;
  gap: 0;
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--copper) 28%, var(--border));
  background: color-mix(in srgb, var(--bg-elevated) 72%, transparent);
  box-shadow: inset 0 1px 0 var(--warm-highlight);
}

.intro-lang__btn {
  padding: 0.45rem 1rem;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  color: rgba(246, 240, 232, 0.7);
  background: transparent;
  border: none;
  border-radius: calc(var(--radius-md) - 3px);
  cursor: pointer;
  transition:
    color 0.15s,
    background 0.15s;
}

.intro-lang__btn:hover {
  color: var(--ink);
}

.intro-lang__btn--active {
  color: var(--ink);
  background: color-mix(in srgb, var(--project) 22%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--project) 42%, transparent);
}

.intro-card__controls {
  margin: 0 0 1.35rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(45, 255, 179, 0.22);
  background: rgba(5, 12, 20, 0.55);
}

.intro-controls__title {
  margin: 0 0 0.75rem;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--project);
}

.intro-controls__row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.35rem 0;
}

.intro-controls__row + .intro-controls__row {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.intro-controls__keys {
  flex: 0 0 auto;
  min-width: 4.5rem;
  padding: 0.28rem 0.55rem;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-align: center;
  color: var(--ink);
  background: rgba(45, 255, 179, 0.14);
  border: 1px solid rgba(45, 255, 179, 0.35);
  border-radius: 6px;
}

.intro-controls__label {
  font-size: var(--text-sm);
  line-height: var(--line-body);
  color: rgba(246, 240, 232, 0.88);
}

.intro-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  pointer-events: auto;
  cursor: pointer;
  border: none;
  border-radius: 999px;
  min-height: var(--touch-min);
  padding: 0.85rem 1.5rem;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.btn--primary {
  background: var(--project);
  color: #0a0c10;
  font-weight: 600;
}

.btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 28px color-mix(in srgb, var(--project) 35%, transparent);
}

.btn--ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.about-card__list {
  margin: 0 0 1.25rem;
  padding-left: 1.25rem;
  font-size: var(--text-md);
  line-height: var(--line-relaxed);
  color: rgba(246, 240, 232, 0.9);
}

.about-card__contact {
  margin: 0 0 0.75rem;
  font-family: var(--font-mono);
  font-size: var(--text-md);
}

.about-card__contact a {
  color: var(--project);
  text-decoration: none;
}

.about-card__art {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

.about-card__art-intro {
  margin: 0 0 0.5rem;
  font-size: var(--text-sm);
  line-height: var(--line-relaxed);
  color: var(--muted);
}

.about-card__art .about-card__link {
  margin-bottom: 0;
}

.about-card__link {
  display: inline-block;
  margin-bottom: 1rem;
  font-size: var(--text-base);
  color: var(--muted);
}

.about-card__thanks {
  margin: 0 0 1rem;
  font-size: var(--text-sm);
  line-height: var(--line-body);
  color: var(--muted);
}

.about-card__gallery-title {
  margin: 1.25rem 0 0.65rem;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.about-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 0 0 1rem;
}

.about-gallery .gallery-item--featured {
  grid-column: 1 / -1;
}

.about-gallery .gallery-item img,
.about-gallery .gallery-item video {
  max-height: 160px;
  object-fit: cover;
}

@media (max-width: 520px) {
  .about-gallery {
    grid-template-columns: 1fr;
  }
}

body.about-mode .ui,
body.detail-mode .ui,
body.journey-mode .ui {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body.maze-mode.ui-menu-open {
  overflow: hidden;
}

/* ── Minimap (maze-mode grid places it — never fixed top-right) ── */
.minimap {
  pointer-events: none;
  padding: 0.55rem;
  border-radius: 4px;
  border: 1px solid color-mix(in srgb, var(--project) 25%, var(--border));
  background: rgba(8, 10, 18, 0.9);
  backdrop-filter: blur(12px);
  box-shadow: var(--neon-glow);
}

.minimap::before {
  content: "MAP";
  display: block;
  font-family: var(--font-game);
  font-size: var(--text-xs);
  letter-spacing: 0.14em;
  color: var(--project);
  margin-bottom: 0.35rem;
  text-align: center;
}

.minimap canvas {
  display: block;
  border-radius: 4px;
}

.minimap__progress {
  margin: 0.35rem 0 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.05em;
  color: var(--muted);
}

body.intro .minimap {
  display: none;
}

body.detail-mode .minimap,
body.about-mode .minimap,
body.journey-mode .minimap {
  opacity: 0;
}

.detail-team {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.04em;
  color: var(--project);
  margin: 0 0 0.85rem;
}

.detail-meta-line {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.03em;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.detail-highlights {
  margin: 0 0 1.25rem;
  padding: 1rem 1.1rem 1rem 1.25rem;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--project) 9%, rgba(8, 12, 18, 0.4));
  border: 1px solid color-mix(in srgb, var(--project) 30%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.detail-bullets {
  margin: 0;
  padding: 0 0 0 1.15rem;
  list-style: none;
}

.detail-bullets li {
  position: relative;
  margin: 0 0 0.65rem;
  padding-left: 0.15rem;
  line-height: var(--line-relaxed);
  font-size: var(--text-md);
}

.detail-bullets li:last-child {
  margin-bottom: 0;
}

.detail-bullets li::before {
  content: "";
  position: absolute;
  left: -1rem;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-teal);
  box-shadow: 0 0 8px var(--accent-teal);
}

.detail-bullets--highlights li {
  font-weight: 500;
  color: var(--text-primary);
}

.detail-bullets--highlights li::before {
  width: 7px;
  height: 7px;
  background: var(--project);
  box-shadow: 0 0 10px color-mix(in srgb, var(--project) 65%, transparent);
}

.detail-bullets--role li {
  color: var(--text-secondary);
}

.detail-summary {
  font-size: var(--text-lg);
  line-height: var(--line-relaxed);
  margin: 0 0 1.5rem;
  color: rgba(246, 240, 232, 0.92);
  max-width: 52rem;
}

.detail-summary--brief {
  margin: 0 0 1.35rem;
}

.detail-section--why {
  padding-left: 0.85rem;
  border-left: 3px solid color-mix(in srgb, var(--project) 55%, var(--accent-magenta));
  margin-bottom: 1.5rem;
}

.detail-why {
  margin: 0;
  font-size: var(--text-md);
  line-height: var(--line-relaxed);
  color: var(--text-secondary);
  max-width: 52rem;
}

.detail-section--my-work {
  margin: 0 0 1.75rem;
  padding: 1rem 1.1rem 1rem 1.25rem;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--project) 9%, rgba(8, 12, 18, 0.4));
  border: 1px solid color-mix(in srgb, var(--project) 32%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.detail-bullets--my-work li {
  font-weight: 600;
  color: var(--text-primary);
}

.detail-bullets--my-work li::before {
  width: 7px;
  height: 7px;
  background: var(--project);
  box-shadow: 0 0 10px color-mix(in srgb, var(--project) 65%, transparent);
}

.key-concept {
  color: color-mix(in srgb, var(--project) 72%, #fff);
  background: color-mix(in srgb, var(--project) 16%, transparent);
  padding: 0.06em 0.32em;
  border-radius: 4px;
  font-weight: 600;
  font-style: normal;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  word-break: keep-all;
  overflow-wrap: normal;
}

.about-card__bio .key-concept,
.about-card__list .key-concept,
.about-card__art-intro .key-concept,
.intro-card__lead .key-concept,
.intro-controls__touch .key-concept,
.hero__tagline .key-concept,
.quest-banner .key-concept,
.journey-card__subtitle .key-concept,
.journey-card__bootcamp .key-concept,
.journey-card__manifesto .key-concept,
.journey-card__scroll-hint .key-concept,
.journey-timeline__summary .key-concept,
.journey-timeline__role .key-concept,
.journey-timeline__learned .key-concept,
.journey-chips .key-concept,
.detail-meta-line .key-concept,
.detail-team .key-concept,
.detail-subtitle .key-concept,
.detail-bullets--highlights .key-concept,
.skill-group .key-concept {
  background: color-mix(in srgb, var(--project) 22%, transparent);
}

.detail-prose {
  margin: 0;
  line-height: var(--line-relaxed);
  color: rgba(246, 240, 232, 0.9);
  font-size: var(--text-md);
  max-width: 52rem;
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
}

.skill-group {
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(8, 10, 16, 0.45);
}

.skill-group h3 {
  margin: 0 0 0.5rem;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--project);
}

.skill-group ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.45rem;
}

.skill-group li {
  font-size: var(--text-base);
  line-height: var(--line-body);
  color: rgba(246, 240, 232, 0.88);
}

.obstacle-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.obstacle-card {
  padding: 0.9rem 1rem;
  border-left: 2px solid var(--project);
  background: rgba(14, 18, 28, 0.55);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.obstacle-card h3 {
  margin: 0 0 0.4rem;
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text);
}

.obstacle-card p {
  margin: 0;
  font-size: var(--text-base);
  line-height: var(--line-relaxed);
  color: rgba(246, 240, 232, 0.88);
}

.detail-list--dense {
  gap: 0.45rem;
}

.detail-list--dense li {
  font-size: var(--text-base);
}

.detail-section {
  margin-bottom: 1.75rem;
  animation: rise 0.6s var(--ease-out) both;
  content-visibility: auto;
  contain-intrinsic-size: auto 12rem;
}

.detail-section:nth-child(3) {
  animation-delay: 0.05s;
}
.detail-section:nth-child(4) {
  animation-delay: 0.1s;
}
.detail-section:nth-child(5) {
  animation-delay: 0.15s;
}

.detail-content h2 {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--project);
  margin: 0 0 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.detail-content h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

.detail-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.detail-list li {
  position: relative;
  padding-left: 1.15rem;
  line-height: var(--line-relaxed);
  color: rgba(246, 240, 232, 0.9);
  font-size: var(--text-md);
}

.detail-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: var(--project);
  transform: rotate(45deg);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.tag {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  letter-spacing: 0.02em;
  transition:
    border-color 0.2s,
    color 0.2s;
}

.tag:hover {
  border-color: color-mix(in srgb, var(--project) 50%, var(--border));
  color: var(--text);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.85rem;
}

.gallery-item {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #050608;
  transition:
    transform 0.35s var(--ease-out),
    border-color 0.35s,
    box-shadow 0.35s;
}

.gallery-item:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.gallery-item--featured {
  grid-column: 1 / -1;
}

.gallery-item--broken video {
  display: none;
}

.gallery-item--featured img,
.gallery-item--featured video {
  max-height: 22rem;
  object-fit: contain;
}

.gallery-item--gif img {
  image-rendering: auto;
}

.gallery-item img,
.gallery-item video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.gallery-item figcaption {
  padding: 0.75rem 0.9rem;
  font-size: var(--text-sm);
  line-height: var(--line-body);
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.gallery-item--image,
.gallery-item--gif,
.gallery-item--video {
  cursor: zoom-in;
  position: relative;
}

.gallery-item--image::after,
.gallery-item--gif::after {
  content: "⤢";
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 1.55rem;
  height: 1.55rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  background: rgba(6, 10, 16, 0.72);
  color: #fff;
  font-size: 0.82rem;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}

.gallery-item--image:hover::after,
.gallery-item--gif:hover::after {
  opacity: 1;
}

.gallery-item__play {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 10, 16, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  font-size: 0.95rem;
  pointer-events: none;
  transition:
    transform 0.25s,
    background 0.25s;
}

.gallery-item--video:hover .gallery-item__play {
  transform: translate(-50%, -50%) scale(1.12);
  background: rgba(20, 26, 36, 0.9);
}

/* ── Lightbox ── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: clamp(1rem, 4vw, 3rem);
  background: rgba(4, 6, 10, 0.93);
  backdrop-filter: blur(14px);
  animation: lightbox-in 0.25s var(--ease-out);
}

.lightbox[hidden] {
  display: none;
}

@keyframes lightbox-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.lightbox__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: min(96vw, 1400px);
  max-height: 82vh;
}

.lightbox__stage img,
.lightbox__stage video {
  max-width: min(96vw, 1400px);
  max-height: 82vh;
  width: auto;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.lightbox__caption {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-md);
  letter-spacing: 0.02em;
  line-height: var(--line-body);
  color: rgba(246, 240, 232, 0.92);
  text-align: center;
  max-width: 60ch;
}

.lightbox__close {
  position: absolute;
  top: clamp(0.8rem, 2vw, 1.5rem);
  right: clamp(0.8rem, 2vw, 1.5rem);
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: rgba(10, 14, 20, 0.82);
  color: #fff;
  font-size: 1.05rem;
  cursor: pointer;
  transition:
    transform 0.2s,
    background 0.2s;
}

.lightbox__close:hover {
  transform: scale(1.08);
  background: rgba(22, 28, 38, 0.95);
}

/* ── Cutscene (project entry transition) ── */
.cutscene {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  overflow: hidden;
}

.cutscene[hidden] {
  display: none;
}

body.cutscene-mode #orbit-ui {
  pointer-events: none;
}

.cutscene__bar {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      circle at 50% 45%,
      color-mix(in srgb, var(--project) 42%, transparent),
      transparent 62%
    ),
    rgba(4, 6, 10, 0.96);
  opacity: 0;
}

.cutscene__content {
  position: relative;
  text-align: center;
  opacity: 0;
  transform: translateY(24px);
  padding: 1rem 2rem;
}

.cutscene__phase {
  margin: 0 0 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--project);
}

.cutscene__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2.2rem, 7vw, 4.5rem);
  letter-spacing: -0.03em;
  color: #fff;
  text-shadow: 0 0 40px color-mix(in srgb, var(--project) 65%, transparent);
}

.cutscene__rule {
  margin: 1rem auto 0;
  width: 0;
  height: 2px;
  background: var(--project);
  box-shadow: 0 0 14px var(--project);
}

.cutscene--in .cutscene__bar {
  animation: cs-bar 0.85s var(--ease-out) forwards;
}
.cutscene--in .cutscene__content {
  animation: cs-content 0.85s var(--ease-out) forwards;
}
.cutscene--in .cutscene__rule {
  animation: cs-rule 0.85s var(--ease-out) forwards;
}
.cutscene--out {
  animation: cs-out 0.35s ease forwards;
}

@keyframes cs-bar {
  0% {
    opacity: 0;
    transform: scale(1.15);
  }
  35% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes cs-content {
  0% {
    opacity: 0;
    transform: translateY(24px);
  }
  45% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes cs-rule {
  0%,
  30% {
    width: 0;
  }
  100% {
    width: 200px;
  }
}
@keyframes cs-out {
  to {
    opacity: 0;
  }
}

.detail-section--links {
  scroll-margin-top: 1rem;
  padding-bottom: 0.25rem;
}

.detail-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.detail-section--links .panel-repo {
  margin-top: 0;
}

.panel-repo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  min-height: var(--touch-min);
  padding: 0.75rem 1.25rem;
  border: 1px solid color-mix(in srgb, var(--project) 45%, var(--border));
  border-radius: var(--radius-sm);
  color: var(--project);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.03em;
  text-decoration: none;
  transition:
    background 0.25s,
    transform 0.25s;
}

.panel-repo:hover {
  background: color-mix(in srgb, var(--project) 10%, transparent);
  transform: translateX(4px);
}

/* Detail: 모바일·태블릿 너비에서만 3D 토글·단일열 (높이만 짧은 데스크톱은 제외) */
@media (max-width: 768px) {
  body.detail-mode .detail-3d-toggle {
    display: inline-flex;
  }

  body.detail-mode.detail-hide-3d .detail-visual {
    display: none;
  }

  body.detail-mode.detail-hide-3d .detail-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
  }

  body.detail-mode .detail__watermark {
    display: none;
  }

  body.detail-mode .detail-scroll-hint {
    bottom: calc(0.75rem + var(--safe-bottom));
  }
}

/* 태블릿 이하 너비에서만 상하 스택 — 넓은 창은 열 유지 */
@media (max-width: 1024px) {
  .detail-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, min(32vh, 260px)) minmax(0, 1fr);
  }

  .detail-visual {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: min(32vh, 260px);
    flex-shrink: 0;
  }

  .detail-visual__frame {
    margin: 0.65rem 0.75rem 0.5rem;
    min-height: 0;
    max-height: 100%;
    height: 100%;
    flex: 1 1 auto;
  }

  .detail-visual__caption {
    margin: 0 0.75rem 0.5rem;
    font-size: 0.7rem;
  }

  .detail__watermark {
    font-size: 6rem;
  }
}

/* 데스크톱 + 짧은 창: 2열 유지, 3D 프레임 높이만 축소 */
@media (min-width: 1025px) and (max-height: 720px) {
  .detail-visual__frame {
    max-height: min(38vh, 360px);
  }
}

@media (max-width: 600px) {
  html {
    font-size: clamp(15px, calc(14px + 0.5vw), 16.5px);
  }

  body:not(.maze-mode) .hero {
    display: none;
  }
  .top-bar {
    padding: 0.85rem 1rem;
  }

  body.maze-mode .mobile-controls {
    bottom: calc(0.55rem + var(--safe-bottom));
    padding: 1.35rem calc(0.65rem + var(--safe-right)) 0.55rem calc(0.65rem + var(--safe-left));
    background: linear-gradient(
      180deg,
      transparent 0%,
      rgba(6, 8, 12, 0.42) 38%,
      rgba(6, 8, 12, 0.72) 100%
    );
  }

  .overlay {
    align-items: flex-start;
    padding: max(0.65rem, var(--safe-top)) max(0.65rem, var(--safe-right))
      max(0.65rem, var(--safe-bottom)) max(0.65rem, var(--safe-left));
  }

  .overlay__card {
    padding: 1.35rem 1.15rem;
    max-height: min(calc(var(--app-height) * 0.94), 100%);
  }

  .intro-card.overlay__card {
    padding: 0;
    max-height: min(calc(var(--app-height) * 0.94), 100%);
  }

  .intro-card__scroll {
    padding: 1.35rem 1.15rem;
  }

  .intro-card__title,
  .about-card__title {
    font-size: clamp(1.65rem, 7.5vw, 2.35rem);
  }

  .intro-station-chips {
    grid-template-columns: 1fr;
  }

  .intro-card__actions {
    flex-direction: column;
    gap: 0.55rem;
  }

  .intro-card__actions .btn {
    width: 100%;
    min-height: var(--touch-min);
  }

  .detail-top {
    padding: 0.75rem 1rem;
  }
  .detail-meta h1 {
    font-size: clamp(1.35rem, 7vw, 2rem);
  }
  .detail-body {
    grid-template-rows: minmax(0, min(28vh, 200px)) minmax(0, 1fr);
  }

  .detail-visual {
    max-height: min(28vh, 200px);
  }

  .detail-visual__frame {
    margin: 0.5rem 0.65rem 0.35rem;
  }

  .detail-content {
    padding: 1rem 0.85rem calc(2.5rem + var(--safe-bottom));
    overscroll-behavior: contain;
  }

  .detail-back,
  .detail-3d-toggle {
    min-height: var(--touch-min);
    min-width: var(--touch-min);
  }

  .skill-grid {
    grid-template-columns: 1fr;
  }

  .gallery {
    grid-template-columns: 1fr;
  }
  .visual-aids {
    grid-template-columns: 1fr;
  }

  .about-card.overlay__card,
  .about-overlay .overlay__card,
  .journey-card.overlay__card,
  .journey-overlay .overlay__card {
    max-width: 100%;
    max-height: min(100dvh, 100%);
  }

  .journey-card__scroll {
    padding: 1.15rem 1rem 0.5rem;
  }

  .journey-card__scroll-hint {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .journey-card__actions {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .journey-card__title {
    font-size: clamp(1.65rem, 7.5vw, 2.35rem);
  }
}

/* 짧은 창 — 미로·오버레이 공통 (너비 무관) */
@media (max-height: 560px) {
  body:not(.maze-mode) .hero {
    display: none;
  }
  .hud {
    display: none;
  }
  .overlay {
    padding: 0.5rem;
    align-items: flex-start;
  }

  body.maze-mode:not(.maze-menu-chrome) .minimap {
    display: none;
  }

  body.maze-mode.maze-menu-chrome .minimap {
    width: clamp(4.75rem, 22vw, 6.5rem);
  }

  body.maze-mode .quest-banner {
    padding: 0.35rem 0.6rem;
  }
}

/* 짧은 창 + 좁은 너비에서만 디테일 스택 행 높이 조정 */
@media (max-width: 1024px) and (max-height: 560px) {
  .detail-body {
    grid-template-rows: minmax(0, min(24vh, 140px)) minmax(0, 1fr);
  }

  .detail-visual {
    max-height: min(24vh, 140px);
  }

  .detail-top {
    padding: 0.55rem 0.85rem;
  }

  .detail-meta h1 {
    font-size: 1.25rem;
  }

  .detail-subtitle {
    font-size: var(--text-sm);
  }
}

@media (max-height: 480px) and (max-width: 900px) {
  body.maze-mode .timeline-btn .phase__name {
    font-size: 0.8rem;
  }
}

/* Overlays never overflow a small or short window. */
.overlay__card:not(.intro-card) {
  max-height: min(92dvh, 92vh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.intro-controls__touch {
  margin: 0.85rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
  font-size: var(--text-sm);
  line-height: var(--line-relaxed);
  color: var(--muted);
}

/* Mobile maze controls */
.mobile-controls {
  position: fixed;
  left: var(--viewport-offset-left);
  width: var(--app-width);
  right: auto;
  bottom: calc(clamp(5.5rem, 18vmin, 8.25rem) + var(--safe-bottom));
  z-index: 11;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0 calc(0.85rem + var(--safe-right)) 0.5rem calc(0.85rem + var(--safe-left));
  pointer-events: none;
  touch-action: manipulation;
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  transition:
    opacity 0.28s ease,
    transform 0.34s var(--ease-out),
    visibility 0.34s;
}

body.maze-mode.ui-menu-open .mobile-controls,
.mobile-controls.mobile-controls--suppressed {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate3d(0, 110%, 0) scale(0.94);
  z-index: 1;
}

body.maze-mode.ui-menu-open .mobile-controls .mobile-joystick,
body.maze-mode.ui-menu-open .mobile-controls .mobile-actions,
.mobile-controls.mobile-controls--suppressed .mobile-joystick,
.mobile-controls.mobile-controls--suppressed .mobile-actions,
.mobile-controls.mobile-controls--suppressed .mobile-btn {
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .mobile-controls {
    transition: none;
  }
}

@media (min-width: 720px) and (max-width: 900px) {
  body.maze-mode .mobile-controls {
    bottom: calc(7rem + var(--safe-bottom));
  }
}

body.maze-mode.touch-ui .top-bar__status {
  width: fit-content;
  max-width: min(48vw, 9.5rem);
}

body.maze-mode.touch-ui .top-bar__status-progress {
  display: inline;
  flex-basis: auto;
  width: auto;
}

.mobile-controls[hidden] {
  display: none !important;
}

.mobile-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  pointer-events: auto;
}

.mobile-joystick,
.mobile-btn {
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.mobile-joystick {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0;
}

.mobile-control-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.1;
  color: color-mix(in srgb, var(--text) 88%, var(--project) 12%);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  user-select: none;
}

.mobile-joystick__base {
  position: relative;
  width: clamp(6.25rem, calc(5.5rem + 14vmin), 7.35rem);
  height: clamp(6.25rem, calc(5.5rem + 14vmin), 7.35rem);
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--project) 58%, var(--border));
  background: color-mix(in srgb, rgba(12, 16, 24, 0.88) 82%, var(--project) 18%);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--text) 10%, transparent),
    0 0 0 1px rgba(0, 0, 0, 0.35),
    0 10px 28px rgba(0, 0, 0, 0.45),
    0 0 22px color-mix(in srgb, var(--project) 22%, transparent);
  backdrop-filter: blur(10px);
}

.mobile-joystick__base::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 38%;
  height: 38%;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--project) 16%, transparent);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.mobile-joystick__base::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  background:
    linear-gradient(
      to right,
      transparent calc(50% - 0.5px),
      color-mix(in srgb, var(--project) 42%, transparent) calc(50% - 0.5px),
      color-mix(in srgb, var(--project) 42%, transparent) calc(50% + 0.5px),
      transparent calc(50% + 0.5px)
    ),
    linear-gradient(
      to bottom,
      transparent calc(50% - 0.5px),
      color-mix(in srgb, var(--project) 42%, transparent) calc(50% - 0.5px),
      color-mix(in srgb, var(--project) 42%, transparent) calc(50% + 0.5px),
      transparent calc(50% + 0.5px)
    );
  opacity: 0.52;
}

.mobile-joystick__dir {
  position: absolute;
  z-index: 1;
  font-size: 0.62rem;
  line-height: 1;
  color: color-mix(in srgb, var(--project) 78%, #fff 22%);
  opacity: 0.82;
  pointer-events: none;
  text-shadow: 0 0 10px color-mix(in srgb, var(--project) 55%, transparent);
}

.mobile-joystick__dir--n {
  top: 0.55rem;
  left: 50%;
  transform: translateX(-50%);
}

.mobile-joystick__dir--s {
  bottom: 0.55rem;
  left: 50%;
  transform: translateX(-50%);
}

.mobile-joystick__dir--e {
  right: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
}

.mobile-joystick__dir--w {
  left: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
}

.mobile-joystick__thumb {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: clamp(2.35rem, calc(2rem + 4.5vmin), 2.75rem);
  height: clamp(2.35rem, calc(2rem + 4.5vmin), 2.75rem);
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--project) 62%, var(--border));
  background: color-mix(in srgb, var(--surface-strong) 72%, var(--project) 28%);
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.42),
    0 0 16px color-mix(in srgb, var(--project) 28%, transparent);
  transform: translate(-50%, -50%);
  transition:
    background 0.12s ease,
    border-color 0.12s ease;
  will-change: transform;
}

.mobile-joystick--active .mobile-joystick__thumb {
  background: color-mix(in srgb, var(--surface-strong) 72%, var(--project) 28%);
  border-color: color-mix(in srgb, var(--project) 55%, var(--border));
}

.mobile-btn:active {
  background: color-mix(in srgb, var(--project) 28%, var(--surface-strong));
  transform: scale(0.96);
}

.mobile-btn--sprint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.1rem;
  min-height: 3.1rem;
  padding: 0;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--copper) 45%, var(--border));
  background: rgba(12, 16, 24, 0.72);
  color: var(--copper);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(10px);
}

.mobile-sprint-icon {
  display: block;
  width: 1.45rem;
  height: 1.45rem;
}

.mobile-sprint-icon__head,
.mobile-sprint-icon__runner {
  fill: currentColor;
}

.mobile-sprint-icon__runner {
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--copper) 45%, transparent));
}

.mobile-sprint-icon__motion {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  opacity: 0.72;
}

.mobile-btn--sprint-active {
  background: color-mix(in srgb, var(--copper) 24%, rgba(12, 16, 24, 0.88));
  border-color: color-mix(in srgb, var(--copper) 65%, var(--border));
  color: #fff2d6;
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.34),
    0 0 14px color-mix(in srgb, var(--copper) 35%, transparent);
}

.mobile-btn--sprint-active .mobile-sprint-icon__runner {
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--copper) 65%, transparent));
}

.mobile-btn--sprint-active .mobile-sprint-icon__motion {
  opacity: 1;
}

.mobile-btn--interact {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-width: 4.35rem;
  min-height: 4.35rem;
  padding: 0.35rem 0.45rem 0.42rem;
  border-radius: 1rem;
  border: 2px solid color-mix(in srgb, var(--project) 58%, var(--border));
  background: color-mix(in srgb, rgba(12, 16, 24, 0.9) 78%, var(--project) 22%);
  color: var(--text);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.35),
    0 10px 28px rgba(0, 0, 0, 0.45),
    0 0 18px color-mix(in srgb, var(--project) 18%, transparent);
  backdrop-filter: blur(10px);
}

.mobile-btn__key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.15rem;
  min-height: 2.15rem;
  padding: 0 0.35rem;
  border-radius: 0.55rem;
  border: 1px solid color-mix(in srgb, var(--project) 55%, var(--border-strong, var(--border)));
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--surface-strong) 88%, #fff 12%) 0%,
    color-mix(in srgb, var(--surface-strong) 72%, var(--project) 28%) 100%
  );
  font-family: var(--font-game);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 3px 10px rgba(0, 0, 0, 0.38);
}

.mobile-btn--interact .mobile-control-label {
  font-size: 0.58rem;
  letter-spacing: 0.12em;
}

.mobile-btn--interact-ready {
  border-color: color-mix(in srgb, var(--project) 82%, #fff 18%);
  background: color-mix(in srgb, rgba(12, 16, 24, 0.82) 62%, var(--project) 38%);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--project) 35%, transparent),
    0 10px 28px rgba(0, 0, 0, 0.45),
    0 0 24px color-mix(in srgb, var(--project) 42%, transparent);
  animation: mobile-interact-pulse 1.35s ease-in-out infinite;
}

.mobile-btn--interact-ready .mobile-btn__key {
  border-color: color-mix(in srgb, var(--project) 75%, #fff 25%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 0 14px color-mix(in srgb, var(--project) 45%, transparent);
}

@keyframes mobile-interact-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.04);
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-btn--interact-ready {
    animation: none;
  }
}

@media (max-width: 719px) {
  .mobile-joystick__base {
    width: 6.75rem;
    height: 6.75rem;
  }

  .mobile-joystick__thumb {
    width: 2.55rem;
    height: 2.55rem;
  }

  .mobile-btn--sprint {
    min-width: 2.9rem;
    min-height: 2.9rem;
  }

  .mobile-sprint-icon {
    width: 1.3rem;
    height: 1.3rem;
  }

  .mobile-btn--interact {
    min-width: 4.05rem;
    min-height: 4.05rem;
  }

  .mobile-btn__key {
    min-width: 2rem;
    min-height: 2rem;
    font-size: 0.98rem;
  }
}

.boot-error {
  position: fixed;
  left: 50%;
  bottom: 2rem;
  z-index: 50;
  transform: translateX(-50%);
  margin: 0;
  padding: 0.9rem 1.35rem;
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--line-body);
}

/* ── Journey overlay (exit slide) ── */
.journey-overlay {
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(232, 168, 73, 0.14), transparent 55%),
    radial-gradient(ellipse 80% 60% at 100% 100%, rgba(155, 123, 255, 0.1), transparent 50%),
    rgba(6, 8, 12, 0.92);
}

.journey-card.overlay__card,
.journey-overlay .overlay__card {
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: min(920px, 96vw);
  max-height: min(92vh, 920px);
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--copper) 22%, var(--border));
  background: linear-gradient(
    165deg,
    rgba(22, 28, 42, 0.97) 0%,
    rgba(12, 16, 26, 0.98) 55%,
    rgba(10, 12, 20, 0.99) 100%
  );
  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 248, 235, 0.06);
  overflow: hidden;
}

.journey-card__fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.journey-card__glow {
  position: absolute;
  inset: -40% -20% auto;
  height: 55%;
  background: radial-gradient(ellipse at 50% 0%, rgba(232, 168, 73, 0.22), transparent 68%);
  opacity: 0.85;
}

.journey-card__scan {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(255, 248, 235, 0.018) 3px,
    rgba(255, 248, 235, 0.018) 4px
  );
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.35), transparent 70%);
}

.journey-exit__masthead {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 0 1rem;
  padding: 0.65rem 0 0.85rem;
  border-bottom: 1px solid color-mix(in srgb, var(--copper) 18%, var(--border));
  background: color-mix(in srgb, rgba(12, 16, 26, 0.98) 92%, transparent);
  backdrop-filter: blur(8px);
}

.journey-card__scroll-hint {
  position: relative;
  z-index: 1;
  flex: none;
  margin: 0.55rem 0 0;
  padding: 0.65rem 0.9rem;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
  line-height: 1.5;
  color: rgba(246, 240, 232, 0.95);
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--copper) 28%, var(--border));
  background: color-mix(in srgb, var(--copper) 10%, rgba(8, 12, 20, 0.75));
  word-break: keep-all;
  overflow-wrap: break-word;
}

.journey-card__scroll {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: clamp(1.5rem, 3.5vw, 2.35rem);
  padding-top: 0.35rem;
}

.journey-card__header {
  position: relative;
  margin-bottom: 1.35rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid color-mix(in srgb, var(--copper) 18%, var(--border));
}

.journey-card__eyebrow {
  margin: 0 0 0.45rem;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--copper);
}

.journey-card__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 5.5vw, 2.65rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.journey-card__subtitle {
  margin: 0.55rem 0 0;
  max-width: min(68ch, 100%);
  font-size: var(--text-md);
  line-height: var(--line-relaxed);
  color: var(--muted);
  word-break: keep-all;
  overflow-wrap: break-word;
}

.journey-card__bootcamp {
  margin: 0.85rem 0 0;
  max-width: min(72ch, 100%);
  padding: 0.75rem 0.9rem;
  font-size: var(--text-sm);
  line-height: var(--line-relaxed);
  color: rgba(246, 240, 232, 0.92);
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--copper) 22%, var(--border));
  background: color-mix(in srgb, var(--copper) 6%, rgba(10, 14, 22, 0.65));
  word-break: keep-all;
  overflow-wrap: break-word;
}

.journey-section {
  position: relative;
  margin-bottom: 1.35rem;
}

.journey-section__title,
.journey-horizon__title {
  margin: 0 0 0.85rem;
  font-family: var(--font-game);
  font-size: var(--text-sm);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--copper) 70%, var(--text));
}

.journey-timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 0.35rem;
  display: grid;
  gap: 0;
}

.journey-timeline__item {
  --milestone-color: var(--dl);

  position: relative;
  display: grid;
  grid-template-columns: 1.35rem 1fr;
  gap: 0 1rem;
  padding: 0 0 1.15rem;
}

.journey-timeline__item:last-child {
  padding-bottom: 0;
}

.journey-timeline__item::before {
  content: "";
  position: absolute;
  left: 0.62rem;
  top: 1.1rem;
  bottom: 0;
  width: 2px;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--milestone-color) 55%, transparent),
    color-mix(in srgb, var(--milestone-color) 12%, transparent)
  );
}

.journey-timeline__item:last-child::before {
  display: none;
}

.journey-timeline__node {
  position: relative;
  z-index: 1;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.35rem;
  border-radius: 50%;
  border: 2px solid var(--milestone-color);
  background: color-mix(in srgb, var(--milestone-color) 22%, var(--bg));
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--milestone-color) 14%, transparent),
    0 0 18px color-mix(in srgb, var(--milestone-color) 35%, transparent);
}

.journey-timeline__body {
  min-width: 0;
  padding: 0.15rem 0.85rem 0.65rem;
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--milestone-color) 18%, var(--border));
  background: color-mix(in srgb, var(--milestone-color) 6%, rgba(10, 14, 22, 0.72));
  transition:
    border-color 0.25s var(--ease-out),
    transform 0.25s var(--ease-out),
    box-shadow 0.25s var(--ease-out);
}

.journey-timeline__item:hover .journey-timeline__body,
.journey-timeline__item:focus-within .journey-timeline__body {
  border-color: color-mix(in srgb, var(--milestone-color) 42%, var(--border));
  box-shadow: 0 8px 28px color-mix(in srgb, var(--milestone-color) 16%, transparent);
  transform: translateX(2px);
}

.journey-timeline__phase {
  display: inline-block;
  margin-bottom: 0.2rem;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--milestone-color);
}

.journey-timeline__name {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.journey-timeline__date {
  display: block;
  margin: 0.15rem 0 0.35rem;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  color: var(--muted);
}

.journey-timeline__summary,
.journey-timeline__role {
  margin: 0;
  font-size: var(--text-sm);
  line-height: var(--line-relaxed);
  color: rgba(246, 240, 232, 0.9);
  word-break: keep-all;
  overflow-wrap: break-word;
}

.journey-timeline__role {
  margin-top: 0.45rem;
}

.journey-timeline__learned {
  margin: 0.55rem 0 0;
  padding-top: 0.5rem;
  border-top: 1px solid color-mix(in srgb, var(--milestone-color) 16%, transparent);
  font-size: var(--text-xs);
  line-height: var(--line-relaxed);
  color: color-mix(in srgb, var(--milestone-color) 55%, var(--muted));
  word-break: keep-all;
  overflow-wrap: break-word;
}

.journey-timeline__learned-label {
  display: block;
  margin-bottom: 0.2rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--milestone-color);
}

.journey-timeline__item[data-project="dl"] {
  --milestone-color: var(--dl);
}
.journey-timeline__item[data-project="iot"] {
  --milestone-color: var(--iot);
}
.journey-timeline__item[data-project="ros"] {
  --milestone-color: var(--ros);
}
.journey-timeline__item[data-project="pai"] {
  --milestone-color: var(--pai);
}

.journey-chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.journey-chips li {
  flex: 1 1 14rem;
  margin: 0;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--copper) 16%, var(--border));
  word-break: keep-all;
  overflow-wrap: break-word;
  background: rgba(8, 12, 20, 0.55);
  font-size: var(--text-sm);
  line-height: var(--line-relaxed);
  color: rgba(246, 240, 232, 0.92);
}

.journey-horizon {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.journey-horizon__col {
  padding: 1rem 1.05rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(8, 12, 20, 0.45);
}

.journey-horizon__col--present {
  border-color: color-mix(in srgb, var(--copper) 28%, var(--border));
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--copper) 8%, transparent),
    rgba(8, 12, 20, 0.5)
  );
}

.journey-horizon__col--future {
  border-color: color-mix(in srgb, var(--pai) 28%, var(--border));
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--pai) 8%, transparent),
    rgba(8, 12, 20, 0.5)
  );
}

.journey-horizon__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.journey-horizon__list li {
  position: relative;
  margin: 0;
  padding-left: 1rem;
  font-size: var(--text-sm);
  line-height: var(--line-relaxed);
  color: rgba(246, 240, 232, 0.9);
}

.journey-horizon__list li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--copper);
  font-size: 0.75em;
}

.journey-horizon__col--future .journey-horizon__list li::before {
  color: var(--pai);
}

.journey-timeline__role {
  margin: 0.45rem 0 0;
  font-size: var(--text-xs);
  line-height: var(--line-relaxed);
  color: rgba(246, 240, 232, 0.88);
}

.journey-timeline__links {
  margin: 0.4rem 0 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
}

.journey-timeline__link {
  color: var(--copper);
  text-decoration: none;
}

.journey-timeline__link:hover {
  text-decoration: underline;
}

.journey-sources {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.journey-sources__link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--text-sm);
  color: var(--copper);
  text-decoration: none;
}

.journey-sources__link:hover {
  text-decoration: underline;
}

.journey-exit__block {
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid color-mix(in srgb, var(--copper) 22%, var(--border));
}

.journey-exit__block:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.journey-exit__block-title {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 5vw, 2.15rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
}

.journey-section--about {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.journey-section--log {
  padding-top: 0.25rem;
}

.journey-about .about-card__title {
  font-size: clamp(1.45rem, 4.5vw, 2rem);
}

.journey-about .about-card__gallery-title {
  margin: 1rem 0 0.65rem;
  font-family: var(--font-game);
  font-size: var(--text-sm);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--copper) 70%, var(--text));
}

body.journey-mode .journey-exit__masthead {
  animation-delay: 0s;
}

body.journey-mode .journey-section--about {
  animation-delay: 0.06s;
}

body.journey-mode .journey-section--log {
  animation-delay: 0.14s;
}

.journey-card__actions {
  position: relative;
  z-index: 2;
  flex: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: stretch;
  padding: 0.85rem clamp(1.5rem, 3.5vw, 2.35rem) clamp(1.1rem, 2.5vw, 1.35rem);
  border-top: 1px solid color-mix(in srgb, var(--copper) 14%, var(--border));
  background: color-mix(in srgb, rgba(12, 16, 26, 0.98) 88%, transparent);
}

.journey-card__actions .btn--primary {
  flex: 1 1 100%;
  min-width: 100%;
  min-height: 3.25rem;
  font-size: var(--text-md);
  letter-spacing: 0.02em;
  text-transform: none;
}

body.journey-mode .journey-card > * {
  animation: journey-reveal 0.65s var(--ease-out) both;
}

body.journey-mode .journey-section--timeline {
  animation-delay: 0.18s;
}
body.journey-mode .journey-section--learned {
  animation-delay: 0.22s;
}
body.journey-mode .journey-horizon {
  animation-delay: 0.26s;
}
body.journey-mode .journey-card__actions {
  animation-delay: 0.3s;
}

@keyframes journey-reveal {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  .journey-horizon {
    grid-template-columns: 1fr;
  }

  .journey-card__actions {
    flex-direction: column-reverse;
  }

  .journey-card__actions .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Easy-read mode (senior-friendly typography & touch) ── */
body.easy-read {
  --line-relaxed: 1.75;
}

body.easy-read .intro-controls__title {
  font-size: var(--text-sm);
  letter-spacing: 0.08em;
}

body.easy-read .intro-controls__keys {
  min-width: 5.5rem;
  padding: 0.45rem 0.7rem;
  font-size: var(--text-sm);
}

body.easy-read .intro-controls__label {
  font-size: var(--text-md);
  line-height: var(--line-relaxed);
}

body.easy-read .intro-controls__row {
  padding: 0.55rem 0;
}

body.easy-read .intro-card__lead,
body.easy-read .intro-card__touch {
  font-size: var(--text-md);
  line-height: var(--line-relaxed);
}

body.easy-read .btn {
  min-height: 3.1rem;
  font-size: var(--text-md);
}

body.easy-read .btn--primary {
  text-transform: none;
  letter-spacing: 0.02em;
}

body.easy-read.maze-mode .quest-banner {
  font-size: var(--text-md);
  line-height: 1.55;
  padding: 1rem 1.35rem;
  max-width: min(94vw, 32rem);
}

body.easy-read.journey-mode .journey-card__eyebrow {
  font-size: var(--text-md);
  letter-spacing: 0.1em;
}

body.easy-read.journey-mode .journey-card__scroll-hint {
  font-size: var(--text-md);
  padding: 0.85rem 1rem;
}

body.easy-read.journey-mode .journey-exit__block-title {
  font-size: clamp(1.75rem, 5.5vw, 2.35rem);
}

body.easy-read.journey-mode .journey-card__subtitle,
body.easy-read.journey-mode .journey-card__bootcamp,
body.easy-read.journey-mode .journey-timeline__summary,
body.easy-read.journey-mode .journey-chips li,
body.easy-read.journey-mode .journey-horizon__list li,
body.easy-read.journey-mode .about-card__bio,
body.easy-read.journey-mode .about-card__list {
  font-size: var(--text-md);
  line-height: var(--line-relaxed);
}

body.easy-read.journey-mode .journey-section__title,
body.easy-read.journey-mode .journey-horizon__title {
  font-size: var(--text-md);
  letter-spacing: 0.08em;
}

body.easy-read.journey-mode .journey-timeline__name {
  font-size: clamp(1.15rem, 3.5vw, 1.35rem);
}

body.easy-read.journey-mode .journey-about .about-card__photo {
  width: 128px;
  height: 158px;
}

body.easy-read.journey-mode .journey-about .about-card__title {
  font-size: clamp(1.55rem, 4.5vw, 2.1rem);
}

body.easy-read.journey-mode .journey-card__actions .btn--primary {
  min-height: 3.5rem;
  font-size: 1.125rem;
}

/* ── Boot loader ── */
body.boot-loading #intro-overlay,
body.boot-loading #orbit-ui {
  visibility: hidden;
  pointer-events: none;
}

.boot-loader {
  position: fixed;
  top: var(--viewport-offset-top);
  left: var(--viewport-offset-left);
  width: var(--app-width);
  height: var(--app-height);
  max-height: var(--app-height);
  z-index: 100;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse 90% 70% at 50% 0%, rgba(155, 123, 255, 0.14), transparent 58%),
    radial-gradient(ellipse 70% 50% at 100% 100%, rgba(232, 168, 73, 0.1), transparent 55%),
    rgba(6, 8, 12, 0.97);
  transition:
    opacity 0.52s var(--ease-out),
    visibility 0.52s;
}

.boot-loader--out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-loader__panel {
  width: min(22rem, 88vw);
  padding: 1.35rem 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid color-mix(in srgb, var(--copper) 32%, var(--border));
  background: color-mix(in srgb, var(--surface-strong) 88%, transparent);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.45),
    0 0 44px color-mix(in srgb, var(--copper) 14%, transparent);
}

.boot-loader__eyebrow {
  margin: 0 0 1rem;
  font-family: var(--font-game);
  font-size: var(--text-fluid-sm);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--copper);
  text-align: center;
}

.boot-loader__track {
  height: 4px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.boot-loader__bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--dl), var(--copper), var(--iot), var(--copper));
  background-size: 200% 100%;
  box-shadow: 0 0 18px color-mix(in srgb, var(--copper) 55%, transparent);
  transition: width 0.38s var(--ease-out);
  animation: boot-bar-shimmer 2.4s ease-in-out infinite;
}

@keyframes boot-bar-shimmer {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

body.perf-low .boot-loader__bar {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .boot-loader__bar {
    animation: none;
  }
}

.boot-loader__status {
  margin: 0.75rem 0 0;
  font-family: var(--font-mono);
  font-size: var(--text-fluid-xs);
  letter-spacing: 0.06em;
  text-align: center;
  color: var(--muted);
  word-break: keep-all;
}

/* ── Viewport resize edge FX ── */
.viewport-edge-fx {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0;
}

.viewport-edge-fx__edge {
  position: absolute;
  opacity: 0;
}

.viewport-edge-fx__edge--top,
.viewport-edge-fx__edge--bottom {
  left: 0;
  right: 0;
  height: 3px;
}

.viewport-edge-fx__edge--left,
.viewport-edge-fx__edge--right {
  top: 0;
  bottom: 0;
  width: 3px;
}

.viewport-edge-fx__edge--top {
  top: 0;
  background: linear-gradient(90deg, transparent, var(--copper), var(--dl), transparent);
}

.viewport-edge-fx__edge--bottom {
  bottom: 0;
  background: linear-gradient(90deg, transparent, var(--iot), var(--copper), transparent);
}

.viewport-edge-fx__edge--left {
  left: 0;
  background: linear-gradient(180deg, transparent, var(--dl), var(--copper), transparent);
}

.viewport-edge-fx__edge--right {
  right: 0;
  background: linear-gradient(180deg, transparent, var(--copper), var(--pai), transparent);
}

body.viewport-resize-active .viewport-edge-fx {
  opacity: 1;
}

body.viewport-resize-active .viewport-edge-fx__edge {
  animation: viewport-edge-sweep 0.72s var(--ease-out);
}

@keyframes viewport-edge-sweep {
  0% {
    opacity: 0;
    filter: blur(6px);
  }
  22% {
    opacity: 1;
    filter: blur(0);
  }
  100% {
    opacity: 0;
    filter: blur(4px);
  }
}

/* ── Desktop portal E prompt (≥720px, non-touch) ── */
.portal-prompt {
  position: fixed;
  left: 50%;
  bottom: calc(5.75rem + var(--safe-bottom));
  z-index: 9;
  display: none;
  align-items: center;
  gap: 0.85rem;
  max-width: min(92vw, 34rem);
  padding: 0.72rem 1.25rem 0.72rem 0.95rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--project) 42%, var(--border));
  background: color-mix(in srgb, rgba(10, 14, 22, 0.94) 82%, var(--project) 18%);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.35),
    0 14px 36px rgba(0, 0, 0, 0.42),
    0 0 28px color-mix(in srgb, var(--project) 14%, transparent);
  backdrop-filter: blur(14px);
  transform: translateX(-50%);
  pointer-events: none;
  transition:
    opacity 0.22s ease,
    transform 0.28s var(--ease-out),
    border-color 0.25s,
    box-shadow 0.25s;
}

.portal-prompt:not([hidden]) {
  display: inline-flex;
}

body.touch-ui .portal-prompt,
body:not(.maze-mode) .portal-prompt,
body.detail-mode .portal-prompt,
body.journey-mode .portal-prompt,
body.about-mode .portal-prompt,
body.intro .portal-prompt {
  display: none !important;
}

.portal-prompt__key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-width: 2.65rem;
  min-height: 2.65rem;
  padding: 0 0.45rem;
  border-radius: 0.65rem;
  border: 1px solid color-mix(in srgb, var(--project) 58%, var(--border-strong));
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--surface-strong) 88%, #fff 12%) 0%,
    color-mix(in srgb, var(--surface-strong) 70%, var(--project) 30%) 100%
  );
  font-family: var(--font-game);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    0 4px 12px rgba(0, 0, 0, 0.38);
}

.portal-prompt__label {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.02em;
  color: var(--text);
  text-wrap: balance;
}

.portal-prompt--ready {
  border-color: color-mix(in srgb, var(--project) 72%, #fff 28%);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--project) 28%, transparent),
    0 14px 36px rgba(0, 0, 0, 0.42),
    0 0 32px color-mix(in srgb, var(--project) 28%, transparent);
  animation: portal-prompt-pulse 1.35s ease-in-out infinite;
}

.portal-prompt--ready .portal-prompt__key {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 0 16px color-mix(in srgb, var(--project) 42%, transparent);
}

@keyframes portal-prompt-pulse {
  0%,
  100% {
    transform: translateX(-50%) scale(1);
  }
  50% {
    transform: translateX(-50%) scale(1.03);
  }
}

@media (max-width: 719px) {
  .portal-prompt {
    display: none !important;
  }
}

@media (min-width: 1280px) {
  body.maze-mode .portal-prompt {
    bottom: calc(1.25rem + var(--safe-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .portal-prompt--ready {
    animation: none;
  }
}

/* ── Desktop web: viewport-responsive scale (≥720px; mobile untouched) ── */
@media (min-width: 720px) {
  html {
    font-size: clamp(13.5px, calc(12.5px + 0.2vmin), calc(15px * var(--ui-scale)));
  }

  :root {
    --touch-min: clamp(2rem, calc(1.85rem + 0.35vmin), calc(2.35rem * var(--ui-scale)));
    --text-xs: 0.75rem;
    --text-sm: 0.8125rem;
    --text-base: 0.9375rem;
    --text-md: 1rem;
    --text-lg: 1.0625rem;
    --space-inline: clamp(0.75rem, calc(0.55rem + 1.2vw), 1.85rem);
    --chrome-pad: clamp(0.5rem, calc(0.38rem + 0.6vmin), 0.95rem);
  }

  body {
    font-size: calc(var(--text-base) * var(--ui-scale));
  }

  /* 하단/좌측 타임라인: 데스크톱에서 제목을 다음 줄로 */
  body.maze-mode .timeline-btn .phase {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 0.35rem;
    row-gap: 0.1rem;
    width: 100%;
  }

  body.maze-mode .timeline-btn .phase__name {
    flex: 0 0 100%;
    width: 100%;
    margin-top: 0.08rem;
    white-space: normal;
    line-height: 1.35;
    word-break: keep-all;
    overflow-wrap: anywhere;
  }

  body.maze-mode .timeline-btn .phase__name::before {
    display: none;
  }

  .top-bar {
    padding: var(--chrome-pad) var(--space-inline);
    gap: calc(0.28rem * var(--ui-scale));
  }

  .icon-btn {
    width: calc(var(--touch-min) * var(--ui-scale));
    height: calc(var(--touch-min) * var(--ui-scale));
    font-size: calc(0.92rem * var(--ui-scale));
  }

  .lang-btn {
    min-height: calc(var(--touch-min) * var(--ui-scale));
    padding: calc(0.4rem * var(--ui-scale)) calc(0.9rem * var(--ui-scale))
      calc(0.4rem * var(--ui-scale)) calc(0.72rem * var(--ui-scale));
    font-size: var(--text-sm);
  }

  .hero h1 {
    font-size: clamp(1.85rem, calc(1.55rem + 2vmin * var(--ui-scale)), 3rem);
  }

  .hero__panel {
    padding: clamp(1rem, calc(0.85rem + 1.6vmin), 1.45rem)
      clamp(1rem, calc(0.9rem + 1.8vmin), 1.55rem)
      clamp(0.9rem, calc(0.75rem + 1.4vmin), 1.35rem);
  }

  .hero__role,
  .hero__tagline {
    font-size: clamp(0.875rem, calc(0.82rem + 0.22vmin), var(--text-md));
  }

  .hud__value {
    font-size: clamp(1.2rem, calc(1.08rem + 0.9vmin * var(--ui-scale)), 1.5rem);
  }

  .intro-card__scroll,
  .overlay__card:not(.intro-card) {
    padding: clamp(1.25rem, calc(1rem + 2.2vmin), 1.85rem);
  }

  body.maze-mode .quest-banner {
    font-size: clamp(0.8125rem, calc(0.78rem + 0.18vmin * var(--ui-scale)), var(--text-sm));
    padding: clamp(0.42rem, calc(0.36rem + 0.28vmin), 0.55rem)
      clamp(0.85rem, calc(0.7rem + 0.9vmin), 1.2rem);
  }

  body.maze-mode .timeline-btn .phase__name {
    font-size: clamp(0.8125rem, calc(0.78rem + 0.14vmin * var(--ui-scale)), var(--text-sm));
  }

  body.maze-mode .dock__hint,
  .hint {
    font-size: clamp(0.78rem, calc(0.74rem + 0.14vmin), var(--text-xs));
  }

  .intro-card__lead,
  .journey-card__bootcamp,
  .journey-timeline__summary,
  .journey-timeline__role {
    font-size: clamp(0.875rem, calc(0.82rem + 0.18vmin), var(--text-sm));
  }

  .intro-card__role,
  .journey-card__subtitle {
    font-size: clamp(1rem, calc(0.94rem + 0.22vmin), var(--text-md));
  }

  .top-bar__status {
    font-size: clamp(0.78rem, calc(0.74rem + 0.14vmin), var(--text-xs));
  }

  .portal-prompt {
    padding: calc(0.62rem * var(--ui-scale)) calc(1.05rem * var(--ui-scale))
      calc(0.62rem * var(--ui-scale)) calc(0.82rem * var(--ui-scale));
    gap: calc(0.72rem * var(--ui-scale));
  }

  .portal-prompt__key {
    min-width: calc(2.45rem * max(var(--ui-scale), 0.9));
    min-height: calc(2.45rem * max(var(--ui-scale), 0.9));
    font-size: calc(1.05rem * max(var(--ui-scale), 0.9));
  }

  .portal-prompt__label {
    font-size: clamp(0.8125rem, calc(0.78rem + 0.16vmin * var(--ui-scale)), var(--text-sm));
  }

  body.maze-mode .minimap {
    transform: scale(clamp(0.72, calc(0.66 + var(--ui-scale) * 0.16), 0.88));
  }
}

@media (min-width: 1280px) {
  html {
    font-size: clamp(13px, calc(12.5px + 0.08vmin), calc(14.5px * var(--ui-scale)));
  }

  body.maze-mode .timeline-btn {
    padding: calc(0.62rem * var(--ui-scale)) calc(0.85rem * var(--ui-scale));
  }

  body.maze-mode .timeline-btn .phase__name {
    font-size: clamp(0.8125rem, calc(0.78rem + 0.12vmin * var(--ui-scale)), var(--text-sm));
  }
}

/* ── Fluid responsive copy — mobile only (≤719px maze drawer) ── */
@media (max-width: 719px) {
  .quest-banner {
    font-size: var(--text-fluid-sm);
  }

  body.maze-mode .timeline-btn .phase__name {
    font-size: var(--text-fluid-sm);
  }

  body.maze-mode .dock__hint,
  .hint {
    font-size: var(--text-fluid-xs);
  }

  .intro-card__lead,
  .journey-card__bootcamp,
  .journey-timeline__summary,
  .journey-timeline__role {
    font-size: var(--text-fluid-sm);
  }

  .intro-card__role,
  .journey-card__subtitle {
    font-size: var(--text-fluid-md);
  }

  .top-bar__status {
    font-size: var(--text-fluid-xs);
  }
}
