:root {
  --text: #4b5263;
  --text-dim: #707a8a;
  --chrome: rgba(253, 253, 254, 0.86);
  --edge: rgba(255, 255, 255, 0.55);
  --accent: #33424f;
  --accent-ink: #fff;
  --btn: rgba(90, 104, 130, 0.12);
  --shadow: 0 6px 28px rgba(40, 52, 72, 0.16);
  --eta-shadow: 0 2px 14px rgba(40, 52, 72, 0.22);
}

body.night {
  --text: #fff;
  --text-dim: rgba(255, 255, 255, 0.72);
  --chrome: rgba(178, 190, 216, 0.4);
  --edge: rgba(255, 255, 255, 0.28);
  --accent: rgba(255, 255, 255, 0.35);
  --btn: rgba(255, 255, 255, 0.14);
  --shadow: 0 6px 28px rgba(0, 2, 12, 0.35);
  --eta-shadow: 0 3px 26px rgba(0, 4, 16, 0.75);
}

[hidden] { display: none !important; }

* { box-sizing: border-box; }

html, body { overscroll-behavior: none; }

body {
  margin: 0;
  overflow: hidden;
  font-family: 'Manrope', system-ui, sans-serif;
  line-height: 1.25; /* pinned: the font's 'normal' box varies by version */
  color: var(--text);
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

#view {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none; /* gestures reach the app, not the browser */
}

.frost {
  position: fixed;
  background: var(--chrome);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  border: 1px solid var(--edge);
  box-shadow: var(--shadow);
}

/* wide default: the arrival dissolves into the scene as two lines of
   display type at the left — no frost, theme ink, a soft shadow for
   contrast. The pill costume lives under the 900px query below. */
#eta {
  position: fixed;
  top: 42vh;
  left: 5vw;
  transform: translateY(-50%);
  font-size: clamp(30px, 5.3vw, 74px);
  font-weight: 800;
  line-height: 1.12;
  text-shadow: var(--eta-shadow);
  pointer-events: none; /* presentational: drags/wheel pass through to the canvas */
}

#eta span { display: block; }

#gpuNotice {
  left: 50%;
  bottom: calc(3% + 96px + env(safe-area-inset-bottom, 0px)); /* clears the dock */
  transform: translateX(-50%);
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 13.5px;
}

@media (min-width: 901px) {
  body:not(.night) #eta { color: #000; }
}

/* the map credit; its corner sits clear of every verify-suite rect */
#attrib {
  position: fixed;
  left: 10px;
  bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  font-size: 11px;
  color: var(--text-dim);
  text-shadow: var(--eta-shadow);
  pointer-events: none; /* presentational, except the link itself */
}

#attrib a { color: inherit; pointer-events: auto; }

#tab {
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  width: 30px;
  height: 116px;
  border-radius: 16px 0 0 16px;
  border-right: none;
  display: flex;
  align-items: center;
  color: var(--text-dim);
  z-index: 12;
  transition: right 0.3s;
}

#tab svg { width: 22px; height: 22px; margin-left: 5px; flex: none; }

body.menu-open #tab { right: min(320px, 88vw); }
body.menu-open #tab svg { transform: scaleX(-1); }

#dock {
  bottom: 4.2%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 20px;
  height: 82px;
  padding: 0 32px 0 13px;
  border-radius: 999px;
  white-space: nowrap;
}

.art {
  width: 56px;
  height: 56px;
  border-radius: 13px;
  background:
    radial-gradient(140% 90% at 20% 100%, #d98a4be0 10%, transparent 60%),
    linear-gradient(160deg, #e8c26b, #b45d7a 65%, #57456e);
}

.track { display: flex; flex-direction: column; min-width: 0; margin-right: 6px; }
.track b { font-size: 16px; font-weight: 600; }
.track span { font-size: 14px; color: var(--text-dim); }
.track b, .track span {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
}

button {
  border: 0;
  padding: 0;
  background: none;
  font: inherit;
  color: var(--text);
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
}

button:hover { opacity: 0.72; }
button:active { transform: scale(0.94); }

button svg { width: 26px; height: 26px; fill: currentColor; }

.round {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  justify-content: center;
}

.wide { gap: 11px; font-size: 17.5px; font-weight: 600; }

.sep { width: 1px; height: 32px; background: currentColor; opacity: 0.22; }

#signal {
  position: fixed;
  transform: translate(-50%, calc(-100% - 14px));
  width: 54px;
  padding: 6px 0;
  border-radius: 15px;
  background: rgba(252, 251, 250, 0.94);
  box-shadow: 0 4px 18px rgba(30, 36, 52, 0.3);
  display: flex;
  justify-content: center;
}

#signal::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 9px solid transparent;
  border-top: 11px solid rgba(252, 251, 250, 0.94);
}

.housing {
  background: #262b36;
  border-radius: 11px;
  padding: 7px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.lamp { width: 16px; height: 16px; border-radius: 50%; }
.lamp.red { background: #6b4a44; }
.lamp.amber { background: #7a6a3a; }
.lamp.green { background: #3f6a4e; }
.lamp.red.lit { background: #ff453a; box-shadow: 0 0 12px 1px #ff453acc; }

/* --- menu drawer, scrim, support sheet ------------------------------------- */

/* ?menu boots suppress every slide/fade for the first frame: a heavy boot
   can land the screenshot mid-transition, catching the tab in flight */
.no-anim * { transition: none !important; }

#scrim {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(15, 20, 32, 0.32);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

#scrim.open { opacity: 1; pointer-events: auto; }

#menu {
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 11;
  width: min(320px, 88vw);
  border-radius: 22px 0 0 22px;
  border-right: none;
  padding: 26px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform: translateX(105%);
  transition: transform 0.3s;
}

#menu.open { transform: none; }

#menu h2 { margin: 0 0 10px; font-size: 22px; }

.item {
  justify-content: center;
  padding: 13px 16px;
  border-radius: 14px;
  background: var(--btn);
  font-size: 16px;
  font-weight: 600;
}

.item.strong { background: var(--accent); color: var(--accent-ink); }

.legend { margin-top: auto; color: var(--text-dim); font-size: 14px; }
.legend h3 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.09em; }
.legend p { margin: 5px 0; }
.legend b { color: var(--text); font-weight: 600; }

#support {
  top: 50%;
  left: 50%;
  z-index: 13;
  width: min(360px, 86vw);
  border-radius: 22px;
  padding: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transform: translate(-50%, -50%) scale(0.96);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, transform 0.25s, visibility 0.25s;
}

#support.open {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%);
}

#support h3 { margin: 0; font-size: 20px; }
#support p { margin: 0; color: var(--text-dim); }

/* --- the ?debug data-overlay menu (view/debug.js builds it) ----------------- */

#debugMenu {
  top: 14px;
  right: 14px;
  z-index: 9; /* under the scrim and the drawer */
  width: 252px;
  /* the panel outgrows short (landscape-phone) viewports: scroll the
     lower rows into reach instead of losing them below the fold */
  max-height: calc(100vh - 28px);
  overflow-y: auto;
  border-radius: 16px;
  padding: 10px 14px;
  font-size: 12.5px;
}

#debugMenu label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  padding: 3px 0;
  cursor: pointer;
}

#debugMenu input { margin: 0 2px 0 0; accent-color: var(--accent); }
#debugMenu b { font-size: 13px; }

#debugMenu h3 {
  margin: 7px 0 1px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-dim);
}

#debugMenu .hint {
  padding: 0 5px;
  border: 1px solid var(--text-dim);
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 11px;
}

#debugMenu .seg { display: inline-flex; align-items: center; gap: 5px; }

#debugMenu .chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 15px;
  border-radius: 4px;
  background: #262b36; /* the signal housing's slate: every overlay color reads on it */
}

#debugMenu .chip i { display: block; }
#debugMenu .line { width: 13px; height: 2px; }
#debugMenu .diamond { width: 6px; height: 6px; transform: rotate(45deg); }
#debugMenu .chev { width: 0; height: 0; border: 4px solid transparent; border-right: 0; border-left: 7px solid; }
#debugMenu .ring { width: 8px; height: 8px; border: 2px solid; border-radius: 50%; }
#debugMenu .rim { width: 11px; height: 8px; border: 1.5px solid; border-radius: 2px; }
#debugMenu .pole { width: 3px; height: 10px; border-radius: 1.5px; }

/* --- narrow: the arrival dresses back down to the frosted pill -------------- */

@media (max-width: 900px) {
  #eta {
    top: 4%;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 34px;
    border-radius: 999px;
    font-size: 24px;
    font-weight: 500;
    line-height: normal;
    white-space: nowrap;
    text-shadow: none;
    background: var(--chrome);
    backdrop-filter: blur(16px) saturate(1.15);
    -webkit-backdrop-filter: blur(16px) saturate(1.15);
    border: 1px solid var(--edge);
    box-shadow: var(--shadow);
  }

  #eta span { display: inline; }
}

/* --- compact chrome on phones ---------------------------------------------- */

@media (max-width: 760px) {
  #eta { font-size: 15px; padding: 10px 22px; top: calc(2.5% + env(safe-area-inset-top, 0px)); }
  #dock { bottom: calc(12px + env(safe-area-inset-bottom, 0px)); height: 60px; gap: 11px; padding: 0 16px 0 9px; }
  .art { width: 40px; height: 40px; border-radius: 10px; }
  .track b { font-size: 13px; }
  .track span { font-size: 11.5px; }
  .track b, .track span { max-width: 84px; }
  .round { width: 40px; height: 40px; }
  button svg { width: 21px; height: 21px; }
  .wide { gap: 7px; font-size: 13.5px; }
  .sep { height: 24px; }
  #tab { width: 27px; height: 96px; }
  #tab svg { width: 20px; height: 20px; }
  /* above the dock — it spans most of a phone's width */
  #attrib { bottom: calc(78px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 480px) {
  .track { display: none; } /* keeps the dock inside a 390 px phone */
  #dock { gap: 9px; }
  #eta { font-size: 13.5px; padding: 9px 18px; }
}

/* per-track album art */
.art.art-2 {
  background:
    radial-gradient(140% 90% at 20% 100%, #5fd4c8e0 5%, transparent 60%),
    linear-gradient(160deg, #8fb8e8, #5560b0 65%, #2e3560);
}

.art.art-3 {
  background:
    radial-gradient(140% 90% at 80% 0%, #f2d98ae0 5%, transparent 55%),
    linear-gradient(200deg, #9fd8a8, #4a8a72 60%, #24443e);
}
