:root {
  --bg: #ffffff;
  --bg-2: #f3f5f4;
  --fg: #14201c;
  --muted: #5b6b66;
  --line: #e2e8e5;
  --brand: #0f766e;
  --brand-2: #14b8a6;
  --brand-ink: #ffffff;
  --danger: #dc2626;
  --shadow: 0 6px 24px rgba(15, 30, 25, 0.16), 0 1px 3px rgba(15, 30, 25, 0.12);
  --c-path: #16a34a;
  --c-lane: #2563eb;
  --c-shared: #f59e0b;
  --c-quiet: #5eead4;
  --c-offroad: #a3e635;
  --c-medium: #fb923c;
  --c-main: #ef4444;
  --radius: 16px;
  --planner-h: 160px;
  --sheet-h: 120px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17201d;
    --bg-2: #222d29;
    --fg: #e8efec;
    --muted: #9db0a9;
    --line: #2e3b37;
    --brand: #2dd4bf;
    --brand-2: #14b8a6;
    --brand-ink: #062a26;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: 'IBM Plex Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--fg);
  background: var(--bg-2);
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

#map { position: fixed; inset: 0; background: #f2f3f0; }

.card {
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.muted { color: var(--muted); }
.small { font-size: 13px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; font-weight: 600; }

/* ---------- layout: mobile first ---------- */

#side { display: contents; }

#planner {
  position: fixed;
  top: calc(8px + var(--safe-top));
  left: 8px;
  right: 8px;
  z-index: 1000;
  padding: 10px 10px 8px;
}

#sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 0 14px calc(12px + var(--safe-bottom));
  max-height: 34vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  transition: max-height .25s ease;
}
#sheet.expanded { max-height: calc(100vh - var(--planner-h) - 24px - var(--safe-top)); max-height: calc(100dvh - var(--planner-h) - 24px - var(--safe-top)); }

.sheet-handle {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: center;
  width: calc(100% + 28px);
  margin: 0 -14px;
  padding: 8px 0 6px;
  background: var(--bg);
  border: 0;
  z-index: 2;
}
.sheet-handle span { width: 40px; height: 5px; border-radius: 3px; background: var(--line); }

.map-btns {
  position: fixed;
  right: 10px;
  top: calc(var(--planner-h) + 20px + var(--safe-top));
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fab {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 0;
  background: var(--bg);
  color: var(--fg);
  box-shadow: var(--shadow);
  display: grid; place-items: center;
}
.fab.active { color: var(--brand); }
.fab.active svg { filter: drop-shadow(0 0 4px rgba(20,184,166,.5)); }

.leaflet-control-zoom { display: none; }
.leaflet-bottom { bottom: calc(var(--sheet-h) - 2px); }
.leaflet-control-attribution { font-size: 10px; }

@media (min-width: 900px) {
  #side {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: fixed;
    top: 12px; left: 12px; bottom: 12px;
    width: 384px;
    z-index: 1000;
    pointer-events: none;
  }
  #side > * { pointer-events: auto; }
  #planner, #sheet { position: static; }
  #sheet {
    border-radius: var(--radius);
    max-height: none;
    flex: 1 1 auto;
    padding-top: 12px;
    min-height: 0;
  }
  .sheet-handle { display: none; }
  .map-btns { top: auto; bottom: 34px; right: 12px; }
  .leaflet-control-zoom { display: block; }
  .leaflet-bottom { bottom: 0; }
}

/* ---------- planner ---------- */

.brand-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.pill-btn {
  border: 1px solid var(--line); background: var(--bg-2);
  border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 600;
}

.fields { position: relative; display: grid; gap: 6px; }
.field {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-2);
  border-radius: 12px;
  padding: 0 4px 0 10px;
  border: 1.5px solid transparent;
}
.field:focus-within { border-color: var(--brand-2); background: var(--bg); }
.field input {
  flex: 1; min-width: 0;
  border: 0; outline: 0; background: transparent;
  padding: 11px 0;
  font-size: 16px; /* avoids iOS zoom on focus */
}
.field input::-webkit-search-cancel-button { display: none; }
.pin {
  flex: none;
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff;
}
.pin-a { background: var(--c-path); }
.pin-b { background: #e11d48; }
.icon-btn {
  flex: none;
  width: 38px; height: 38px;
  border: 0; border-radius: 10px;
  background: transparent; color: var(--muted);
  display: grid; place-items: center;
}
.icon-btn:hover { background: var(--line); color: var(--fg); }

.suggest {
  position: absolute; left: 0; right: 0; top: 100%;
  margin: 6px 0 0; padding: 6px;
  list-style: none;
  background: var(--bg);
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 5;
  max-height: 50vh; overflow-y: auto;
}
.suggest li {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 9px 10px; border-radius: 10px; cursor: pointer;
}
.suggest li:hover, .suggest li.active { background: var(--bg-2); }
.suggest .s-ico { flex: none; width: 20px; text-align: center; }
.suggest .s-name { font-weight: 500; }
.suggest .s-detail { font-size: 12px; color: var(--muted); }
.suggest .s-empty { color: var(--muted); cursor: default; }

.profiles {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 4px; margin-top: 8px;
  background: var(--bg-2); padding: 3px; border-radius: 12px;
}
.profiles button {
  border: 0; background: transparent;
  padding: 7px 4px; border-radius: 9px;
  font-size: 14px; font-weight: 500; color: var(--muted);
}
.profiles button[aria-checked="true"] { background: var(--bg); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 600; }

/* ---------- route box ---------- */

#route-box { padding-top: 4px; }
.route-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.route-big { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.safety-badge {
  flex: none; text-align: center;
  border-radius: 12px; padding: 6px 10px;
  background: var(--bg-2); font-size: 11px; line-height: 1.2; color: var(--muted);
}
.safety-badge b { display: block; font-size: 20px; color: var(--fg); }
.bar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; margin: 12px 0 8px; background: var(--line); }
.bar span { display: block; height: 100%; }
.bar-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; list-style: none; margin: 0; padding: 0; font-size: 12px; color: var(--muted); }
.bar-legend li { display: flex; align-items: center; gap: 5px; }
.bar-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.alts { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.alts button {
  border: 1px solid var(--line); background: var(--bg);
  border-radius: 999px; padding: 4px 12px; font-size: 13px;
}
.alts button.on { border-color: var(--brand); color: var(--brand); font-weight: 600; }

.actions { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 6px; margin-top: 12px; }
.actions button {
  border: 0; border-radius: 12px; padding: 11px 6px;
  background: var(--bg-2); font-size: 14px; font-weight: 500;
}
.actions .primary {
  background: var(--brand); color: var(--brand-ink); font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}

.steps { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.steps summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.steps ol { list-style: none; padding: 0; margin: 6px 0 0; }
.steps li { display: flex; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; cursor: pointer; }
.steps li:last-child { border-bottom: 0; }
.steps .st-ico { flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--bg-2); display: grid; place-items: center; }
.steps .st-dist { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }

.loading { display: flex; align-items: center; gap: 10px; padding: 12px 0; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 2.5px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- conditions ---------- */

.cond { margin-top: 6px; }
.cond-card { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 14px; background: var(--bg-2); }
.cond-emoji { font-size: 34px; line-height: 1; }
.cond-main { flex: 1; min-width: 0; }
.cond-verdict { font-weight: 700; }
.cond-verdict.good { color: var(--c-path); }
.cond-verdict.ok { color: #d97706; }
.cond-verdict.bad { color: var(--danger); }
.cond-row { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--muted); margin-top: 2px; }
.aq { display: inline-block; padding: 0 6px; border-radius: 6px; color: #fff; font-weight: 600; font-size: 12px; }

/* ---------- spots & layers ---------- */

.spots { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.spots::-webkit-scrollbar { display: none; }
.spots button {
  flex: none; border: 1px solid var(--line); background: var(--bg);
  border-radius: 12px; padding: 8px 12px; text-align: left; font-size: 13px;
}
.spots button b { display: block; font-size: 14px; font-weight: 600; }

.layer-list { display: grid; gap: 2px; }
.layer-row { display: flex; align-items: center; gap: 10px; padding: 7px 2px; cursor: pointer; font-size: 14px; }
.layer-row input { width: 18px; height: 18px; accent-color: var(--brand); margin: 0; }
.layer-row .sw { width: 22px; height: 6px; border-radius: 3px; flex: none; }
.layer-row .dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.2); flex: none; margin: 0 5px; }
.layer-row .cnt { margin-left: auto; color: var(--muted); font-size: 12px; }

.basemaps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.basemaps button {
  border: 1.5px solid var(--line); background: var(--bg);
  border-radius: 10px; padding: 7px 2px; font-size: 12px;
}
.basemaps button.on { border-color: var(--brand); color: var(--brand); font-weight: 600; }

.foot { margin: 18px 0 4px; line-height: 1.5; }

/* ---------- map bits ---------- */

.leaflet-container { font-family: inherit; }
.leaflet-popup-content-wrapper { border-radius: 14px; background: var(--bg); color: var(--fg); }
.leaflet-popup-tip { background: var(--bg); }
.leaflet-popup-content { margin: 12px 14px; min-width: 180px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.pp-title { font-weight: 600; font-size: 15px; }
.pp-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.pp-meta { font-size: 12px; margin-top: 6px; line-height: 1.5; }
.pp-meta a { color: var(--brand); }
.pp-actions { display: flex; gap: 6px; margin-top: 10px; }
.pp-actions button {
  flex: 1; border: 0; border-radius: 10px; padding: 8px 6px;
  font-size: 13px; font-weight: 600; color: #fff;
}
.pp-actions .from { background: var(--c-path); }
.pp-actions .to { background: #e11d48; }

.ab-pin {
  width: 30px; height: 30px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: grid; place-items: center;
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.ab-pin span { transform: rotate(45deg); color: #fff; font-weight: 700; font-size: 13px; }

.me-dot { position: relative; width: 22px; height: 22px; }
.me-dot .core {
  position: absolute; inset: 3px; border-radius: 50%;
  background: #2563eb; border: 3px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.15), 0 2px 6px rgba(37,99,235,.5);
}
.me-dot .cone {
  position: absolute; left: 50%; top: 50%;
  width: 0; height: 0;
  border-left: 9px solid transparent; border-right: 9px solid transparent;
  border-bottom: 18px solid rgba(37, 99, 235, .35);
  transform-origin: 50% 100%;
  margin-left: -9px; margin-top: -26px;
}

/* ---------- ride HUD ---------- */

body.riding #side, body.riding .map-btns { display: none; }
body.riding .leaflet-bottom { bottom: 96px; }
#hud .hud-turn {
  position: fixed; top: calc(8px + var(--safe-top)); left: 8px; right: 8px; z-index: 1100;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 10px 12px 14px;
  background: var(--brand); color: var(--brand-ink);
}
#hud .hud-icon { width: 52px; height: 52px; flex: none; display: grid; place-items: center; }
#hud .hud-main { flex: 1; min-width: 0; }
#hud .hud-dist { font-size: 28px; font-weight: 700; line-height: 1.1; }
#hud .hud-text { font-size: 16px; opacity: .92; }
#hud .hud-turn .icon-btn { color: inherit; background: rgba(255,255,255,.15); }
#hud .hud-bottom {
  position: fixed; left: 8px; right: 8px; bottom: calc(8px + var(--safe-bottom)); z-index: 1100;
  display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px;
}
.hud-stat { display: flex; flex-direction: column; min-width: 58px; font-size: 11px; color: var(--muted); }
.hud-stat b { font-size: 18px; color: var(--fg); }
#stop-btn { margin-left: auto; border: 0; border-radius: 12px; padding: 12px 14px; background: var(--danger); color: #fff; font-weight: 600; }
@media (min-width: 900px) {
  #hud .hud-turn { left: 12px; right: auto; width: 420px; }
  #hud .hud-bottom { left: 12px; right: auto; width: 420px; }
}

#toast {
  position: fixed; left: 50%; bottom: calc(var(--sheet-h) + 16px);
  transform: translateX(-50%) translateY(20px);
  background: #14201c; color: #fff;
  padding: 10px 16px; border-radius: 12px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .25s ease;
  z-index: 2000; max-width: calc(100% - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (min-width: 900px) { #toast { bottom: 28px; left: calc(50% + 200px); } }

/* ---------- brand actions ---------- */

.brand-actions { display: flex; gap: 6px; align-items: center; }
.online-chip { display: flex; align-items: center; gap: 6px; }
.online-chip i { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.2); }
.donate-btn { color: #e11d48; }

/* ---------- community ---------- */

.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 18px 0 8px; }
.sec-head h3 { margin: 0; }
.live { color: #16a34a; font-size: 12px; font-weight: 600; }

.join-btn {
  width: 100%; border: 1.5px dashed var(--brand); background: transparent; color: var(--brand);
  border-radius: 12px; padding: 12px; font-weight: 600;
}
.me-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg-2); border-radius: 14px; }
.av-big { font-size: 26px; line-height: 1; }
.me-info { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.me-info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.me-note { margin: 6px 4px 0; line-height: 1.4; }
.link { border: 0; background: none; padding: 0; color: var(--brand); font-size: 13px; }
.danger-link { color: var(--danger); }

.switch { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12px; color: var(--muted); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { position: relative; width: 42px; height: 24px; border-radius: 12px; background: var(--line); transition: background .2s; flex: none; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + i { background: #22c55e; }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:disabled + i { opacity: .45; cursor: not-allowed; }
.switch input:focus-visible + i { outline: 2px solid var(--brand-2); outline-offset: 2px; }
.switch-label { max-width: 76px; text-align: right; line-height: 1.2; }

.people { list-style: none; margin: 8px 0 0; padding: 0; }
.people li { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.people li:last-child { border-bottom: 0; }
.people li[data-r].has-loc, .people li[data-g], .people li[data-h] { cursor: pointer; }
.people li.empty { color: var(--muted); font-size: 13px; }
.p-av, .g-ico { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--bg-2); display: grid; place-items: center; font-size: 18px; }
.p-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.p-main b { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-main .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { flex: none; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--bg-2); color: var(--muted); }
.badge.riding { background: #dcfce7; color: #15803d; font-weight: 600; }
.pace { flex: none; font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.pace-chill { background: #dcfce7; color: #15803d; }
.pace-medium { background: #fef3c7; color: #b45309; }
.pace-fast { background: #fee2e2; color: #b91c1c; }

/* map markers */
.rider {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg); color: var(--fg);
  border-radius: 999px; padding: 2px 9px 2px 2px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  border: 2px solid #94a3b8;
  white-space: nowrap; font-size: 12px; font-weight: 600;
}
.rider.riding { border-color: #22c55e; }
.rider.mine { border-color: #2563eb; }
.rider-av { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-2); font-size: 15px; }
.rider-name { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
.grp-pin {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: #fff7ed; border: 2.5px solid #f97316; font-size: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

/* ---------- modal ---------- */

.modal {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(10, 20, 17, .45);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
}
.modal-card {
  position: relative;
  width: 100%; max-width: 480px; max-height: 88vh; max-height: 88dvh; overflow-y: auto;
  background: var(--bg); color: var(--fg);
  border-radius: 20px 20px 0 0;
  padding: 20px 18px calc(18px + var(--safe-bottom));
  box-shadow: var(--shadow);
}
@media (min-width: 600px) {
  .modal { align-items: center; padding: 20px; }
  .modal-card { border-radius: 20px; }
}
.modal-card h2 { margin: 0 32px 6px 0; font-size: 20px; letter-spacing: -.01em; }
.modal-x { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--bg-2); font-size: 22px; line-height: 1; color: var(--muted); }
.fl { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.fl > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.fl input, .fl select, .fl textarea {
  width: 100%; border: 1.5px solid var(--line); background: var(--bg); border-radius: 12px;
  padding: 11px 12px; font-size: 16px; outline: 0; resize: vertical;
}
.fl input:focus, .fl select:focus, .fl textarea:focus { border-color: var(--brand-2); }
.avatars { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.av { aspect-ratio: 1; border: 1.5px solid var(--line); background: var(--bg); border-radius: 12px; font-size: 20px; padding: 0; }
.av.on { border-color: var(--brand); background: var(--bg-2); box-shadow: 0 0 0 2px var(--brand-2) inset; }
.modal-actions { display: flex; gap: 8px; margin-top: 18px; justify-content: flex-end; }
.modal-actions.wrap { flex-wrap: wrap; }
.modal-actions.wrap > * { flex: 1 1 auto; }
.modal-actions.owner { justify-content: space-between; margin-top: 12px; }
.modal-actions button, .btn {
  border: 0; border-radius: 12px; padding: 11px 16px; background: var(--bg-2);
  font-size: 14px; font-weight: 600; text-decoration: none; color: var(--fg); text-align: center;
}
.modal-actions .primary, .btn.primary { background: var(--brand); color: var(--brand-ink); }
.modal-actions .link { padding: 4px 0; background: none; }
.meet-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.meet-row button { border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 6px 12px; font-size: 13px; }
.g-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--bg-2); }
.g-desc { white-space: pre-line; line-height: 1.55; margin: 14px 0 0; }
.g-members { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); }

.amounts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.amounts button { border: 1.5px solid var(--line); background: var(--bg); border-radius: 10px; padding: 8px 2px; font-weight: 600; }
.amounts button.on { border-color: var(--brand); color: var(--brand); }
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 14px; padding: 14px; background: #fff; color: #14201c; border-radius: 16px; border: 1px solid var(--line); }
.qr-box img { width: 240px; height: 240px; }
.qr-box .muted { color: #5b6b66; }

/* ---------- call for help ---------- */

.fab.sos { background: #dc2626; color: #fff; font-weight: 800; font-size: 13px; letter-spacing: .02em; }
.sos-mini { background: #dc2626 !important; color: #fff !important; font-weight: 800; font-size: 11px; }
.sos-banner {
  margin-top: 12px; padding: 10px 12px; border-radius: 12px;
  background: #fef2f2; color: #991b1b; font-size: 13px; line-height: 1.5;
}
.sos-banner a { color: #b91c1c; font-weight: 700; }
.kinds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kinds button {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: 1.5px solid var(--line); background: var(--bg); border-radius: 14px;
  padding: 12px 4px; font-size: 13px; font-weight: 500;
}
.kinds button span { font-size: 24px; }
.kinds button.on { border-color: #dc2626; background: #fef2f2; color: #991b1b; }
.modal-actions .sos-send { background: #dc2626; color: #fff; }
.modal-actions button:disabled { opacity: .45; cursor: default; }
.tag-ok { background: #dcfce7; color: #15803d; font-weight: 600; }
.help-av { background: #fef2f2; }
.help-item.mine { background: #fef2f2; border-radius: 12px; padding-left: 8px; padding-right: 8px; }
.help-count { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: #dc2626; color: #fff; font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.help-pin {
  position: relative; width: 40px; height: 40px; border-radius: 50%;
  background: #dc2626; border: 3px solid #fff; display: grid; place-items: center;
  box-shadow: 0 2px 10px rgba(220, 38, 38, .5);
}
.help-pin span { font-size: 18px; }
.help-pin::before {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  border: 3px solid #dc2626; animation: sos-pulse 1.6s ease-out infinite;
}
.help-pin.mine { background: #f97316; }
.help-pin.mine::before { border-color: #f97316; }
@keyframes sos-pulse { from { transform: scale(1); opacity: .9; } to { transform: scale(2.2); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .help-pin::before { animation: none; } }
.notify-row { margin-top: 8px; }
.me-info b.wrap { white-space: normal; font-size: 13px; line-height: 1.35; }

/* ---------- battery saver ride screen ---------- */

.saver-tap { display: none; }
#saver-btn.on { background: rgba(255,255,255,.32); }
body.saver { background: #000; }
body.saver #map { display: none; }
body.saver *, body.saver *::before { animation: none !important; transition: none !important; }
body.saver .saver-tap {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 10px;
  position: fixed; inset: 0; z-index: 1050; background: #000;
  padding: 0 24px calc(120px + var(--safe-bottom)); color: #6b7c77; text-align: center;
}
.saver-label { font-size: 13px; font-weight: 600; color: #7c8f89; }
.saver-hint { font-size: 13px; }
.saver-off { border: 1px solid #2a3330; background: #000; color: #8fa39d; border-radius: 10px; padding: 8px 14px; font-size: 13px; }
body.saver #hud .hud-turn {
  top: calc(12vh + var(--safe-top)); left: 0; right: 0; width: auto;
  flex-direction: column; text-align: center; gap: 6px;
  background: #000; color: #a9c9c2; box-shadow: none; border-radius: 0;
}
body.saver #hud .hud-icon { width: 140px; height: 140px; }
body.saver #hud .hud-icon svg { width: 120px; height: 120px; }
body.saver #hud .hud-dist { font-size: 64px; letter-spacing: -.02em; }
body.saver #hud .hud-text { font-size: 22px; color: #8fa39d; }
body.saver #hud .hud-turn .icon-btn { position: absolute; top: 0; background: #111; color: #7c8f89; }
body.saver #saver-btn { right: 64px; }
body.saver #voice-btn { right: 14px; }
body.saver #hud .hud-bottom {
  left: 0; right: 0; width: auto; border-radius: 0;
  background: #000; box-shadow: none; border-top: 1px solid #1a2220;
}
body.saver .hud-stat { color: #6b7c77; }
body.saver .hud-stat b { color: #c3d3cf; }
body.saver #stop-btn { background: #3a0d0d; color: #f3b4b4; }
body.saver .sos-mini { background: #3a0d0d !important; color: #f3b4b4 !important; }
body.saver #recenter-btn { display: none; }
body.saver #toast { bottom: 110px; }

/* ---------- feedback ---------- */

.feedback-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 22px; padding: 12px; border-radius: 12px;
  border: 1.5px solid var(--brand); color: var(--brand);
  font-weight: 600; font-size: 15px; text-decoration: none;
}
.feedback-btn:hover { background: var(--bg-2); }
.feedback-note { text-align: center; margin: 8px 8px 0; line-height: 1.45; }

/* ---------- share ---------- */

.share-opts { display: grid; gap: 10px; margin-top: 14px; }
.share-opts button {
  display: flex; align-items: center; gap: 14px; text-align: left;
  border: 1.5px solid var(--line); background: var(--bg); border-radius: 16px; padding: 14px;
}
.share-opts button:hover { border-color: var(--brand-2); }
.share-opts .sh-ico { font-size: 28px; flex: none; }
.share-opts b { display: block; font-size: 16px; }
.share-opts small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; line-height: 1.4; }
.share-preview { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 200px; margin-top: 12px; color: var(--muted); }
.share-preview img { max-width: 100%; max-height: 58vh; max-height: 58dvh; border-radius: 14px; box-shadow: var(--shadow); }
.share-preview { flex-direction: column; }
.sh-tip { text-align: center; margin: 8px 0 0; }

/* ---------- sheet tabs ---------- */

.tabs {
  position: sticky; top: 30px; z-index: 1;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  margin: 10px 0 6px; padding: 3px; border-radius: 12px; background: var(--bg-2);
}
@media (min-width: 900px) { .tabs { top: -12px; } }
.tabs button { border: 0; background: transparent; padding: 8px 4px; border-radius: 9px; font-size: 14px; font-weight: 500; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--bg); color: var(--fg); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.tab-panel { padding-top: 4px; }
.tab-panel .tip { margin: 14px 2px 4px; line-height: 1.5; }
#community-box > #me-card { margin-top: 6px; }
.more { border-bottom: 0 !important; justify-content: center; }
.more-btn { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 7px 16px; font-size: 13px; font-weight: 600; color: var(--brand); }

/* ---------- stops along the way ---------- */

.pin-via { background: #f97316; }
.via-field .via-remove { font-size: 14px; }
.add-stop { display: block; margin: 6px 0 0 auto; border: 0; background: none; color: var(--brand); font-size: 13px; font-weight: 600; padding: 2px 4px; }

/* ---------- map popup extra actions ---------- */

.pp-links { display: flex; gap: 14px; justify-content: center; margin-top: 8px; }
.pp-links button { border: 0; background: none; color: var(--brand); font-size: 13px; font-weight: 600; padding: 2px 0; }
.pp-links .report { color: #b45309; }

/* ---------- problem reports ---------- */

.rep-pin {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: #fffbeb; border: 2.5px solid #f59e0b; font-size: 15px;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.pp-actions .vote-yes { background: #f59e0b; }
.pp-actions .vote-gone { background: #16a34a; }
.route-warn {
  display: block; width: 100%; margin-top: 10px; padding: 9px 12px; border-radius: 12px;
  border: 1px solid #fcd34d; background: #fffbeb; color: #92400e; font-size: 13px; font-weight: 600; text-align: left;
}


/* ---------- eye button: panels hidden, whole map visible ---------- */

body.panel-hidden #side { display: none; }
