:root {
  --paper: #f7f0e3;
  --paper-2: #efe5d2;
  --ink: #1d3427;
  --ink-2: #5d6b5a;
  --ink-3: #9aa192;
  --catch: #e0662f;
  --cobalt: #2c4bb0;
  --cream: #fdf6e8;

  --r-sheet: 34px;
  --r-chip: 999px;
  --r-key: 22px;

  --gutter: 22px;

  --t-xs: 12px;
  --t-sm: 14px;
  --t-md: 16px;
  --t-lg: 20px;
  --t-xl: 28px;

  --ease-calm: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.33, 0, 0.2, 1);
  --d-quick: 220ms;
  --d-calm: 640ms;
  --d-slow: 900ms;

  --serif: "Fraunces", Georgia, serif;
  -webkit-tap-highlight-color: transparent;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1d3427; }
body { font-family: var(--serif); font-variation-settings: "SOFT" 100, "WONK" 0; color: var(--ink); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }

.app-shell {
  position: fixed; inset: 0;
  max-width: 480px; margin: 0 auto;
  /* Clip sideways only. In the Home Screen app iOS can report a screen shorter than the glass, so the sheet and the
     painting are allowed to run past the bottom edge and cover whatever iOS leaves below it. */
  overflow-x: clip; overflow-y: visible;
  --rest-top: 340px;                                     /* where the sheet rests: the same on every page */
  --up-top: calc(env(safe-area-inset-top) + 112px);       /* pulled up: a sliver of painting stays above it */
}
/* The Home Screen app on iPhone reports a viewport shorter than the glass by the status-bar inset, so fixed boxes, 100vh
   and inset: 0 all stop short (the strip in the user's photos). There the page and the app take the screen's own height
   (--app-h, set in the head script) and the app is placed in the page rather than fixed. Safari keeps inset: 0. */
html.standalone, html.standalone body { height: var(--app-h, 100vh); }
html.standalone .app-shell { position: absolute; top: 0; left: 0; right: 0; bottom: auto; height: var(--app-h, 100vh); }

/* Painting */
.painting { position: absolute; top: 0; left: 0; right: 0; bottom: -160px; z-index: 0; overflow: hidden; }
.painting-track {
  position: absolute; inset: 0;
  transition: transform var(--d-calm) var(--ease-calm);
  will-change: transform;
}
.pane {
  position: absolute; top: 0; bottom: 0; width: 100%;
  background-color: #24442f; background-size: cover; background-position: center top;
}
.painting-wash {
  position: absolute; inset: 0;
  background:
    radial-gradient(85% 42% at 50% 34%, rgba(18, 32, 22, 0.55) 0%, rgba(18, 32, 22, 0.18) 60%, transparent 85%),
    linear-gradient(to bottom, rgba(20, 34, 24, 0.10) 0%, transparent 30%, rgba(20, 34, 24, 0.35) 100%);
}
.grain {
  position: absolute; inset: 0; opacity: 0.22; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 1.4 -0.2'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* Top */
.top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 14px) var(--gutter) 0;
  color: var(--cream);
}
.place-pill {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 14px 0 16px; border-radius: var(--r-chip);
  font-size: var(--t-md); font-weight: 500;
  background: rgba(253, 246, 232, 0.18); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  text-shadow: 0 1px 10px rgba(0,0,0,0.2);
  max-width: 100%;
}
.place-pill > span:not(.dot) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.place-pill .chev { width: 12px; height: 12px; flex: none; opacity: 0.8; }
.place-pill select { position: absolute; inset: 0; opacity: 0; font-size: 16px; width: 100%; cursor: pointer; -webkit-appearance: none; appearance: none; }
.near-icon { width: 13px; height: 13px; flex: none; color: #b8f0c0; }
.place-pill.is-near { background: rgba(20, 40, 28, 0.32); box-shadow: inset 0 0 0 1px rgba(184, 240, 192, 0.35); }
.top-note { font-size: var(--t-sm); font-style: italic; color: var(--cream); opacity: 0.9; text-shadow: 0 1px 12px rgba(0,0,0,0.35); text-align: right; transition: opacity var(--d-calm) var(--ease-calm); }
.top-note:empty { opacity: 0; }
.dot { width: 6px; height: 6px; flex: none; border-radius: 50%; background: #9fe0a8; box-shadow: 0 0 0 3px rgba(159, 224, 168, 0.25); }
.dot[hidden] { display: none; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(253, 246, 232, 0.18); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: var(--cream); }
.icon-btn svg { width: 20px; height: 20px; }

/* Hero */
.hero {
  position: absolute; top: 0; left: 0; right: 0; z-index: 1;
  height: var(--rest-top);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(env(safe-area-inset-top) + 60px) var(--gutter) 34px;
  color: var(--cream); text-align: center;
  transform-origin: 50% 35%;
  transition: opacity var(--d-calm) var(--ease-calm);
}
.painting-dim { position: absolute; inset: 0; background: #0e1a12; opacity: 0; pointer-events: none; }

.top { transition: opacity var(--d-calm) var(--ease-calm); pointer-events: none; }
.top .place-pill, .top .place-more { pointer-events: auto; }
.place-more[hidden] { display: none; }
.top-note:empty { display: none; }
.hero { touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.hero-content { display: flex; flex-direction: column; align-items: center; transition: transform var(--d-calm) var(--ease-calm), opacity var(--d-calm) var(--ease-calm); }
.dots { position: absolute; left: 0; right: 0; bottom: 12px; display: flex; justify-content: center; gap: 7px; }
.dots span { width: 6px; height: 6px; border-radius: 3px; background: rgba(253, 246, 232, 0.45); transition: width var(--d-calm) var(--ease-calm), background var(--d-calm) var(--ease-calm); }
.dots span.on { width: 18px; background: var(--cream); }
.dots span.plus { opacity: 0.6; }
.hero-bus { font-size: var(--t-lg); font-weight: 400; font-style: italic; letter-spacing: 0.01em; opacity: 0.92; text-shadow: 0 1px 14px rgba(0,0,0,0.3); }
.hero-bus span { font-style: italic; font-weight: 400; opacity: 0.85; }
.hero-num-wrap { position: relative; display: flex; align-items: baseline; justify-content: center; height: 140px; margin: 2px 0 4px; }
.ink { width: 240px; height: 140px; display: block; }
.hero-num-fallback { display: none; font-size: 125px; line-height: 140px; font-variation-settings: "SOFT" 100, "opsz" 144; }
.no-webgl .ink { display: none; }
.no-webgl .hero-num-fallback { display: block; }
.hero-unit { position: absolute; left: 50%; bottom: 24px; font-size: var(--t-lg); font-style: italic; opacity: 0.85; white-space: nowrap;
  transform: translateX(calc(var(--num-half, 40px) + 10px)); transition: transform 620ms var(--ease-calm), opacity var(--d-quick) var(--ease-out); }
.hero-label { font-size: var(--t-sm); opacity: 0.8; }
.hero-verdict {
  font-size: var(--t-md); line-height: 1.35; max-width: 320px;
  text-shadow: 0 1px 14px rgba(0,0,0,0.35);
  transition: opacity var(--d-quick) var(--ease-out);
}
.hero-verdict.swap { opacity: 0; }

/* Sheet */
.sheet {
  position: absolute; left: 0; right: 0; z-index: 2;
  top: var(--up-top); bottom: 0;
  will-change: transform;
  background: rgba(247, 240, 227, 0.95);
  backdrop-filter: blur(24px) saturate(1.2); -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  box-shadow: 0 -10px 40px rgba(16, 30, 20, 0.22), inset 0 1px 0 rgba(255,255,255,0.7);
  padding: 10px 0 0;   /* no bottom padding: lists run to the screen's edge and keep their own room for the home bar */
  display: flex; flex-direction: column;
}
.sheet::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 240px; background: rgb(247, 240, 227); } /* covers the overscroll when pulled past the top */
.sheet-grab { touch-action: none; cursor: grab; }
.clip { overflow: hidden; min-height: 0; flex: none; }
.find-wrap.gone { display: none; }
.grabber { display: block; width: 100%; height: 22px; margin-top: -10px; position: relative; }
.grabber::after { content: ""; position: absolute; left: 50%; top: 9px; width: 38px; height: 5px; margin-left: -19px; border-radius: 3px; background: rgba(29, 52, 39, 0.18); }

.find-wrap { padding: 0 var(--gutter) 12px; }
.find {
  display: flex; align-items: center; gap: 10px; width: 100%;
  height: 46px; padding: 0 16px; border-radius: 16px;
  background: rgba(29, 52, 39, 0.06); color: var(--ink-2); font-size: 17px; text-align: left;
}
.find svg { width: 18px; height: 18px; flex: none; }

.sheet-body { flex: 1; min-height: 0; overflow: hidden; touch-action: none; overscroll-behavior: contain; padding: 0 var(--gutter) calc(env(safe-area-inset-bottom) + 24px); }
.sheet.is-up .sheet-body { overflow-y: auto; touch-action: pan-y; }
.sheet[data-state="panel"] .sheet-body, .sheet[data-state="panel"] .clip { display: none; }
/* New place: the form needs the room, the painting keeps a band */
.sheet.is-away { visibility: hidden; }
.is-onboarding .hero-content { opacity: 0; pointer-events: none; }
.is-onboarding .dots { opacity: 0 !important; }
/* With no sheet on New place, its landing sits in the middle of the painting */
.is-new .hero { height: 100%; padding-bottom: calc(env(safe-area-inset-bottom) + 110px); }
.is-new .dots { bottom: calc(env(safe-area-inset-bottom) + 40px); }
/* New place's landing: a round + is the way in, with "Add a place" above it */
.add-plus { display: none; }
.is-new .hero-num-wrap { display: none; }
.is-new .add-plus {
  display: grid; place-items: center; width: 76px; height: 76px; margin: 18px 0 20px; border-radius: 50%;
  color: var(--cream); background: rgba(253, 246, 232, 0.18); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: inset 0 0 0 1px rgba(253, 246, 232, 0.45), 0 10px 30px rgba(10, 20, 14, 0.22);
  transition: transform 160ms var(--ease-out), background var(--d-quick) var(--ease-out);
}
.is-new .add-plus svg { width: 30px; height: 30px; }
.is-new .hero-bus { font-size: 26px; font-style: normal; font-weight: 560; font-variation-settings: "SOFT" 100, "opsz" 72; }
.app-shell.is-new:not(.is-onboarding) .ob-next { display: none; }
@media (hover: hover) { .is-new .add-plus:hover { background: rgba(253, 246, 232, 0.26); } }
@media (hover: none) { .is-new .add-plus:active { transform: scale(0.94); transition: none; } }
.dots { transition: opacity var(--d-calm) var(--ease-calm); }
.sheet { transition: opacity var(--d-calm) var(--ease-calm); }
.hero-content { transition: opacity var(--d-calm) var(--ease-calm); }

/* New place: onboarding set on the painting */
.onboard {
  position: absolute; inset: 0; z-index: 2;
  padding: calc(env(safe-area-inset-top) + 76px) var(--gutter) 0;
  color: var(--cream);
  display: flex; flex-direction: column;
}
.onboard[hidden] { display: none; }
.app-shell:not(.is-onboarding) .onboard { pointer-events: none; }
.app-shell:not(.is-onboarding) .ob-next { pointer-events: auto; }
.ob-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ob-step { flex: 1; min-height: 0; display: flex; flex-direction: column; transition: opacity 260ms var(--ease-out), transform 260ms var(--ease-out), filter 260ms var(--ease-out); }
.ob-step.leaving { opacity: 0; filter: blur(6px); transform: translateY(-6px); }
.ob-step.from-right .ob-name, .ob-step.from-right .ob-find, .ob-step.from-right .ob-list { animation: rise 700ms var(--ease-calm) 260ms both; }
.ob-step.from-left .ob-name { animation: rise 700ms var(--ease-calm) 260ms both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.ob-step.ask { justify-content: center; padding-bottom: max(calc(env(safe-area-inset-bottom) + 120px), calc(var(--kb, 0px) + 86px)); transition: padding-bottom 250ms var(--ease-out), opacity 260ms var(--ease-out), transform 260ms var(--ease-out), filter 260ms var(--ease-out); }
/* The question is quiet and italic; your answer is the big type, like the number on a place */
.ob-q {
  margin: 0 0 12px; font-size: 22px; line-height: 1.25; font-style: italic; font-weight: 400; opacity: 0.9;
  text-shadow: 0 1px 16px rgba(10, 20, 14, 0.35);
}
.ink-word { display: inline-block; animation: ink-in 900ms var(--ease-calm) both; }
@keyframes ink-in {
  from { opacity: 0; filter: blur(10px); transform: translateY(6px) scale(1.04); }
  60% { opacity: 1; }
  to { opacity: 1; filter: blur(0); transform: none; }
}
.ob-name {
  width: 100%; border: 0; background: transparent; outline: none; color: var(--cream); caret-color: var(--cream);
  font: inherit; font-size: 50px; line-height: 1.1; font-weight: 640; letter-spacing: -0.015em; padding: 0;
  font-variation-settings: "SOFT" 100, "opsz" 120;
  text-shadow: 0 2px 24px rgba(10, 20, 14, 0.35); -webkit-appearance: none; appearance: none; border-radius: 0;
}
.ob-name::placeholder { color: rgba(253, 246, 232, 0.3); }
.ob-back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; margin: -12px 0 2px -6px; padding: 0 6px; align-self: flex-start; color: var(--cream); font-size: var(--t-md); font-style: italic; opacity: 0.85; }
.ob-back svg { width: 14px; height: 14px; }
.ob-close { position: absolute; top: calc(env(safe-area-inset-top) + 14px); right: var(--gutter); width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--cream); background: rgba(253, 246, 232, 0.16); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.ob-close svg { width: 14px; height: 14px; }
.ob-find {
  height: 48px; border-radius: 16px; border: 0; padding: 0 16px; margin-bottom: 12px;
  background: rgba(253, 246, 232, 0.2); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  color: var(--cream); font: inherit; font-size: 17px; outline: none; -webkit-appearance: none; appearance: none;
  box-shadow: inset 0 0 0 1px rgba(253, 246, 232, 0.3);
}
.ob-find::placeholder { color: rgba(253, 246, 232, 0.7); }
.ob-list { grid-auto-rows: max-content; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; color: var(--ink); align-content: start; padding-bottom: calc(env(safe-area-inset-bottom) + 100px); margin: 0 calc(-1 * var(--gutter)); padding-left: var(--gutter); padding-right: var(--gutter);
  padding-top: 6px; }
.ob-next {
  position: absolute; left: 50%; bottom: max(calc(env(safe-area-inset-bottom) + 22px), calc(var(--kb, 0px) + 14px)); transform: translateX(-50%);
  transition: bottom 250ms var(--ease-out);
  min-width: 160px; min-height: 52px; padding: 0 28px; border-radius: 999px; white-space: nowrap;
  background: var(--cream); color: var(--ink); font-size: var(--t-md); font-weight: 600;
  box-shadow: 0 10px 30px rgba(10, 20, 14, 0.28);
  transition: opacity var(--d-quick) var(--ease-out), transform 160ms var(--ease-out);
}
.ob-next[disabled] { background: #efe8da; color: rgba(29, 52, 39, 0.52); box-shadow: 0 6px 20px rgba(10, 20, 14, 0.14);
  }   /* solid, so the list never reads through */
@media (hover: none) { .ob-next:active { transform: translateX(-50%) scale(0.97); transition: none; } }

/* Stop cards */
.stops { display: grid; gap: 10px; }
/* Scrolling lists of stop cards stack: at the top a card pins and the next slides over it (it shrinks and dims, as
   if behind); at the bottom edge cards sit a little lower, smaller and softer, like the iOS lock-screen stack. */
.stack .stops, .stops.stack { display: flex; flex-direction: column; gap: 10px; }
.stack .card { flex: none; position: sticky; top: 0; transform-origin: 50% 0; will-change: transform, opacity; }
.stack .card { background: #fdf9f1; }   /* solid, so a card sliding over another hides it */
.card { background: rgba(255, 252, 245, 0.92); border-radius: 22px; overflow: hidden;
  /* WebKit stops clipping children to the corners once a card is moving (sticky, transformed); a clip-path keeps
     pressed rows and tints inside the rounded edge */
  clip-path: inset(0 round 22px); }
.card-head {
  display: flex; align-items: baseline; gap: 10px;
  padding: 11px 16px 3px; font-size: var(--t-sm); color: var(--ink-2);
}
.card-head b { font-size: var(--t-md); font-weight: 600; color: var(--ink); white-space: nowrap; flex: none; }
.card-meta { margin-left: auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-act { min-height: 32px; margin: -6px -6px -6px 0; padding: 0 8px; color: var(--catch); font-weight: 600; font-size: var(--t-sm); }
.bus-row {
  display: grid; grid-template-columns: 70px 1fr auto; align-items: center; gap: 8px;
  width: 100%; min-height: 46px; padding: 0 16px; position: relative; text-align: left;
  transition: background var(--d-quick) var(--ease-out);
}
/* Numbers and words share a baseline, so a big bus number doesn't look like it floats above its text */
.bus-row { align-items: baseline; align-content: center; }
.bus-row .tick { align-self: center; }
.bus-row + .bus-row::before { content: ""; position: absolute; top: 0; left: 94px; right: 0; height: 1px; background: rgba(29,52,39,0.08); }
.bus-row:last-child { margin-bottom: 4px; }
.bus-row.is-top { background: rgba(224, 102, 47, 0.10); }
.bus-row.is-pinned { background: rgba(224, 102, 47, 0.18); }
.bus-row.is-pinned .bus-no { color: var(--catch); }
.bus-row.is-top::before, .bus-row.is-top + .bus-row::before { opacity: 0; }
.bus-no { font-size: 24px; font-weight: 600; font-variation-settings: "SOFT" 100, "opsz" 36; font-variant-numeric: tabular-nums; }
.bus-to { font-size: var(--t-sm); color: var(--ink-2); font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.times { display: flex; gap: 12px; align-items: baseline; font-variant-numeric: tabular-nums; }
.t { font-size: 22px; font-weight: 500; font-variation-settings: "SOFT" 100, "opsz" 48; line-height: 1; min-width: 24px; text-align: right; transition: color var(--d-calm) var(--ease-out); }
.t.miss { color: var(--ink-3); text-decoration: line-through; text-decoration-thickness: 1.5px; font-size: 17px; }
.t.catch { color: var(--catch); font-weight: 700; }
.t.run { color: var(--catch); font-style: italic; }
.add-stop { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; margin-top: 4px; font-size: var(--t-md); color: var(--catch); font-weight: 600; }
.quiet { color: var(--ink-2); font-size: var(--t-md); line-height: 1.4; margin: 6px 0 12px; }
.quiet.center { text-align: center; margin: 0; padding: 12px 0 4px; }
/* on New place the list sits on the painting, so its empty message gets a dark glass behind it */
.ob-list .quiet { color: var(--cream); background: rgba(14, 26, 18, 0.5); border-radius: 18px; padding: 14px 16px; margin: 4px 0 0;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }

/* Ticking buses */
.tick-row { grid-template-columns: 26px 70px 1fr auto; }
.tick-row + .tick-row::before { left: 120px; }
.tick { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgba(29,52,39,0.25); display: grid; place-items: center; color: transparent; transition: background var(--d-quick) var(--ease-out), color var(--d-quick) var(--ease-out); }
.tick svg { width: 13px; height: 13px; }
.ticked .tick { background: var(--catch); box-shadow: none; color: #fff; }
.ticked .tick svg { animation: pop 380ms var(--ease-calm); }
@keyframes pop { 0% { transform: scale(0.5); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }

/* Fields */
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field > span { font-size: var(--t-sm); color: var(--ink-2); padding-left: 4px; }
.field input {
  height: 48px; border-radius: 16px; border: 0; padding: 0 16px;
  background: rgba(255, 252, 245, 0.92); box-shadow: inset 0 0 0 1.5px rgba(29,52,39,0.10);
  font: inherit; font-size: 17px; color: var(--ink); outline: none; -webkit-appearance: none; appearance: none;
}
html[data-keyboard] .field input:focus { box-shadow: inset 0 0 0 1.5px rgba(224,102,47,0.6); }
.new-place .stops { margin-bottom: 6px; }

/* Panels (search, a place's stops) */
.panel-wrap { display: none; flex: 1; min-height: 0; }
.sheet[data-state="panel"] .panel-wrap { display: flex; animation: fade-in var(--d-calm) var(--ease-calm); }
@keyframes fade-in { from { opacity: 0; } }
.panel { flex: 1; min-height: 0; min-width: 0; display: flex; flex-direction: column; padding: 0 var(--gutter) env(safe-area-inset-bottom); }
.panel-head { display: flex; gap: 8px; align-items: center; padding-bottom: 10px; min-height: 48px; }
.panel-head input {
  flex: 1; min-width: 0; height: 48px; border-radius: 16px; border: 0; padding: 0 16px;
  background: rgba(255, 252, 245, 0.92); box-shadow: inset 0 0 0 1.5px rgba(29,52,39,0.12);
  font: inherit; font-size: 17px; color: var(--ink); outline: none; -webkit-appearance: none; appearance: none;
}
html[data-keyboard] .panel-head input:focus { box-shadow: inset 0 0 0 1.5px rgba(224,102,47,0.6); }
.panel-title { flex: 1; font-size: var(--t-lg); font-weight: 600; }
.panel-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 16px; }
.panel-foot:empty { display: none; }
.panel-foot { padding: 10px 0 2px; }
.add-to { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.secondary { position: relative; display: grid; place-items: center; min-height: 52px; padding: 0 16px; border-radius: 18px; font-size: var(--t-md); font-weight: 600; color: var(--ink); box-shadow: inset 0 0 0 1.5px rgba(29,52,39,0.2); }
.secondary select { position: absolute; inset: 0; opacity: 0; font-size: 16px; width: 100%; -webkit-appearance: none; appearance: none; }
.text-btn { min-height: 44px; padding: 0 6px; font-size: var(--t-md); color: var(--ink-2); }
.text-btn.strong { color: var(--catch); font-weight: 600; }
.text-btn.danger { display: block; margin: 14px auto 0; color: #b0412a; }

.back-row { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; font-size: var(--t-md); color: var(--ink-2); margin-left: -4px; }
.back-row svg { width: 14px; height: 14px; }
.stop-head { padding: 2px 0 10px; }
.stop-name { font-size: var(--t-xl); font-weight: 600; font-variation-settings: "SOFT" 100, "opsz" 48; }
.stop-sub { font-size: var(--t-sm); color: var(--ink-2); margin-top: 2px; }

/* Foot */
.primary {
  width: 100%; min-height: 52px; border-radius: 18px;
  background: var(--ink); color: var(--cream);
  font-size: var(--t-md); font-weight: 600; letter-spacing: 0.01em;
  transition: transform 160ms var(--ease-out), background var(--d-calm) var(--ease-out), opacity var(--d-quick) var(--ease-out);
}
.primary[disabled] { opacity: 0.4; }

@media (hover: hover) {
  .bus-row:hover { background: rgba(29, 52, 39, 0.04); }
  .bus-row.is-top:hover { background: rgba(224, 102, 47, 0.14); }
  .find:hover { background: rgba(29, 52, 39, 0.09); }
}
@media (hover: none) {
  .bus-row:active { background: rgba(29, 52, 39, 0.06); transition: none; }
  .primary:active, .find:active { transform: scale(0.97); transition: none; }
}
html[data-keyboard] button:focus-visible { outline: 2px solid var(--cobalt); outline-offset: -2px; }
button:focus { outline: none; }

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

@media (min-width: 481px) {
  .app-shell { box-shadow: 0 0 0 1px rgba(255,255,255,0.06); }
  body { background: #142419; }
}

/* Toast */
.toast {
  position: absolute; left: var(--gutter); right: var(--gutter); bottom: calc(env(safe-area-inset-bottom) + 18px); z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 52px; padding: 0 8px 0 18px; border-radius: 18px;
  background: var(--ink); color: var(--cream); font-size: var(--t-md);
  box-shadow: 0 10px 30px rgba(10, 20, 14, 0.3);
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity var(--d-quick) var(--ease-out), transform var(--d-calm) var(--ease-calm);
}
.toast.show { opacity: 1; transform: none; pointer-events: auto; }
.toast-btn { min-height: 44px; padding: 0 12px; color: #f3a27b; font-weight: 600; }
.toast-btn[hidden] { display: none; }

/* A bus's route: a line of stops, the one nearest you marked */
.route-title { font-size: 40px; line-height: 1; font-weight: 640; font-variation-settings: "SOFT" 100, "opsz" 96; margin: 4px 0 14px; }
.route-title span { font-size: var(--t-lg); font-weight: 400; font-style: italic; color: var(--ink-2); margin-right: 2px; }
.route-one { margin: -6px 0 12px; font-style: italic; color: var(--ink-2); }
.seg { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; margin-bottom: 14px; border-radius: 14px; background: rgba(29, 52, 39, 0.07); }
.seg button { position: relative; z-index: 1; min-height: 40px; padding: 0 10px; font-size: var(--t-sm); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color var(--d-quick) var(--ease-out); }
.seg button[aria-selected="true"] { color: var(--ink); font-weight: 600; }
.seg-thumb { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 11px; background: #fdf9f1; box-shadow: 0 1px 4px rgba(16, 30, 20, 0.12); transform: translateX(calc(var(--i) * 100%)); transition: transform 380ms var(--ease-calm); }
.route-card { position: relative; background: #fdf9f1; border-radius: 22px; padding: 6px 0; margin-bottom: 16px; overflow: hidden; clip-path: inset(0 round 22px); }
/* the line is drawn per stop, from dot to dot, so it starts and ends exactly on the first and last dots */
.route-stop::before { content: ""; position: absolute; left: 27px; top: 0; bottom: 0; width: 2px; background: rgba(29, 52, 39, 0.16); }
.route-stop:first-child::before { top: 50%; }
.route-stop:last-child::before { bottom: 50%; }
.rs-dot { position: relative; z-index: 1; }
.route-stop { position: relative; display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 6px 16px; text-align: left; }
.rs-dot { justify-self: center; width: 10px; height: 10px; border-radius: 50%; background: #fdf9f1; box-shadow: inset 0 0 0 2px rgba(29, 52, 39, 0.35); }
.rs-text { display: grid; min-width: 0; }
.rs-name { font-size: var(--t-md); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-sub { font-size: var(--t-sm); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-next { font-size: var(--t-sm); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.route-stop.is-near { background: rgba(224, 102, 47, 0.10); min-height: 64px; }
.route-stop.is-near .rs-dot { width: 16px; height: 16px; background: var(--catch); box-shadow: 0 0 0 5px rgba(224, 102, 47, 0.18); }
.route-stop.is-near .rs-name { font-size: var(--t-lg); font-weight: 600; }
.route-stop.is-near .rs-sub { color: var(--catch); font-weight: 500; }
.route-stop.is-end .rs-dot { background: #aeb3a8; box-shadow: none; }   /* solid, so the line never shows through */
.route-stop.is-end { color: var(--ink-2); }
.route-stop:first-child .rs-dot { background: #aeb3a8; box-shadow: none; }
@media (hover: hover) { .route-stop:not(:disabled):hover { background: rgba(29, 52, 39, 0.04); } .route-stop.is-near:hover { background: rgba(224, 102, 47, 0.14); } }
@media (hover: none) { .route-stop:not(:disabled):active { background: rgba(29, 52, 39, 0.07); transition: none; } }

/* Search results, in the same cards as the rest of the app */
.res-head { font-size: var(--t-sm); color: var(--ink-2); padding: 10px 4px 6px; font-style: italic; }
.res-group { padding: 4px 0; }
.res-bus { grid-template-columns: 70px 1fr auto; min-height: 52px; }
.res-bus .bus-to { font-style: normal; color: var(--ink); font-size: var(--t-md); }
.res-dist { font-size: var(--t-sm); color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.res-pin { justify-self: start; align-self: center; width: 16px; height: 16px; margin-left: 4px; color: rgba(29, 52, 39, 0.45); }   /* a stop, as a map pin */
.res-recent-stop { font-weight: 500; }
.res-stop { display: grid; gap: 2px; width: 100%; text-align: left; padding-bottom: 14px; margin-bottom: 10px; }
.res-road { padding: 0 16px; font-size: var(--t-sm); color: var(--ink-2); }
.res-buses { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 16px 0; }
.res-buses span { min-width: 34px; height: 26px; padding: 0 8px; border-radius: 9px; display: inline-grid; place-items: center; background: rgba(29, 52, 39, 0.06); font-size: var(--t-sm); font-weight: 600; font-variant-numeric: tabular-nums; }
.res-buses .more { background: none; color: var(--ink-2); font-weight: 400; }
@media (hover: hover) { .res-stop:hover { background: #fffdf8; } }
@media (hover: none) { .res-stop:active { background: #f6efe2; transition: none; } }

/* Editing a place: name, painting, remove */
.panel-find {
  width: 100%; height: 48px; margin-bottom: 12px; border-radius: 16px; border: 0; padding: 0 16px;
  background: rgba(255, 252, 245, 0.92); box-shadow: inset 0 0 0 1.5px rgba(29,52,39,0.10);
  font: inherit; font-size: 17px; color: var(--ink); outline: none; -webkit-appearance: none; appearance: none;
}
html[data-keyboard] .panel-find:focus { box-shadow: inset 0 0 0 1.5px rgba(224,102,47,0.6); }

/* The ··· menu: a small paper card that grows from the button */
.top .place-menu { pointer-events: auto; }
.place-menu {
  position: absolute; top: calc(env(safe-area-inset-top) + 64px); right: var(--gutter); z-index: 6; min-width: 210px;
  padding: 6px; border-radius: 18px; background: rgba(250, 245, 235, 0.97); color: var(--ink);
  box-shadow: 0 14px 40px rgba(10, 20, 14, 0.28); transform-origin: 90% 0;
  opacity: 0; transform: scale(0.92) translateY(-6px);
  transition: opacity 180ms var(--ease-out), transform 320ms var(--ease-calm);
}
.place-menu.open { opacity: 1; transform: none; }
.place-menu[hidden] { display: none; }
.place-menu button { display: block; width: 100%; min-height: 44px; padding: 0 14px; border-radius: 12px; text-align: left; font-size: var(--t-md); }
.place-menu button + button { margin-top: 2px; }
.place-menu .danger { color: #b0412a; }
@media (hover: hover) { .place-menu button:hover { background: rgba(29, 52, 39, 0.06); } }
@media (hover: none) { .place-menu button:active { background: rgba(29, 52, 39, 0.08); transition: none; } }
/* Rearranging places */
.order-list { padding: 4px 0; }
.order-row { position: relative; display: grid; grid-template-columns: 34px 1fr 44px; align-items: center; gap: 12px; min-height: 56px; padding: 0 6px 0 16px; background: #fdf9f1; transition: transform 220ms var(--ease-calm); }
.order-row + .order-row::before { content: ""; position: absolute; top: 0; left: 62px; right: 0; height: 1px; background: rgba(29,52,39,0.08); }
.order-art { width: 34px; height: 34px; border-radius: 10px; background-size: cover; background-position: center top; }
.order-name { font-size: var(--t-md); font-weight: 500; }
.order-grip { display: grid; place-items: center; height: 44px; color: var(--ink-3); touch-action: none; cursor: grab; }
.order-grip svg { width: 18px; height: 18px; }
.order-row.lifted { z-index: 2; transition: none; box-shadow: 0 8px 24px rgba(16, 30, 20, 0.18); border-radius: 14px; }

/* Nearby: your saved stops first, tagged with their place */
.near-label { margin: 6px 4px 0; font-size: var(--t-sm); font-style: italic; color: var(--ink-2); }
.near-label:first-child { margin-top: 0; }
.saved-tag { flex: none; position: relative; top: -0.16em; padding: 2px 8px; border-radius: 999px; background: rgba(224, 102, 47, 0.12); color: var(--catch); font-size: var(--t-xs); font-weight: 600; }
.bus-row.is-other .bus-no, .bus-row.is-other .bus-to { opacity: 0.6; }

/* Long-press on a bus row: it sinks a little before the route opens */
.bus-row[data-pick] { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.bus-row.pressed-long { transform: scale(0.97); background: rgba(29, 52, 39, 0.08); transition: transform 120ms var(--ease-out), background 120ms var(--ease-out); }
.route-stop.is-focus:not(.is-near) { background: rgba(29, 52, 39, 0.06); }

/* New place's questions sit on a soft darker wash at the top, so they read on bright paintings */
.onboard::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 52%; pointer-events: none; z-index: -1;
  background: linear-gradient(to bottom, rgba(14, 26, 18, 0.5) 0%, rgba(14, 26, 18, 0.32) 45%, transparent 100%);
  opacity: 0; transition: opacity var(--d-calm) var(--ease-calm); }
.is-onboarding .onboard::before { opacity: 1; }

/* ---------- Splash: the leaf is shaded in with crayon strokes, then the name inks in ---------- */
.splash { position: absolute; inset: 0; z-index: 60; background: #1d3427; display: grid; place-items: center; overflow: hidden;
  transition: opacity 480ms var(--ease-calm); }
.splash.out { opacity: 0; pointer-events: none; }
.splash-art { position: absolute; inset: -60px; background-size: cover; background-position: center; filter: blur(22px) saturate(1.08); }   /* dispersed, so the mark stands clear */
.splash-art::after { content: ""; position: absolute; inset: 0;
  background: radial-gradient(60% 40% at 50% 50%, rgba(14, 26, 18, 0.34), rgba(14, 26, 18, 0.12) 70%, rgba(14, 26, 18, 0.2)); }
.splash-stack { position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 24px; }
.splash-mark, .splash-word { display: block; }
.splash-mark { transform-origin: 50% 100%; }
/* while she's being drawn the line boils a little, like hand-drawn frames; then she lands with a hop */
.splash.is-drawing .splash-mark { animation: boil 250ms steps(1) infinite; }
@keyframes boil { 0% { transform: rotate(-0.6deg) translate(0.4px, 0); } 50% { transform: rotate(0.5deg) translate(-0.4px, 0.3px); } }
.splash.is-hop .splash-mark { animation: hop 480ms cubic-bezier(0.3, 0.7, 0.3, 1) both; }
@keyframes hop { 0% { transform: none; } 32% { transform: translateY(-11px) rotate(-2deg); } 62% { transform: translateY(0) scale(1.04, 0.95); }
  82% { transform: scale(0.99, 1.01); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .splash.is-drawing .splash-mark, .splash.is-hop .splash-mark { animation: none; } }

/* ---------- First run: a light overlay on the app, crayon arrows to the real controls ---------- */
@property --sx { syntax: "<length>"; inherits: false; initial-value: 195px; }
@property --sy { syntax: "<length>"; inherits: false; initial-value: 300px; }
@property --rw { syntax: "<length>"; inherits: false; initial-value: 120px; }
@property --rh { syntax: "<length>"; inherits: false; initial-value: 90px; }
.coach { position: absolute; inset: 0; z-index: 55; color: var(--cream); }
.coach[hidden] { display: none; }
.coach-dim { position: absolute; inset: 0; opacity: 0;
  background: radial-gradient(var(--rw) var(--rh) at var(--sx) var(--sy), rgba(14, 26, 18, 0) 0%, rgba(14, 26, 18, 0) 62%, rgba(14, 26, 18, 0.86) 100%);
  transition: opacity 420ms var(--ease-calm), --sx 620ms var(--ease-calm), --sy 620ms var(--ease-calm), --rw 620ms var(--ease-calm), --rh 620ms var(--ease-calm); }
.coach.is-in .coach-dim { opacity: 1; }
.coach-arrow { position: absolute; left: 0; top: 0; transform-origin: 0 50%; pointer-events: none; }
.coach-arrow canvas { display: block; }
.coach-note { position: absolute; left: var(--gutter); right: var(--gutter); font-size: 21px; line-height: 1.35; font-weight: 500;
  text-shadow: 0 1px 16px rgba(14, 26, 18, 0.7); transition: opacity 260ms var(--ease-out); }
.coach-note.swap { opacity: 0; }
.coach-note p { margin: 0; max-width: 19em; }
.coach-note.right p { margin-left: auto; text-align: right; }
.coach-next { margin-top: 14px; min-height: 44px; padding: 0 22px; border-radius: 999px; font-size: var(--t-md); font-weight: 600; color: var(--ink);
  background: var(--cream); box-shadow: 0 8px 24px rgba(10, 20, 14, 0.3); }
.coach-later { margin: 14px 0 0 8px; min-height: 44px; padding: 0 10px; color: var(--cream); font-size: var(--t-md); opacity: 0.85; }
.coach-skip { position: absolute; top: calc(env(safe-area-inset-top) + 14px); right: var(--gutter); min-height: 44px; padding: 0 6px;
  color: var(--cream); font-size: var(--t-md); opacity: 0.85; }
.coach-title { margin: 0 0 22px; font-size: 28px; line-height: 1.15; font-weight: 600; }
.coach-steps { margin: 0; padding: 0; list-style: none; display: grid; gap: 18px; font-size: 18px; text-shadow: none; }
.coach-steps li { display: grid; grid-template-columns: 26px 40px 1fr; align-items: center; gap: 10px; }
.coach-steps .n { font-weight: 600; opacity: 0.7; }
.coach-steps .ic { width: 40px; height: 40px; border-radius: 12px; background: rgba(251, 244, 230, 0.16); display: grid; place-items: center;
  box-shadow: inset 0 0 0 1px rgba(251, 244, 230, 0.3); }
.coach-steps .ic svg { width: 22px; height: 22px; }
.coach-steps b { font-weight: 600; }
.coach-note .coach-aside { margin: 24px 0 0; font-size: 15px; line-height: 1.4; opacity: 0.8; }
.coach-actions { margin-top: 30px; display: flex; align-items: center; }
.coach-actions .coach-next { margin-top: 0; }
.coach-actions .coach-later { margin: 0 0 0 10px; }
.coach.is-last .coach-skip { display: none; }
.coach.out { opacity: 0; transition: opacity 420ms var(--ease-calm); pointer-events: none; }
html.standalone .splash, html.standalone .coach { height: var(--app-h, 100%); bottom: auto; }
/* the Home Screen step has no spotlight: a near-solid dim so its steps and caption never sit over the list's text */
.coach.is-last .coach-dim { background: rgba(14, 26, 18, 0.96); }

/* Nearby without location: one clear way to turn it on (the tap is what lets the browser ask) */
.loc-btn { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; min-height: 46px; padding: 0 20px; border-radius: 999px;
  background: var(--cream); color: var(--ink); font-size: var(--t-md); font-weight: 600; box-shadow: 0 8px 24px rgba(10, 20, 14, 0.25); }
.loc-btn[hidden] { display: none; }
.loc-btn svg { width: 15px; height: 15px; color: var(--catch); }
@media (hover: none) { .loc-btn:active { transform: scale(0.97); transition: none; } }
/* LTA's credit line, quiet at the end of the list */
.kopi { margin: 26px 8px 0; font-size: var(--t-sm); line-height: 1.45; color: var(--ink-2); text-align: center; }
.kopi a { color: var(--catch); font-weight: 600; text-decoration: none; }
.credit { margin: 10px 4px 0; font-size: var(--t-xs); line-height: 1.4; color: var(--ink-2); opacity: 0.75; text-align: center; }

/* Late night with nothing running: the hop-runner asleep on her bench takes the number's place */
.hero-sleep { display: block; height: 132px; width: auto; margin: 4px auto 10px; }
.hero-sleep[hidden] { display: none; }
.hero-content.is-sleep .hero-num-wrap { display: none; }

/* Save to a place: one full-width button with the phone's own picker over it */
.primary.pick { position: relative; display: grid; place-items: center; width: 100%; }
.primary.pick select { position: absolute; inset: 0; opacity: 0; font-size: 16px; width: 100%; -webkit-appearance: none; appearance: none; }

/* during the first-run tour the top-right note would sit under Skip */
.is-coaching .top-note { opacity: 0; }

/* Busy stops: extra buses fold behind "+N more"; the card animates its height (script) to fit them */
.more-rows { overflow: hidden; height: 0; }
.more-rows.is-open { height: auto; }
.more-rows > .bus-row:first-child::before { content: ""; position: absolute; top: 0; left: 94px; right: 0; height: 1px; background: rgba(29,52,39,0.08); }
.more-btn { position: relative; display: block; width: 100%; min-height: 44px; padding: 0 16px 0 94px; margin-bottom: 4px; text-align: left;
  font-size: var(--t-sm); font-weight: 600; color: var(--ink-2); }
.more-btn::before { content: ""; position: absolute; top: 0; left: 94px; right: 0; height: 1px; background: rgba(29,52,39,0.08); }
@media (hover: hover) { .more-btn:hover { color: var(--ink); } }
@media (hover: none) { .more-btn:active { background: rgba(29, 52, 39, 0.05); transition: none; } }

/* Edit stops: the sheet unlocks in place; stops drag by their grip, buses and stops come off with the minus */
.edit-head { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 4px 6px; }
.edit-title { font-size: var(--t-md); font-weight: 600; color: var(--ink); }
.edit-card .card-head { align-items: center; gap: 10px; }
.edit-row { grid-template-columns: 70px 1fr auto; align-items: center; }
.edit-del { display: grid; place-items: center; width: 44px; height: 44px; margin: -10px -12px -10px -12px; color: #d4553a; flex: none; }
.edit-del svg { width: 20px; height: 20px; }
.edit-row .edit-del { justify-self: end; margin-right: -10px; }
.edit-grip { display: grid; place-items: center; width: 44px; height: 44px; margin: -10px -12px -10px 0; color: rgba(29, 52, 39, 0.4); touch-action: none; cursor: grab; }
.edit-grip svg { width: 18px; height: 18px; }
.edit-card { transition: transform 220ms var(--ease-out), box-shadow 220ms var(--ease-out); }
.edit-card.lifted { transition: none; z-index: 2; box-shadow: 0 14px 34px rgba(10, 20, 14, 0.18); }
.is-editing #find, .is-editing .find-wrap { pointer-events: none; opacity: 0.4; }
@media (hover: none) { .edit-del:active, .edit-grip:active { opacity: 0.6; transition: none; } }
