:root {
  --shaft-x: 55px;
  --pill-bg: rgba(255, 255, 255, 0.86);
  --pill-border: rgba(15, 23, 42, 0.14);
  --pill-text: #0f172a;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #60a5fa;
  color: #ffffff;
  font-family: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#envCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: block;
}

/* --- Caption for the current view --- */
.milestone-label {
  position: fixed;
  bottom: clamp(88px, 15vh, 150px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  width: min(560px, calc(100% - 96px));
  text-align: center;
  pointer-events: none;
  text-shadow: 0 1px 2px #020617, 0 2px 6px #020617, 0 0 14px rgba(2, 6, 23, 0.92);
}

.milestone-title {
  font-size: clamp(1.25rem, 2.7vw, 2.4rem);
  font-weight: 800;
  line-height: 1.2;
}

.milestone-alt {
  display: block;
  margin-top: 3px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #bae6fd;
}

.milestone-fact {
  margin-top: 6px;
  font-size: clamp(0.83rem, 1.35vw, 1rem);
  font-weight: 600;
  line-height: 1.38;
  color: #f1f5f9;
}

/* --- Far-Left Vertical Elevator Shaft & Glass Car --- */
.elevator-shaft {
  position: fixed;
  top: 0;
  bottom: 0;
  left: var(--shaft-x);
  transform: translateX(-50%);
  width: 90px;
  z-index: 6;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cable-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.55);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25);
  overflow: hidden;
}

.cable-markers {
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.65) 0px,
    rgba(255, 255, 255, 0.65) 2px,
    transparent 2px,
    transparent 28px
  );
  will-change: transform;
}

.elevator-car-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease-out;
}

/* 2D Transparent Glass Elevator Box with Blue Caps */
.elevator-car {
  position: relative;
  width: 54px;
  height: 78px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  z-index: 2;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.28));
}

.car-cap {
  height: 9px;
  background: linear-gradient(180deg, #3b82f6, #1d4ed8);
  border: 2px solid #1e3a8a;
  flex-shrink: 0;
}

.car-cap-top {
  border-radius: 7px 7px 2px 2px;
}

.car-cap-bottom {
  border-radius: 2px 2px 7px 7px;
}

.car-glass {
  flex: 1;
  width: 48px;
  margin: 0 auto;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.32) 0%, rgba(186, 230, 253, 0.14) 55%, rgba(255, 255, 255, 0.24) 100%);
  border-left: 2px solid rgba(255, 255, 255, 0.8);
  border-right: 2px solid rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.car-glass::after {
  content: "";
  position: absolute;
  top: -10px;
  left: -14px;
  width: 24px;
  height: 120%;
  background: rgba(255, 255, 255, 0.22);
  transform: rotate(22deg);
  pointer-events: none;
}

.passenger-photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}

/* Passenger speech bubble */
.speech-bubble {
  position: absolute;
  left: calc(100% + 14px);
  top: 50%;
  transform: translateY(-50%) translateX(-6px) scale(0.95);
  background: #ffffff;
  color: #0f172a;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.3;
  padding: 8px 13px;
  border-radius: 14px;
  border: 2px solid #0f172a;
  width: max-content;
  max-width: 220px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transition: opacity 0.24s ease, transform 0.24s ease;
  pointer-events: none;
  z-index: 12;
}

.speech-bubble.visible {
  opacity: 1;
  transform: translateY(-50%) translateX(0) scale(1);
}

.speech-bubble::before {
  content: "";
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  border-width: 7px 9px 7px 0;
  border-style: solid;
  border-color: transparent #0f172a transparent transparent;
}

.speech-bubble::after {
  content: "";
  position: absolute;
  right: calc(100% - 2px);
  top: 50%;
  transform: translateY(-50%);
  border-width: 5px 7px 5px 0;
  border-style: solid;
  border-color: transparent #ffffff transparent transparent;
}

/* --- Minimal Top-Left Home Pill --- */
.ww-home-pill {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 25;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.2px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  color: var(--pill-text);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.16);
  transition: transform 0.16s ease, background 0.16s ease;
  line-height: 1;
}

.ww-home-pill:hover {
  background: #ffffff;
  transform: translateY(-1px);
}

.ww-home-pill .ww-logo-icon {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  display: block;
}

/* --- Minimal Top-Right Floating Toggles --- */
.top-right-pills {
  position: fixed;
  top: 14px;
  right: 22px;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  color: var(--pill-text);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.16);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.mini-pill:hover {
  background: #ffffff;
  transform: translateY(-1px);
}

.music-pill {
  width: 32px;
  padding: 0;
  font-size: 0.95rem;
}

.music-pill.playing {
  background: #dbeafe;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3), 0 3px 12px rgba(0, 0, 0, 0.18);
}

/* --- Sleek Right-Edge Interactive Scrollbar --- */
.scroll-track {
  position: fixed;
  top: 58px;
  bottom: 24px;
  right: 6px;
  width: 16px;
  z-index: 22;
  touch-action: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  cursor: pointer;
  transition: background 0.15s ease;
}

.scroll-track:hover, .scroll-track:focus-visible {
  background: rgba(255, 255, 255, 0.25);
}

.scroll-surface-mark {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.75);
  pointer-events: none;
}

.scroll-thumb {
  position: absolute;
  left: 1px;
  right: 1px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  transform: translateY(-50%);
  pointer-events: none;
}

/* --- Bottom-Center Mechanical Retro Odometer Flipper Altimeter --- */
.odometer-dock {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 24;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.odometer-frame {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: 12px;
  background: #1e293b;
  border: 2px solid #475569;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42), inset 0 2px 4px rgba(255, 255, 255, 0.12);
  pointer-events: auto;
}

.odo-sign {
  width: 18px;
  height: 36px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  background: #0f172a;
  border: 1px solid #334155;
  color: #38bdf8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1.25rem;
  font-weight: 900;
  position: relative;
}

.odo-sign.negative {
  display: flex;
}

.odo-sign::after {
  content: "-";
}

.odo-digits {
  display: flex;
  align-items: center;
  gap: 3px;
}

.odo-slot {
  width: 24px;
  height: 36px;
  border-radius: 5px;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 49%, #0b1120 51%, #111827 100%);
  border: 1px solid #334155;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Split-flap mechanical horizontal seam */
.odo-slot::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: rgba(0, 0, 0, 0.75);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.odo-num {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1.3rem;
  font-weight: 800;
  color: #f8fafc;
  line-height: 1;
  transition: transform 0.12s ease-out;
}

.odo-slot.dim .odo-num {
  color: #475569;
}

.odo-slot.flip .odo-num {
  animation: odoFlip 0.14s ease-out;
}

@keyframes odoFlip {
  0% { transform: translateY(-35%) scaleY(0.75); opacity: 0.5; }
  100% { transform: translateY(0) scaleY(1); opacity: 1; }
}

.odo-unit {
  margin-left: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.95rem;
  font-weight: 800;
  color: #94a3b8;
  min-width: 20px;
  text-align: center;
}

.scroll-hint {
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.65);
  transition: opacity 0.45s ease;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 680px) {
  :root {
    --shaft-x: 42px;
  }

  .elevator-car {
    width: 46px;
    height: 68px;
  }

  .car-glass {
    width: 40px;
  }

  .speech-bubble {
    max-width: 170px;
    font-size: 0.74rem;
    padding: 6px 10px;
  }

  .top-right-pills {
    right: 16px;
    gap: 5px;
    max-width: calc(100vw - 146px);
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .mini-pill {
    height: 29px;
    padding: 0 9px;
    font-size: 0.74rem;
  }

  .music-pill {
    width: 29px;
    padding: 0;
  }

  .odo-slot {
    width: 20px;
    height: 31px;
  }

  .odo-num {
    font-size: 1.1rem;
  }

  .odo-sign {
    width: 15px;
    height: 31px;
    font-size: 1.05rem;
  }
}

@media (max-height: 480px) {
  .milestone-label {
    bottom: 76px;
  }

  .milestone-title {
    font-size: 1.2rem;
  }
}
