:root {
  --bg-dark: #07111e;
  --panel-bg: rgba(10, 22, 38, 0.88);
  --panel-border: rgba(56, 189, 248, 0.28);
  --text-main: #f1f5f9;
  --text-sub: #94a3b8;
  --cyan: #00e5ff;
  --cyan-soft: rgba(0, 229, 255, 0.16);
  --emerald: #10b981;
  --gold: #f59e0b;
  --crimson: #ef4444;
  --purple: #a855f7;
  --shadow-lg: 0 20px 50px rgba(2, 8, 20, 0.72);
}

[data-theme="light"] {
  --bg-dark: #e6f0f7;
  --panel-bg: rgba(255, 255, 255, 0.92);
  --panel-border: rgba(14, 165, 233, 0.32);
  --text-main: #0f172a;
  --text-sub: #475569;
  --cyan: #0284c7;
  --cyan-soft: rgba(2, 132, 199, 0.12);
  --emerald: #059669;
  --gold: #d97706;
  --crimson: #dc2626;
  --shadow-lg: 0 18px 42px rgba(15, 35, 60, 0.18);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  color: var(--text-main);
  font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================================
   2.5D PARALLAX DIORAMA VIEWPORT & STAGE
   ============================================================================ */
.viewport-25d {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  perspective: 1400px;
  background: radial-gradient(circle at 50% 45%, #112a42 0%, #050c16 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stage-25d {
  position: relative;
  width: 100vw;
  height: 100vh;
  transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

/* Background Plate */
.layer-bg {
  position: absolute;
  inset: -4%;
  width: 108%;
  height: 108%;
  z-index: 1;
  transform: translate3d(var(--px-bg-x, 0px), var(--px-bg-y, 0px), 0) scale(1.04);
  transition: filter 0.45s ease;
}

.layer-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  filter: saturate(1.06) contrast(1.03);
  transition: opacity 0.35s ease;
}

.bg-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 45%, transparent 64%, rgba(8, 18, 34, 0.22) 100%),
    linear-gradient(180deg, rgba(6, 16, 30, 0.14) 0%, transparent 14%, transparent 82%, rgba(6, 16, 30, 0.45) 100%);
  pointer-events: none;
}

/* Mid-Background Ambience & Holographic Globe Pulse (Z = 0, z-index 28 so globe & beacon are clickable) */
.layer-ambience {
  position: absolute;
  inset: 0;
  z-index: 28;
  pointer-events: none;
  transform: translate3d(var(--px-mid-x, 0px), var(--px-mid-y, 0px), 0);
}

/* Interactive 3D Holographic Globe Actor */
.holo-globe-actor {
  position: absolute;
  left: 50%;
  top: 32.8%;
  width: 17.5%;
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: pointer;
  border-radius: 50%;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.25s ease;
}

.holo-globe-actor canvas {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 0 22px rgba(0, 229, 255, 0.55));
  transition: filter 0.25s ease;
}

.holo-globe-actor:hover {
  transform: translate(-50%, -50%) scale(1.06);
}

.holo-globe-actor:hover canvas,
.holo-globe-actor.is-spinning canvas {
  filter:
    drop-shadow(0 0 32px rgba(0, 229, 255, 0.9))
    drop-shadow(0 0 12px rgba(255, 255, 255, 0.65));
}

/* Live D0-D4 Security Beacon on Back-Right Glass Booth */
.vault-status-beacon {
  position: absolute;
  right: 3.2%;
  top: 24%;
  pointer-events: auto;
  cursor: pointer;
  background: rgba(8, 18, 34, 0.86);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(56, 189, 248, 0.38);
  border-radius: 12px;
  padding: 8px 11px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.vault-status-beacon:hover {
  transform: translateY(-2px) scale(1.04);
  border-color: var(--cyan);
}

.beacon-header {
  font-size: 11px;
  font-weight: 700;
  color: #cbd5e1;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.beacon-lights {
  display: flex;
  gap: 5px;
}

.b-dot {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  opacity: 0.32;
  transition: all 0.25s ease;
  border: 1px solid transparent;
}

.b-dot.green { background: rgba(16, 185, 129, 0.2); color: #34d399; border-color: #10b981; }
.b-dot.blue  { background: rgba(14, 165, 233, 0.2); color: #38bdf8; border-color: #0ea5e9; }
.b-dot.amber { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border-color: #f59e0b; }
.b-dot.red   { background: rgba(239, 68, 68, 0.2);  color: #f87171; border-color: #ef4444; }

.b-dot.active {
  opacity: 1;
  transform: scale(1.08);
  box-shadow: 0 0 12px currentColor;
}

.beacon-Readout {
  margin-top: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #fbbf24;
}

/* ============================================================================
   INTERACTIVE CEILING-SUSPENDED HANGING SIGN (FBI SI中心 — Click to Swing)
   ============================================================================ */
.hanging-sign-actor {
  position: absolute;
  left: 25.5%;
  top: -6.5%;
  width: 19.4%;
  z-index: 30;
  cursor: pointer;
  pointer-events: auto;
  transform: translate3d(calc(-50% + var(--px-mid-x, 0px)), calc(var(--px-mid-y, 0px) * 0.5), 12px);
  perspective: 900px;
  outline: none;
}

.hanging-sign-pendulum {
  width: 100%;
  transform-origin: 50% 0%;
  transform-style: preserve-3d;
  animation: signIdleBreeze 5.5s ease-in-out infinite;
  transition: filter 0.25s ease;
}

.hanging-sign-img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 14px 24px rgba(8, 24, 44, 0.32));
  transition: filter 0.25s ease;
}

.hanging-sign-actor:hover .hanging-sign-img {
  filter:
    drop-shadow(0 16px 28px rgba(8, 24, 44, 0.42))
    drop-shadow(0 0 18px rgba(0, 229, 255, 0.55));
}

.hanging-sign-actor.is-swinging .hanging-sign-pendulum {
  animation: signClickSwing 1.35s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

.hanging-sign-actor.is-swinging .hanging-sign-img {
  filter:
    drop-shadow(0 18px 32px rgba(8, 24, 44, 0.48))
    drop-shadow(0 0 26px rgba(0, 229, 255, 0.85));
}

@keyframes signIdleBreeze {
  0%, 100% { transform: rotateZ(-0.6deg) rotateX(0deg); }
  50%      { transform: rotateZ(0.6deg) rotateX(1.5deg); }
}

@keyframes signClickSwing {
  0%   { transform: rotateZ(0deg) rotateX(0deg); }
  14%  { transform: rotateZ(-8.5deg) rotateX(14deg) scale(1.02); }
  30%  { transform: rotateZ(6.8deg) rotateX(-10deg); }
  46%  { transform: rotateZ(-4.6deg) rotateX(7deg); }
  62%  { transform: rotateZ(3.0deg) rotateX(-4.5deg); }
  78%  { transform: rotateZ(-1.6deg) rotateX(2.2deg); }
  90%  { transform: rotateZ(0.7deg) rotateX(-1deg); }
  100% { transform: rotateZ(0deg) rotateX(0deg); }
}

/* ============================================================================
   2.5D ROBOT AGENT ACTORS (4 DISTINCT DEPTH LAYERS & BODY SILHOUETTES)
   ============================================================================ */
.agent-actor {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  outline: none;
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), filter 0.3s ease;
  will-change: transform, filter;
}

/* Invisible hover bridge between sprite head and speech bubble so mousemove never drops hover */
.agent-actor::before {
  content: '';
  position: absolute;
  bottom: 96%;
  left: 10%;
  right: 10%;
  height: 32px;
  pointer-events: auto;
}

.actor-sprite-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  animation: actorBreath 3.6s ease-in-out infinite;
}

.actor-sprite {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.65));
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.28s ease;
}

.agent-actor:hover .actor-sprite,
.agent-actor.focused .actor-sprite {
  transform: translateY(-8px) scale(1.06);
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.8)) drop-shadow(0 0 18px var(--actor-glow, rgba(0, 229, 255, 0.75)));
}

/* Dim non-focused actors slightly when zooming into one */
.stage-25d.has-focus .agent-actor:not(.focused) {
  filter: brightness(0.68) saturate(0.82) blur(1px);
}

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

/* Floor Perspective Elliptical Aura Rings */
.actor-floor-ring {
  width: 78%;
  height: 22px;
  margin-top: -12px;
  border-radius: 50%;
  border: 2px solid rgba(0, 229, 255, 0.65);
  background: radial-gradient(ellipse at center, rgba(0, 229, 255, 0.32) 0%, transparent 72%);
  box-shadow: 0 0 22px rgba(0, 229, 255, 0.45);
  transform: rotateX(68deg);
  pointer-events: none;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.agent-actor:hover .actor-floor-ring,
.agent-actor.focused .actor-floor-ring {
  transform: rotateX(68deg) scale(1.18);
}

.ring-cyan    { border-color: #00e5ff; background: radial-gradient(ellipse, rgba(0, 229, 255, 0.38) 0%, transparent 72%); box-shadow: 0 0 24px rgba(0, 229, 255, 0.55); }
.ring-amber   { border-color: #f59e0b; background: radial-gradient(ellipse, rgba(245, 158, 11, 0.38) 0%, transparent 72%); box-shadow: 0 0 24px rgba(245, 158, 11, 0.55); }
.ring-crimson { border-color: #ef4444; background: radial-gradient(ellipse, rgba(239, 68, 68, 0.38) 0%, transparent 72%); box-shadow: 0 0 24px rgba(239, 68, 68, 0.55); }
.ring-emerald { border-color: #10b981; background: radial-gradient(ellipse, rgba(16, 185, 129, 0.42) 0%, transparent 72%); box-shadow: 0 0 28px rgba(16, 185, 129, 0.65); }

/* Light-Colored High-Impact Speech Bubbles Above Characters (Large Pointer Tail, No Under-Text) */
.actor-speech-bubble {
  --bubble-bg: #ffffff;
  --bubble-border: #cbd5e1;
  position: absolute;
  bottom: calc(100% + 18px);
  left: 50%;
  transform: translateX(-50%);
  transform-origin: 50% 100%;
  width: max-content;
  background: var(--bubble-bg);
  border: 3.5px solid var(--bubble-border);
  border-radius: 22px;
  padding: 12px 26px;
  font-size: clamp(20px, 1.8vw, 28px);
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1.25;
  color: #0f172a;
  box-shadow:
    0 14px 32px rgba(15, 23, 42, 0.24),
    0 4px 10px rgba(15, 23, 42, 0.12);
  text-align: center;
  white-space: nowrap;
  z-index: 60;
  transition:
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    padding 0.24s ease,
    border-radius 0.24s ease,
    box-shadow 0.25s ease;
}

/* Expanded Typewriter State for Xiaoxin Bubble (grows upward from bottom anchor) */
.actor-speech-bubble.is-expanded {
  padding: 16px 28px;
  border-radius: 24px;
  font-size: clamp(18px, 1.55vw, 23px);
  line-height: 1.55;
  text-align: left;
  white-space: pre-line;
  transform: translateX(-50%) translateY(-6px) scale(1.05);
  box-shadow:
    0 22px 44px rgba(8, 145, 178, 0.32),
    0 0 28px rgba(0, 229, 255, 0.45);
}

.actor-speech-bubble .typewriter-url {
  color: #0284c7;
  text-decoration: underline;
  text-underline-offset: 4px;
  font-family: 'JetBrains Mono', 'Noto Sans TC', sans-serif;
  font-weight: 900;
}

.actor-speech-bubble .construction-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: 6px;
  background: #fef08a;
  border: 1.5px solid #ca8a04;
  color: #713f12;
  font-weight: 900;
}

.actor-speech-bubble .typewriter-cursor {
  display: inline-block;
  width: 3px;
  height: 1.05em;
  vertical-align: -0.15em;
  margin-left: 3px;
  background: #0891b2;
  animation: cursorBlink 0.6s steps(2, start) infinite;
}

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

/* Large Prominent Speech Bubble Pointer Tail (尖嘴加大 + 底部透明橋接區防斷觸) */
.actor-speech-bubble::before {
  content: '';
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-top: 24px solid var(--bubble-border);
}

.actor-speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-top: 20px solid var(--bubble-bg);
}

.bubble-cyan {
  --bubble-bg: #f0fdfa;
  --bubble-border: #0891b2;
  color: #0f172a;
}

.bubble-amber {
  --bubble-bg: #fffbeb;
  --bubble-border: #d97706;
  color: #0f172a;
}

.bubble-crimson {
  --bubble-bg: #fff1f2;
  --bubble-border: #e11d48;
  color: #0f172a;
}

.bubble-emerald {
  --bubble-bg: #ecfdf5;
  --bubble-border: #059669;
  color: #0f172a;
}

.agent-actor:hover .actor-speech-bubble:not(.is-expanded) {
  transform: translateX(-50%) translateY(-6px) scale(1.06);
  box-shadow:
    0 20px 38px rgba(15, 23, 42, 0.32),
    0 0 22px var(--actor-glow, rgba(14, 165, 233, 0.45));
}

/* ============================================================================
   INDIVIDUAL AGENT 2.5D POSITIONS & Z-LAYERS
   ============================================================================ */

/* 1. 小新 (Moved to Lower-Left of Center Bar, Standing on Floor, Z-index 35) */
.actor-xiaoxin {
  --actor-glow: rgba(0, 229, 255, 0.85);
  left: 36.5%;
  bottom: 27.5%;
  width: 12.5%;
  z-index: 35;
  transform: translate3d(calc(-50% + var(--px-mid-x, 0px)), var(--px-mid-y, 0px), 0);
}

/* 2. 阿昇 (Moved Left, Standing on Open Floor in Front-Left Lounge, Z-index 45) */
.actor-asheng {
  --actor-glow: rgba(245, 158, 11, 0.85);
  left: 14.5%;
  bottom: 8.5%;
  width: 15.5%;
  z-index: 45;
  transform: translate3d(calc(-50% + var(--px-fg-x, 0px)), var(--px-fg-y, 0px), 0);
}
.actor-asheng .actor-sprite-wrap { animation-delay: -1.1s; }

/* 3. 大雄 資安官 (Back-Right Behind Floating Architectural Model & Workbench, Z-index 15 — 巨型威嚴守衛比例) */
.actor-daxiong {
  --actor-glow: rgba(239, 68, 68, 0.85);
  left: 77.5%;
  bottom: 24.5%;
  width: 20.2%;
  z-index: 15;
  transform: translate3d(calc(-50% + var(--px-back-x, 0px)), var(--px-back-y, 0px), 0);
}
.actor-daxiong .actor-sprite-wrap { animation-delay: -2.3s; }
.actor-daxiong .actor-speech-bubble {
  bottom: calc(100% + 4px);
}

/* Foreground Occlusion Layer: Right-Front Workbench & Floating 3D Architectural Models (Z-index 22, in front of Daxiong) */
.layer-fg-workbench {
  position: absolute;
  inset: -4%;
  width: 108%;
  height: 108%;
  z-index: 22;
  pointer-events: none;
  transform: translate3d(var(--px-bg-x, 0px), var(--px-bg-y, 0px), 0) scale(1.04);
}

.layer-fg-workbench img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  filter: saturate(1.06) contrast(1.03);
  transition: opacity 0.35s ease;
  pointer-events: none;
}

/* 4. 阿宏 (Moved Left of the Kiosk Control Panel on Floor, Z-index 50 — 1.2x 活力實戰比例, 縮至原 80%) */
.actor-huoli {
  --actor-glow: rgba(16, 185, 129, 0.9);
  left: 53.5%;
  bottom: 6.5%;
  width: 19.2%;
  z-index: 50;
  transform: translate3d(calc(-50% + var(--px-fg-x, 0px)), var(--px-fg-y, 0px), 0);
}
.actor-huoli .actor-sprite-wrap { animation-delay: -0.5s; }

.actor-cta-ribbon {
  background: linear-gradient(90deg, #059669 0%, #10b981 50%, #eab308 100%);
  color: #04131d;
  font-size: 11.5px;
  font-weight: 900;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 6px;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.7);
  animation: ctaBounce 2.2s ease-in-out infinite;
}

@keyframes ctaBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

/* ============================================================================
   ON-BAR DYNAMIC MORNING / EVENING BULLETIN BOARD (Z-index 25, Mounted on Bar Front)
   ============================================================================ */
.bar-bulletin-board {
  position: absolute;
  left: 49%;
  bottom: 43%;
  width: clamp(265px, 23vw, 360px);
  z-index: 25;
  transform: translate3d(calc(-50% + var(--px-bar-x, 0px)), var(--px-bar-y, 0px), 22px);
  background: linear-gradient(180deg, rgba(8, 22, 38, 0.94) 0%, rgba(6, 16, 30, 0.97) 100%);
  backdrop-filter: blur(14px);
  border: 2px solid rgba(0, 229, 255, 0.65);
  border-radius: 16px;
  padding: 10px 14px 12px;
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.75),
    0 0 32px rgba(0, 229, 255, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: transform 0.28s ease, box-shadow 0.28s ease;
}

.bar-bulletin-board:hover {
  box-shadow:
    0 20px 48px rgba(0, 0, 0, 0.82),
    0 0 42px rgba(0, 229, 255, 0.48);
}

.bulletin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(0, 229, 255, 0.24);
}

.bulletin-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: 0.02em;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00e5ff;
  box-shadow: 0 0 10px #00e5ff;
  animation: pulseDot 1.6s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.bulletin-tabs {
  display: flex;
  background: rgba(15, 32, 54, 0.9);
  padding: 2px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.b-tab {
  border: none;
  background: transparent;
  color: #94a3b8;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.b-tab.active {
  background: linear-gradient(135deg, #0ea5e9, #00e5ff);
  color: #03111c;
  box-shadow: 0 2px 10px rgba(0, 229, 255, 0.45);
}

.bulletin-ext-link {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: #38bdf8;
  text-decoration: none;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(14, 165, 233, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.35);
  transition: all 0.2s ease;
}

.bulletin-ext-link:hover {
  background: rgba(0, 229, 255, 0.28);
  color: #ffffff;
}

.bulletin-posters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.bar-poster-note {
  background: linear-gradient(160deg, rgba(16, 36, 62, 0.92) 0%, rgba(10, 24, 44, 0.95) 100%);
  border: 1px solid rgba(56, 189, 248, 0.32);
  border-radius: 10px;
  padding: 8px 9px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 5px;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  position: relative;
  overflow: hidden;
}

.bar-poster-note::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #00e5ff, #10b981);
}

.bar-poster-note.evening-note::before {
  background: linear-gradient(90deg, #a855f7, #f59e0b);
}

.bar-poster-note:hover {
  transform: translateY(-3px);
  border-color: #00e5ff;
  background: rgba(20, 46, 78, 0.98);
}

.poster-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 700;
  color: #38bdf8;
}

.poster-delta {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  padding: 1px 5px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
}

.poster-headline {
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.35;
  color: #f1f5f9;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.poster-cta {
  font-size: 10px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Foreground 2.5D Particle Canvas */
.fx-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 60;
  pointer-events: none;
}

/* ============================================================================
   TOP & BOTTOM GAME HUD OVERLAYS
   ============================================================================ */
.hud-top {
  position: fixed;
  top: 14px;
  left: 18px;
  right: 18px;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.hud-brand {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 34vw;
  padding: 8px 14px;
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
}

.brand-logo-img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--cyan);
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.35);
}

.brand-info h1 {
  font-size: 16.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--cyan-soft);
  color: var(--cyan);
  border: 1px solid var(--panel-border);
}

.brand-info p {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 2px;
}

.hud-top-right {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 8px 10px;
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
}

.bg-style-switcher {
  display: flex;
  background: rgba(15, 28, 48, 0.65);
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
}

.bg-switch-btn {
  border: none;
  background: transparent;
  color: var(--text-sub);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.bg-switch-btn.active {
  background: var(--cyan);
  color: #04121f;
  box-shadow: 0 2px 10px rgba(0, 229, 255, 0.38);
}

.hud-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--panel-border);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hud-pill-btn:hover {
  border-color: var(--cyan);
  transform: translateY(-1px);
}

.pill-highlight {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.24), rgba(16, 185, 129, 0.24));
  border-color: var(--cyan);
}

/* Bottom Navigation Hotbar */
.hud-bottom {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  width: min(96vw, 1060px);
  pointer-events: none;
}

.controls-hint {
  pointer-events: auto;
  font-size: 12px;
  color: #e2e8f0;
  background: rgba(7, 16, 30, 0.82);
  backdrop-filter: blur(10px);
  padding: 4px 14px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.teleport-dock {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  overflow-x: auto;
  max-width: 100%;
}

.dock-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.dock-btn:hover {
  background: rgba(0, 229, 255, 0.12);
  border-color: rgba(0, 229, 255, 0.45);
  transform: translateY(-2px);
}

.dock-btn.active {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.24), rgba(16, 185, 129, 0.22));
  border-color: var(--cyan);
  box-shadow: 0 0 18px rgba(0, 229, 255, 0.3);
}

.dock-btn-featured {
  border-color: rgba(16, 185, 129, 0.55);
}

.dock-mini-avatar {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.dock-key {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--cyan);
}

/* ============================================================================
   RIGHT-SIDE INTERACTIVE RPG DIALOG & FUNCTION DRAWER (LIGHT THEME)
   ============================================================================ */
.dialog-drawer {
  --text-main: #0f172a;
  --text-sub: #475569;
  --cyan: #0284c7;
  --emerald: #059669;
  --gold: #b45309;
  --crimson: #e11d48;
  --panel-border: rgba(148, 163, 184, 0.45);
  position: fixed;
  top: 78px;
  right: 18px;
  bottom: 92px;
  width: min(500px, 92vw);
  z-index: 120;
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
  backdrop-filter: blur(22px);
  border: 2px solid #cbd5e1;
  border-radius: 22px;
  box-shadow:
    0 24px 54px rgba(15, 23, 42, 0.24),
    0 4px 14px rgba(15, 23, 42, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(110%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease;
}

.dialog-drawer.open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1.5px solid #e2e8f0;
  background: #f8fafc;
}

.npc-speaker {
  display: flex;
  align-items: center;
  gap: 12px;
}

.npc-avatar-img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 14px;
  background: #ffffff;
  border: 2px solid #0284c7;
  padding: 3px;
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.15);
}

.npc-speaker-name {
  font-size: 16.5px;
  font-weight: 900;
  color: #0f172a;
}

.npc-speaker-role {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: #0284c7;
  margin-top: 2px;
}

.close-drawer-btn {
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #1e293b;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.close-drawer-btn:hover {
  background: #ffe4e6;
  border-color: #e11d48;
  color: #be123c;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #ffffff;
  color: #0f172a;
}

.npc-speech-box {
  background: #f0f9ff;
  border-left: 4px solid #0284c7;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.65;
  color: #0f172a;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hud-chip {
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  color: #1e293b;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.hud-chip:hover {
  border-color: #0284c7;
  background: #f0f9ff;
  color: #0369a1;
}

.hud-chip.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  font-weight: 800;
}

.hud-item-card {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 13px 15px;
  cursor: pointer;
  color: #0f172a;
  transition: all 0.2s ease;
}

.hud-item-card:hover {
  border-color: #0284c7;
  background: #f0f9ff;
}

.hud-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 800;
  color: #334155;
  margin-bottom: 5px;
}

.hud-item-title {
  font-size: 14.5px;
  font-weight: 800;
  line-height: 1.45;
  color: #0f172a;
}

.hud-item-desc {
  font-size: 13px;
  line-height: 1.6;
  color: #334155;
  margin-top: 5px;
}

.hud-input {
  width: 100%;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 9px 12px;
  color: #0f172a;
  font-family: inherit;
  font-size: 13.5px;
}

.hud-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #0284c7, #059669);
  color: #ffffff;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.25);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.hud-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(14, 165, 233, 0.5);
}

@media (max-width: 900px) {
  /* Enable smooth horizontal touch-scrolling of the 16:9 2.5D diorama on mobile */
  .viewport-25d {
    display: block;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    perspective: none;
    background: #07111e;
  }

  .stage-25d {
    height: 100dvh;
    width: calc(100dvh * 16 / 9);
    min-width: 100vw;
    transform-style: flat;
  }

  /* Keep all 4 light speech bubbles visible and properly sized on mobile */
  .actor-speech-bubble {
    display: block;
    font-size: 17px;
    padding: 9px 18px;
    border-width: 3px;
    border-radius: 18px;
    bottom: calc(100% + 14px);
  }

  .actor-speech-bubble.is-expanded {
    font-size: 15.5px;
    padding: 12px 18px;
    line-height: 1.5;
  }

  .actor-speech-bubble::before {
    bottom: -20px;
    border-left-width: 14px;
    border-right-width: 14px;
    border-top-width: 20px;
  }

  .actor-speech-bubble::after {
    bottom: -15px;
    border-left-width: 11px;
    border-right-width: 11px;
    border-top-width: 16px;
  }

  /* Compact Top & Bottom HUD for mobile */
  .hud-top {
    top: 8px;
    left: 8px;
    right: 8px;
    justify-content: space-between;
  }

  .hud-brand {
    max-width: 62vw;
    padding: 6px 10px;
    gap: 8px;
    border-radius: 12px;
  }

  .brand-logo-img {
    width: 30px;
    height: 30px;
  }

  .brand-info h1 {
    font-size: 13px;
  }

  .hud-badge,
  .brand-info p {
    display: none;
  }

  .hud-top-right {
    padding: 5px 8px;
    border-radius: 12px;
    gap: 5px;
  }

  .hud-pill-btn {
    font-size: 11px;
    padding: 4px 8px;
  }

  .hud-bottom {
    bottom: 8px;
    left: 8px;
    right: 8px;
    width: auto;
    transform: none;
    gap: 5px;
  }

  .controls-hint {
    width: 100%;
    text-align: center;
    font-size: 11px;
    padding: 4px 10px;
  }

  .teleport-dock {
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
    padding: 5px 6px;
    gap: 6px;
  }

  .dock-btn {
    padding: 5px 10px;
    font-size: 11.5px;
    flex-shrink: 0;
  }

  .dock-key {
    display: none;
  }

  .dialog-drawer {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    height: 72dvh;
    transform: translateY(110%);
  }

  .dialog-drawer.open {
    transform: translateY(0);
  }
}
