:root {
  color-scheme: dark;
  --green: #141c17;
  --gold: #c8a96a;
  --cream: #f4efe6;
  --edge: clamp(14px, 2.2vw, 36px);
  --top: max(var(--edge), env(safe-area-inset-top));
  --bottom: max(var(--edge), env(safe-area-inset-bottom));
  --left: max(var(--edge), env(safe-area-inset-left));
  --right: max(var(--edge), env(safe-area-inset-right));
  --serif: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--cream);
  background: var(--green);
}
* { box-sizing: border-box; }
html, body, #tour { width: 100%; height: 100%; margin: 0; overflow: hidden; }
#tour { position: fixed; inset: 0; isolation: isolate; }
button { color: inherit; font: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .48; cursor: wait; }
button:focus-visible, canvas:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
button, #joystick, .hud { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
#scene { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#scene:active { cursor: grabbing; }
body.walk #scene { cursor: crosshair; }
#interface { pointer-events: none; position: absolute; inset: 0; }
#interface::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(0deg, rgb(12 20 15 / .48), transparent min(23%, 160px));
}
.panel { background: var(--green); border: 1px solid rgb(200 169 106 / .33); box-shadow: 0 6px 22px #131a1326; }
.hud {
  position: absolute; top: var(--top); left: var(--left); right: var(--right);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 12px;
}
.hud > *, .view-panel { pointer-events: auto; }
.brand {
  display: flex; align-items: center; gap: 12px; justify-self: start;
  border-radius: 4px; padding: 11px 18px 11px 13px;
}
.mark {
  width: 38px; height: 38px; display: inline-block; position: relative; color: var(--gold);
  border: 1px solid currentColor;
}
.mark::before, .mark::after, .mark i { content: ""; position: absolute; display: block; }
.mark::before { left: 19%; top: 29%; width: 58%; height: 46%; border: 1px solid currentColor; border-top: 0; }
.mark::after { left: 15%; top: 32%; width: 69%; height: 1px; background: currentColor; transform: rotate(-16deg); }
.mark i { left: 48%; top: 35%; width: 1px; height: 41%; background: currentColor; }
.eyebrow { margin: 0; font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .15em; color: var(--gold); }
h1, h2, .caption p, .loader-title { font-family: var(--serif); font-weight: 500; margin: 0; }
h1 { font-size: 1.45rem; line-height: 1.1; margin-top: 2px; }
.modes { display: flex; padding: 4px; border-radius: 100px; gap: 2px; }
.modes button, .views-toggle {
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  gap: 9px; font-size: .875rem; font-weight: 550; border-radius: 100px;
}
.modes button { padding: 0 17px; color: #dddcd3; }
.modes button[aria-pressed=true] { background: var(--gold); color: var(--green); }
.modes button[aria-pressed=false]:hover, .views-toggle:hover, .close:hover { background: #29342c; }
.views-toggle { justify-self: end; padding: 0 17px; min-height: 50px; }
.views-toggle[aria-expanded=true] { color: var(--gold); border-color: var(--gold); }
.icon { position: relative; width: 17px; height: 17px; display: inline-block; flex: none; }
.orbit-icon::before { content: ""; position: absolute; left: 0; top: 4px; height: 8px; width: 15px; border: 1.5px solid currentColor; border-radius: 100%; transform: rotate(-28deg); }
.orbit-icon::after { content: ""; position: absolute; left: 7px; top: 7px; width: 3px; height: 3px; background: currentColor; border-radius: 50%; }
.walk-icon::before, .walk-icon::after { content: ""; position: absolute; width: 5px; height: 8px; border: 1.3px solid currentColor; border-radius: 60% 55% 35% 40%; transform: rotate(-13deg); }
.walk-icon::before { top: 1px; left: 8px; }
.walk-icon::after { top: 6px; left: 1px; transform: rotate(9deg); }
.views-icon { width: 15px; height: 15px; border: 1.4px solid currentColor; background: linear-gradient(currentColor,currentColor) center/1px 100% no-repeat,linear-gradient(currentColor,currentColor) center/100% 1px no-repeat; border-radius: 2px; }
.view-panel {
  position: absolute; top: calc(var(--top) + 62px); right: var(--right); z-index: 2;
  width: min(330px, calc(100% - var(--right) - var(--left))); max-height: calc(100% - var(--top) - var(--bottom) - 72px);
  display: flex; flex-direction: column; padding: 14px; border-radius: 6px; 
}
.panel-title, .groups { display: flex; align-items: center; }
.panel-title { justify-content: space-between; padding-left: 5px; }
h2 { font-size: 1.8rem; }
.close { width: 44px; height: 44px; border-radius: 50%; }
.close i { display: block; width: 16px; height: 16px; position: relative; margin: auto; }
.close i::before, .close i::after { content: ""; position: absolute; top: 7px; left: 0; width: 16px; height: 1.5px; background: currentColor; transform: rotate(45deg); }
.close i::after { transform: rotate(-45deg); }
.groups { gap: 3px; border-bottom: 1px solid #536054; margin: 5px 0 3px; }
.groups button { padding: 9px 11px; min-height: 44px; color: #c8cfc1; border-bottom: 2px solid transparent; }
.groups button[aria-pressed=true] { color: var(--gold); border-color: var(--gold); }
.view-list { overflow-y: auto; overscroll-behavior: contain; scrollbar-color: #5c6557 transparent; }
.view-list button {
  width: 100%; text-align: left; padding: 11px 10px; min-height: 44px;
  display: flex; align-items: center; gap: 13px; font-size: .91rem; border-bottom: 1px solid #ffffff12;
}
.view-list button .view-id { color: #c3ab7c; font-size: .75rem; font-variant-numeric: tabular-nums; }
.view-list button:hover, .view-list button[aria-current=true] { color: var(--gold); background: #ffffff0a; }
.caption { position: absolute; bottom: var(--bottom); left: var(--left); max-width: 46%; text-shadow: 0 1px 6px #122016bb; }
.caption .eyebrow { color: #f2d79e; }
.caption p { line-height: 1.05; margin-top: 4px; font-size: clamp(1.65rem,3vw,2.8rem); text-wrap: balance; }
.hint { position: absolute; right: var(--right); bottom: var(--bottom); padding: 10px 15px; border-radius: 4px; font-size: .83rem; line-height: 1.4; color: #e1e3d9; }
#joystick { position: absolute; bottom: var(--bottom); left: var(--left); width: 102px; height: 102px; border: 1px solid #f3ebd69e; border-radius: 50%; background: #141c178c; pointer-events: auto; touch-action: none; }
#joystick i { position: absolute; inset: 30px; border: 1px solid var(--gold); border-radius: 50%; background: #c8a96acc; pointer-events: none; }
#reticle { position: absolute; top: 50%; left: 50%; width: 5px; height: 5px; margin: -2.5px; border-radius: 50%; background: #f4efe6c0; box-shadow: 0 0 2px #141c17; }
#debug { position: absolute; top: calc(var(--top) + 75px); left: var(--left); white-space: pre; padding: 8px; background: #141c17e6; font: .76rem/1.5 ui-monospace, monospace; color: #f4efe6; }
#loading { position: absolute; inset: 0; display: grid; place-items: center; background: var(--green); z-index: 4; }
.loader-content { width: min(290px, 74vw); text-align: center; }
.mark.large { width: 58px; height: 58px; margin-bottom: 24px; }
.loader-title { font-size: clamp(2.8rem, 6vw, 4rem); margin: 4px 0 34px; }
.loading-details { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: .85rem; text-align: left; color: #dee1d5; }
#progress-value { color: var(--gold); font-variant-numeric: tabular-nums; white-space: nowrap; }
progress { width: 100%; height: 3px; margin-top: 10px; appearance: none; border: 0; background: #374036; vertical-align: top; color: var(--gold); }
progress::-webkit-progress-bar { background: #374036; }
progress::-webkit-progress-value { background: var(--gold); }
progress::-moz-progress-bar { background: var(--gold); }
#retry { min-height: 44px; background: var(--cream); color: var(--green); border-radius: 100px; margin-top: 18px; padding: 0 20px; }
noscript { position: absolute; z-index: 6; bottom: 12%; text-align: center; width: 100%; }
@media (max-width: 670px) {
  .hud { grid-template-columns: 1fr auto; align-items: center; }
  .brand { padding: 8px 12px 8px 9px; gap: 9px; }
  h1 { font-size: 1.27rem; }
  .brand .eyebrow { font-size: .625rem; }
  .mark { height: 32px; width: 32px; }
  .modes { position: fixed; left: 50%; transform: translateX(-50%); bottom: var(--bottom); }
  .views-toggle { grid-column: 2; min-height: 46px; padding: 0 13px; }
  .hint { left: var(--left); right: auto; bottom: calc(var(--bottom) + 67px); padding: 0; background: transparent; box-shadow: none; border: 0; text-shadow: 0 1px 5px #08110b; font-size: .78rem; }
  .caption { bottom: calc(var(--bottom) + 96px); max-width: calc(100% - 2 * var(--edge)); }
  body.touch-walk .caption, body.touch-walk .hint { left: calc(var(--left) + 116px); }
  #joystick { bottom: calc(var(--bottom) + 62px); }
  #debug { top: calc(var(--top) + 58px); }
  .view-panel { top: calc(var(--top) + 61px); max-height: calc(100% - var(--top) - var(--bottom) - 130px); }
}
@media (pointer: coarse) and (min-width: 671px) {
  body.touch-walk .caption { left: calc(var(--left) + 120px); }
}
@media (max-height: 480px) {
  .caption p { font-size: 1.55rem; }
  #joystick { width: 84px; height: 84px; }
  #joystick i { inset: 24px; }
}

.location-hud {
  position: absolute; bottom: var(--bottom); left: var(--left);
  display: grid; justify-items: start; gap: 12px; max-width: 48%;
}
.location-hud .caption { position: static; max-width: 100%; }
.tour-line, .tour-controls { display: flex; align-items: center; gap: 9px; }
#tour-count { font-size: .74rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tour-controls { gap: 0; pointer-events: auto; background: #141c17df; border: 1px solid #c8a96a66; border-radius: 20px; }
.tour-controls button { width: 36px; height: 32px; font-size: 24px; line-height: 1; border-radius: inherit; color: var(--cream); }
.tour-controls button:hover, #plan-toggle:hover { color: var(--gold); }
.mini-map { pointer-events: auto; width: clamp(165px, 13vw, 218px); border-radius: 6px; background: #141c17e8; overflow: hidden; }
#plan-toggle { width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; text-align: left; }
#plan-toggle .eyebrow { display: block; font-size: .58rem; }
#plan-room { display: block; font: 500 1.1rem/1.05 var(--serif); margin-top: 2px; }
.plan-chevron { width: 7px; height: 7px; border: solid var(--gold); border-width: 0 1px 1px 0; transform: rotate(225deg); }
.collapsed .plan-chevron { transform: rotate(45deg); }
.plan-body { position: relative; padding: 0 9px 8px; }
.collapsed .plan-body { display: none; }
.plan-north { position: absolute; right: 9px; top: -4px; color: var(--gold); font-size: .56rem; pointer-events: none; }
#plan-map { display: block; width: 100%; height: clamp(120px, 18vh, 185px); touch-action: manipulation; }
body.walk #plan-map { cursor: crosshair; }
.plan-zone { fill: #394239; }
.plan-zone:nth-of-type(even) { fill: #404b40; }
.plan-zone.outdoor { fill: #28352d; }
#plan-map .plan-zone.active { fill: #796c4d; }
.plan-wall { stroke: var(--cream); stroke-linecap: square; }
.plan-cone { fill: #dfbd7a; fill-opacity: .58; }
.plan-dot { fill: #e8c88c; stroke: #191f18; stroke-width: .15; }
#door-action { position: absolute; left: 50%; top: calc(50% + 20px); transform: translateX(-50%); padding: 9px 13px; border-radius: 22px; color: var(--cream); background: #141c17eb; font-size: .81rem; pointer-events: auto; }
body.touch-walk #door-action { left: auto; top: auto; right: var(--right); bottom: calc(var(--bottom) + clamp(138px, 22vh, 210px)); transform: none; min-height: 46px; border-color: var(--gold); }
body.touch-walk .tour-controls, body.touch-walk #tour-count { display: none; }
.hint { max-width: 46%; }
@media (max-width: 670px), (pointer: coarse) {
  .mini-map { width: 152px; }
  .mini-map .plan-body svg { height: min(135px, 24vh); }
  .tour-controls button { width: 44px; height: 44px; }
}
@media (max-width: 670px) {
  .location-hud { bottom: calc(var(--bottom) + 94px); max-width: calc(100% - var(--left) - var(--right)); }
  .mini-map { position: fixed; top: calc(var(--top) + 62px); left: var(--left); }
  body.touch-walk .location-hud { left: calc(var(--left) + 111px); max-width: calc(100% - var(--left) - var(--right) - 111px); }
  body.touch-walk .hint { right: var(--right); bottom: calc(var(--bottom) + 48px); }
  .hint { max-width: calc(100% - var(--left) - var(--right)); }
  .caption p { font-size: clamp(1.45rem, 6vw, 2rem); }
}
@media (pointer: coarse) and (min-width: 671px) {
  body.touch-walk .location-hud { left: calc(var(--left) + 116px); }
}
@media (max-height: 480px) {
  .location-hud { gap: 3px; }
  .mini-map .plan-body svg { height: 80px; }
}
