:root {
  color-scheme: light;
  --blue: #1f73ee;
  --blue-dark: #174fbf;
  --teal: #14a7b6;
  --red: #ec3f42;
  --text: #1f2429;
  --muted: #8a9199;
  --line: #e7eaee;
  --surface: #ffffff;
  --shadow: 0 24px 60px rgba(31, 42, 55, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  position: fixed;
  inset: 0;
  margin: 0;
  height: 100dvh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: #eef4ff;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

button,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.phone-stage {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 22% 12%, rgba(255, 255, 255, 0.85), transparent 34%),
    linear-gradient(135deg, #f5f8ff 0%, #e8f1ff 100%);
}

.phone-frame {
  width: min(100%, 390px);
  height: min(920px, calc(100vh - 36px));
  min-height: 680px;
  padding: 18px;
  border-radius: 44px;
  background: #fff;
  box-shadow: var(--shadow);
}

.app-screen {
  position: relative;
  height: 100%;
  overflow: hidden;
  border: 1px solid #eef0f4;
  border-radius: 30px;
  background: #f7f8f9;
}

.map-shell,
.map {
  position: absolute;
  inset: 0;
}

.map {
  min-height: 100%;
  background: #eef1f2;
}

.top-search {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 14px;
  z-index: 8;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
  min-height: 58px;
}

.top-search::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 6px 18px rgba(28, 41, 57, 0.16);
}

.back-button,
.mic-button {
  width: 34px;
  height: 38px;
  border: 0;
  background: transparent;
}

.back-button {
  position: relative;
}

.back-button::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 11px;
  width: 13px;
  height: 13px;
  border-left: 3px solid #222;
  border-bottom: 3px solid #222;
  transform: rotate(45deg);
}

.mic-button,
.search-clear,
.search-back {
  position: relative;
}

.mic-button::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 7px;
  width: 10px;
  height: 17px;
  border: 3px solid #222;
  border-radius: 999px;
}

.mic-button::after {
  content: "";
  position: absolute;
  left: 16px;
  top: 27px;
  width: 11px;
  height: 2px;
  border-radius: 999px;
  background: #222;
  box-shadow: 3px -11px 0 -1px #ef3b47;
}

.route-picker select {
  display: none;
}

.search-trigger {
  width: 100%;
  height: 44px;
  border: 0;
  outline: 0;
  text-align: left;
  color: #858b92;
  background: transparent;
  font-size: 16px;
  font-weight: 700;
}

.map-badge {
  position: absolute;
  top: 84px;
  right: 18px;
  z-index: 7;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  color: #fff;
  background: rgba(31, 115, 238, 0.92);
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(31, 115, 238, 0.24);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.22);
}

.map-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 6px;
  padding: 20px;
  text-align: center;
  background:
    linear-gradient(90deg, rgba(64, 77, 90, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(64, 77, 90, 0.08) 1px, transparent 1px),
    #f6f7f8;
  background-size: 36px 36px;
}

.map-fallback span {
  max-width: 260px;
  color: var(--muted);
  font-size: 13px;
}

.fallback-map::before {
  content: "";
}

.fallback-bus {
  position: absolute;
  z-index: 5;
  transform: translate(-50%, -50%);
}

.marker-overlay-shell {
  opacity: 1;
  transition: opacity 0.55s ease-in-out;
  will-change: transform, opacity;
  backface-visibility: hidden;
}

.marker-overlay-shell.is-entering,
.marker-overlay-shell.is-leaving {
  opacity: 0;
}

.bus-marker {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  height: 26px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 4px;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 3px 8px rgba(22, 61, 122, 0.3);
  font-size: 11px;
  font-weight: 900;
  isolation: isolate;
  overflow: visible;
  transform: rotate(calc(var(--heading, 0deg) + 90deg));
  transition: transform 3s linear;
  will-change: transform;
  backface-visibility: hidden;
}

.bus-marker::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: -1;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(31, 115, 238, 0.52);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.5);
}

.bus-marker span {
  display: block;
  width: 38px;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: rotate(var(--counter-heading, 0deg));
  transition: transform 3s linear;
}

.bus-marker.is-selected::before {
  animation: selected-bus-pulse 1.6s ease-in-out infinite;
}

@keyframes selected-bus-pulse {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  20% {
    opacity: 0.68;
  }
  80% {
    opacity: 0.34;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1);
  }
}

.map-loader {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.12);
}

.map-loader[hidden] {
  display: none;
}

.map-loader i {
  width: 34px;
  height: 34px;
  border: 4px solid rgba(31, 115, 238, 0.2);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: loader-spin 0.75s linear infinite;
}

@keyframes loader-spin {
  to { transform: rotate(360deg); }
}

.nearby-button {
  position: absolute;
  left: 50%;
  bottom: var(--floating-button-bottom, 174px);
  z-index: 8;
  height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  color: #20252b;
  background: #fff;
  box-shadow: 0 8px 22px rgba(10, 15, 22, 0.28);
  font-size: 13px;
  font-weight: 800;
  transform: translateX(-50%);
  white-space: nowrap;
}

.nearby-button[hidden] {
  display: none;
}

.nearby-button span {
  width: 12px;
  height: 12px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 2px var(--blue), 0 0 0 5px rgba(31, 115, 238, 0.14);
}

.nearby-button strong {
  color: #4c91ff;
}

.nearby-button.is-active span {
  animation: nearby-dot 1.2s ease-in-out infinite;
}

@keyframes nearby-dot {
  50% { opacity: 0.35; transform: scale(0.7); }
}

.current-location-marker {
  display: block;
  width: 17px;
  height: 17px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 8px rgba(31, 115, 238, 0.18), 0 2px 8px rgba(20, 53, 103, 0.3);
}

.route-stop-marker {
  position: relative;
  display: block;
  width: 18px;
  height: 18px;
  border: 2px solid #5269df;
  border-radius: 5px;
  background: #fff;
  box-shadow: 0 2px 5px rgba(32, 62, 126, 0.24);
}

.route-stop-marker::before {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: 4px;
  height: 5px;
  border-radius: 1px;
  background: #5269df;
}

.route-stop-marker::after {
  content: "";
  position: absolute;
  left: 4px;
  bottom: 2px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #5269df;
  box-shadow: 5px 0 0 #5269df;
}

.bottom-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9;
  height: 280px;
  display: flex;
  flex-direction: column;
  border-radius: 24px 24px 0 0;
  background: #fff;
  box-shadow: 0 -8px 28px rgba(34, 43, 54, 0.18);
  transition: height 0.22s ease;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}

.bottom-sheet[hidden] {
  display: none;
}

.bottom-sheet[data-state="collapsed"] {
  height: 154px;
}

.bottom-sheet[data-state="collapsed"] .progress-actions,
.bottom-sheet[data-state="collapsed"] .bus-progress-wrap,
.bottom-sheet[data-state="collapsed"] .arrival-strip,
.bottom-sheet[data-state="collapsed"] .list-header,
.bottom-sheet[data-state="collapsed"] .bus-list {
  display: none;
}

.bottom-sheet[data-state="collapsed"] .vehicle-focus {
  border-bottom: 0;
  padding: 8px 18px 12px;
}

.bottom-sheet[data-state="expanded"] {
  height: auto;
}

.bottom-sheet.is-dragging {
  transition: none;
}

.sheet-handle {
  position: sticky;
  top: 0;
  z-index: 5;
  flex: 0 0 24px;
  align-self: center;
  width: 72px;
  height: 24px;
  margin: 0;
  background: transparent;
  cursor: grab;
  touch-action: none;
}

.sheet-handle::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  top: 9px;
  height: 5px;
  border-radius: 999px;
  background: #bfc3c8;
}

.sheet-handle:active {
  cursor: grabbing;
}

.arrival-strip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 36px;
  gap: 9px;
  align-items: center;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
}

.arrival-strip strong {
  color: var(--red);
  font-size: 14px;
}

.arrival-strip span {
  overflow: hidden;
  color: #8b929a;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.round-refresh {
  width: 34px;
  height: 34px;
  border: 1px solid #e2e5e9;
  border-radius: 50%;
  color: #777f89;
  background: #fff;
  font-size: 18px;
}

.vehicle-focus {
  display: grid;
  gap: 7px;
  padding: 8px 18px 12px;
  border-bottom: 1px solid var(--line);
}

.focus-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.focus-route {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 900;
}

.focus-route > strong {
  color: #0c0f14;
  font-size: 22px;
  line-height: 1;
}

.focus-route i {
  width: 12px;
  height: 12px;
  border-right: 2px solid #8c9299;
  border-bottom: 2px solid #8c9299;
  transform: rotate(-45deg);
}

.route-type,
.route-pill {
  display: inline-grid;
  place-items: center;
  height: 20px;
  padding: 0 5px;
  border-radius: 4px;
  color: #fff;
  background: #5b72ff;
  font-size: 11px;
  font-weight: 900;
}

.vehicle-focus h2 {
  display: grid;
  gap: 3px;
  margin: 0;
  color: #05070a;
  font-size: 23px;
  line-height: 1.2;
}

.vehicle-focus h2 strong {
  font-size: inherit;
}

.vehicle-focus em {
  color: var(--red);
  font-style: normal;
}

.vehicle-focus h2 span {
  color: #111;
  font-size: 17px;
  font-weight: 800;
}

.vehicle-focus h2 span em {
  margin-left: 7px;
  color: #858b92;
  font-size: 13px;
  font-weight: 600;
}

#focusMeta {
  display: none;
}

.vehicle-focus p,
.speed-line {
  margin: 0;
  color: #777f88;
  font-size: 17px;
}

.progress-actions {
  display: flex;
  justify-content: space-between;
  padding-top: 5px;
}

.progress-actions button {
  height: 34px;
  padding: 0 13px;
  border: 1px solid #edf0f2;
  border-radius: 999px;
  color: #c8ccd1;
  background: #fff;
  font-size: 15px;
}

.bus-progress-wrap {
  display: grid;
  gap: 6px;
  margin: 20px -18px 0;
}

.vehicle-focus:not(.has-progress) .bus-progress i::after {
  left: 50%;
}

.bus-progress {
  position: relative;
  height: 54px;
}

.bus-progress i {
  position: absolute;
  left: 17%;
  right: 17%;
  top: 24px;
  height: 10px;
  background: #d0d1d3;
}

.bus-progress i::after {
  content: "";
  position: absolute;
  left: var(--bus-progress, 50%);
  right: 0;
  top: 0;
  bottom: 0;
  background: var(--teal);
  transition: left 0.9s linear;
}

.progress-dot {
  position: absolute;
  top: 17px;
  z-index: 2;
  width: 28px;
  height: 28px;
  border: 8px solid #d0d1d3;
  border-radius: 50%;
  background: #fff;
}

.progress-dot.prev {
  left: 17%;
  transform: translateX(-50%);
}

.progress-dot.next {
  left: 83%;
  border-color: var(--teal);
  transform: translateX(-50%);
}

.progress-bus-icon {
  position: absolute;
  left: var(--bus-position, 50%);
  top: 5px;
  z-index: 3;
  width: 58px;
  height: 34px;
  border-radius: 8px 11px 8px 8px;
  background: #f8f8f8;
  border: 2px solid #d9dadd;
  transform: translateX(-50%);
  box-shadow: -12px 28px 0 -24px #333, 12px 28px 0 -24px #333;
  transition: left 0.9s linear;
}

.progress-bus-icon::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 7px;
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: #202326;
  box-shadow: 16px 0 0 #202326, 32px 0 0 #202326;
}

.progress-bus-no {
  position: absolute;
  left: var(--bus-position, 50%);
  top: -31px;
  z-index: 4;
  min-width: 54px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid #dfe2e6;
  border-radius: 999px;
  color: #111;
  background: #fff;
  font-size: 18px;
  transform: translateX(-50%);
  transition: left 0.9s linear;
}

.progress-labels {
  position: relative;
  height: 24px;
}

.progress-labels span {
  position: absolute;
  top: 0;
  width: 42%;
  overflow: hidden;
  color: #161a1f;
  font-size: 16px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: translateX(-50%);
}

.progress-labels span:first-child {
  left: 17%;
}

.progress-labels span:last-child {
  left: 83%;
}

.vehicle-focus.progress-reset .progress-bus-icon,
.vehicle-focus.progress-reset .progress-bus-no,
.vehicle-focus.progress-reset .bus-progress i::after {
  transition: none;
}

.list-header {
  display: flex;
  justify-content: space-between;
  padding: 10px 18px 4px;
  color: #6f7780;
  font-size: 13px;
  font-weight: 800;
}

.bus-list {
  overflow: auto;
  padding: 0 0 12px;
}

.bus-list.empty {
  padding: 20px;
  color: var(--muted);
  font-size: 14px;
}

.bus-card {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 10px 56px 10px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.bus-card.is-selected {
  background: #f5f8ff;
}

.card-locate {
  position: absolute;
  right: 16px;
  top: 50%;
  width: 34px;
  height: 34px;
  border: 1px solid #dde1e6;
  border-radius: 50%;
  background: #fff;
  transform: translateY(-50%);
}

.card-locate::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 8px;
  width: 0;
  height: 0;
  border-left: 12px solid #8d949d;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  transform: rotate(-38deg);
}

.bus-card-main {
  display: flex;
  align-items: center;
  gap: 7px;
}

.bus-card-main strong {
  font-size: 19px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 8px;
  color: var(--muted);
  font-size: 12px;
}

.stop-flow {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 3px 7px;
  font-size: 13px;
}

.stop-flow span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.stop-flow strong {
  min-width: 0;
  overflow: hidden;
  color: #30343a;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stop-flow i {
  grid-column: 1 / -1;
  height: 1px;
  margin-left: 41px;
  background: #eef0f3;
}

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgba(239, 244, 252, 0.94);
}

.search-overlay[hidden] {
  display: none;
}

.search-page {
  width: min(100%, 430px);
  height: min(920px, 100vh);
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow);
}

.search-bar {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 4px;
  margin: 46px 14px 18px;
  padding: 0 10px;
  height: 58px;
  border: 1px solid #e2e5e9;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(24, 31, 39, 0.08);
}

.search-back,
.search-clear {
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
}

.search-back::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 13px;
  width: 14px;
  height: 14px;
  border-left: 3px solid #252a30;
  border-bottom: 3px solid #252a30;
  transform: rotate(45deg);
}

.search-clear {
  color: #30353a;
  font-size: 44px;
  line-height: 1;
  font-weight: 300;
}

.search-bar input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: #1f2429;
  font-size: 27px;
  background: transparent;
}

.search-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
}

.search-tabs button {
  height: 58px;
  border: 0;
  color: #353a40;
  background: #fff;
  font-size: 20px;
  font-weight: 800;
}

.search-tabs button::before {
  display: inline-block;
  margin-right: 8px;
  font-size: 20px;
}

.search-tabs button:nth-child(1)::before {
  content: "●";
}

.search-tabs button:nth-child(2)::before {
  content: "▣";
}

.search-tabs button:nth-child(3)::before {
  content: "▤";
}

.search-tabs .is-active {
  color: var(--blue);
}

.search-filters {
  display: flex;
  gap: 20px;
  height: 54px;
  align-items: center;
  padding: 0 20px;
  background: #f6f7f9;
  border-bottom: 1px solid var(--line);
}

.search-filters button {
  border: 0;
  color: #50565e;
  background: transparent;
  font-size: 17px;
}

.search-filters button::after {
  content: "";
  display: inline-block;
  margin-left: 7px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #a2a7ad;
  vertical-align: middle;
}

.search-results {
  height: calc(100% - 179px);
  overflow: auto;
  background: #fff;
}

.search-results.empty {
  padding: 28px 22px;
  color: var(--muted);
  font-size: 17px;
}

.route-result {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-areas:
    "icon title"
    "icon desc"
    "icon meta";
  column-gap: 10px;
  width: 100%;
  min-height: 116px;
  padding: 20px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  background: #fff;
}

.result-bus {
  grid-area: icon;
  width: 25px;
  height: 27px;
  margin-top: 4px;
  border-radius: 5px;
  background: var(--blue);
  position: relative;
}

.result-bus.green {
  background: #64c000;
}

.result-bus.purple {
  background: #7b61ff;
}

.result-bus::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 5px;
  width: 15px;
  height: 8px;
  border-radius: 2px;
  background: #fff;
}

.result-bus::after {
  content: "";
  position: absolute;
  left: 5px;
  bottom: 3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 11px 0 0 #fff;
}

.route-result strong {
  grid-area: title;
  color: #181c21;
  font-size: 28px;
  line-height: 1.1;
}

.route-result p {
  grid-area: desc;
  margin: 6px 0 0;
  overflow: hidden;
  color: #33383f;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-result small {
  grid-area: meta;
  margin-top: 8px;
  color: #8a8f96;
  font-size: 16px;
}

@media (min-width: 900px) {
  .phone-frame {
    width: 430px;
  }
}

@media (max-width: 520px) {
  html,
  body {
    height: 100dvh;
    overflow: hidden;
  }

  .phone-stage {
    width: 100vw;
    height: 100dvh;
    padding: 0;
    overflow: hidden;
  }

  .phone-frame {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    padding: 0;
    border-radius: 0;
  }

  .app-screen {
    border: 0;
    border-radius: 0;
  }

  .bottom-sheet {
    position: fixed;
    bottom: 0;
    height: 280px;
  }

  .bottom-sheet[data-state="expanded"] {
    height: auto;
  }

  .nearby-button {
    position: fixed;
    bottom: var(--floating-button-bottom, 24px);
  }

  .search-page {
    width: 100%;
    height: 100dvh;
  }
}
