:root {
  color-scheme: dark;
  --navy: #062c3a;
  --navy-2: #0a4b5e;
  --paper: #f6f2e7;
  --ink: #17343d;
  --muted: #61777d;
  --sea: #167b8b;
  --sea-dark: #0a596b;
  --sand: #d59135;
  --sand-dark: #9b5c13;
  --line: rgba(23,52,61,0.15);
  --header-height: 74px;
  --panel-width: 390px;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: #061d26; }
button { font: inherit; -webkit-tap-highlight-color: transparent; }

.model-shell {
  display: grid;
  grid-template-columns: var(--panel-width) minmax(0,1fr);
  grid-template-rows: var(--header-height) minmax(0,1fr);
  width: 100%;
  height: 100dvh;
  background: #061d26;
}

.model-header {
  z-index: 40;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 9px 18px;
  color: white;
  background: radial-gradient(circle at 24% -120%, rgba(123,216,219,.35), transparent 37%), linear-gradient(112deg,#062c3a,#0a4b5e 66%,#083947);
  border-bottom: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 8px 28px rgba(0,0,0,.22);
}

.header-button,
.model-icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  color: white;
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.19);
  border-radius: 12px;
  cursor: pointer;
}

.header-button:hover, .header-button:focus-visible,
.model-icon-button:hover, .model-icon-button:focus-visible { background: rgba(255,255,255,.17); border-color: rgba(255,255,255,.4); }
.header-button svg, .model-icon-button svg, .tour-link svg, .download-link svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.model-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: white;
  text-decoration: none;
}

.model-brand img { flex: 0 0 auto; filter: drop-shadow(0 5px 12px rgba(0,0,0,.22)); }
.model-brand img.site-logo { object-fit: cover; background: #f5f0e7; border: 2px solid rgba(255,255,255,.74); border-radius: 7px; }
.model-brand > span { display: grid; min-width: 0; line-height: 1.15; }
.model-brand small { margin-bottom: 3px; color: #a7eaeb; font-size: .66rem; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.model-brand strong { overflow: hidden; font-size: clamp(1rem,2vw,1.2rem); text-overflow: ellipsis; white-space: nowrap; }

.model-header-actions { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.model-header .access-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 38px;
  padding: 7px 11px;
  color: white;
  font: inherit;
  font-size: .74rem;
  font-weight: 760;
  background: rgba(213,145,53,.16);
  border: 1px solid rgba(245,204,133,.38);
  border-radius: 11px;
  cursor: pointer;
}
.model-header .access-button:hover, .model-header .access-button:focus-visible { background: rgba(213,145,53,.27); outline: 3px solid rgba(255,255,255,.14); }
.model-header .access-button.is-unlocked { background: rgba(64,174,132,.18); border-color: rgba(146,235,198,.42); }
.tour-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 12px;
  color: white;
  font-size: .8rem;
  font-weight: 720;
  text-decoration: none;
  background: rgba(213,145,53,.16);
  border: 1px solid rgba(245,204,133,.35);
  border-radius: 11px;
}
.tour-link:hover, .tour-link:focus-visible { background: rgba(213,145,53,.27); }

.model-panel {
  z-index: 30;
  grid-column: 1;
  grid-row: 2;
  min-height: 0;
  padding: 25px 22px 26px;
  overflow: auto;
  color: var(--ink);
  background: radial-gradient(circle at 112% 0%,rgba(123,216,219,.18),transparent 31%), var(--paper);
  border-right: 1px solid rgba(255,255,255,.24);
  box-shadow: 13px 0 38px rgba(0,0,0,.16);
  transition: transform 220ms cubic-bezier(.2,.8,.2,1), opacity 180ms ease;
}

.eyebrow,
.model-eyebrow { margin: 0 0 6px; color: var(--sea); font-size: .66rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.model-intro h1 { margin: 0 0 8px; font-size: 1.48rem; line-height: 1.15; letter-spacing: -.025em; }
.model-intro > p:last-child { margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.48; }

.source-card {
  display: grid;
  gap: 5px;
  margin: 18px 0;
  padding: 14px 15px;
  color: #4f6469;
  font-size: .73rem;
  line-height: 1.4;
  background: #eceee5;
  border-left: 4px solid var(--sand);
  border-radius: 0 11px 11px 0;
}
.source-card > span { color: var(--sand-dark); font-size: .62rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.source-card strong { color: var(--ink); font-size: .77rem; }
.source-card small { color: #738388; }

.evidence-note {
  display: grid;
  gap: 5px;
  margin: 18px 0;
  padding: 14px 15px;
  color: #4f6469;
  font-size: .74rem;
  line-height: 1.4;
  background: #eceee5;
  border-left: 4px solid var(--sand);
  border-radius: 0 11px 11px 0;
}
.evidence-note strong { color: var(--ink); font-size: .8rem; }
.evidence-note small { color: #738388; }

.control-section { padding: 17px 0; border-top: 1px solid var(--line); }
.control-section h2 { margin: 0 0 10px; font-size: .83rem; letter-spacing: .01em; }

.view-buttons { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; margin-bottom: 15px; }
.view-button {
  min-height: 38px;
  padding: 7px;
  color: #597078;
  font-size: .72rem;
  font-weight: 750;
  background: rgba(255,255,255,.55);
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
}
.view-button:hover, .view-button:focus-visible { background: white; border-color: rgba(22,123,139,.38); outline: none; }
.view-button.is-active { color: white; background: linear-gradient(115deg,var(--sea-dark),var(--sea)); border-color: transparent; }

.range-label { display: flex; justify-content: space-between; gap: 12px; color: #526a71; font-size: .74rem; }
.range-label output { color: var(--sea-dark); font-weight: 800; }
#layer-gap { width: 100%; margin: 10px 0 0; accent-color: var(--sea); }

.toggle-row { display: flex; align-items: center; gap: 9px; min-height: 34px; color: #526a71; font-size: .76rem; cursor: pointer; }
.toggle-row input { width: 17px; height: 17px; margin: 0; accent-color: var(--sea); }
.toggle-row > span { display: inline-flex; align-items: center; gap: 8px; }
.floor-swatch { width: 13px; height: 13px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(23,52,61,.16); }
.floor-swatch.og { background: #c8893d; }
.floor-swatch.eg { background: #2e8994; }
.floor-swatch.ug { background: #687b83; }
.floor-swatch.dg { background: #8a6958; }
.gap-toggle { color: #8d204f; font-weight: 760; }
.gap-toggle input { accent-color: #c52a69; }

.point-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.point-heading span { color: var(--muted); font-size: .62rem; }
.point-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.point-floor-heading { grid-column: 1 / -1; margin: 6px 0 0; color: var(--sea-dark); font-size: .64rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.point-button {
  display: grid;
  grid-template-columns: 25px minmax(0,1fr);
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 7px;
  color: var(--ink);
  text-align: left;
  background: rgba(255,255,255,.55);
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
}
.point-button:hover, .point-button:focus-visible { background: white; border-color: rgba(22,123,139,.38); outline: none; }
.point-button.is-active { color: white; background: linear-gradient(115deg,var(--sea-dark),var(--sea)); border-color: transparent; }
.point-button > span { display: grid; place-items: center; width: 25px; height: 25px; color: var(--sea-dark); font-size: .65rem; font-weight: 850; background: rgba(22,123,139,.1); border-radius: 8px; }
.point-button.is-active > span { color: white; background: rgba(255,255,255,.16); }
.point-button.is-private { color: #704719; background: rgba(213,145,53,.09); border-style: dashed; }
.point-button strong { overflow: hidden; font-size: .68rem; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }

.selected-point {
  display: grid;
  gap: 4px;
  padding: 14px;
  color: white;
  background: linear-gradient(125deg,#083f50,#0b6473);
  border-radius: 12px;
  box-shadow: 0 9px 22px rgba(10,89,107,.2);
}
.selected-point span { color: #b9e9e8; font-size: .64rem; }
.selected-point strong { font-size: .9rem; }
.selected-point a { color: white; font-size: .7rem; font-weight: 750; }

.download-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  margin-top: 12px;
  color: var(--sea-dark);
  font-size: .72rem;
  font-weight: 760;
  text-decoration: none;
  background: rgba(255,255,255,.55);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.download-link:hover, .download-link:focus-visible { background: white; border-color: rgba(22,123,139,.38); }

.model-stage { position: relative; z-index: 1; grid-column: 2; grid-row: 2; min-width: 0; min-height: 0; overflow: hidden; background: radial-gradient(circle at 50% 24%,#155464 0,#0a3543 38%,#061d26 78%); }
.model-canvas { position: absolute; inset: 0; }
.model-canvas canvas { display: block; width: 100%; height: 100%; }
.label-layer { position: absolute; inset: 0; pointer-events: none; }

.camera-label {
  display: grid;
  place-items: center;
  min-width: 29px;
  height: 29px;
  padding: 0 7px;
  color: white;
  font-size: .68rem;
  font-weight: 850;
  background: var(--sea-dark);
  border: 2px solid white;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0,0,0,.38);
  pointer-events: auto;
  cursor: pointer;
  transform: translate(-50%,-50%);
}
.camera-label[hidden] { display: none; }
.camera-label.is-likely { background: var(--sand-dark); border-style: dashed; }
.camera-label.is-private { color: #fff4d7; background: #704719; border-color: #ffd89d; border-style: dashed; }
.camera-label.is-active { background: #b64e2e; box-shadow: 0 0 0 7px rgba(182,78,46,.22),0 4px 14px rgba(0,0,0,.38); }
.camera-label:focus-visible { outline: 3px solid #fff; }

.floor-label {
  padding: 7px 10px;
  color: white;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .03em;
  background: rgba(4,29,38,.82);
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 8px;
  box-shadow: 0 5px 16px rgba(0,0,0,.3);
  transform: translate(-50%,-50%);
}

.gap-label {
  padding: 6px 9px;
  color: white;
  font-size: .64rem;
  font-weight: 850;
  letter-spacing: .03em;
  background: #b51f5c;
  border: 2px dashed #ffd0e2;
  border-radius: 7px;
  box-shadow: 0 5px 16px rgba(52,0,21,.46);
  transform: translate(-50%,-50%);
}

.model-legend {
  position: absolute;
  z-index: 4;
  top: 17px;
  right: 17px;
  display: flex;
  gap: 12px;
  padding: 8px 11px;
  color: rgba(255,255,255,.76);
  font-size: .65rem;
  background: rgba(4,29,38,.72);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  backdrop-filter: blur(8px);
}
.model-legend span { display: inline-flex; align-items: center; gap: 6px; }
.model-legend i { width: 10px; height: 10px; border-radius: 2px; }
.model-legend i.plan-wall { background: #f5efe2; border: 1px solid rgba(255,255,255,.55); }
.model-legend i.camera-point { background: var(--sea-light); border-radius: 50%; }
.model-legend i.missing-area { background: #d22f72; border: 1px dashed #ffd0e2; }

.model-hint {
  position: absolute;
  z-index: 4;
  bottom: 22px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 15px;
  color: white;
  font-size: .72rem;
  font-weight: 720;
  background: rgba(4,29,38,.75);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  box-shadow: 0 8px 26px rgba(0,0,0,.22);
  backdrop-filter: blur(9px);
  transform: translateX(-50%);
  transition: opacity 260ms ease, transform 260ms ease;
  pointer-events: none;
}
.model-hint.is-hidden { opacity: 0; transform: translate(-50%,8px); }
.model-hint svg { width: 21px; height: 21px; fill: none; stroke: #7bd8db; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.model-loading, .model-error {
  position: absolute;
  z-index: 12;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  color: white;
  text-align: center;
  background: radial-gradient(circle at center,#165364,#061d26 72%);
  transition: opacity 260ms ease, visibility 260ms ease;
}
.model-loading.is-hidden { visibility: hidden; opacity: 0; }
.model-error[hidden] { display: none; }

.loading-cube { width: 37px; height: 37px; background: #7bd8db; border: 2px solid white; box-shadow: 10px 10px 0 rgba(213,145,53,.52); animation: cube 1.2s ease-in-out infinite alternate; }
@keyframes cube { to { transform: rotate(45deg) scale(.82); } }
.model-scrim { display: none; }

@media (min-width: 901px) {
  .model-shell:not(.is-panel-open) { grid-template-columns: 0 minmax(0,1fr); }
  .model-shell:not(.is-panel-open) .model-panel { opacity: 0; transform: translateX(-100%); pointer-events: none; }
}

@media (max-width: 900px) {
  :root { --header-height: 68px; --panel-width: 380px; }
  .model-shell { grid-template-columns: minmax(0,1fr); }
  .model-header { padding: 8px 12px; }
  .model-brand img { width: 45px; height: 45px; }
  .model-panel { position: fixed; top: var(--header-height); bottom: 0; left: 0; width: min(var(--panel-width),calc(100% - 38px)); transform: translateX(-105%); }
  .model-shell.is-panel-open .model-panel { transform: translateX(0); }
  .model-scrim { position: fixed; z-index: 20; inset: var(--header-height) 0 0; display: block; padding: 0; background: rgba(2,18,24,.58); border: 0; opacity: 1; transition: opacity 180ms ease; }
  .model-shell:not(.is-panel-open) .model-scrim { visibility: hidden; opacity: 0; pointer-events: none; }
  .model-stage { grid-column: 1; }
}

@media (max-width: 600px) {
  .model-brand small { font-size: .55rem; letter-spacing: .08em; }
  .model-brand strong { font-size: .88rem; }
  .tour-link { width: 39px; min-height: 39px; justify-content: center; padding: 0; }
  .tour-link span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .header-button, .model-icon-button { width: 39px; height: 39px; }
  .model-header-actions { gap: 5px; }
  .model-header .access-button { width: 39px; min-height: 39px; padding: 0; }
  .model-header .access-button span { font-size: 0; }
  .model-header .access-button span::first-letter { font-size: .9rem; }
  .model-legend { top: 10px; right: 10px; }
  .model-hint { bottom: 16px; max-width: calc(100% - 24px); text-align: center; }
}

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