/* Sox Maps. Day: friendly and muted (rounded cards, steel blue, soft tints); night: the dark dashboard in the same
   colours. One family, Rubik, tabular figures for times and distances. Inline style attributes are blocked by the page's
   security policy: everything is here (JS only sets a few CSS properties directly). */
@font-face {
  font-family: Rubik; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url(/fonts/rubik/rubik-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Rubik; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url(/fonts/rubik/rubik-latin-ext-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --ground: #F4F5F4; --paper: #FFFFFF; --wash: #F1F2F2; --ink: #26343F; --muted: #66727A; --line: #E6EAED;
  --accent: #3B78BD; --accent-ink: #FFFFFF; --accent-soft: #E6EEF7; --accent-text: #2F65A3;
  --good: #43936F; --good-soft: #EAF2EC; --good-text: #2F7A5A;
  --amber: #B07B35; --amber-soft: #F7EFDF; --amber-text: #8A6420;
  --bad: #C65A51; --bad-soft: #F6E3E1; --bad-text: #A8443C;
  --banner: #3B78BD; --banner-deep: #2F65A3;
  --lift: 0 2px 4px rgba(38, 52, 63, .08), 0 6px 18px rgba(38, 52, 63, .14);
  --sheet-shadow: 0 -6px 24px rgba(38, 52, 63, .14);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --ground: #12181E; --paper: #1A2129; --wash: #232B34; --ink: #E3E8EB; --muted: #96A3AB; --line: #2B343D;
  --accent: #6FA3DC; --accent-ink: #0F1A24; --accent-soft: #1F2D3C; --accent-text: #9CC2EA;
  --good: #5FBF95; --good-soft: #1B2B25; --good-text: #85D3AF;
  --amber: #D9AA5A; --amber-soft: #2C2519; --amber-text: #E5C07E;
  --bad: #E07B72; --bad-soft: #35211F; --bad-text: #F2A9A1;
  --banner: #2C5584; --banner-deep: #22446A;
  --lift: 0 2px 4px rgba(0, 0, 0, .35), 0 6px 20px rgba(0, 0, 0, .45);
  --sheet-shadow: 0 -6px 24px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ground); color: var(--ink);
  font: 400 16px/1.4 Rubik, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent;
  font-variant-numeric: tabular-nums; }
#map { position: fixed; inset: 0; }
.sprite { position: absolute; }
.ic { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic .fill, symbol .fill { fill: currentColor; stroke: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

button { font: inherit; color: var(--ink); background: var(--wash); border: 0; border-radius: 16px; padding: 10px 16px; cursor: pointer;
  min-height: 48px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
button:active { transform: scale(.97); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
button.danger { background: var(--bad); color: #fff; font-weight: 700; }
button.quiet { background: var(--wash); }
.icon-btn { background: transparent; min-width: 44px; min-height: 44px; padding: 8px; color: var(--muted); border-radius: 22px; }
.muted { color: var(--muted); }
.small { font-size: 14px; margin-top: 4px; }
.good { color: var(--good-text); }
.bad { color: var(--bad-text); }

/* ---- floating map buttons ---- */
.fab { background: var(--paper); color: var(--ink); box-shadow: var(--lift); padding: 0; }
.fab.round { width: 58px; height: 58px; border-radius: 29px; }
.fab.round-sq { width: 56px; height: 56px; border-radius: 16px; }
#btn-menu { position: fixed; top: max(14px, env(safe-area-inset-top)); left: 14px; z-index: 5; }
#btn-menu .ic { width: 26px; height: 26px; }
/* the panel and the buttons riding on top of it, one piece: sliding the panel moves the dock (on the graphics chip) */
#dock { position: fixed; inset: 0; z-index: 6; pointer-events: none; transition: transform .25s ease; will-change: transform; }
#dock.dragging { transition: none; }
#dock > * { pointer-events: auto; }
#left-tools, #right-tools { position: absolute; bottom: calc(var(--sheet-h, 120px) + 16px); display: flex; flex-direction: column; gap: 12px; }
#left-tools { left: 14px; align-items: flex-start; }
#right-tools { right: 14px; align-items: flex-end; }
#btn-locate .ic { width: 28px; height: 28px; }
#btn-locate.attention { color: var(--accent-ink); background: var(--accent); }
body.driving #btn-menu { display: none; }
body.choosing #btn-menu { display: none; }

/* choosing a route: from / to card at the top, each route's time in a bubble on the map */
#route-top { position: fixed; top: max(10px, env(safe-area-inset-top)); left: 10px; right: 10px; z-index: 5; display: flex; align-items: center;
  gap: 2px; background: var(--paper); border-radius: 22px; box-shadow: var(--lift); padding: 4px 8px 4px 2px; }
#route-top[hidden] { display: none; }
.rt-back .ic { width: 26px; height: 26px; color: var(--ink); }
.rt-rows { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--wash); border-radius: 16px; padding: 0 6px; }
.rt-row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 6px; background: transparent; border-radius: 0; text-align: left;
  font-size: 17px; font-weight: 600; width: 100%; color: var(--ink); }
.rt-row + .rt-row { border-top: 1px solid var(--line); }
.rt-row > .ic { width: 22px; height: 22px; color: var(--muted); flex: none; }
.rt-row .rt-stop { color: var(--amber-text); }
.rt-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-dot { width: 18px; height: 18px; margin: 0 2px; border-radius: 50%; border: 5px solid var(--muted); box-sizing: border-box; flex: none; }
.rt-x { min-width: 40px; min-height: 40px; }
.rbub { --bg: var(--paper); background: var(--bg); color: var(--ink); border-radius: 12px; padding: 7px 11px; font-size: 17px; font-weight: 800; line-height: 1.1;
  box-shadow: var(--lift); white-space: nowrap; text-align: left; min-height: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.rbub small { display: block; font-size: 13px; font-weight: 700; }
.rbub.sel { color: #fff; font-size: 19px; }
:root[data-theme="dark"] .rbub.sel { color: #0F1A24; }
.rbub::after { content: ''; position: absolute; left: 10px; bottom: -7px; border: 7px solid transparent; border-bottom: 0; border-top-color: var(--bg); }
.rbub.flip { align-items: flex-end; }
.rbub.flip::after { left: auto; right: 10px; }

/* the chosen route: time, distance, roads, then Leave later / Go now */
.rsum { display: flex; flex-direction: column; gap: 6px; }
.rs-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.rs-dur { font-size: 34px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.rs-km { font-size: 18px; color: var(--muted); font-weight: 600; }
.rs-via { font-size: 17px; font-weight: 700; }
.rs-note { font-size: 14.5px; color: var(--muted); font-weight: 600; }
.rs-note .jam { color: var(--amber-text); }
.go-row .later { flex: 1; min-height: 60px; border-radius: 30px; font-size: 18px; font-weight: 700; color: var(--accent-text); }
.place-name.small { font-size: 18px; margin-top: 4px; }

/* ---- bottom sheet ---- */
#sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; background: var(--paper); box-shadow: var(--sheet-shadow);
  border-radius: 28px 28px 0 0; padding: 0 18px calc(18px + env(safe-area-inset-bottom)); max-height: 80vh; overflow: auto; overscroll-behavior: contain; }
#sheet.full { top: max(10px, env(safe-area-inset-top)); max-height: none; border-radius: 24px 24px 0 0; }
#sheet.fixed { padding: 12px 14px calc(14px + env(safe-area-inset-bottom)); border-radius: 26px 26px 0 0; overflow: visible; }
#grip { position: sticky; top: 0; height: 26px; margin: 0 -18px; touch-action: none; cursor: grab; z-index: 1; background: var(--paper); }
#grip::after { content: ""; position: absolute; top: 10px; left: 50%; width: 44px; height: 5px; margin-left: -22px; border-radius: 3px; background: var(--line); }
#sheet.full #grip, #sheet.fixed #grip { display: none; }
#sheet.full #sheet-body { padding-top: 10px; }
#sheet h2 { margin: 0; font-size: 23px; font-weight: 800; line-height: 1.2; letter-spacing: -.01em; overflow-wrap: anywhere; }
.title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.title-row .icon-btn { margin: -8px -10px 0 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* home */
.home { display: flex; flex-direction: column; gap: 16px; }
.search-row { display: flex; align-items: center; gap: 6px; background: var(--wash); border-radius: 29px; padding-right: 6px; }
.searchbox { flex: 1; justify-content: flex-start; min-height: 58px; background: transparent; border-radius: 29px; padding: 0 20px; font-size: 19px; font-weight: 500; color: var(--muted); gap: 12px; }
.searchbox .ic { color: var(--muted); }
.mic { color: var(--ink); }
.cards { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; margin: 0 -18px; padding: 0 18px; }
.pcard { flex: 1 0 112px; max-width: 160px; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 5px; padding: 14px 12px;
  border-radius: 20px; text-align: left; min-height: 146px; } /* as tall as a card with its travel time: no jump when times arrive */
.pc-icon { width: 38px; height: 38px; border-radius: 19px; display: grid; place-items: center; color: #fff; }
.pc-icon .ic { width: 20px; height: 20px; }
.pc-name { font-size: 16px; font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-sub { font-size: 13px; color: var(--muted); font-weight: 500; }
.k-home { background: var(--good-soft); } .k-home .pc-icon { background: var(--good); }
.k-work { background: var(--amber-soft); } .k-work .pc-icon { background: var(--amber); }
.k-other { background: var(--accent-soft); } .k-other .pc-icon { background: var(--accent); }
.k-suggest { background: var(--wash); } .k-suggest .pc-icon { background: var(--muted); }
.pcard.empty { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.stop-row { display: flex; align-items: center; gap: 8px; background: var(--amber-soft); border-radius: 16px; padding: 4px 4px 4px 14px; font-size: 15px; }
.stop-row > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stop-row .ic { color: var(--amber-text); width: 20px; height: 20px; }
.pcard.empty .pc-icon { background: var(--wash); color: var(--muted); }
.list { display: flex; flex-direction: column; }
.list-title { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; padding: 10px 2px 4px; }
.row-place { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; column-gap: 14px; width: 100%; padding: 10px 2px; background: transparent;
  border-radius: 0; border-bottom: 1px solid var(--line); text-align: left; font-weight: 400; min-height: 62px; justify-content: stretch; }
.row-place:last-child { border-bottom: 0; }
.r-icon { width: 40px; height: 40px; border-radius: 20px; display: grid; place-items: center; background: var(--wash); color: var(--muted); }
.r-icon .ic { width: 20px; height: 20px; }
.r-icon.saved { background: var(--accent-soft); color: var(--accent-text); }
.r-icon.tt { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.r-text { min-width: 0; display: flex; flex-direction: column; }
.r-name { font-weight: 700; font-size: 16px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-sub { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-dist { color: var(--muted); font-size: 13.5px; font-weight: 600; text-align: right; }
.src { font-size: 12px; color: var(--muted); }
.note { color: var(--muted); padding: 12px 2px; font-size: 15px; }
.status { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 500; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.live { background: var(--good); box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 22%, transparent); }

/* search */
.search { display: flex; flex-direction: column; min-height: 100%; }
.search-form { display: flex; align-items: center; gap: 4px; background: var(--wash); border-radius: 29px; padding: 0 6px; min-height: 58px; position: sticky; top: 0; z-index: 1; }
.search-form input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 18px; font-weight: 500; padding: 12px 4px; }
.search-form input::placeholder { color: var(--muted); font-weight: 400; }
.search-form input::-webkit-search-cancel-button { display: none; }
.results { padding-top: 6px; }

/* a place and its routes */
.place { display: flex; flex-direction: column; gap: 12px; }
.place-sub { color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 15px; margin-top: -6px; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chip { min-height: 42px; border-radius: 21px; padding: 6px 14px 6px 12px; font-size: 14.5px; white-space: nowrap; gap: 6px; flex: none; }
.chip .ic { width: 19px; height: 19px; color: var(--accent-text); }
a.chip { display: inline-flex; align-items: center; background: var(--wash); color: var(--ink); font-weight: 600; text-decoration: none; }
.road-row { display: flex; flex-direction: column; gap: 8px; }
.routes { display: flex; flex-direction: column; gap: 10px; }
.routes-note { display: flex; align-items: center; gap: 12px; color: var(--muted); font-weight: 500; padding: 8px 0; flex-wrap: wrap; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.route { display: flex; flex-direction: column; align-items: stretch; gap: 4px; width: 100%; text-align: left; background: var(--paper);
  box-shadow: inset 0 0 0 2px var(--line); border-radius: 20px; padding: 12px 16px; font-weight: 400; }
.route.sel { box-shadow: inset 0 0 0 2.5px var(--accent); }
.r-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dur { font-size: 27px; font-weight: 800; line-height: 1.05; letter-spacing: -.02em; }
.badge { font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: #fff; background: var(--good); border-radius: 10px; padding: 4px 9px; }
:root[data-theme="dark"] .badge { color: #0F1A14; }
.badge.tt { background: var(--wash); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.route .r-sub { white-space: normal; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 14px; }
.r-note { font-size: 13.5px; color: var(--muted); font-weight: 600; }
.r-note .jam { color: var(--amber-text); }
.via { display: inline-flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.shield { display: inline-block; font-weight: 800; font-size: 12.5px; line-height: 1; padding: 4px 6px 3px; border-radius: 4px; letter-spacing: .02em; }
.s-A { background: #2F7A52; color: #EDCF5E; box-shadow: inset 0 0 0 1.5px #EDCF5E; }
.s-B { background: #335C99; color: #EDCF5E; box-shadow: inset 0 0 0 1.5px #EDCF5E; }
.s-other { background: #fff; color: #3A464E; box-shadow: inset 0 0 0 1.5px #9AA4AB; }
.go-row { display: flex; gap: 8px; margin-top: 4px; }
.go { flex: 1; min-height: 60px; border-radius: 30px; font-size: 20px; }
.go-row .quiet { min-height: 60px; border-radius: 30px; }

/* when to go + the leave-time chart */
.when { display: flex; flex-direction: column; gap: 8px; }
.when-segs { margin: 0; }
.when-time { font: inherit; font-size: 18px; font-weight: 600; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--paper); color: var(--ink); align-self: flex-start; }
.chart { display: flex; flex-direction: column; gap: 6px; padding: 4px 0; }
.chart-title { font-weight: 700; font-size: 15px; }
.chart-bars { display: flex; align-items: flex-end; gap: 4px; height: 64px; }
.bar-t { flex: 1; height: 64px; min-height: 0; padding: 0; background: transparent; border-radius: 6px; align-items: flex-end; min-width: 0; }
.bar-fill { display: block; width: 100%; border-radius: 6px 6px 3px 3px; }
.b-good .bar-fill { background: color-mix(in srgb, var(--good) 45%, transparent); }
.b-mid .bar-fill { background: color-mix(in srgb, var(--amber) 45%, transparent); }
.b-bad .bar-fill { background: color-mix(in srgb, var(--bad) 45%, transparent); }
.bar-t.best .bar-fill { background: var(--good); }
.bar-t:first-child .bar-fill { box-shadow: inset 0 0 0 2.5px var(--accent); }
.chart-axis { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.pc-time { font-size: 22px; font-weight: 800; color: var(--good-text); line-height: 1.1; }
.pc-time.slow { color: var(--amber-text); }

/* trips, settings, road marks */
.panel { padding-bottom: 6px; }
.card { background: var(--wash); border-radius: 18px; padding: 14px; margin-top: 12px; }
.card b { display: block; margin-bottom: 4px; font-weight: 800; }
.card .title-row b { margin: 0; }
.summary { background: var(--paper); box-shadow: inset 0 0 0 2px var(--accent); }
button.link { background: none; padding: 6px 0; min-height: 36px; color: var(--accent-text); font-size: 14px; }
.card button.danger { margin-top: 10px; }
a.button { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 16px; margin-top: 10px;
  border-radius: 16px; font-weight: 700; text-decoration: none; background: var(--wash); color: var(--ink); }
a.button.primary { background: var(--accent); color: var(--accent-ink); }
.usage { margin-top: 10px; }
.bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin-top: 4px; }
.fill { height: 100%; background: var(--good); }
.fill.amber { background: var(--amber); }
.fill.red { background: var(--bad); }
.card button:not(.primary):not(.link):not(.danger) { background: var(--paper); box-shadow: inset 0 0 0 1.5px var(--line); }
.card input { flex: 1; min-width: 0; font: inherit; padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); }
.mark b { display: inline; margin: 0; }
.mark { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 15px; }

/* ---- driving ---- */
#banner { position: fixed; top: 0; left: 0; right: 0; z-index: 7; padding: max(10px, env(safe-area-inset-top)) 12px 0; pointer-events: none;
  display: flex; flex-direction: column; align-items: stretch; }
#banner > * { pointer-events: auto; }
.b-card { display: flex; align-items: center; gap: 16px; background: var(--banner); color: #fff; border-radius: 26px; padding: 14px 16px; box-shadow: var(--lift); position: relative; z-index: 1; }
.b-arrow { position: relative; width: 72px; height: 72px; border-radius: 20px; background: rgba(255, 255, 255, .16); display: grid; place-items: center; flex: none; }
svg.turn { width: 52px; height: 52px; stroke: #fff; stroke-width: 5.5; color: #fff; }
.b-exit { position: absolute; right: -6px; bottom: -6px; font-size: 15px; background: #fff; color: var(--banner); border-radius: 999px; padding: 2px 8px; font-weight: 800; }
.b-words { min-width: 0; }
.b-dist { font-size: 40px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.b-street { font-size: 19px; font-weight: 600; margin-top: 5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; overflow-wrap: anywhere; }
.b-text { font-size: 18px; font-weight: 600; }
.b-lanes { align-self: center; display: flex; gap: 10px; background: var(--banner-deep); border-radius: 0 0 18px 18px; margin-top: -12px; padding: 18px 16px 8px; box-shadow: var(--lift); }
svg.lane { width: 28px; height: 30px; stroke: rgba(255, 255, 255, .38); stroke-width: 5; }
svg.lane.ok { stroke: #fff; }
.b-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.b-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--paper); color: var(--ink); border-radius: 18px; padding: 7px 14px; font-size: 15px; font-weight: 700; box-shadow: var(--lift); }
svg.turn-sm { width: 20px; height: 20px; stroke: currentColor; stroke-width: 5; }
.b-chip.camera { background: #EDC35A; color: #3D2B00; }
.b-chip.off { background: var(--bad-soft); color: var(--bad-text); }
#speedo { display: flex; flex-direction: column-reverse; align-items: center; } /* the limit sits above the speed */
#myspeed { width: 72px; height: 72px; border-radius: 36px; background: var(--paper); box-shadow: var(--lift); display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; z-index: 1; }
#myspeed b { font-size: 28px; font-weight: 800; line-height: 1; }
#myspeed span { font-size: 11px; font-weight: 700; color: var(--muted); }
#myspeed.over { background: var(--bad); color: #fff; }
#myspeed.over span { color: rgba(255, 255, 255, .85); }
#limit { width: 48px; height: 48px; border-radius: 24px; background: #fff; border: 5px solid #D6453D; color: #111; display: grid; place-items: center;
  font-weight: 800; font-size: 17px; margin-bottom: -8px; box-shadow: var(--lift); }
.drive { display: flex; align-items: center; gap: 10px; }
.drive .round { width: 54px; height: 54px; border-radius: 27px; padding: 0; flex: none; }
.drive .end { background: var(--bad-soft); color: var(--bad-text); }
.d-eta { flex: 1; text-align: center; }
.d-arrive { font-size: 34px; font-weight: 800; line-height: 1; letter-spacing: -.01em; }
.d-left { font-size: 15px; color: var(--muted); font-weight: 600; margin-top: 4px; }

/* ---- menu ---- */
#scrim { position: fixed; inset: 0; background: rgba(10, 16, 22, .38); z-index: 30; }
#menu { position: fixed; top: 0; bottom: 0; left: 0; width: min(320px, 86vw); z-index: 31; background: var(--paper); box-shadow: var(--lift);
  padding: max(16px, env(safe-area-inset-top)) 14px 16px; display: flex; flex-direction: column; gap: 4px; transform: translateX(-102%); transition: transform .2s ease; overflow: auto; }
#menu.open { transform: none; }
.m-head { display: flex; align-items: center; gap: 12px; padding: 0 4px 12px; font-size: 20px; }
.m-head b { flex: 1; font-weight: 800; }
.m-logo { width: 40px; height: 40px; border-radius: 11px; }
.m-item { justify-content: flex-start; gap: 14px; background: transparent; min-height: 56px; font-size: 17px; border-radius: 16px; padding: 8px 12px; width: 100%; }
.m-item .ic { color: var(--accent-text); }
.m-item.toggle { justify-content: flex-start; }
.m-label { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; padding: 14px 12px 6px; }
.segs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; background: var(--wash); border-radius: 18px; padding: 4px; margin: 0 4px 8px; }
.seg { background: transparent; min-height: 44px; border-radius: 14px; font-size: 14.5px; gap: 6px; padding: 6px; color: var(--muted); }
.seg .ic { width: 18px; height: 18px; }
.seg.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.switch { margin-left: auto; width: 46px; height: 28px; border-radius: 14px; background: var(--line); position: relative; flex: none; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 11px; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(18px); }
.m-status { margin-top: auto; display: flex; gap: 10px; align-items: center; font-size: 13.5px; color: var(--muted); padding: 12px; }

/* ---- our dialog ---- */
#dialog { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; pointer-events: none; }
.dlg { pointer-events: auto; width: min(380px, 100%); background: var(--paper); border-radius: 26px; padding: 22px 20px 16px; box-shadow: var(--lift); display: flex; flex-direction: column; gap: 10px; }
.dlg h3 { margin: 0; font-size: 21px; font-weight: 800; }
.dlg p { margin: 0; color: var(--muted); }
.dlg input { font: inherit; font-size: 17px; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--paper); color: var(--ink); outline: 0; }
.dlg input:focus { border-color: var(--accent); }
.dlg-row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.dlg-row button { min-width: 96px; border-radius: 24px; }

/* ---- popups, messages ---- */
.pop { font: 14px/1.4 Rubik, system-ui, sans-serif; color: #26343F; }
.pop b { font-weight: 800; }
#toast { position: fixed; left: 50%; top: calc(max(14px, env(safe-area-inset-top)) + 70px); transform: translate(-50%, -12px); opacity: 0; transition: transform .2s, opacity .2s; z-index: 50;
  background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 18px; box-shadow: var(--lift); max-width: calc(100% - 32px);
  font-size: 15px; font-weight: 600; pointer-events: none; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
body.driving #toast { top: auto; bottom: calc(var(--sheet-vis, 100px) + 110px); }
@media (prefers-reduced-motion: reduce) { #toast, #sheet, #menu, #dock { transition: none; } button:active { transform: none; } .spinner { animation-duration: 3s; } }

/* ---- sign-in pages ---- */
.auth { max-width: 360px; margin: 18vh auto 0; padding: 0 16px; }
.auth h1 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.auth input { width: 100%; font: inherit; padding: 12px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); margin: 8px 0 12px; }
.auth button { width: 100%; background: var(--accent); color: #fff; }
.auth .err { color: var(--bad-text); min-height: 1.4em; }

/* the shared "on the way" page (eta.html) */
body.eta-page { overflow: auto; display: grid; place-items: center; min-height: 100%; padding: 16px; }
.eta-card { background: var(--paper); border-radius: 24px; box-shadow: var(--lift); padding: 28px 24px; width: min(100%, 380px); text-align: center; }
.eta-logo { width: 56px; height: 56px; border-radius: 14px; }
.eta-dest { margin-top: 12px; font-size: 18px; font-weight: 600; }
.eta-time { margin-top: 10px; font-size: 40px; font-weight: 800; color: var(--accent-text); }
.eta-left { margin-top: 2px; font-size: 18px; color: var(--muted); }
.eta-map { display: inline-block; margin-top: 16px; color: var(--accent-text); font-weight: 600; }
.eta-updated { margin-top: 14px; }

/* parked car card */
.k-car { background: var(--wash); } .k-car .pc-icon { background: var(--amber); }

/* the drive bar's extra panel (share, fuel) */
.drive-wrap { display: flex; flex-direction: column; gap: 10px; }
.drive-panel { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow-y: auto; }
.dp-row { display: flex; gap: 8px; }
.dp-item { justify-content: flex-start; width: 100%; }
.dp-row .dp-item.quiet { width: auto; flex: none; color: var(--bad-text); }
.drive .round.on { background: var(--accent-soft); color: var(--accent-text); }
.d-shared { color: var(--good-text); font-weight: 600; }
.fuel-list .r-dist { font-weight: 600; }

/* the arrival screen */
.arrived { display: flex; flex-direction: column; gap: 12px; padding-bottom: 6px; }
.arrived h2 { display: flex; align-items: center; gap: 8px; margin: 0; }
.arr-flag { display: inline-flex; width: 34px; height: 34px; border-radius: 17px; background: var(--good-soft); color: var(--good-text); align-items: center; justify-content: center; flex: none; }
.arr-flag .ic { width: 20px; height: 20px; }
.scores { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.score { display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; border-radius: 16px; background: var(--wash); min-width: 0; }
.score.win { background: var(--good-soft); box-shadow: inset 0 0 0 2px var(--good); }
.score.actual { background: var(--accent-soft); }
.sc-label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.sc-time { font-size: 24px; font-weight: 800; }
.sc-note { font-size: 12.5px; color: var(--muted); }
.score.win .sc-note { color: var(--good-text); font-weight: 600; }
.verdict { margin-top: -4px; }
.ht-title { display: flex; align-items: center; gap: 8px; font-weight: 800; margin-bottom: 4px; }
.ht-title .ic { width: 20px; height: 20px; color: var(--accent-text); }
button.wide { width: 100%; }

/* My drives */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.stat { display: flex; flex-direction: column; gap: 2px; background: var(--accent-soft); border-radius: 16px; padding: 12px 10px; min-width: 0; }
.st-big { font-size: 22px; font-weight: 800; color: var(--accent-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-small { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.drive-row { border-bottom: 1px solid var(--line); }
.drive-row summary { display: flex; align-items: center; gap: 12px; padding: 12px 2px; cursor: pointer; list-style: none; }
.drive-row summary::-webkit-details-marker { display: none; }
.dr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dr-dest { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dr-sub { font-size: 13.5px; color: var(--muted); }
.dr-time { font-size: 20px; font-weight: 800; }
.drive-row.dim { opacity: .6; }
.dr-more { padding: 0 2px 10px; font-size: 14px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.proven { margin-top: 14px; }
/* place details: opening hours, address, food, wheelchair access, Wikipedia */
.place-info { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 4px; font-size: 15px; }
.info-row { display: flex; gap: 10px; align-items: flex-start; }
.info-row > .ic { width: 19px; height: 19px; color: var(--muted); flex: none; margin-top: 1px; }
.info-open { color: var(--good-text); font-weight: 600; }
.info-closed { color: var(--bad-text); font-weight: 600; }
.info-small { color: var(--muted); font-size: 13.5px; }
.info-wiki { font-size: 14px; color: var(--muted); overflow: hidden; }
.info-wiki img { float: right; width: 84px; height: 84px; object-fit: cover; border-radius: 10px; margin: 2px 0 6px 10px; }
.info-wiki p { margin: 0 0 4px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.info-wiki a { color: var(--accent-text); font-weight: 600; text-decoration: none; }
