:root {
  --bg-void: #07060b;
  --bg-surface: #110e17;
  --bg-card: rgba(20, 17, 28, 0.85);
  --brass: #d6b26e;
  --brass-bright: #f5dea8;
  --brass-dim: rgba(214, 178, 110, 0.3);
  --burgundy: #7a1c26;
  --emerald: #1f6b52;
  --sapphire: #4ea5ff;
  --crimson: #e04646;
  --parchment: #efe3c6;
  --parchment-ink: #2b1f14;
  --text-main: #f6efe2;
  --text-muted: #b9ad96;
  --font-serif: "Cinzel", "Palatino Linotype", "Book Antiqua", "Songti SC", "STSong", Georgia, serif;
  --font-sans: "Inter", "PingFang SC", "Noto Sans SC", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: radial-gradient(circle at 30% 10%, #1b1526 0%, var(--bg-void) 70%);
  color: var(--text-main);
  font-family: var(--font-sans);
}

.ambient-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(640px circle at 15% 15%, rgba(214, 178, 110, 0.08), transparent 60%),
    radial-gradient(680px circle at 85% 80%, rgba(122, 28, 38, 0.12), transparent 60%);
  z-index: 0;
}

/* Top Header */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  background: rgba(11, 9, 16, 0.92);
  border-bottom: 1px solid rgba(214, 178, 110, 0.25);
  backdrop-filter: blur(12px);
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-crest {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--brass);
  background: radial-gradient(circle, rgba(122, 28, 38, 0.7), rgba(20, 14, 24, 0.9));
  color: var(--brass-bright);
  font-size: 16px;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  color: var(--brass-bright);
  letter-spacing: 0.06em;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.top-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.seg-group {
  display: inline-flex;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--brass-dim);
  background: rgba(20, 16, 28, 0.8);
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.seg-btn.active {
  background: rgba(214, 178, 110, 0.25);
  color: var(--brass-bright);
}

.top-pill {
  height: 29px;
  padding: 0 11px;
  border-radius: 6px;
  border: 1px solid var(--brass-dim);
  background: rgba(20, 16, 28, 0.82);
  color: var(--text-main);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.top-pill:hover, .top-pill.active {
  border-color: var(--brass-bright);
  color: var(--brass-bright);
  background: rgba(122, 28, 38, 0.42);
}

/* Quick 7-Act Showcase Strip */
.showcase-strip {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  padding: 8px 16px;
  background: rgba(13, 11, 18, 0.72);
  border-bottom: 1px solid rgba(214, 178, 110, 0.14);
}

.showcase-card {
  padding: 7px 10px;
  border-radius: 7px;
  border: 1px solid rgba(214, 178, 110, 0.22);
  background: rgba(24, 20, 34, 0.72);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  transition: all 0.18s ease;
}

.showcase-card:hover, .showcase-card.active {
  border-color: var(--brass-bright);
  background: rgba(122, 28, 38, 0.35);
  transform: translateY(-1px);
}

.sc-tag {
  font-size: 10px;
  color: var(--brass);
  font-family: var(--font-mono);
}

.sc-title {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 700;
  color: var(--brass-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sc-desc {
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Workspace Grid: Director Mode vs Full Cinema Mode */
.workspace-layout {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 14px;
  padding: 12px 16px 24px;
  max-width: 1720px;
  margin: 0 auto;
}

body.cinema-mode .showcase-strip,
body.cinema-mode .right-column,
body.cinema-mode .dag-panel {
  display: none;
}

body.cinema-mode .workspace-layout {
  grid-template-columns: minmax(0, 1fr);
  max-width: min(100vw, calc((100vh - 96px) * 16 / 9));
  padding: 10px 16px;
}

.left-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

/* Pseudo-3D Perspective Wrapper */
.stage-perspective-wrap {
  perspective: 1250px;
  transform-style: preserve-3d;
}

.stage-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #050408;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid rgba(214, 178, 110, 0.36);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.8), inset 0 0 36px rgba(0, 0, 0, 0.6);
  transform-style: preserve-3d;
  transition: transform 0.12s ease-out;
  user-select: none;
}

.stage-frame.orbit-grabbing {
  cursor: grabbing !important;
}

.stage-frame.orbit-ready {
  cursor: grab;
}

.stage-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.36s ease;
  pointer-events: none;
}

.stage-video.active {
  opacity: 1;
}

.film-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(6, 5, 10, 0.56) 0%, transparent 22%, transparent 65%, rgba(6, 5, 10, 0.82) 100%),
    radial-gradient(ellipse at center, transparent 58%, rgba(4, 3, 7, 0.58) 100%);
  z-index: 2;
}

.spell-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 6;
  background: radial-gradient(circle at 46% 45%, rgba(255, 224, 150, 0.85), rgba(220, 48, 48, 0.45) 45%, transparent 72%);
}

.spell-flash.trigger { animation: spellBurst 0.65s ease-out forwards; }
@keyframes spellBurst {
  0% { opacity: 0; transform: scale(0.85); }
  22% { opacity: 0.95; transform: scale(1.06); }
  100% { opacity: 0; transform: scale(1.25); }
}

/* Parchment Transition */
.parchment-transition {
  position: absolute;
  inset: 0;
  z-index: 22;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #f6eedc 0%, #e4d4b0 65%, #cfb98c 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.42s ease;
}

.parchment-transition.visible { opacity: 1; pointer-events: auto; }

.parchment-plaque {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 12px 32px;
  background: rgba(54, 41, 28, 0.88);
  border: 1.5px solid #c9a259;
  color: #f7ecd2;
  font-family: var(--font-serif);
  font-size: clamp(15px, 1.8vw, 22px);
  letter-spacing: 0.14em;
  clip-path: polygon(12px 0%, calc(100% - 12px) 0%, 100% 50%, calc(100% - 12px) 100%, 12px 100%, 0% 50%);
}

/* Opening Curtain */
.start-curtain {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.55s ease, visibility 0.55s ease;
}

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

.curtain-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 7, 13, 0.52) 0%, rgba(8, 7, 13, 0.72) 55%, rgba(8, 7, 13, 0.92) 100%),
    url('media/images/kf_courtyard_evelyn.jpg') center/cover no-repeat;
}

.curtain-lang-bar {
  position: absolute;
  top: 18px;
  right: 20px;
  z-index: 2;
  display: flex;
  gap: 7px;
}

.lang-pill {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--brass-dim);
  background: rgba(14, 12, 20, 0.74);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
}

.lang-pill.active, .lang-pill:hover {
  border-color: var(--brass-bright);
  color: var(--brass-bright);
  background: rgba(122, 28, 38, 0.45);
}

.curtain-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 720px;
  padding: 20px;
}

.curtain-crest { color: var(--brass-bright); margin-bottom: 8px; }
.curtain-eyebrow { margin: 0 0 6px; font-size: 11px; letter-spacing: 0.24em; color: var(--brass); font-weight: 700; }
.curtain-title {
  margin: 0 0 10px;
  font-family: var(--font-serif);
  font-size: clamp(28px, 3.8vw, 50px);
  letter-spacing: 0.08em;
  color: var(--brass-bright);
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.85);
}
.curtain-subtitle { margin: 0 0 22px; font-size: clamp(12.5px, 1.2vw, 15px); color: #e4dac6; }
.curtain-hint { margin: 14px 0 0; font-size: 11.5px; color: rgba(219, 208, 186, 0.8); }

.btn-brass-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 30px;
  border-radius: 4px;
  border: 1.5px solid var(--brass-bright);
  background: linear-gradient(180deg, rgba(136, 32, 44, 0.94), rgba(76, 16, 24, 0.96));
  color: var(--brass-bright);
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.65), 0 0 22px rgba(214, 178, 110, 0.3);
  transition: transform 0.18s ease, filter 0.18s ease;
}

.btn-brass-primary:hover { transform: translateY(-2px); filter: brightness(1.12); }

.btn-brass-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 4px;
  border: 1px solid var(--brass-dim);
  background: rgba(24, 20, 30, 0.88);
  color: var(--text-main);
  font-family: var(--font-serif);
  font-size: 13.5px;
  cursor: pointer;
}

.btn-brass-secondary:hover { border-color: var(--brass-bright); color: var(--brass-bright); }

/* In-Stage HUD */
.hud-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 12;
  pointer-events: none;
}

.hud-top.hidden { display: none; }
.hud-left, .hud-right { pointer-events: auto; display: flex; flex-direction: column; gap: 6px; }
.hud-right { align-items: flex-end; }

.badge-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.model-tag {
  padding: 3px 9px;
  border-radius: 4px;
  background: rgba(12, 10, 16, 0.78);
  border: 1px solid rgba(214, 178, 110, 0.35);
  color: var(--brass);
  font-size: 10.5px;
  font-family: var(--font-mono);
  backdrop-filter: blur(6px);
}

/* Living Idle Breathing Indicator */
.idle-breath-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(24, 78, 61, 0.82);
  border: 1px solid #7ee3b8;
  color: #dcffef;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 0 16px rgba(126, 227, 184, 0.35);
}

.idle-breath-pill.hidden { display: none; }

.breath-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8cffc9;
  animation: breathPulse 2.2s ease-in-out infinite;
}

@keyframes breathPulse {
  0%, 100% { transform: scale(0.8); opacity: 0.55; }
  50% { transform: scale(1.35); opacity: 1; }
}

.objective-card {
  padding: 7px 12px;
  border-left: 3px solid var(--brass);
  background: linear-gradient(90deg, rgba(12, 10, 18, 0.84), rgba(12, 10, 18, 0.32));
  border-radius: 0 6px 6px 0;
  backdrop-filter: blur(6px);
  max-width: 340px;
}

.objective-label { font-size: 9.5px; letter-spacing: 0.14em; color: var(--brass); text-transform: uppercase; }
.objective-text { font-size: 12.5px; font-weight: 500; color: var(--text-main); margin-top: 2px; }

.toast-stack { display: flex; flex-direction: column; gap: 5px; }
.toast-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(36, 26, 16, 0.94), rgba(18, 14, 20, 0.78));
  border: 1px solid var(--brass);
  color: var(--brass-bright);
  font-size: 12px;
  font-weight: 600;
  animation: toastSlideIn 0.36s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.toast-item.success { border-color: #79d4a6; color: #c9f7df; }
.toast-item.info { border-color: #7eb8f7; color: #d6eaff; }
.toast-item.danger { border-color: #ff7a7a; background: rgba(120, 18, 26, 0.92); color: #ffd9d9; }

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: translateX(0); }
}

.hud-controls-row { display: flex; align-items: center; gap: 6px; }
.hud-chip, .hud-icon-btn {
  height: 26px;
  border-radius: 5px;
  border: 1px solid var(--brass-dim);
  background: rgba(12, 10, 16, 0.78);
  color: var(--text-main);
  font-size: 11.5px;
  padding: 0 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.hud-icon-btn { width: 26px; padding: 0; color: var(--brass); }
.hud-chip:hover, .hud-icon-btn:hover { border-color: var(--brass-bright); color: var(--brass-bright); }

.hud-status-row { display: flex; align-items: center; gap: 8px; }
.stats-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(12, 10, 16, 0.78);
  border: 1px solid rgba(214, 178, 110, 0.28);
  font-size: 11.5px;
}
.stat-item { display: inline-flex; align-items: center; gap: 4px; color: var(--text-muted); }
.stat-item strong { color: var(--brass-bright); }
.stat-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.stat-dot.gold { background: var(--brass-bright); }
.stat-dot.blue { background: var(--sapphire); }
.stat-dot.amber { background: #e69d35; }
.stat-divider { width: 1px; height: 10px; background: rgba(214, 178, 110, 0.25); }

.compass-widget { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.compass-svg { transition: transform 0.15s ease-out; }
.location-badge {
  padding: 2px 8px;
  border-radius: 3px;
  background: rgba(12, 10, 16, 0.82);
  border: 1px solid rgba(214, 178, 110, 0.35);
  font-size: 10.5px;
  color: var(--brass-bright);
  white-space: nowrap;
}

/* Character Plate */
.character-plate {
  position: absolute;
  top: 104px;
  right: 22%;
  z-index: 11;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(14, 12, 18, 0.8);
  border: 1px solid rgba(214, 178, 110, 0.48);
  color: #efe4cc;
  font-size: 11.5px;
}
.character-plate.hidden { display: none; }
.plate-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brass-bright); }
.hostile-pill {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(196, 36, 36, 0.92);
  border: 1px solid #ff9494;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
}
.hostile-pill.hidden { display: none; }

/* Pseudo-3D Orbit Interactive Overlay */
.orbit-overlay {
  position: absolute;
  inset: 0;
  z-index: 16;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 22px;
}
.orbit-overlay.hidden { display: none; }

.orbit-dial {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(12, 10, 18, 0.86);
  border: 1px solid var(--brass);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65);
}

.orbit-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--brass-bright);
  letter-spacing: 0.08em;
}

.orbit-angle {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: #8ee7ff;
  min-width: 44px;
  text-align: center;
}

.orbit-bar {
  position: relative;
  width: 120px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.orbit-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--brass-bright);
  box-shadow: 0 0 10px rgba(245, 222, 168, 0.9);
}

.orbit-mini-btn {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--brass-dim);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  font-size: 11px;
  cursor: pointer;
}
.orbit-mini-btn.active {
  background: rgba(78, 165, 255, 0.25);
  border-color: var(--sapphire);
  color: #c8e6ff;
}
.orbit-mini-btn.exit {
  border-color: rgba(224, 70, 70, 0.6);
  background: rgba(122, 28, 38, 0.55);
  color: #ffdede;
}

.orbit-drag-hint {
  padding: 7px 18px;
  border-radius: 999px;
  background: rgba(12, 10, 18, 0.8);
  border: 1px solid rgba(214, 178, 110, 0.45);
  color: var(--brass-bright);
  font-size: 12.5px;
  letter-spacing: 0.05em;
  animation: hintFloat 2.4s ease-in-out infinite;
}

@keyframes hintFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* Act 2 Interactive 3-Location Marauder Map + Animated Footsteps + 3D Zoom */
.stage-frame.map-zooming {
  transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1), filter 0.75s ease !important;
}

.orbit-overlay.with-hub {
  align-items: flex-start;
  padding-left: 24px;
}

.map-hotspot-layer {
  position: absolute;
  inset: 0;
  z-index: 15;
  pointer-events: none;
}
.map-hotspot-layer.hidden { display: none; }

.map-route-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.map-route-base {
  fill: none;
  stroke: rgba(245, 222, 168, 0.36);
  stroke-width: 0.45;
  stroke-dasharray: 1.4 1.2;
}

.map-route-active {
  fill: none;
  stroke: #ffe59e;
  stroke-width: 0.9;
  stroke-linecap: round;
  filter: drop-shadow(0 0 2px rgba(245, 222, 168, 0.95));
  stroke-dasharray: 160;
  stroke-dashoffset: 160;
  animation: drawInkRoute 1.15s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes drawInkRoute {
  to { stroke-dashoffset: 0; }
}

.map-footstep {
  fill: #ffe8a8;
  opacity: 0;
  filter: drop-shadow(0 0 1.4px rgba(255, 226, 140, 0.95));
  animation: stepAppear 1.25s ease-out forwards;
}

@keyframes stepAppear {
  0% { opacity: 0; transform: scale(0.5); }
  25% { opacity: 1; transform: scale(1.1); }
  75% { opacity: 0.9; transform: scale(1); }
  100% { opacity: 0.45; transform: scale(0.95); }
}

.map-pins-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.map-origin-chip {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(16, 12, 20, 0.85);
  border: 1px dashed rgba(214, 178, 110, 0.72);
  color: #e9d5a6;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.65);
}

.map-pin-btn {
  pointer-events: auto;
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: transform 0.22s ease, opacity 0.25s ease;
}

.map-pin-btn:hover {
  transform: translate(-50%, -54%) scale(1.06);
  z-index: 4;
}

.map-pin-btn.dimmed {
  opacity: 0.28;
  pointer-events: none;
}

.map-pin-btn.travel-target .pin-core {
  box-shadow: 0 0 42px rgba(255, 232, 166, 1);
  transform: scale(1.18);
}

.pin-pulse {
  position: absolute;
  top: -10px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--brass-bright);
  animation: mapRipple 1.9s ease-out infinite;
}

.map-pin-btn.secondary .pin-pulse {
  border-color: #7cc9ff;
}

@keyframes mapRipple {
  0% { transform: scale(0.65); opacity: 0.95; }
  100% { transform: scale(1.65); opacity: 0; }
}

.pin-core {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, rgba(168, 34, 48, 0.95), rgba(74, 14, 22, 0.96));
  border: 2px solid var(--brass-bright);
  color: var(--brass-bright);
  font-size: 19px;
  box-shadow: 0 0 24px rgba(245, 222, 168, 0.72);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.map-pin-btn.secondary .pin-core {
  background: radial-gradient(circle, rgba(28, 66, 108, 0.95), rgba(14, 28, 52, 0.96));
  border-color: #8fd3ff;
  box-shadow: 0 0 22px rgba(124, 201, 255, 0.65);
}

.pin-badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(122, 28, 38, 0.92);
  border: 1px solid rgba(245, 222, 168, 0.7);
  color: #fff3d1;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.map-pin-btn.secondary .pin-badge {
  background: rgba(24, 62, 104, 0.92);
  border-color: rgba(143, 211, 255, 0.75);
  color: #dff4ff;
}

.pin-badge.visited {
  background: rgba(24, 88, 56, 0.94);
  border-color: #6ee7b7;
  color: #d1fae5;
}

.pin-label {
  padding: 5px 13px;
  border-radius: 999px;
  background: rgba(14, 11, 20, 0.92);
  border: 1.5px solid var(--brass-bright);
  color: var(--brass-bright);
  font-family: var(--font-serif);
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.82);
}

.map-pin-btn.secondary .pin-label {
  border-color: rgba(143, 211, 255, 0.8);
  color: #eaf6ff;
}

.pin-sub {
  max-width: 210px;
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(10, 8, 16, 0.8);
  color: #d8ccb4;
  font-size: 10.5px;
  line-height: 1.3;
  text-align: center;
}

.map-travel-banner {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 9px 22px;
  border-radius: 999px;
  background: rgba(22, 16, 26, 0.94);
  border: 1.5px solid var(--brass-bright);
  color: var(--brass-bright);
  font-family: var(--font-serif);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.85);
  z-index: 6;
}
.map-travel-banner.hidden { display: none; }

/* Courtyard Hub Buttons */
.courtyard-hub {
  position: absolute;
  right: 22px;
  bottom: 52px;
  z-index: 14;
  display: flex;
  align-items: flex-end;
  gap: 12px;
}
.courtyard-hub.hidden { display: none; }

.round-hub-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 1.5px solid rgba(214, 178, 110, 0.68);
  background: radial-gradient(circle at 35% 30%, rgba(44, 34, 24, 0.9), rgba(14, 11, 18, 0.94));
  color: var(--brass-bright);
  cursor: pointer;
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.65);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  padding: 4px;
}

.round-hub-btn:hover { transform: translateY(-4px) scale(1.05); border-color: #fff2cc; }

.round-hub-btn.orbit-orb {
  border-color: #7cc4ff;
  background: radial-gradient(circle at 35% 30%, rgba(22, 68, 110, 0.92), rgba(12, 24, 44, 0.95));
  color: #d6eeff;
}

.round-hub-btn.primary-orb {
  width: 92px;
  height: 92px;
  border-width: 2px;
  border-color: var(--brass-bright);
  background: radial-gradient(circle at 35% 30%, rgba(148, 34, 46, 0.95), rgba(62, 13, 20, 0.96));
  animation: orbPulse 2.3s ease-in-out infinite;
}

@keyframes orbPulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7), 0 0 14px rgba(214, 178, 110, 0.35); }
  50% { box-shadow: 0 8px 28px rgba(0, 0, 0, 0.75), 0 0 30px rgba(245, 222, 168, 0.7); }
}

.round-icon { font-size: 20px; line-height: 1; margin-bottom: 4px; }
.round-label { font-size: 10.5px; font-weight: 700; text-align: center; line-height: 1.15; }

/* Choice Overlay over Living Idle Breathing Loop */
.choice-overlay {
  position: absolute;
  left: 50%;
  bottom: 62px;
  transform: translateX(-50%);
  width: min(94%, 820px);
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
}
.choice-overlay.hidden { display: none; }

.choice-top-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.choice-eyebrow {
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(12, 10, 18, 0.78);
  border: 1px solid rgba(214, 178, 110, 0.4);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: var(--brass-bright);
}

.timer-pause-chip {
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--brass-dim);
  background: rgba(18, 14, 24, 0.84);
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
}
.timer-pause-chip:hover { color: var(--brass-bright); border-color: var(--brass-bright); }

.choice-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 11px;
  width: 100%;
}

.choice-btn {
  position: relative;
  flex: 1 1 200px;
  max-width: 270px;
  padding: 10px 15px;
  border-radius: 5px;
  border: 1.5px solid rgba(214, 178, 110, 0.6);
  background: linear-gradient(180deg, rgba(20, 16, 26, 0.9), rgba(10, 8, 14, 0.95));
  color: #f8f0df;
  cursor: pointer;
  text-align: center;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.72);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.choice-btn.recommended {
  border-color: var(--brass-bright);
  background: linear-gradient(180deg, rgba(102, 24, 34, 0.88), rgba(38, 12, 18, 0.95));
}

.choice-btn:hover {
  transform: translateY(-3px);
  border-color: #fff3cf;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.8), 0 0 22px rgba(245, 222, 168, 0.45);
}

.choice-key {
  position: absolute;
  top: 5px;
  left: 7px;
  font-size: 10px;
  font-weight: 700;
  color: var(--brass);
}

.choice-label { display: block; font-family: var(--font-serif); font-size: 14px; font-weight: 700; color: var(--brass-bright); }
.choice-hint { display: block; margin-top: 3px; font-size: 11px; color: #cfc3ab; }

.choice-timer-wrap { width: min(68%, 440px); }
.choice-timer-track {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  display: flex;
  justify-content: center;
  overflow: hidden;
}
.choice-timer-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #b8873c, #f6e1a8, #b8873c);
  transition: width 0.1s linear;
}

/* Subtitles */
.subtitle-box {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  width: min(90%, 820px);
  text-align: center;
  z-index: 13;
  pointer-events: none;
}
.subtitle-box.hidden { display: none; }
.sub-en { font-size: clamp(12.5px, 1.2vw, 16px); font-weight: 600; color: #fff; text-shadow: 0 2px 6px #000; }
.sub-zh { margin-top: 2px; font-size: clamp(11.5px, 1.05vw, 14px); color: #f3dfb0; text-shadow: 0 2px 6px #000; }

.clip-progress-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, 0.08); z-index: 16; }
.clip-progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--burgundy), var(--brass-bright)); }

/* Stage Transport Bar */
.transport-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid rgba(214, 178, 110, 0.22);
}

.transport-left, .transport-right { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }

.mini-ctrl {
  padding: 5px 10px;
  border-radius: 5px;
  border: 1px solid var(--brass-dim);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  font-size: 12px;
  cursor: pointer;
}
.mini-ctrl:hover { border-color: var(--brass-bright); color: var(--brass-bright); }

.vlm-inline-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-family: var(--font-mono);
  background: rgba(31, 107, 82, 0.25);
  border: 1px solid rgba(126, 227, 184, 0.45);
  color: #c8f9e4;
}

.time-pill {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
}

/* DAG Story Tree Panel */
.dag-panel {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid rgba(214, 178, 110, 0.22);
}

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

.panel-header h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 14px;
  color: var(--brass-bright);
}

.dag-progress-badge {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(214, 178, 110, 0.15);
  border: 1px solid var(--brass-dim);
  color: var(--brass-bright);
}

.dag-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.dag-tier-col {
  padding: 8px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(214, 178, 110, 0.14);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dag-tier-label {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--brass);
  letter-spacing: 0.06em;
}

.dag-node-btn {
  padding: 7px 9px;
  border-radius: 6px;
  border: 1px solid rgba(214, 178, 110, 0.24);
  background: rgba(16, 13, 24, 0.85);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  transition: all 0.16s ease;
}

.dag-node-btn:hover { border-color: var(--brass-bright); transform: translateY(-1px); }
.dag-node-btn.visited { border-color: #6bc79a; background: rgba(24, 78, 61, 0.26); }
.dag-node-btn.active { border-color: var(--brass-bright); background: rgba(122, 28, 38, 0.48); box-shadow: 0 0 12px rgba(214, 178, 110, 0.28); }
.dag-node-name { font-size: 11.5px; font-weight: 700; color: var(--brass-bright); }
.dag-node-meta { font-size: 10px; color: var(--text-muted); margin-top: 2px; font-family: var(--font-mono); }

/* Right Director Column */
.right-column {
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid rgba(214, 178, 110, 0.25);
  overflow: hidden;
  max-height: calc(100vh - 120px);
  position: sticky;
  top: 60px;
}

.director-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid rgba(214, 178, 110, 0.2);
  background: rgba(12, 10, 18, 0.8);
}

.dir-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 10px 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.18s ease;
}

.dir-tab.active, .dir-tab:hover {
  color: var(--brass-bright);
  border-bottom-color: var(--brass-bright);
  background: rgba(214, 178, 110, 0.08);
}

.director-body {
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dir-card {
  padding: 11px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(214, 178, 110, 0.18);
}

.dir-card h3 {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-size: 13.5px;
  color: var(--brass-bright);
}

.dir-card p { margin: 0; font-size: 12px; color: var(--text-muted); line-height: 1.5; }

.map-row {
  padding: 8px 9px;
  border-radius: 6px;
  border: 1px solid rgba(214, 178, 110, 0.15);
  background: rgba(12, 10, 18, 0.65);
  cursor: pointer;
  margin-top: 7px;
  transition: border-color 0.16s ease;
}
.map-row:hover { border-color: var(--brass-bright); }
.map-row-act { font-size: 10.5px; font-family: var(--font-mono); color: var(--brass); font-weight: 700; }
.map-row-orig { font-size: 11px; color: #9c9282; margin-top: 2px; }
.map-row-hp { font-size: 11.5px; color: #f3e4c6; margin-top: 2px; font-weight: 600; }

/* Cast & Anchor Gallery in Director Tab */
.cast-mini-card {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(214, 178, 110, 0.24);
  background: rgba(14, 12, 20, 0.85);
  cursor: pointer;
}
.cast-mini-card:hover { border-color: var(--brass-bright); }
.cast-mini-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.cast-mini-body { padding: 8px 10px; }
.cast-mini-title { font-size: 12.5px; font-weight: 700; color: var(--brass-bright); }
.cast-mini-sub { font-size: 11px; color: #a7c9ec; margin-top: 2px; }
.cast-mini-desc { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; line-height: 1.4; }
.pill-mini {
  display: inline-block;
  margin-top: 5px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-family: var(--font-mono);
  background: rgba(214, 178, 110, 0.14);
  color: var(--brass);
}

/* VLM QC Audit Cards */
.vlm-summary-box {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.vlm-kpi {
  padding: 8px;
  border-radius: 7px;
  background: rgba(12, 10, 18, 0.8);
  border: 1px solid rgba(214, 178, 110, 0.22);
  text-align: center;
}
.vlm-kpi strong { display: block; font-size: 18px; color: var(--brass-bright); font-family: var(--font-mono); }
.vlm-kpi span { font-size: 10.5px; color: var(--text-muted); }

.vlm-item {
  padding: 9px 11px;
  border-radius: 7px;
  background: rgba(12, 10, 18, 0.8);
  border: 1px solid rgba(214, 178, 110, 0.2);
}
.vlm-item-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.vlm-item-id { font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--brass-bright); }
.vlm-score-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}
.vlm-score-badge.pass { background: rgba(31, 107, 82, 0.38); color: #9effd2; border: 1px solid #6bd6a5; }
.vlm-score-badge.warn { background: rgba(180, 120, 32, 0.35); color: #ffe1a8; border: 1px solid #d6a44e; }
.vlm-reroll-tag {
  margin-top: 5px;
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 10.5px;
  background: rgba(78, 165, 255, 0.15);
  border: 1px solid rgba(78, 165, 255, 0.35);
  color: #b7dcff;
}
.vlm-bars { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; margin-top: 6px; font-size: 10.5px; color: var(--text-muted); }
.vlm-note { margin-top: 6px; font-size: 11px; color: #ddd2bc; line-height: 1.4; }
.vlm-issue { margin-top: 3px; font-size: 10.5px; color: #f0b398; line-height: 1.35; }

/* Native <dialog> Modals */
.wiz-dialog {
  width: min(92vw, 720px);
  max-height: 88vh;
  padding: 22px 24px;
  border-radius: 10px;
  border: 1.5px solid var(--brass);
  background: linear-gradient(180deg, #17131f 0%, #0e0c14 100%);
  color: var(--text-main);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.9);
  overflow-y: auto;
}
.wiz-dialog::backdrop { background: rgba(4, 3, 8, 0.8); backdrop-filter: blur(8px); }
.dialog-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding-bottom: 12px; border-bottom: 1px solid rgba(214, 178, 110, 0.22); margin-bottom: 14px; }
.dialog-header h2 { margin: 0 0 4px; font-family: var(--font-serif); font-size: 19px; color: var(--brass-bright); }
.dialog-sub { margin: 0; font-size: 12px; color: var(--text-muted); }
.dialog-close { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--brass-dim); background: rgba(255, 255, 255, 0.05); color: var(--brass-bright); cursor: pointer; }

.ref-video-player {
  width: 100%;
  max-height: 66vh;
  border-radius: 8px;
  background: #000;
  border: 1px solid var(--brass-dim);
}

/* Ending Scroll Dialog */
.dialog-scroll { text-align: center; max-width: 620px; }
.wax-seal {
  width: 50px;
  height: 50px;
  margin: 0 auto 10px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 35% 30%, #4da8ff, #194b8c 70%, #0d2b57);
  border: 2px solid #96cbff;
  color: #e4f2ff;
  font-size: 20px;
  box-shadow: 0 0 22px rgba(78, 165, 255, 0.55);
}
.ending-badge { font-size: 11px; letter-spacing: 0.2em; color: var(--brass); }
.ending-title { margin: 6px 0 14px; font-family: var(--font-serif); font-size: 22px; color: var(--brass-bright); }
.parchment-letter {
  padding: 18px 22px;
  border-radius: 6px;
  background: linear-gradient(180deg, #f4ead0, #e6d5af);
  color: var(--parchment-ink);
  border: 1.5px solid #b59254;
  text-align: left;
  white-space: pre-line;
}
.parchment-letter h3 { margin: 0 0 8px; font-family: var(--font-serif); font-size: 14.5px; color: #5b1820; }
.parchment-letter p { margin: 0; font-size: 13.5px; line-height: 1.65; }
.parchment-letter .letter-sign { margin-top: 10px; text-align: right; font-style: italic; font-weight: 700; }
.ending-stats { display: flex; justify-content: center; gap: 16px; margin: 14px 0 10px; font-size: 12.5px; color: var(--text-muted); }
.ending-stats strong { color: var(--brass-bright); }
.ending-next-tag { display: inline-block; padding: 4px 14px; border-radius: 999px; background: rgba(78, 165, 255, 0.14); border: 1px solid rgba(78, 165, 255, 0.4); color: #a8d4ff; font-size: 11.5px; margin-bottom: 16px; }
.ending-actions { display: flex; justify-content: center; gap: 10px; }

@media (max-width: 1180px) {
  .workspace-layout { grid-template-columns: 1fr; }
  .right-column { position: static; max-height: none; }
  .showcase-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dag-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
