:root {
  color-scheme: light;
  --paper: #F7F5F0;
  --ink: #1A1A1F;
  --muted: #737378;
  --orange: #C75C1F;
  --tile: #FBFBFC;
  --line: #D9D9DE;
  --panel: rgba(247, 245, 240, .93);
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
body { background: var(--paper); }
button, a { -webkit-tap-highlight-color: transparent; }
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--tile);
  border-radius: 8px;
  min-height: 36px;
  padding: 8px 12px;
  transition: background-color .15s, border-color .15s;
}
button:hover { border-color: var(--orange); }
button:disabled { cursor: wait; opacity: .55; }
button:focus-visible, a:focus-visible, canvas:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
}
button[aria-pressed="true"] {
  color: var(--orange);
  border-color: var(--orange);
  background: #fff4eb;
}
a { color: var(--orange); }
[hidden] { display: none !important; }
#viewport { position: fixed; inset: 0; isolation: isolate; }
#sceneCanvas { display: block; width: 100%; height: 100%; touch-action: none; }
#sceneCanvas:focus { outline-offset: -4px; }
body.playing #sceneCanvas { cursor: grab; }
body.pointer-locked #sceneCanvas { cursor: none; }
.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 42%, rgba(20, 19, 18, .16));
}
.panel {
  background: var(--panel);
  border: 1px solid rgba(217, 217, 222, .85);
  border-radius: 10px;
}
.topbar {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
  right: max(16px, env(safe-area-inset-right));
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand-panel { padding: 16px; min-width: 192px; }
.brand {
  color: var(--orange);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: .4px;
  text-decoration: none;
}
.brand-caption { display: block; margin-top: 6px; font-size: 11px; color: var(--muted); }
.location-panel {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  min-width: 192px;
  max-width: 32%;
  text-align: center;
  pointer-events: none;
}
.location-panel strong {
  display: block;
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.location-panel > span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.actions-panel { padding: 8px; margin-left: auto; }
.languages { display: flex; align-items: center; gap: 4px; }
.languages button { font-size: 11px; font-weight: bold; min-width: 36px; padding: 6px 8px; }
.actions-panel .languages { justify-content: flex-end; margin-bottom: 8px; }
.action-row { display: flex; gap: 8px; }
.action-row button { font-size: 11px; }
#dayIcon { display: inline-block; margin-right: 4px; }
.rooms-panel {
  position: absolute;
  top: 144px;
  left: max(16px, env(safe-area-inset-left));
  width: 232px;
  overflow: hidden;
}
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-weight: bold;
  padding: 16px;
}
#roomsChevron { color: var(--orange); font-size: 18px; }
#roomList {
  display: grid;
  gap: 6px;
  padding: 0 8px 8px;
  max-height: calc(100dvh - 272px);
  overflow-y: auto;
  scrollbar-width: thin;
}
.room-chip {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 0 8px;
  text-align: left;
  padding: 10px 8px;
}
.room-number { grid-row: span 2; color: var(--muted); font-size: 11px; padding-top: 2px; }
.room-label { font-size: 12px; line-height: 1.35; }
.room-meta { color: var(--muted); font-size: 10px; margin-top: 3px; }
.room-chip.active { border-color: var(--orange); background: #fff4eb; }
.room-chip.active .room-number { color: var(--orange); }
.resume-button {
  position: absolute;
  left: 50%;
  top: 112px;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--orange);
}
.status {
  position: absolute;
  left: 50%;
  top: 168px;
  transform: translateX(-50%);
  max-width: min(440px, 80vw);
  padding: 12px 16px;
  font-size: 12px;
  text-align: center;
  pointer-events: none;
}
.minimap-panel {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: 256px;
  overflow: hidden;
}
.map-heading { display: flex; align-items: center; justify-content: space-between; padding: 8px; gap: 8px; }
#mapToggle { border: 0; background: transparent; padding: 4px 8px; font-size: 12px; font-weight: bold; }
.floor-buttons { display: flex; gap: 4px; }
.floor-buttons button { font-size: 10px; min-height: 32px; padding: 6px 8px; }
#minimap { display: block; width: 100%; height: 176px; cursor: crosshair; touch-action: manipulation; }
.map-caption {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px 12px;
  font-size: 10px;
  color: var(--muted);
}
.desktop-hint {
  position: absolute;
  bottom: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  font-size: 10px;
  color: var(--muted);
}
.hand-tools {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.round-button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  min-height: 48px;
  padding: 0;
  border-radius: 50%;
  background: var(--panel);
  color: var(--ink);
}
.round-button svg { display: block; width: 22px; height: 22px; }
.crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid rgba(247, 245, 240, .95);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(26, 26, 31, .45);
  pointer-events: none;
}
.crosshair.target { border-color: var(--orange); }
.crosshair.holding { border-color: var(--orange); background: var(--orange); }
.hand-hint {
  position: absolute;
  left: 50%;
  bottom: 76px;
  transform: translateX(-50%);
  max-width: min(520px, 80vw);
  padding: 10px 16px;
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
  pointer-events: none;
}
body.touch-mode .hand-hint { bottom: 168px; }
kbd { font: inherit; font-weight: bold; color: var(--ink); }
.start-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: auto;
  background: rgba(26, 26, 31, .25);
  backdrop-filter: blur(3px);
}
.start-card {
  width: min(100%, 552px);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: 0 16px 64px rgba(26, 26, 31, .12);
}
.start-card-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.eyebrow { margin: 32px 0 8px; color: var(--muted); font-size: 12px; }
h1 { margin: 0; font-size: clamp(28px, 4vw, 36px); line-height: 1.12; letter-spacing: -.7px; }
.title-underline { height: 4px; width: 140px; margin-top: 16px; background: var(--orange); }
.intro { font-size: 14px; line-height: 1.6; margin: 24px 0 16px; }
.controls-list { padding-left: 20px; margin: 16px 0; font-size: 12px; line-height: 1.65; }
.controls-list li { padding-left: 4px; margin-bottom: 8px; }
.loading { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 11px; margin: 24px 0 12px; }
.loading-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange);
  animation: pulse 1.1s ease-in-out infinite alternate;
}
.loading.ready .loading-dot { animation: none; background: #647857; }
.loading.error .loading-dot { animation: none; background: var(--orange); }
.primary-button { width: 100%; padding: 16px 24px; background: var(--orange); color: white; border-color: var(--orange); font-weight: bold; }
.primary-button:hover { background: #ad4d18; }
.source-note { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 16px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.source-note strong { color: var(--ink); font-weight: bold; }
.source-note p { margin: 6px 0 16px; }
.back-link { display: inline-block; font-size: 12px; line-height: 1.5; text-underline-offset: 3px; }
.help-dialog {
  max-width: min(480px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
}
.help-dialog::backdrop { background: rgba(26, 26, 31, .35); }
.help-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.help-heading h2 { margin: 0; font-size: 24px; }
.close-button { font-size: 24px; padding: 0 8px; line-height: 1; }
.help-dialog p { font-size: 12px; line-height: 1.65; }
.muted { color: var(--muted); }
.touch-copy { display: none; }
#touchControls { position: absolute; inset: 0; pointer-events: none; }
.joystick {
  position: absolute;
  left: max(24px, env(safe-area-inset-left));
  bottom: max(32px, env(safe-area-inset-bottom));
  width: 112px;
  height: 112px;
  border-radius: 50%;
  border: 1px solid rgba(217, 217, 222, .9);
  background: rgba(247, 245, 240, .7);
  touch-action: none;
  pointer-events: auto;
}
.joystick-cross { position: absolute; inset: 16px; border-radius: 50%; border: 1px solid rgba(115, 115, 120, .18); }
.joystick-handle {
  position: absolute;
  top: 35px;
  left: 35px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(199, 92, 31, .86);
  border: 1px solid rgba(247, 245, 240, .9);
}
.touch-look-hint {
  position: absolute;
  bottom: 24px;
  left: 156px;
  right: 272px;
  color: white;
  font-size: 10px;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .5);
}
body.touch-mode .desktop-copy, body.touch-mode .desktop-hint { display: none; }
body.touch-mode .touch-copy { display: block; }
@keyframes pulse { from { opacity: .35; } to { opacity: 1; } }
@media (max-width: 900px) {
  .location-panel { top: 88px; max-width: 48%; padding: 8px 16px; }
  .rooms-panel { top: 152px; width: 208px; }
  .resume-button { top: 152px; max-width: 42%; }
  .status { top: 208px; }
  .desktop-hint { max-width: calc(100vw - 304px); flex-wrap: wrap; }
}
@media (max-width: 600px) {
  .topbar { top: 8px; left: 8px; right: 8px; gap: 8px; }
  .brand-panel { min-width: 0; padding: 12px; }
  .brand-panel .brand { font-size: 14px; }
  .brand-caption { max-width: 128px; font-size: 9px; }
  .actions-panel { padding: 4px; }
  .action-row { gap: 4px; }
  .action-row button { padding: 6px 8px; font-size: 10px; min-height: 32px; }
  .actions-panel .languages { margin-bottom: 4px; }
  .languages button { min-height: 32px; min-width: 32px; padding: 6px; }
  .location-panel { top: 96px; max-width: 66%; min-width: 152px; }
  .location-panel strong { font-size: 12px; }
  .rooms-panel { top: 152px; left: 8px; width: 176px; }
  .panel-heading { padding: 12px; font-size: 12px; }
  #roomList { max-height: min(40dvh, 280px); }
  .room-chip { padding: 8px 6px; grid-template-columns: 20px minmax(0, 1fr); gap: 0 4px; }
  .room-label { font-size: 11px; }
  .resume-button { top: 208px; left: auto; right: 8px; transform: none; font-size: 10px; max-width: 42%; }
  .status { top: 264px; }
  .minimap-panel { right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); width: 176px; }
  #minimap { height: 128px; }
  .map-heading { gap: 2px; padding: 4px; }
  #mapToggle { font-size: 10px; padding: 4px; }
  .floor-buttons button { padding: 4px 6px; min-height: 28px; }
  .map-caption { flex-direction: column; gap: 3px; padding: 6px 8px 8px; font-size: 9px; }
  .desktop-hint { display: none; }
  .hand-tools { right: 8px; gap: 6px; }
  .round-button { width: 44px; height: 44px; min-height: 44px; }
  .hand-hint { font-size: 11px; max-width: 70vw; }
  .start-overlay { padding: 16px; }
  .start-card { padding: 24px; margin: auto; }
  .start-card-top { gap: 8px; }
  .start-card-top .brand { font-size: 15px; }
  .eyebrow { margin-top: 24px; }
  .touch-look-hint { left: 144px; right: 192px; bottom: 24px; font-size: 9px; }
  .joystick { left: 16px; bottom: max(24px, env(safe-area-inset-bottom)); }
}
@media (max-height: 540px) and (orientation: landscape) {
  .start-overlay { padding: 16px; display: block; }
  .start-card { margin: 0 auto; padding: 24px; }
  .rooms-panel { top: 104px; }
  #roomList { max-height: calc(100dvh - 172px); }
  .location-panel { top: 0; max-width: 28%; }
  .minimap-panel { width: 200px; }
  #minimap { height: 112px; }
  .resume-button { top: 104px; }
  .touch-look-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
