/* Volt — Clean micromobility UI
   White, minimal, single-scan-entry design.
   The bottom "Scan" pill morphs in place into the brand picker,
   then morphs again into a bottom camera preview card. */

:root {
  --bg: #eef2f5;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --surface-hover: #e5e8ec;
  --text: #12161a;
  --muted: #5e6875;
  --dim: #909aa6;
  --line: rgba(0, 0, 0, 0.07);
  --line-strong: rgba(0, 0, 0, 0.12);

  /* Authentic Lime green */
  --lime: #00dd62;
  --lime-dark: #00be54;
  --lime-soft: rgba(0, 221, 98, 0.12);
  --lime-text: #04652e;

  --amber: #f59e0b;
  --amber-soft: #fef3c7;
  --blue: #0284c7;
  --blue-soft: #e0f2fe;
  --danger: #ef4444;
  --danger-soft: #fee2e2;

  --mono: ui-monospace, "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;

  /* Flat, utilitarian: no drop shadows anywhere. */
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;

  /* Apple-ish: a long, gentle ease-out for morphs + an overshoot spring for pops */
  --morph: cubic-bezier(0.32, 0.72, 0, 1);
  --morph-ms: 0.52s;
  --spring: cubic-bezier(0.34, 1.42, 0.5, 1);
  --spring-soft: cubic-bezier(0.22, 1.3, 0.36, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }

body {
  background: #f0f2f5;
  color: var(--text);
  font-family: var(--sans);
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
button:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }

.orb { display: none !important; }

/* ---------- Phone Container ---------- */
.phone {
  position: relative;
  isolation: isolate;
  width: 100%;
  max-width: 412px;
  height: 100dvh;
  max-height: 920px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
}

@media (min-width: 520px) and (min-height: 760px) {
  .phone {
    border-radius: 14px;
    border: 1px solid var(--line-strong);
  }
}

/* ---------- Top Bar ---------- */
.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 8px;
  background: transparent;
}

/* Toasts dock to the right of the bar, clear of the brand mark. */
.topbar-slot {
  position: absolute;
  left: 96px;
  right: 18px;
  top: 12px;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}

/* Bare lockup — no container, no pill, just the mark + wordmark. */
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--lime);
  color: #042e12;
  display: grid;
  place-items: center;
}

.brand-mark svg { width: 16px; height: 16px; }

.brand-name {
  font-size: 17px;
  font-weight: 900;
  letter-spacing: -0.05em;
  color: var(--text);
}

.brand-pill {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--lime-soft);
  color: var(--lime-text);
}

/* ---------- Main Content ---------- */
.content {
  position: relative;
  z-index: 5;
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 120px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.content::-webkit-scrollbar { display: none; }

.hero {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--line-strong);
  animation: heroIn 0.4s ease both;
}

@keyframes heroIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.hero-top {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
}

.eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--dim);
}

.hero-date { color: var(--dim); font-weight: 700; }

.hero h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: -0.035em;
  font-weight: 800;
  color: var(--text);
}

.hero-balance {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}

.hero-bar {
  flex: 1;
  height: 6px;
  border-radius: 2px;
  background: var(--surface-2);
  overflow: hidden;
}

/* Full bar — reads as a real limit meter, with the ∞ filling it edge to edge. */
.hero-bar i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: var(--lime);
  transform-origin: left center;
}

.hero-balance-text {
  margin: 0;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.hero-balance-text b {
  font-weight: 800;
  color: var(--text);
  font-size: 13px;
}

/* The unlimited glyph stands in for the finite number. */
.hero-balance-text .hero-infinity {
  display: inline-block;
  color: var(--lime);
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  vertical-align: -1px;
}

/* legacy in-page scanner card — unused */
.scanner-zone { display: none !important; }

/* Section Header */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 0;
}

.section-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.section-count {
  font-size: 12px;
  font-weight: 750;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Ride list — when empty, fills the remaining height so the empty
   state can sit at the optical middle of the screen. */
.ride-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ride-list:has(.empty-state:not([hidden])) {
  flex: 1;
}

.empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px 20px 96px;
}

.empty-state strong {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--muted);
}

.empty-state[hidden] { display: none !important; }

/* ---------- Ride Card ---------- */
.ride-card {
  position: relative;
  --accent: var(--lime);
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  border: 1px solid var(--line-strong);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: cardIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.ride-card.riding {
  border-left: 3px solid var(--accent);
}

.ride-card.leaving {
  opacity: 0;
  transform: scale(0.96);
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s var(--morph);
}

/* Cancellation sequence: the card pours out in a little Apple-style
   dissolve, flinging green particles out of the QR as it goes. */
.ride-card.dissolving {
  position: relative;
  animation: cardDissolve 0.66s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  pointer-events: none;
}
.ride-card.dissolving.dissolve-late {
  animation-duration: 0.92s;
}

@keyframes cardDissolve {
  0% { transform: scale(1); filter: blur(0); }
  32% { transform: scale(1.025); filter: blur(0); }
  100% { transform: scale(0.9) translateY(6px); opacity: 0; filter: blur(7px); }
}

.dissolve-cloud {
  position: absolute;
  left: 42px;
  top: 42px;
  z-index: 4;
  pointer-events: none;
}

.dissolve-cloud .p {
  position: absolute;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 2.5px;
  background: var(--accent);
  opacity: 0;
  animation: particleFly 0.72s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
  animation-delay: var(--d, 0ms);
}

@keyframes particleFly {
  0% { opacity: 1; transform: translate(0, 0) scale(0.4) rotate(0deg); }
  28% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx, 0), var(--dy, -50px)) scale(1.05) rotate(var(--rot, 180deg)); }
}

/* Cancel-phase rows reuse the boot progress UI but in a calmer tone. */
.ride-card.cancelling .phase-row { background: #fff7f7; }
.ride-card.cancelling .mini-spinner { border-color: rgba(239, 68, 68, 0.18); border-top-color: var(--danger); }
.ride-card.cancelling .phase-label { color: #b91c1c; }
.ride-card.cancelling .steps i::after { background: var(--danger); }
.ride-card.cancelling .steps i.done { background: var(--danger); }
.ride-card.cancelling .ride-badge { color: #b91c1c; background: var(--danger-soft); }

/* A quick ring pulse when a scan lands */
.ride-card.scan-pop { animation: cardIn 0.3s var(--spring) both; }

.ride-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ride-qr {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #ffffff;
  display: grid;
  place-items: center;
  color: var(--text);
  flex: 0 0 48px;
  overflow: hidden;
  padding: 3px;
  border: 1px solid var(--line);
}

/* QR + provider logo are stacked; the swap is driven by the active class. */
.ride-qr-img,
.ride-brand-img {
  position: absolute;
  inset: 3px;
  width: calc(100% - 6px);
  height: calc(100% - 6px);
  object-fit: contain;
  display: block;
  border-radius: 6px;
  transition: opacity 0.45s ease, transform 0.5s var(--spring);
}

.ride-brand-img {
  opacity: 0;
  transform: scale(0.6) rotate(-14deg);
  background: #ffffff;
}

/* While riding, fade the QR out and pop the provider logo in. */
.riding .ride-qr-img { opacity: 0; transform: scale(0.6); }
.riding .ride-brand-img { opacity: 1; transform: scale(1) rotate(0deg); }

.ride-qr svg { width: 26px; height: 26px; }

.riding .ride-qr {
  border-color: rgba(0, 221, 98, 0.5);
}

/* "Scooter" only appears once the ride is actually starting. */
.ride-dot-sep,
.ride-label-scooter {
  display: inline-block;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: max-width 0.3s var(--morph), opacity 0.24s ease, margin 0.3s var(--morph);
}

.ride-card.show-scooter .ride-dot-sep,
.ride-card.show-scooter .ride-label-scooter {
  max-width: 90px;
  opacity: 1;
}

.ride-id { flex: 1; min-width: 0; }

.ride-meta-line {
  display: flex;
  align-items: center;
  gap: 5px;
}

.ride-name {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
}

.ride-dot-sep { font-size: 10px; color: var(--dim); }

.ride-label-scooter {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.ride-code {
  display: block;
  margin-top: 1px;
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.ride-badge {
  font-size: 11px;
  font-weight: 750;
  padding: 4px 10px;
  border-radius: 4px;
  flex: 0 0 auto;
}

.badge-amber { color: #b45309; background: var(--amber-soft); }
.badge-blue { color: #0369a1; background: var(--blue-soft); }
.badge-green { color: var(--lime-text); background: var(--lime-soft); }
.badge-red { color: #b91c1c; background: var(--danger-soft); }

.phase-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  padding: 10px 14px;
  border-radius: var(--radius-md);
}

.mini-spinner {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--text);
  animation: spin 0.8s linear infinite;
  flex: 0 0 15px;
}

.phase-label { font-size: 13px; font-weight: 650; color: var(--text); }

.steps { display: flex; gap: 4px; }

.steps i {
  position: relative;
  flex: 1;
  height: 4px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
  transition: background 0.2s;
}

/* Each segment fills left→right over that phase's rolled duration. */
.steps i::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  opacity: 0;
}

.steps i.current::after {
  opacity: 1;
  transform: scaleX(1);
  transition: transform var(--fill-dur, 400ms) linear;
}

.steps i.done { background: var(--accent); }

.ride-live {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.riding .ride-live { display: flex; }
.riding .phase-row, .riding .steps { display: none; }

.live-left { display: flex; align-items: center; gap: 10px; }

.eq {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 10px;
  height: 10px;
}

.eq i { display: none; }

.eq::before {
  content: "";
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--accent);
}

.live-text { font-size: 12px; color: var(--muted); }

.live-text b {
  display: block;
  color: var(--text);
  font-size: 14px;
  font-weight: 750;
}

.ride-time-wrap { text-align: right; }

.ride-time {
  display: block;
  font-family: var(--sans);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.ride-time-label {
  display: block;
  margin-top: 3px;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.ride-foot { display: flex; justify-content: flex-end; }

.btn-cancel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  transition: all 0.15s;
}

.btn-cancel:hover { background: var(--danger-soft); color: var(--danger); }
.btn-cancel svg { width: 12px; height: 12px; }

/* ---------- Bottom Bar ---------- */
.hamburger {
  position: absolute;
  bottom: 24px;
  left: 18px;
  z-index: 25;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1px solid var(--line-strong);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: transform 0.15s, opacity 0.25s;
}

.hamburger:active { transform: scale(0.94); }

.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
}

.hamburger span:nth-child(2) { width: 13px; margin-right: 5px; }

.cancel-all {
  position: absolute;
  bottom: 24px;
  right: 18px;
  z-index: 26;
  height: 52px;
  padding: 0 16px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: var(--danger);
  font-size: 13px;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s, opacity 0.25s;
}

.cancel-all:active { transform: scale(0.96); }
.cancel-all svg { width: 15px; height: 15px; }

.cancel-all[hidden] { display: none !important; }

/* Dim + retire the bottom chrome while the scan surface is expanded */
.phone.scan-open .hamburger,
.phone.scan-open .cancel-all {
  opacity: 0;
  pointer-events: none;
}

/* ---------- Morphing Scan Surface ----------
   One element that IS the pill when idle, then grows into the
   brand picker, then into the camera preview. */
.scan-scrim {
  position: absolute;
  inset: 0;
  z-index: 55;
  background: rgba(12, 16, 22, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.scan-scrim.on { opacity: 1; pointer-events: auto; }

.scan-surface {
  position: absolute;
  left: 80px;
  right: 18px;
  bottom: 24px;
  height: 52px;
  z-index: 60;
  border-radius: 10px;
  background: var(--lime);
  color: #042e12;
  overflow: hidden;
  isolation: isolate;
  transition:
    left var(--morph-ms) var(--morph),
    right var(--morph-ms) var(--morph),
    bottom var(--morph-ms) var(--morph),
    height var(--morph-ms) var(--morph),
    border-radius var(--morph-ms) var(--morph),
    background-color 0.3s ease;
  will-change: left, right, bottom, height, border-radius;
}

/* Idle pill keeps room for the Cancel-all button when rides are live */
.phone:has(.cancel-all:not([hidden])) .scan-surface[data-state="idle"] {
  right: 138px;
}

.scan-surface[data-state="brands"] {
  left: 18px;
  right: 18px;
  bottom: 24px;
  height: min(80%, 356px);
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid var(--line-strong);
}

.scan-surface[data-state="camera"] {
  left: 18px;
  right: 18px;
  bottom: 24px;
  height: min(84%, 566px);
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid var(--line-strong);
}

/* The idle pill content */
.scan-trigger {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #042e12;
  opacity: 1;
  transition: opacity 0.16s ease;
}

.scan-surface:not([data-state="idle"]) .scan-trigger {
  opacity: 0;
  pointer-events: none;
}

.scan-trigger-icon { width: 22px; height: 22px; flex: 0 0 auto; }

/* Views inside the surface */
.scan-view {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease 0.14s;
}

.scan-surface[data-state="brands"] .scan-brands,
.scan-surface[data-state="camera"] .scan-cam {
  opacity: 1;
  pointer-events: auto;
}

/* ---- Brand picker view ---- */
.scan-brands {
  display: flex;
  flex-direction: column;
  padding: 22px 20px;
}

.scan-view-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.scan-view-head h3 {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.scan-view-head p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.scan-view-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  display: grid;
  place-items: center;
  transition: background 0.15s;
}

.scan-view-close:hover { background: var(--surface-hover); }
.scan-view-close svg { width: 16px; height: 16px; }

.brand-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.brand-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 16px 10px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1.5px solid transparent;
  transition: all 0.18s;
  cursor: pointer;
}

/* Each card is tinted with its own brand color; unsupported stays red. */
.brand-card[data-brand="lime"] { --brand: #00dd62; }
.brand-card[data-brand="dott"] { --brand: #00a8e9; }
.brand-card[data-brand="voi"]  { --brand: #f36961; }

/* Supported brands carry a brand-colored accent dot */
.brand-card::after {
  content: "";
  position: absolute;
  top: 12px;
  right: 12px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand, var(--lime));
}

.brand-card:hover {
  background: #ffffff;
  border-color: color-mix(in srgb, var(--brand, var(--lime)) 55%, transparent);
}

.brand-card[data-brand="lime"] .brand-title { color: #04652e; }
.brand-card[data-brand="dott"] .brand-title { color: #046283; }
.brand-card[data-brand="voi"]  .brand-title { color: #a32b24; }

.brand-card:active { transform: scale(0.97); }

/* Bolt is unsupported — red accent instead */
.brand-card.unsupported {
  background: #fff7f7;
}

.brand-card.unsupported::after {
  background: var(--danger);
}

.brand-card.unsupported .brand-title {
  color: #b91c1c;
}

.brand-card.unsupported:hover {
  background: #ffffff;
  border-color: rgba(239, 68, 68, 0.5);
}

.brand-logo-wrap {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  background: #ffffff;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-card[data-brand="bolt"] .brand-logo-img {
  object-fit: contain;
  padding: 6px;
}

.brand-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* ---- Camera preview view (white theme) ---- */
.scan-cam {
  display: flex;
  --accent: var(--lime);
  --accent-text: var(--lime-text);
  flex-direction: column;
  color: var(--text);
  background: #ffffff;
}

.scan-cam-stage {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: #f4f7fa;
  display: grid;
  place-items: center;
}

/* The whole preview is a tap target: the camera feed IS the button. */
.cam-tap {
  position: absolute;
  inset: 0;
  z-index: 4;
  border-radius: inherit;
  background: transparent;
  cursor: pointer;
  transition: background 0.2s ease;
}
.cam-tap:active { background: rgba(0, 0, 0, 0.04); }

.scan-cam-stage video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.scan-cam-stage video.live { opacity: 1; }

/* Flat sandbox shown while there is no camera feed */
.cam-backdrop {
  position: absolute;
  inset: 0;
  background: #f4f7fa;
  transition: opacity 0.4s ease;
}

.cam-backdrop::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(10, 20, 30, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(10, 20, 30, 0.06) 1px, transparent 1px);
  background-size: 26px 26px;
}

.scan-cam-stage video.live ~ .cam-backdrop { opacity: 0; }

.scan-cam-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
}

.cam-brand-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 5px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--line-strong);
}

.cam-brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
  background: #ffffff;
  display: grid;
  place-items: center;
  flex: 0 0 28px;
  border: 1px solid var(--line);
}

.cam-brand-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.cam-brand-name {
  font-size: 13px;
  font-weight: 750;
  letter-spacing: -0.01em;
  color: var(--text);
}

.scan-view-close {
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--line-strong);
}

.scan-view-close:hover { background: #ffffff; }

.scan-cam-title {
  position: absolute;
  bottom: 62px;
  left: 26px;
  right: 26px;
  z-index: 6;
  text-align: center;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--muted);
}

/* Pulse "Tap to scan" affordance under the viewfinder */
.cam-pulse-hint {
  position: absolute;
  bottom: 22px;
  left: 0;
  right: 0;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--accent-text);
  pointer-events: none;
  animation: hintPulse 1.9s ease-in-out infinite;
}

.cam-pulse-hint svg { width: 16px; height: 16px; }

@keyframes hintPulse {
  0%, 100% { opacity: 0.65; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-2px); }
}

/* Viewfinder frame */
.viewfinder {
  position: relative;
  z-index: 2;
  width: min(62%, 226px);
  aspect-ratio: 1;
  border-radius: var(--radius-md);
}

.vf-corner {
  display: block;
  position: absolute;
  width: 36px;
  height: 36px;
  border: 4px solid var(--accent);
}

.vf-corner.tl { top: -2px; left: -2px; border-right: 0; border-bottom: 0; border-radius: 4px 0 0 0; }
.vf-corner.tr { top: -2px; right: -2px; border-left: 0; border-bottom: 0; border-radius: 0 4px 0 0; }
.vf-corner.bl { bottom: -2px; left: -2px; border-right: 0; border-top: 0; border-radius: 0 0 0 4px; }
.vf-corner.br { bottom: -2px; right: -2px; border-left: 0; border-top: 0; border-radius: 0 0 4px 0; }

.vf-laser {
  position: absolute;
  left: 12px;
  right: 12px;
  height: 3px;
  border-radius: 3px;
  background: var(--accent);
  animation: scanline 2.4s ease-in-out infinite alternate;
}

.vf-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(10, 20, 30, 0.12);
}

.vf-center svg { width: 40%; height: 40%; }

.cam-hint {
  position: absolute;
  bottom: 84px;
  left: 16px;
  right: 16px;
  z-index: 8;
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--muted);
  text-align: center;
  display: none;
}

.cam-hint.show { display: block; }

.capture-flash {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
}

.capture-flash.on { animation: flash 0.6s ease-out both; }

.detected {
  position: absolute;
  inset: 0;
  z-index: 9;
  background: #fafcfe;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
}

.detected.on { display: flex; }

.detected-crop {
  width: 176px;
  height: 176px;
  border-radius: 18px;
  background: #ffffff;
  padding: 12px;
  border: 1px solid var(--line-strong);
  animation: detectPop 0.32s var(--spring) both;
}

.detected-crop img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 8px;
}

.detected-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.detected-badge {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--lime);
  color: #042e12;
  display: grid;
  place-items: center;
  flex: 0 0 34px;
}

.detected-badge svg { width: 20px; height: 20px; }

.detected-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.detected-kicker {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dim);
}

.detected-id {
  font-family: var(--sans);
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

@keyframes detectPop {
  0% { opacity: 0; transform: scale(0.86) translateY(6px); }
  60% { opacity: 1; transform: scale(1.03) translateY(0); }
  100% { opacity: 1; transform: scale(1); }
}

/* ---------- Side Drawer ---------- */
.scrim {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

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

.drawer {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 84%;
  max-width: 320px;
  z-index: 50;
  background: #ffffff;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border-right: 1px solid var(--line-strong);
  overflow-y: auto;
}

.drawer::-webkit-scrollbar { display: none; }
.drawer.open { transform: none; }

.drawer-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.drawer-name { font-size: 16px; font-weight: 800; color: var(--text); }
.drawer-mail { font-size: 13px; color: var(--muted); margin-top: 1px; }

.drawer-x {
  margin-left: auto;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  display: grid;
  place-items: center;
  color: var(--text);
}

.drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 650;
  color: var(--muted);
  transition: all 0.15s;
}

.nav-item svg { width: 20px; height: 20px; flex: 0 0 auto; }

.nav-item:hover, .nav-item.active {
  color: var(--text);
  background: var(--surface-2);
}

.drawer-sep { height: 1px; background: var(--line); margin: 10px 0 16px; }

.drawer-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--dim);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.demo-desc {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}

.demo-scan {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 46px;
  border-radius: var(--radius-sm);
  background: var(--lime);
  color: #042e12;
  font-size: 14px;
  font-weight: 750;
  transition: opacity 0.15s;
}

.demo-scan:hover { opacity: 0.9; }
.demo-scan svg { width: 18px; height: 18px; }

.demo-reset {
  margin-top: 10px;
  display: block;
  width: 100%;
  height: 42px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.drawer-foot {
  margin-top: auto;
  padding-top: 20px;
  font-size: 12px;
  color: var(--dim);
  text-align: center;
}

/* ---------- Confirmation Dialog ---------- */
.dialog-wrap {
  position: absolute;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, 0.5);
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.dialog-wrap.open { opacity: 1; pointer-events: auto; }
.dialog-wrap[hidden] { display: none !important; }

.dialog {
  width: 100%;
  max-width: 320px;
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  padding: 24px;
  text-align: center;
  transform: scale(0.96);
  transition: transform 0.2s;
}

.dialog-wrap.open .dialog { transform: none; }

.dialog-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border-radius: var(--radius-md);
  background: var(--danger-soft);
  color: var(--danger);
  display: grid;
  place-items: center;
}

.dialog h3 { margin: 0 0 6px; font-size: 18px; font-weight: 800; color: var(--text); }

.dialog p {
  margin: 0 0 22px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
}

.dialog-actions { display: flex; gap: 10px; }

.dialog-actions .btn-ghost {
  flex: 1;
  height: 46px;
  font-size: 14px;
  background: var(--surface-2);
  color: var(--text);
}

.btn-danger {
  flex: 1;
  height: 46px;
  border-radius: var(--radius-sm);
  background: var(--danger);
  color: #ffffff;
  font-size: 14px;
  font-weight: 750;
}

/* ---------- Toasts ---------- */
.toast-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  border: 1px solid var(--line);
  max-width: 100%;
  /* centred + width-fit, so it hugs its text like a Dynamic Island pill */
  align-self: center;
  width: fit-content;
  animation: toastIn 0.4s var(--spring) both;
}

.toast.out { animation: toastOut 0.2s ease-in forwards; }

.toast .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lime);
  flex: 0 0 auto;
}

.toast.danger .dot { background: var(--danger); }
.toast.info .dot { background: var(--blue); }

/* ---------- Keyframes ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes scanline {
  0% { top: 10%; opacity: 0.35; }
  50% { opacity: 1; }
  100% { top: 88%; opacity: 0.35; }
}
@keyframes cardIn { from { opacity: 0; transform: translateY(12px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-16px) scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-12px) scale(0.96); } }
@keyframes flash { 0% { opacity: 0.9; } 100% { opacity: 0; } }
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

.toast.shake { animation: toastIn 0.25s var(--spring) both, shake 0.5s ease-in-out; }

/* While the surface morphs, don't clip the view's own fade-in. */
.scan-surface.morphing { overflow: visible; }

@media (prefers-reduced-motion: reduce) {
  .scan-surface { transition-duration: 0.01s; }
  .scan-view { transition-delay: 0s; }
  .cam-pulse-hint,
  .vf-laser { animation: none; }
  .dissolve-cloud { display: none; }
  .ride-card.dissolving { animation-duration: 0.01s; }
  .ride-card.scan-pop { animation: cardIn 0.01s both; }
  .hero,
  .toast { animation-duration: 0.01s; }
  .hero-bar i { animation: none; }
}
