:root {
  --bg: #1f241c;
  --ink: #f4f1e7;
  --ink-dim: rgba(244, 241, 231, 0.72);
  --line: rgba(244, 241, 231, 0.18);
  --card: rgba(24, 28, 21, 0.92);
  --accent: #c8a86a;
  --danger: #e08d78;
  font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

.viewer {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
}

.viewer__preview {
  position: absolute;
  inset: -6%;
  width: 112%;
  height: 112%;
  object-fit: cover;
  filter: blur(18px) saturate(0.9) brightness(0.62);
  transform: scale(1.02);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
  background: #2a3125;
}

.viewer__preview[data-visible='true'] {
  opacity: 1;
}

.viewer__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.viewer__hotspots {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(20, 24, 18, 0.62);
  color: var(--ink);
  font-size: 13px;
  line-height: 1;
  backdrop-filter: blur(6px);
  pointer-events: auto;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s ease, transform 0.16s ease;
}

.hotspot:hover,
.hotspot:focus-visible {
  background: rgba(200, 168, 106, 0.32);
  outline: none;
}

.hotspot[data-behind='true'] {
  display: none;
}

.hotspot__dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff, var(--accent) 62%, #9c7c3f);
  box-shadow: 0 0 0 6px rgba(200, 168, 106, 0.18);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 4px rgba(200, 168, 106, 0.16);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(200, 168, 106, 0.06);
  }
}

.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 12px;
  background: linear-gradient(180deg, rgba(15, 18, 13, 0.72), rgba(15, 18, 13, 0));
}

.topbar__btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(20, 24, 18, 0.55);
  color: var(--ink);
  font-size: 13px;
  backdrop-filter: blur(6px);
  cursor: pointer;
}

.topbar__btn[hidden] {
  display: none;
}

.topbar__btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.topbar__icon {
  font-size: 15px;
}

.topbar__title {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: center;
}

.topbar__title strong {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__title small {
  font-size: 11px;
  color: var(--ink-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.legend {
  position: absolute;
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(20, 24, 18, 0.5);
  color: var(--ink-dim);
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(12, 15, 10, 0.55);
  backdrop-filter: blur(2px);
}

.overlay[hidden] {
  display: none;
}

.overlay__card {
  width: min(340px, 100%);
  padding: 26px 22px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.overlay__title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.overlay__desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.8;
  color: var(--ink-dim);
}

.spinner {
  width: 26px;
  height: 26px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.btn {
  height: 38px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--accent);
  color: #241f14;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.drawer {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(300px, 82vw);
  padding: calc(14px + env(safe-area-inset-top)) 16px 20px;
  background: var(--card);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  z-index: 5;
}

.drawer[hidden] {
  display: none;
}

.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
}

.drawer__close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.drawer__hint {
  margin: 10px 0 14px;
  font-size: 11px;
  line-height: 1.7;
  color: var(--ink-dim);
}

.drawer__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scene-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.scene-item[aria-current='true'] {
  border-color: var(--accent);
  background: rgba(200, 168, 106, 0.14);
}

.scene-item:disabled {
  color: var(--ink-dim);
  cursor: not-allowed;
  opacity: 0.7;
}

.scene-item__name {
  font-size: 14px;
}

.scene-item__meta {
  font-size: 11px;
  color: var(--ink-dim);
}

.scrim {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 7, 0.45);
  z-index: 4;
}

.scrim[hidden] {
  display: none;
}

.spotcard {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  padding: 16px 16px 14px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.spotcard[hidden] {
  display: none;
}

.spotcard__head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.spotcard__head strong {
  font-size: 15px;
}

.spotcard__type {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 10px;
  color: var(--ink-dim);
}

.spotcard__desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink-dim);
}

.spotcard__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.spotcard__note {
  margin: 0;
  font-size: 11px;
  line-height: 1.6;
  color: var(--danger);
}

.spotcard__note[hidden] {
  display: none;
}

@media (min-width: 720px) {
  .spotcard {
    left: auto;
    right: 24px;
    bottom: 24px;
    width: 320px;
  }
}
