:root {
  color-scheme: light;
  --paper: #f8e7dc;
  --paper-2: #fff7ef;
  --cream: #fffaf4;
  --peach: #f8b8ab;
  --peach-2: #ffd4c9;
  --coral: #dc6551;
  --ink: #783a2b;
  --ink-soft: #a36c5c;
  --line: #b86a56;
  --line-soft: #d7aa99;
  --sage: #a7ae78;
  --shadow: 0 10px 30px rgba(120, 58, 43, .08);
  --radius: 24px;
  font-family: "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(184,106,86,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(184,106,86,.055) 1px, transparent 1px);
  background-size: 26px 26px;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
button { font: inherit; }

.app-shell {
  width: min(100%, 500px);
  margin: 0 auto;
  padding: 22px 16px 34px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 2px 18px;
}
.brand-block { display: flex; align-items: center; gap: 12px; }
.kicker {
  margin: 0 0 2px;
  font-size: .68rem;
  letter-spacing: .13em;
  color: var(--ink-soft);
  font-weight: 800;
}
h1 {
  margin: 0;
  font-size: clamp(2rem, 9vw, 2.65rem);
  line-height: .95;
  letter-spacing: -.04em;
  color: var(--coral);
}

.sun-doodle {
  width: 48px;
  height: 48px;
  border: 2px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #ffd58c;
  box-shadow: 0 0 0 6px rgba(255,213,140,.22);
  transform: rotate(-4deg);
}
.sun-face { font-size: .85rem; letter-spacing: -2px; }

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 2px solid var(--line-soft);
  background: rgba(255,250,244,.72);
  padding: 8px 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 800;
  white-space: nowrap;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #d7aa99; }
.live-pill.live .live-dot { background: #82a96b; box-shadow: 0 0 0 4px rgba(130,169,107,.14); }
.live-pill.error .live-dot { background: var(--coral); }

.welcome-card,
.eta-card,
.route-strip,
.passing-card {
  position: relative;
  overflow: hidden;
  background: rgba(255,250,244,.92);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.welcome-card { padding: 21px 16px 17px; margin-bottom: 14px; }
.welcome-card h2 {
  position: relative;
  z-index: 2;
  margin: 0 0 14px;
  text-align: center;
  font-size: 1rem;
  letter-spacing: .01em;
}
.direction-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; position: relative; z-index: 2; }
.direction-button {
  min-height: 58px;
  border: 2px solid var(--line-soft);
  border-radius: 18px;
  background: var(--cream);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 850;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.direction-button:active { transform: translateY(1px) scale(.99); }
.direction-button.active {
  border-color: var(--coral);
  background: var(--peach-2);
  box-shadow: inset 0 -4px 0 rgba(220,101,81,.07);
}
.mini-bus {
  width: 24px;
  height: 20px;
  border: 2px solid currentColor;
  border-radius: 6px;
  display: inline-grid;
  place-items: center;
  font-size: .6rem;
  line-height: 1;
}

.cloud { position: absolute; width: 70px; height: 24px; border: 2px solid var(--line-soft); border-radius: 999px; background: var(--cream); opacity: .7; }
.cloud::before, .cloud::after { content:""; position:absolute; background:var(--cream); border:2px solid var(--line-soft); border-bottom:0; border-radius:50% 50% 0 0; }
.cloud::before { width: 28px; height: 18px; left: 12px; top: -15px; }
.cloud::after { width: 22px; height: 14px; right: 10px; top: -11px; }
.cloud-left { left: -25px; top: 24px; transform: rotate(3deg); }
.cloud-right { right: -28px; top: 12px; transform: rotate(-4deg); }
.sparkle { position:absolute; color:var(--peach); font-size:1.15rem; z-index:1; }
.sparkle-a { left: 12%; top: 12px; }
.sparkle-b { right: 13%; bottom: 12px; }

.eta-card {
  min-height: 290px;
  padding: 24px 22px 20px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.eta-card::before {
  content:"";
  position:absolute;
  width:120px;
  height:120px;
  border-radius:50%;
  background:rgba(248,184,171,.22);
  right:-42px;
  top:-35px;
}
.eta-card::after {
  content:"♡";
  position:absolute;
  right:26px;
  top:22px;
  color:var(--coral);
  font-size:1.55rem;
  transform:rotate(9deg);
}

.eta-eyebrow { margin: 0 0 4px; font-size: .9rem; font-weight: 850; color: var(--ink-soft); }
.eta-number-row { display: flex; align-items: baseline; gap: 9px; margin: 1px 0 4px; }
.eta-number { font-size: clamp(5.8rem, 27vw, 8.2rem); line-height: .83; letter-spacing: -.09em; color: var(--coral); font-weight: 900; }
.eta-unit { font-size: 1.35rem; font-weight: 900; color: var(--ink); }
.eta-subline { margin: 8px 0 0; font-size: 1.03rem; line-height: 1.45; }
.eta-subline strong { color: var(--coral); }
.eta-meta { margin-top: 18px; padding-top: 15px; border-top: 2px dashed rgba(184,106,86,.28); display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--ink-soft); font-size: .82rem; font-weight: 750; }
.eta-meta span { display:inline-flex; align-items:center; gap:6px; }

.no-bus-wrap { text-align: center; padding: 20px 8px; }
.no-bus-doodle { font-size: 3.2rem; line-height: 1; margin-bottom: 12px; color: var(--coral); }
.no-bus-wrap h3 { margin: 0 0 7px; font-size: 1.35rem; }
.no-bus-wrap p { margin: 0 auto; max-width: 290px; color: var(--ink-soft); line-height: 1.5; font-size: .9rem; }
.loading-flower { text-align:center; font-size:2rem; color:var(--coral); animation: bob 1.2s ease-in-out infinite alternate; }
.eta-card > p { text-align:center; margin:8px 0 0; color:var(--ink-soft); }
@keyframes bob { to { transform: translateY(-5px) rotate(8deg); } }

.route-strip {
  display: grid;
  grid-template-columns: 78px 1fr 78px;
  align-items: center;
  gap: 7px;
  padding: 16px 12px;
  margin-bottom: 14px;
  min-height: 112px;
}
.place { text-align: center; font-size: .77rem; font-weight: 850; line-height: 1.15; }
.place-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 32px;
  margin: 0 auto 6px;
  border: 2px solid var(--line-soft);
  border-radius: 12px 12px 8px 8px;
  background: #ffd9c2;
  font-size: 1rem;
}
.route-track { position: relative; height: 42px; display: flex; align-items: center; }
.route-dashes { position:absolute; left:10px; right:10px; top:20px; border-top:4px dashed var(--peach); }
.route-dot { position:absolute; top:14px; width:16px; height:16px; border-radius:50%; border:3px solid var(--coral); background:var(--cream); z-index:2; }
.route-dot.start { left:0; }
.route-dot.end { right:0; }
.bus-marker {
  position:absolute;
  left:50%;
  top:7px;
  z-index:3;
  transform:translateX(-50%);
  width:31px;
  height:26px;
  display:grid;
  place-items:center;
  border:2px solid var(--ink);
  border-radius:8px;
  background:var(--peach-2);
  font-size:.72rem;
  transition:left .6s ease;
  box-shadow:0 3px 0 rgba(120,58,43,.09);
}

.passing-card {
  margin-bottom: 14px;
  padding: 13px 14px;
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 11px;
  align-items: start;
  border-color: var(--line-soft);
  box-shadow: none;
}
.passing-icon {
  width: 32px;
  height: 32px;
  display:grid;
  place-items:center;
  border:2px solid var(--line-soft);
  border-radius:50%;
  background:#fff3ce;
  font-weight:900;
}
.passing-title { margin: 1px 0 5px; font-weight:900; font-size:.84rem; }
.passing-list { color:var(--ink-soft); font-size:.79rem; line-height:1.45; }
.passing-list div + div { margin-top: 3px; }
.not-18 { font-weight:900; color:var(--coral); }

.tiny-footer {
  display:flex;
  justify-content:center;
  align-items:center;
  gap:8px;
  color:var(--ink-soft);
  font-size:.69rem;
  text-align:center;
  padding:4px 8px;
}
.heart, .star { color:var(--coral); font-size:1rem; }

@media (max-width: 370px) {
  .app-shell { padding-inline: 11px; }
  .route-strip { grid-template-columns: 68px 1fr 68px; }
  .direction-button { font-size: .88rem; gap: 6px; }
  .sun-doodle { width: 42px; height: 42px; }
}

@media (min-width: 560px) {
  .app-shell { padding-top: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* Cute live map */
.map-card {
  position: relative;
  overflow: hidden;
  background: rgba(255,250,244,.94);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.map-card-head,
.map-dialog-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}
.map-kicker {
  margin:0 0 2px;
  font-size:.63rem;
  letter-spacing:.13em;
  color:var(--ink-soft);
  font-weight:900;
}
.map-card h2,
.map-dialog h2 {
  margin:0;
  font-size:1.15rem;
  letter-spacing:-.02em;
}
.map-actions { display:flex; align-items:center; gap:8px; }
.bus-count {
  display:inline-flex;
  align-items:center;
  min-height:31px;
  padding:0 10px;
  border:2px solid var(--line-soft);
  border-radius:999px;
  background:#fff7ef;
  font-size:.72rem;
  font-weight:850;
  color:var(--ink-soft);
}
.map-expand,
.map-close {
  border:2px solid var(--line-soft);
  background:var(--cream);
  color:var(--ink);
  width:34px;
  height:34px;
  border-radius:12px;
  display:grid;
  place-items:center;
  cursor:pointer;
  font-weight:900;
}
.map-expand:active,
.map-close:active { transform:translateY(1px); }
.cute-map {
  position:relative;
  overflow:hidden;
  width:100%;
  aspect-ratio:4/3;
  min-height:245px;
  border:2px solid var(--line-soft);
  border-radius:20px;
  background:#fffaf4;
  box-shadow:inset 0 0 0 5px rgba(248,184,171,.07);
}
.cute-map svg { display:block; width:100%; height:100%; }
.map-empty {
  position:absolute;
  inset:0;
  display:grid;
  place-items:center;
  padding:24px;
  text-align:center;
  color:var(--ink-soft);
  font-size:.8rem;
  font-weight:800;
  background:rgba(255,250,244,.68);
}
.map-empty[hidden] { display:none; }
.map-bus-bubble {
  position:absolute;
  left:12px;
  right:12px;
  bottom:10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 12px;
  background:rgba(255,250,244,.96);
  border:2px solid var(--line);
  border-radius:15px;
  box-shadow:0 8px 22px rgba(120,58,43,.12);
  font-size:.76rem;
  pointer-events:none;
}
.map-bus-bubble strong { color:var(--coral); }
.map-bus-bubble span { color:var(--ink-soft); text-align:right; }
.map-note {
  margin:9px 2px 0;
  color:var(--ink-soft);
  font-size:.7rem;
  font-weight:750;
  text-align:center;
}
.map-note span { color:var(--coral); }
.live-bus-marker { transition:opacity .15s ease; }
.live-bus-marker:hover { opacity:.85; }
.live-bus-marker.selected { filter:drop-shadow(0 4px 4px rgba(120,58,43,.18)); }

.map-dialog {
  width:min(96vw, 720px);
  max-width:none;
  border:0;
  padding:0;
  border-radius:28px;
  background:transparent;
  color:var(--ink);
}
.map-dialog::backdrop { background:rgba(90,48,38,.32); backdrop-filter:blur(4px); }
.map-dialog-shell {
  background:var(--paper-2);
  border:2px solid var(--line);
  border-radius:28px;
  padding:16px;
  box-shadow:0 22px 70px rgba(90,48,38,.25);
}
.map-dialog-head { padding:2px 2px 0; }
.map-close { font-size:1.4rem; line-height:1; }
.expanded-map-host .cute-map {
  min-height:min(68vh, 560px);
  aspect-ratio:auto;
}
.expanded-map-host .cute-map svg { min-height:min(68vh, 560px); }

@media (max-width: 370px) {
  .cute-map { min-height:220px; }
  .map-bus-bubble { font-size:.7rem; }
}
