html,
body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  width: 100%;
  height: 100%;
  background: #000;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  pointer-events: none; /* let taps pass through to WebXR select */
}
/* Enter AR button, borrowed from https://github.com/immersive-web/webxr-samples/ */
#enter-ar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  border-radius: 999px;
  border: none;
  background: #2563eb;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  z-index: 10;
  pointer-events: auto;
}

#enter-ar[disabled] {
  background: #4b5563;
  cursor: not-allowed;
}

/* Full-screen tap capture for AR (fallback when WebXR select doesn’t fire) */
#tap-capture {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: auto;
}

.trip-details {
  position: fixed;
  top: auto;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  left: auto;
  right: calc(12px + env(safe-area-inset-right, 0px));
  width: max-content;
  max-width: min(320px, calc(100vw - 24px - env(safe-area-inset-right, 0px) - env(safe-area-inset-left, 0px)));
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.92);
  color: #e5e7eb;
  font-size: 13px;
  line-height: 1.35;
  text-align: right;
  pointer-events: none;
  z-index: 11;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.trip-details.visible {
  opacity: 1;
  visibility: visible;
}

#trip-filter {
  position: fixed;
  top: 48px;
  left: 16px;
  z-index: 11;
  background: rgba(15,23,42,0.9);
  color: #e5e7eb;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: auto;
}

.trip-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.trip-date {
  min-width: 48px;
  font-weight: 600;
  color: #93c5fd;
}

#trip-031-label,
#trip-0401-label {
  font-size: 11px;
  min-width: 80px;
}

#trip-031-prev,
#trip-031-next,
#trip-0401-prev,
#trip-0401-next {
  background: rgba(31,41,55,1);
  color: #e5e7eb;
  border: none;
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 11px;
  cursor: pointer;
}

#compare-duration-btn {
  position: fixed;
  top: 152px;
  left: 16px;
  z-index: 11;
  background: rgba(15,23,42,0.9);
  color: #e5e7eb;
  padding: 10px 18px;
  border-radius: 999px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  min-height: 44px;
  cursor: pointer;
  pointer-events: auto;
}

#visibility-toggles {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 11;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: min(100vw - 32px, 280px);
  pointer-events: auto;
}

.visibility-toggle {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(15, 23, 42, 0.8);
  color: #e5e7eb;
  font-size: 12px;
  font-weight: 600;
  backdrop-filter: blur(10px);
  cursor: pointer;
  pointer-events: auto;
  min-height: 40px;
}

.visibility-toggle.off {
  opacity: 0.5;
  border-color: rgba(255, 255, 255, 0.15);
}

#event-date-filter {
  position: fixed;
  top: 212px;
  left: 16px;
  z-index: 11;
  background: rgba(15,23,42,0.9);
  color: #e5e7eb;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
}

#event-date-label {
  font-size: 11px;
  font-weight: 500;
}

#event-date-prev,
#event-date-next {
  background: rgba(31,41,55,1);
  color: #e5e7eb;
  border: none;
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 11px;
  cursor: pointer;
}

#instructions {
  position: fixed;
  top: 16px;
  left: 16px;
  right: 16px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  color: #f9fafb;
  font-size: 12px;
  backdrop-filter: blur(8px);
  z-index: 10;
  text-align: center;
  line-height: 1.3;
  pointer-events: none;
}

#unsupported {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: #020617;
  color: #e5e7eb;
  padding: 24px;
  text-align: center;
  font-size: 15px;
}

#placement-toggle {
  position: fixed;
  bottom: 24px;
  right: 16px;
  padding: 8px 14px;
  border-radius: 999px;
  border: none;
  background: rgba(15, 23, 42, 0.8);
  color: #e5e7eb;
  font-size: 13px;
  font-weight: 500;
  backdrop-filter: blur(10px);
  cursor: pointer;
  z-index: 11;
  display: none;
  pointer-events: auto;
}

#center-reticle {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 26px;
  height: 26px;
  margin-left: -13px;
  margin-top: -13px;
  border: 2px solid rgba(255, 255, 255, 0.5); /* alpha value sets transparency */
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  z-index: 12;
  display: none;
}
#center-reticle::before,
#center-reticle::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.5); /* alpha value sets transparency */
}
#center-reticle::before {
  left: 50%;
  top: 2px;
  width: 2px;
  height: 22px;
  transform: translateX(-50%);
}
#center-reticle::after {
  top: 50%;
  left: 2px;
  width: 22px;
  height: 2px;
  transform: translateY(-50%);
}

/* Wider screens / tablets: larger trip picker (easier to tap) */
@media (min-width: 600px) {
  #trip-filter {
    top: 52px;
    left: 20px;
    padding: 18px 22px;
    border-radius: 16px;
    font-size: 17px;
    gap: 14px;
  }

  .trip-row {
    gap: 14px;
    min-height: 54px;
  }

  .trip-date {
    min-width: 64px;
    font-size: 17px;
  }

  #trip-031-label,
  #trip-0401-label {
    font-size: 17px;
    min-width: 168px;
    text-align: center;
  }

  #trip-031-prev,
  #trip-031-next,
  #trip-0401-prev,
  #trip-0401-next {
    min-width: 54px;
    min-height: 54px;
    padding: 0;
    font-size: 20px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Below trip panel: top 52 + panel height (~158px) */
  #compare-duration-btn {
    top: 226px;
    left: 20px;
    padding: 14px 26px;
    font-size: 16px;
    min-height: 52px;
  }

  #event-date-filter {
    top: 298px;
    left: 20px;
    padding: 12px 18px;
    font-size: 16px;
    gap: 12px;
    min-height: 54px;
  }

  #event-date-label {
    font-size: 16px;
    min-width: 120px;
    text-align: center;
  }

  #event-date-prev,
  #event-date-next {
    min-width: 52px;
    min-height: 52px;
    padding: 0;
    font-size: 18px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* Landscape: UI along edges so center stays clear for the map */
@media (orientation: landscape) {
  #instructions {
    top: 8px;
    left: 8px;
    right: auto;
    max-width: 42%;
    padding: 4px 8px;
    font-size: 11px;
    text-align: left;
  }

  #event-date-filter {
    top: 50%;
    left: 8px;
    transform: translateY(-50%);
    flex-direction: column;
    gap: 4px;
  }

  #compare-duration-btn {
    top: auto;
    bottom: 96px;
    left: 8px;
    min-height: 44px;
  }

  #visibility-toggles {
    top: 8px;
    right: 8px;
    max-width: min(100vw - 16px, 260px);
  }

  #enter-ar {
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 18px;
    font-size: 14px;
  }

  #placement-toggle {
    top: 50%;
    right: 8px;
    bottom: auto;
    transform: translateY(-50%);
    padding: 6px 12px;
    font-size: 12px;
  }

  .trip-details {
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    right: calc(8px + env(safe-area-inset-right, 0px));
    max-width: min(280px, calc(100vw - 100px - env(safe-area-inset-right, 0px)));
    font-size: 12px;
  }
}

/* Tablet landscape: sample-point strip is a column; keep comfortable spacing */
@media (min-width: 600px) and (orientation: landscape) {
  #event-date-filter {
    gap: 10px;
  }
}