/* 360° Standalone Web Viewer (WebRotate 360 SpotEditor style) */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #e9eef3;
  color: #333333;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  padding: 0;
  user-select: none;
}
.viewer-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
}
.viewer-container {
  position: relative;
  width: 100%;
  height: 100%;
  max-height: none;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #e9eef3;
}
.viewer-container:fullscreen {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  max-width: none;
  aspect-ratio: auto;
}
.viewer-container:fullscreen .viewer-canvas-wrap {
  width: 100%;
  height: 100%;
  flex: none;
}
.viewer-container:fullscreen canvas#viewerCanvas {
  object-fit: contain;
}
.viewer-container:fullscreen .viewer-toolbar {
  bottom: max(20px, env(safe-area-inset-bottom));
}
.viewer-canvas-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  background: #e9eef3;
}
.viewer-canvas-wrap:active {
  cursor: grabbing;
}
canvas#viewerCanvas {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  flex: none;
  object-fit: contain;
  object-position: center;
  display: block;
  transform: scale(var(--viewer-zoom, 1));
}
.viewer-canvas-wrap.is-zoomed canvas#viewerCanvas {
  cursor: move;
}
.hotspot-overlay-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
.hotspot-svg-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.polygon-shape {
  pointer-events: auto;
  cursor: pointer;
  transition: fill 0.15s ease, fill-opacity 0.15s ease, stroke 0.15s ease;
}
.hotspot-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: pointer;
  z-index: 20;
}
.hotspot-marker.is-polygon-marker {
  width: 0;
  height: 0;
  pointer-events: none;
}
.hotspot-marker.is-polygon-marker .hotspot-popup {
  pointer-events: auto;
}
.hotspot-marker.is-polygon-marker .hotspot-pin {
  position: absolute;
  pointer-events: auto;
  transform: translate(-50%, -50%);
}
.hotspot-marker.is-polygon-marker:hover .hotspot-pin {
  transform: translate(-50%, -50%) scale(1.15);
}
.hotspot-pin {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #00a2e8;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
.hotspot-marker:hover .hotspot-pin {
  transform: scale(1.15);
}
.hotspot-state-media { display: flex; align-items: center; justify-content: center; width: 75%; height: 75%; pointer-events: none; }
.hotspot-state-media > img, .hotspot-state-media > svg { width: 100%; height: 100%; object-fit: contain; }
.has-state-styles .hotspot-pin { transition: none; }
.hotspot-hit-area { position: absolute; display: flex; align-items: center; justify-content: center; transform: translate(-50%, -50%); pointer-events: auto; }
.hotspot-label {
  position: absolute;
  left: calc(100% + 6px);
  top: 50%;
  transform: translateY(-50%);
  padding: 3px 8px;
  border: 1px solid #38a9e4;
  border-radius: 4px;
  background: #172033;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: auto;
}
.hotspot-popup {
  position: absolute;
  background: #ffffff;
  color: #1e293b;
  padding: 8px 12px;
  border-radius: 6px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.2);
  border: 1px solid #e2e8f0;
  font-size: 12px;
  line-height: 1.4;
  white-space: normal;
  width: 220px;
  min-width: 0;
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px);
  overflow-y: auto;
  overflow-x: hidden;
  overflow-wrap: break-word;
  display: none;
  z-index: 30;
  pointer-events: auto;
  animation: popupFadeIn 0.15s ease-out;
}
.hotspot-popup.pos-right {
  left: calc(100% + 12px);
  top: 50%;
  bottom: auto;
  right: auto;
  transform: translateY(-50%);
}
.hotspot-marker.is-polygon-marker .hotspot-popup.pos-right {
  left: 14px;
}
.hotspot-popup.pos-left {
  right: calc(100% + 12px);
  top: 50%;
  bottom: auto;
  left: auto;
  transform: translateY(-50%);
}
.hotspot-marker.is-polygon-marker .hotspot-popup.pos-left {
  right: 14px;
}
.hotspot-popup.pos-top {
  bottom: calc(100% + 12px);
  left: 50%;
  top: auto;
  right: auto;
  transform: translateX(-50%);
}
.hotspot-popup.pos-bottom {
  top: calc(100% + 12px);
  left: 50%;
  bottom: auto;
  right: auto;
  transform: translateX(-50%);
}
@keyframes popupFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.hotspot-popup.active { display: block; }
.hotspot-popup img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin-top: 6px;
  display: block;
}
.hotspot-popup-content {
  line-height: 1.4;
  white-space: pre-wrap;
}
.hotspot-popup-content ul,
.hotspot-popup-content ol {
  padding-left: 18px;
}
.viewer-toolbar {
  position: absolute;
  z-index: 100;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 5px 7px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 11px;
  background: rgba(24,28,36,0.65);
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
  box-shadow: 0 8px 30px rgba(0,0,0,0.22);
  touch-action: none;
  cursor: grab;
}
.viewer-toolbar.is-dragging { cursor: grabbing; }
.toolbar-grip { display: flex; align-items: center; color: rgba(255,255,255,0.5); padding: 0 2px; }
.frame-counter {
  min-width: 66px;
  padding: 0 7px;
  color: #ffffff;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: center;
  border-left: 1px solid rgba(255,255,255,0.22);
  border-right: 1px solid rgba(255,255,255,0.22);
}
.tb-btn svg { width: 18px; height: 18px; }
.tb-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.12s ease, transform 0.1s ease;
  padding: 0;
}
.tb-btn:hover {
  color: #ffffff;
  background: rgba(255,255,255,0.16);
}
.tb-btn:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}
.tb-btn:active {
  transform: scale(0.94);
}
