:root {
  --paper: #f5f2ea;
  --ink: #243b33;
  --muted: #73796f;
  --accent: #a45135;
  --gold: #e5a93c;
  --line: #dcded3;
  --dark-bg: #0f1814;
}

* { box-sizing: border-box; }
body, html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--dark-bg);
  color: #fff;
  font-family: 'Be Vietnam Pro', system-ui, -apple-system, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

#canvasContainer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
}
#canvasContainer:active {
  cursor: grabbing;
}

/* Header & Video-like Top Bar */
.top-nav {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr minmax(0, 2fr) 1fr;
  align-items: start;
  gap: 8px;
  max-width: none;
  margin: 0;
  border: 0;
  padding: 10px 16px 16px;
  background: linear-gradient(to bottom, rgba(10, 18, 14, 0.82), transparent);
  pointer-events: none;
}
.top-nav :is(a, button, select) { pointer-events: auto; }

.brand-back {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1.2px;
  background: rgba(0, 0, 0, 0.5);
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
  transition: all 0.25s;
}
.brand-back:hover {
  background: rgba(164, 81, 53, 0.9);
  border-color: #fff;
}
.brand-back b { color: #f2a88d; }

.top-center-banner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.top-center-banner h1 {
  margin: 0;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  text-shadow: 0 1px 4px #000;
}
#currentHeritageSubtitle {
  margin: 0;
  color: #f0f4f1;
  font-size: 11px;
  line-height: 1.3;
  text-shadow: 0 1px 4px #000;
}
.source-badge-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(20, 35, 28, 0.85);
  border: 1px solid rgba(229, 169, 60, 0.45);
  color: #f7d189;
  font-size: 10px;
  font-weight: 500;
  padding: 2px 10px;
  border-radius: 12px;
  cursor: pointer;
  margin-top: 3px;
  backdrop-filter: blur(6px);
  transition: all 0.2s;
  pointer-events: auto;
}
.source-badge-btn:hover {
  background: rgba(164, 81, 53, 0.9);
  border-color: #fff;
  color: #fff;
}
.source-badge-btn.is-real {
  border-color: rgba(72, 187, 120, 0.6);
  color: #9ae6b4;
}
.site-title-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.8px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.6);
}
.heritage-select {
  max-width: min(280px, 65vw);
  background: rgba(10, 18, 14, 0.75);
  border: 1px solid rgba(229, 169, 60, 0.6);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  outline: none;
  cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  transition: all 0.2s;
}
.heritage-select:hover {
  border-color: #fff;
  background: rgba(164, 81, 53, 0.85);
}
.heritage-select option {
  background: #192721;
  color: #fff;
  padding: 6px;
}
.site-title-badge .pencil-icon {
  color: var(--gold);
  font-size: 14px;
}
.top-actions {
  display: flex;
  justify-self: end;
  gap: 8px;
}
.top-actions .site-language {
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 255, 255, 0.25);
  border-radius: 18px;
}
.btn-top {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 8px 14px;
  font-size: 12px;
  border-radius: 18px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}
.btn-top:hover {
  background: rgba(255, 255, 255, 0.2);
}
.btn-top.active {
  background: var(--accent);
  border-color: #f2a88d;
}

/* 3D Ground Navigation Arrow (Bước đi giữa các điểm) */
.ground-nav-arrow {
  position: absolute;
  width: 48px;
  height: 48px;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1);
}
.ground-nav-arrow:hover {
  transform: translate(-50%, -50%) scale(1.15);
  z-index: 65;
}
.arrow-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(164, 81, 53, 0.9);
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  font-weight: bold;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  animation: pulse-ground 2s infinite;
  flex-shrink: 0;
}
@keyframes pulse-ground {
  0% { box-shadow: 0 0 0 0 rgba(242, 168, 141, 0.8); }
  70% { box-shadow: 0 0 0 14px rgba(242, 168, 141, 0); }
  100% { box-shadow: 0 0 0 0 rgba(242, 168, 141, 0); }
}
.arrow-label {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 18, 14, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 14px;
  white-space: nowrap;
  backdrop-filter: blur(6px);
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Numbered Circular Hotspots (1, 2, 3... như video mẫu) */
.hotspot-numbered {
  position: absolute;
  width: 32px;
  height: 32px;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: pointer;
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1);
}
.hotspot-numbered:hover {
  transform: translate(-50%, -50%) scale(1.15);
  z-index: 58;
}
.hotspot-num-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(229, 169, 60, 0.92);
  border: 2px solid #fff;
  color: #1a221a;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  animation: pulse-num 2.5s infinite;
  flex-shrink: 0;
}
.hotspot-num-circle.is-nav {
  background: var(--accent);
  border-color: #fff;
  color: #fff;
  font-size: 15px;
  animation: pulse-ground 1.8s infinite;
}
@keyframes pulse-num {
  0% { box-shadow: 0 0 0 0 rgba(229, 169, 60, 0.8); }
  70% { box-shadow: 0 0 0 10px rgba(229, 169, 60, 0); }
  100% { box-shadow: 0 0 0 0 rgba(229, 169, 60, 0); }
}
.hotspot-num-label {
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: rgba(10, 18, 14, 0.88);
  border: 1px solid rgba(229, 169, 60, 0.4);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  white-space: nowrap;
  backdrop-filter: blur(6px);
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Floorplan Mini-Map with Radar (Bản đồ mặt bằng có nón radar quét góc nhìn) */
.minimap-panel {
  position: absolute;
  bottom: 95px;
  left: 20px;
  z-index: 90;
  width: 220px;
  background: rgba(12, 20, 16, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 10px;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  transition: all 0.3s ease;
}
.minimap-panel.collapsed {
  width: 44px;
  height: 44px;
  padding: 0;
  overflow: hidden;
  border-radius: 50%;
}
.minimap-panel.collapsed .minimap-body {
  display: none;
}
.minimap-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.8px;
}
.minimap-header button {
  background: none;
  border: 0;
  color: #ccc;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
}
.minimap-map-wrap {
  position: relative;
  width: 100%;
  height: 160px;
  background: #192721;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.minimap-svg {
  width: 100%;
  height: 100%;
}
.radar-cone {
  position: absolute;
  width: 70px;
  height: 70px;
  pointer-events: none;
  transform-origin: center center;
  z-index: 10;
  transition: transform 0.05s linear;
}
.radar-cone svg {
  width: 100%;
  height: 100%;
}
.minimap-node {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e5a93c;
  border: 2px solid #fff;
  transform: translate(-50%, -50%);
  cursor: pointer;
  z-index: 20;
  transition: transform 0.2s;
}
.minimap-node:hover {
  transform: translate(-50%, -50%) scale(1.4);
}
.minimap-node.active {
  background: #e64a19;
  box-shadow: 0 0 10px #e64a19;
}

/* Bottom Scene Carousel (Dải chọn phòng / điểm nhìn) */
.bottom-tour-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 85;
  background: linear-gradient(to top, rgba(10, 18, 14, 0.95) 0%, rgba(10, 18, 14, 0.75) 80%, transparent 100%);
  padding: 12px 20px 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}
.scenes-carousel {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  max-width: 70vw;
  scrollbar-width: none;
  padding: 4px;
}
.scenes-carousel::-webkit-scrollbar { display: none; }

.scene-card {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 6px 12px 6px 6px;
  cursor: pointer;
  transition: all 0.25s;
  color: #fff;
}
.scene-card:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: #fff;
}
.scene-card.active {
  background: rgba(164, 81, 53, 0.9);
  border-color: var(--gold);
  box-shadow: 0 4px 15px rgba(164, 81, 53, 0.5);
}
.scene-card img {
  width: 44px;
  height: 34px;
  object-fit: cover;
  border-radius: 4px;
}
.scene-card-info {
  text-align: left;
}
.scene-card-title {
  font-size: 11px;
  font-weight: 600;
  display: block;
}
.scene-card-sub {
  font-size: 9px;
  color: #adb8b0;
}

/* Action Controls (Bên phải dưới cùng) */
.tour-action-tools {
  display: flex;
  gap: 6px;
}
.action-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.action-icon-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.08);
}
.action-icon-btn.active {
  background: var(--accent);
  border-color: var(--gold);
}

/* Dialog Hotspot Detail */
dialog.story-popup {
  border: 0;
  background: var(--paper);
  color: var(--ink);
  width: min(540px, 92vw);
  max-height: 85vh;
  border-radius: 12px;
  padding: 0;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  z-index: 200;
}
dialog.story-popup::backdrop {
  background: rgba(10, 20, 16, 0.7);
  backdrop-filter: blur(5px);
}
.story-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--accent);
  font-weight: 600;
}
.story-header button {
  background: none;
  border: 0;
  font-size: 16px;
  color: var(--ink);
  cursor: pointer;
}
.story-content {
  padding: 20px;
  overflow-y: auto;
}
.story-content h2 {
  margin: 0 0 12px;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 22px;
  color: var(--ink);
}
.story-content img {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 12px;
  background: #eee;
}
.story-content p {
  line-height: 1.8;
  color: #4b5850;
  font-size: 13px;
  margin: 0 0 16px;
}
.audio-player-box {
  background: #e8e4d8;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.audio-player-box button {
  background: var(--accent);
  border: 0;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Smooth Fade Transition Screen */
#sceneFadeOverlay {
  position: absolute;
  inset: 0;
  background: #0f1814;
  opacity: 0;
  pointer-events: none;
  z-index: 150;
  transition: opacity 0.4s ease;
}
#sceneFadeOverlay.active {
  opacity: 1;
}

/* Loading Spinner */
#panoLoader {
  position: absolute;
  inset: 0;
  background: #0f1814;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 180;
  transition: opacity 0.4s ease;
}
#panoLoader.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
#panoLoading,
#panoError {
  padding: 0 20px;
  text-align: center;
  color: #d1dcd5;
}
#panoLoading {
  font-size: 12px;
  letter-spacing: 1px;
}
#panoError .primary {
  display: inline-block;
  margin: 4px;
  padding: 8px 12px;
  border: 1px solid #748a7e;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.loader-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 768px) {
  .minimap-panel { bottom: 85px; left: 10px; width: 170px; }
  .scenes-carousel { max-width: 60vw; }
  .scene-card-sub { display: none; }
}
@media (max-width: 640px) {
  .top-nav { grid-template-columns: minmax(0, 1fr) auto; padding: 8px 10px 14px; }
  .top-center-banner { grid-column: 1 / -1; grid-row: 2; }
  .top-actions { grid-column: 2; grid-row: 1; gap: 4px; }
  .brand-back, .btn-top { padding: 6px 8px; font-size: 11px; }
  .brand-back { gap: 4px; letter-spacing: 0; }
}

/* Quick History Side Drawer (Xem nhanh ảnh cũ kế bên) */
.btn-quick-history {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(229, 169, 60, 0.22) !important;
  border: 1px solid rgba(229, 169, 60, 0.7) !important;
  color: #fff !important;
  font-weight: 600;
  cursor: pointer;
  animation: pulse-gold 2.5s infinite;
}
.btn-quick-history:hover {
  background: rgba(229, 169, 60, 0.45) !important;
  border-color: #ffe082 !important;
}
@keyframes pulse-gold {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229, 169, 60, 0.4); }
  50% { box-shadow: 0 0 12px 2px rgba(229, 169, 60, 0.5); }
}

.pill-badge {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 700;
}

.quick-history-drawer {
  position: fixed;
  top: 75px;
  right: 16px;
  bottom: 110px;
  width: 370px;
  max-width: calc(100vw - 32px);
  background: rgba(14, 25, 20, 0.94);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(229, 169, 60, 0.45);
  border-radius: 12px;
  box-shadow: -8px 12px 36px rgba(0, 0, 0, 0.7);
  z-index: 150;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideInRight 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: rgba(20, 36, 29, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.drawer-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.drawer-icon {
  font-size: 22px;
}
.drawer-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
.drawer-subtitle {
  margin: 2px 0 0;
  font-size: 11px;
  color: #a2b7ab;
  line-height: 1.2;
}
.drawer-close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}
.drawer-close-btn:hover {
  background: rgba(229, 169, 60, 0.8);
  color: #000;
}

.drawer-preview-box {
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.preview-badge-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}
.preview-year-badge {
  background: var(--gold);
  color: #1a2922;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}
.preview-period-tag {
  background: rgba(255, 255, 255, 0.12);
  color: #d1ded6;
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 4px;
}
.preview-img-wrap {
  width: 100%;
  max-height: 200px;
  background: #000;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(229, 169, 60, 0.3);
}
.preview-img-wrap img {
  width: 100%;
  height: auto;
  max-height: 200px;
  object-fit: contain;
  display: block;
}
.drawer-preview-caption {
  margin: 8px 0 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: #f1f4f2;
}

.drawer-list-title {
  padding: 8px 14px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gold);
}

.drawer-cards-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.drawer-card-item {
  display: flex;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: all 0.2s;
  align-items: center;
}
.drawer-card-item:hover, .drawer-card-item.active {
  background: rgba(229, 169, 60, 0.18);
  border-color: var(--gold);
}
.drawer-card-thumb {
  width: 60px;
  height: 48px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  background: #000;
}
.drawer-card-info {
  flex: 1;
  min-width: 0;
}
.drawer-card-year {
  font-size: 10px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 2px;
}
.drawer-card-desc {
  font-size: 11px;
  color: #d1dad5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

/* ==========================================================================
   360 TOUR AUDIO GUIDE & AUTO-READ CONTROLLER
   ========================================================================== */
.tour-audio-ctrl {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-audio-play {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(164, 81, 53, 0.4) !important;
  border: 1px solid rgba(229, 169, 60, 0.6) !important;
  color: #fff !important;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn-audio-play:hover {
  background: rgba(164, 81, 53, 0.7) !important;
  border-color: #ffe082 !important;
}

.btn-audio-play.active {
  background: var(--accent) !important;
  border-color: var(--gold) !important;
  box-shadow: 0 0 14px rgba(229, 169, 60, 0.5);
}

.mini-equalizer {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}

.mini-equalizer span {
  width: 2.5px;
  height: 3px;
  background: #e5a93c;
  border-radius: 1px;
}

.mini-equalizer.playing span:nth-child(1) { animation: miniWave 0.8s infinite ease-in-out; }
.mini-equalizer.playing span:nth-child(2) { animation: miniWave 1.1s infinite 0.15s ease-in-out; }
.mini-equalizer.playing span:nth-child(3) { animation: miniWave 0.9s infinite 0.3s ease-in-out; }

@keyframes miniWave {
  0%, 100% { height: 3px; }
  50% { height: 13px; }
}

.btn-auto-read {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(46, 189, 96, 0.2) !important;
  border: 1px solid rgba(46, 189, 96, 0.6) !important;
  color: #fff !important;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-auto-read.off {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  color: #a0ada5 !important;
}


/* ---------- Mobile layout (no overlapping controls) ---------- */
@media (max-width: 640px) {
  .top-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 8px 10px 12px;
  }
  .btn-top, .brand-back { white-space: nowrap; flex: 0 0 auto; }
  /* Back link: arrow only */
  .brand-back { font-size: 0; padding: 0; width: 34px; height: 34px; justify-content: center; }
  .brand-back::before { content: '←'; font-size: 16px; }
  .top-actions { flex: 0 1 auto; min-width: 0; gap: 4px; flex-wrap: nowrap; }
  .tour-audio-ctrl { display: flex; gap: 4px; }
  .tour-audio-label, #guideBtn span, .btn-quick-history > span:not(.pill-badge) { display: none; }
  .btn-top { padding: 0 10px; height: 34px; font-size: 11px; }
  .top-actions .site-language { height: 34px; padding: 0 10px; }
  .top-center-banner { order: 3; flex: 1 1 100%; }
  .heritage-select { max-width: calc(100vw - 90px); font-size: 12px; padding: 5px 12px; }
  .site-title-badge .pencil-icon { font-size: 12px; }

  /* Bottom bar: scenes row, then tools row */
  .bottom-tour-bar { flex-direction: column; gap: 8px; padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); }
  .scenes-carousel { max-width: 100%; width: 100%; }
  .scene-card { padding: 4px 10px 4px 4px; }
  .action-icon-btn { width: 34px; height: 34px; }

  /* Mini-map: smaller, sits above the bottom bar, starts collapsed */
  .minimap-panel { bottom: 128px; left: 10px; width: 160px; padding: 8px; }
  .minimap-map-wrap { height: 115px; }
  .minimap-panel.collapsed { width: 40px; height: 40px; padding: 0; }
  .minimap-panel.collapsed .minimap-header { margin: 0; height: 100%; justify-content: center; }
  .minimap-panel.collapsed .minimap-header span { display: none; }
  .minimap-panel.collapsed .minimap-header button { font-size: 0; width: 100%; height: 100%; }
  .minimap-panel.collapsed .minimap-header button::before { content: '🗺'; font-size: 18px; }
  .quick-history-drawer { top: 130px; bottom: 140px; right: 10px; left: 10px; width: auto; max-width: none; }
}

/* Top-right buttons: keep each on one line (desktop) */
.btn-top { white-space: nowrap; }
.tour-audio-label { display: inline-block; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.top-actions { flex-wrap: nowrap; align-items: center; }
@media (max-width: 1100px) and (min-width: 641px) {
  .tour-audio-label { max-width: 90px; }
  .btn-top { padding: 8px 10px; }
}

.brand-logo-sm{width:26px;height:26px;display:block;flex:0 0 auto}
@media (max-width: 640px){.brand-logo-sm{display:none}}
@media (min-width: 641px) {
  .top-nav { grid-template-columns: auto minmax(0, 1fr) auto; }
  .brand-back { white-space: nowrap; }
}
@media (min-width: 641px) and (max-width: 1100px) {
  .brand-back { font-size: 0; gap: 6px; padding: 5px 12px 5px 10px; }
  .brand-back::before { content: '←'; font-size: 16px; }
  .brand-back b { display: none; }
}
