:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --ink: #f8f5ed;
  --muted: #cbc9c3;
  --accent: #ead8b3;
  --glass: rgba(25, 34, 37, .88);
  --border: rgba(255, 255, 255, .14);
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: #232e32; }
body { color: var(--ink); }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: .42; cursor: default; }
button, a { touch-action: manipulation; }
button:focus-visible, a:focus-visible, [role="button"]:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
[hidden] { display: none !important; }
svg { display: block; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#tour { position: relative; isolation: isolate; width: 100%; height: 100%; height: 100dvh; background: #232e32; }
#panorama { position: absolute; inset: 0; background: #232e32; }
.glass { background: var(--glass); border: 1px solid var(--border); box-shadow: 0 6px 28px rgba(0, 0, 0, .16); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.topbar { position: absolute; z-index: 3; top: max(24px, env(safe-area-inset-top)); left: max(24px, env(safe-area-inset-left)); right: max(24px, env(safe-area-inset-right)); display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; pointer-events: none; }
.project-label, .toolbar { pointer-events: auto; }
.project-label { padding: 15px 21px 16px; border-radius: 14px; min-width: 250px; }
.back-to-panoramas { display: inline-flex; align-items: center; gap: 7px; min-height: 24px; margin-bottom: 10px; border-radius: 4px; color: var(--muted); font-size: 12px; line-height: 1.4; text-decoration: none; }
.back-to-panoramas svg { width: 16px; height: 16px; }
.back-to-panoramas:hover { color: var(--accent); }
.eyebrow { display: block; color: var(--accent); font-size: 10px; line-height: 1.4; letter-spacing: 1.3px; text-transform: uppercase; }
.project-title { display: block; color: var(--muted); font-size: 12px; margin-top: 5px; }
h1 { font-size: 22px; font-weight: 500; letter-spacing: -.5px; line-height: 1.25; margin: 6px 0 0; }
.toolbar { display: flex; align-items: center; padding: 4px; border-radius: 12px; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; border: 0; padding: 0; width: 42px; height: 42px; border-radius: 9px; background: transparent; color: var(--ink); transition: background .15s, color .15s; }
.icon-button:hover { background: rgba(255,255,255,.1); }
.icon-button[aria-pressed="true"] { background: rgba(234,216,179,.16); color: var(--accent); }
.toolbar-divider { height: 22px; width: 1px; margin: 0 3px; background: var(--border); }
.floorplan-widget { position: absolute; z-index: 3; top: 180px; left: max(24px,env(safe-area-inset-left)); width: 376px; border-radius: 14px; }
.floorplan-heading { display: flex; align-items: center; gap: 2px; padding-right: 6px; }
.floorplan-toggle { display: flex; align-items: center; gap: 9px; flex: 1; border: 0; padding: 13px 12px; border-radius: 13px; background: transparent; text-align: left; font-size: 12px; }
.floorplan-toggle > svg:first-child { width: 17px; height: 17px; color: var(--accent); }
.floorplan-toggle > span { flex: 1; }
.floorplan-toggle:hover { background: rgba(255,255,255,.07); }
.floorplan-toggle[aria-expanded="false"] .toggle-chevron { transform: rotate(180deg); }
.floorplan-expand { width: 32px; height: 32px; }
.floorplan-expand svg { width: 19px; height: 19px; }
.floorplan-panel { padding: 0 8px 10px; }
.floorplan-map { position: relative; isolation: isolate; width: 100%; border-radius: 9px; background: #faf8f3; color: #202c30; }
.floorplan-map > img { display: block; width: 100%; height: auto; border-radius: inherit; user-select: none; }
.floorplan-points { position: absolute; inset: 0; }
.map-point { position: absolute; z-index: 1; display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 2px solid #fffaf0; border-radius: 50%; transform: translate(-50%,-50%); background: #25363c; color: #fff; box-shadow: 0 2px 7px rgba(0,0,0,.3); font-size: 10px; font-weight: 600; transition: background .15s, box-shadow .15s; }
.map-point[aria-current="true"] { background: #d4b778; color: #202c30; border-color: #fffaf0; box-shadow: 0 0 0 4px rgba(77,59,31,.3),0 2px 7px rgba(0,0,0,.2); }
.map-point:hover, .map-point:focus-visible { z-index: 2; box-shadow: 0 0 0 4px rgba(41,65,73,.24); }
.map-point-label { position: absolute; bottom: calc(100% + 9px); left: 50%; transform: translateX(-50%); padding: 6px 9px; border-radius: 6px; background: #202c30; color: #fff; white-space: nowrap; font-size: 11px; font-weight: 400; opacity: 0; pointer-events: none; transition: opacity .15s; box-shadow: 0 3px 12px rgba(0,0,0,.2); }
.map-point[data-label-side="left"] .map-point-label { left: auto; right: -3px; transform: none; }
.map-point[data-label-side="right"] .map-point-label { left: -3px; transform: none; }
.map-point:hover .map-point-label, .map-point:focus-visible .map-point-label { opacity: 1; }
.floorplan-caption { margin: 11px 4px 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.floorplan-caption strong, .floorplan-current strong { font-weight: 500; color: var(--accent); }
.floorplan-widget.is-compact { width: auto; }
.floorplan-widget.is-compact .floorplan-heading { padding-right: 0; }
.floorplan-widget.is-compact .toggle-chevron { display: none; }
.floorplan-image-error { margin: 0; padding: 32px 12px; text-align: center; font-size: 13px; }
.navigation { position: absolute; z-index: 3; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: min(1120px, calc(100% - 48px)); pointer-events: none; }
.nav-heading { display: flex; justify-content: center; margin-bottom: 8px; }
.thumb-toggle { display: flex; align-items: center; gap: 9px; padding: 8px 13px; border-radius: 10px; font-size: 12px; pointer-events: auto; }
.thumb-toggle > svg:first-child { height: 16px; width: 16px; }
.thumb-toggle:hover { background: rgba(36,46,48,.96); }
.scene-counter { color: var(--accent); font-size: 10px; font-variant-numeric: tabular-nums; letter-spacing: .6px; padding-left: 8px; border-left: 1px solid var(--border); }
.toggle-chevron { width: 14px; height: 14px; transition: transform .2s; }
.thumb-toggle[aria-expanded="false"] .toggle-chevron { transform: rotate(180deg); }
.thumb-panel { display: flex; align-items: center; gap: 8px; border-radius: 14px; padding: 10px; pointer-events: auto; }
.step-button { width: 32px; height: 66px; }
.thumbnails { display: flex; flex: 1 1 auto; gap: 8px; overflow-x: auto; min-width: 0; padding: 3px; scroll-behavior: smooth; scrollbar-width: none; overscroll-behavior-x: contain; }
.thumbnails::-webkit-scrollbar { display: none; }
.scene-thumb { position: relative; display: block; flex: 0 0 auto; width: 104px; height: 76px; padding: 0; overflow: hidden; border: 1px solid transparent; border-radius: 8px; background: #425055; text-align: left; }
.scene-thumb:after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 18%,rgba(0,0,0,.68)); pointer-events: none; }
.scene-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.scene-thumb:hover img { transform: scale(1.07); }
.scene-thumb[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.thumb-title { position: absolute; z-index: 1; left: 8px; bottom: 7px; right: 6px; font-size: 10px; font-weight: 500; line-height: 1.25; color: #fff; text-shadow: 0 1px 3px #000; }
.thumb-number { position: absolute; z-index: 1; left: 8px; top: 6px; font-size: 9px; font-variant-numeric: tabular-nums; color: white; text-shadow: 0 1px 3px #000; }
.loading-status { position: absolute; z-index: 4; left: 50%; top: 50%; transform: translate(-50%,-50%); display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-radius: 12px; font-size: 13px; white-space: nowrap; }
.spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid rgba(255,255,255,.2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.welcome { position: absolute; z-index: 3; left: 50%; top: 50%; transform: translate(-50%,-50%); display: flex; align-items: center; gap: 14px; padding: 17px 22px; border-radius: 12px; font-size: 12px; line-height: 1.55; pointer-events: none; opacity: 0; transition: opacity .4s; }
.welcome.is-visible { opacity: 1; }
.welcome svg { width: 30px; height: 30px; color: var(--accent); }
.toast { position: absolute; z-index: 5; top: 50%; left: 50%; transform: translate(-50%,-50%); width: min(360px, calc(100% - 32px)); padding: 16px 20px; font-size: 13px; line-height: 1.5; text-align: center; border-radius: 12px; }
.error-card { position: absolute; z-index: 5; left: 50%; top: 50%; transform: translate(-50%,-50%); width: min(440px, calc(100% - 32px)); padding: 24px; border-radius: 14px; }
.error-card strong { font-size: 18px; font-weight: 500; }
.error-card p { font-size: 13px; line-height: 1.55; color: var(--muted); }
.error-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.text-button { display: inline-block; color: var(--ink); border: 1px solid var(--border); border-radius: 8px; background: rgba(255,255,255,.07); padding: 10px 13px; font: inherit; font-size: 12px; text-decoration: none; }
.text-button:hover { background: rgba(255,255,255,.14); }
.tour-dialog { color: var(--ink); border: 1px solid var(--border); background: #202c30; padding: 24px; border-radius: 18px; width: min(610px,calc(100% - 32px)); max-height: calc(100dvh - 40px); box-shadow: 0 24px 90px rgba(0,0,0,.5); }
.tour-dialog::backdrop { background: rgba(0,0,0,.42); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.dialog-heading h2 { font-size: 23px; font-weight: 500; letter-spacing: -.5px; margin: 6px 0 0; }
.close-dialog { background: rgba(255,255,255,.05); }
.floorplan-dialog { width: min(1060px,calc(100% - 32px)); padding: 20px; }
.floorplan-dialog .dialog-heading { margin-bottom: 16px; align-items: flex-start; }
.floorplan-current { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.floorplan-dialog .floorplan-map { width: min(100%,calc((100dvh - 202px) * var(--plan-ratio,1))); margin: 0 auto; }
.floorplan-dialog .map-point { width: 40px; height: 40px; border-width: 2px; font-size: 12px; }
.floorplan-hint { margin: 14px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; text-align: center; }
.room-choices { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.room-card { position: relative; overflow: hidden; padding: 0; height: 126px; border: 1px solid var(--border); border-radius: 10px; background: #37434a; text-align: left; }
.room-card img { width: 100%; height: 100%; object-fit: cover; }
.room-card:after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 25%,rgba(0,0,0,.75)); }
.room-card span { position: absolute; z-index: 1; left: 14px; bottom: 14px; right: 8px; font-size: 14px; }
.room-card:hover { border-color: var(--accent); }
.help-dialog { width: min(470px,calc(100% - 32px)); }
.help-list { margin: 0; padding: 0; list-style: none; }
.help-list li + li { margin-top: 19px; }
.help-list strong { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--accent); }
.help-list span { display: block; color: var(--muted); font-size: 13px; line-height: 1.6; }
.noscript { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); padding: 24px; z-index: 8; border-radius: 14px; }
/* Стандартные контролы заменены панелью, которая остается видна в fullscreen. */
.pnlm-controls-container, .pnlm-panorama-info, .pnlm-load-box, .pnlm-error-msg { display: none !important; }
.pnlm-container { background: #232e32; }
.pnlm-hotspot-base.tour-hotspot { width: 46px; height: 46px; border: 1px solid rgba(255,255,255,.8); border-radius: 50%; background: rgba(27,38,41,.85); box-shadow: 0 0 0 6px rgba(255,255,255,.15), 0 4px 18px rgba(0,0,0,.24); color: #fff; cursor: pointer; transition: background .15s, box-shadow .15s; }
.tour-hotspot:hover, .tour-hotspot:focus-visible { background: #384a4f; box-shadow: 0 0 0 7px rgba(234,216,179,.3); }
.hotspot-icon { display: flex; align-items: center; justify-content: center; height: 100%; pointer-events: none; }
.hotspot-icon svg { width: 23px; height: 23px; stroke-width: 2; }
.hotspot-label { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); background: rgba(25,34,37,.9); border: 1px solid rgba(255,255,255,.2); padding: 5px 10px; border-radius: 6px; color: white; font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif; font-size: 11px; line-height: 1.3; white-space: nowrap; pointer-events: none; }
@media (max-width: 800px) {
  .topbar { top: max(16px,env(safe-area-inset-top)); left: max(16px,env(safe-area-inset-left)); right: max(16px,env(safe-area-inset-right)); gap: 12px; }
  .project-label { min-width: 210px; padding: 13px 17px; }
  .floorplan-widget { left: max(16px,env(safe-area-inset-left)); top: 174px; width: 280px; }
  .toolbar .icon-button { width: 36px; height: 40px; }
  .desktop-control { display: none; }
  .navigation { max-width: calc(100% - 32px); bottom: max(16px,env(safe-area-inset-bottom)); }
  .scene-thumb { height: 72px; }
}
@media (max-width: 600px) {
  .topbar { top: max(12px,env(safe-area-inset-top)); left: max(12px,env(safe-area-inset-left)); right: max(12px,env(safe-area-inset-right)); align-items: flex-start; }
  .project-label { min-width: 0; max-width: calc(100% - 60px); padding: 12px 15px; border-radius: 11px; }
  .back-to-panoramas { min-height: 24px; margin-bottom: 8px; font-size: 11px; }
  .project-title { font-size: 10px; }
  .eyebrow { font-size: 8px; letter-spacing: 1px; }
  h1 { font-size: 18px; margin-top: 5px; }
  .floorplan-widget { left: max(12px,env(safe-area-inset-left)); top: 146px; }
  .toolbar { flex-direction: column; padding: 3px; border-radius: 11px; }
  .toolbar .icon-button { width: 40px; height: 40px; }
  .toolbar-divider { height: 1px; width: 20px; margin: 3px 0; }
  .navigation { max-width: calc(100% - 24px); bottom: max(12px,env(safe-area-inset-bottom)); }
  .thumb-panel { gap: 4px; padding: 7px; border-radius: 11px; }
  .thumbnails { gap: 8px; }
  .scene-thumb { width: 96px; height: 68px; }
  .step-button { width: 28px; }
  .thumb-toggle { padding: 8px 11px; font-size: 11px; }
  .tour-dialog { padding: 20px; }
  .floorplan-dialog { padding: 15px; }
  .floorplan-dialog .dialog-heading h2 { font-size: 21px; }
  .floorplan-dialog .floorplan-map { width: min(100%,calc((100dvh - 182px) * var(--plan-ratio,1))); }
  .floorplan-hint { font-size: 11px; }
  .room-card { height: 110px; }
  .room-card span { font-size: 12px; left: 10px; bottom: 12px; }
  .welcome { left: calc(50% - 20px); max-width: calc(100% - 100px); padding: 14px 15px; font-size: 11px; }
  .pnlm-hotspot-base.tour-hotspot { width: 42px; height: 42px; }
  .hotspot-label { top: 51px; font-size: 10px; }
}
@media (max-height: 500px) and (min-width: 601px) {
  .topbar { top: 10px; left: 12px; right: 12px; }
  .project-label { padding: 9px 14px; }
  .project-title { display: none; }
  .floorplan-widget { top: 122px; left: 12px; }
  h1 { font-size: 18px; }
  .navigation { bottom: 10px; }
  .thumb-panel { padding: 6px; }
  .scene-thumb { width: 80px; height: 56px; }
  .nav-heading { margin-bottom: 5px; }
}
@media (max-height: 500px) and (max-width: 600px) {
  .project-label { max-width: calc(100% - 96px); }
  .floorplan-widget { top: 134px; }
  .toolbar { display: grid; grid-template-columns: repeat(2,36px); }
  .toolbar .icon-button { width: 36px; height: 36px; }
  .toolbar-divider { grid-column: 1 / -1; width: auto; height: 1px; }
}
@media (max-height: 500px) {
  .floorplan-dialog { width: min(460px,calc(100% - 24px)); max-height: calc(100dvh - 16px); padding: 12px; }
  .floorplan-dialog .dialog-heading { margin-bottom: 8px; }
  .floorplan-dialog .eyebrow, .floorplan-dialog .floorplan-hint { display: none; }
  .floorplan-dialog .dialog-heading h2 { font-size: 18px; margin: 0; }
  .floorplan-dialog .floorplan-current { font-size: 11px; margin-top: 5px; }
  .floorplan-dialog .floorplan-map { width: min(100%,calc((100dvh - 100px) * var(--plan-ratio,1))); }
  .floorplan-dialog .map-point { width: 36px; height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .spinner { animation-duration: 2s; }
}

@media (max-width: 600px) { .floorplan-dialog .map-point { width: 30px; height: 30px; font-size: 11px; } }
@media (max-width: 420px) { .floorplan-dialog .map-point { width: 24px; height: 24px; font-size: 10px; } }
@media (max-width: 350px) { .floorplan-dialog .map-point { width: 20px; height: 20px; font-size: 9px; } }
