:root {
  --bg: #0d1117;
  --main: #508fce;
  --line: #ff5a4d;
  --ink: #f5f7fa;
  --purple: #a78bfa;
  --dim: #8b949e;
  --soft: #c9d1d9;
  --card: #161b22;
  --edge: rgba(240, 246, 252, 0.1);
  --danger: #f85149;
  --font-display: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ring: clamp(34px, 25px + 1.5vw, 52px);
  --stroke: calc(var(--ring) * 8 / 44);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
button,
label,
.title,
.subtitle,
.menu-label,
.app-name {
  font-family: var(--font-display);
}

.stage {
  width: min(92vw, 1240px);
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  align-items: center;
  margin: 0 auto;
  padding: calc(var(--ring) * 2 + 8px) 0 40px;
}

.corner-mark {
  top: calc(var(--ring) * 24 / 44);
  left: calc(var(--ring) * 24 / 44);
}

.corner-mark img {
  width: calc(var(--ring) * 36 / 44);
  height: calc(var(--ring) * 36 / 44);
}

.menu {
  position: fixed;
  top: calc(var(--ring) * 24 / 44);
  right: calc(var(--ring) * 24 / 44);
  z-index: 10;
  pointer-events: none;
}

.menu::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  border-radius: 28px;
  background: rgba(13, 17, 23, 0.9);
  box-shadow: 0 0 24px 18px rgba(13, 17, 23, 0.9);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.menu.open::before {
  opacity: 1;
}

.menu-svg {
  width: calc(var(--ring) * 160 / 44);
  height: auto;
  display: block;
  overflow: visible;
  pointer-events: none;
}

.menu-line,
.menu-toggle-ring,
.menu-stop,
.menu-bars line {
  fill: none;
  stroke: var(--main);
  stroke-linecap: round;
}

.menu-line {
  stroke-width: 8;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 0.5s ease;
}

.menu.open .menu-line {
  stroke-dashoffset: 0;
}

.menu-toggle-ring,
.menu-stop {
  fill: var(--bg);
  stroke-width: 8;
}

.menu-toggle {
  cursor: pointer;
  pointer-events: auto;
}

.menu-toggle:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 4px;
  border-radius: 50%;
}

.menu-bars line {
  stroke-width: 3;
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.menu.open .bar-top {
  transform: translateY(6px) rotate(45deg);
}

.menu.open .bar-mid {
  opacity: 0;
}

.menu.open .bar-bot {
  transform: translateY(-6px) rotate(-45deg);
}

.menu-stop {
  opacity: 0;
  transform: scale(0);
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s ease;
}

.menu.open .menu-stop {
  opacity: 1;
  transform: scale(1);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) var(--d),
    opacity 0.35s ease var(--d);
}

.menu.open.ready .menu-stop,
.menu.open.ready .menu-label {
  transition-delay: 0s;
}

.menu-label {
  fill: var(--ink);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.menu.open .menu-label {
  opacity: 1;
  transition: opacity 0.35s ease var(--d);
}

.menu-item {
  text-decoration: none;
  pointer-events: none;
}

.menu-item:nth-child(1) {
  --d: 0.15s;
}

.menu-item:nth-child(2) {
  --d: 0.27s;
}

.menu-item:nth-child(3) {
  --d: 0.39s;
}

.menu-item:nth-child(4) {
  --d: 0.51s;
}

.menu.open .menu-item {
  pointer-events: auto;
}

.title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35em;
  margin: 0 0 4px;
  font-size: clamp(1.8rem, 5vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.title-mark {
  width: 1.15em;
  height: 1.15em;
  border-radius: 22%;
}

.subtitle {
  margin: 10px 0 0;
  text-align: center;
  font-weight: 500;
  font-size: clamp(0.95rem, 1.8vw, 1.1rem);
  color: var(--dim);
}

.hero {
  display: grid;
  gap: clamp(32px, 5vw, 96px);
}

.hero-main {
  position: relative;
  justify-self: center;
  width: min(100%, 460px);
}

.line {
  --icon: clamp(68px, 20vw, 88px);
  --gap: clamp(20px, 3.6svh, 32px);
  display: grid;
  gap: var(--gap);
  margin: clamp(24px, 6svh, 56px) 0 0;
  padding: 0;
  list-style: none;
}

.stop {
  position: relative;
}

.stop:not(:last-child)::before {
  content: '';
  position: absolute;
  left: calc(var(--ring) / 2);
  top: calc(var(--icon) / 2);
  width: var(--stroke);
  height: calc(100% + var(--gap));
  border-radius: 99px;
  background: var(--main);
  transform-origin: top;
}

.stop-link {
  display: grid;
  grid-template-columns: calc(var(--ring) + var(--stroke)) var(--icon) minmax(0, 1fr);
  column-gap: clamp(12px, 3.5vw, 22px);
  align-items: start;
  color: inherit;
  text-decoration: none;
  border-radius: 20px;
}

.stop-link:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 8px;
}

.stop-ring {
  position: relative;
  z-index: 1;
  aspect-ratio: 1;
  margin-top: calc((var(--icon) - var(--ring) - var(--stroke)) / 2);
  border: var(--stroke) solid var(--main);
  border-radius: 50%;
  background: var(--bg);
  transition: transform 0.25s ease;
}

.stop-ring::after {
  content: '';
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: var(--main);
  transform: scale(0);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.stop.is-showing .stop-ring::after {
  transform: scale(1);
}

.stop-icon {
  display: block;
  width: var(--icon);
  height: var(--icon);
  border-radius: 22%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  transition: transform 0.25s ease;
}

.stop-link:hover .stop-ring,
.stop-link:focus-visible .stop-ring {
  transform: scale(1.2);
}

.stop-link:hover .stop-icon,
.stop-link:focus-visible .stop-icon {
  transform: scale(1.06);
}

.stop-text {
  align-self: center;
  display: grid;
  gap: 6px;
}

.stop-name {
  font-family: var(--font-display);
  font-size: clamp(1rem, 0.86rem + 0.5vw, 1.3rem);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.stop-desc {
  color: var(--dim);
  font-size: clamp(0.88rem, 0.8rem + 0.3vw, 1.08rem);
  line-height: 1.35;
  text-wrap: balance;
}

@media (prefers-reduced-motion: no-preference) {
  .stop:not(:last-child)::before {
    animation: line-draw 0.6s cubic-bezier(0.45, 0, 0.55, 1) 0.1s backwards;
  }
  .stop-ring {
    animation: ring-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
  }
  .stop:nth-child(2) .stop-ring {
    animation-delay: 0.55s;
  }
  .stop-text {
    animation: text-in 0.45s ease-out 0.2s backwards;
  }
  .stop:nth-child(2) .stop-text {
    animation-delay: 0.45s;
  }
  body[data-lines] .menu-toggle-ring {
    transform-box: fill-box;
    transform-origin: center;
    animation: ring-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s backwards;
  }
}

@keyframes line-draw {
  from { transform: scaleY(0); }
}

@keyframes ring-pop {
  from { transform: scale(0); }
}

@keyframes text-in {
  from { opacity: 0; transform: translateY(6px); }
}

/* ---------------------------------------------------------------------------
   Sign in, on the home page: a card that comes up from the bottom.
   --------------------------------------------------------------------------- */

.signin-sheet {
  position: fixed;
  inset: auto 0 0 0;
  width: min(100%, 440px);
  max-width: none;
  margin: 0 auto;
  padding: 30px 28px calc(30px + env(safe-area-inset-bottom));
  border: 1px solid var(--edge);
  border-bottom: 0;
  border-radius: 32px 32px 0 0;
  background: var(--card);
  color: var(--ink);
  text-align: center;
  box-shadow: 0 -24px 70px rgba(0, 0, 0, 0.55);
  transform: translateY(105%);
  transition: transform 0.38s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.signin-sheet.is-up {
  transform: none;
}

.signin-sheet::backdrop {
  background: rgba(5, 8, 12, 0);
  transition: background 0.38s ease;
}

.signin-sheet.is-up::backdrop {
  background: rgba(5, 8, 12, 0.6);
}

.sheet-title {
  margin: 0 0 24px;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  text-transform: uppercase;
}

.signin-sheet .apple-button {
  width: 100%;
  max-width: 320px;
}

.sheet-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 3px solid var(--main);
  border-radius: 50%;
  background: var(--bg);
  cursor: pointer;
  transition: background 0.25s ease;
}

.sheet-close svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--main);
  stroke-width: 2.6;
  stroke-linecap: round;
  transition: stroke 0.25s ease;
}

.sheet-close:hover {
  background: var(--main);
}

.sheet-close:hover svg {
  stroke: var(--bg);
}

.sheet-close:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 3px;
}

/* ---------------------------------------------------------------------------
   The display beside the line: small moving pictures of each app, drawn over the
   real Bay (scenes/*.svg, which preview.js brings in on wide screens).
   --------------------------------------------------------------------------- */

.preview {
  display: none;
  min-width: 0;
}

.preview-screen {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  isolation: isolate;
  border-radius: clamp(28px, 2.8vw, 44px);
  background: #16254d;
  box-shadow: 0 0 0 1px rgba(240, 246, 252, 0.14), 0 30px 80px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.5s ease;
}

.preview.is-ready .preview-screen {
  opacity: 1;
}

.scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.7s ease, visibility 0s 0.7s;
}

.scene.is-active {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.7s ease;
}

.scene-apple,
.scene-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.scene-art {
  pointer-events: none;
}

/* The drawn map gives way once Apple's is under it. */
.pv-base {
  transition: opacity 0.9s ease;
}

.scene.has-apple .pv-base {
  opacity: 0;
}

.scene text {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.scene-game text {
  font-family: var(--font-display);
}

.pv-water { fill: #16254d; }
.pv-land { fill: #262a31; fill-rule: evenodd; }
.pv-park { fill: #1d3f35; fill-rule: evenodd; }

.pv-street,
.pv-road,
.pv-hwy,
.pv-case,
.pv-rail,
.pv-run,
.pv-bar {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pv-street { stroke: rgba(255, 255, 255, 0.07); stroke-width: 0.8; }
.pv-road { stroke: #3a3f48; stroke-width: 1.4; }
.pv-hwy { stroke: #4a505b; stroke-width: 2.4; }
.pv-case { stroke: #17202d; stroke-width: 4.3; }
.pv-rail { stroke-width: 2.6; }
.pv-rail.is-faint { opacity: 0.3; }
.pv-case.is-ride { stroke-width: 8; }
.pv-rail.is-ride { stroke-width: 4.5; }
.pv-run { stroke: none; }

.scene-game .pv-street { stroke: rgba(255, 255, 255, 0.1); stroke-width: 1; }
.scene-game .pv-road { stroke-width: 2; }
.scene-game .pv-hwy { stroke-width: 3; }

.pv-stops circle {
  fill: #fff;
  stroke: #17202d;
  stroke-width: 1.2;
}

.pv-place {
  fill: rgba(244, 244, 245, 0.85);
  font-size: 12px;
  font-weight: 600;
  paint-order: stroke;
  stroke: rgba(20, 23, 28, 0.85);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.pv-place.is-small { fill: rgba(244, 244, 245, 0.6); font-size: 8.5px; letter-spacing: 0.04em; }
.pv-place.is-stop { font-size: 10.5px; }

.pv-veh rect {
  stroke: rgba(255, 255, 255, 0.5);
  stroke-width: 1;
}

.pv-veh text {
  fill: #fff;
  font-size: 9.5px;
  font-weight: 800;
  text-anchor: middle;
}

.pv-veh .pv-veh-late {
  font-size: 6.5px;
  font-weight: 600;
  opacity: 0.9;
}

.pv-veh text.is-dark { fill: #111; }
.pv-veh.is-bus { opacity: 0.72; }
.pv-veh.is-bus text { font-size: 8px; }
.pv-veh.is-bus .pv-veh-late { font-size: 5.5px; }
.pv-veh.is-picked rect { stroke: #fff; stroke-width: 2; }
.pv-veh.is-picked text { font-size: 11px; }
.pv-veh.is-picked .pv-veh-late { font-size: 7.5px; }

.pv-sheet {
  fill: rgba(31, 38, 58, 0.93);
  stroke: rgba(255, 255, 255, 0.12);
}

.pv-tile-back { fill: rgba(36, 38, 44, 0.94); }
.pv-tile { fill: rgba(0, 153, 216, 0.22); stroke: rgba(255, 255, 255, 0.1); }
.pv-tile-title { fill: rgba(244, 244, 245, 0.92); font-size: 13.5px; font-weight: 600; }
.pv-tile-sub { fill: rgba(244, 244, 245, 0.55); font-size: 10.5px; font-weight: 500; }

.pv-badge { font-size: 17px; font-weight: 800; text-anchor: middle; }
.pv-h { fill: #f4f4f5; font-size: 12.5px; font-weight: 600; }
.pv-title { fill: #f4f4f5; font-size: 15px; font-weight: 700; }
.pv-sub { fill: rgba(244, 244, 245, 0.7); font-size: 10.5px; font-weight: 500; }
.pv-dim { fill: rgba(244, 244, 245, 0.5); font-size: 10px; font-weight: 500; }
.pv-b { fill: #f4f4f5; font-size: 11px; font-weight: 600; }
.pv-count { fill: #f4f4f5; font-size: 24px; font-weight: 700; }
.pv-count-unit { fill: rgba(244, 244, 245, 0.6); font-size: 11px; font-weight: 600; }

.pv-bar { stroke-width: 5; }
.pv-bar.is-track { stroke: rgba(255, 255, 255, 0.18); }
.pv-bar-fill { stroke-dasharray: 100; stroke-dashoffset: 42; }
.pv-go-fill { stroke-dasharray: 100; stroke-dashoffset: 50; }

.pv-origin { fill: #fff; stroke: #17202d; stroke-width: 2; }
.pv-goal { fill: #ed1c24; stroke: #fff; stroke-width: 2; }
.pv-goal-ring { fill: rgba(237, 28, 36, 0.3); }

.pv-zone { fill-opacity: 0.25; stroke-width: 2; stroke-linejoin: round; }

.pv-bound {
  fill: none;
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 2;
  stroke-dasharray: 8 5;
}

.pv-flag path { stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pv-player { stroke: #fff; stroke-width: 1.8; }
.pv-player.is-me { stroke-width: 3; }
.pv-me-pulse { fill: none; stroke: #0a84ff; stroke-width: 2; opacity: 0; }

.pv-name,
.pv-tag {
  fill: #fff;
  font-size: 8.5px;
  font-weight: 700;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(20, 23, 28, 0.85);
  stroke-width: 2.5px;
  stroke-linejoin: round;
}

.pv-tag { fill: rgba(255, 255, 255, 0.82); font-weight: 500; font-size: 8px; }

.pv-glass { fill: rgba(24, 30, 52, 0.82); stroke: rgba(255, 255, 255, 0.14); }
.pv-ico { fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pv-ico.is-solid { fill: #fff; }
.pv-hud-text { fill: #fff; font-size: 11.5px; font-weight: 500; }
.pv-hud-strong { fill: #fff; font-size: 15px; font-weight: 500; }
.pv-hud-sub { fill: rgba(255, 255, 255, 0.5); font-size: 12.5px; font-weight: 500; }

.pv-pulse,
.pv-goal-ring,
.pv-me-pulse {
  transform-box: fill-box;
  transform-origin: center;
}

@media (prefers-reduced-motion: no-preference) {
  .scene.is-active .pv-bar-fill { animation: pv-bar 30s linear infinite; }
  .scene.is-active .pv-go-fill { animation: pv-go-fill 16s linear infinite; }
  .scene.is-active .pv-pulse { animation: pv-pulse 1.8s ease-in-out infinite; }
  .scene.is-active .pv-goal-ring { animation: pv-ring 2.2s ease-out infinite; }
  .scene.is-active .pv-me-pulse { animation: pv-ring 2s ease-out infinite; }
}

@keyframes pv-bar {
  from { stroke-dashoffset: 46; }
  to { stroke-dashoffset: 30; }
}

@keyframes pv-go-fill {
  from { stroke-dashoffset: 100; }
  to { stroke-dashoffset: 0; }
}

@keyframes pv-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@keyframes pv-ring {
  0% { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(2.1); opacity: 0; }
}

@media (min-width: 601px) and (max-width: 899px) {
  .hero-main {
    width: min(100%, 520px);
  }
  .line {
    --icon: 96px;
  }
}

@media (min-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }
  .hero-main {
    justify-self: start;
    width: min(100%, 560px);
  }
  .hero-main .title {
    justify-content: flex-start;
  }
  .hero-main .subtitle {
    text-align: left;
  }
  .line {
    --icon: clamp(88px, 7vw, 120px);
    --gap: clamp(24px, 4.5svh, 44px);
  }
  .preview {
    --wide: min((100svh - 150px) * 5 / 6, 700px, 46vw);
    display: block;
    width: var(--wide);
    height: calc(var(--wide) * 6 / 5);
  }
}

@media (min-width: 1600px) {
  .stage {
    width: min(88vw, 1560px);
  }
}

@media (max-height: 480px) and (max-width: 899px) {
  .stage {
    padding: calc(var(--ring) + 20px) 0 16px;
  }
  .line {
    --icon: 64px;
    --gap: 20px;
    margin-top: 16px;
  }
}

.about {
  min-height: 100vh;
  width: min(92vw, 1000px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0 16px;
  transition: opacity 0.7s ease, transform 0.7s ease;
  text-align: center;
}

.about-content {
  max-width: 700px;
  text-align: left;
}

.about h2 {
  margin: 0 0 20px;
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--main);
}

.about p {
  margin: 0 0 14px;
  font-size: clamp(0.9rem, 1.4vw, 1.05rem);
  line-height: 1.6;
  color: #c9d1d9;
}
.about a {
  color: var(--main);
  text-decoration: none;
}

.about a:hover {
  text-decoration: underline;
}

.about .about-sign {
  margin-top: 24px;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
}

.about .about-small {
  font-size: clamp(0.82rem, 1.2vw, 0.92rem);
  color: var(--dim);
}


/* ---------------------------------------------------------------------------
   Our apps: a small App Store page for each, between the line and About.
   --------------------------------------------------------------------------- */

.app-pages {
  width: min(92vw, 1080px);
  margin: 0 auto;
  padding: 24px 0 40px;
  display: flex;
  flex-direction: column;
  gap: 72px;
}

.app-page {
  position: relative;
  padding: 36px;
  border: 1px solid var(--edge);
  border-radius: 32px;
  background: rgba(13, 17, 23, 0.9);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  scroll-margin-top: 32px;
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.can-reveal .app-page:not(.is-visible),
.can-reveal .about:not(.is-visible) {
  opacity: 0;
  transform: translateY(24px);
}

.app-page-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
}

.app-page-icon {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.app-page-name h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.app-page-name p {
  margin: 8px 0 0;
  font-size: 1.05rem;
  color: var(--dim);
}

.app-page-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.app-page-actions > * {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 22px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.app-page-actions .btn-primary {
  background: var(--main);
  color: var(--bg);
  border: 2px solid var(--main);
}

.app-page-actions .btn-primary:hover {
  background: #6aa3db;
  border-color: #6aa3db;
}

.app-page-actions .btn-ghost {
  border: 2px solid rgba(80, 143, 206, 0.45);
  color: var(--ink);
}

.app-page-actions .btn-ghost:hover {
  border-color: var(--main);
  color: var(--main);
}

.app-page-actions .btn-pending {
  border: 2px dashed rgba(139, 148, 158, 0.4);
  color: var(--dim);
  cursor: default;
}

.shelf {
  position: relative;
  margin: 32px -36px 0;
}

.shelf-track {
  display: flex;
  gap: 16px;
  margin: 0;
  padding: 4px 36px 12px;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 36px;
  scroll-behavior: smooth;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}

.shelf-track::-webkit-scrollbar {
  display: none;
}

.shelf-track:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: -2px;
  border-radius: 12px;
}

.shelf-item {
  flex: 0 0 auto;
  scroll-snap-align: start;
}

.shelf-item img {
  display: block;
  height: clamp(380px, 56vh, 540px);
  width: auto;
  border-radius: 24px;
  border: 1px solid var(--edge);
  background: var(--card);
}

.shelf-arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 48px;
  height: 48px;
  margin-top: -30px;
  border: 3px solid var(--main);
  border-radius: 50%;
  background: var(--bg);
  color: var(--ink);
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, opacity 0.25s ease;
}

.shelf-arrow:hover {
  background: var(--main);
  color: var(--bg);
}

.shelf-arrow:disabled {
  opacity: 0;
  pointer-events: none;
}

.shelf-arrow.is-prev {
  left: 12px;
}

.shelf-arrow.is-next {
  right: 12px;
}

.app-page-text {
  max-width: 660px;
  margin: 24px 0 0;
  font-size: clamp(0.98rem, 1.4vw, 1.1rem);
  line-height: 1.6;
  color: var(--soft);
}

@media (hover: none) {
  .shelf-arrow {
    display: none;
  }
}

/* ---------------------------------------------------------------------------
   Sign in and Pick a username: a board over the lines, like the 404 page.
   --------------------------------------------------------------------------- */

.board-stage {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 96px 16px 64px;
}

.board {
  width: min(100%, 560px);
  padding: 48px 32px;
  text-align: center;
  background: radial-gradient(closest-side, rgba(13, 17, 23, 0.97) 74%, rgba(13, 17, 23, 0));
}

.board-station {
  display: block;
  width: 64px;
  height: 96px;
  margin: 0 auto 24px;
  overflow: visible;
}

.board-station line {
  stroke: var(--main);
  stroke-width: 8;
  stroke-linecap: round;
}

.board-station circle {
  fill: var(--bg);
  stroke: var(--main);
  stroke-width: 8;
}

.board-title {
  margin: 0;
  font-size: clamp(1.6rem, 4.5vw, 2.6rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  text-transform: uppercase;
}

.board-lead {
  max-width: 440px;
  margin: 18px auto 0;
  font-size: clamp(0.95rem, 1.6vw, 1.05rem);
  line-height: 1.6;
  color: var(--soft);
  text-wrap: balance;
}

.board-actions {
  margin-top: 32px;
}

.apple-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 260px;
  min-height: 52px;
  padding: 12px 28px;
  border-radius: 999px;
  background: #fff;
  color: #000;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.25s ease;
}

.apple-button svg {
  width: 17px;
  height: 20px;
  fill: currentColor;
  margin-top: -3px;
}

.apple-button:hover {
  box-shadow: 0 0 0 4px rgba(80, 143, 206, 0.45);
}

.signin-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* Google's own mark keeps its four colours and sits level with the text. */
.google-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  margin-top: 0;
}

.identity-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}

.identity-list .card-row + .card-row {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.apple-button:active {
  transform: scale(0.98);
}

.apple-button:focus-visible,
.board-form .btn:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 4px;
}

.board-note {
  margin: 16px 0 0;
  font-size: 0.88rem;
  color: var(--dim);
}

.board-form {
  max-width: 400px;
  margin: 32px auto 0;
  text-align: left;
}

.board-form .btn {
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
  border-radius: 999px;
  font-size: 1rem;
}

.board .form-message {
  text-align: left;
  max-width: 400px;
  margin: 16px auto 0;
}

/* ---------------------------------------------------------------------------
   The account page: sections down the right, and a line map down the left
   whose stations jump to them.
   --------------------------------------------------------------------------- */

.account-page {
  width: min(92vw, 1080px);
  margin: 0 auto;
  padding: 112px 0 96px;
}

.account-header {
  margin-bottom: 48px;
  text-align: center;
}

.account-header .title,
.account-header .subtitle {
  opacity: 1;
}

.account-header .title {
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  letter-spacing: 0.1em;
  text-indent: 0.1em;
}

.account-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

.account-layout[hidden] {
  display: none;
}

.account-loading {
  text-align: center;
  color: var(--dim);
  padding: 24px;
}

/* The line map. Each station draws the line above and below its own dot, so
   the line starts at the first station and ends at the last. */

.route-map {
  position: sticky;
  top: 112px;
}

.route-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.route-station {
  --dot: 24px;
  --rail: 6px;
  position: relative;
  height: 44px;
}

.route-station.is-minor {
  --dot: 12px;
  height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transition: height 0.25s ease, opacity 0.2s ease;
}

.route-map.is-expanded .route-station.is-minor {
  height: 32px;
  opacity: 1;
  pointer-events: auto;
}

.route-station::before,
.route-station::after {
  content: '';
  position: absolute;
  left: calc(12px - var(--rail) / 2);
  width: var(--rail);
  background: var(--main);
}

.route-station::before {
  top: 0;
  height: 50%;
}

.route-station::after {
  top: 50%;
  bottom: 0;
}

.route-station:first-child::before,
.route-station:last-child::after {
  display: none;
}

.route-station a {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
  color: var(--dim);
  text-decoration: none;
  border-radius: 8px;
}

.route-dot {
  flex: 0 0 auto;
  width: var(--dot);
  height: var(--dot);
  margin-left: calc(12px - var(--dot) / 2);
  margin-right: calc(12px - var(--dot) / 2);
  border-radius: 50%;
  border: 5px solid var(--main);
  background: var(--bg);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.25s ease;
}

.is-minor .route-dot {
  border-width: 3px;
}

.route-label {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: color 0.25s ease;
}

.is-minor .route-label {
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
}

.route-station a:hover .route-label,
.route-station.is-current .route-label {
  color: var(--ink);
}

.route-station a:hover .route-dot {
  transform: scale(1.2);
}

.route-station.is-current .route-dot {
  background: var(--main);
  transform: scale(1.15);
}

.route-station a:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 4px;
}

/* Sections and cards. */

.account-section {
  margin-bottom: 64px;
  scroll-margin-top: 112px;
}

.account-section:last-child {
  margin-bottom: 0;
}

.account-section h2,
.hw-group-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--main);
}

.section-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.section-lead {
  margin: -6px 0 24px;
  color: var(--dim);
  font-size: 0.95rem;
}

.account-card {
  padding: 24px;
  border: 1px solid var(--edge);
  border-radius: 20px;
  background: var(--card);
}

.account-card + .account-card {
  margin-top: 16px;
}

.account-card.danger {
  border-color: rgba(248, 81, 73, 0.35);
}

.account-card.danger .card-row-title {
  color: var(--danger);
}

.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.card-row .small {
  margin: 4px 0 0;
}

.card-row-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.profile-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.avatar {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--main), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--bg);
}

.profile-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
}

.profile-since {
  font-size: 0.85rem;
  color: var(--dim);
  margin-top: 2px;
}

.inline-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--soft);
}

.field-row {
  display: flex;
  gap: 10px;
}

.field-row .text-input {
  flex: 1;
  min-width: 0;
}

.text-input {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(240, 246, 252, 0.16);
  background: var(--bg);
  color: var(--ink);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.text-input:focus {
  border-color: var(--main);
  box-shadow: 0 0 0 3px rgba(80, 143, 206, 0.2);
}

.text-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn {
  min-height: 44px;
  padding: 10px 22px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s, transform 0.1s, border-color 0.2s, color 0.2s;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--main);
  color: var(--bg);
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.9;
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(240, 246, 252, 0.2);
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--main);
  color: var(--main);
}

.btn-danger {
  background: #da3633;
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  opacity: 0.9;
}

.hint {
  margin: 10px 0 0;
  font-size: 0.85rem;
  color: var(--dim);
}

.token-count {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--ink);
}

.token-count .unit {
  margin-left: 6px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--dim);
}

.token-count.problem {
  font-size: 1rem;
  font-weight: 500;
  color: var(--dim);
}

.more {
  display: inline-block;
  margin-top: 12px;
  color: var(--main);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
}

.more:hover {
  text-decoration: underline;
}

.form-message {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.88rem;
}

.form-message.ok {
  background: rgba(38, 139, 88, 0.16);
  border: 1px solid rgba(38, 139, 88, 0.4);
  color: #7ee787;
}

.form-message.error {
  background: rgba(218, 54, 51, 0.16);
  border: 1px solid rgba(218, 54, 51, 0.4);
  color: var(--danger);
}

.small {
  font-size: 0.88rem;
  line-height: 1.5;
}

.muted {
  color: var(--dim);
}

/* Headways settings: boxes to tap, like a store's configurator, not menus to open. */

/* Whether the last change saved, floating at the bottom wherever you are on the page. */
.save-status {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 20;
  padding: 10px 18px;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: rgba(22, 27, 34, 0.96);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--soft);
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.save-status.is-shown {
  opacity: 1;
  transform: translate(-50%, 0);
}

.save-status.is-ok {
  color: #7ee787;
}

.save-status.is-error {
  color: var(--danger);
}

.hw-group {
  margin-bottom: 36px;
  scroll-margin-top: 112px;
}

.hw-group-title {
  font-size: 0.8rem;
  color: var(--dim);
}

.hw-card {
  padding: 4px 24px;
}

.hw-card.is-magic {
  border-color: rgba(167, 139, 250, 0.4);
  background: linear-gradient(135deg, rgba(62, 34, 154, 0.55), rgba(22, 27, 34, 0.9));
}

.hw-row {
  padding: 20px 0;
  border-top: 1px solid rgba(240, 246, 252, 0.07);
}

/* Rows that only matter when another setting is on come after it, so the
   first row is always shown. */
.hw-row:first-child {
  border-top: none;
}

.hw-row[hidden] {
  display: none;
}

.hw-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 32px;
}

.hw-label {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
}

.hw-hint {
  margin: 6px 0 0;
  max-width: 520px;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--dim);
}

.hw-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(124px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.hw-options.is-compact {
  grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
}

.hw-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 12px 36px 12px 14px;
  border: 1px solid rgba(240, 246, 252, 0.16);
  border-radius: 14px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 500;
  text-align: left;
  line-height: 1.25;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.hw-option:hover {
  border-color: rgba(240, 246, 252, 0.4);
}

.hw-option.is-selected {
  border-color: var(--main);
  box-shadow: inset 0 0 0 1px var(--main);
  background: rgba(80, 143, 206, 0.1);
}

.hw-option:focus-visible,
.hw-switch:focus-visible,
.hw-step:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 3px;
}

.hw-check {
  position: absolute;
  top: 50%;
  right: 12px;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border-radius: 50%;
  border: 2px solid rgba(240, 246, 252, 0.25);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.is-selected .hw-check {
  border-color: var(--main);
  background: var(--main) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%230d1117' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat;
}

.hw-swatch {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.hw-switch {
  position: relative;
  flex: 0 0 auto;
  width: 52px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(240, 246, 252, 0.18);
  cursor: pointer;
  transition: background 0.25s ease;
}

.hw-switch[aria-checked="true"] {
  background: var(--main);
}

.hw-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: transform 0.25s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.hw-switch[aria-checked="true"] .hw-knob {
  transform: translateX(20px);
}

.is-magic .hw-switch[aria-checked="true"] {
  background: var(--purple);
}

.hw-stepper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hw-step {
  width: 40px;
  height: 36px;
  border: 1px solid rgba(240, 246, 252, 0.16);
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 1.15rem;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.hw-step:hover:not(:disabled) {
  border-color: var(--main);
  color: var(--main);
}

.hw-step:disabled {
  opacity: 0.35;
  cursor: default;
}

.hw-step-value,
.hw-value {
  min-width: 96px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.hw-value {
  min-width: 0;
  color: var(--soft);
}

.hw-slider {
  display: block;
  width: 100%;
  margin: 14px 0 0;
  accent-color: var(--main);
  cursor: pointer;
}

/* ---------------------------------------------------------------------------
   Phones and narrow windows.
   --------------------------------------------------------------------------- */

@media (max-width: 860px) {
  .account-page {
    padding-top: 88px;
  }

  .account-layout {
    display: block;
  }

  /* The logo and menu scroll away here, so the line map can have the top. */
  .account-body .corner-mark,
  .account-body .menu {
    position: absolute;
  }

  /* The line map turns sideways and sticks to the top, with the main stations only. */
  .route-map {
    top: 0;
    z-index: 5;
    margin: 0 -4vw 32px;
    padding: 12px 4vw;
    overflow-x: auto;
    scrollbar-width: none;
    background: rgba(13, 17, 23, 0.94);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--edge);
  }

  .route-map::-webkit-scrollbar {
    display: none;
  }

  .route-list {
    display: flex;
    width: max-content;
  }

  .route-station.is-minor {
    display: none;
  }

  .route-station {
    height: auto;
    padding: 0 14px;
  }

  .route-station:first-child {
    padding-left: 0;
  }

  .route-station:last-child {
    padding-right: 0;
  }

  .route-station::before,
  .route-station::after {
    top: 22px;
    bottom: auto;
    height: var(--rail);
    margin-top: calc(var(--rail) / -2);
    left: auto;
    width: auto;
  }

  .route-station::before {
    left: 0;
    right: 50%;
  }

  .route-station::after {
    left: 50%;
    right: 0;
  }

  .route-station a {
    flex-direction: column;
    gap: 6px;
  }

  .route-dot {
    margin: 10px 0 0;
  }

  .route-label {
    font-size: 0.7rem;
  }

  .account-section,
  .hw-group {
    scroll-margin-top: 104px;
  }
}

@media (max-width: 600px) {
  .title {
    font-size: clamp(1.5rem, 7vw, 2.5rem);
  }
  .subtitle {
    font-size: clamp(0.9rem, 3.6vw, 1rem);
  }
  .about {
    min-height: auto;
    padding: 64px 20px 80px;
  }
  .about h2 {
    font-size: clamp(1.2rem, 4vw, 1.6rem);
    letter-spacing: 0.12em;
  }
  .about p {
    font-size: 0.95rem;
  }

  .app-pages {
    gap: 40px;
  }
  .app-page {
    padding: 24px 20px;
    border-radius: 24px;
  }
  .app-page-head {
    grid-template-columns: auto 1fr;
    gap: 16px;
  }
  .app-page-icon {
    width: 72px;
    height: 72px;
    border-radius: 17px;
  }
  .app-page-name p {
    font-size: 0.95rem;
  }
  .app-page-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }
  .app-page-actions > * {
    flex: 1 1 0;
    padding: 10px 14px;
  }
  .shelf {
    margin: 24px -20px 0;
  }
  .shelf-track {
    gap: 12px;
    padding: 4px 20px 12px;
    scroll-padding: 0 20px;
  }
  .shelf-item img {
    height: 420px;
    border-radius: 20px;
  }

  .account-card {
    padding: 20px;
  }
  .hw-card {
    padding: 0 18px;
  }
  .hw-options,
  .hw-options.is-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hw-step-value {
    min-width: 76px;
  }
  .field-row {
    flex-direction: column;
  }
  .card-row {
    flex-direction: column;
    align-items: stretch;
  }
  .board {
    padding: 32px 8px;
  }
  .board-title {
    letter-spacing: 0.12em;
    text-indent: 0.12em;
  }
  .apple-button {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 400px) {
  .title {
    font-size: 1.3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .signin-sheet,
  .signin-sheet::backdrop,
  .preview-screen,
  .pv-base,
  .scene,
  .scene.is-active,
  .about,
  .app-page,
  .route-dot,
  .hw-knob {
    transition: none;
  }
  .can-reveal .app-page:not(.is-visible) {
    opacity: 1;
    transform: none;
  }
  .shelf-track {
    scroll-behavior: auto;
  }
}

/* The home page sits over slowly moving transit lines, like the 404 page.
   A dark glow behind each part keeps the words easy to read. */
.has-lines .stage,
.has-lines .about,
.has-lines .app-pages {
  position: relative;
  z-index: 1;
}

.has-lines .hero-main::before {
  content: '';
  position: absolute;
  inset: -12px max(-28px, -4vw);
  z-index: -1;
  pointer-events: none;
  border-radius: 40px;
  background: rgba(13, 17, 23, 0.9);
  box-shadow: 0 0 48px 32px rgba(13, 17, 23, 0.9);
}

.has-lines .about::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(13, 17, 23, 0.95) 55%, rgba(13, 17, 23, 0));
}
