/* ===== Teez Taxi — first screen ===== */
:root {
  --blue: #2f6bff;
  --blue-dark: #1f4fd6;
  --ink: #111318;
  --muted: #8a8f98;
  --sheet-radius: 22px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  /* On-screen keyboard height, kept in sync from visualViewport (app.js) */
  --kb: 0px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  /* Stretch to the true visual-viewport height so nothing white shows under
     the home indicator / bottom safe-area on iOS standalone (viewport-fit=cover).
     Chain: JS --app-height wins, then dvh, then -webkit-fill-available (old iOS),
     then plain 100%. Background matches the map so any residual sub-pixel gap
     blends instead of showing a white system strip. */
  height: 100%;
  height: -webkit-fill-available;
  height: var(--app-height, 100dvh);
  overflow: hidden;
  overscroll-behavior: none;
  background: #eef1f4;
}
@supports not (height: 100dvh) {
  html,
  body {
    height: var(--app-height, 100vh);
  }
}

body {
  font-family: var(--font);
  font-size: 14.4px;
  color: var(--ink);
  /* Never pure white: match the map so any uncovered sub-pixel at the very
     bottom (bottom safe-area on iOS) blends instead of showing a white strip. */
  background: #eef1f4;
  /* Lock: no page zoom, no text selection, no tap callout */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

/* ===== Map ===== */
#map {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  /* Fill the true visual-viewport height so no white gap shows at the very
     bottom on iOS standalone (viewport-fit=cover). JS --app-height wins, then
     dvh, then -webkit-fill-available, then vh. */
  height: 100%;
  height: -webkit-fill-available;
  height: var(--app-height, 100dvh);
  z-index: 0;
  background: #eef1f4;
  touch-action: none; /* let MapGL handle pan/pinch, not the page */
}
/* Legacy fallback for browsers without dvh support */
@supports not (height: 100dvh) {
  #map {
    height: var(--app-height, 100vh);
  }
}

/* Hide 2GIS attribution */
#map .dg-attribution_wrapper {
  display: none !important;
}

/* ===== Fixed center pickup pin (Uber-style) ===== */
/* The whole pin sits at the center of the screen; the .pin-dot is the
   geographic anchor. Everything above the dot is anchored to its bottom,
   everything below hangs from the dot. */
.center-pin {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  filter: drop-shadow(0 8px 16px rgba(16, 24, 40, 0.22));
}
/* Portion above the dot grows upward, so the dot stays put. */
.stack-up {
  position: absolute;
  bottom: 7px; /* half of the dot (16px) so its center is the anchor */
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.pin-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--blue);
  color: #fff;
  padding: 8px 14px;
  border-radius: 14px;
  white-space: nowrap;
}
.pin-icon {
  display: inline-flex;
  opacity: 0.95;
}
.pin-txt {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.05;
}
.pin-txt b {
  display: block;
  font-size: 10.8px;
  font-weight: 600;
  opacity: 0.9;
  margin-top: 1px;
}
.pin-line {
  width: 3px;
  height: 24px;
  background: var(--blue);
  border-radius: 2px;
}
.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--blue);
  box-sizing: border-box;
  position: relative;
  z-index: 2;
}

/* ===== Top header ===== */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: calc(var(--safe-top) + 10px) 14px 6px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
}
.topbar > * {
  pointer-events: auto;
}

/* Left vertical stack: menu on top, locate under it (like Locator) */
.control-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Liquid-glass buttons (Apple-style frosted glass) */
.glass-btn {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  /* frosted glass */
  background: rgba(255, 255, 255, 0.38);
  -webkit-backdrop-filter: blur(16px) saturate(170%);
  backdrop-filter: blur(16px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 6px 18px rgba(16, 24, 40, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: transform 0.15s ease, background 0.2s ease;
}
.glass-btn:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.5);
}
.glass-btn.loading {
  opacity: 0.6;
  pointer-events: none;
}
.menu-btn .badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 9px;
  background: #ff3b30;
  color: #fff;
  font-size: 9.9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px #fff;
}

/* Centered address (top) */
.address {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: calc(var(--safe-top) + 10px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 3px 9px;
  border-radius: 12px;
  max-width: 60vw;
}
.address-label {
  font-size: 9.9px;
  font-weight: 600;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.address-value {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ===== Bottom sheet (lifted up a bit, clear bottom edge) ===== */
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-top-left-radius: var(--sheet-radius);
  border-top-right-radius: var(--sheet-radius);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  box-shadow: 0 12px 34px rgba(16, 24, 40, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  padding: 6px 6px calc(1px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  /* Cap the sheet so the address list always stays scrollable inside it */
  max-height: calc(100vh - var(--safe-top) - 100px - var(--kb));
  max-height: calc(100dvh - var(--safe-top) - 100px - var(--kb));
  transition: max-height 0.25s ease, bottom 0.25s ease, background 0.25s ease;
}
/* Expanded search menu: fills the screen and lifts above the keyboard */
.sheet.expanded {
  bottom: var(--kb);
  background: #ffffff;
}
.sheet-grabber {
  width: 40px;
  height: 5px;
  border-radius: 3px;
  background: #e2e5ea;
  margin: 2px auto 8px;
  flex-shrink: 0;
}

/* Destination search row: tap it to expand the menu */
.search-field {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 6px 8px;
  border-bottom: 1px solid #f0f1f4;
  flex-shrink: 0;
  transition: background 0.2s ease;
}
.search-field:focus-within {
  background: rgba(47, 107, 255, 0.06);
}
.search-flag {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.search-input-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.search-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: -0.1px;
  line-height: 1.1;
}
.search-field input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  /* 16.5px keeps iOS from zooming the page when the field gets focus */
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--ink);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
  -webkit-user-modify: none;
  padding: 0;
}
.search-field input::placeholder {
  color: #aab0b9;
  font-weight: 600;
}
.search-clear {
  border: none;
  background: #eef0f4;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  display: none;
  outline: none;
  padding: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  touch-action: manipulation;
}
.search-field.has-text .search-clear {
  display: inline-flex;
  color: var(--ink);
}

.search-map {
  flex-shrink: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  background: #f1f3f6;
  border-radius: 12px;
  padding: 9px 13px;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  transition: background 0.15s ease;
}
.search-map:active {
  background: #e5e8ed;
}

/* Pickup row — always visible in the search panel, opens the map picker */
.sheet-pickup {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-bottom: 1px solid #f0f1f4;
  flex-shrink: 0;
  cursor: pointer;
  touch-action: manipulation;
}
.sheet-pickup:active {
  background: rgba(47, 107, 255, 0.06);
}
.pickup-icon {
  color: var(--ink);
  display: inline-flex;
  flex-shrink: 0;
}
.pickup-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.pickup-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: -0.1px;
}
.pickup-text {
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pickup-chevron {
  color: var(--muted);
  display: inline-flex;
  flex-shrink: 0;
}

.dest-list {
  list-style: none;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.dest {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 3px;
  border-bottom: 1px solid #f0f1f4;
}
.dest:last-child {
  border-bottom: none;
}
.dest-icon {
  color: #aeb4bd;
  display: inline-flex;
  flex-shrink: 0;
}
.dest-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.dest-name {
  font-size: 14.4px;
  font-weight: 700;
  letter-spacing: -0.2px;
}
.dest-sub {
  font-size: 11.7px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dest-time {
  font-size: 12.6px;
  color: var(--muted);
  font-weight: 600;
  flex-shrink: 0;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 330px);
  transform: translateX(-50%) translateY(20px);
  z-index: 30;
  background: rgba(17, 19, 24, 0.9);
  color: #fff;
  font-size: 11.7px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 12px;
  max-width: 84vw;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Shorter screens — raise the toast a bit */
@media (max-height: 700px) {
  .toast {
    bottom: calc(var(--safe-bottom) + 300px);
  }
  .sheet .dest {
    padding: 10px 3px;
  }
}

/* ---- iOS gesture guards: no double-tap-to-zoom on UI chrome (map keeps none) ---- */
.topbar,
.glass-btn,
.address,
.toast {
  touch-action: none;
}
/* The sheet hosts a scrollable address list: allow vertical panning only */
.sheet,
.dest {
  touch-action: pan-y;
}

/* ---- HTTPS / secure-context warning banner (top of viewport) ---- */
.https-warning {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(255, 59, 48, 0.94);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}
.https-warning.show {
  display: flex;
}
.https-warning-icon {
  font-size: 17px;
  line-height: 1;
}
.https-warning-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  line-height: 1.35;
  max-width: 82vw;
}
.https-warning-title {
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: -0.2px;
}
.https-warning-body {
  font-size: 11.5px;
  font-weight: 500;
  opacity: 0.9;
  max-width: 70vw;
}
.https-warning-fix {
  margin-top: 5px;
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.2);
  padding: 5px 12px;
  border-radius: 7px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  white-space: nowrap;
}


/* ===== Ride-flow panels (one sheet, panels switched by data-panel) ===== */
.sheet .panel {
  display: none;
  flex-direction: column;
  gap: 12px;
  padding: 2px 8px 4px;
  min-height: 0;
  /* Panels size to their content — the sheet must not stretch with empty
     space below (only the search list grows to fill the expanded sheet). */
  flex: 0 1 auto;
}
.sheet[data-panel="search"] .panel-search,
.sheet[data-panel="pickup"] .panel-pickup,
.sheet[data-panel="options"] .panel-options,
.sheet[data-panel="searching"] .panel-searching,
.sheet[data-panel="driver"] .panel-driver,
.sheet[data-panel="trip"] .panel-trip,
.sheet[data-panel="review"] .panel-review {
  display: flex;
}
/* The search panel keeps its scrollable list layout; it alone stretches
   to fill the sheet while the search menu is expanded. */
.panel-search {
  gap: 0;
  overflow: hidden;
}
.sheet.expanded .panel-search {
  flex: 1 1 auto;
}
/* Center pin is only meaningful while choosing points on the map */
body:not([data-stage="search"]):not([data-stage="pickup"]) .center-pin {
  display: none;
}

.panel-headline h2 {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--ink);
}
.panel-headline p {
  margin-top: 3px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.35;
}
.panel-title {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--ink);
}
.eyebrow {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.muted {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

/* Black pill primary button (like Avo) */
.primary-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 52px;
  border-radius: 16px;
  background: var(--ink);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
  flex-shrink: 0;
  touch-action: manipulation;
  transition: transform 0.15s ease, opacity 0.2s ease;
}
.primary-btn:active {
  transform: scale(0.98);
  opacity: 0.9;
}
.text-btn {
  align-self: center;
  padding: 10px 16px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--muted);
  touch-action: manipulation;
}
.text-btn:active {
  color: var(--ink);
}

/* Pickup picker panel */
.pickup-current {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 8px;
  background: #f6f7f9;
  border-radius: 16px;
}
.pickup-current .dest-name {
  font-size: 15.5px;
}

/* Options panel: route summary */
.options-route {
  display: flex;
  flex-direction: column;
  background: #f6f7f9;
  border-radius: 16px;
  padding: 4px 14px;
}
.route-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
}
.route-dot {
  display: block;
  width: 12px;
  height: 12px;
  min-width: 12px;
  min-height: 12px;
  max-width: 12px;
  max-height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  align-self: center;
}
.route-dot.origin {
  background: var(--ink);
}
.route-dot.dest {
  background: var(--blue);
}
.route-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.route-copy small {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.route-copy strong {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.route-edit {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--blue);
  padding: 6px 8px;
  touch-action: manipulation;
}
.route-sep {
  height: 1px;
  background: #e8eaee;
}

/* Tariff list — bounded so the sheet stays compact; scrolls if needed */
.ride-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  min-height: 0;
  max-height: 42vh;
  max-height: 42dvh;
}
.ride-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #f6f7f9;
  border: 2px solid transparent;
  text-align: left;
  touch-action: manipulation;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.ride-option.active {
  border-color: var(--ink);
  background: #fff;
}
.ride-emoji {
  font-size: 26px;
  line-height: 1;
  flex-shrink: 0;
}
.ride-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.ride-copy strong {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.2px;
}
.ride-copy small {
  font-size: 12px;
  color: var(--muted);
}
.ride-price {
  font-size: 15px;
  font-weight: 800;
  flex-shrink: 0;
}

/* Order row: cash badge + primary button */
.order-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
/* Inside the row the button must share width with the badge, not take 100% */
.order-row .primary-btn {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}
.pay-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: #f1f3f6;
  font-size: 16px;
  font-weight: 800;
  flex-shrink: 0;
}
.pay-badge small {
  font-size: 8.5px;
  font-weight: 700;
  color: var(--muted);
  margin-top: 1px;
}

/* Back button (glass arrow) — tucked to the left edge of the sheet */
.panel-back {
  align-self: flex-start;
  width: 42px;
  height: 42px;
  margin: -4px 0 -8px -6px;
}
.panel-searching .panel-back,
.panel-trip .panel-back {
  align-self: flex-start;
}

/* Tariff car cut-outs (Photoroom PNGs) */
.ride-img {
  width: 66px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
  margin: -5px 0;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}
.ride-option.active .ride-img {
  transform: scale(1.05);
  transition: transform 0.15s ease;
}

/* "+ адрес по пути" — intermediate stops under the route card */
.via-add {
  align-self: flex-start;
  margin-top: -6px;
  margin-left: -6px;
  padding: 6px 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--blue);
  touch-action: manipulation;
}
.via-rows {
  display: flex;
  flex-direction: column;
}
.via-row {
  padding: 8px 0;
}
.route-dot.via {
  background: #b8bfca;
}
.via-input {
  width: 100%;
  border: none;
  background: none;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--ink);
  outline: none;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
}
.via-input::placeholder {
  color: #aab0b9;
  font-weight: 600;
}

/* Filter button — right of "Заказать", mirrors the pay badge */
.filter-btn {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: #f1f3f6;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  touch-action: manipulation;
  transition: background 0.15s ease, color 0.15s ease;
}
.filter-btn.active {
  background: var(--ink);
  color: #fff;
}
.filter-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  display: none;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--blue);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}
.filter-btn.active .filter-badge {
  display: flex;
}

/* Trip options modal (child seat, pet, heavy luggage…) */
.opts-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(17, 19, 24, 0.45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.opts-backdrop.show {
  display: flex;
}
.opts-sheet {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  padding: 10px 16px calc(16px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 72vh;
  animation: chat-slide 0.25s ease;
}
.opts-grab {
  width: 40px;
  height: 5px;
  border-radius: 3px;
  background: #e2e5ea;
  margin: 2px auto 4px;
  flex-shrink: 0;
}
.opts-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.opts-head strong {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.opts-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #f1f3f6;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  touch-action: manipulation;
}
.opts-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.opts-chips button {
  padding: 10px 14px;
  border-radius: 999px;
  background: #f1f3f6;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  touch-action: manipulation;
  transition: background 0.15s ease, color 0.15s ease;
}
.opts-chips button.selected {
  background: var(--ink);
  color: #fff;
}
.opts-note {
  font-size: 12px;
  color: var(--muted);
  margin: -4px 0 0;
}


/* Searching-for-driver animation (pulsing rings + car) */
.panel-searching,
.panel-trip {
  align-items: center;
  text-align: center;
  padding-top: 18px;
  padding-bottom: 10px;
}
.search-animation {
  position: relative;
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
}
.search-animation span {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(47, 107, 255, 0.4);
  animation: pulse-ring 1.8s ease-out infinite;
}
.search-animation span:nth-child(2) {
  animation-delay: 0.9s;
}
.search-animation i {
  position: relative;
  z-index: 1;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
@keyframes pulse-ring {
  0% { transform: scale(0.55); opacity: 1; }
  100% { transform: scale(1.15); opacity: 0; }
}

/* Driver card */
.driver-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.driver-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.driver-avatar.small {
  width: 40px;
  height: 40px;
  font-size: 14px;
}
.driver-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  background: #f6f7f9;
  border-radius: 16px;
}
.driver-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.driver-info strong {
  font-size: 15.5px;
  font-weight: 800;
  letter-spacing: -0.2px;
}
.driver-info small {
  font-size: 12.5px;
  color: var(--muted);
}
.plate {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: #fff;
  border: 1.5px solid #d9dde3;
  border-radius: 8px;
  padding: 6px 9px;
  flex-shrink: 0;
}

/* Call / message buttons */
.driver-actions {
  display: flex;
  gap: 10px;
}
.act-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  border-radius: 16px;
  background: #f1f3f6;
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 700;
  text-decoration: none;
  touch-action: manipulation;
  transition: background 0.15s ease, transform 0.15s ease;
}
.act-btn:active {
  background: #e5e8ed;
  transform: scale(0.98);
}

/* Trip progress */
.progress-track {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #eceef2;
  overflow: hidden;
  margin-top: 4px;
}
.progress-track span {
  display: block;
  height: 100%;
  width: 40%;
  border-radius: 3px;
  background: var(--blue);
  animation: trip-progress 3s linear forwards;
}
@keyframes trip-progress {
  0% { width: 8%; }
  100% { width: 100%; }
}


/* ===== Collapse state styles ===== */

/* Back arrow: floats ABOVE the white sheet, outside it, with a gap.
   It is a child of .sheet (position:fixed), anchored just above its top edge
   so it always hugs the top of the current block and leaves a clear gap. */
.panel-back-fixed {
  position: absolute;
  left: 14px;
  bottom: calc(100% + 12px);
  z-index: 40;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 4px 16px rgba(16, 24, 40, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  touch-action: manipulation;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.panel-back-fixed:active { transform: scale(0.92); }
.panel-back-fixed svg { width: 20px; height: 20px; stroke: var(--ink); }
/* Keep the back arrow hidden on the main menu stage */
body[data-stage="search"] .panel-back-fixed { opacity: 0; pointer-events: none; }

/* The grabber doubles as the collapse / expand paddle */
.sheet-grabber {
  cursor: pointer;
  touch-action: manipulation;
}

/* Collapsed sheet: transparent glass pill floating over the map, no white bg.
   The block moves down (closer to the bottom edge) and shrinks. */
.sheet.collapsed {
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border-color: transparent;
  box-shadow: none;
  padding-left: 12px;
  padding-right: 12px;
  max-height: none;
  height: auto;
  bottom: calc(var(--safe-bottom) + 10px);
}
.sheet.collapsed .panel {
  gap: 0;
  padding: 0;
  min-height: 0;
}
/* Hide every panel child except the floating preview pill */
.sheet.collapsed .panel > *:not(.collapse-pill) { display: none !important; }
/* The pill is hidden by default and only shown while collapsed (inactive
   panels stay display:none, so only the active panel's pill appears). */
.collapse-pill { display: none; }
.sheet.collapsed .collapse-pill { display: flex !important; }

/* ---- Floating glass preview pill (no white background) ---- */
.collapse-pill {
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(18, 22, 32, 0.5);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
  backdrop-filter: blur(20px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 10px 30px rgba(8, 12, 24, 0.35);
  color: #fff;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
.collapse-pill:active { transform: scale(0.99); }

.collapse-pill-flag {
  width: 34px; height: 34px; border-radius: 11px;
  background: var(--blue);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.collapse-pill-emoji { font-size: 22px; flex-shrink: 0; width: 34px; text-align: center; }
.collapse-pill-text { flex: 1; font-size: 15px; font-weight: 600; }
.collapse-pill-text b { font-weight: 800; }
.collapse-pill-cta { font-size: 13px; font-weight: 700; color: #a8bcff; flex-shrink: 0; }
.collapse-pill-price { font-size: 15px; font-weight: 800; flex-shrink: 0; }

/* Order (tariff) pill — solid blue "order" bar */
.collapse-pill-order {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  border-color: rgba(255, 255, 255, 0.22);
}
.collapse-pill-order .collapse-pill-price {
  background: rgba(255, 255, 255, 0.2);
  padding: 6px 12px; border-radius: 10px;
}

/* Driver pill — plate + eta on top, big "Уже выхожу" button below */
.collapse-pill-driver {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.collapse-pill-meta { display: flex; flex-direction: column; gap: 1px; }
.collapse-pill-meta strong { font-size: 16px; font-weight: 800; letter-spacing: 0.3px; }
.collapse-pill-meta small { font-size: 12px; color: rgba(255, 255, 255, 0.72); }
.collapse-pill-btn {
  width: 100%;
  padding: 13px;
  border: 0;
  border-radius: 12px;
  background: #ffffff;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  font-family: var(--font);
  cursor: pointer;
  touch-action: manipulation;
}
.collapse-pill-btn:active { transform: scale(0.99); }

/* Review panel */
.review-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  background: #f6f7f9;
  border-radius: 16px;
}
.review-summary > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.review-summary strong {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.2px;
}
.review-summary small {
  font-size: 12.5px;
  color: var(--muted);
}
.review-title {
  margin-top: 2px;
}
.stars {
  display: flex;
  justify-content: center;
  gap: 6px;
}
.stars button {
  font-size: 34px;
  line-height: 1;
  color: #d9dde3;
  padding: 4px;
  touch-action: manipulation;
  transition: color 0.15s ease, transform 0.15s ease;
}
.stars button.filled {
  color: #ffb300;
  transform: scale(1.08);
}
.review-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.review-tags button {
  padding: 9px 13px;
  border-radius: 12px;
  background: #f1f3f6;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  touch-action: manipulation;
  transition: background 0.15s ease, color 0.15s ease;
}
.review-tags button.selected {
  background: var(--ink);
  color: #fff;
}
.review-comment {
  width: 100%;
  min-height: 64px;
  resize: none;
  border: none;
  background: #f6f7f9;
  border-radius: 16px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  outline: none;
  -webkit-user-select: text;
  user-select: text;
}
.review-comment::placeholder {
  color: #aab0b9;
}


/* ===== Chat with the driver ===== */
.chat-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(17, 19, 24, 0.45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.chat-backdrop.show {
  display: flex;
}
.chat {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  padding: 10px 16px calc(16px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 72vh;
  animation: chat-slide 0.25s ease;
}
@keyframes chat-slide {
  from { transform: translateY(40px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}
.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f0f1f4;
  flex-shrink: 0;
}
.chat-head-copy {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.chat-head-copy strong {
  font-size: 15.5px;
  font-weight: 800;
  letter-spacing: -0.2px;
}
.chat-head-copy small {
  font-size: 12px;
  color: var(--muted);
}
.chat-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #f1f3f6;
  color: var(--ink);
  font-size: 14px;
  flex-shrink: 0;
  touch-action: manipulation;
}
.chat-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 2px 0;
}
.chat-msg {
  max-width: 78%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.35;
  -webkit-user-select: text;
  user-select: text;
}
.chat-msg.driver {
  align-self: flex-start;
  background: #f1f3f6;
  color: var(--ink);
  border-bottom-left-radius: 6px;
}
.chat-msg.me {
  align-self: flex-end;
  background: var(--blue);
  color: #fff;
  border-bottom-right-radius: 6px;
}
.chat-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.chat-form input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  border: none;
  background: #f1f3f6;
  border-radius: 14px;
  padding: 0 14px;
  font-size: 16.5px; /* keeps iOS from zooming on focus */
  font-weight: 600;
  color: var(--ink);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  -webkit-user-select: text;
  user-select: text;
}
.chat-form input::placeholder {
  color: #aab0b9;
  font-weight: 500;
}
.chat-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  touch-action: manipulation;
}
.chat-send:active {
  transform: scale(0.92);
}

