:root {
  --fg: #f5f5f4;
  --muted: rgba(245, 245, 244, 0.65);
  --glass: rgba(20, 20, 22, 0.55);
  --glass-strong: rgba(20, 20, 22, 0.8);
  --accent: #fbbf24;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: var(--fg);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#pano {
  position: absolute;
  inset: 0;
}

.bar {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 999px;
  z-index: 2;
}

.bar.top {
  top: max(16px, env(safe-area-inset-top));
  padding: 8px 18px;
  gap: 12px;
  max-width: calc(100% - 32px);
}

.bar.bottom {
  bottom: max(16px, env(safe-area-inset-bottom));
  padding: 6px;
}

h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#counter {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

button.icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
}

button.icon:hover { background: rgba(255, 255, 255, 0.12); }
button.icon:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
button.icon:disabled { opacity: 0.35; cursor: default; background: transparent; }
button.icon[aria-pressed="true"],
button.icon[aria-expanded="true"] { color: var(--accent); }
button.icon[hidden] { display: none; }

button.icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#scene-list {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 32px);
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 68px);
  display: flex;
  gap: 10px;
  padding: 10px;
  overflow-x: auto;
  background: var(--glass-strong);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius);
  z-index: 2;
  scrollbar-width: thin;
}

#scene-list[hidden] { display: none; }

#scene-list a {
  flex: 0 0 160px;
  color: var(--fg);
  text-decoration: none;
  border-radius: 8px;
  overflow: hidden;
  outline-offset: 2px;
}

#scene-list img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid transparent;
}

#scene-list a[aria-current="true"] img { border-color: var(--accent); }
#scene-list a:hover img { filter: brightness(1.15); }
#scene-list a:focus-visible { outline: 2px solid var(--accent); }

#scene-list span {
  display: block;
  padding: 6px 2px 0;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: min(420px, calc(100% - 32px));
  padding: 20px 24px;
  background: var(--glass-strong);
  border-radius: var(--radius);
  text-align: center;
  z-index: 3;
}

#message code {
  background: rgba(255, 255, 255, 0.12);
  padding: 1px 6px;
  border-radius: 4px;
}

@media (max-width: 480px) {
  #scene-list a { flex-basis: 128px; }
}

/* Link hotspots: a ring with a chevron, labelled with the target scene. */
.link-hotspot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--fg);
  font: inherit;
  cursor: pointer;
  /* Center the ring on the hotspot position. */
  transform: translate(-50%, -26px);
}

.link-hotspot .ring {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, background 0.15s ease;
}

.link-hotspot svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.link-hotspot .label {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--glass-strong);
  font-size: 13px;
  white-space: nowrap;
}

.link-hotspot:hover .ring,
.link-hotspot:focus-visible .ring {
  transform: scale(1.12);
  background: rgba(251, 191, 36, 0.35);
}

.link-hotspot:focus-visible { outline: none; }
.link-hotspot:focus-visible .ring { border-color: var(--accent); }
