:root {
  --navy: #0B2545;
  --blue: #1B6CA8;
  --teal: #2EC4B6;
  --light-teal: #CBF3F0;
  --bg: #FAFAFA;
  --white: #ffffff;
  --text: #0B2545;
  --text-soft: #5C7086;
  --border: #E7ECEF;
  --danger: #E63946;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 2px 10px rgba(11, 37, 69, 0.06);
  --shadow-md: 0 8px 24px rgba(11, 37, 69, 0.10);
}

* { box-sizing: border-box; }
button, input { font-family: inherit; color: inherit; }

html, body {
  margin: 0;
  padding: 0;
  background: #E9EEF1;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
}

body {
  display: flex;
  justify-content: center;
  min-height: 100vh;
}

.app-shell {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: 100vh;
  background: var(--bg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

@media (min-width: 460px) {
  body { padding: 24px 0; }
  .app-shell { height: calc(100vh - 48px); border-radius: 28px; }
}

/* ---------- screens ---------- */
.screen {
  display: none;
  height: 100%;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.screen.active { display: flex; }

.content {
  padding: 0 20px 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ---------- topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 700; }
.icon-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--light-teal);
  color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.icon-btn .icon { width: 18px; height: 18px; }
.icon-btn:active { transform: scale(0.94); }

.icon { width: 22px; height: 22px; display: block; }
.icon-filled { fill: currentColor; }

/* ---------- typography helpers ---------- */
.eyebrow { font-size: 13px; color: var(--text-soft); margin: 0 0 4px; }
h2.title { font-size: 22px; margin: 4px 0 6px; }
p.subtitle { font-size: 14px; color: var(--text-soft); margin: 0 0 20px; line-height: 1.5; }

/* ---------- buttons ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  padding: 15px 18px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.btn-primary { background: linear-gradient(135deg, var(--navy), var(--blue)); color: #fff; box-shadow: var(--shadow-sm); }
.btn-secondary { background: var(--white); color: var(--blue); border: 1.5px solid var(--blue); }
.btn-ghost { background: transparent; color: var(--text-soft); font-weight: 500; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 10px 14px; font-size: 13px; width: auto; border-radius: var(--radius-sm); }
.btn-row { display: flex; gap: 10px; margin-top: auto; padding-top: 16px; }
.btn-stack { display: flex; flex-direction: column; gap: 10px; margin-top: auto; padding-top: 16px; }

/* ---------- option cards (region/city/hospital/mobility/location) ---------- */
.option-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.option-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
}
.option-card.selected { border-color: var(--teal); background: #F3FDFC; }
.option-card.disabled { opacity: 0.55; cursor: not-allowed; }
.option-card .radio {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  position: relative;
}
.option-card.selected .radio { border-color: var(--teal); }
.option-card.selected .radio::after {
  content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--teal);
}
.option-card .option-icon {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--light-teal); color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.option-card .option-text { flex: 1; min-width: 0; }
.option-card .option-text strong { display: block; font-size: 15px; }
.option-card .option-text span { display: block; font-size: 12.5px; color: var(--text-soft); margin-top: 2px; }

/* ---------- search bar ---------- */
.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 12px 16px;
}
.search-bar .icon { color: var(--text-soft); width: 19px; height: 19px; flex-shrink: 0; }
.search-bar input {
  border: none; outline: none; background: transparent;
  font-size: 14.5px; flex: 1; color: var(--text); min-width: 0;
}
.search-bar input::placeholder { color: #9AAAB8; }

/* ---------- list rows ---------- */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  background: none; border-left: none; border-right: none; border-top: none;
  width: 100%; text-align: left; cursor: pointer;
}
.list-item:last-child { border-bottom: none; }
.list-item .row-icon {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--light-teal); color: var(--navy);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.list-item .row-text { flex: 1; min-width: 0; }
.list-item .row-text strong { display: block; font-size: 14.5px; }
.list-item .row-text span { display: block; font-size: 12.5px; color: var(--text-soft); margin-top: 2px; }
.list-item .chevron { color: #C4CFD8; width: 18px; height: 18px; flex-shrink: 0; }
.list-item .row-photo {
  width: 56px; height: 56px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--blue), var(--teal));
}
.section-label {
  font-size: 12.5px; font-weight: 700; color: var(--text-soft);
  text-transform: uppercase; letter-spacing: 0.03em;
  margin: 18px 0 6px;
}

/* ---------- main menu ---------- */
.greeting { padding: 18px 20px 6px; }
.greeting .eyebrow { color: var(--text-soft); }
.greeting h2 { margin: 2px 0 16px; font-size: 21px; }

.menu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 18px;
}
.menu-cell {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 6px;
  cursor: pointer;
}
.menu-cell .menu-icon {
  width: 46px; height: 46px; border-radius: 14px;
  background: var(--light-teal); color: var(--navy);
  display: flex; align-items: center; justify-content: center;
}
.menu-cell span { font-size: 12px; font-weight: 600; text-align: center; line-height: 1.25; }

/* ---------- bottom nav ---------- */
.tabbar {
  position: sticky; bottom: 0; left: 0; right: 0;
  display: flex;
  margin-top: auto;
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 10px 8px calc(10px + env(safe-area-inset-bottom, 0px));
  z-index: 10;
  flex-shrink: 0;
}
.tab-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: none; color: var(--text-soft); cursor: pointer; padding: 4px;
}
.tab-btn.active { color: var(--teal); }
.tab-btn span { font-size: 11px; font-weight: 600; }

/* ---------- empty states ---------- */
.empty-state {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 14px; padding: 30px 10px;
}
.empty-state .empty-icon {
  width: 74px; height: 74px; border-radius: 50%;
  background: var(--light-teal); color: var(--navy);
  display: flex; align-items: center; justify-content: center;
}
.empty-state .empty-icon .icon { width: 32px; height: 32px; }
.empty-state h3 { margin: 0; font-size: 16px; }
.empty-state p { margin: 0; font-size: 13.5px; color: var(--text-soft); max-width: 260px; }

/* ---------- splash screen ---------- */
.splash-screen {
  justify-content: center; align-items: center; text-align: center; gap: 6px;
  background: linear-gradient(160deg, var(--navy), var(--blue));
  color: #fff;
}
.splash-loader {
  position: relative; width: 120px; height: 120px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 26px;
}
.splash-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.18);
  border-top-color: var(--teal);
  animation: splash-spin 1s linear infinite;
}
.splash-logo-wrap { animation: splash-pulse 1.6s ease-in-out infinite; border-radius: 22px; overflow: hidden; }
.logo-img { display: block; border-radius: 22px; object-fit: cover; box-shadow: 0 8px 20px rgba(11,37,69,0.25); }
@keyframes splash-spin { to { transform: rotate(360deg); } }
@keyframes splash-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.splash-title { font-size: 24px; font-weight: 700; margin: 0 0 6px; }
.splash-tag { font-size: 13px; opacity: 0.75; margin: 0; }

/* ---------- welcome screen ---------- */
.welcome-screen { position: relative; justify-content: space-between; padding: 48px 28px 32px; text-align: center; align-items: center; }
.welcome-top { display: flex; flex-direction: column; align-items: center; gap: 18px; margin-top: 10%; }
.welcome-top h1 { font-size: 26px; margin: 0; }
.welcome-top p { color: var(--text-soft); font-size: 14px; margin: 0; }
.welcome-actions { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.welcome-foot { font-size: 12px; color: var(--text-soft); margin-top: 18px; }

/* ---------- text inputs ---------- */
.text-field {
  width: 100%; padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 16px; outline: none; background: var(--white); color: var(--text);
}
.text-field:focus { border-color: var(--teal); }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-soft); margin: 14px 0 6px; }

.error-banner {
  display: flex; gap: 10px; align-items: flex-start;
  background: #FDECEE; color: var(--danger);
  border-radius: var(--radius-md); padding: 14px; font-size: 13.5px; margin: 14px 0;
}
.error-banner .icon { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }

/* ---------- location details / route preview ---------- */
.detail-hero {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 20px; margin-top: 4px; box-shadow: var(--shadow-sm);
}
.detail-hero .row-icon { width: 52px; height: 52px; border-radius: 16px; }
.detail-hero-top { display: flex; align-items: center; gap: 14px; }
.detail-hero h2 { margin: 0 0 2px; font-size: 18px; }
.detail-hero .meta { font-size: 13px; color: var(--text-soft); }
.detail-hero .desc { font-size: 13.5px; color: var(--text-soft); margin-top: 14px; line-height: 1.6; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.info-chip { background: var(--light-teal); border-radius: var(--radius-sm); padding: 10px 12px; }
.info-chip span { display: block; font-size: 11px; color: var(--text-soft); }
.info-chip strong { display: block; font-size: 13.5px; margin-top: 2px; }

.map-wrap { position: relative; }
.route-map {
  position: relative;
  height: 280px;
  border-radius: var(--radius-lg);
  background: #EEF3F2;
  border: 1px solid var(--border);
  overflow: hidden;
}
.route-map svg { position: absolute; inset: 0; width: 100%; height: 100%; }
#map-scene { transition: transform 0.2s ease; }

.map-controls {
  position: absolute; bottom: 12px; inset-inline-end: 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.map-btn {
  width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid var(--border); background: rgba(255,255,255,0.95);
  color: var(--navy); font-size: 17px; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: var(--shadow-sm);
}
.map-btn .icon { width: 16px; height: 16px; }
.map-btn:active { transform: scale(0.92); }
.map-btn-recenter { margin-top: 4px; }

.map-legend {
  position: absolute; top: 12px; inset-inline-start: 12px;
  background: rgba(255,255,255,0.92); border-radius: var(--radius-sm);
  padding: 6px 10px; font-size: 11px; color: var(--text-soft);
  display: flex; flex-direction: column; gap: 4px;
  box-shadow: var(--shadow-sm);
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.legend-dot-start { background: var(--navy); }
.legend-dot-end { background: var(--teal); }

.route-meta { display: flex; align-items: center; gap: 8px; margin: 16px 0 4px; flex-wrap: wrap; }
.route-type-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--light-teal); color: var(--navy);
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
}
.route-type-badge .icon { width: 15px; height: 15px; }
.accessible-note {
  font-size: 11.5px; color: var(--teal); font-weight: 600;
}
.route-stats { font-size: 13px; color: var(--text-soft); line-height: 1.7; }
.route-stats strong { color: var(--text); }

/* ---------- AR navigation ---------- */
.ar-screen { padding: 0; background: #0A1826; color: #fff; min-height: 100%; }
.ar-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; position: relative; z-index: 3;
}
.ar-topbar .icon-btn { background: rgba(255,255,255,0.16); color: #fff; }
.ar-dest { text-align: center; }
.ar-dest .eyebrow { color: rgba(255,255,255,0.65); margin: 0; }
.ar-dest strong { font-size: 14px; }
.ar-view {
  position: relative;
  flex: 1;
  min-height: 380px;
  overflow: hidden;
  background:
    linear-gradient(180deg, #1c3350 0%, #16283f 40%, #0e1c2d 100%);
}
.ar-camera {
  position: absolute; inset: 0; z-index: 0;
  width: 100%; height: 100%; object-fit: cover;
  display: none; background: #0A1826;
}
.ar-camera.active { display: block; }
.ar-dim {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, rgba(10,24,38,0.45) 0%, rgba(10,24,38,0.05) 32%, rgba(10,24,38,0.05) 68%, rgba(10,24,38,0.6) 100%);
}
.ar-camera-notice {
  position: absolute; top: 60px; left: 12px; right: 12px; z-index: 3;
  background: rgba(11,37,69,0.75); color: #fff; text-align: center;
  font-size: 12px; padding: 8px 14px; border-radius: 10px;
}
.ar-arrow {
  position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%);
  width: 70px; height: 70px; color: var(--teal); z-index: 2;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.35));
  animation: arrowPulse 1.4s ease-in-out infinite;
}
@keyframes arrowPulse {
  0%, 100% { transform: translate(-50%, -50%) translateY(0); }
  50% { transform: translate(-50%, -50%) translateY(-8px); }
}
.ar-status {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%); z-index: 2;
  background: rgba(11,37,69,0.55); backdrop-filter: blur(2px);
  padding: 8px 16px; border-radius: 999px; font-size: 12.5px;
}
.ar-sheet {
  background: #0F2136; padding: 20px; border-radius: 24px 24px 0 0;
  margin-top: -24px; position: relative; z-index: 2;
}
.ar-instruction { display: flex; align-items: center; gap: 14px; }
.ar-instruction .dir-icon {
  width: 48px; height: 48px; border-radius: 14px;
  background: rgba(46,196,182,0.18); color: var(--teal);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ar-instruction h3 { margin: 0; font-size: 16px; }
.ar-instruction p { margin: 2px 0 0; font-size: 12.5px; color: rgba(255,255,255,0.6); }
.ar-actions { display: flex; gap: 10px; margin-top: 18px; }
.ar-actions .btn-secondary { background: transparent; color: #fff; border-color: rgba(255,255,255,0.3); }
.ar-arrived { display: none; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.ar-arrived .icon { width: 46px; height: 46px; color: var(--teal); }

/* ---------- favorites row swipe-less delete ---------- */
.fav-item { position: relative; }
.fav-remove { background: none; border: none; color: var(--text-soft); cursor: pointer; padding: 6px; }
.fav-remove .icon { width: 18px; height: 18px; }

/* ---------- toast ---------- */
.toast {
  position: absolute; left: 20px; right: 20px; bottom: 24px;
  background: var(--navy); color: #fff;
  padding: 13px 16px; border-radius: var(--radius-md);
  font-size: 13.5px; text-align: center;
  box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none; transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateY(0); }
