:root {
  --navy: #0B1F4B; --saff: #F28C28; --green: #12804A; --cream: #F6F3EC; --ink: #13151A; --mut: #5B5F66;
  --line: #E4DFD4; --card: #FFFFFF; --red: #B3261E;
  --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(--cream); color: var(--ink); font-family: 'Mukta', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 16px; line-height: 1.4; }
body { overscroll-behavior-y: none; }
.disp { font-family: 'Anton', 'Arial Narrow', Impact, sans-serif; font-weight: 400; letter-spacing: .3px; line-height: 1; }
button { font-family: inherit; cursor: pointer; }
a { color: var(--navy); }
.hidden { display: none !important; }
.sr { position: absolute; left: -9999px; }

#app { min-height: 100%; display: flex; flex-direction: column; max-width: 520px; margin: 0 auto; }
.view { display: flex; flex-direction: column; flex: 1; min-height: 100vh; padding-bottom: calc(84px + var(--safe-bottom)); }
.view.full { padding-bottom: 0; }

/* header */
.top { padding: calc(16px + var(--safe-top)) 20px 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand .mark { width: 36px; height: 36px; border-radius: 10px; background: var(--navy); color: #fff; display: grid; place-items: center; font-size: 13px; }
.brand .mark span { color: var(--saff); }
.brand .name { font-weight: 800; font-size: 17px; letter-spacing: -.2px; }
.brand .sub { font-size: 12px; color: var(--mut); margin-top: -2px; }
.who { text-align: right; font-size: 13px; color: var(--mut); line-height: 1.2; }
.who b { display: block; color: var(--ink); font-size: 14px; }

.body { padding: 8px 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.card.navy { background: var(--navy); color: #fff; border-color: var(--navy); }
.card.navy .mut { color: #C9D3EC; }
.card.green { background: var(--green); color: #fff; border-color: var(--green); }
.card.green .mut { color: #D5EFE0; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: var(--saff); }
.mut { color: var(--mut); font-size: 13px; }
.h { font-size: 16px; font-weight: 800; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat .n { font-size: 34px; }
.stat .l { font-size: 12px; color: var(--mut); }
.card.navy .stat .l { color: #C9D3EC; }

.moves { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.move { min-height: 96px; border: none; border-radius: 18px; color: #fff; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; padding: 14px; font-size: 16px; font-weight: 800; }
.move.walk { background: var(--navy); } .move.run { background: var(--saff); color: var(--ink); } .move.cycle { background: var(--green); }
.move svg { width: 26px; height: 26px; }

.list { display: flex; flex-direction: column; gap: 10px; }
.item { text-decoration: none; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; color: inherit; font: inherit; }
.item .ic { width: 42px; height: 42px; border-radius: 21px; display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.item .ic.walk { background: var(--navy); } .item .ic.run { background: var(--saff); color: var(--ink); } .item .ic.cycle { background: var(--green); }
.item .t { font-weight: 800; font-size: 15px; } .item .s { font-size: 13px; color: var(--mut); }
.item .r { margin-left: auto; text-align: right; } .item .r .n { font-size: 22px; } .item .r .l { font-size: 11px; color: var(--mut); }

.btn { text-decoration: none; min-height: 52px; border: none; border-radius: 14px; font-size: 16px; font-weight: 800; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.primary { background: var(--navy); color: #fff; }
.btn.saff { background: var(--saff); color: var(--ink); }
.btn.green { background: var(--green); color: #fff; }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); color: var(--ink); }
.btn.danger { background: var(--red); color: #fff; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }

label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--mut); }
input, select { font: inherit; font-size: 16px; min-height: 50px; border: 1.5px solid var(--line); border-radius: 12px; padding: 0 14px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus { outline: 2px solid var(--navy); border-color: var(--navy); }
.err { color: var(--red); font-size: 14px; font-weight: 700; min-height: 1.2em; }
.note { font-size: 12px; color: var(--mut); line-height: 1.4; }

/* bottom nav */
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 520px; background: #fff; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(3, 1fr); padding: 6px 6px calc(10px + var(--safe-bottom)); }
nav.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0; text-decoration: none; color: var(--mut); font-size: 12px; font-weight: 700; border-radius: 12px; }
nav.tabs a.on { color: var(--navy); background: #EEF1F8; }
nav.tabs svg { width: 22px; height: 22px; }

/* sign in */
.hero { background: var(--navy); color: #fff; padding: calc(28px + var(--safe-top)) 24px 28px; border-radius: 0 0 28px 28px; display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; }
.hero .blob { position: absolute; right: -110px; top: -120px; width: 260px; height: 260px; border-radius: 50%; background: var(--saff); opacity: .9; }
.hero .blob2 { position: absolute; right: 60px; top: -170px; width: 240px; height: 240px; border-radius: 50%; background: var(--green); opacity: .85; }
.hero .t { font-size: 44px; position: relative; }
.hero .t span { color: var(--saff); }
.hero p { position: relative; margin: 0; color: #C9D3EC; font-size: 15px; }

/* tracker */
.track { background: var(--navy); color: #fff; min-height: 100vh; display: flex; flex-direction: column; }
.track .head { padding: calc(16px + var(--safe-top)) 20px 6px; display: flex; justify-content: space-between; align-items: center; }
.track .type { font-size: 13px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: var(--saff); }
.track .gps { font-size: 12px; color: #C9D3EC; display: flex; align-items: center; gap: 6px; }
.track .dot { width: 8px; height: 8px; border-radius: 4px; background: #9AA0AA; }
.track .dot.good { background: #38C172; } .track .dot.ok { background: var(--saff); } .track .dot.bad { background: #E5484D; }
.track .big { padding: 10px 20px 0; }
.track .big .n { font-size: 84px; line-height: .95; }
.track .big .l { color: #C9D3EC; font-size: 14px; margin-top: 2px; }
.track .grid { display: grid; grid-template-columns: repeat(3, 1fr); padding: 16px 20px; gap: 10px; }
.track .grid .n { font-size: 30px; } .track .grid .l { color: #C9D3EC; font-size: 12px; }
#map { flex: 1; min-height: 220px; margin: 0 14px; border-radius: 18px; background: #16305F; overflow: hidden; }
.track .ctl { padding: 14px 20px calc(18px + var(--safe-bottom)); display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.track .ctl .btn { min-height: 60px; font-size: 18px; }
.track .ctl .btn.ghost { color: #fff; border-color: rgba(255,255,255,.4); }
.track .hint { padding: 0 20px 10px; font-size: 12px; color: #C9D3EC; text-align: center; }

/* summary */
.summary .big { font-size: 64px; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: #EEF1F8; color: var(--navy); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 800; }
.pill.green { background: #E3F2E9; color: var(--green); }

/* totals */
.table { display: flex; flex-direction: column; }
.table .tr { display: grid; grid-template-columns: 32px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.table .tr:last-child { border-bottom: none; }
.table .tr.me { background: #FFF4E8; margin: 0 -16px; padding: 10px 16px; border-radius: 10px; }
.table .rank { color: var(--mut); font-weight: 800; }
.table .km { font-size: 20px; }
.table .sub { font-size: 12px; color: var(--mut); }
.counter { font-size: 56px; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--green); }
.live::before { content: ''; width: 8px; height: 8px; border-radius: 4px; background: var(--green); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

.toast { position: fixed; left: 50%; bottom: calc(100px + var(--safe-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 700; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 50; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; }
.leaflet-container { font: inherit; }
