:root {
  --bg: #121212;
  --bg-deep: #121212;
  --surface: #121212;
  --surface-2: #121212;
  --surface-3: #121212;
  --line: rgba(229, 231, 235, 0.16);
  --line-strong: rgba(229, 231, 235, 0.28);
  --text: #F9FAFB;
  --muted: #6B7280;
  --soft: #E5E7EB;
  --accent: #2EC47A;
  --accent-soft: #2EC47A;
  --accent-2: #6EC1E4;
  --warning: #F6D365;
  --danger: #F6D365;
  --shadow: none;
  --radius: 22px;
  --font-ui: "Open Sans", Aptos, Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
button, select, input { font: inherit; }
button, select { color: inherit; }
button { cursor: pointer; }
img, svg { display: block; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed;
  left: 18px;
  top: -60px;
  z-index: 1000;
  padding: 10px 16px;
  color: var(--bg);
  background: var(--accent);
  border-radius: 10px;
  font-weight: 760;
}
.skip-link:focus { top: 18px; }

.site-header {
  min-height: 92px;
  padding: 16px clamp(22px, 3vw, 48px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(18, 18, 18, .76);
  backdrop-filter: blur(18px);
}
.brand-wrap { display: flex; align-items: center; gap: 20px; min-width: 0; }
.brand-logo { width: 196px; height: auto; max-height: 56px; flex: none; object-fit: contain; }
.header-divider { width: 1px; height: 38px; background: var(--line-strong); }
.header-kicker, .eyebrow {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.site-header h1 {
  margin: 0;
  color: var(--accent);
  font-size: clamp(22px, 1.8vw, 27px);
  line-height: 1;
  letter-spacing: -.025em;
  font-weight: 680;
}
.site-header h1 strong { margin-left: .24em; color: var(--text); font-weight: 680; }
.header-actions { display: flex; align-items: center; gap: 16px; }
.location-picker {
  display: flex;
  align-items: center;
  gap: 12px;
}
.location-picker > span {
  color: var(--accent);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
}
.location-picker select {
  min-width: 330px;
  max-width: 470px;
  height: 50px;
  padding: 0 46px 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: 0;
  color: var(--text);
  background-color: var(--surface-2);
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 680;
  line-height: 1;
  letter-spacing: -.02em;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--soft) 50%), linear-gradient(135deg, var(--soft) 50%, transparent 50%);
  background-position: calc(100% - 19px) 21px, calc(100% - 14px) 21px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.location-picker select option {
  color: var(--text);
  background: var(--surface-2);
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 680;
}
.location-picker select:focus { border-color: rgba(46,196,122,.55); box-shadow: 0 0 0 3px rgba(46,196,122,.08); }
.location-picker select:disabled { opacity: .55; }
.header-version {
  height: 40px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.demo-shell { padding: clamp(22px, 3vw, 44px); }
.comparison-grid {
  display: grid;
  grid-template-columns: minmax(300px, .72fr) minmax(440px, 1fr) minmax(280px, .62fr);
  gap: 18px;
  align-items: stretch;
}

.video-panel {
  grid-column: 1;
  grid-row: 1 / 4;
  display: flex;
  flex-direction: column;
}
.map-panel { grid-column: 2; grid-row: 1; }
.follow-panel { grid-column: 3; grid-row: 1; }
.timeline-panel { grid-column: 2 / 4; grid-row: 2; }
.recordings-section { grid-column: 2 / 4; grid-row: 3; }
.demo-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: none;
}
.panel-heading {
  min-height: 98px;
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}
.panel-heading h2, .recordings-heading h2 { margin: 0; font-size: 19px; line-height: 1.15; letter-spacing: -.025em; }
.video-heading { justify-content: flex-start; }
.panel-heading .eyebrow { margin: 7px 0 0; }

.follow-stage {
  position: relative;
  height: 500px;
  min-height: 0;
  overflow: hidden;
  background: #121212;
}
#follow-map { width: 100%; height: 100%; display: block; }
.follow-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  pointer-events: none;
}
.follow-stage.has-position .follow-empty { display: none; }
.follow-panel .panel-heading { min-height: 98px; }

.video-stage {
  position: relative;
  height: auto;
  min-height: 500px;
  flex: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,.015), transparent),
    #121212;
}
.video-stage::before,
.video-stage::after {
  content: "";
  position: absolute;
  width: 38px;
  height: 38px;
  z-index: 3;
  pointer-events: none;
  opacity: .55;
}
.video-stage::before { top: 20px; left: 20px; border-top: 2px solid var(--accent); border-left: 2px solid var(--accent); }
.video-stage::after { right: 20px; bottom: 20px; border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent); }
#active-video {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #121212;
}
.video-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
  background:
    radial-gradient(circle at 50% 45%, rgba(46,196,122,.08), transparent 33%),
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
    #121212;
  background-size: auto, 52px 52px, 52px 52px, auto;
}
.video-placeholder strong { color: var(--soft); font-size: 15px; }
.video-placeholder span { font-size: 12px; }

.map-heading { align-items: end; }
.selectors { display: flex; gap: 10px; align-items: end; }
.selectors label { display: grid; gap: 5px; }
.selectors label > span { color: var(--muted); font-size: 9px; font-weight: 760; letter-spacing: .1em; text-transform: uppercase; }
.selectors select {
  min-width: 150px;
  max-width: 235px;
  height: 38px;
  padding: 0 35px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: 0;
  color: var(--soft);
  background: var(--surface-2);
  font-size: 12px;
}
.selectors select:focus { border-color: rgba(46,196,122,.55); box-shadow: 0 0 0 3px rgba(46,196,122,.08); }
.selectors select:disabled { opacity: .55; }

.map-stage {
  position: relative;
  height: 500px;
  min-height: 0;
  overflow: hidden;
  background: #121212;
}

.position-status {
  position: absolute;
  z-index: 5;
  top: 16px;
  left: 16px;
  padding: 8px 11px;
  border: 1px solid rgba(46, 196, 122, .28);
  border-radius: 999px;
  background: rgba(18, 18, 18, .84);
  color: #E5E7EB;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
}

.map-stage.ungrounded-positioning #map-background-layer,
.map-stage.ungrounded-positioning #anchor-layer {
  opacity: .14;
}

.map-stage.ungrounded-positioning #position-layer {
  filter: drop-shadow(0 0 6px rgba(46, 196, 122, .18));
}
#anchor-map { width: 100%; height: 100%; }
.map-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 7px;
  color: var(--muted);
  text-align: center;
  pointer-events: none;
}
.map-empty strong { color: var(--soft); font-size: 15px; }
.map-empty span { font-size: 12px; }
.map-caption {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 10px;
  pointer-events: none;
}
.text-button {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--soft);
  background: rgba(18,18,18,.72);
  pointer-events: auto;
}
.text-button:hover { border-color: rgba(46,196,122,.35); }
.anchor-refinement-line { stroke: rgba(246,211,101,.55); stroke-width: 1.5; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.anchor-original-dot { fill: rgba(18,18,18,.72); stroke: rgba(246,211,101,.72); stroke-width: 2; vector-effect: non-scaling-stroke; }
.anchor-leader { stroke: rgba(159,176,198,.24); stroke-width: 1; }
.anchor-dot { fill: #121212; stroke: var(--accent); stroke-width: 3; }
.anchor-dot.vertical { fill: var(--accent-2); stroke: #E5E7EB; }
.anchor-pulse { fill: rgba(46,196,122,.07); stroke: rgba(46,196,122,.22); stroke-width: 1; }
.anchor-label-bg { fill: rgba(18, 18, 18, .86); stroke: rgba(157, 183, 215, .19); stroke-width: 1; }
.anchor-label-text { fill: #E5E7EB; font-size: 11px; font-weight: 640; }
.anchor-label-category { fill: #6B7280; font-size: 8px; text-transform: uppercase; letter-spacing: .04em; }
.anchor-group { cursor: default; }
.anchor-group:hover .anchor-label-bg { stroke: rgba(46,196,122,.55); fill: rgba(18,18,18,.96); }
.anchor-group:hover .anchor-dot { fill: var(--accent); }
.labels-hidden .anchor-label, .labels-hidden .anchor-leader { display: none; }

.timeline-panel {
  margin-top: 0;
  min-height: 74px;
  padding: 14px 18px;
  display: grid;
  grid-template-columns: auto auto minmax(180px, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #121212;
  box-shadow: none;
}
.play-button, .icon-button, .rail-button {
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  color: var(--soft);
  background: rgba(255,255,255,.025);
}
.play-button {
  width: 43px;
  height: 43px;
  border-color: rgba(46,196,122,.30);
  border-radius: 50%;
  color: var(--bg);
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
}
.play-button svg { width: 21px; height: 21px; fill: currentColor; }
.play-button:disabled, .icon-button:disabled { opacity: .35; cursor: default; }
.icon-button { width: 36px; height: 36px; border-radius: 10px; }
.icon-button svg { width: 18px; height: 18px; fill: currentColor; }
.timecode { color: var(--soft); font-variant-numeric: tabular-nums; font-size: 12px; }
.timeline-wrap { position: relative; display: grid; align-items: center; height: 28px; }
#timeline {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 28px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.timeline-wrap::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 99px;
  background: #6B7280;
}
.timeline-fill {
  position: absolute;
  left: 0;
  width: 0;
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent));
  box-shadow: 0 0 14px rgba(46,196,122,.18);
}
.timeline-fill::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border: 3px solid var(--bg);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.timeline-label { color: var(--muted); font-size: 10px; white-space: nowrap; text-transform: uppercase; letter-spacing: .08em; }

#timeline:active { cursor: grabbing; }
#timeline:focus-visible + .timeline-fill::after {
  box-shadow: 0 0 0 1px var(--accent), 0 0 0 5px rgba(46,196,122,.15);
}

.recordings-section { padding: 0 0 8px; }
.recordings-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 16px; }
.rail-controls { display: flex; gap: 8px; }
.rail-button { width: 37px; height: 37px; border-radius: 10px; font-size: 17px; }
.rail-button:hover, .icon-button:hover { border-color: rgba(46,196,122,.42); color: var(--accent); }
.recording-rail {
  min-height: 108px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 12px;
  scroll-snap-type: x proximity;
  scrollbar-color: rgba(159,176,198,.32) transparent;
  scrollbar-width: thin;
}
.recording-card {
  position: relative;
  flex: 0 0 72px;
  height: 72px;
  padding: 0;
  display: grid;
  grid-template-rows: 72px 0;
  overflow: hidden;
  scroll-snap-align: start;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--text);
  background: rgba(255,255,255,.014);
  text-align: center;
  transition: flex-basis .18s ease, height .18s ease, border-color .18s ease, background .18s ease, transform .18s ease;
}
.recording-card:hover { transform: translateY(-2px); border-color: rgba(46,196,122,.34); }
.recording-card.selected {
  flex-basis: 92px;
  height: 102px;
  grid-template-rows: 72px 30px;
  border-color: rgba(46,196,122,.68);
  background: rgba(46,196,122,.055);
}
.recording-visual {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 65% 30%, rgba(46,196,122,.14), transparent 35%),
    #121212;
}
.recording-grid {
  position: absolute;
  inset: 0;
  opacity: .4;
  background-image:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 18px 18px;
  transform: perspective(150px) rotateX(56deg) scale(1.5) translateY(10px);
}
.recording-play {
  position: relative;
  z-index: 2;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  padding-left: 2px;
  border: 1px solid rgba(46,196,122,.44);
  border-radius: 50%;
  color: var(--bg);
  background: var(--accent);
  font-size: 7px;
}
.recording-index {
  position: absolute;
  left: 7px;
  bottom: 5px;
  z-index: 2;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}
.recording-current-copy {
  display: none;
  min-width: 0;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  color: #121212;
  background: var(--accent);
  font-size: 10px;
  line-height: 1;
}
.recording-card.selected .recording-current-copy { display: flex; }
.recording-current-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 760; }
.quiet-message { min-height: 18px; margin: 5px 2px 0; color: var(--muted); font-size: 10px; }

.loading-shimmer { animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }

@media (max-width: 1120px) {
  .comparison-grid { grid-template-columns: 1fr; }
  .video-panel, .map-panel, .follow-panel, .timeline-panel, .recordings-section {
    grid-column: 1;
    grid-row: auto;
  }
  .video-stage, .follow-stage, .map-stage { height: 460px; min-height: 0; flex: none; }
  #anchor-map { height: 100%; min-height: 0; }
}
@media (max-width: 760px) {
  .site-header { align-items: flex-start; flex-direction: column; gap: 14px; }
  .header-divider { display: none; }
  .brand-wrap { gap: 12px; }
  .brand-logo { width: 170px; max-height: 50px; }
  .site-header h1 { font-size: 19px; }
  .header-actions { width: 100%; align-items: center; }
  .location-picker { flex: 1; min-width: 0; }
  .location-picker select { width: 100%; min-width: 0; max-width: none; }
  .header-version { flex: none; }
  .demo-shell { padding: 16px; }
  .panel-heading, .map-heading { align-items: flex-start; flex-direction: column; }
  .video-stage, .follow-stage, .map-stage { height: 390px; min-height: 0; }
  #anchor-map { height: 100%; min-height: 0; }
  .timeline-panel { grid-template-columns: auto auto 1fr auto; gap: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.floor-background-image {
  filter: grayscale(1) contrast(.94) brightness(.86);
  pointer-events: none;
}

.map-toggle-group {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  pointer-events: auto;
}
.text-button[aria-pressed="true"] {
  border-color: rgba(46,196,122,.55);
  color: #E5E7EB;
  background: rgba(46,196,122,.10);
}
.embedding-match-marker { pointer-events: none; }
.embedding-match-halo {
  fill: rgba(18,18,18,.88);
  stroke: rgba(18,18,18,.98);
  stroke-width: 8;
  vector-effect: non-scaling-stroke;
}
.embedding-match-dot {
  stroke: #121212;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}
.embedding-match-rank {
  fill: #121212;
  font-size: 10px;
  font-weight: 850;
  text-anchor: middle;
  dominant-baseline: central;
}
.embedding-match-label-bg {
  fill: rgba(18,18,18,.92);
  stroke: rgba(255,255,255,.18);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.embedding-match-label {
  fill: #F9FAFB;
  font-size: 10px;
  font-weight: 700;
}
.embedding-match-subtitle {
  fill: #6B7280;
  font-size: 8px;
}
.embedding-walk-count {
  fill: #121212;
  font-size: 9px;
  font-weight: 850;
  text-anchor: middle;
  dominant-baseline: central;
}
@media (max-width: 760px) {
  .map-caption { align-items: flex-end; }
  .map-toggle-group { max-width: 62%; }
}

/* Semantic-map v3 geometry is drawn directly in each authoritative floor image's
   native pixel frame. Regions remain translucent so source-map detail stays readable. */
.semantic-region-group { pointer-events: none; }
.semantic-region-polygon {
  fill: rgba(246, 211, 101, .10);
  stroke: rgba(246, 211, 101, .72);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.semantic-region-group:nth-child(even) .semantic-region-polygon {
  fill: rgba(46, 196, 122, .08);
  stroke: rgba(46, 196, 122, .60);
}
.semantic-region-label-bg {
  fill: rgba(18, 18, 18, .82);
  stroke: rgba(246, 211, 101, .30);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.semantic-region-label-text {
  fill: #F9FAFB;
  font-size: 10px;
  font-weight: 720;
}

.vertical-transition-group { pointer-events: none; }
.vertical-transition-halo {
  fill: rgba(110, 193, 228, .12);
  stroke: rgba(229, 231, 235, .70);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.vertical-transition-marker {
  fill: rgba(110, 193, 228, .92);
  stroke: #F9FAFB;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.vertical-transition-label-bg {
  fill: rgba(18,18,18,.90);
  stroke: rgba(229,231,235,.36);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.vertical-transition-label-text { fill: #F9FAFB; font-weight: 720; }
#vertical-transition-layer.labels-hidden .vertical-transition-label { display: none; }
.map-stage.ungrounded-positioning #vertical-transition-layer { opacity: .14; }

#semantic-region-layer.regions-hidden { display: none; }
.map-stage.ungrounded-positioning #semantic-region-layer { opacity: .14; }

/* Product-demo position animation */
.position-target-arm,
.position-target-heading {
  fill: none;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.position-trail-dot {
  fill: #2EC47A;
  stroke: rgba(18,18,18,.72);
  vector-effect: non-scaling-stroke;
  shape-rendering: geometricPrecision;
}
.position-target-pulse {
  fill: rgba(46,196,122,.12);
  stroke: rgba(46,196,122,.62);
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 8px rgba(46,196,122,.36));
}
.position-target-animated {
  transform-box: fill-box;
  transform-origin: center;
}
.position-target-ring {
  fill: rgba(18,18,18,.76);
  stroke: #2EC47A;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 5px rgba(46,196,122,.46));
}
.position-target-arm { stroke: #E5E7EB; vector-effect: non-scaling-stroke; }
.position-target-core {
  fill: #F9FAFB;
  stroke: #2EC47A;
  stroke-width: 1.33;
  vector-effect: non-scaling-stroke;
}
.position-target-heading {
  stroke: #f6d365;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 3px rgba(246,211,101,.42));
}

/* Demo surface intentionally suppresses research/debug metadata. */
.position-status { display: none !important; }


/* Demo map is intentionally bitmap-only apart from the synchronized position. */
#semantic-region-layer,
#vertical-transition-layer,
#anchor-layer,
#embedding-match-layer { display: none !important; }

.site-footer {
  padding: 22px clamp(22px, 3vw, 48px) 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
}
.site-footer p { margin: 2px 0; }
.site-footer strong { color: var(--soft); font-weight: 650; }
.site-footer .footer-note { color: var(--muted); font-style: italic; }
