:root {
  --paper: #f3f0e7;
  --paper-deep: #e7e2d5;
  --ink: #17201e;
  --ink-muted: #616a65;
  --line: #cbc6b9;
  --signal: #ef542f;
  --signal-dark: #c83b1c;
  --lime: #d8ef74;
  --white: #fffdf8;
  --shadow: 0 16px 44px rgba(28, 32, 29, 0.12);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(23, 32, 30, 0.035) 1px, transparent 1px) 0 0 / 80px 80px,
    var(--paper);
  font-family: "Aptos", "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.site-shell {
  min-height: 100vh;
}

.topbar {
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: stretch;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  min-width: 66px;
  padding: 0 10px;
  background: var(--ink);
  color: var(--white);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand-copy {
  padding: 4px 0 4px 12px;
  font-size: 11px;
  line-height: 1.25;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 26px;
  font-size: 13px;
}

.open-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-muted);
}

.open-status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #49a56b;
  box-shadow: 0 0 0 4px rgba(73, 165, 107, 0.14);
}

.plain-button,
.example-room {
  border: 0;
  border-bottom: 1px solid currentColor;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.layout {
  min-height: calc(100vh - 88px);
  display: grid;
  grid-template-columns: minmax(330px, 410px) minmax(0, 1fr);
}

.route-panel {
  display: flex;
  flex-direction: column;
  padding: 42px 38px 24px;
  border-right: 1px solid var(--line);
  background: rgba(243, 240, 231, 0.92);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--signal-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 16px;
  font-size: clamp(38px, 3.2vw, 54px);
  font-weight: 650;
  letter-spacing: -0.055em;
  line-height: 0.95;
}

.lede {
  max-width: 310px;
  margin-bottom: 32px;
  color: var(--ink-muted);
  font-size: 15px;
  line-height: 1.5;
}

.route-fields {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 38px;
  gap: 12px;
  align-items: center;
}

.route-spine {
  grid-row: 1 / span 3;
  display: flex;
  height: 104px;
  align-items: center;
  flex-direction: column;
}

.spine-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.start-dot {
  background: var(--ink);
}

.end-dot {
  border: 3px solid var(--signal);
  background: var(--paper);
}

.spine-line {
  width: 1px;
  flex: 1;
  background: repeating-linear-gradient(to bottom, var(--ink-muted) 0 4px, transparent 4px 8px);
}

.field-stack {
  grid-column: 2;
}

.field-stack:first-of-type {
  grid-row: 1;
}

.field-stack:last-of-type {
  grid-row: 3;
}

.field-stack label {
  display: block;
  margin-bottom: 5px;
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.input-wrap {
  position: relative;
}

.input-wrap input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 36px 0 13px;
  color: var(--ink);
  background: var(--white);
  outline: none;
  font-size: 15px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.input-wrap input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(23, 32, 30, 0.09);
}

.clear-input {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  transform: translateY(-50%);
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  font-size: 20px;
}

.clear-input:hover {
  background: var(--paper-deep);
}

.swap-button {
  grid-column: 3;
  grid-row: 2;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--white);
  cursor: pointer;
}

.swap-button:hover {
  border-color: var(--ink);
}

.swap-button svg,
.primary-button svg,
.map-actions svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.field-hint {
  margin: 14px 0 4px 30px;
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 1.45;
}

.example-room {
  font-weight: 700;
}

.form-error {
  min-height: 18px;
  margin: 6px 0 6px 30px;
  color: var(--signal-dark);
  font-size: 12px;
  line-height: 1.4;
}

.quick-destinations {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 12px 0 4px 30px;
}

.quick-destinations > span {
  width: 100%;
  color: var(--ink-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.quick-destinations button {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 5px 9px;
  background: var(--white);
  cursor: pointer;
  font-size: 11px;
}

.quick-destinations button:hover {
  border-color: var(--ink);
  background: var(--paper-deep);
}

.accessibility-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0 18px 30px;
  cursor: pointer;
}

.accessibility-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  width: 40px;
  height: 22px;
  flex: 0 0 auto;
  border-radius: 20px;
  padding: 3px;
  background: #b8b5ab;
  transition: background 150ms ease;
}

.toggle-track span {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--white);
  transition: transform 150ms ease;
}

.accessibility-toggle input:checked + .toggle-track {
  background: var(--ink);
}

.accessibility-toggle input:checked + .toggle-track span {
  transform: translateX(18px);
}

.accessibility-toggle input:focus-visible + .toggle-track {
  outline: 3px solid rgba(23, 32, 30, 0.2);
  outline-offset: 2px;
}

.accessibility-toggle strong,
.accessibility-toggle small {
  display: block;
}

.accessibility-toggle strong {
  font-size: 13px;
}

.accessibility-toggle small {
  margin-top: 2px;
  color: var(--ink-muted);
  font-size: 11px;
}

.primary-button {
  width: calc(100% - 30px);
  height: 50px;
  margin-left: 30px;
  border: 0;
  border-radius: 3px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--white);
  background: var(--ink);
  cursor: pointer;
  font-weight: 700;
  transition: background 150ms ease, transform 150ms ease;
}

.primary-button:hover {
  background: var(--signal-dark);
}

.primary-button:active {
  transform: translateY(1px);
}

.journey-summary {
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.journey-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.journey-heading h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.03em;
}

.directions {
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: direction;
}

.directions li {
  position: relative;
  min-height: 40px;
  padding: 0 0 18px 38px;
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 1.4;
  counter-increment: direction;
}

.directions li::before {
  content: counter(direction, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: -2px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
}

.directions li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 16px;
  bottom: 2px;
  border-left: 1px dotted #9d9a91;
}

.safety-note {
  margin: auto 0 0;
  padding-top: 28px;
  color: #777c78;
  font-size: 10px;
  line-height: 1.5;
}

.map-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.map-toolbar {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
}

.floor-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
}

.floor-tab {
  position: relative;
  min-width: 42px;
  height: 38px;
  border: 0;
  border-radius: 3px;
  padding: 0 11px;
  background: transparent;
  cursor: pointer;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 750;
}

.floor-tab:first-child {
  padding-inline: 14px;
}

.floor-tab:hover {
  background: var(--paper-deep);
  color: var(--ink);
}

.floor-tab.is-active {
  color: var(--white);
  background: var(--ink);
}

.floor-tab i {
  position: absolute;
  left: 50%;
  bottom: 4px;
  display: none;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  transform: translateX(-50%);
  background: var(--signal);
}

.floor-tab.has-route i {
  display: block;
}

.floor-tab.is-active.has-route i {
  background: var(--lime);
}

.map-actions {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.map-actions button {
  width: 38px;
  height: 36px;
  border: 0;
  border-right: 1px solid var(--line);
  display: grid;
  place-items: center;
  background: var(--white);
  cursor: pointer;
  font-size: 20px;
}

.map-actions button:last-child {
  border-right: 0;
}

.map-actions button:hover {
  background: var(--paper-deep);
}

.map-viewport {
  position: relative;
  min-height: 480px;
  flex: 1;
  overflow: hidden;
  border: 1px solid #aaa79f;
  border-radius: var(--radius);
  background: #656565;
  box-shadow: var(--shadow);
  cursor: grab;
  touch-action: none;
}

.map-viewport.is-dragging {
  cursor: grabbing;
}

.map-stage {
  position: absolute;
  inset: 0;
  transform-origin: center;
  transition: transform 220ms cubic-bezier(.2,.8,.2,1);
}

.map-viewport.is-dragging .map-stage {
  transition: none;
}

#mapImage,
#routeOverlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#mapImage {
  object-fit: contain;
  user-select: none;
}

#routeOverlay {
  overflow: visible;
  pointer-events: none;
}

.route-halo {
  fill: none;
  stroke: rgba(255, 253, 248, 0.92);
  stroke-width: 16;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.route-line {
  fill: none;
  stroke: var(--signal);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 18 12;
  animation: route-flow 1.2s linear infinite;
}

.route-spur {
  stroke: rgba(255, 253, 248, 0.9);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 5 8;
}

.transition-marker circle {
  fill: var(--white);
  stroke: var(--ink);
  stroke-width: 5;
}

.transition-marker text {
  fill: var(--ink);
  font-size: 17px;
  font-weight: 800;
}

@keyframes route-flow {
  to { stroke-dashoffset: -30; }
}

.route-pin-start {
  fill: var(--ink);
  stroke: var(--white);
  stroke-width: 6;
}

.route-pin-end-ring {
  fill: rgba(239, 84, 47, 0.14);
  stroke: var(--signal);
  stroke-width: 5;
  transform-box: fill-box;
  transform-origin: center;
  animation: pin-pulse 1.8s ease-out infinite;
}

.route-pin-end {
  fill: var(--signal);
  stroke: var(--white);
  stroke-width: 6;
}

@keyframes pin-pulse {
  0% { transform: scale(.7); opacity: 1; }
  80%, 100% { transform: scale(1.75); opacity: 0; }
}

.pin-label rect {
  fill: var(--ink);
}

.pin-label text {
  fill: var(--white);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.map-status {
  position: absolute;
  left: 18px;
  bottom: 18px;
  max-width: calc(100% - 36px);
  padding: 10px 13px;
  border-radius: 4px;
  display: flex;
  gap: 10px;
  color: var(--white);
  background: rgba(23, 32, 30, 0.91);
  backdrop-filter: blur(8px);
  pointer-events: none;
  font-size: 11px;
}

.status-floor {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-detail {
  color: rgba(255,255,255,.72);
}

.map-key {
  position: absolute;
  top: 18px;
  right: 18px;
  padding: 9px 11px;
  border-radius: 4px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.91);
  backdrop-filter: blur(8px);
  font-size: 10px;
  pointer-events: none;
}

.map-key span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.map-key span + span {
  margin-top: 6px;
}

.map-key i {
  width: 15px;
  height: 6px;
  display: block;
}

.key-route {
  border-top: 3px solid var(--signal);
}

.key-estimate {
  border: 2px solid var(--signal);
  border-radius: 50%;
  background: transparent;
}

.map-caption {
  min-height: 40px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 11px 4px 0;
  color: var(--ink-muted);
  font-size: 11px;
}

.map-caption p {
  margin: 0;
}

.drag-hint {
  white-space: nowrap;
}

.help-dialog {
  width: min(500px, calc(100% - 32px));
  border: 0;
  border-radius: 6px;
  padding: 34px;
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 30px 100px rgba(0,0,0,.25);
}

.help-dialog::backdrop {
  background: rgba(23, 32, 30, 0.58);
  backdrop-filter: blur(3px);
}

.help-dialog h2 {
  margin-bottom: 22px;
  font-size: 30px;
  letter-spacing: -0.04em;
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--paper);
  cursor: pointer;
  font-size: 22px;
}

.room-code {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr 1fr;
  margin-bottom: 22px;
  border: 2px solid var(--ink);
}

.room-code span {
  padding: 18px 10px 12px;
  border-right: 1px solid var(--ink);
  text-align: center;
}

.room-code span:last-child {
  border-right: 0;
}

.room-code strong,
.room-code small {
  display: block;
}

.room-code strong {
  color: var(--signal);
  font-size: 38px;
  line-height: 1;
}

.room-code small {
  margin-top: 6px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.help-dialog > p:not(.eyebrow) {
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 1.55;
}

.dialog-note {
  margin: 18px -34px -34px;
  padding: 18px 34px;
  background: var(--paper);
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 330px minmax(0, 1fr);
  }

  .route-panel {
    padding-inline: 26px;
  }

  .map-panel {
    padding: 16px;
  }

  .map-viewport {
    min-height: 430px;
  }
}

@media (max-width: 720px) {
  .topbar {
    height: 72px;
    padding: 0 18px;
  }

  .open-status {
    display: none;
  }

  .layout {
    min-height: auto;
    display: flex;
    flex-direction: column;
  }

  .route-panel {
    border-right: 0;
    padding: 30px 20px 24px;
  }

  .route-intro h1 br {
    display: none;
  }

  .lede {
    margin-bottom: 24px;
  }

  .safety-note {
    margin-top: 26px;
  }

  .map-panel {
    min-height: 610px;
    border-top: 1px solid var(--line);
    padding: 14px 12px 18px;
  }

  .map-toolbar {
    gap: 8px;
    overflow: hidden;
  }

  .floor-tabs {
    min-width: 0;
  }

  .floor-tab {
    min-width: 36px;
    padding-inline: 8px;
  }

  .floor-tab:first-child {
    min-width: 40px;
    max-width: 40px;
    overflow: hidden;
    font-size: 0;
  }

  .floor-tab:first-child::after {
    content: "All";
    font-size: 12px;
  }

  .map-actions button {
    width: 34px;
  }

  .map-viewport {
    min-height: 390px;
  }

  .map-caption {
    align-items: flex-start;
  }

  .drag-hint {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
