:root {
  --glass: rgba(23, 22, 20, 0.72);
  --gold: #d4aa5e;
  --ink: #f2efe9;
  --blue: #2f7bf6;
  --safe-t: max(12px, env(safe-area-inset-top));
  --safe-b: max(14px, env(safe-area-inset-bottom));
  --safe-l: max(14px, env(safe-area-inset-left));
  --safe-r: max(14px, env(safe-area-inset-right));
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #171614;
  color: var(--ink);
  font: 14px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; }

#stage { position: fixed; inset: 0; }
#pano {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
#pano.dragging { cursor: grabbing; }
#spots { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
#fade {
  position: absolute; inset: 0; pointer-events: none;
  background: #171614; opacity: 1; transition: opacity 0.6s ease;
}
#fade.off { opacity: 0; }

/* ---- top bar ---- */
.top {
  position: fixed;
  top: var(--safe-t);
  left: var(--safe-l);
  right: var(--safe-r);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}
.brand {
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  min-width: 0;
}
.brand h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.flats {
  display: flex;
  gap: 2px;
  padding: 4px;
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: auto;
  flex: none;
}
.flats button {
  padding: 7px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #bab5ac;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.flats button.is-on { color: #171614; background: var(--gold); }
.flats button:disabled { opacity: 0.45; cursor: default; }
.flats button small { font-weight: 500; font-size: 10.5px; margin-left: 4px; }

/* ---- room list ---- */
.rooms-btn {
  position: fixed;
  top: calc(var(--safe-t) + 52px);
  left: var(--safe-l);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.rooms-btn svg, .back svg, .hs-go svg {
  width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.rooms {
  position: fixed;
  top: calc(var(--safe-t) + 96px);
  left: var(--safe-l);
  max-height: calc(100% - var(--safe-t) - 96px - var(--safe-b) - 70px);
  overflow-y: auto;
  padding: 6px;
  border-radius: 14px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  min-width: 190px;
}
.rooms button {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  text-align: left;
  font-size: 13.5px;
  cursor: pointer;
}
.rooms button:hover { background: rgba(255, 255, 255, 0.08); }
.rooms button.is-on { color: #171614; background: var(--ink); font-weight: 700; }

/* ---- bottom ---- */
.foot {
  position: fixed;
  left: var(--safe-l);
  right: var(--safe-r);
  bottom: var(--safe-b);
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.here {
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.here::before {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--gold);
  vertical-align: 1px;
}
.back {
  position: absolute;
  left: 0;
  bottom: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px 9px 11px;
  border-radius: 999px;
  border: 1px solid rgba(212, 176, 106, 0.6);
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  pointer-events: auto;
  max-width: 45%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.back[hidden] { display: none; }
.hint {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-b) + 52px);
  transform: translateX(-50%);
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--glass);
  color: #e6e1d8;
  font-size: 12.5px;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.5s;
}
.hint.gone { opacity: 0; }
.status {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-b) + 92px);
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--glass);
  color: #e6e1d8;
  font-size: 12px;
  pointer-events: none;
}
.status[hidden] { display: none; }

/* ---- hotspots (the Jewale tour's look: white dot, blue ring, heartbeat waves) ---- */
.hs {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  will-change: transform;
}
.hs[hidden] { display: none; }
.hs-dot {
  position: relative;
  flex: none;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 4px solid var(--blue);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}
.hs-dot::before, .hs-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 2px solid rgba(47, 123, 246, 0.85);
  border-radius: 50%;
  animation: hs-beat 1.9s cubic-bezier(0.2, 0.6, 0.3, 1) infinite;
  pointer-events: none;
}
.hs-dot::after { animation-delay: 0.32s; }
@keyframes hs-beat {
  0% { transform: scale(1); opacity: 0.9; }
  70% { transform: scale(2.3); opacity: 0; }
  100% { transform: scale(2.3); opacity: 0; }
}
.hs-go {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 9px 7px 13px;
  border: 0;
  border-radius: 999px;
  background: rgba(250, 248, 243, 0.95);
  color: #1d2320;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  opacity: 0.9;
  transition: opacity 0.18s, transform 0.18s;
}
/* room names always on (the brief: hotspot + room label); hover / focus lifts the one under the pointer */
.hs:hover .hs-go, .hs:focus-within .hs-go { opacity: 1; transform: scale(1.04); }
@media (hover: none) {
  .hs-go { padding: 5px 8px 5px 11px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .hs-dot::before, .hs-dot::after { animation: none; }
}

/* sideways phones */
@media (max-height: 500px) {
  .brand { padding: 7px 13px; }
  .brand h1 { font-size: 13px; }
  .flats button { padding: 5px 11px; font-size: 12px; }
  .rooms-btn { top: calc(var(--safe-t) + 42px); padding: 6px 12px; }
  .rooms { top: calc(var(--safe-t) + 80px); max-height: calc(100% - var(--safe-t) - 80px - var(--safe-b)); }
  .status { bottom: calc(var(--safe-b) + 76px); }
  .here { padding: 6px 14px; font-size: 13px; }
  .hint { bottom: calc(var(--safe-b) + 40px); }
}
/* narrow portrait phones: the title gets its own line */
@media (max-width: 520px) {
  .top { flex-direction: column; align-items: flex-start; gap: 6px; }
  .brand h1 { font-size: 13.5px; }
  .rooms-btn { top: calc(var(--safe-t) + 90px); }
  .rooms { top: calc(var(--safe-t) + 132px); max-height: calc(100% - var(--safe-t) - 132px - var(--safe-b) - 60px); }
}

/* 11-06 user: a compact window like the Jewale tour (2K panos were stretched full-screen = blurry) */
@media (min-width: 820px) and (min-height: 501px) {
  body { background: radial-gradient(ellipse at center, #2a2724 0%, #121110 75%); }
  #stage {
    inset: auto; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: min(820px, 86vw); height: min(460px, calc(min(820px, 86vw) * 0.56), 68vh);   /* 11-07 user: smaller */
    border-radius: 16px; overflow: hidden; box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  }
}

/* ---- mini map: the flat's plan, top-right (inside the desktop window; under the flat switcher on phones) ---- */
.minimap {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  padding: 6px;
  border-radius: 12px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.32);
  touch-action: manipulation;
}
.minimap[hidden] { display: none; }
.minimap:not(.is-open) { cursor: pointer; }
.mm-svg { display: block; overflow: visible; }
.mm-poche path { fill: #4c4741; stroke: #4c4741; stroke-linejoin: miter; }
.mm-open path { fill: #ebe5da; }
.mm-room path {
  fill: #ebe5da;
  stroke: rgba(76, 71, 65, 0.35);
  stroke-width: calc(var(--mm-px, 0.06) * 0.8);
  transition: fill 0.25s;
}
.mm-room.mm-balcony path { fill: #cfc8bc; }
.mm-room.is-off path { fill: #bdb6aa; }
.mm-room:not(.is-off) { cursor: pointer; outline: none; }
.mm-room.is-current path { fill: var(--gold); stroke: #8a6a2c; stroke-width: calc(var(--mm-px, 0.06) * 1.4); }
.mm-room text {
  fill: #5a534a;
  font-weight: 650;
  letter-spacing: 0.01em;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}
.mm-room.is-current text { fill: #2a2118; font-weight: 800; }
.mm-room.is-off text { fill: #7a7368; }
@media (hover: hover) {
  .minimap.is-open .mm-room:not(.is-off):not(.is-current):hover path { fill: #fbf6ec; }
}
.mm-room:focus-visible path { stroke: var(--blue); stroke-width: calc(var(--mm-px, 0.06) * 2); }
.mm-win path { fill: #b9d0e6; }
.mm-entry { fill: var(--gold); }
.mm-dot { fill: var(--blue); stroke: #fff; }
.mm-me, .mm-poche, .mm-open, .mm-win, .mm-entry { pointer-events: none; }
.minimap:not(.is-open) .mm-room text, .minimap:not(.is-open) .mm-entry { display: none; }
.mm-toggle {
  position: absolute;
  top: -7px;
  left: -7px;
  width: 26px;
  height: 26px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: #262421;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.mm-toggle svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.mm-toggle .mm-ico-open, .minimap:not(.is-open) .mm-toggle .mm-ico-close { display: none; }
.minimap:not(.is-open) .mm-toggle .mm-ico-open { display: block; }
.minimap:not(.is-open) .mm-toggle { width: 22px; height: 22px; top: -6px; left: -6px; }
.minimap:not(.is-open) .mm-toggle svg { width: 12px; height: 12px; }
.mm-north {
  position: absolute;
  left: -6px;
  bottom: -6px;
  height: 20px;
  padding: 0 6px 0 2px;
  display: flex;
  align-items: center;
  gap: 1px;
  border-radius: 999px;
  background: #262421;
  border: 1px solid rgba(255, 255, 255, 0.18);
  pointer-events: none;
}
.mm-north svg { display: block; width: 14px; height: 14px; fill: var(--gold); }
.mm-north b { font-size: 9px; font-weight: 800; color: var(--ink); line-height: 1; }
.minimap:not(.is-open) .mm-north { display: none; }

/* full-screen layouts (phones, small tablets): the map sits under the top bar, on the right */
@media (max-width: 819px), (max-height: 500px) {
  .minimap { top: calc(var(--safe-t) + 52px); right: var(--safe-r); padding: 5px; border-radius: 11px; }
}
@media (max-height: 500px) {
  .minimap { top: calc(var(--safe-t) + 44px); }
}
/* portrait phones: the thumbnail rides beside the flat switcher (row 2); opened it takes the width under it */
@media (max-width: 520px) {
  .minimap { top: calc(var(--safe-t) + 42px); }
  .minimap.is-open { top: calc(var(--safe-t) + 92px); }
  body.mm-big .rooms-btn, body.mm-big .rooms { visibility: hidden; }
}

/* ---- 11-07 phones: landscape only (the walkthroughs' TurnPhone card) ---- */
.turn-phone { position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; justify-items: center;
  gap: 0.9rem; padding: 2rem; text-align: center; background: rgba(18, 17, 16, 0.97);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); color: #f6f3ea; touch-action: none;
  font-family: inherit; }
.turn-phone[hidden] { display: none; }
.turn-phone b { font-size: 1.45rem; font-weight: 600; line-height: 1.15; }
.turn-phone p { max-width: 30ch; margin: 0; color: rgba(246, 243, 234, 0.72); font-size: 0.92rem; line-height: 1.45; }
.turn-phone i { position: relative; width: 34px; height: 58px; margin-bottom: 0.8rem; border: 1.5px solid var(--gold);
  border-radius: 7px; animation: turn-phone-tilt 2.4s cubic-bezier(0.65, 0, 0.35, 1) infinite; }
.turn-phone i::after { content: ''; position: absolute; left: 50%; bottom: 5px; width: 8px; height: 2px; border-radius: 1px;
  background: var(--gold); transform: translateX(-50%); }
.turn-phone__actions { display: grid; gap: 0.6rem; margin-top: 0.6rem; min-width: min(15rem, 80vw); }
.turn-phone button { padding: 0.75rem 1.3rem; border: 1px solid var(--gold); border-radius: 999px; background: var(--gold);
  color: #171614; font: inherit; font-size: 0.95rem; font-weight: 600; }
@keyframes turn-phone-tilt { 0%, 20% { transform: rotate(0deg); } 55%, 85% { transform: rotate(-90deg); } 100% { transform: rotate(0deg); } }
.turn-phone--swipe { touch-action: pan-y; }
.turn-phone--swipe i { width: 22px; height: 22px; border: 0; border-left: 2px solid var(--gold); border-top: 2px solid var(--gold);
  border-radius: 2px; margin: 0.4rem 0 0.2rem; animation: swipe-up-hint 1.6s ease-in-out infinite; }
.turn-phone--swipe i::after { content: none; }
@keyframes swipe-up-hint { 0% { transform: rotate(45deg) translate(10px, 10px); opacity: 0; } 40% { opacity: 1; }
  100% { transform: rotate(45deg) translate(-10px, -10px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .turn-phone i { animation: none; transform: rotate(-90deg); }
  .turn-phone--swipe i { animation: none; transform: rotate(45deg); } }
/* iPhone sideways: the document gets room to scroll (Safari folds its bars on the swipe); the tour stays pinned */
#swipe-room { display: none; }
html.swipe-full, html.swipe-full body { height: auto; overflow-x: hidden; overflow-y: auto; }
html.swipe-full #swipe-room { display: block; height: calc(100vh + 240px); }
html.swipe-full #stage { position: fixed; inset: 0; }
