:root {
  --bg: #16181c; --panel: #20242a; --panel2: #2a2f37; --text: #eef0f3; --muted: #9aa3ad;
  --line: #f2c14e; --ok: #5ccf8a; --warn: #e8833a;
  --t1: #9aa3ad; --t2: #5ccf8a; --t3: #4ea8ff; --t4: #c27bff; --t5: #ffb02e;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { padding: env(safe-area-inset-top) 0 calc(64px + env(safe-area-inset-bottom)); min-height: 100vh; }
button { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: var(--bg); border-bottom: 1px solid #0006; }
.brand { font-weight: 800; letter-spacing: .5px; display: flex; align-items: center; gap: 10px; font-size: 18px; }
.logo { width: 26px; height: 18px; border-radius: 4px; background:
  linear-gradient(90deg, transparent 45%, var(--line) 45% 55%, transparent 55%), #3a3f47; }
.pts { color: var(--line); }

main { padding: 12px 16px; max-width: 720px; margin: 0 auto; }
.tab { display: none; } .tab.active { display: block; }
h2 { font-size: 16px; margin: 18px 0 8px; } h3 { margin: 0 0 6px; font-size: 15px; }
.card { background: var(--panel); border-radius: 14px; padding: 14px; margin: 10px 0; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { background: var(--panel); border-radius: 12px; padding: 10px 8px; text-align: center; }
.stat .k { display: block; font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: .6px; }
.stat b { font-size: 20px; font-variant-numeric: tabular-nums; }
@media (max-width: 380px) { .stats { grid-template-columns: repeat(2, 1fr); } }

.tracking { display: flex; gap: 12px; align-items: center; }
.tracking .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); flex: none; }
.tracking.on .dot { background: var(--ok); box-shadow: 0 0 0 4px #5ccf8a33; }
.tracking .grow { flex: 1; }
.tracking button, .row button, .detail button { background: var(--line); color: #1a1a1a; border: 0; border-radius: 10px;
  padding: 9px 14px; font-weight: 700; cursor: pointer; }
button.ghost { background: transparent; color: var(--text); border: 1px solid #fff3; }
button:disabled { opacity: .45; cursor: default; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }

.dwell .bar, .stop .bar { height: 8px; background: var(--panel2); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.dwell .bar i, .stop .bar i { display: block; height: 100%; background: var(--line); }

.feed { list-style: none; padding: 0; margin: 0; }
.feed li { display: flex; gap: 12px; align-items: center; background: var(--panel); border-radius: 12px; padding: 8px 12px; margin: 6px 0; }
.feed li svg { flex: none; }
.feed .when { font-size: 12px; color: var(--muted); }
.feed .empty { color: var(--muted); justify-content: center; padding: 18px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.buddy { background: var(--panel); border-radius: 14px; padding: 8px 6px 10px; text-align: center; border: 2px solid transparent;
  cursor: pointer; }
.buddy .nm { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.buddy .lv { font-size: 11px; color: var(--muted); }
.buddy.locked .nm { color: var(--muted); }
.tier1 { border-color: #9aa3ad44; } .tier2 { border-color: var(--t2); } .tier3 { border-color: var(--t3); }
.tier4 { border-color: var(--t4); } .tier5 { border-color: var(--t5); box-shadow: 0 0 12px #ffb02e55; }
.tiertxt1 { color: var(--t1); } .tiertxt2 { color: var(--t2); } .tiertxt3 { color: var(--t3); }
.tiertxt4 { color: var(--t4); } .tiertxt5 { color: var(--t5); }

.stops { list-style: none; padding: 0; margin: 0; }
.stop { background: var(--panel); border-radius: 12px; padding: 10px 12px; margin: 8px 0; }
.stop .l1 { display: flex; justify-content: space-between; gap: 8px; }
.stop .nm { font-weight: 700; }
.stop .stars { color: var(--line); white-space: nowrap; letter-spacing: 1px; }
.stop .l2 { font-size: 13px; color: var(--muted); }
.stop.cool .l2::after { content: " - checked in recently"; color: var(--warn); }

.prose p { margin: 8px 0; }

.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(4, 1fr);
  background: #101215; border-top: 1px solid #0008; padding-bottom: env(safe-area-inset-bottom); z-index: 6; }
.tabs button { background: none; border: 0; padding: 14px 0 16px; color: var(--muted); font-weight: 600; cursor: pointer; }
.tabs button.active { color: var(--line); box-shadow: inset 0 3px 0 var(--line); }

.lock { position: fixed; inset: 0; background: #0d0e10; z-index: 20; display: grid; place-items: center; text-align: center; padding: 24px; }
.lock-inner { max-width: 340px; }
.lock h2 { font-size: 26px; margin: 18px 0 8px; }
.road { width: 120px; height: 160px; margin: 0 auto; border-radius: 10px; background:
  repeating-linear-gradient(180deg, var(--line) 0 22px, transparent 22px 44px) center / 8px 100% no-repeat, #2b2f36;
  animation: roll 0.6s linear infinite; }
@keyframes roll { from { background-position: center 0, 0 0; } to { background-position: center 44px, 0 0; } }
@media (prefers-reduced-motion: reduce) { .road { animation: none; } }

.detail { background: var(--panel); color: var(--text); border: 0; border-radius: 16px; max-width: 360px; width: calc(100% - 32px); }
.detail::backdrop { background: #000a; }
.detail .hero { text-align: center; }
.detail h2 { margin: 6px 0 2px; }
.detail form { text-align: right; margin-top: 10px; }

.toast { position: fixed; left: 16px; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); background: var(--panel2);
  border-left: 4px solid var(--line); padding: 12px 14px; border-radius: 10px; z-index: 15; display: flex; gap: 10px; align-items: center; }
.err { position: fixed; left: 0; right: 0; bottom: 0; background: #b00020; color: #fff; padding: 8px 12px; font-size: 12px; z-index: 30; }
