/* Vinhomes Ocean Park 1 (420 ha) V2 Photorealistic Cinema & Interactive Studio
   Typography: Google Sans & Google Sans Code · Minimum font size >= 12px · Tabular numerals */

:root {
  --font-sans: 'Google Sans', 'Google Sans Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Google Sans Code', 'Google Sans', ui-monospace, monospace;
  --ui-scale: 1;

  --bg-page: #06111d;
  --bg-sidebar: rgba(7, 20, 34, 0.94);
  --bg-card: rgba(10, 26, 43, 0.88);
  --bg-card-solid: #0d2136;
  --bg-hover: rgba(56, 189, 248, 0.14);
  --bg-input: rgba(14, 37, 58, 0.86);
  --border: rgba(148, 197, 232, 0.2);
  --border-strong: rgba(56, 189, 248, 0.48);

  --text: #f1f7fc;
  --text-muted: #9eb7cd;
  --accent: #0ea5e9;
  --accent-2: #14b8a6;
  --cinema: #f43f5e;
  --gold: #f59e0b;
  --ok: #22c55e;
  --danger: #f43f5e;
  --shadow: 0 18px 42px rgba(2, 10, 20, 0.52);
  --sidebar-w: 298px;
}

[data-theme="light"] {
  --bg-page: #eef6fb;
  --bg-sidebar: rgba(255, 255, 255, 0.96);
  --bg-card: rgba(255, 255, 255, 0.92);
  --bg-card-solid: #ffffff;
  --bg-hover: rgba(14, 165, 233, 0.1);
  --bg-input: #f1f6fa;
  --border: rgba(15, 42, 68, 0.14);
  --border-strong: rgba(14, 165, 233, 0.5);

  --text: #0c1f33;
  --text-muted: #4b647d;
  --shadow: 0 14px 34px rgba(12, 31, 51, 0.14);
}

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

html {
  font-family: var(--font-sans);
  font-size: calc(14px * var(--ui-scale));
  color: var(--text);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  height: 100%;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

button, input, select {
  font-family: inherit;
  font-size: max(12px, 0.92rem);
  color: inherit;
}

code {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(148, 163, 184, 0.16);
}

.tabular-nums { font-variant-numeric: tabular-nums; }

/* Full-bleed WebGL Canvas */
#sceneCanvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 1;
  touch-action: none;
}

/* Loading Splash */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: radial-gradient(circle at 50% 35%, #113250, #06111d 75%);
  color: #f1f7fc;
  transition: opacity 0.35s ease;
}
.loading-screen.hidden { opacity: 0; pointer-events: none; }
.loading-logo { width: 72px; height: 72px; border-radius: 18px; box-shadow: 0 12px 30px rgba(14,165,233,0.35); }
.loading-bar { width: min(300px, 78vw); height: 8px; border-radius: 999px; background: rgba(255,255,255,0.12); overflow: hidden; }
.loading-fill { height: 100%; width: 15%; border-radius: 999px; background: linear-gradient(90deg, #0ea5e9, #14b8a6, #f59e0b); transition: width 0.25s ease; }
.loading-text { font-size: 14px; color: #b8d3e8; text-align: center; padding: 0 16px; }

/* App Shell with Persistent Collapsible Left Sidebar */
.app-shell {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  pointer-events: none;
}

.sidebar {
  width: var(--sidebar-w);
  max-width: 86vw;
  height: 100%;
  background: var(--bg-sidebar);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 45;
  box-shadow: var(--shadow);
}

.sidebar.collapsed {
  transform: translateX(-106%);
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
}

.sidebar-header {
  padding: 14px 14px 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.brand-mark { width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0; }
.brand-text { flex: 1; min-width: 0; }
.brand-title { font-size: 1.08rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
.brand-sub { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-search { padding: 10px 12px 6px; }
.sidebar-search input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  outline: none;
  font-size: 13px;
}
.sidebar-search input:focus { border-color: var(--accent); }

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px 16px;
}
.sidebar-scroll::-webkit-scrollbar { width: 5px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.28); border-radius: 99px; }

.nav-group { margin-top: 10px; }
.nav-group-title {
  padding: 5px 10px 4px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.nav-item:hover { background: var(--bg-hover); }
.nav-item.active {
  background: rgba(14, 165, 233, 0.18);
  border-color: var(--border-strong);
  font-weight: 600;
}
.nav-highlight-cinema {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.16), rgba(168, 85, 247, 0.14));
  border-color: rgba(244, 63, 94, 0.3);
  margin-bottom: 3px;
}
.nav-highlight-show {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.14), rgba(14, 165, 233, 0.12));
  border-color: rgba(56, 189, 248, 0.34);
  margin-top: 6px;
}
.nav-highlight-show.active-show {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.32), rgba(244, 63, 94, 0.25));
  border-color: rgba(0, 229, 255, 0.78);
}

.nav-item-left { display: flex; align-items: center; gap: 9px; min-width: 0; }
.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-dot { width: 9px; height: 9px; border-radius: 999px; flex-shrink: 0; }
.nav-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(14, 165, 233, 0.18);
  color: var(--accent);
  flex-shrink: 0;
}
.nav-badge.ok { background: rgba(34, 197, 94, 0.22); color: var(--ok); }
.nav-badge.accent { background: rgba(244, 63, 94, 0.22); color: #fb7185; }
.nav-badge.live { background: rgba(0, 229, 255, 0.25); color: #38bdf8; }

.nav-sublist {
  margin-top: 3px;
  padding-left: 8px;
  border-left: 2px solid var(--border);
  margin-left: 12px;
  max-height: 152px;
  overflow-y: auto;
}
.nav-sublist::-webkit-scrollbar { width: 4px; }
.nav-sublist::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.28); border-radius: 99px; }
.nav-sublist .nav-item {
  padding: 5px 8px;
  font-size: 12px;
}

.sidebar-light-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  padding: 4px 4px 2px;
}
.mini-pill {
  border: 1px solid var(--border);
  background: var(--bg-input);
  padding: 6px 8px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s ease;
}
.mini-pill:hover { border-color: var(--border-strong); color: var(--text); }
.mini-pill.active { background: var(--accent); border-color: transparent; color: #ffffff; }

.sidebar-footer {
  padding: 10px 12px 11px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.seg-group {
  display: inline-flex;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
}
.seg-btn {
  border: none;
  background: transparent;
  padding: 4px 8px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
}
.seg-btn.active { background: var(--accent); color: #ffffff; }

.perf-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  padding-top: 4px;
  border-top: 1px dashed var(--border);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 8, 18, 0.48);
  z-index: 38;
  pointer-events: auto;
}
.sidebar-backdrop[hidden] { display: none; }

/* Main Portal Stage */
.portal-stage {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  padding: 18px 24px 36px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}
.portal-stage[hidden] { display: none; }

.portal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  pointer-events: auto;
}
.portal-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-show-chip {
  border: 1px solid rgba(56, 189, 248, 0.5);
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.25), rgba(168, 85, 247, 0.25));
  backdrop-filter: blur(12px);
  color: #f8fafc;
  padding: 9px 14px;
  border-radius: 13px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s ease;
}
[data-theme="light"] .btn-show-chip {
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  color: #ffffff;
}
.btn-show-chip.active {
  background: linear-gradient(135deg, #06b6d4, #ec4899);
  border-color: rgba(255, 255, 255, 0.65);
  box-shadow: 0 0 22px rgba(6, 182, 212, 0.48);
}

.portal-hero-wrap {
  margin: auto 0;
  padding: 18px 0;
  max-width: 720px;
  pointer-events: auto;
}

.hero-card {
  background: var(--bg-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 24px 26px;
  box-shadow: var(--shadow);
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}

.hero-title {
  margin: 0 0 10px;
  font-size: clamp(1.55rem, 3vw, 2.2rem);
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero-desc {
  margin: 0 0 18px;
  font-size: 0.96rem;
  line-height: 1.56;
  color: var(--text-muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 18px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.kpi-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 10px 12px;
}
.kpi-val {
  font-size: 1.22rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.kpi-lbl {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Shared Buttons */
.btn-primary, .btn-secondary, .btn-ghost, .btn-icon {
  border-radius: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: transform 0.12s ease, filter 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  border: 1px solid transparent;
}
.btn-primary:active, .btn-secondary:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: #ffffff;
  padding: 10px 16px;
  box-shadow: 0 8px 20px rgba(14, 165, 233, 0.32);
}
.btn-primary:hover { filter: brightness(1.08); }

.btn-secondary {
  background: var(--bg-card-solid);
  border-color: var(--border);
  color: var(--text);
  padding: 9px 14px;
}
.btn-secondary:hover { border-color: var(--border-strong); background: var(--bg-hover); }

.btn-ghost {
  background: rgba(9, 24, 38, 0.72);
  backdrop-filter: blur(12px);
  border-color: var(--border);
  color: #f1f7fc;
  padding: 8px 13px;
}
[data-theme="light"] .btn-ghost {
  background: rgba(255, 255, 255, 0.9);
  color: #0c1f33;
}
.btn-ghost:hover { border-color: var(--border-strong); }
.btn-ghost.active-toggle {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.85), rgba(236, 72, 153, 0.8));
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.55);
}

.btn-icon {
  width: 36px;
  height: 36px;
  background: var(--bg-input);
  border-color: var(--border);
  padding: 0;
  flex-shrink: 0;
}
.btn-icon:hover { border-color: var(--border-strong); }
.btn-icon.active-toggle { background: var(--accent); color: #ffffff; border-color: transparent; }

.btn-sm { padding: 7px 11px; font-size: 12px; border-radius: 9px; }

/* Time Chips */
.time-strip {
  display: inline-flex;
  gap: 5px;
  flex-wrap: wrap;
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 4px;
}
.time-chip {
  border: none;
  background: transparent;
  padding: 7px 11px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
}
.time-chip.active { background: var(--accent); color: #ffffff; }

/* Cinema Director HUD */
.cinema-hud {
  position: fixed;
  inset: 0;
  z-index: 25;
  pointer-events: none;
}
.cinema-hud[hidden] { display: none; }

.cinema-top {
  position: fixed;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  pointer-events: none;
}
.cinema-top > * { pointer-events: auto; }
.cinema-meta { display: flex; flex-direction: column; gap: 1px; max-width: 340px; }
.cinema-chapter { font-size: 12px; color: var(--accent); font-weight: 600; }
.cinema-shot-title { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cinema-top-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.designer-panel {
  position: fixed;
  top: 76px;
  right: 14px;
  bottom: 98px;
  width: min(336px, calc(100vw - 28px));
  background: var(--bg-sidebar);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: auto;
  box-shadow: var(--shadow);
}
.designer-panel[hidden] { display: none; }
.designer-head {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.designer-title { font-size: 14px; font-weight: 700; }
.designer-sub { font-size: 12px; color: var(--text-muted); }
.designer-body {
  padding: 12px 14px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}
.designer-shot-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 2px;
}
.dshot-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.dshot-btn:hover { border-color: var(--border-strong); }
.dshot-btn.active {
  background: rgba(14, 165, 233, 0.22);
  border-color: var(--accent);
}
.dshot-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.designer-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; font-size: 12px; }
.range-input { width: 100%; accent-color: var(--accent); cursor: pointer; }
.designer-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.select-input.compact { padding: 7px 10px; font-size: 12px; }
.designer-hint {
  font-size: 12px;
  line-height: 1.48;
  color: var(--text-muted);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
}
.designer-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }

.cinema-bottom {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: 14px;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.cinema-timeline-bar {
  width: min(1040px, 100%);
  background: var(--bg-card);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  pointer-events: auto;
}
.cinema-controls-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.cinema-scrubber-wrap {
  flex: 1;
  min-width: 180px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cinema-segments {
  display: flex;
  height: 7px;
  border-radius: 99px;
  overflow: hidden;
  gap: 2px;
}
.cinema-seg {
  height: 100%;
  border-radius: 3px;
  cursor: pointer;
  opacity: 0.72;
  transition: opacity 0.15s ease;
}
.cinema-seg.active { opacity: 1; }
.cinema-seg.tod-day { background: #38bdf8; }
.cinema-seg.tod-sunset { background: #f59e0b; }
.cinema-seg.tod-night { background: #6366f1; }
.cinema-seg.tod-lightshow { background: linear-gradient(90deg, #00e5ff, #f43f5e, #fbbf24); }

.cinema-range {
  width: 100%;
  margin: 0;
  accent-color: #38bdf8;
  cursor: pointer;
}

/* In-Game 3D Exploration HUD */
.game-hud {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}
.game-hud[hidden] { display: none; }

.hud-top-left {
  position: fixed;
  top: 14px;
  left: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(500px, calc(100vw - 180px));
  pointer-events: auto;
}
.hud-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 7px 11px;
  box-shadow: var(--shadow);
}
.hud-loc { font-weight: 700; font-size: 13px; }
.hud-stat {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  font-weight: 600;
}
.hud-nav-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(245, 158, 11, 0.22);
  border: 1px solid rgba(245, 158, 11, 0.55);
  color: var(--text);
  backdrop-filter: blur(12px);
  border-radius: 12px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
}
.hud-nav-pill[hidden] { display: none; }

.hud-top-right {
  position: fixed;
  top: 14px;
  right: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: auto;
}
.minimap-box {
  width: 184px;
  height: 132px;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid var(--border-strong);
  background: #0b1a2a;
  box-shadow: var(--shadow);
  cursor: pointer;
  position: relative;
}
.minimap-box canvas { width: 100%; height: 100%; display: block; }
.minimap-cap {
  position: absolute;
  bottom: 4px;
  left: 6px;
  right: 6px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: #f8fafc;
  text-shadow: 0 1px 4px #000;
  pointer-events: none;
}

.hud-quick-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* Bottom Center Vehicle Dock & Interaction Prompt */
.hud-bottom-center {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  pointer-events: auto;
  z-index: 25;
}
.interact-banner {
  background: linear-gradient(135deg, rgba(14,165,233,0.95), rgba(20,184,166,0.95));
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(14,165,233,0.45);
  animation: pulseSoft 1.8s infinite;
}
.interact-banner[hidden] { display: none; }

@keyframes pulseSoft {
  0%, 100% { box-shadow: 0 10px 26px rgba(14,165,233,0.45); }
  50% { box-shadow: 0 10px 34px rgba(20,184,166,0.75); }
}

.vehicle-dock {
  display: flex;
  gap: 6px;
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 5px;
  box-shadow: var(--shadow);
}
.veh-btn {
  border: 1px solid transparent;
  background: transparent;
  padding: 8px 12px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}
.veh-btn.active { background: var(--accent); color: #ffffff; }
.key-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  background: rgba(255,255,255,0.16);
}
.controls-hint-bar {
  font-size: 12px;
  color: #e2eef8;
  background: rgba(7, 19, 32, 0.74);
  padding: 5px 13px;
  border-radius: 999px;
  text-align: center;
}

/* Mobile Virtual Joystick */
.touch-controls {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 24;
  display: none;
}
.touch-controls.active { display: block; }

.joystick-zone {
  position: fixed;
  left: 18px;
  bottom: 84px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(9, 24, 38, 0.45);
  border: 2px solid rgba(56, 189, 248, 0.55);
  pointer-events: auto;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.joystick-knob {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #7dd3fc, #0284c7);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.touch-actions {
  position: fixed;
  right: 16px;
  bottom: 86px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
}
.touch-fab {
  min-width: 58px;
  height: 50px;
  padding: 0 14px;
  border-radius: 15px;
  border: 1px solid rgba(255,255,255,0.28);
  background: rgba(9, 24, 38, 0.82);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.touch-fab.primary { background: linear-gradient(135deg, #0ea5e9, #14b8a6); }

/* Modals (Entry, Dialogue, Phone, Render Gallery) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(4, 12, 24, 0.72);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-backdrop[hidden] { display: none; }

.modal-card {
  width: min(540px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
}
.modal-card h2 { margin: 0 0 6px; font-size: 1.3rem; }
.modal-sub { margin: 0 0 16px; font-size: 13px; color: var(--text-muted); }

.field-group { margin-bottom: 14px; }
.field-label { display: block; font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.text-input, .select-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: 14px;
  outline: none;
}
.text-input:focus, .select-input:focus { border-color: var(--accent); }

.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.choice-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}
.choice-card.active { border-color: var(--accent); background: rgba(14, 165, 233, 0.2); }
.swatch { width: 16px; height: 16px; border-radius: 999px; flex-shrink: 0; border: 2px solid rgba(255,255,255,0.6); }

.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* Resident Phone & Gallery Shared Shell */
.phone-card {
  width: min(880px, 96vw);
  max-height: 90vh;
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.gallery-card { width: min(1040px, 96vw); }
.phone-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}
.phone-title { font-size: 1.08rem; font-weight: 700; }
.phone-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.phone-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
}
.phone-tab {
  border: 1px solid var(--border);
  background: var(--bg-input);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.phone-tab.active { background: var(--accent); color: #ffffff; border-color: transparent; }

.phone-body { padding: 16px 20px 22px; overflow-y: auto; flex: 1; }

/* Blender Gallery Grid, Video & Lightbox */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.gallery-item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease;
}
.gallery-item:hover { transform: translateY(-2px); border-color: var(--accent); }
.gallery-thumb-wrap { position: relative; aspect-ratio: 16 / 9; background: #071320; overflow: hidden; }
.gallery-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-res-tag {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 8px;
  border-radius: 8px;
  background: rgba(6, 17, 29, 0.82);
  color: #e2f2ff;
  font-size: 12px;
  font-weight: 600;
}
.gallery-meta { padding: 11px 13px; }
.gallery-item-title { font-size: 14px; font-weight: 700; line-height: 1.3; }
.gallery-item-sub { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

.gallery-empty {
  text-align: center;
  padding: 32px 20px;
  border: 1px dashed var(--border-strong);
  border-radius: 16px;
  background: var(--bg-input);
}
.gallery-empty-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.18);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
}
.gallery-empty h3 { margin: 0 0 8px; font-size: 1.15rem; }
.gallery-empty p { margin: 0 auto 18px; max-width: 560px; font-size: 13px; line-height: 1.56; color: var(--text-muted); }
.gallery-empty-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

.gallery-video-wrap { display: flex; flex-direction: column; gap: 12px; }
.gallery-video-switcher {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 12px;
  border-radius: 13px;
  background: var(--bg-input);
  border: 1px solid var(--border);
}
.switcher-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.switcher-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
  justify-content: flex-start;
}
.video-ver-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card-solid);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
  flex-wrap: wrap;
}
.video-ver-btn:hover { border-color: var(--border-strong); background: var(--bg-hover); }
.video-ver-btn.active {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.24), rgba(168, 85, 247, 0.2));
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.22);
}
.video-ver-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  flex-shrink: 0;
}
.video-ver-dot.cycles { background: linear-gradient(135deg, #00e5ff, #f43f5e); }
.video-ver-dot.eevee { background: #22c55e; }
.video-ver-dot.community { background: linear-gradient(135deg, #10b981, #0ea5e9); }
.video-ver-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(14, 165, 233, 0.16);
  color: var(--accent);
  white-space: nowrap;
}
.gallery-video {
  width: 100%;
  max-height: 48vh;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  border-radius: 14px;
  background: #040b14;
  border: 1px solid var(--border);
}
.gallery-video::cue {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 600;
  color: #ffffff;
  background-color: rgba(6, 17, 29, 0.78);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}
.gallery-audio-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-radius: 11px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.12), rgba(20, 184, 166, 0.1));
  border: 1px solid rgba(56, 189, 248, 0.3);
}
.audio-master-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.audio-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.8);
  flex-shrink: 0;
}
.sub-toggle-btn {
  border: 1px solid var(--border);
  background: var(--bg-card-solid);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.sub-toggle-btn:hover { border-color: var(--border-strong); color: var(--text); }
.sub-toggle-btn.active {
  background: var(--accent);
  border-color: transparent;
  color: #ffffff;
}
.gallery-video-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.gallery-chapters { display: flex; flex-wrap: wrap; gap: 7px; }

.gallery-lightbox {
  width: min(1160px, 96vw);
  max-height: 94vh;
  background: var(--bg-card-solid);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.gallery-lb-top {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.gallery-lb-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #040b14;
  padding: 12px;
  min-height: 360px;
  max-height: 76vh;
}
.gallery-lb-img { max-width: 100%; max-height: 72vh; object-fit: contain; border-radius: 10px; }
.gallery-lb-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 5; }
#galLbPrev { left: 14px; }
#galLbNext { right: 14px; }
.gallery-lb-cap { padding: 12px 18px; font-size: 13px; color: var(--text-muted); border-top: 1px solid var(--border); }

/* Resident Phone Content */
.stamp-progress-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.stamp-progress-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px; }
.progress-track { height: 9px; border-radius: 99px; background: rgba(148,163,184,0.22); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #0ea5e9, #14b8a6, #22c55e); transition: width 0.3s ease; }
.stamp-actions-row { margin-top: 10px; display: flex; justify-content: flex-end; }

.landmark-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.lm-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lm-card.done { border-color: rgba(34, 197, 94, 0.55); }
.lm-card-top { display: flex; align-items: flex-start; gap: 10px; }
.lm-badge {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lm-meta { flex: 1; min-width: 0; }
.lm-name { font-weight: 700; font-size: 13px; line-height: 1.3; }
.lm-zone { font-size: 12px; color: var(--text-muted); }
.lm-desc { margin: 0; font-size: 12px; line-height: 1.48; color: var(--text-muted); flex: 1; }
.lm-actions { display: flex; gap: 8px; }
.lm-actions button { flex: 1; }

.pill { padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill-ok { background: rgba(34, 197, 94, 0.2); color: var(--ok); }
.pill-wait { background: rgba(148, 163, 184, 0.18); color: var(--text-muted); }

.fullmap-wrap canvas {
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
  cursor: pointer;
  display: block;
}
.map-hint { font-size: 12px; color: var(--text-muted); margin: 8px 0 12px; }
.zone-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.zone-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.zone-chip:hover { border-color: var(--accent); }
.zone-chip .dot { width: 8px; height: 8px; border-radius: 999px; }

.wardrobe-section { margin-bottom: 16px; }
.wardrobe-section h4 { margin: 0 0 8px; font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.guide-block {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.guide-block h4 { margin: 0 0 6px; font-size: 14px; }
.guide-block p { margin: 0; font-size: 13px; line-height: 1.58; color: var(--text-muted); }

/* NPC Dialogue Drawer */
.dialogue-card {
  width: min(560px, 94vw);
  background: var(--bg-card-solid);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.dialogue-speaker { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.dialogue-name { font-weight: 700; font-size: 15px; color: var(--accent); }
.dialogue-zone { font-size: 12px; color: var(--text-muted); }
.dialogue-text { font-size: 14px; line-height: 1.62; margin: 0 0 16px; min-height: 64px; }
.dialogue-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* Toast Notification */
.toast {
  position: fixed;
  top: 74px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  z-index: 85;
  background: linear-gradient(135deg, #0d2a42, #0b4f6c);
  color: #ffffff;
  border: 1px solid rgba(56, 189, 248, 0.55);
  border-radius: 14px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Responsive Mobile Layout */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; }
  .portal-stage { padding: 12px 12px 26px; }
  .hero-card { padding: 17px 17px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .landmark-grid { grid-template-columns: 1fr; }
  .hud-top-left { top: 10px; left: 10px; max-width: calc(100vw - 146px); }
  .hud-bar { padding: 6px 8px; gap: 6px; }
  #hudClock { display: none; }
  .hud-top-right { top: 10px; right: 10px; gap: 6px; }
  .minimap-box { width: 124px; height: 88px; }
  .hud-quick-row { flex-direction: column; align-items: stretch; gap: 5px; }
  .hud-quick-row .btn-sm { padding: 5px 8px; }
  .controls-hint-bar { display: none; }
  .hud-bottom-center { bottom: 10px; gap: 6px; max-width: calc(100vw - 16px); }
  .interact-banner { padding: 8px 14px; font-size: 12px; }
  .veh-btn { padding: 7px 9px; white-space: nowrap; }
  .veh-btn .key-badge { display: none; }
  .joystick-zone { left: 14px; bottom: 120px; width: 104px; height: 104px; }
  .joystick-knob { width: 42px; height: 42px; }
  .touch-actions { right: 14px; bottom: 120px; gap: 8px; }
  .touch-fab { min-width: 54px; height: 44px; font-size: 12px; }
  .cinema-meta { max-width: 210px; }
  .cinema-top-actions .btn-sm { padding: 6px 9px; }
  .designer-panel { top: 112px; bottom: 118px; }
  .gallery-video-switcher { flex-direction: column; align-items: stretch; gap: 8px; }
  .switcher-pills { flex-direction: column; align-items: stretch; }
  .video-ver-btn { justify-content: space-between; width: 100%; }
  .phone-body { padding: 14px 14px 18px; }
}
