/* CARMA — dark, neon, glanceable. */
:root {
  --bg: #0b0b10;
  --bg2: #13131b;
  --card: #181822;
  --card2: #20202c;
  --line: #2a2a38;
  --text: #f2f2f7;
  --muted: #9a9aae;
  --pink: #ff2e88;
  --pink2: #ff6fb0;
  --mint: #2ee6a8;
  --amber: #ffb547;
  --red: #ff4d5e;
  --blue: #4da3ff;
  --radius: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --num: 'Rajdhani', 'Inter', system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.5 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; -webkit-font-smoothing: antialiased; min-height: 100vh; }
a { color: var(--pink2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 30px; font-weight: 800; }
h2 { font-size: 22px; font-weight: 800; }
h3 { font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-top: 1.4em; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.lead { font-size: 17px; color: #c9c9d6; }
.big-emoji { font-size: 54px; line-height: 1; margin: 10px 0 18px; }
[hidden] { display: none !important; }

.logo { font-weight: 800; letter-spacing: .32em; font-size: 22px; color: var(--pink); text-shadow: 0 0 24px rgba(255,46,136,.45); margin-bottom: 18px; }

/* ── Buttons & forms ─────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: 0; border-radius: 14px; padding: 12px 20px;
  font: 700 15px/1.2 'Inter', system-ui, sans-serif; cursor: pointer; color: var(--text); background: var(--card2); text-decoration: none !important;
  transition: transform .1s, filter .15s, background .15s; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: scale(.97); }
.btn-lg { width: 100%; padding: 16px 22px; font-size: 17px; border-radius: 16px; }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn-primary { background: linear-gradient(135deg, var(--pink), #ff5a5f); color: #fff; box-shadow: 0 8px 28px rgba(255,46,136,.35); }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn-google { background: #fff; color: #222; }
.btn-danger { background: rgba(255,77,94,.15); color: var(--red); border: 1px solid rgba(255,77,94,.35); }
.stack { display: grid; gap: 12px; margin: 24px 0; }
.form { display: grid; gap: 14px; margin: 10px 0 16px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; color: #d5d5e0; }
input[type=text], input[type=email], input:not([type]), select, textarea {
  width: 100%; background: var(--bg2); border: 1px solid var(--line); color: var(--text); border-radius: 12px; padding: 13px 14px; font: 16px 'Inter', system-ui, sans-serif; }
input:focus, select:focus { outline: 2px solid var(--pink); outline-offset: 1px; border-color: transparent; }
.code-input { font: 700 28px var(--num); letter-spacing: .3em; text-transform: uppercase; text-align: center; }
.alert { background: rgba(255,77,94,.12); border: 1px solid rgba(255,77,94,.35); color: #ffb3bb; padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; }
.notice { background: rgba(46,230,168,.1); border: 1px solid rgba(46,230,168,.3); color: #b5f5df; padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 18px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); font-weight: 600; }
.toggle small { display: block; color: var(--muted); font-weight: 400; }
.toggle input { width: 22px; height: 22px; accent-color: var(--pink); }
.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.seg label { display: block; }
.seg input { display: none; }
.seg span { display: block; padding: 8px 16px; border-radius: 9px; cursor: pointer; font-weight: 700; }
.seg input:checked + span { background: var(--pink); color: #fff; }

/* ── Landing / auth ──────────────────────────── */
.hero { max-width: 480px; margin: 0 auto; padding: 48px 22px 40px; position: relative; text-align: center; }
.hero-glow { position: absolute; inset: -40px 0 auto; height: 420px; background: radial-gradient(closest-side, rgba(255,46,136,.28), transparent); z-index: -1; }
.hero h1 { font-size: 40px; }
.hero-car { margin: 18px auto 0; height: 190px; filter: drop-shadow(0 20px 40px rgba(255,46,136,.35)); }
.hero-car svg { transform: rotate(90deg); }
.feature-list { list-style: none; padding: 0; margin: 28px 0; display: grid; gap: 10px; text-align: left; }
.feature-list li { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.feature-list b { display: block; }
.feature-list span { color: var(--muted); font-size: 14px; }
.auth-card { max-width: 440px; margin: 0 auto; padding: 48px 22px 120px; }
.auth-card .btn + .btn { margin-top: 10px; }

/* ── Car-screen pairing ──────────────────────── */
body.pair { min-height: 100vh; display: flex; align-items: center; background: radial-gradient(ellipse at 70% 50%, #2a0f22, var(--bg) 60%); }
.pair-wrap { display: grid; grid-template-columns: 1.1fr .9fr; gap: 60px; align-items: center; width: 100%; max-width: 1400px; margin: 0 auto; padding: 40px 60px; }
.pair-left h1 { font-size: 52px; }
.steps { list-style: none; padding: 0; margin: 26px 0; display: grid; gap: 16px; font-size: 22px; }
.steps li { display: flex; gap: 16px; align-items: flex-start; }
.steps span { flex: 0 0 40px; height: 40px; border-radius: 50%; background: var(--pink); color: #fff; font: 700 22px/40px var(--num); text-align: center; }
.short-code { font: 700 64px var(--num); letter-spacing: .25em; color: #fff; margin: 4px 0 18px; }
.pair-right { display: grid; justify-items: center; gap: 22px; }
.qr { background: #fff; border-radius: 28px; padding: 22px; width: min(460px, 38vw); aspect-ratio: 1; box-shadow: 0 0 80px rgba(255,46,136,.35); }
.qr svg { width: 100%; height: 100%; display: block; }
.pair-status { font-size: 20px; font-weight: 600; display: flex; align-items: center; gap: 12px; }
.pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 0 rgba(46,230,168,.7); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 14px rgba(46,230,168,0); } 100% { box-shadow: 0 0 0 0 rgba(46,230,168,0); } }
@media (max-width: 900px) {
  .pair-wrap { grid-template-columns: 1fr; padding: 30px 22px; gap: 30px; }
  .pair-left h1 { font-size: 34px; }
  .steps { font-size: 17px; }
  .qr { width: min(320px, 80vw); }
  .short-code { font-size: 44px; }
}

/* ── Drive screen ────────────────────────────── */
body.drive { overflow: hidden; height: 100vh; height: 100dvh; }
body.drive #map { position: fixed; inset: 0; background: #0e0e14; }
.maplibregl-ctrl-attrib { background: rgba(0,0,0,.5) !important; color: #888; font-size: 10px; }
.maplibregl-ctrl-attrib a { color: #aaa !important; }
.maplibregl-ctrl-attrib-button { filter: invert(1); }
body.drive .maplibregl-ctrl-bottom-right { right: auto; left: 0; }
.car-marker { position: relative; will-change: transform; }
.car-marker .car-rot { display: flex; justify-content: center; will-change: transform; }
.car-marker .car-svg { filter: drop-shadow(0 4px 6px rgba(0,0,0,.5)); }
.car-label { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); white-space: nowrap; background: rgba(11,11,16,.85); border: 1px solid var(--line);
  color: #fff; font: 700 12px 'Inter', sans-serif; padding: 3px 8px; border-radius: 8px; margin-top: 2px; }

.drive-top { position: fixed; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 16px; padding: 14px 18px; z-index: 500;
  background: linear-gradient(rgba(11,11,16,.85), transparent); pointer-events: none; }
.drive-top .brand { font-weight: 800; letter-spacing: .3em; color: var(--pink); font-size: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; background: rgba(24,24,34,.9); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 700; }
.chip.good { color: var(--mint); }
.chip.warn { color: var(--amber); }
.chip.bad { color: var(--red); }
.chip.sim { color: var(--blue); }
.chip.rec i { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.chip.rec.on i { background: var(--red); animation: blink 1.4s infinite; }
.chip.rec.warn i { background: var(--amber); }
@keyframes blink { 50% { opacity: .25; } }

.recenter { position: fixed; z-index: 500; left: 20px; bottom: 24px; width: 64px; height: 64px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(24,24,34,.95); color: #fff; cursor: pointer; display: grid; place-items: center; }

.hud { position: fixed; z-index: 600; top: 0; right: 0; bottom: 0; width: 380px; padding: 70px 22px 22px; display: flex; flex-direction: column; gap: 18px;
  background: linear-gradient(90deg, rgba(11,11,16,.55), rgba(11,11,16,.94) 18%); border-left: 1px solid rgba(255,255,255,.04); backdrop-filter: blur(6px); }
.speed-block { text-align: center; }
.speed { font: 700 150px/0.9 var(--num); letter-spacing: -.02em; text-shadow: 0 0 40px rgba(255,46,136,.25); }
.speed-unit { font: 600 20px var(--num); color: var(--muted); letter-spacing: .2em; text-transform: uppercase; }
.hud-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hud-grid > div { background: rgba(32,32,44,.75); border: 1px solid var(--line); border-radius: 16px; padding: 10px 14px; transition: background .3s; }
.hud-grid b { display: block; font: 700 34px/1.1 var(--num); }
.hud-grid span { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.hud-grid > div.flash { animation: flashred 1.2s; }
@keyframes flashred { 0%, 40% { background: rgba(255,77,94,.45); } }
.nearby { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.nearby-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.nearby-head b { background: var(--pink); color: #fff; border-radius: 999px; padding: 1px 10px; font-size: 14px; }
.nearby-list { overflow: auto; display: grid; gap: 8px; align-content: start; }
.near-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; background: rgba(32,32,44,.75); border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; }
.near-row b { display: block; font-size: 16px; }
.near-row span { color: var(--muted); font-size: 13px; }
.near-row em { font-style: normal; text-align: right; font: 600 15px/1.2 var(--num); color: var(--pink2); }
.near-car { display: flex; justify-content: center; }
.met { font-weight: 700; color: var(--mint); }
.hud-actions { display: grid; gap: 8px; }
.btn-end { width: 100%; padding: 18px; font-size: 19px; background: rgba(255,77,94,.15); color: #ff8a96; border: 1px solid rgba(255,77,94,.35); border-radius: 16px; }
.btn-end.armed { background: var(--red); color: #fff; }
.hud.viewing .btn-end { display: none; }

.toasts { position: fixed; z-index: 800; top: 70px; left: 50%; transform: translateX(calc(-50% - 190px)); width: min(620px, calc(100vw - 440px)); display: grid; gap: 12px; pointer-events: none; }
.toast { display: flex; gap: 18px; align-items: center; background: rgba(18,18,26,.96); border: 2px solid var(--pink); border-radius: 22px; padding: 14px 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 40px rgba(255,46,136,.3); animation: toastin .45s cubic-bezier(.2,1.3,.4,1); }
.toast.out { opacity: 0; transform: translateY(-14px); transition: .5s; }
.toast.kind-oncoming, .toast.kind-crossed { border-color: var(--blue); box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 40px rgba(77,163,255,.3); }
.toast.kind-passed_by { border-color: var(--amber); }
.toast.kind-convoy { border-color: var(--mint); }
.toast-car svg { transform: rotate(90deg); margin: -12px 10px; }
.toast-kind { font-size: 15px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.toast-name { font-size: 30px; font-weight: 800; line-height: 1.1; }
.toast-sub { color: #cfcfe0; font-size: 16px; }
.toast-greet { color: var(--pink2); font-size: 17px; font-style: italic; margin-top: 2px; }
.plate { display: inline-block; background: #ffd400; color: #111; font: 700 13px var(--num); letter-spacing: .08em; padding: 0 7px; border-radius: 4px; margin-left: 4px; }
@keyframes toastin { from { opacity: 0; transform: translateY(-30px) scale(.95); } }

.viewer-banner { position: fixed; z-index: 700; left: 12px; right: 12px; top: 64px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: rgba(24,24,34,.95); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; font-size: 14px; }

.overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(5,5,8,.82); backdrop-filter: blur(8px); display: grid; place-items: center; padding: 20px; overflow: auto; }
.sheet { background: var(--card); border: 1px solid var(--line); border-radius: 26px; padding: 30px; width: min(640px, 100%); text-align: center; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.summary { text-align: left; }
.sum-head { display: flex; justify-content: space-between; gap: 20px; align-items: center; }
.eyebrow { color: var(--pink2); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .1em; }
.route-label { color: var(--muted); margin: 0; }
.score-ring { flex: 0 0 auto; width: 110px; height: 110px; border-radius: 50%; display: grid; place-content: center; text-align: center; border: 6px solid var(--mint); }
.score-ring.ok { border-color: var(--amber); }
.score-ring.low { border-color: var(--red); }
.score-ring b { font: 700 42px/1 var(--num); }
.score-ring span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.sum-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 22px 0 14px; }
.sum-grid > div { background: var(--card2); border-radius: 14px; padding: 12px; text-align: center; }
.sum-grid b { display: block; font: 700 30px/1.1 var(--num); }
.sum-grid span { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.xp-line { font: 700 22px var(--num); color: var(--mint); margin-bottom: 6px; }
.badges-new { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 14px 0; }
.badge-new { background: linear-gradient(135deg, rgba(255,46,136,.18), rgba(255,181,71,.12)); border: 1px solid rgba(255,46,136,.4); border-radius: 14px; padding: 12px; text-align: center; }
.badge-new span { font-size: 30px; display: block; }
.badge-new small { display: block; color: var(--muted); font-size: 12px; }
.enc-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.enc-list li { display: flex; align-items: center; gap: 12px; background: var(--card2); border-radius: 12px; padding: 6px 12px; }
.mini-car { display: inline-flex; width: 26px; justify-content: center; }
.sum-actions { display: grid; gap: 10px; margin-top: 20px; }

/* Phone as the main drive screen */
body.drive.is-phone .hud { top: auto; left: 0; width: auto; padding: 14px 14px calc(14px + var(--safe-b)); gap: 10px; border-left: 0; border-top: 1px solid var(--line);
  background: rgba(11,11,16,.94); border-radius: 22px 22px 0 0; display: grid; grid-template-columns: auto 1fr; align-items: center; }
body.drive.is-phone .speed-block { grid-row: span 2; padding-right: 8px; }
body.drive.is-phone .speed { font-size: 84px; }
body.drive.is-phone .speed-unit { font-size: 14px; }
body.drive.is-phone .hud-grid { gap: 6px; }
body.drive.is-phone .hud-grid > div { padding: 6px 10px; border-radius: 12px; }
body.drive.is-phone .hud-grid b { font-size: 24px; }
body.drive.is-phone .hud-grid span { font-size: 10px; }
body.drive.is-phone .nearby { grid-column: 1 / -1; flex: none; }
body.drive.is-phone .nearby-list { max-height: 112px; }
body.drive.is-phone .hud-actions { grid-column: 1 / -1; grid-template-columns: 1fr auto; }
body.drive.is-phone .btn-end { padding: 14px; font-size: 16px; }
body.drive.is-phone .toasts { left: 12px; right: 12px; width: auto; transform: none; top: 60px; }
body.drive.is-phone .toast { padding: 10px 14px; gap: 10px; }
body.drive.is-phone .toast-name { font-size: 22px; }
body.drive.is-phone .toast-car svg { width: 30px; height: 60px; margin: -6px 6px; }
body.drive.is-phone .recenter { bottom: auto; top: 64px; left: auto; right: 14px; width: 52px; height: 52px; }
body.drive.is-phone .drive-top { padding: 10px 12px; }
body.drive.is-phone .sum-grid { grid-template-columns: repeat(2, 1fr); }
body.drive.is-phone .sheet { padding: 22px; }
@media (max-width: 1000px) {
  body.drive.is-car .hud { width: 320px; }
  body.drive.is-car .speed { font-size: 110px; }
  body.drive.is-car .toasts { transform: translateX(calc(-50% - 160px)); width: calc(100vw - 370px); }
}

/* ── Companion app ───────────────────────────── */
body.app { padding-bottom: calc(86px + var(--safe-b)); }
.page { max-width: 640px; margin: 0 auto; padding: 22px 16px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head h1 { margin: 0; font-size: 26px; }
.avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; background: var(--card2); display: grid; place-items: center; font-weight: 800; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.card-link { display: block; color: inherit; text-decoration: none !important; }
.card-link:hover { border-color: #3a3a4d; }
.profile-card { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; background: linear-gradient(135deg, #24122a, var(--card) 60%); }
.profile-card .car-hold svg { transform: rotate(90deg); margin: -20px 6px; }
.level { font: 700 15px var(--num); color: var(--pink2); letter-spacing: .06em; text-transform: uppercase; }
.xpbar { height: 8px; background: var(--bg2); border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--pink), var(--amber)); border-radius: 99px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.stat b { display: block; font: 700 32px/1.05 var(--num); }
.stat span { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.stat.hl b { color: var(--mint); }
.cta-drive { display: flex; align-items: center; justify-content: center; gap: 12px; }
.live-card { border-color: rgba(255,77,94,.45); background: linear-gradient(135deg, rgba(255,77,94,.15), var(--card)); }
.live-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--red); margin-right: 6px; animation: blink 1.4s infinite; }
.drive-row { display: grid; grid-template-columns: 92px 1fr auto; gap: 14px; align-items: center; padding: 12px; }
.drive-row .thumb { width: 92px; height: 72px; background: var(--bg2); border-radius: 12px; overflow: hidden; }
.drive-row h4 { margin: 0 0 2px; font-size: 15px; }
.drive-row p { margin: 0; color: var(--muted); font-size: 13px; }
.drive-row .score { font: 700 26px var(--num); text-align: right; }
.drive-row .score small { display: block; font: 600 10px 'Inter', sans-serif; color: var(--muted); text-transform: uppercase; }
.score.great { color: var(--mint); } .score.ok { color: var(--amber); } .score.low { color: var(--red); }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.badge { text-align: center; background: var(--card2); border-radius: 14px; padding: 12px 6px; font-size: 12px; font-weight: 600; }
.badge span { display: block; font-size: 28px; }
.badge.locked { opacity: .3; filter: grayscale(1); }
.pill { display: inline-block; background: var(--card2); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; color: var(--muted); }
.empty { text-align: center; padding: 34px 18px; color: var(--muted); }

.detail-map { position: relative; z-index: 0; height: 46vh; min-height: 300px; border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; border: 1px solid var(--line); }
.chart { width: 100%; height: 150px; display: block; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 18px; height: 4px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }

.garage-preview { display: grid; place-items: center; height: 230px; background: radial-gradient(circle at 50% 60%, rgba(255,46,136,.22), transparent 65%), var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
.garage-preview svg { transform: rotate(90deg); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatches label { display: block; }
.swatches input { display: none; }
.swatches span { display: block; width: 38px; height: 38px; border-radius: 50%; border: 3px solid transparent; box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); cursor: pointer; }
.swatches input:checked + span { border-color: #fff; transform: scale(1.08); }
.bodies { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.bodies label { display: block; }
.bodies input { display: none; }
.bodies span { display: grid; justify-items: center; gap: 4px; background: var(--bg2); border: 2px solid var(--line); border-radius: 12px; padding: 8px 4px; font-size: 11px; font-weight: 700; cursor: pointer; }
.bodies input:checked + span { border-color: var(--pink); }
.rank-row { display: grid; grid-template-columns: 34px 40px 1fr auto; gap: 12px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.rank-row:last-child { border-bottom: 0; }
.rank-row .pos { font: 700 22px var(--num); color: var(--muted); text-align: center; }
.rank-row.me { background: rgba(255,46,136,.08); border-radius: 12px; }
.rank-row .val { font: 700 22px var(--num); }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--text); font-weight: 700; font-size: 14px; white-space: nowrap; text-decoration: none; }
.tabs a.on { background: var(--pink); border-color: var(--pink); }
.device-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }

.tabbar { position: fixed; z-index: 900; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); background: rgba(14,14,20,.96);
  border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-b)); backdrop-filter: blur(10px); }
.tabbar a { display: grid; justify-items: center; gap: 2px; color: var(--muted); font-size: 11px; font-weight: 600; text-decoration: none; padding: 4px 0; }
.tabbar svg { width: 24px; height: 24px; }
.tabbar a.on { color: var(--pink); }
.tabbar a.go svg { width: 44px; height: 44px; padding: 9px; margin-top: -18px; border-radius: 50%; background: linear-gradient(135deg, var(--pink), #ff5a5f); color: #fff; box-shadow: 0 6px 20px rgba(255,46,136,.45); }
.tabbar a.go { color: var(--text); }
@media (min-width: 700px) {
  .stats { grid-template-columns: repeat(4, 1fr); }
}

/* ── Road prizes ─────────────────────────────── */
.prize { pointer-events: none; width: max-content; text-align: center; }
.prize-emoji { font-size: 38px; line-height: 1; display: block; filter: drop-shadow(0 3px 3px rgba(0,0,0,.5)); }
.prize-pts { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); margin-top: 2px; white-space: nowrap; background: rgba(16,18,28,.9); color: #fff;
  font: 700 12px/1 var(--num); padding: 3px 7px; border-radius: 999px; border: 1px solid rgba(255,255,255,.15); }
.prize::before { content: ''; position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%); }
.prize.r-uncommon::before { background: radial-gradient(circle, rgba(46,230,168,.45), transparent 70%); }
.prize.r-rare::before { background: radial-gradient(circle, rgba(77,163,255,.6), transparent 70%); }
.prize.r-epic::before { background: radial-gradient(circle, rgba(170,90,255,.75), transparent 70%); width: 70px; height: 70px; margin: -35px 0 0 -35px; }
.prize.r-legendary::before { background: radial-gradient(circle, rgba(255,200,40,.9), transparent 70%); width: 84px; height: 84px; margin: -42px 0 0 -42px; }
.prize.r-legendary .prize-emoji { font-size: 48px; }
.prize.r-rare .prize-pts { background: #1f4fd1; }
.prize.r-epic .prize-pts { background: #7b3cff; }
.prize.r-legendary .prize-pts { background: #ffb547; color: #1a1205; }
.prize.popping .prize-emoji { animation: pop .7s ease-out forwards; }
.prize.popping .prize-pts, .prize.popping::before { opacity: 0; transition: opacity .2s; }
@keyframes pop { 30% { transform: translateY(-30px) scale(1.7); } 100% { transform: translateY(-90px) scale(.4); opacity: 0; } }

.prize-count { display: inline-block; margin-top: 8px; background: rgba(255,181,71,.14); border: 1px solid rgba(255,181,71,.4); color: var(--amber);
  font: 700 18px var(--num); padding: 4px 14px; border-radius: 999px; }
.prize-count b { color: #fff; font-size: 22px; }
.prize-count.bump { animation: bump .5s; }
@keyframes bump { 40% { transform: scale(1.25); } }

.pickups { position: fixed; z-index: 850; left: 24px; bottom: 110px; display: grid; gap: 10px; pointer-events: none; }
.pickup { display: flex; align-items: center; gap: 12px; background: rgba(18,18,26,.95); border: 2px solid var(--amber); border-radius: 18px; padding: 8px 18px 8px 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,.5); animation: pickin .5s cubic-bezier(.2,1.5,.4,1); }
.pickup.r-rare { border-color: var(--blue); }
.pickup.r-epic { border-color: #a35bff; box-shadow: 0 0 40px rgba(163,91,255,.5); }
.pickup.r-legendary { border-color: #ffd23f; box-shadow: 0 0 60px rgba(255,210,63,.6); }
.pickup.r-epic .pk-emoji, .pickup.r-legendary .pk-emoji { font-size: 64px; }
.pickup.out { opacity: 0; transform: translateX(-30px); transition: .5s; }
.pk-emoji { font-size: 44px; line-height: 1; }
.pk-pts { font: 700 30px/1 var(--num); color: var(--amber); }
.pk-name { font-weight: 700; font-size: 14px; color: #ddd; }
@keyframes pickin { from { opacity: 0; transform: scale(.5) translateY(30px); } }
body.drive.is-phone .pickups { left: 12px; bottom: auto; top: 120px; }
body.drive.is-phone .prize-count { font-size: 14px; margin-top: 4px; padding: 2px 10px; }
body.drive.is-phone .prize-count b { font-size: 16px; }

.prize-haul { display: flex; flex-wrap: wrap; gap: 8px; }
.haul { position: relative; display: grid; justify-items: center; min-width: 58px; background: var(--card2); border-radius: 14px; padding: 6px 8px; font-size: 28px; line-height: 1.1; border: 1px solid var(--line); }
.haul b { font: 700 13px var(--num); color: var(--amber); }
.haul i { position: absolute; top: 2px; right: 5px; font: 700 11px var(--num); font-style: normal; color: #fff; }
.haul.r-rare { border-color: rgba(77,163,255,.6); }
.haul.r-epic { border-color: rgba(163,91,255,.7); }
.haul.r-legendary { border-color: #ffd23f; box-shadow: 0 0 16px rgba(255,210,63,.35); }
body.drive.is-car .prize-emoji { font-size: 52px; }
body.drive.is-car .prize.r-legendary .prize-emoji { font-size: 64px; }
body.drive.is-car .prize-pts { font-size: 15px; }

/* ── Quick comms ─────────────────────────────── */
.tappable { cursor: pointer; }
.car-marker.tappable { pointer-events: auto; }
.near-row.tappable:active { background: rgba(255,46,136,.2); }
.comms { position: fixed; z-index: 950; left: 50%; bottom: 24px; transform: translateX(calc(-50% - 190px)); width: min(620px, calc(100vw - 440px));
  background: rgba(18,18,26,.97); border: 2px solid var(--pink); border-radius: 24px; padding: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.6); animation: toastin .3s; }
.comms-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.comms-car svg { transform: rotate(90deg); margin: -16px 8px; }
.comms-to { color: var(--muted); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.comms-name { font-size: 24px; font-weight: 800; }
.comms-close { margin-left: auto; width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--line); background: var(--card2); color: #fff; font-size: 20px; cursor: pointer; }
.comms-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.comm-btn { display: grid; justify-items: center; gap: 4px; padding: 12px 6px; border-radius: 16px; border: 1px solid var(--line); background: var(--card2);
  color: #fff; font: 700 14px 'Inter', sans-serif; cursor: pointer; }
.comm-btn span { font-size: 40px; line-height: 1; }
.comm-btn:active { transform: scale(.94); background: var(--pink); }
.toast.kind-comm { border-color: var(--mint); }
.comm-emoji { font-size: 60px; line-height: 1; }
.pickup.sent { border-color: var(--mint); padding: 10px 16px; }
.pickup.sent .pk-name { font-size: 16px; color: #fff; }
body.drive.is-phone .comms { left: 8px; right: 8px; width: auto; transform: none; bottom: 8px; padding: 12px; }
body.drive.is-phone .comm-btn span { font-size: 30px; }
body.drive.is-phone .comm-btn { font-size: 12px; padding: 8px 4px; }
body.drive.is-phone .comm-emoji { font-size: 40px; }
@media (max-width: 1000px) { body.drive.is-car .comms { transform: translateX(calc(-50% - 160px)); width: calc(100vw - 370px); } }

/* ── Messages ────────────────────────────────── */
.icon-btn { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--card2); color: #fff; text-decoration: none !important; font-size: 20px; }
.icon-btn .dot { position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--pink); color: #fff; font: 700 12px/20px 'Inter', sans-serif; text-align: center; }
.head-actions { display: flex; gap: 10px; align-items: center; }
.convo { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none !important; }
.convo:last-child { border-bottom: 0; }
.convo p { margin: 0; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo .unread { background: var(--pink); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 700; }
.convo.has-unread p { color: #fff; font-weight: 600; }
.thread { display: flex; flex-direction: column; gap: 8px; padding-bottom: 90px; }
.bubble { max-width: 80%; padding: 10px 14px; border-radius: 18px; background: var(--card2); align-self: flex-start; word-wrap: break-word; }
.bubble.mine { align-self: flex-end; background: linear-gradient(135deg, var(--pink), #ff5a5f); }
.bubble.quick { font-size: 22px; background: transparent; border: 1px solid var(--line); }
.bubble small { display: block; font-size: 11px; opacity: .7; margin-top: 2px; }
.day-sep { text-align: center; color: var(--muted); font-size: 12px; margin: 8px 0; }
.composer { position: fixed; left: 0; right: 0; bottom: calc(66px + var(--safe-b)); z-index: 800; background: rgba(11,11,16,.97); border-top: 1px solid var(--line); padding: 10px 12px; }
.composer form { max-width: 640px; margin: 0 auto; display: flex; gap: 8px; }
.composer input { flex: 1; }
.quick-row { max-width: 640px; margin: 0 auto 8px; display: flex; gap: 6px; overflow-x: auto; }
.quick-row button { flex: 0 0 auto; background: var(--card2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; font-size: 20px; cursor: pointer; }
.btn-msg { padding: 6px 12px; font-size: 13px; border-radius: 10px; margin-left: auto; }
