
/* ── Entry / Landing screen ──────────────────────────────────────────────── */
#entry-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #080809;
  transition: opacity 0.55s ease, transform 0.55s ease;
}
#entry-screen.dismissed {
  opacity: 0;
  pointer-events: none;
  transform: scale(1.03);
}

#entry-content {
  text-align: center;
  padding: 0 24px;
  max-width: 560px;
}

.entry-eyebrow {
  margin: 0 0 20px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.entry-title {
  margin: 0 0 18px;
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  font-weight: 300;
  letter-spacing: -0.02em;
  color: #fff;
  line-height: 1.05;
}

.entry-subtitle {
  margin: 0 0 44px;
  font-size: 15px;
  line-height: 1.65;
  color: rgba(255,255,255,0.52);
  font-weight: 300;
}

.entry-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.entry-btn {
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 0.04em;
  padding: 12px 28px;
  border-radius: 50px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}
.entry-btn--ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.22);
  color: rgba(255,255,255,0.72);
}
.entry-btn--ghost:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.4);
  color: #fff;
}
.entry-btn--primary {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #060607;
  font-weight: 600;
}
.entry-btn--primary:hover {
  background: #9af4d0;
  border-color: #9af4d0;
  box-shadow: 0 0 20px rgba(110,231,183,0.35);
}

/* About description panel (shown over entry screen) */
.entry-about-panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 72px 24px 48px;
  background: rgba(8,8,9,0.96);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  text-align: center;
  box-sizing: border-box;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.entry-about-panel.visible {
  opacity: 1;
  pointer-events: auto;
}
.entry-about-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: 0;
  color: rgba(255,255,255,0.45);
  font-size: 18px;
  cursor: pointer;
  padding: 6px 10px;
}
.entry-about-close:hover { color: #fff; }
.entry-about-heading {
  margin: 0 0 20px;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: #fff;
}
.entry-about-panel p {
  margin: 0 0 1em;
  font-size: 14px;
  line-height: 1.7;
  color: rgba(255,255,255,0.68);
  max-width: 460px;
}
.entry-about-muted {
  font-size: 12px !important;
  color: var(--muted) !important;
  letter-spacing: 0.06em;
}
.entry-about-label {
  font-size: 10px !important;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent) !important;
  margin: 1.4rem 0 0.3rem !important;
  font-weight: 600;
}

/* ── Table of contents ───────────────────────────────────────────────────── */
#toc-btn {
  position: fixed;
  bottom: 56px;
  left: 12px;
  height: 32px;
  padding: 0 14px;
  border-radius: 16px;
  background: rgba(10,10,12,0.82);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.7);
  font-family: Inter, Roboto, system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  cursor: pointer;
  z-index: 100;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background .18s, border-color .18s, color .18s;
}
#toc-btn:hover, #toc-btn[aria-expanded="true"] {
  background: rgba(110,231,183,0.12);
  border-color: rgba(110,231,183,0.35);
  color: var(--accent);
}

#toc-panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: rgba(10,10,14,0.96);
  border-right: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  overflow-y: auto;
}
#toc-panel.open { transform: translateX(0); }

.toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.toc-title {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: lowercase;
  color: rgba(255,255,255,0.5);
  font-family: Inter, Roboto, system-ui, sans-serif;
}
#toc-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
  transition: color .15s;
}
#toc-close:hover { color: #fff; }

.toc-nav { padding: 12px 0 24px; }

.toc-section { padding: 16px 0 8px; }
.toc-section + .toc-section {
  border-top: 1px solid rgba(255,255,255,0.06);
}

.toc-room-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: lowercase;
  color: var(--accent);
  padding: 0 20px 8px;
  font-family: Inter, Roboto, system-ui, sans-serif;
  font-weight: 600;
}

.toc-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.toc-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: rgba(255,255,255,0.65);
  font-family: Inter, Roboto, system-ui, sans-serif;
  font-size: 13px;
  padding: 7px 20px;
  cursor: pointer;
  transition: background .14s, color .14s;
  letter-spacing: 0.01em;
}
.toc-item:hover {
  background: rgba(110,231,183,0.07);
  color: #fff;
}
.toc-item--link { color: rgba(110,231,183,0.7); }
.toc-item--link:hover { color: var(--accent); }

@media (max-width: 640px) {
  #toc-panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 72vh;
    border-right: none;
    border-top: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  }
  #toc-panel.open { transform: translateY(0); }
  #toc-btn { bottom: 100px; }
}

/* iPad landscape — nudge contents button above the hint label */
@media (min-width: 768px) and (orientation: landscape) {
  #toc-btn { bottom: 80px; }
}

/* App wrapper — always rendered; entry screen sits on top */
#app { width: 100%; height: 100%; }

/* ── Root variables ──────────────────────────────────────────────────────── */
:root {
  --bg: #0b0b0d;
  --panel-bg: rgba(10,10,12,0.96);
  --accent: #6ee7b7;
  --muted: #9aa3a8;
}
html,body { height:100%; margin:0; background:var(--bg); color:#ddd; font-family: Inter, Roboto, system-ui, sans-serif; -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale; }
#container { width:100%; height:100vh; position:relative; overflow:hidden; touch-action: none; }
canvas { display:block; width:100%; height:100%; }

/* Hotspot labels (HTML) */
.hotspot-label {
  position:absolute;
  transform:translate(-50%,-100%);
  pointer-events:none;
  color: #fff;
  font-size:13px;
  padding:6px 8px;
  background: linear-gradient(180deg, rgba(0,0,0,0.88), rgba(0,0,0,0.78));
  border-radius:6px;
  border:1px solid rgba(255,255,255,0.04);
  white-space:nowrap;
  opacity:0;
  transition:opacity .18s ease, transform .18s ease;
  will-change: transform, opacity;
}
.hotspot-label.visible { opacity:1; transform:translate(-50%,-120%) scale(1); pointer-events:auto; }

.label-tap-hint {
  display: none;
  font-size: 10px;
  color: rgba(255,255,255,0.45);
  margin-top: 3px;
  letter-spacing: 0.04em;
}
@media (hover: none) {
  .label-tap-hint { display: block; }
}

/* Hotspot screen dot (for click/tap) */
.hotspot-dot {
  position:absolute;
  width:18px;
  height:18px;
  border-radius:50%;
  background: radial-gradient(circle at 30% 30%, #fff 0%, transparent 45%), rgba(110,231,183,0.14);
  box-shadow: 0 0 14px 6px rgba(110,231,183,0.12), 0 0 28px 1px rgba(110,231,183,0.06);
  transform:translate(-50%,-50%);
  pointer-events:none;
}

/* Overlay panel */
.overlay {
  position:fixed;
  left:0; right:0; bottom:0;
  top:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(2,2,3,0.45);
  z-index:50;
  opacity:0;
  pointer-events:none;
  transition:opacity .28s ease;
}
.overlay.active {
  opacity:1;
  pointer-events:auto;
}
.panel {
  width:min(960px,96%);
  max-height:88vh;
  background: rgba(255,255,255,0.13);
  backdrop-filter: blur(26px) saturate(1.5);
  -webkit-backdrop-filter: blur(26px) saturate(1.5);
  border-radius:10px;
  border: 1px solid rgba(255,255,255,0.52);
  box-shadow: 0 12px 48px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.18);
  overflow:hidden;
  color:#fff;
  transform: translateY(16px);
  transition: transform .28s ease;
  opacity:1;
}
.overlay.active .panel { transform: translateY(0); }

.panel .header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
}
.panel h2 { margin:0; font-size:16px; letter-spacing:0.2px; color:#fff; }
.close {
  background:transparent;
  border:0;
  color:rgba(255,255,255,0.6);
  font-size:18px;
  cursor:pointer;
  padding:6px;
}
.panel .content {
  padding:18px;
  overflow:auto;
  color:#eef2f0;
  background: transparent;
}

.text-scroll { max-height:60vh; overflow:auto; line-height:1.55; color:#eef2f0; font-size:15px; }
.text-scroll p { margin-top:0; margin-bottom:1em; color:#eef2f0; }
.muted { color:var(--muted); font-size:13px; }

.media { display:flex; gap:12px; flex-direction:column; align-items:stretch; position:relative; }
.next-video-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(10,10,12,0.88);
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.9);
  font-family: Inter, Roboto, system-ui, sans-serif;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  padding: 10px 22px;
  border-radius: 20px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.next-video-btn:hover {
  background: rgba(110,231,183,0.14);
  border-color: rgba(110,231,183,0.4);
  color: var(--accent);
}
video, img { width:100%; height:auto; border-radius:6px; background:#000; }
audio { width:100%; }

/* Room navigation bar */
#room-nav {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 100;
  pointer-events: auto;
}
.room-btn {
  background: rgba(10,10,12,0.88);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--muted);
  font-family: Inter, Roboto, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: background .18s, color .18s, border-color .18s;
  white-space: nowrap;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.room-btn:hover:not(:disabled) {
  background: rgba(110,231,183,0.12);
  border-color: rgba(110,231,183,0.35);
  color: #fff;
}
.room-btn.active {
  background: rgba(20,48,38,0.96);
  border-color: var(--accent);
  color: var(--accent);
}
.room-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Tiny UI hint */
.hint {
  position: absolute;
  left:12px;
  bottom:12px;
  font-size:13px;
  color:#eef4f1;
  background: rgba(0,0,0,0.28);
  padding:8px 10px;
  border-radius:8px;
  z-index:10;
  user-select:none;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Legend dot (matches 3-D hotspot appearance) */
.legend-dot {
  display: inline-block;
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0%, transparent 42%), #6ee7b7;
  box-shadow: 0 0 6px 3px rgba(110,231,183,0.55);
  animation: legend-pulse 3.2s ease-in-out infinite;
}

@keyframes legend-pulse {
  0%, 100% { transform: scale(1);    box-shadow: 0 0 5px 2px rgba(110,231,183,0.45); }
  50%       { transform: scale(1.4); box-shadow: 0 0 10px 5px rgba(110,231,183,0.8); }
}

/* Click / tap icon shown below each hotspot dot */
.hotspot-click-icon {
  position: absolute;
  transform: translate(-50%, 0);
  font-size: 20px;
  pointer-events: none;
  color: #6ee7b7;
  text-shadow: 0 0 8px rgba(110,231,183,0.9), 0 0 18px rgba(110,231,183,0.5);
  opacity: 0;
  transition: opacity 0.25s ease;
  animation: click-tap 2.8s ease-in-out infinite;
}
.hotspot-click-icon.visible { opacity: 1; }

@keyframes click-tap {
  0%   { transform: translate(-50%, 0)   scale(1);    opacity: 0.7;  }
  12%  { transform: translate(-50%, 2px) scale(0.78); opacity: 1;    }
  24%  { transform: translate(-50%, 0)   scale(1.28); opacity: 0.85; }
  36%  { transform: translate(-50%, 0)   scale(1);    opacity: 0.7;  }
  100% { transform: translate(-50%, 0)   scale(1);    opacity: 0.7;  }
}
/* ── Room loader spinner ─────────────────────────────────────────────────── */
#room-loader {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
#room-loader.active { opacity: 1; }
#room-loader::after {
  content: '';
  width: 32px;
  height: 32px;
  border: 2px solid rgba(110,231,183,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Fullscreen button ───────────────────────────────────────────────────── */
#fs-btn {
  position: fixed;
  bottom: 56px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(10,10,12,0.78);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background .18s, border-color .18s, color .18s;
}
#fs-btn:hover {
  background: rgba(110,231,183,0.12);
  border-color: rgba(110,231,183,0.35);
  color: var(--accent);
}

/* ── Link loading overlay ────────────────────────────────────────────────── */
#link-loader {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
#link-loader.active {
  opacity: 1;
  pointer-events: auto;
}
.link-loader-ring {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2.5px solid rgba(255,150,180,0.18);
  border-top-color: #ff8fb2;
  animation: spin 0.9s linear infinite, pulse-pink 1.8s ease-in-out infinite;
  box-shadow: 0 0 18px rgba(255,143,178,0.35);
}
@keyframes pulse-pink {
  0%, 100% { box-shadow: 0 0 12px rgba(255,143,178,0.3); }
  50%       { box-shadow: 0 0 28px rgba(255,143,178,0.7); }
}
.link-loader-text {
  margin: 0;
  font-family: Inter, Roboto, system-ui, sans-serif;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: lowercase;
  color: rgba(255,255,255,0.45);
}

/* ── Scroll hint ─────────────────────────────────────────────────────────── */
.scroll-hint {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 10px 0 4px;
  letter-spacing: 0.05em;
  transition: opacity 0.3s ease;
}

/* ── Panel close button — larger tap target on mobile ────────────────────── */
@media (max-width: 640px) {
  .close { padding: 10px 14px; font-size: 20px; }
}

/* Background audio toggle */
#audio-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(10,10,12,0.78);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--accent);
  font-size: 15px;
  cursor: pointer;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background .18s, border-color .18s, color .18s;
}
#audio-btn:hover {
  background: rgba(110,231,183,0.15);
  border-color: rgba(110,231,183,0.4);
}
#audio-btn.muted {
  color: var(--muted);
  border-color: rgba(255,255,255,0.08);
}

/* Work-in-progress badge */
.wip-badge {
  position: fixed;
  bottom: 12px;
  right: 12px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: #f5f0c0;
  background: rgba(0,0,0,0.52);
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid rgba(245,240,150,0.45);
  box-shadow: 0 0 8px rgba(245,240,100,0.12);
  z-index: 10;
  user-select: none;
}

@media (max-width:640px) {
  /* Panel as bottom sheet — no scrim, panel provides its own background */
  .overlay { align-items: flex-end; background: transparent; transition: none; }
  .panel {
    width: 100%;
    max-height: 84vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(24px);
    opacity: 1;
    transition: transform 0.4s cubic-bezier(0.33, 1, 0.68, 1);
  }
  .overlay.active .panel { transform: translateY(0); opacity: 1; }

  /* Tighter panel internals */
  .panel { display: flex; flex-direction: column; overscroll-behavior: contain; }
  .panel .header { padding: 12px 16px; flex-shrink: 0; }
  .panel h2 { font-size: 14px; }
  .panel .content { padding: 14px 16px; }

  /* Video panels: fixed height, full slide-up on open / slide-down on close */
  .panel--video {
    height: 68vh;
    transform: translateY(100%);
    transition: transform 0.55s cubic-bezier(0.33, 1, 0.68, 1);
  }
  .overlay.active .panel--video {
    transform: translateY(0);
    transition: transform 0.55s cubic-bezier(0.33, 1, 0.68, 1);
  }
  .overlay:not(.active) .panel--video {
    transition: transform 0.45s cubic-bezier(0.32, 0, 0.67, 0);
  }
  .panel--video .content { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; }
  .panel--video .media { width: 100%; }
  video { max-height: 52vh; width: 100%; object-fit: contain; }

  /* Text scroll takes remaining sheet height */
  .text-scroll { max-height: 62vh; font-size: 14px; }

  .hotspot-label { font-size:12px; padding:6px; }

  /* Shrink nav buttons so they fit without reaching the audio button */
  .room-btn { font-size: 11px; padding: 6px 10px; }

  /* Drop audio button below the nav row so they don't overlap */
  #audio-btn { top: 62px; }

  /* Hide long navigation hint — keep only the legend + tap cue */
  .hint-nav { display: none; }
  .hint { font-size: 12px; padding: 6px 8px; }

  /* Tighten WIP badge slightly */
  .wip-badge { font-size: 11px; padding: 5px 9px; }

  /* Entry screen — tighter vertical rhythm on small screens */
  #entry-content { padding: 0 20px; }
  .entry-eyebrow { margin-bottom: 14px; }
  .entry-title { margin-bottom: 14px; }
  .entry-subtitle { margin-bottom: 32px; font-size: 14px; }
  .entry-btn { padding: 13px 24px; font-size: 13px; }

  /* About panel — less top/bottom padding, scrollable */
  .entry-about-panel { padding: 60px 20px 32px; justify-content: flex-start; }
  .entry-about-heading { font-size: 16px; margin-bottom: 14px; }
  .entry-about-panel p { font-size: 13px; }
}

/* Touch active state for entry buttons (hover doesn't fire on touch) */
@media (hover: none) {
  .entry-btn--ghost:active {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.4);
    color: #fff;
  }
  .entry-btn--primary:active {
    background: #9af4d0;
    box-shadow: 0 0 20px rgba(110,231,183,0.35);
  }
}
