:root {
  color-scheme: dark;
  --panel: rgba(16, 16, 18, 0.74);
  --text: #f3f3f3;
  --muted: #b9b9b9;
  --accent: #ffb020;
  --line: rgba(255, 255, 255, 0.4);
  --plan-size: 230px;
}

html,
body {
  margin: 0;
  height: 100%;
  background: #111;
  color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
}

#viewer {
  position: fixed;
  inset: 0;
}

/* Top-down plan of the stations (bottom-left, above the PSV navbar). */
#plan {
  position: fixed;
  left: 12px;
  bottom: 52px;
  width: var(--plan-size);
  height: var(--plan-size);
  box-sizing: border-box;
  padding: 8px;
  border-radius: 10px;
  background: var(--panel);
  backdrop-filter: blur(4px);
  z-index: 100;
}

.plan-title {
  margin-bottom: 4px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

#plan-svg {
  display: block;
  width: 100%;
  height: calc(100% - 20px);
  overflow: visible;
}

#plan-svg .link {
  stroke: var(--line);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

#plan-svg .cone {
  fill: rgba(255, 176, 32, 0.38);
}

#plan-svg .station {
  fill: #fff;
  stroke: rgba(0, 0, 0, 0.6);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  outline: none;
}

#plan-svg .station:hover,
#plan-svg .station:focus-visible {
  fill: #ffe2a8;
}

#plan-svg .station.current {
  fill: var(--accent);
}

#plan-svg .station-label {
  fill: var(--muted);
  pointer-events: none;
}

/* Laser tour: floor plan drawn from the scans, and a metre scale bar. */
#plan-svg .floorplan {
  opacity: 0.6;
  pointer-events: none;
}

#plan-svg .scale {
  stroke: #fff;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

#plan-svg .scale-label {
  fill: #fff;
}

/* Tour switch + measuring tool (bottom-right, above the PSV navbar). */
#tools {
  position: fixed;
  right: 12px;
  bottom: 52px;
  display: flex;
  gap: 8px;
  align-items: center;
  z-index: 100;
}

#tour-switch {
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--panel);
  backdrop-filter: blur(4px);
}

#tour-switch a {
  padding: 5px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

#tour-switch a:hover,
#tour-switch a:focus-visible {
  color: var(--text);
}

#tour-switch a.active {
  background: var(--accent);
  color: #1a1a1a;
  font-weight: 600;
}

#measure,
#about-open {
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

#measure[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #1a1a1a;
  font-weight: 600;
}

#measure-hint {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--panel);
  font-size: 13px;
  text-align: center;
  z-index: 100;
}

body.measuring .psv-container {
  cursor: crosshair;
}

/* Click-anywhere navigation: destination ring on the floor + its name. */
body.can-walk .psv-container {
  cursor: pointer;
}

.walk-target {
  position: relative;
  width: 0;
  height: 0;
  pointer-events: none;
}

.walk-ring {
  position: absolute;
  left: calc(var(--w) / -2);
  top: calc(var(--h) / -2);
  width: var(--w);
  height: var(--h);
  box-sizing: border-box;
  border: 3px solid rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  background: rgba(255, 176, 32, 0.22);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

/* Above the ring: below it would collide with the floor arrows. */
.walk-label {
  position: absolute;
  bottom: calc(var(--h) / 2 + 6px);
  left: 0;
  transform: translateX(-50%);
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font: 600 12px/1.3 system-ui, -apple-system, "Segoe UI", sans-serif;
  white-space: nowrap;
}

#plan-svg .station.target {
  fill: #fff;
  stroke: var(--accent);
  stroke-width: 3;
}

#walk-hint {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--panel);
  font-size: 13px;
  text-align: center;
  z-index: 100;
}

.measure-label {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font: 600 14px/1.3 system-ui, -apple-system, "Segoe UI", sans-serif;
  white-space: nowrap;
}

#help {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--panel);
  font-size: 13px;
  text-align: center;
  z-index: 100;
  transition: opacity 0.6s;
}

#help.hidden {
  opacity: 0;
  pointer-events: none;
}

/* "À propos" window. */
#about {
  width: min(560px, calc(100% - 32px));
  max-height: calc(100% - 48px);
  box-sizing: border-box;
  overflow: auto;
  padding: 22px 24px 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(20, 20, 22, 0.97);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

#about::backdrop {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
}

#about h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
}

#about p,
#about li {
  color: #e4e4e4;
  font-size: 14px;
  line-height: 1.55;
}

#about .about-sub {
  margin: 2px 0 14px;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#about ul {
  margin: 6px 0 14px;
  padding-left: 20px;
}

#about .about-note {
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: rgba(255, 176, 32, 0.09);
}

#about form {
  margin: 0;
  text-align: right;
}

.about-start {
  padding: 8px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #1a1a1a;
  font: 600 14px/1.3 system-ui, -apple-system, "Segoe UI", sans-serif;
  cursor: pointer;
}

/* Narrow screens: the floor arrows sit at the bottom centre, so move the plan
   to the top-right corner (below the hint) to keep them clear. */
@media (max-width: 760px) {
  :root {
    --plan-size: 140px;
  }

  #plan {
    top: 96px;
    right: 10px;
    bottom: auto;
    left: auto;
  }

  /* Top-left, stacked, so the tools stay clear of both the plan and the arrows. */
  #tools {
    top: 96px;
    left: 10px;
    right: auto;
    bottom: auto;
    flex-direction: column;
    align-items: flex-start;
  }

  #help {
    font-size: 12px;
  }
}
