:root {
  --ink: #08232c;
  --deep: #102f39;
  --teal: #335c63;
  --sea: #75d8de;
  --foam: #e8fbfb;
  --mist: rgba(229, 248, 250, 0.84);
  --line: rgba(222, 249, 250, 0.34);
  --white: #f8ffff;
  --shadow: 0 24px 70px rgba(2, 29, 36, 0.26);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--ink);
  color: var(--white);
}
button { font: inherit; }
a-scene {
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 0;
}
canvas { cursor: grab; }
canvas:active { cursor: grabbing; }
.a-enter-vr-button {
  right: 18px !important;
  bottom: 18px !important;
  width: 42px !important;
  height: 42px !important;
  border-radius: 50% !important;
  border: 1px solid rgba(232,251,251,.28) !important;
  background-color: rgba(8,34,42,.62) !important;
}

#museum-ui {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  min-height: 82px;
  padding: 22px 28px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  background: linear-gradient(180deg, rgba(7, 31, 39, 0.82) 0%, rgba(7, 31, 39, 0.26) 58%, transparent 100%);
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  background: none;
  border: 0;
  color: var(--white);
  padding: 0;
  cursor: pointer;
  pointer-events: auto;
  letter-spacing: 0.04em;
}
.brand-name {
  font-family: 'Manrope', sans-serif;
  font-size: 20px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0.23em;
}
.brand-subtitle {
  margin-top: 7px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.23em;
  opacity: 0.65;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}
.utility-button,
.language-switcher {
  min-height: 34px;
  border: 1px solid rgba(226, 251, 251, 0.25);
  background: rgba(8, 35, 44, 0.38);
  color: var(--white);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.utility-button {
  padding: 0 13px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}
.utility-button:hover { background: rgba(102, 210, 217, 0.16); border-color: rgba(226, 251, 251, 0.48); }
.utility-button:active { transform: translateY(1px); }
.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,.35);
  box-shadow: 0 0 0 0 rgba(117,216,222,0);
  transition: .25s ease;
}
#sound-toggle[aria-pressed="true"] .status-dot {
  background: var(--sea);
  box-shadow: 0 0 12px rgba(117,216,222,.7);
}
.language-switcher {
  height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  letter-spacing: .08em;
}
.language-switcher button {
  border: 0;
  padding: 0;
  background: transparent;
  color: rgba(255,255,255,.48);
  cursor: pointer;
}
.language-switcher button[aria-pressed="true"] { color: var(--white); font-weight: 600; }
.language-switcher span { color: rgba(255,255,255,.25); }

#intro-card {
  position: absolute;
  left: 28px;
  bottom: 28px;
  width: min(390px, calc(100vw - 56px));
  padding: 18px 20px 17px;
  border: 1px solid rgba(231, 253, 253, 0.2);
  border-radius: 16px;
  background: rgba(8, 34, 42, 0.67);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  box-shadow: var(--shadow);
  transition: opacity .45s ease, transform .45s ease;
}
#intro-card.is-hidden { opacity: 0; transform: translateY(12px); }
.intro-index {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 9px;
  letter-spacing: .18em;
  color: var(--sea);
}
#intro-card p {
  margin: 0;
  max-width: 330px;
  font-size: 13px;
  line-height: 1.55;
  color: rgba(248,255,255,.88);
}
.intro-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 13px;
  font-size: 9px;
  letter-spacing: .08em;
  color: rgba(255,255,255,.55);
}
.intro-controls b { color: var(--white); font-weight: 600; }
.intro-controls em { font-style: normal; margin-left: 4px; }
.mobile-only { display: none; }

#exhibit-hint {
  position: absolute;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(8,34,42,.56);
  border: 1px solid rgba(231,253,253,.17);
  backdrop-filter: blur(10px);
  font-size: 9px;
  letter-spacing: .12em;
  opacity: 0;
  transition: opacity .25s ease;
}
#exhibit-hint.is-visible { opacity: 1; }
.hint-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sea);
  box-shadow: 0 0 0 0 rgba(117,216,222,.45);
  animation: hintPulse 1.8s infinite;
}
@keyframes hintPulse {
  0% { box-shadow: 0 0 0 0 rgba(117,216,222,.45); }
  65% { box-shadow: 0 0 0 8px rgba(117,216,222,0); }
  100% { box-shadow: 0 0 0 0 rgba(117,216,222,0); }
}

#exhibit-panel {
  position: absolute;
  top: 18px;
  right: 18px;
  bottom: 18px;
  width: min(420px, calc(100vw - 36px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid rgba(231,253,253,.24);
  background: linear-gradient(180deg, rgba(235,251,251,.94), rgba(218,242,244,.92));
  color: var(--deep);
  box-shadow: 0 30px 90px rgba(1,21,27,.35);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  pointer-events: auto;
  opacity: 0;
  transform: translateX(28px);
  visibility: hidden;
  transition: opacity .28s ease, transform .28s ease, visibility 0s linear .28s;
}
#exhibit-panel.is-open {
  opacity: 1;
  transform: translateX(0);
  visibility: visible;
  transition-delay: 0s;
}
.panel-close {
  position: absolute;
  right: 18px;
  top: 15px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(16,47,57,.15);
  background: rgba(255,255,255,.38);
  color: var(--deep);
  cursor: pointer;
  font-size: 24px;
  line-height: 28px;
}
.panel-header {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 64px;
  padding: 0 64px 0 24px;
  border-bottom: 1px solid rgba(16,47,57,.12);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .15em;
}
#panel-index {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  color: #103b43;
  background: rgba(92,199,206,.28);
}
#panel-category { opacity: .56; }
.panel-content {
  flex: 1;
  overflow: auto;
  padding: 40px 34px 36px;
  scrollbar-width: thin;
  scrollbar-color: rgba(16,47,57,.22) transparent;
}
#panel-eyebrow {
  margin: 0 0 14px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #338890;
}
#panel-title {
  margin: 0;
  max-width: 310px;
  font-family: 'Manrope', sans-serif;
  font-size: clamp(30px, 4vw, 43px);
  line-height: 1.02;
  letter-spacing: -.04em;
  font-weight: 500;
}
#panel-lead {
  margin: 22px 0 25px;
  font-size: 14px;
  line-height: 1.55;
  color: rgba(16,47,57,.72);
}
#panel-body p {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.68;
  color: rgba(16,47,57,.82);
}
.panel-footer {
  min-height: 54px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(16,47,57,.12);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: .14em;
  color: rgba(16,47,57,.5);
}

#mobile-controls {
  display: none;
  position: absolute;
  left: 22px;
  bottom: 22px;
  width: 112px;
  height: 112px;
  pointer-events: auto;
  touch-action: none;
}
#joystick-base {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(231,253,253,.28);
  background: rgba(8,34,42,.33);
  backdrop-filter: blur(8px);
}
#joystick-base::after {
  content: '';
  position: absolute;
  inset: 34%;
  border-radius: 50%;
  border: 1px solid rgba(231,253,253,.18);
}
#joystick-nub {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;
  border-radius: 50%;
  background: rgba(224,252,252,.88);
  box-shadow: 0 6px 18px rgba(3,25,31,.22);
  transform: translate(0,0);
}

#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  justify-items: center;
  background:
    radial-gradient(circle at 50% 38%, rgba(94,195,202,.2), transparent 32%),
    linear-gradient(155deg, #082731 0%, #123d48 52%, #0b2d36 100%);
  color: var(--white);
  transition: opacity .55s ease, visibility 0s linear .55s;
}
#loading-screen::before,
#loading-screen::after {
  content: '';
  position: absolute;
  width: 54vw;
  height: 54vw;
  border: 1px solid rgba(179,238,240,.08);
  border-radius: 42% 58% 61% 39% / 43% 39% 61% 57%;
  animation: drift 13s linear infinite;
}
#loading-screen::after { width: 38vw; height: 38vw; animation-duration: 9s; animation-direction: reverse; }
#loading-screen.is-hidden { opacity: 0; visibility: hidden; }
.loading-kicker {
  margin: 18px 0 8px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .28em;
  opacity: .55;
}
#loading-screen h1 {
  margin: 0;
  font-family: 'Manrope', sans-serif;
  font-size: clamp(36px, 7vw, 74px);
  line-height: 1;
  font-weight: 500;
  letter-spacing: .22em;
  text-indent: .22em;
}
#loading-status {
  margin: 18px 0 14px;
  font-size: 10px;
  letter-spacing: .08em;
  opacity: .62;
}
.loading-track {
  position: relative;
  width: 170px;
  height: 1px;
  overflow: hidden;
  background: rgba(255,255,255,.14);
}
.loading-track i {
  position: absolute;
  width: 42%;
  height: 100%;
  background: var(--sea);
  animation: loadLine 1.35s ease-in-out infinite;
}
.loading-mark { display: flex; gap: 6px; }
.loading-mark span {
  width: 5px;
  height: 5px;
  border: 1px solid rgba(219,250,251,.62);
  border-radius: 50%;
  animation: dot 1.4s ease-in-out infinite;
}
.loading-mark span:nth-child(2) { animation-delay: .15s; }
.loading-mark span:nth-child(3) { animation-delay: .3s; }
@keyframes loadLine { 0% { left:-45%; } 60%,100% { left:105%; } }
@keyframes drift { to { transform: rotate(360deg); } }
@keyframes dot { 0%,100% { background: transparent; } 50% { background: var(--sea); } }

@media (max-width: 720px) {
  .topbar { padding: 16px; min-height: 68px; }
  .brand-name { font-size: 17px; }
  .brand-subtitle { font-size: 8px; }
  .utility-button { padding: 0 10px; }
  #reset-view { display: none; }
  #intro-card { left: 16px; right: 16px; bottom: 146px; width: auto; }
  .desktop-only { display: none; }
  .mobile-only { display: inline; }
  #mobile-controls { display: block; }
  #exhibit-hint { bottom: 36px; left: auto; right: 18px; transform: none; }
  #exhibit-panel { top: 10px; right: 10px; bottom: 10px; width: calc(100vw - 20px); border-radius: 19px; }
  .panel-content { padding: 34px 25px 28px; }
  #panel-title { font-size: 34px; }
}

@media (max-width: 430px) {
  .language-switcher { display: none; }
  .top-actions { gap: 6px; }
  #intro-card p { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
