/* ==========================================================================
   THE LAST EXIT / 唯一出口 — V2 OBSIDIAN SANCTUARY DESIGN SYSTEM
   Visual Paradigm: Immersive Dark Stone & Torchlight Exploration Deck
   ========================================================================== */

:root {
  /* Obsidian Stone Palette */
  --bg-deep: #06080a;
  --bg-surface: #0b0f14;
  --bg-card: #121820;
  --bg-card-hover: #17202b;
  --border-subtle: rgba(240, 235, 225, 0.08);
  --border-medium: rgba(240, 235, 225, 0.16);
  --border-bright: rgba(245, 176, 65, 0.35);

  /* Torchlight & Ember Palette */
  --torch-gold: #f5b041;
  --torch-amber: #ff9f43;
  --torch-ember: #e67e22;
  --torch-flame: #ff6b4a;
  --torch-glow: rgba(245, 176, 65, 0.18);
  --torch-glow-strong: rgba(245, 176, 65, 0.35);

  /* Semantic Feedback Tones */
  --emerald-open: #4cd964;
  --emerald-bg: rgba(76, 217, 100, 0.12);
  --emerald-border: rgba(76, 217, 100, 0.3);
  --ruby-blocked: #ff4757;
  --ruby-bg: rgba(255, 71, 87, 0.12);
  --ruby-border: rgba(255, 71, 87, 0.3);

  /* Typography Colors */
  --text-main: #f0ebe1;
  --text-sub: #b5ac9d;
  --text-faint: #6c737d;
  --text-accent: #f5b041;

  /* Fonts */
  --font-mono: "JetBrains Mono", "SFMono-Regular", "Roboto Mono", Consolas, monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Cinzel", "Times New Roman", Georgia, serif;

  /* Layout Consts */
  --header-height: 64px;
  --max-content-width: 1360px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.5;
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(245, 176, 65, 0.07) 0%, transparent 60%),
    radial-gradient(circle at 10% 80%, rgba(30, 42, 56, 0.25) 0%, transparent 50%),
    linear-gradient(180deg, #06080a 0%, #090d12 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

[hidden] {
  display: none !important;
}

a {
  color: inherit;
  text-decoration: none;
}

button, select, input, textarea {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

button {
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
}

/* ==========================================================================
   Header HUD (Top Deck)
   ========================================================================== */
.sanctuary-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(8, 11, 15, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-container {
  max-width: var(--max-content-width);
  height: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
}

.exit-totem {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-bright);
  background: radial-gradient(circle, rgba(245, 176, 65, 0.25) 0%, rgba(18, 24, 32, 0.8) 80%);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px var(--torch-glow);
}

.exit-totem i {
  display: block;
  width: 10px;
  height: 10px;
  background: var(--torch-gold);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  box-shadow: 0 0 8px var(--torch-gold);
  animation: totemPulse 3s ease-in-out infinite;
}

@keyframes totemPulse {
  0%, 100% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; filter: drop-shadow(0 0 4px var(--torch-gold)); }
}

.brand-title {
  display: flex;
  flex-direction: column;
}

.brand-title strong {
  font-size: 14px;
  letter-spacing: 0.15em;
  color: var(--text-main);
  text-shadow: 0 0 8px rgba(240, 235, 225, 0.2);
}

.brand-title small {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--text-accent);
}

.header-status-capsule {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(18, 24, 32, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 6px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.beacon-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--torch-gold);
  box-shadow: 0 0 8px var(--torch-gold);
  animation: beaconGlow 2s ease-in-out infinite;
}

@keyframes beaconGlow {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.header-status-capsule b {
  color: var(--text-main);
  letter-spacing: 0.08em;
}

.header-status-capsule span {
  color: var(--text-faint);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Control Buttons & Dropdowns in Header */
.hud-btn, .hud-select-wrap {
  min-height: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-sub);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  transition: all 160ms ease;
}

.hud-btn:hover, .hud-select-wrap:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--border-medium);
}

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

.hud-btn[aria-pressed="true"] {
  border-color: var(--torch-gold);
  color: var(--torch-gold);
  background: rgba(245, 176, 65, 0.1);
  box-shadow: 0 0 10px var(--torch-glow);
}

.hud-select-wrap select {
  cursor: pointer;
  padding: 8px 0;
  color: var(--text-main);
}

.hud-select-wrap select option {
  background: var(--bg-card);
  color: var(--text-main);
}

.header-share-btn {
  border-color: var(--border-bright);
  color: var(--torch-gold);
}

.header-share-btn:hover {
  background: rgba(245, 176, 65, 0.15);
  box-shadow: 0 0 12px var(--torch-glow);
}

/* ==========================================================================
   Hero Deck & Atmospheric Header
   ========================================================================== */
.sanctuary-main {
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: 24px 20px 80px;
}

.sanctuary-intro {
  margin-bottom: 24px;
  padding: 20px 24px;
  background: linear-gradient(135deg, rgba(18, 24, 32, 0.5) 0%, rgba(11, 15, 20, 0.8) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.intro-lore {
  max-width: 680px;
}

.lore-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--torch-gold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.lore-tag i {
  width: 6px;
  height: 6px;
  background: var(--torch-gold);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--torch-gold);
}

.intro-lore h1 {
  font-size: clamp(20px, 3.2vw, 28px);
  font-weight: 500;
  color: var(--text-main);
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.intro-lore p {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.6;
}

.intro-rules-pills {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
}

.rule-pill {
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
}

.rule-pill b {
  font-size: 16px;
  color: var(--torch-gold);
  line-height: 1;
}

.rule-pill span {
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.05em;
  margin-top: 4px;
}

/* ==========================================================================
   Expedition Deck (Split Stage & Rail)
   ========================================================================== */
.expedition-deck {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.85fr);
  gap: 24px;
  align-items: start;
}

/* Left: The Labyrinth Altar */
.altar-chamber {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stage-visor {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
}

.visor-region {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-accent);
}

.visor-region i {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1px solid var(--torch-gold);
  border-radius: 2px;
}

.visor-telemetry {
  display: flex;
  align-items: center;
  gap: 16px;
}

.visor-radar {
  padding: 3px 8px;
  border-radius: 2px;
  font-size: 11px;
  background: var(--emerald-bg);
  border: 1px solid var(--emerald-border);
  color: var(--emerald-open);
  letter-spacing: 0.05em;
  transition: all 120ms ease;
}

.visor-radar.blocked {
  background: var(--ruby-bg);
  border-color: var(--ruby-border);
  color: var(--ruby-blocked);
}

.visor-batch {
  color: var(--text-faint);
  font-size: 11px;
}

/* Canvas Altar Container */
.canvas-altar {
  position: relative;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  background: #05070a;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6), inset 0 0 60px rgba(0, 0, 0, 0.8);
}

.canvas-altar canvas {
  display: block;
  width: 100%;
  height: 540px;
  outline: none;
}

.canvas-overlay-corner {
  position: absolute;
  z-index: 5;
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(240, 235, 225, 0.4);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  pointer-events: none;
}

.corner-tl { top: 14px; left: 16px; }
.corner-br { bottom: 14px; right: 16px; color: var(--torch-gold); }

.altar-compass-rose {
  position: absolute;
  top: 12px;
  right: 16px;
  z-index: 5;
  width: 28px;
  height: 28px;
  background: rgba(18, 24, 32, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: bold;
  color: var(--torch-gold);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

/* Central Stage Start / Result Overlay */
.stage-curtain {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: radial-gradient(circle at center, rgba(11, 15, 20, 0.75) 0%, rgba(4, 6, 9, 0.95) 100%);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.stage-curtain.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.curtain-relic {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  border: 2px solid var(--torch-gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 24px var(--torch-glow-strong);
}

.curtain-relic i {
  display: block;
  width: 18px;
  height: 18px;
  background: var(--torch-gold);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

.stage-curtain strong {
  font-size: 24px;
  font-weight: 500;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.stage-curtain small {
  display: block;
  margin-top: 8px;
  max-width: 320px;
  color: var(--text-sub);
  font-size: 13px;
  line-height: 1.5;
}

.curtain-start-btn {
  margin-top: 24px;
  min-height: 48px;
  padding: 0 28px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--torch-gold) 0%, var(--torch-amber) 100%);
  color: #0c0f12;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 0 24px var(--torch-glow-strong), 0 8px 16px rgba(0, 0, 0, 0.4);
  transition: all 180ms ease;
}

.curtain-start-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 0 32px var(--torch-glow-strong), 0 12px 24px rgba(0, 0, 0, 0.5);
}

/* Observation Stone Panel Inside Stage */
.observation-panel {
  position: absolute;
  bottom: 24px;
  left: 24px;
  right: 24px;
  z-index: 8;
  padding: 16px 20px;
  background: rgba(14, 19, 26, 0.94);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}

.observation-panel p {
  color: var(--torch-gold);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
}

/* Tactical Action Console */
.tactical-console {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  align-items: center;
}

.action-tools-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.action-tool-btn {
  min-height: 48px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.05em;
  transition: all 160ms ease;
}

.action-tool-btn:hover {
  border-color: var(--border-bright);
  color: var(--torch-gold);
  background: var(--bg-card-hover);
}

.action-tool-btn[aria-pressed="true"] {
  border-color: var(--torch-gold);
  background: rgba(245, 176, 65, 0.15);
  color: var(--torch-gold);
  box-shadow: 0 0 14px var(--torch-glow);
}

.action-lever-btn {
  border-color: var(--torch-flame);
  color: var(--torch-flame);
  background: rgba(255, 107, 74, 0.1);
}

.action-lever-btn:hover {
  background: rgba(255, 107, 74, 0.2);
  box-shadow: 0 0 14px rgba(255, 107, 74, 0.3);
}

/* Direction Pad (Tactical Compass) */
.tactical-dpad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  min-width: 320px;
}

.dpad-btn {
  min-height: 48px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-sub);
  font-family: var(--font-mono);
  font-size: 12px;
  transition: all 120ms ease;
}

.dpad-btn span {
  font-weight: 600;
  line-height: 1;
}

.dpad-btn small {
  font-size: 9px;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

.dpad-btn:hover {
  border-color: var(--border-bright);
  color: var(--text-main);
  background: var(--bg-card-hover);
}

.dpad-btn.open {
  border-color: var(--emerald-border);
  background: var(--emerald-bg);
  color: var(--emerald-open);
}

.dpad-btn.open small {
  color: var(--emerald-open);
}

.dpad-btn.blocked {
  border-color: var(--ruby-border);
  background: var(--ruby-bg);
  color: var(--ruby-blocked);
}

.dpad-btn.blocked small {
  color: var(--ruby-blocked);
}

/* Console Guide Tip */
.console-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
}

.console-hint span b {
  color: var(--torch-gold);
  font-weight: 500;
}

/* Right: Sanctuary Telemetry Rail */
.sanctuary-rail {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.telemetry-deck {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.telemetry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.telemetry-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--torch-gold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.telemetry-seed {
  font-size: 12px;
  font-weight: bold;
  color: var(--text-main);
}

/* Chronometer (Timer) */
.chronometer-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chronometer-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.chronometer-time {
  font-family: var(--font-mono);
  font-size: 34px;
  font-weight: 500;
  color: var(--text-main);
  letter-spacing: -0.02em;
  line-height: 1;
}

.chronometer-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 4px;
}

.chronometer-state span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
}

.chronometer-state.running span {
  background: var(--torch-gold);
  box-shadow: 0 0 8px var(--torch-gold);
}

.chronometer-state.finished span {
  background: var(--emerald-open);
  box-shadow: 0 0 8px var(--emerald-open);
}

/* Seal Relics Chamber */
.seals-dock {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.seals-dock-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
}

.seals-dock-head span {
  color: var(--text-sub);
}

.seals-dock-head strong {
  font-size: 16px;
  color: var(--torch-gold);
}

.seal-dots {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.seal-dots i {
  height: 10px;
  border-radius: 2px;
  background: #182029;
  border: 1px solid var(--border-subtle);
  transition: all 200ms ease;
}

.seal-dots i.active {
  background: var(--torch-gold);
  box-shadow: 0 0 10px var(--torch-gold);
  border-color: var(--torch-gold);
}

.seals-dock-note {
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.4;
}

/* Vital Grid Metrics */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.metric-cell {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-cell span {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
  text-transform: uppercase;
}

.metric-cell strong {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--text-main);
  font-weight: 500;
}

/* Telemetry Main Action Buttons */
.telemetry-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-start-run {
  min-height: 44px;
  background: var(--torch-gold);
  color: #0c0f12;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 160ms ease;
}

.btn-start-run:hover {
  background: var(--torch-amber);
  box-shadow: 0 0 16px var(--torch-glow);
}

.btn-reset-run {
  min-height: 44px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-sub);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  transition: all 160ms ease;
}

.btn-reset-run:hover {
  border-color: var(--border-medium);
  color: var(--text-main);
}

/* Phase Jump (Practice & Return) */
.phase-dock {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.phase-dock-title {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.phase-btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.phase-btn {
  min-height: 44px;
  padding: 0 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-sub);
  transition: all 160ms ease;
}

.phase-btn:hover {
  border-color: var(--border-medium);
  color: var(--text-main);
}

/* Ancient Codex (Guide) */
.codex-deck {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}

.codex-deck summary {
  cursor: pointer;
  list-style: none;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--torch-gold);
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.codex-deck summary::-webkit-details-marker {
  display: none;
}

.codex-content {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.codex-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.5;
}

.codex-item i {
  font-style: normal;
  font-family: var(--font-mono);
  color: var(--torch-gold);
  font-size: 14px;
  line-height: 1;
}

.codex-regions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.codex-regions span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
}

/* Live Echo Banner */
.live-echo-banner {
  padding: 12px 16px;
  background: rgba(18, 24, 32, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-sub);
}

.live-echo-banner p {
  line-height: 1.5;
}

/* ==========================================================================
   Chronicles & Monument of Escapees (Lower Deck)
   ========================================================================== */
.chronicles-deck {
  margin-top: 56px;
  padding-top: 40px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.chronicles-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.chronicles-title-group h2 {
  font-size: clamp(22px, 3.5vw, 32px);
  font-weight: 500;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.chronicles-title-group p {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-sub);
}

.chronicles-tabs {
  display: flex;
  gap: 8px;
}

.chronicles-tab-btn {
  min-height: 44px;
  padding: 0 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-sub);
  transition: all 160ms ease;
}

.chronicles-tab-btn:hover {
  color: var(--text-main);
  border-color: var(--border-medium);
}

.chronicles-tab-btn[aria-pressed="true"] {
  border-color: var(--torch-gold);
  color: var(--torch-gold);
  background: rgba(245, 176, 65, 0.12);
}

/* Podium & Records Grid */
.podium-monument {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.monument-stone {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.stone-rank-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: 0.1em;
}

.stone-avatar-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px dashed var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-family: var(--font-mono);
  margin: 6px 0;
}

.monument-stone h3 {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-main);
}

.monument-stone strong {
  font-family: var(--font-mono);
  font-size: 20px;
  color: var(--torch-gold);
}

.monument-stone small {
  font-size: 11px;
  color: var(--text-faint);
}

.monument-stone.rank-prime {
  border-color: var(--border-bright);
  background: linear-gradient(180deg, rgba(245, 176, 65, 0.08) 0%, var(--bg-card) 100%);
  box-shadow: 0 0 24px var(--torch-glow);
}

.monument-stone.rank-prime .stone-avatar-circle {
  border-color: var(--torch-gold);
  color: var(--torch-gold);
}

/* Personal Strip */
.personal-ledger {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.personal-rank-info {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
}

.personal-rank-info span {
  font-size: 12px;
  color: var(--text-faint);
  text-transform: uppercase;
}

.personal-rank-info strong {
  font-size: 20px;
  color: var(--torch-gold);
}

.personal-rank-info small {
  font-size: 11px;
  color: var(--text-sub);
}

.btn-closing-start {
  min-height: 44px;
  padding: 0 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  color: var(--torch-gold);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 160ms ease;
}

.btn-closing-start:hover {
  background: rgba(245, 176, 65, 0.15);
  box-shadow: 0 0 14px var(--torch-glow);
}

/* Vault Records Export (Details Accordion) */
.vault-export-drawer {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 24px;
}

.vault-export-drawer summary {
  cursor: pointer;
  list-style: none;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-main);
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.vault-export-drawer summary::-webkit-details-marker {
  display: none;
}

.vault-drawer-body {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.vault-drawer-body p {
  font-size: 12px;
  color: var(--text-faint);
}

.btn-export-trigger {
  align-self: flex-start;
  min-height: 44px;
  padding: 0 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-sub);
  transition: all 160ms ease;
}

.btn-export-trigger:hover {
  border-color: var(--border-medium);
  color: var(--text-main);
}

.record-preview {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.record-preview textarea {
  width: 100%;
  height: 120px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-sub);
  resize: vertical;
}

.record-preview-actions {
  display: flex;
  gap: 10px;
}

.record-preview-actions button {
  min-height: 44px;
  padding: 0 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-sub);
  transition: all 160ms ease;
}

.record-preview-actions button:hover {
  color: var(--text-main);
  border-color: var(--border-medium);
}

/* Run Review Post-Game Drawer */
.run-review-deck {
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: 0 0 28px var(--torch-glow);
}

.run-review-deck h3 {
  font-size: 18px;
  color: var(--torch-gold);
  margin-bottom: 8px;
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.review-actions button {
  min-height: 44px;
  padding: 0 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-sub);
}

.review-actions button:hover {
  border-color: var(--border-bright);
  color: var(--torch-gold);
}

/* ==========================================================================
   Share Modal Dialog
   ========================================================================== */
.share-modal-veil {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(4, 6, 9, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.share-modal-card {
  width: 100%;
  max-width: 460px;
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 32px var(--torch-glow);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.share-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--torch-gold);
  letter-spacing: 0.1em;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.share-card-close {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-sub);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  transition: all 120ms ease;
}

.share-card-close:hover {
  color: var(--text-main);
  border-color: var(--border-medium);
}

.share-card-copy h2 {
  font-size: 20px;
  font-weight: 500;
  color: var(--text-main);
}

.share-card-copy p {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-sub);
}

.share-url-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.share-url-text {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  word-break: break-all;
}

.btn-copy-share {
  min-height: 44px;
  background: var(--torch-gold);
  color: #0c0f12;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 140ms ease;
}

.btn-copy-share:hover {
  background: var(--torch-amber);
}

.share-social-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.share-social-btn {
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-sub);
  font-family: var(--font-mono);
  font-size: 10px;
  transition: all 140ms ease;
}

.share-social-btn span {
  font-size: 14px;
  color: var(--torch-gold);
}

.share-social-btn:hover {
  border-color: var(--border-medium);
  color: var(--text-main);
}

.share-status-msg {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  text-align: center;
}

/* ==========================================================================
   Footer Deck
   ========================================================================== */
.sanctuary-footer {
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: 24px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-brand strong {
  color: var(--text-sub);
}

.footer-brand .exit-totem {
  width: 20px;
  height: 20px;
}

/* ==========================================================================
   Focus Play Mode
   ========================================================================== */
body.focus-play .sanctuary-intro,
body.focus-play .sanctuary-rail,
body.focus-play .chronicles-deck,
body.focus-play .sanctuary-footer {
  display: none !important;
}

body.focus-play .sanctuary-header {
  position: fixed !important;
  top: 12px !important;
  right: 12px !important;
  left: auto !important;
  bottom: auto !important;
  height: auto !important;
  min-height: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  z-index: 1000 !important;
  pointer-events: none !important;
  padding: 0 !important;
}

body.focus-play .header-container {
  padding: 0 !important;
  margin: 0 !important;
  width: auto !important;
  max-width: none !important;
  display: block !important;
}

body.focus-play .brand-badge,
body.focus-play .header-status-capsule,
body.focus-play .hud-select-wrap,
body.focus-play #soundToggle,
body.focus-play #shareChallenge {
  display: none !important;
}

body.focus-play .header-controls {
  display: block !important;
  width: auto !important;
  pointer-events: auto !important;
  grid-template-columns: none !important;
}

body.focus-play #focusToggle {
  display: inline-flex !important;
  pointer-events: auto !important;
  background: rgba(10, 14, 20, 0.92) !important;
  border: 1.5px solid var(--torch-gold) !important;
  color: var(--torch-gold) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.75), 0 0 12px var(--torch-glow) !important;
  border-radius: 22px !important;
  padding: 0 16px !important;
  height: 44px !important;
  min-height: 44px !important;
  min-width: 44px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

body.focus-play .sanctuary-main {
  padding: 10px;
  max-width: 100vw;
}

body.focus-play .expedition-deck {
  grid-template-columns: 1fr;
}

body.focus-play .canvas-altar canvas {
  height: calc(100vh - 160px);
  min-height: 480px;
}

/* ==========================================================================
   Responsive Breakpoints: 1024px, 768px, 520px, 360px
   ========================================================================== */
@media (max-width: 1024px) {
  .expedition-deck {
    grid-template-columns: 1fr;
  }
  .canvas-altar canvas {
    height: 480px;
  }
}

@media (max-width: 768px) {
  .header-status-capsule {
    padding: 3px 8px;
    font-size: 11px;
    gap: 6px;
  }
  .sanctuary-intro {
    padding: 16px;
  }
  .tactical-console {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .tactical-dpad {
    width: 100%;
    min-width: 0;
  }
  .podium-monument {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .sanctuary-header {
    height: auto;
  }
  .header-container {
    padding: 8px 12px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  .brand-badge {
    flex: 0 1 auto;
    min-width: 0;
  }
  .header-status-capsule {
    flex: 0 0 auto;
  }
  .header-controls {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .hud-btn, .hud-select-wrap {
    min-width: 44px;
    min-height: 44px;
    height: 44px;
    padding: 0 8px;
    font-size: 12px;
    justify-content: center;
    white-space: nowrap;
    overflow: visible;
  }
  .hud-select-wrap select {
    width: 100%;
    text-align: center;
    font-size: 12px;
    padding: 0 4px;
  }
}

@media (max-width: 520px) {
  :root {
    --header-height: auto;
  }
  .sanctuary-main {
    padding: 14px 12px 60px;
  }
  .canvas-altar canvas {
    height: 380px;
  }
  .brand-title small {
    font-size: 9px;
    letter-spacing: 0.5px;
    opacity: 0.85;
  }
  .stage-visor {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .visor-telemetry {
    width: 100%;
    justify-content: space-between;
  }
  .chronometer-time {
    font-size: 28px;
  }
  .metrics-grid {
    grid-template-columns: 1fr 1fr;
  }
  .personal-ledger {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-closing-start {
    justify-content: center;
  }
}

@media (max-width: 360px) {
  .canvas-altar canvas {
    height: 300px;
  }
  .dpad-btn {
    padding: 6px 4px;
    font-size: 11px;
    gap: 2px;
  }
  .dpad-btn small {
    font-size: 9px;
    line-height: 1.1;
    opacity: 0.85;
  }
}

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