/* ==========================================================================
   METAMORPHOSIS 2026 — Architectural Obsidian & Alchemical Chiaroscuro
   ========================================================================== */

:root {
  --bg-void: #09090b;
  --bg-elevated: #111115;
  --bg-card: #15151a;
  --bg-glass: rgba(12, 12, 16, 0.84);

  --ink-primary: #f2ece0;
  --ink-secondary: #a29c91;
  --ink-muted: #666159;

  --accent-gold: #e2a84b;
  --accent-gold-soft: rgba(226, 168, 75, 0.14);
  --accent-cinnabar: #d94b38;
  --accent-cinnabar-soft: rgba(217, 75, 56, 0.14);
  --accent-sage: #5ba882;

  --border-hairline: rgba(242, 236, 224, 0.11);
  --border-strong: rgba(242, 236, 224, 0.24);

  --font-serif: 'Cormorant Garamond', 'Noto Serif SC', 'Songti SC', 'STSong', Georgia, serif;
  --font-sans: 'Inter', 'Noto Sans SC', 'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', ui-monospace, Menlo, monospace;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  background-color: var(--bg-void);
  color: var(--ink-primary);
  font-size: 16px;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg-void);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  line-height: 1.72;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.serif {
  font-family: var(--font-serif);
}

.mono {
  font-family: var(--font-mono);
}

button,
input,
textarea {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* Tactile SVG Noise Grain */
.film-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 90;
  opacity: 0.032;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Top Scroll Progress Hairline */
.scroll-progress-track {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(242, 236, 224, 0.06);
  z-index: 120;
}

.scroll-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-cinnabar), var(--accent-gold));
  transition: width 0.08s linear;
}

/* Persistent Top HUD */
.top-hud {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  left: 12px;
  right: 12px;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hud-pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-hairline);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-primary);
  transition: border-color 0.2s, background-color 0.2s, transform 0.15s;
}

.hud-pill:active {
  transform: scale(0.96);
}

.hud-gold {
  border-color: rgba(226, 168, 75, 0.35);
  color: var(--accent-gold);
}

.hud-bars {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 12px;
}

.hud-bars span {
  display: block;
  height: 1.5px;
  width: 100%;
  background: var(--accent-gold);
}

.hud-bars span:last-child {
  width: 72%;
}

.audio-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-muted);
  transition: background-color 0.2s, box-shadow 0.2s;
}

.audio-dot.active {
  background: var(--accent-sage);
  box-shadow: 0 0 8px rgba(91, 168, 130, 0.7);
}

/* Desktop Left Constellation Rail */
.desktop-rail {
  display: none;
}

@media (min-width: 1080px) {
  .desktop-rail {
    position: fixed;
    left: 28px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 80;
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .rail-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-muted);
    transition: color 0.2s;
  }

  .rail-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    border: 1px solid var(--ink-muted);
    transition: all 0.25s var(--ease-out);
  }

  .rail-item.active {
    color: var(--accent-gold);
  }

  .rail-item.active .rail-dot {
    background: var(--accent-gold);
    border-color: var(--accent-gold);
    box-shadow: 0 0 10px rgba(226, 168, 75, 0.55);
    transform: scale(1.25);
  }
}

/* Editorial Monograph Shell */
.editorial-shell {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 18px calc(108px + env(safe-area-inset-bottom, 0px));
}

.act-section {
  padding: 84px 0 42px;
  border-bottom: 1px solid var(--border-hairline);
}

.act-section:last-child {
  border-bottom: none;
}

/* ==========================================================================
   PROLOGUE · 00
   ========================================================================== */
.prelude-section {
  position: relative;
  min-height: 100svh;
  padding-top: calc(68px + env(safe-area-inset-top, 0px));
  padding-bottom: 88px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.prelude-canvas-wrap {
  position: relative;
  width: 100%;
  height: clamp(148px, 21svh, 200px);
  margin-bottom: 10px;
}

.prelude-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.kicker-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
}

.kicker {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--accent-gold);
  text-transform: uppercase;
}

.badge-stat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-cinnabar-soft);
  border: 1px solid rgba(217, 75, 56, 0.35);
  color: var(--ink-primary);
}

.badge-stat strong {
  color: var(--accent-cinnabar);
  font-weight: 600;
}

.prelude-headline {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 5.4vw, 2.55rem);
  font-weight: 600;
  line-height: 1.24;
  letter-spacing: -0.01em;
  text-wrap: balance;
  margin: 0 0 8px;
}

.prelude-subhead {
  font-family: var(--font-serif);
  font-size: clamp(1.1rem, 3.3vw, 1.38rem);
  color: var(--accent-gold);
  font-style: italic;
  margin: 0 0 18px;
}

.prose-stack p {
  margin: 0 0 11px;
  color: var(--ink-secondary);
  font-size: 0.94rem;
}

.prelude-cta-wrap {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

/* Signature Hold-to-Shatter Button */
.hold-btn {
  position: relative;
  width: 248px;
  height: 72px;
  border-radius: 999px;
  border: 1px solid rgba(226, 168, 75, 0.38);
  background: radial-gradient(circle at center, rgba(226, 168, 75, 0.12), rgba(17, 17, 21, 0.96));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 20px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.hold-btn:active,
.hold-btn.holding {
  transform: scale(0.97);
  border-color: var(--accent-cinnabar);
  box-shadow: 0 0 28px rgba(217, 75, 56, 0.28);
}

.hold-btn.shattered {
  border-color: var(--accent-sage);
  background: rgba(91, 168, 130, 0.12);
}

.hold-ring-svg {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  transform: rotate(-90deg);
}

.hold-ring-bg {
  fill: none;
  stroke: rgba(242, 236, 224, 0.12);
  stroke-width: 5;
}

.hold-ring-fg {
  fill: none;
  stroke: var(--accent-gold);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 339.29;
  stroke-dashoffset: 339.29;
  transition: stroke 0.2s;
}

.hold-btn.holding .hold-ring-fg {
  stroke: var(--accent-cinnabar);
}

.hold-btn-core {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hold-icon {
  color: var(--accent-gold);
  font-size: 13px;
}

.hold-text {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-align: left;
  line-height: 1.3;
}

.text-link-btn {
  font-size: 12px;
  color: var(--ink-muted);
  padding: 6px 12px;
  transition: color 0.2s;
}

.text-link-btn:hover {
  color: var(--accent-gold);
}

/* ==========================================================================
   SHARED ACT TYPOGRAPHY & INSTRUMENTS
   ========================================================================== */
.act-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.act-numeral {
  font-size: clamp(2.5rem, 8vw, 3.6rem);
  line-height: 0.92;
  color: var(--accent-gold);
  opacity: 0.88;
  min-width: 44px;
  padding-top: 2px;
}

.act-tag {
  display: block;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.act-title {
  margin: 0;
  font-size: clamp(1.48rem, 4.8vw, 2.05rem);
  line-height: 1.28;
  font-weight: 600;
  color: var(--ink-primary);
}

.lead-text {
  font-size: 1rem;
  color: var(--ink-secondary);
  margin: 0 0 24px;
}

.body-text.compact {
  font-size: 0.9rem;
  color: var(--ink-secondary);
  margin: 8px 0 14px;
}

/* Quote Plate */
.quote-plate {
  margin: 0 0 24px;
  padding: 18px 20px;
  border-left: 2px solid var(--accent-gold);
  background: linear-gradient(90deg, rgba(226, 168, 75, 0.06), transparent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.quote-body {
  margin: 0 0 8px;
  font-size: clamp(1.06rem, 3.3vw, 1.24rem);
  line-height: 1.56;
  color: var(--ink-primary);
}

.quote-author {
  font-size: 11px;
  color: var(--accent-gold);
  letter-spacing: 0.05em;
}

/* Instrument Box */
.instrument-box {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 18px 16px;
  margin: 22px 0;
}

.corner-tick {
  position: absolute;
  width: 8px;
  height: 8px;
  border-color: rgba(226, 168, 75, 0.55);
  border-style: solid;
  pointer-events: none;
}

.corner-tick.tl {
  top: -1px;
  left: -1px;
  border-width: 1.5px 0 0 1.5px;
}

.corner-tick.tr {
  top: -1px;
  right: -1px;
  border-width: 1.5px 1.5px 0 0;
}

.instrument-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.inst-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--accent-gold);
  text-transform: uppercase;
}

.inst-hint {
  margin: 0 0 14px;
  font-size: 0.84rem;
  color: var(--ink-muted);
}

.inst-hint.center {
  text-align: center;
  margin: 10px 0 0;
}

/* Segmented Switch */
.segmented-switch {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-hairline);
  gap: 3px;
}

.segmented-switch.full-width {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.seg-btn {
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-secondary);
  transition: all 0.2s var(--ease-out);
}

.segmented-switch.full-width .seg-btn {
  border-radius: 4px;
  padding: 9px 10px;
}

.seg-btn.active {
  background: var(--accent-gold);
  color: #09090b;
  font-weight: 600;
}

/* ==========================================================================
   ACT I · ORDERS, ELASTIC SIM & ARCHETYPES
   ========================================================================== */
.order-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

@media (min-width: 600px) {
  .order-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.order-card {
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
}

.order-card.first-order {
  border-color: rgba(226, 168, 75, 0.42);
  background: linear-gradient(155deg, rgba(226, 168, 75, 0.08), var(--bg-card));
}

.order-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.order-tag {
  font-size: 10px;
  color: var(--ink-muted);
}

.order-card.first-order .order-tag {
  color: var(--accent-gold);
}

.order-status {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(217, 75, 56, 0.14);
  color: var(--accent-cinnabar);
}

.order-card.first-order .order-status {
  background: var(--accent-gold-soft);
  color: var(--accent-gold);
}

.order-name {
  margin: 0 0 6px;
  font-size: 1.02rem;
  font-weight: 600;
}

.order-desc {
  margin: 0;
  font-size: 0.87rem;
  color: var(--ink-secondary);
}

/* Tactile Gravity Track */
.gravity-stage {
  padding: 14px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(242, 236, 224, 0.07);
}

.gravity-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--ink-muted);
  margin-bottom: 10px;
}

.gravity-track {
  position: relative;
  height: 54px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  padding: 0 8px;
  touch-action: none;
  user-select: none;
}

.gravity-well {
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 6px;
  width: 44px;
  border-radius: 999px;
  background: rgba(217, 75, 56, 0.14);
  border: 1px dashed rgba(217, 75, 56, 0.45);
  transition: left 0.45s var(--ease-out), background 0.3s, border-color 0.3s;
}

.gravity-track.first-mode .gravity-well {
  left: calc(100% - 50px);
  background: rgba(226, 168, 75, 0.18);
  border-color: rgba(226, 168, 75, 0.65);
}

.elastic-band {
  position: absolute;
  left: 28px;
  height: 2px;
  width: 0px;
  background: var(--accent-cinnabar);
  opacity: 0.75;
  pointer-events: none;
}

.gravity-track.first-mode .elastic-band {
  background: var(--accent-gold);
}

.gravity-knob {
  position: relative;
  z-index: 2;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #1b1b22;
  border: 2px solid var(--accent-gold);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  transform: translateX(0px);
}

.gravity-knob:active {
  cursor: grabbing;
}

.knob-core {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-gold);
}

.sim-feedback-line {
  margin-top: 10px;
  font-size: 11px;
  color: var(--accent-gold);
  min-height: 18px;
}

/* Archetypes */
.sub-block {
  margin: 26px 0;
}

.section-subhead {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--accent-gold);
  margin: 0 0 12px;
}

.archetype-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.arch-tab {
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 12.5px;
  border: 1px solid var(--border-hairline);
  color: var(--ink-secondary);
  background: var(--bg-card);
  transition: all 0.2s;
}

.arch-tab.active {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  background: var(--accent-gold-soft);
}

.archetype-stage {
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  display: grid;
  gap: 12px;
}

.arch-row {
  display: grid;
  gap: 4px;
}

.arch-badge {
  font-size: 10px;
  letter-spacing: 0.08em;
}

.arch-badge.illusion {
  color: var(--ink-muted);
}

.arch-badge.reality {
  color: var(--accent-gold);
}

.editorial-callout {
  margin: 22px 0;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: rgba(217, 75, 56, 0.07);
  border: 1px solid rgba(217, 75, 56, 0.26);
  font-size: 0.94rem;
  color: var(--ink-primary);
}

.micro-prompt-card {
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline);
}

.micro-label {
  font-size: 11px;
  color: var(--ink-secondary);
  margin-bottom: 10px;
}

.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.chip-btn {
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--border-hairline);
  color: var(--ink-secondary);
}

.chip-btn:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.minimal-input,
.minimal-textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 0.92rem;
  color: var(--ink-primary);
  outline: none;
  transition: border-color 0.2s;
}

.minimal-input:focus,
.minimal-textarea:focus {
  border-color: var(--accent-gold);
}

.minimal-textarea {
  resize: vertical;
  min-height: 76px;
  line-height: 1.6;
}

/* ==========================================================================
   ACT II · X-RAY SCANNER & PERCEPTION LENS
   ========================================================================== */
.xray-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.xray-card {
  position: relative;
  display: grid;
  min-height: 156px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-hairline);
  background: #141419;
  user-select: none;
  touch-action: pan-y;
}

.xray-layer {
  grid-area: 1 / 1;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.xray-surface {
  background: #141419;
}

.xray-truth {
  background: linear-gradient(135deg, #1b1112, #120d0e);
  clip-path: inset(0 0 0 82%);
}

.layer-badge {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}

.truth-badge {
  color: var(--accent-cinnabar);
}

.layer-copy {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.5;
}

.truth-copy {
  color: var(--ink-primary);
  font-size: 0.96rem;
}

.xray-scanline {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 18%;
  width: 2px;
  background: var(--accent-cinnabar);
  box-shadow: 0 0 14px var(--accent-cinnabar);
  pointer-events: none;
}

.xray-slider-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-size: 11px;
  color: var(--ink-muted);
}

.brass-range {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: rgba(242, 236, 224, 0.14);
  outline: none;
}

.brass-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-gold);
  border: 2px solid #09090b;
  box-shadow: 0 0 10px rgba(226, 168, 75, 0.5);
  cursor: pointer;
}

.lens-selector {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

@media (min-width: 600px) {
  .lens-selector {
    grid-template-columns: repeat(3, 1fr);
  }
}

.lens-btn {
  padding: 10px;
  text-align: left;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  background: var(--bg-card);
  transition: all 0.2s;
}

.lens-btn.active {
  border-color: var(--accent-gold);
  background: rgba(226, 168, 75, 0.08);
}

.lens-btn-title {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 3px;
}

.lens-btn-sub {
  display: block;
  font-size: 11px;
  color: var(--ink-muted);
  line-height: 1.35;
}

.canvas-frame {
  position: relative;
  width: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: radial-gradient(circle at center, #14141a, #09090b);
  border: 1px solid rgba(242, 236, 224, 0.08);
}

.lens-frame {
  height: 250px;
}

.cyber-frame {
  height: 240px;
}

.radar-frame {
  height: 310px;
}

.canvas-frame canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ==========================================================================
   ACT III · IDENTITY LOOP SVG BREAKER
   ========================================================================== */
.identity-svg-wrap {
  width: 100%;
  max-width: 340px;
  margin: 4px auto 12px;
}

.identity-svg {
  width: 100%;
  height: auto;
  display: block;
}

.svg-node-circle {
  cursor: pointer;
  transition: all 0.25s;
}

.node-inspector {
  padding: 14px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid var(--border-hairline);
  margin-bottom: 14px;
}

.inspector-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.node-num-badge {
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-gold-soft);
  color: var(--accent-gold);
}

.inspector-title {
  font-size: 0.96rem;
}

.inspector-detail {
  margin: 0;
  font-size: 0.87rem;
  color: var(--ink-secondary);
}

.loop-action-bar {
  display: flex;
  justify-content: center;
  margin: 8px 0 12px;
}

.primary-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: transform 0.15s, box-shadow 0.25s, background 0.25s;
}

.primary-action-btn:active {
  transform: scale(0.97);
}

.primary-action-btn.danger-glow {
  background: var(--accent-cinnabar-soft);
  border: 1px solid var(--accent-cinnabar);
  color: var(--ink-primary);
  box-shadow: 0 0 22px rgba(217, 75, 56, 0.22);
}

.primary-action-btn.gold-fill {
  background: var(--accent-gold);
  color: #09090b;
  box-shadow: 0 8px 26px rgba(226, 168, 75, 0.28);
}

.primary-action-btn.full {
  width: 100%;
}

.outline-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: 999px;
  font-size: 12.5px;
  border: 1px solid var(--border-strong);
  color: var(--ink-primary);
  transition: all 0.2s;
}

.outline-btn.gold-outline {
  border-color: rgba(226, 168, 75, 0.55);
  color: var(--accent-gold);
}

.outline-btn.active {
  background: var(--accent-gold);
  color: #09090b;
  border-color: var(--accent-gold);
}

.sever-status-box {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  border: 1px solid var(--border-hairline);
  color: var(--ink-secondary);
}

.sever-status-box.broken {
  border-color: rgba(91, 168, 130, 0.5);
  background: rgba(91, 168, 130, 0.08);
  color: var(--ink-primary);
}

/* ==========================================================================
   ACT IV · 9-STAGE EGO ALTIMETER
   ========================================================================== */
.altitude-readout {
  font-size: 11px;
  color: var(--accent-gold);
}

.altimeter-layout {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

@media (min-width: 600px) {
  .altimeter-layout {
    grid-template-columns: 220px 1fr;
  }
}

.altimeter-scale {
  display: flex;
  flex-direction: column-reverse;
  gap: 5px;
}

.stage-step-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  background: rgba(255, 255, 255, 0.02);
  font-size: 12px;
  text-align: left;
  transition: all 0.18s;
}

.stage-step-btn.in-zone {
  border-left: 2px solid rgba(226, 168, 75, 0.45);
}

.stage-step-btn.inspecting {
  border-color: var(--accent-gold);
  background: var(--accent-gold-soft);
}

.stage-num {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-muted);
}

.stage-pins {
  display: flex;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.pin-tag-cur {
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--accent-cinnabar);
  color: #fff;
}

.pin-tag-tgt {
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--accent-gold);
  color: #09090b;
}

.altimeter-detail {
  padding: 16px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.stage-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
}

.stage-code {
  color: var(--accent-gold);
}

.stage-en {
  color: var(--ink-muted);
}

.stage-name {
  margin: 0;
  font-size: 1.45rem;
}

.stage-core {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ink-primary);
}

.stage-example-box {
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border-left: 2px solid var(--ink-muted);
}

.ex-tag {
  display: block;
  font-size: 9.5px;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.stage-example {
  margin: 0;
  font-size: 0.84rem;
  color: var(--ink-secondary);
}

.stage-pin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ==========================================================================
   ACT V · FORMULA & CYBERNETIC HELMSMAN
   ========================================================================== */
.formula-score {
  font-size: 12px;
  color: var(--accent-gold);
}

.formula-sliders {
  display: grid;
  gap: 14px;
  margin-bottom: 12px;
}

.slider-row {
  display: grid;
  gap: 5px;
}

.slider-top {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
}

.slider-desc {
  font-size: 11.5px;
  color: var(--ink-muted);
}

.formula-diagnosis {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(226, 168, 75, 0.07);
  font-size: 11.5px;
  color: var(--ink-primary);
}

.cyber-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}

.sim-note {
  font-size: 11px;
  color: var(--ink-secondary);
}

.mini-pill-btn {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--border-hairline);
  color: var(--ink-secondary);
  background: var(--bg-card);
  transition: all 0.2s;
}

.mini-pill-btn:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.mini-pill-btn.danger-text:hover {
  border-color: var(--accent-cinnabar);
  color: var(--accent-cinnabar);
}

.rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 460px) {
  .rules-grid {
    grid-template-columns: 1fr;
  }
}

.rule-card {
  padding: 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  background: var(--bg-card);
  text-align: left;
  transition: all 0.2s;
}

.rule-card.checked {
  border-color: rgba(226, 168, 75, 0.5);
  background: rgba(226, 168, 75, 0.08);
}

.rule-top {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--accent-gold);
  margin-bottom: 4px;
}

.rule-text {
  display: block;
  font-size: 0.92rem;
  font-weight: 500;
}

.rule-sub {
  display: block;
  font-size: 11px;
  color: var(--ink-muted);
}

/* ==========================================================================
   ACT VI · 1-DAY PROTOCOL WORKBENCH
   ========================================================================== */
.phase-curve-wrap {
  margin: 4px 0 12px;
}

.phase-curve-svg {
  width: 100%;
  height: auto;
  display: block;
}

.phases-grid {
  display: grid;
  gap: 10px;
}

@media (min-width: 600px) {
  .phases-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.phase-card {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-hairline);
}

.phase-card strong {
  display: block;
  font-size: 12px;
  color: var(--accent-gold);
  margin-bottom: 5px;
}

.phase-card p {
  margin: 0;
  font-size: 12px;
  color: var(--ink-secondary);
  line-height: 1.5;
}

.no-ai-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  background: var(--accent-cinnabar-soft);
  border: 1px solid rgba(217, 75, 56, 0.36);
  margin: 18px 0 12px;
}

.no-ai-icon {
  color: var(--accent-cinnabar);
  font-size: 15px;
  margin-top: 2px;
}

.no-ai-banner p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--ink-primary);
}

.workbench-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 14px;
}

.protocol-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}

.proto-tab {
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  background: var(--bg-card);
  text-align: center;
  transition: all 0.2s;
}

.proto-tab.active {
  border-color: var(--accent-gold);
  background: var(--accent-gold-soft);
}

.proto-tab-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-primary);
}

.proto-tab-sub {
  display: block;
  font-size: 10px;
  color: var(--ink-muted);
  margin-top: 2px;
}

.protocol-panel {
  display: none;
}

.protocol-panel.active {
  display: block;
}

.q-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0 8px;
  border-bottom: 1px solid var(--border-hairline);
  margin: 18px 0 12px;
}

.q-group-header:first-child {
  margin-top: 0;
}

.q-group-title {
  margin: 0;
  font-size: 0.96rem;
  color: var(--accent-gold);
}

.q-card {
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline);
  margin-bottom: 10px;
}

.q-card.filled {
  border-color: rgba(226, 168, 75, 0.34);
}

.q-prompt-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.q-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-gold);
  padding-top: 3px;
}

.q-text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
}

.q-sync-tag {
  display: inline-block;
  margin-top: 6px;
  font-size: 10px;
  color: var(--accent-sage);
}

/* Daytime Interrupt Timeline */
.interrupt-timeline {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.interrupt-item {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline);
  align-items: center;
}

.interrupt-time {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-gold);
}

.interrupt-q {
  margin: 0;
  font-size: 0.89rem;
}

.day-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

/* ==========================================================================
   ACT VII · VIDEO GAME FORCEFIELD & FINALE
   ========================================================================== */
.radar-box {
  text-align: center;
}

.radar-score {
  font-size: 12px;
  color: var(--accent-gold);
}

.radar-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 10.5px;
  color: var(--ink-muted);
  margin: 10px 0 4px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot-gold {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-gold);
}

.dot-dashed {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px dashed var(--ink-muted);
}

.forcefield-cards {
  display: grid;
  gap: 12px;
  margin: 20px 0;
}

.ff-card {
  padding: 15px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline);
  transition: border-color 0.2s;
}

.ff-card.active {
  border-color: rgba(226, 168, 75, 0.45);
}

.ff-card.anti.active {
  border-color: rgba(217, 75, 56, 0.55);
}

.ff-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.ff-role {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--accent-gold);
}

.ff-card.anti .ff-role {
  color: var(--accent-cinnabar);
}

.ff-ring-num {
  font-size: 10px;
  color: var(--ink-muted);
}

.ff-name {
  margin: 0 0 4px;
  font-size: 1.04rem;
}

.ff-desc {
  margin: 0 0 10px;
  font-size: 0.83rem;
  color: var(--ink-secondary);
}

.closing-plate {
  margin-top: 32px;
  padding: 28px 18px;
  text-align: center;
  border-radius: var(--radius-lg);
  background: radial-gradient(circle at top, rgba(226, 168, 75, 0.12), rgba(17, 17, 21, 0.96));
  border: 1px solid rgba(226, 168, 75, 0.28);
}

.closing-quote {
  margin: 0 0 8px;
  font-size: 1.15rem;
  line-height: 1.6;
}

.closing-sig {
  display: block;
  font-size: 12px;
  color: var(--accent-gold);
  margin-bottom: 22px;
}

.finale-cta-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.saved-indicator {
  font-size: 11px;
  color: var(--ink-muted);
}

/* ==========================================================================
   FLOATING BOTTOM DOCK & DRAWER MODALS
   ========================================================================== */
.bottom-dock {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 95;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--bg-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-hairline);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
}

@media (min-width: 1080px) {
  .bottom-dock {
    left: auto;
    right: 28px;
    transform: none;
  }
}

.dock-btn {
  width: 34px;
  height: 30px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--ink-primary);
  transition: background 0.15s;
}

.dock-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.dock-center {
  font-size: 11px;
  padding: 0 10px;
  color: var(--accent-gold);
  letter-spacing: 0.08em;
}

/* Overlay Drawers */
.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(4, 4, 6, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}

.drawer-overlay[hidden] {
  display: none;
}

@media (min-width: 640px) {
  .drawer-overlay {
    align-items: center;
  }
}

.drawer-sheet,
.poster-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 88svh;
  overflow-y: auto;
  background: #121217;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.drawer-title {
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--accent-gold);
}

.close-x {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink-primary);
  font-size: 14px;
}

.toc-list {
  display: grid;
  gap: 8px;
}

.toc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  background: rgba(255, 255, 255, 0.02);
  text-align: left;
  font-size: 0.9rem;
}

.toc-item.active {
  border-color: var(--accent-gold);
  background: var(--accent-gold-soft);
}

.toc-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-gold);
  min-width: 28px;
}

.bp-summary {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.bp-row {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-hairline);
}

.bp-row-label {
  display: block;
  font-size: 10px;
  color: var(--accent-gold);
  margin-bottom: 3px;
}

.bp-row-val {
  font-size: 0.85rem;
  color: var(--ink-secondary);
}

.poster-hint {
  margin: 0 0 12px;
  font-size: 0.82rem;
  color: var(--ink-secondary);
}

.poster-preview-wrap {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-hairline);
  margin-bottom: 14px;
  max-height: 55svh;
  overflow-y: auto;
}

.poster-preview-wrap img {
  width: 100%;
  height: auto;
  display: block;
}

.poster-actions {
  display: grid;
  gap: 8px;
}

@media (min-width: 480px) {
  .poster-actions {
    grid-template-columns: 1fr 1fr;
  }
}

/* Toast */
.toast {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 54px);
  left: 50%;
  transform: translate(-50%, -12px);
  z-index: 300;
  padding: 8px 16px;
  border-radius: 999px;
  background: #1c1c22;
  border: 1px solid var(--accent-gold);
  color: var(--ink-primary);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
