@font-face {
  font-family: Archivo;
  src: url("./fonts/archivo-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: Archivo;
  src: url("./fonts/archivo-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: Ojuju;
  src: url("./fonts/ojuju-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root { color-scheme: dark; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; width: 100%; height: 100%; }
body { background: #101c2a; color: #f4f1e9; font-family: Archivo, Arial, sans-serif; }
button, a { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.experience {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 420px;
  overflow: hidden;
  background: radial-gradient(circle at 50% 45%, #ddc8bd, #a9939b 80%);
}

.scene, .scene canvas { width: 100%; height: 100%; }
.scene { position: absolute; inset: 0; }
.scene canvas { display: block; touch-action: none; }
.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse, transparent 48%, rgb(64 46 56 / 19%) 100%);
}
.portal-glow {
  position: absolute;
  z-index: 4;
  inset: -20%;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle, rgb(255 247 223 / 91%) 0%, rgb(240 204 173 / 58%) 22%, transparent 70%);
  transition: opacity .38s ease;
}
.portal-glow.active { opacity: 1; }

.topbar {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: max(1rem, env(safe-area-inset-top)) max(1.15rem, env(safe-area-inset-right)) 1rem max(1.15rem, env(safe-area-inset-left));
  background: linear-gradient(rgb(53 43 51 / 42%), transparent);
}
.site-link {
  font-family: Ojuju, Archivo, sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -.03em;
  text-decoration: none;
}
.topbar-right { display: flex; align-items: center; gap: .85rem; }
.section-status { font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; color: #d8e5e8; }
.icon-button {
  width: 2.3rem;
  height: 2.3rem;
  border: 1px solid rgb(255 255 255 / 48%);
  border-radius: 50%;
  background: rgb(7 18 31 / 58%);
  color: #fff;
  font-weight: 700;
}
.icon-button:hover, .icon-button:focus-visible { background: #d9f0f2; color: #0d2332; }

.reticle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  margin: -3.5px;
  border: 1px solid rgb(255 255 255 / 65%);
  border-radius: 50%;
  opacity: .5;
  pointer-events: none;
}
.look-hint {
  position: absolute;
  right: max(1.3rem, env(safe-area-inset-right));
  bottom: max(2.4rem, env(safe-area-inset-bottom));
  padding: .55rem .75rem;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 999px;
  background: rgb(6 16 30 / 45%);
  color: #e8eef2;
  font-size: .73rem;
  pointer-events: none;
}

.joystick {
  position: absolute;
  z-index: 3;
  left: max(1.1rem, env(safe-area-inset-left));
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  display: grid;
  justify-items: center;
  gap: .35rem;
  width: 120px;
  touch-action: none;
  user-select: none;
}
.joystick-ring {
  display: grid;
  place-items: center;
  width: 108px;
  height: 108px;
  border: 1.5px solid rgb(235 246 250 / 62%);
  border-radius: 50%;
  background: rgb(8 24 41 / 44%);
  box-shadow: inset 0 0 22px rgb(255 255 255 / 8%);
}
.joystick-knob {
  width: 43px;
  height: 43px;
  border-radius: 50%;
  border: 1px solid #e3f4f5;
  background: rgb(191 231 236 / 55%);
  box-shadow: 0 0 18px rgb(118 223 228 / 24%);
}
.joystick span { font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; }

.overlay, .fallback {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(1.25rem, env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right)) max(1.25rem, env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left));
  overflow-y: auto;
  background: rgb(4 11 22 / 72%);
  backdrop-filter: blur(14px);
}
.welcome-card, .fallback-card {
  width: min(100%, 580px);
  padding: clamp(1.5rem, 5vw, 3.2rem);
  border: 1px solid rgb(185 218 226 / 28%);
  border-radius: 1.4rem;
  background: linear-gradient(145deg, rgb(34 55 75 / 97%), rgb(13 26 44 / 97%));
  box-shadow: 0 24px 80px rgb(0 0 0 / 30%);
}
.eyebrow { margin: 0 0 1.1rem; color: #b8dfe2; font-size: .76rem; font-weight: 700; letter-spacing: .17em; text-transform: uppercase; }
h1 { margin: 0 0 1.2rem; font-family: Ojuju, Archivo, sans-serif; font-size: clamp(2.45rem, 7vw, 4.4rem); font-weight: 600; line-height: 1.03; letter-spacing: -.06em; }
.welcome-card p:not(.eyebrow), .fallback-card p:not(.eyebrow) { max-width: 48ch; line-height: 1.55; color: #d7e3e8; }
.control-note { padding-top: .5rem; font-size: .9rem; }
.control-note strong { color: #fff; }
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .8rem;
  min-height: 3.1rem;
  margin-top: 1rem;
  padding: .85rem 1.3rem;
  border: 0;
  border-radius: 999px;
  background: #e2f2ef;
  color: #142739;
  font-weight: 700;
  text-decoration: none;
}
.primary-button:hover, .primary-button:focus-visible { background: #fff; }
.back-link { display: inline-block; margin: 1rem 0 0 1.2rem; font-size: .87rem; text-underline-offset: 3px; }
.retry-button { display: inline-block; margin: 1rem 1rem 0 0; padding: .7rem 0; border: 0; background: none; color: #e2f2ef; text-decoration: underline; }
.frame-list { display: grid; grid-template-columns: repeat(7, 1fr); gap: .4rem; max-height: 9rem; overflow: auto; padding: 0; list-style: none; }
.frame-list li { padding: .35rem; border: 1px solid rgb(255 255 255 / 23%); border-radius: .3rem; text-align: center; font-size: .77rem; }
.fallback-preview { display: block; width: min(100%, 10rem); max-height: 13rem; object-fit: contain; margin: .7rem auto; border: 3px solid #d9ac6c; }
.room-title { position: absolute; z-index: 5; top: calc(4.4rem + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(28rem, 72vw); padding: .5rem .8rem; border: 1px solid rgb(236 196 128 / 55%); border-radius: .5rem; background: rgb(27 23 40 / 74%); color: #f9e9cd; text-align: center; font-size: clamp(.68rem, 1.8vw, .88rem); line-height: 1.25; pointer-events: none; }
.room-title[hidden] { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (pointer: fine) { .joystick { display: none; } }
@media (max-width: 600px) {
  .experience { min-height: 0; }
  .welcome-card, .fallback-card { border-radius: 1rem; }
  .welcome-card p:not(.eyebrow) { font-size: .93rem; }
  .section-status { font-size: .68rem; }
  .look-hint { bottom: max(2rem, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { .portal-glow { transition: none; } }
