/* Real-user feedback pass: legibility, focus and optional large views. */
:root {
  --ux-green: #006b45;
  --ux-green-dark: #004b35;
  --ux-cream: #fffdf5;
  --ux-focus: #ffd95a;
}

.map-module {
  border-color: #8dad99 !important;
  box-shadow: 0 12px 32px rgba(0, 75, 53, 0.08);
}

.map-scroll {
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

.floor-map > image {
  filter: contrast(1.12) saturate(0.92);
}

.ux-map-toolbar {
  align-items: center;
  display: flex;
  justify-content: flex-end;
  padding: 8px 12px 0;
}

.ux-map-action,
.ux-overlay-action,
.ux-photo-expand {
  align-items: center;
  background: var(--ux-cream);
  border: 1.5px solid var(--ux-green);
  border-radius: 10px;
  color: var(--ux-green-dark);
  cursor: pointer;
  display: inline-flex;
  font: 700 14px/1.2 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  gap: 7px;
  justify-content: center;
  min-height: 42px;
  padding: 9px 13px;
}

.ux-map-action:hover,
.ux-overlay-action:hover,
.ux-photo-expand:hover {
  background: #e8f4ec;
}

.ux-map-action:focus-visible,
.ux-overlay-action:focus-visible,
.ux-photo-expand:focus-visible {
  outline: 3px solid var(--ux-focus);
  outline-offset: 2px;
}

.ux-map-focus-ring {
  animation: ux-map-pulse 1.8s ease-in-out infinite;
  filter: drop-shadow(0 0 3px rgba(0, 75, 53, 0.45));
  pointer-events: none;
}

@keyframes ux-map-pulse {
  0%, 100% { opacity: 0.82; }
  50% { opacity: 1; }
}

.ux-map-overlay,
.ux-photo-overlay {
  align-items: stretch;
  background: rgba(5, 20, 15, 0.88);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  position: fixed;
  z-index: 99999;
}

.ux-overlay-dialog {
  background: #f7f6ee;
  border: 2px solid #52a87d;
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 1320px;
  overflow: hidden;
  width: 100%;
}

.ux-overlay-header {
  align-items: center;
  background: var(--ux-green-dark);
  color: #fff;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-height: 62px;
  padding: 10px 14px;
}

.ux-overlay-title {
  font: 800 clamp(18px, 3vw, 24px)/1.2 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
}

.ux-overlay-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}

.ux-overlay-action {
  background: #fffdf5;
  min-height: 40px;
  min-width: 42px;
  padding: 8px 11px;
}

.ux-map-viewport {
  flex: 1;
  overflow: auto;
  padding: 18px;
  touch-action: pan-x pan-y;
}

.ux-map-stage {
  margin: auto;
  width: 1000px;
  zoom: var(--ux-zoom, 1);
}

.ux-map-stage .map-scroll {
  max-height: none !important;
  overflow: visible !important;
}

.ux-map-stage .floor-map {
  height: auto !important;
  min-width: 1000px !important;
  width: 1000px !important;
}

.ux-map-stage .ux-map-toolbar {
  display: none;
}

.ux-photo-expand {
  background: rgba(255, 253, 245, 0.96);
  min-width: 42px;
  padding: 8px 10px;
  position: absolute;
  right: 14px;
  /* Keep this below the navigation header and progress bar. */
  top: 144px;
  z-index: 8;
}

.scene-viewport {
  position: relative;
}

.ux-photo-stage {
  align-items: center;
  background: #0a1b15;
  display: flex;
  flex: 1;
  justify-content: center;
  min-height: 0;
  overflow: auto;
  padding: 14px;
}

.ux-photo-stage img {
  height: 100%;
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  width: 100%;
}

.survey-photo {
  filter: contrast(1.06) saturate(1.04);
}

.immersive-scene .ar-cue {
  max-width: min(82%, 410px) !important;
  padding: 10px 14px !important;
}

.immersive-scene .ar-cue-icon {
  height: 58px !important;
  width: 58px !important;
}

.immersive-scene .ar-cue strong {
  font-size: clamp(18px, 2.5vw, 23px) !important;
}

body.ux-overlay-open {
  overflow: hidden !important;
}

@media (max-width: 820px) {
  .ar-home {
    min-width: 64px !important;
    padding: 0 9px !important;
    width: auto !important;
  }

  .ar-home span {
    display: inline !important;
  }

  .stage-select .map-scroll,
  .dialog-map .map-scroll {
    overflow: auto !important;
  }

  .stage-select .floor-map,
  .dialog-map .floor-map {
    height: auto !important;
    min-width: 760px !important;
    width: 760px !important;
  }

  .ux-map-toolbar {
    justify-content: stretch;
  }

  .ux-map-action {
    width: 100%;
  }

  .ux-overlay-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .ux-overlay-controls {
    justify-content: flex-start;
    width: 100%;
  }

  .ux-map-viewport {
    padding: 8px;
  }

  .ux-map-stage,
  .ux-map-stage .floor-map {
    min-width: 860px !important;
    width: 860px !important;
  }

  .ux-photo-expand .ux-button-label {
    display: none;
  }

  .ux-photo-expand {
    right: 10px;
    top: 138px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ux-map-focus-ring {
    animation: none;
  }

  .map-scroll {
    scroll-behavior: auto;
  }
}
.map-destination-marker {
  cursor: pointer;
  touch-action: manipulation;
}

.map-destination-marker text {
  pointer-events: none;
}

.map-destination-marker:hover circle:not(.destination-hit-area),
.map-destination-marker:focus-visible circle:not(.destination-hit-area) {
  fill: #ffd95a;
  stroke: #004b35;
  stroke-width: 2.5;
}

.map-destination-marker:focus-visible {
  outline: none;
}

/* Narrow-phone safety pass: keep every guide control inside the CSS viewport. */
@media (max-width: 480px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .guide-shell {
    max-width: 100%;
    overflow-x: hidden;
    padding: 0 !important;
    width: 100%;
  }

  .guide-layout,
  .guide-phone,
  .immersive-scene,
  .immersive-scene .scene-viewport {
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
    width: 100%;
  }

  .immersive-scene {
    border-left-width: 0;
    border-radius: 0;
    border-right-width: 0;
  }

  .ar-interface {
    box-sizing: border-box;
    padding: 14px 10px 12px !important;
    width: 100%;
  }

  .ar-header {
    display: grid !important;
    gap: 6px !important;
    grid-template-columns: 44px minmax(0, 1fr) 54px !important;
    width: 100%;
  }

  .ar-back {
    min-width: 44px !important;
    width: 44px !important;
  }

  .ar-destination-pill {
    gap: 7px !important;
    min-width: 0 !important;
    padding: 9px 8px !important;
    width: 100%;
  }

  .ar-destination-pill > div {
    min-width: 0;
    overflow: hidden;
  }

  .ar-destination-pill small {
    font-size: 7px !important;
    letter-spacing: 0.7px !important;
  }

  .ar-destination-pill strong {
    display: block;
    font-size: 15px !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ar-home {
    min-width: 54px !important;
    padding: 0 6px !important;
    width: 54px !important;
  }

  .ar-home svg {
    display: none;
  }

  .ar-home span {
    display: inline !important;
    font-size: 12px;
  }

  .guide-step-progress,
  .ar-bottom-stack {
    box-sizing: border-box;
    max-width: 100%;
    width: 100%;
  }

  .immersive-scene .ar-cue {
    box-sizing: border-box;
    max-width: calc(100% - 32px) !important;
    width: calc(100% - 32px) !important;
  }

  .ux-photo-expand {
    right: 10px;
    top: 126px;
  }
}

@media (max-width: 350px) {
  .ar-header {
    grid-template-columns: 40px minmax(0, 1fr) 48px !important;
    gap: 4px !important;
  }

  .ar-back {
    min-width: 40px !important;
    width: 40px !important;
  }

  .ar-home {
    min-width: 48px !important;
    width: 48px !important;
  }

  .ar-destination-pill strong {
    font-size: 14px !important;
  }
}
