/* JoinTheRide — minimal look: warm paper, near-black panels, one accent, square edges, monospace labels. */
:root {
  --bg: #efebe4; --paper: #f8f5f0; --ink: #141714; --panel: #1b201d; --panel2: #252b27;
  --muted: #76776f; --line: #d5cfc4; --line-dark: #333a35;
  --accent: #e4501d; --accent-dark: #c43f12; --ok: #3d8b52; --warn: #e0912b; --bad: #d93a1f;
  --sans: 'Inter Variable', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 400 16px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.bad { color: var(--bad); font-weight: 600; }
.ic { width: 20px; height: 20px; flex: none; display: inline-block; vertical-align: -4px; }

/* ---------- type ---------- */
h1, h2, h3 { font-weight: 800; letter-spacing: -0.035em; line-height: 1.05; margin: 0; }
.wordmark { font-weight: 800; font-size: 21px; letter-spacing: -0.045em; white-space: nowrap; }
.wordmark i { font-style: normal; color: var(--accent); }
.brand { display: inline-flex; align-items: center; gap: 9px; }
.brand .mark { width: 26px; height: 26px; flex: none; display: block; }
.page.center .brand .mark { width: 36px; height: 36px; }
.poster-head .brand .mark { width: 34px; height: 34px; }
.page-title { font-size: 32px; letter-spacing: -0.045em; margin: 0 0 14px; }
.label, .form label, .form .field > span, .ride-card dt, .card h2, .dialog h3, .code-big small, .hint, .foot {
  font-family: var(--mono); }

/* ---------- pages ---------- */
.page { max-width: 560px; margin: 0 auto; padding: calc(14px + var(--safe-top)) 20px calc(40px + var(--safe-bottom)); }
.page.center { text-align: center; padding-top: 22vh; }
.page.center .wordmark { font-size: 28px; }
.bar { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; margin-bottom: 22px; border-bottom: 1px solid var(--ink); }
.bar h1 { font-size: 22px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .spacer { flex: 1; }
.tagline { font-size: 38px; font-weight: 800; letter-spacing: -0.045em; line-height: 1.02; margin: 18px 0 28px; }
.foot { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; margin-top: 36px; }
.lang { display: flex; border: 1.5px solid var(--ink); flex: none; }
.lang button { border: 0; background: transparent; padding: 5px 9px; font: 700 11px var(--mono); letter-spacing: .06em; cursor: pointer; }
.lang button.on { background: var(--ink); color: var(--paper); }
.card { background: var(--paper); border: 1px solid var(--line); padding: 18px; margin: 18px 0; }
.card h2 { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.big-msg { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin: 18px 0; }
.ok-title { font-size: 30px; margin: 6px 0 8px; }
.ok-title::after { content: '.'; color: var(--accent); }
.error { color: var(--bad); font-weight: 600; }

/* ---------- buttons ---------- */
.btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 52px; padding: 10px 16px; margin: 10px 0;
  border: 1.5px solid var(--ink); border-radius: 0; background: transparent; cursor: pointer; text-decoration: none; text-align: center;
  font: 700 13px var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.btn small { display: block; font: 400 12px var(--sans); letter-spacing: 0; text-transform: none; opacity: .75; }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.primary:active, .btn:active { transform: translateY(1px); }
.btn.big { min-height: 64px; font-size: 14px; flex-direction: column; gap: 2px; }
.btn.big .ic { display: none; }
.btn.small { width: auto; min-height: 42px; font-size: 11px; margin: 4px 0; padding: 8px 12px; }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.link { border: 0; text-decoration: underline; text-underline-offset: 4px; font-weight: 400; min-height: 44px; }
.btn:disabled { opacity: .5; }
.icon-btn { width: 42px; height: 42px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--ink); border-radius: 0; background: transparent; cursor: pointer; padding: 0; }
.icon-btn.dark { background: transparent; border-color: var(--line-dark); color: #fff; }

/* ---------- forms ---------- */
.form label, .form .field { display: block; margin: 22px 0; }
.form label, .form .field > span { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.form input:not([type=file]):not([type=checkbox]), .form textarea, .form select, .code-input {
  display: block; width: 100%; margin-top: 6px; padding: 10px 0; border: 0; border-bottom: 1.5px solid var(--ink); border-radius: 0;
  background: transparent; font: 400 19px var(--sans); letter-spacing: -0.01em; color: var(--ink); text-transform: none; }
.form textarea { border: 1.5px solid var(--ink); padding: 10px; font-size: 16px; }
.form select { appearance: none; -webkit-appearance: none; background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23141714' stroke-width='1.8'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right center / 20px; padding-right: 28px; }
.form input:focus, .form textarea:focus, .form select:focus, .code-input:focus { outline: none; border-color: var(--accent); }
.form input::placeholder, .form textarea::placeholder, .code-input::placeholder { color: #a6a399; }
.code-input { flex: 1; min-width: 0; margin: 0; text-transform: uppercase; letter-spacing: .3em; font: 700 22px var(--mono); }
#joinForm.card label { display: block; font: 700 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
#joinForm .row { flex-wrap: nowrap; align-items: flex-end; }
#joinForm .row .btn { width: auto; margin: 0; padding: 0 20px; min-height: 48px; }
.hint { display: block; font-size: 11px; color: var(--muted); margin-top: 8px; letter-spacing: .02em; text-transform: none; font-weight: 400; line-height: 1.5; }
.hint.ok { color: var(--ok); font-weight: 700; }
.hint.bad { color: var(--bad); font-weight: 700; }
.hint a { color: var(--ink); }
.file-drop { position: relative; display: block; margin-top: 4px; padding: 26px 14px; border: 1.5px dashed var(--ink); background: transparent;
  text-align: center; font: 400 15px var(--sans); color: var(--ink); text-transform: none; letter-spacing: 0; }
.file-drop.ok { border-style: solid; border-color: var(--ok); color: var(--ok); font-weight: 600; }
.file-drop input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.preview { height: 220px; overflow: hidden; margin: 12px 0; background: #dcd6cb; border: 1px solid var(--ink); }
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1.5px solid var(--ink); margin: 8px 0 12px; }
.seg button { display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; background: transparent; padding: 12px 6px;
  font: 700 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; cursor: pointer; color: var(--ink); }
.seg button.on { background: var(--ink); color: var(--paper); }
.plan { border-left: 1.5px solid var(--ink); padding: 0 0 4px 14px; }
.form .plan label.sub { margin: 12px 0; }
.via-row { display: flex; gap: 10px; align-items: flex-end; }
.via-row label { flex: 1; }
.via-row .icon-btn { margin-bottom: 14px; }
.switch-row { display: flex; gap: 12px; align-items: flex-start; text-align: left; border: 1px solid var(--line); padding: 12px; margin: 14px 0; cursor: pointer;
  font: 600 15px var(--sans) !important; letter-spacing: 0 !important; text-transform: none !important; color: var(--ink) !important; }
.switch-row input { width: 22px; height: 22px; flex: none; accent-color: var(--ink); margin: 0; }
.switch-row small { display: block; font: 400 12px var(--sans); color: var(--muted); margin-top: 3px; }
.switch-row.small { padding: 8px 10px; font-size: 14px !important; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.swatch { width: 36px; height: 36px; border-radius: 0; border: 3px solid var(--bg); outline: 1px solid transparent; cursor: pointer; }
.swatch.on { outline: 2px solid var(--ink); }
.avatar-row { display: flex; gap: 14px; align-items: center; margin: 10px 0; }
.avatar-preview .av { width: 72px; height: 72px; font-size: 36px; }
.emojis { display: grid; grid-template-columns: repeat(4, 48px); gap: 6px; }
.emoji { width: 48px; height: 40px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; padding: 0; color: var(--ink); }
.emoji.on { border: 1.5px solid var(--ink); color: var(--accent); }
.emoji .bike-ic svg { width: 34px; }
.file-btn { cursor: pointer; }

/* place search */
.place-search { position: relative; display: block; }
.place-list { position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 1200; background: var(--paper); border: 1.5px solid var(--ink); box-shadow: 0 10px 24px rgba(20,23,20,.15); }
.place-item { display: block; width: 100%; text-align: left; border: 0; border-top: 1px solid var(--line); background: transparent; padding: 11px 12px; cursor: pointer; text-transform: none; letter-spacing: 0; }
.place-item:first-child { border-top: 0; }
.place-item b { display: block; font: 600 16px var(--sans); color: var(--ink); }
.place-item small { display: block; font: 400 12px var(--mono); color: var(--muted); }
.place-item.start b { font: 700 12px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.place-item:hover, .place-item:focus { background: #ece6dc; }

/* ---------- avatars ---------- */
.av { width: 42px; height: 42px; border-radius: 50%; border: 3px solid var(--c); background: #fff; display: flex; align-items: center; justify-content: center; overflow: hidden; font-size: 20px; flex: none; }
.av img { width: 100%; height: 100%; object-fit: cover; }
.av > span { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.bike-ic { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.bike-ic svg { width: 86%; height: auto; display: block; }
.av .bike-ic { color: var(--c); }

/* ---------- ride card / my rides ---------- */
.ride-card { padding: 0; }
.ride-card > h2 { font: 800 26px var(--sans); letter-spacing: -0.04em; text-transform: none; color: var(--ink); padding: 18px 18px 0; margin: 0; }
.ride-card dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 14px 18px; }
.ride-card dt { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding-top: 3px; }
.ride-card dd { margin: 0; font-weight: 600; }
.ride-card .preview { margin: 0; border-width: 1px 0 0; }
.notes { white-space: pre-wrap; margin: 0 18px 16px; padding-left: 12px; border-left: 2px solid var(--accent); }
.maps-link { display: inline-flex; align-items: center; gap: 4px; font: 700 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; margin-top: 4px; }
.maps-link .ic { width: 14px; height: 14px; vertical-align: -2px; }
.ride-item { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.ride-item b { font-weight: 700; letter-spacing: -0.01em; }
.ride-item small { display: block; font: 400 11px var(--mono); color: var(--muted); letter-spacing: .04em; margin-top: 2px; }
.chev { color: var(--ink); }

/* ---------- share ---------- */
.share { text-align: center; }
.qr { width: 220px; height: 220px; background: #fff; padding: 10px; border: 1px solid var(--ink); margin: 14px auto; display: block; }
.code-big { font: 700 34px var(--mono); letter-spacing: .3em; margin: 6px 0 10px; padding-left: .3em; }
.code-big small { display: block; font-size: 11px; letter-spacing: .08em; color: var(--muted); padding: 0; }
.link-box { display: flex; gap: 0; margin: 12px 0; border: 1.5px solid var(--ink); }
.link-box input { flex: 1; min-width: 0; padding: 10px; border: 0; background: transparent; font: 400 13px var(--mono); }
.link-box .btn { margin: 0; border-width: 0 0 0 1.5px; min-height: 44px; }
.share-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.app-btn { color: var(--ink); }

/* ---------- poster ---------- */
.poster { max-width: 700px; margin: 0 auto; padding: 40px 28px; text-align: center; background: #fff; min-height: 100vh; }
.poster-head .wordmark { font-size: 26px; }
.poster h1 { font-size: 52px; letter-spacing: -0.05em; margin: 28px 0 12px; line-height: .98; }
.p-when { font: 700 18px var(--mono); letter-spacing: .04em; text-transform: uppercase; margin: 6px 0; }
.p-where, .p-dist { font-size: 18px; margin: 4px 0; }
.p-qr { width: 340px; max-width: 80%; margin: 26px auto; display: block; }
.p-scan { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; margin: 0; }
.p-code { font: 400 14px var(--mono); } .p-code b { letter-spacing: .3em; font-size: 22px; }
.p-small { color: var(--muted); font: 400 12px var(--mono); text-transform: uppercase; letter-spacing: .06em; }
@media print { .no-print { display: none !important; } body { background: #fff; } }

/* ======================================================================
   LIVE RIDE SCREEN
   ====================================================================== */
.ride { position: fixed; inset: 0; overflow: hidden; background: #dcd6cb; }
#map { position: absolute; inset: 0; }
.topbar { position: absolute; left: 0; right: 0; top: 0; z-index: 800; display: flex; gap: 10px; align-items: center;
  background: var(--panel); color: #fff; padding: calc(8px + var(--safe-top)) 10px 8px; }
.tb-title { flex: 1; min-width: 0; }
.tb-title b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 16px; font-weight: 800; letter-spacing: -0.02em; }
.tb-title small { font: 400 11px var(--mono); color: #a7aca6; letter-spacing: .04em; }
.conn { font: 400 10px var(--mono); text-transform: uppercase; letter-spacing: .06em; text-align: right; max-width: 42%; line-height: 1.35; color: #cfd3cd; }
.conn.clickable { text-decoration: underline; cursor: pointer; }
.dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; vertical-align: 1px; }
.dot.ok { background: #5fd17f; } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); animation: blink 1s infinite; }

.fabs { position: absolute; right: 10px; top: calc(70px + var(--safe-top)); z-index: 700; display: flex; flex-direction: column; border: 1.5px solid var(--ink); background: var(--paper); }
.fab { width: 46px; height: 46px; border: 0; border-top: 1px solid var(--line); background: transparent; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink); padding: 0; }
.fab:first-child { border-top: 0; }

.bottom { position: absolute; left: 0; right: 0; bottom: 0; z-index: 800; padding-bottom: var(--safe-bottom); background: var(--panel); }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line-dark); border-bottom: 1px solid var(--line-dark); }
.q { position: relative; overflow: hidden; height: 62px; border: 0; background: var(--panel); color: #fff; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 5px; font: 700 10px var(--mono); letter-spacing: .07em; text-transform: uppercase; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; white-space: nowrap; padding: 0 2px; }
.q .qi { line-height: 0; }
.q .qi .ic { width: 22px; height: 22px; }
.q:active { background: #000; }
.q.sos { background: var(--accent); }
.q.sos .qi { font: 800 17px var(--sans); letter-spacing: .02em; line-height: 1; }
.q.sos .fill { position: absolute; left: 0; bottom: 0; height: 4px; width: 0; background: #fff; }
.q.sos.holding { background: var(--accent-dark); }

.sheet { background: var(--panel); color: #fff; max-height: 118px; overflow: hidden; transition: max-height .25s; }
.sheet.open { max-height: 62vh; overflow-y: auto; }
.handle { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; border: 0; background: none; color: #a7aca6; padding: 8px 0 6px;
  font: 700 10px var(--mono); letter-spacing: .08em; text-transform: uppercase; cursor: pointer; }
.handle i { display: block; width: 28px; height: 2px; background: #59605a; }
.rider-row { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; color: #fff; text-align: left; padding: 9px 12px; border-top: 1px solid var(--line-dark); cursor: pointer; }
.rider-row.me { background: var(--panel2); }
.rider-row .av { width: 36px; height: 36px; font-size: 17px; border-width: 2.5px; }
.rr-main { flex: 1; min-width: 0; }
.rr-main b { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.rr-main small { display: block; font: 400 11px var(--mono); color: #c3c8c1; letter-spacing: .02em; margin-top: 1px; }
.rr-main small.muted { color: #808780; } .rr-main small.bad { color: #ff7a5c; }
.rr-bike { font: 400 10px var(--mono); color: #8d948d; max-width: 34%; text-align: right; text-transform: uppercase; letter-spacing: .04em; }
.tag { font: 700 9px var(--mono); font-style: normal; letter-spacing: .08em; text-transform: uppercase; padding: 2px 5px; margin-left: 8px; vertical-align: 2px; border: 1px solid currentColor; }
.tag.lead { color: var(--accent); } .tag.sweep { color: #7fb2ff; }

/* map markers */
.rm { position: relative; width: 48px; display: flex; flex-direction: column; align-items: center; }
.rm .av { width: 44px; height: 44px; box-shadow: 0 0 0 2px #fff, 0 2px 8px rgba(0,0,0,.35); font-size: 21px; }
.rm .lbl { margin-top: 4px; background: var(--ink); color: #fff; font: 700 10px var(--mono); letter-spacing: .05em; text-transform: uppercase; padding: 2px 5px; white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.rm .lbl2 { background: #fff; color: var(--ink); font: 400 9px var(--mono); padding: 1px 5px; white-space: nowrap; max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.rm.me .av { box-shadow: 0 0 0 2px #fff, 0 0 0 6px rgba(20,23,20,.35); }
.rm.stale { opacity: .45; filter: grayscale(1); }
.rm.alert .av { animation: pulse 1s infinite; }
.rm.alert.sos .av, .rm.alert.problem .av { border-color: var(--bad); }
.badge { position: absolute; top: -3px; right: -3px; width: 17px; height: 17px; font: 700 10px var(--mono); font-style: normal; display: flex; align-items: center; justify-content: center; color: #fff; border: 1.5px solid #fff; }
.badge.lead { background: var(--accent); } .badge.sweep { background: #2e6fd9; }
.flag { width: 16px; height: 16px; border: 2.5px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.flag.start { background: var(--ok); } .flag.finish { background: var(--ink); }
.meet-pin { display: inline-flex; align-items: center; gap: 6px; }
.meet-pin i { display: block; width: 14px; height: 14px; background: var(--accent); border: 2.5px solid #fff; transform: rotate(45deg); box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.meet-pin span { font: 700 10px var(--mono); letter-spacing: .06em; text-transform: uppercase; background: var(--ink); color: #fff; padding: 3px 6px; white-space: nowrap; }
.meet-pin.regroup i { background: #2e6fd9; }

/* toasts */
.toasts { position: fixed; left: 10px; right: 66px; top: calc(70px + var(--safe-top)); z-index: 950; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.page ~ .toasts { top: auto; bottom: calc(16px + var(--safe-bottom)); right: 10px; }
.toast { pointer-events: auto; background: var(--panel); color: #fff; padding: 12px 14px; font-size: 15px; border-left: 3px solid #fff; box-shadow: 0 6px 16px rgba(0,0,0,.25); animation: slide .2s ease-out; }
.toast b { font-weight: 800; }
.toast.warn { border-left-color: var(--warn); } .toast.info { border-left-color: #6aa6ff; }
.toast.sos { background: var(--bad); border-left-color: #fff; font-size: 17px; animation: slide .2s, blinkbg 1s infinite; }
.toast.clickable { cursor: pointer; }

/* off-route warning */
.offroute { position: absolute; inset: 0; z-index: 900; pointer-events: none; animation: flash 1s infinite; }
.off-panel { pointer-events: auto; position: absolute; left: 0; right: 0; top: calc(58px + var(--safe-top)); background: var(--bad); color: #fff; padding: 16px 14px 12px; }
.off-title { font: 800 30px var(--sans); letter-spacing: -0.04em; line-height: 1; text-transform: uppercase; }
.off-dist { font-size: 17px; font-weight: 600; margin: 8px 0 2px; }
.off-dir { display: flex; align-items: center; gap: 8px; font: 400 12px var(--mono); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px; }
.off-dir .arrow { display: inline-flex; transition: transform .3s; }
.off-btns { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.off-btns .btn { margin: 0; background: transparent; color: #fff; border-color: #fff; min-height: 44px; font-size: 10px; padding: 6px 4px; }
.off-btns .btn:first-child { background: #fff; color: var(--bad); }

/* overlays and dialogs */
.overlay { position: absolute; inset: 0; z-index: 1000; background: rgba(20,23,20,.55); display: flex; align-items: flex-end; justify-content: center; }
.dialog { background: var(--paper); color: var(--ink); width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; border-top: 3px solid var(--accent);
  padding: 22px 18px calc(18px + var(--safe-bottom)); }
.dialog h2 { font-size: 26px; letter-spacing: -0.04em; margin: 0 0 10px; }
.dialog h3 { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 22px 0 4px; }
.dialog p { margin: 8px 0 12px; }
.dialog .btn { margin: 8px 0; }
.lang-row { display: flex; justify-content: center; margin: 14px 0; }
.rider-head { display: flex; gap: 14px; align-items: center; }
.rider-head .av { width: 60px; height: 60px; font-size: 30px; }
.rider-head h2 { margin: 0; } .rider-head p { margin: 2px 0 0; font: 400 12px var(--mono); color: var(--muted); text-transform: uppercase; }

/* leaflet tweaks */
.leaflet-container { font-family: var(--sans); }
.leaflet-control-attribution { font: 400 9px var(--mono) !important; background: rgba(248,245,240,.85) !important; }
.ride .leaflet-bottom { bottom: 190px; }
.leaflet-popup-content-wrapper { border-radius: 0; }

@keyframes blink { 50% { opacity: .3; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 2px #fff, 0 0 0 2px rgba(217,58,31,.8); } 100% { box-shadow: 0 0 0 2px #fff, 0 0 0 18px rgba(217,58,31,0); } }
@keyframes flash { 0%, 100% { box-shadow: inset 0 0 0 8px rgba(217,58,31,.95); } 50% { box-shadow: inset 0 0 0 22px rgba(217,58,31,.3); } }
@keyframes blinkbg { 50% { background: #8e1d0a; } }
@keyframes slide { from { transform: translateY(-8px); opacity: 0; } }
.form label.file-btn { display: inline-flex; width: auto; margin: 6px 0; color: var(--ink); font-size: 11px; min-height: 42px; }
.av .bike-ic svg { width: 80%; }

/* visible "start" bar after choosing to just look at the map */
.start-bar { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 54px; border: 0; background: var(--accent); color: #fff;
  font: 700 12px var(--mono); letter-spacing: .07em; text-transform: uppercase; cursor: pointer; }
.start-bar .ic { width: 18px; height: 18px; }
.start-bar:active { background: var(--accent-dark); }

/* ===== POWER MODE ===== */
.power-flash { position: fixed; inset: 0; z-index: 3000; display: flex; align-items: center; justify-content: center; background: rgba(20,23,20,.92);
  animation: pf 2.6s ease forwards; pointer-events: none; }
.power-flash div { text-align: center; color: #fff; padding: 0 24px; }
.power-flash b { display: block; font: 800 40px var(--sans); letter-spacing: -0.045em; line-height: 1; color: var(--accent); animation: pfz .5s cubic-bezier(.2,1.6,.4,1); }
.power-flash small { display: block; margin-top: 14px; font: 400 12px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: #cfd3cd; }
@keyframes pf { 0% { opacity: 0; } 8% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes pfz { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.hud { position: absolute; left: 10px; top: calc(70px + var(--safe-top)); z-index: 700; display: grid; grid-template-columns: auto auto auto auto; gap: 1px;
  background: var(--line-dark); border: 1px solid var(--line-dark); }
.hud > div { background: var(--panel); color: #fff; padding: 6px 10px; text-align: left; }
.hud > div b { display: block; font: 700 18px var(--mono); line-height: 1.1; }
.hud > div small { display: block; font: 400 9px var(--mono); color: #a7aca6; text-transform: uppercase; letter-spacing: .08em; }
.hud .hud-speed { display: flex; flex-direction: column; justify-content: center; }
.hud > div:not(.hud-speed) { display: flex; flex-direction: column; justify-content: flex-end; }
.hud .hud-speed b { font-size: 30px; color: var(--accent); }
.ride.power .toasts { top: calc(130px + var(--safe-top)); }
#map.night .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9) saturate(.6); }
.power-h { color: var(--accent) !important; }
.btn.power-btn { border-color: var(--accent); color: var(--accent); }
.toast.power { border-left-color: var(--accent); }

/* power riders: visible to everyone */
.rm.pw .av { box-shadow: 0 0 0 2px #fff, 0 0 0 5px var(--accent), 0 0 18px 6px rgba(228,80,29,.65); animation: pwglow 1.6s ease-in-out infinite; }
@keyframes pwglow { 50% { box-shadow: 0 0 0 2px #fff, 0 0 0 5px var(--accent), 0 0 28px 12px rgba(228,80,29,.35); } }
.badge.bolt { left: -6px; right: auto; top: -6px; background: var(--accent); color: #fff; font-style: normal; }
.tag.pw { background: var(--accent); color: #fff; }
/* desktop / tablet: dialogs float in the middle of the screen */
@media (min-width: 700px) and (min-height: 500px) {
  .overlay { align-items: center; padding: 24px; }
  .dialog { max-height: calc(100vh - 48px); padding: 26px 24px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
}

/* legal pages and links */
.legal-links { display: flex; gap: 8px; justify-content: center; margin: 22px 0 8px; font: 400 11px var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.legal-links a { color: var(--muted); text-decoration: none; border-bottom: 1px solid transparent; } .legal-links a:hover { border-color: var(--muted); }
.legal-links span { color: var(--muted); }
.agree { font-size: 12px; color: var(--muted); margin: 10px 0 0; text-align: center; } .agree a { color: inherit; }
.safety { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; background: #fff3ec; border-left: 3px solid var(--accent); padding: 8px 10px; margin: 12px 0; }
.safety svg { width: 18px; height: 18px; flex: none; color: var(--accent); }
.legal article { max-width: 680px; margin: 0 auto; line-height: 1.6; }
.legal article h1 { font-size: 34px; letter-spacing: -0.04em; margin: 8px 0 4px; }
.legal article h2 { font: 700 12px var(--mono); text-transform: uppercase; letter-spacing: .08em; margin: 28px 0 6px; }
.legal article h2.warn-h { color: var(--accent); }
.legal article ul { padding-left: 18px; } .legal article li { margin: 6px 0; }
.legal article a { color: var(--ink); }

/* SOS sent: cancel bar */
.sos-active { display: flex; align-items: center; gap: 8px; background: var(--bad, #c62828); color: #fff; padding: 10px 12px; }
.sos-active.hidden { display: none; }
.sos-active div { flex: 1; } .sos-active b { display: block; font-size: 15px; } .sos-active small { font: 400 11px var(--mono); opacity: .9; }
.sos-active .btn { margin: 0; width: auto; background: #fff; color: var(--bad, #c62828); border-color: #fff; text-decoration: none; }
.sos-active .btn.call { background: transparent; color: #fff; }
.toast.ok { border-left-color: #3fb950; }

/* support / donate */
.donate { display: flex; align-items: center; gap: 12px; margin: 22px 0 0; padding: 14px; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); text-decoration: none; }
.donate:hover { background: #fff; }
.donate .donate-ic { width: 34px; height: 34px; flex: none; display: flex; align-items: center; justify-content: center; background: var(--accent); color: #fff; font-size: 18px; }
.donate span:nth-child(2) { flex: 1; } .donate b { display: block; font-size: 15px; } .donate small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.donate .donate-pp { font: 700 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: #003087; }
.donate.compact { margin: 8px 0; padding: 10px 12px; }

/* ride history: remove */
.ride-row { display: flex; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); }
.ride-row .ride-item { flex: 1; border-top: 0; min-width: 0; }
.ride-del { background: none; border: 0; padding: 10px; margin-left: 6px; color: var(--muted); cursor: pointer; }
.ride-del svg { width: 18px; height: 18px; } .ride-del:hover { color: var(--bad); }
.ride-confirm { flex-basis: 100%; display: flex; align-items: center; gap: 8px; padding: 0 0 12px; font-size: 13px; }
.ride-confirm.hidden { display: none; } .ride-confirm span { flex: 1; }
.ride-confirm .btn { width: auto; margin: 0; }
.ride-row.confirming .ride-del { visibility: hidden; }
/* credits */
.credits { text-align: center; font: 400 11px var(--mono); color: var(--muted); letter-spacing: .04em; margin: 4px 0 18px; }
.credits a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--muted); }
