:root {
  --bg: #0b1220; --bg2: #101a2e; --card: #15213a; --card2: #1b2a49; --line: #26375c;
  --text: #eaf1ff; --muted: #8fa3c7; --accent: #35d0ff; --accent-ink: #04202b;
  --ok: #3ddc97; --warn: #ffb84d; --bad: #ff6b6b; --danger: #ff5c5c;
  --r: 18px; --tap: 56px;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: 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(--text); font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
body { background: radial-gradient(120% 60% at 50% -10%, #173462 0%, var(--bg) 60%) no-repeat, var(--bg); }
button, input { font: inherit; color: inherit; }
.app { height: 100dvh; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; }
.hidden { display: none !important; }

/* header + pills */
.top { padding: calc(var(--safe-t) + 10px) 16px 8px; display: flex; align-items: center; gap: 10px; }
.top h1 { font-size: 19px; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--card); font-size: 13px; color: var(--muted); border: 1px solid var(--line); }
.pill i { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); display: inline-block; }
.pill.ok { color: var(--ok); } .pill.ok i { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.pill.warn { color: var(--warn); } .pill.warn i { background: var(--warn); }
.pill.bad { color: var(--bad); } .pill.bad i { background: var(--bad); }
.banner { margin: 0 16px 8px; padding: 10px 14px; border-radius: 12px; background: #3a2a10; color: var(--warn); font-size: 14px; border: 1px solid #5a4116; }
.banner.bad { background: #3a1616; color: var(--bad); border-color: #5a2323; }
.banner.mode { font-size: 12px; padding: 6px 12px; letter-spacing: .02em; }
.banner.mode.mock { background: transparent; color: var(--muted); border-color: var(--line); }
.banner.mode.real { background: #3a1616; color: #ff9d8a; border-color: #5a2323; font-weight: 600; }
.pending-bind { border-color: #5a4116; }
.pending-bind h2 { color: var(--warn); }

/* content */
main { flex: 1; overflow-y: auto; padding: 4px 16px 24px; -webkit-overflow-scrolling: touch; }
.card { background: linear-gradient(180deg, var(--card), var(--bg2)); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 14px; }
.card h2 { margin: 0 0 10px; font-size: 14px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--card2); border-radius: 14px; padding: 12px 14px; min-height: 74px; }
.tile .k { font-size: 12px; color: var(--muted); }
.tile .v { font-size: 22px; font-weight: 650; margin-top: 4px; }
.tile.wide { grid-column: 1 / -1; }
.stale .v { opacity: .55; }

/* controls */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: var(--tap); border-radius: 16px; border: 1px solid var(--line); background: var(--card2); font-weight: 650; font-size: 17px; padding: 0 16px; cursor: pointer; }
.btn:active { transform: scale(.985); filter: brightness(1.15); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.danger { background: #3b1a22; color: #ffb3b3; border-color: #6a2a37; }
.btn.go { background: #12382b; color: #8af0c4; border-color: #1f6b4f; }
.btn.ghost { background: transparent; }
.btn[disabled] { opacity: .38; pointer-events: none; }
.btn.slim { min-height: 44px; font-size: 15px; }
.row { display: flex; gap: 10px; } .row > * { flex: 1; }
.stack > * + * { margin-top: 10px; }
.stepper { display: flex; align-items: center; background: var(--card2); border-radius: 16px; overflow: hidden; border: 1px solid var(--line); }
.stepper button { width: 46px; height: 60px; background: transparent; border: 0; font-size: 28px; color: var(--accent); cursor: pointer; }
.stepper button:active { background: var(--card); }
.stepper div { flex: 1; text-align: center; } .stepper b { font-size: 22px; white-space: nowrap; } .stepper span { display: block; font-size: 12px; color: var(--muted); }

/* inputs */
label.f { display: block; margin-bottom: 12px; }
label.f span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input.in { width: 100%; height: 56px; border-radius: 14px; border: 1px solid var(--line); background: #0d1730; padding: 0 16px; font-size: 18px; outline: none; }
input.in:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #35d0ff33; }
.err { color: var(--bad); font-size: 14px; min-height: 20px; margin: 8px 0; }

/* login */
.login { padding: calc(var(--safe-t) + 40px) 20px 24px; display: flex; flex-direction: column; justify-content: center; min-height: 100%; }
.login img { width: 84px; height: 84px; border-radius: 20px; align-self: center; box-shadow: 0 10px 30px #00000066; }
.login h1 { text-align: center; margin: 16px 0 4px; font-size: 26px; } .login p { text-align: center; margin: 0 0 24px; }

/* vehicles */
.veh { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; margin-bottom: 12px; padding: 16px; border-radius: var(--r); border: 1px solid var(--line); background: linear-gradient(180deg, var(--card), var(--bg2)); cursor: pointer; }
.veh .ic { width: 48px; height: 48px; border-radius: 14px; background: var(--card2); display: grid; place-items: center; font-size: 24px; }
.veh b { display: block; font-size: 17px; }

/* tab bar */
.tabs { display: flex; background: #0a1020ee; backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: 6px 6px calc(var(--safe-b) + 6px); }
.tabs button { flex: 1; background: none; border: 0; color: var(--muted); padding: 6px 0 2px; font-size: 11px; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; min-height: 52px; }
.tabs button .g { font-size: 22px; line-height: 1; }
.tabs button.on { color: var(--accent); }

/* progress */
.steps { display: flex; gap: 6px; margin: 12px 0 6px; }
.steps div { flex: 1; height: 8px; border-radius: 4px; background: var(--card2); }
.steps div.done { background: var(--accent); } .steps div.fail { background: var(--bad); }
.pulse { animation: pulse 1.2s ease-in-out infinite; } @keyframes pulse { 50% { opacity: .45; } }

/* sms */
.code { font: 600 19px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; background: #0d1730; border: 1px dashed var(--accent); border-radius: 14px; padding: 14px; text-align: center; word-break: break-all; user-select: all; -webkit-user-select: all; }
.count { text-align: center; margin: 12px 0 4px; font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums; }
.count.low { color: var(--warn); } .count.dead { color: var(--bad); }
.bar { height: 8px; border-radius: 4px; background: var(--card2); overflow: hidden; margin-bottom: 12px; } .bar > div { height: 100%; background: var(--accent); width: 100%; transition: width .25s linear; transform-origin: left; }

/* modal + toast */
.scrim { position: fixed; inset: 0; background: #000a; display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.sheet { width: 100%; max-width: 560px; background: var(--card); border-radius: 24px 24px 0 0; padding: 22px 18px calc(var(--safe-b) + 18px); border: 1px solid var(--line); }
.sheet h3 { margin: 0 0 8px; font-size: 20px; } .sheet p { margin: 0 0 16px; color: #cfdcf7; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--safe-b) + 86px); background: #1f2f52; border: 1px solid var(--line); padding: 12px 16px; border-radius: 14px; z-index: 30; text-align: center; box-shadow: 0 10px 30px #0008; }
.log li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; list-style: none; } .log { margin: 0; padding: 0; } .log time { display: block; font-size: 12px; color: var(--muted); }
.kv { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); } .kv:last-child { border: 0; } .kv span:first-child { color: var(--muted); }
details { margin-top: 10px; } summary { cursor: pointer; color: var(--accent); }
ol.how { padding-left: 20px; margin: 8px 0 0; } ol.how li { margin-bottom: 6px; }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } .bar > div { transition: none; } }

.noscript { padding: 24px; color: #fff; }
.offscreen { position: fixed; left: -9999px; top: 0; opacity: 0; }

/* dashboard */
.hero { text-align: center; padding-top: 22px; }
.ring { width: 188px; height: 188px; border-radius: 50%; margin: 0 auto 16px; display: grid; place-items: center; border: 8px solid #2b3c63; background: radial-gradient(circle at 50% 35%, #1b2a49, #0e1830); transition: border-color .4s, box-shadow .4s; }
.ring.run { border-color: var(--ok); box-shadow: 0 0 44px #3ddc9755, inset 0 0 30px #3ddc9722; animation: breathe 2.6s ease-in-out infinite; }
.ring.unknown { border-color: var(--warn); }
.ring-in { text-align: center; } .ring-v { font-size: 26px; font-weight: 700; } .ring-k { font-size: 12px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin-top: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { background: var(--card2); border-radius: 14px; padding: 8px 14px; min-width: 76px; } .chip span { display: block; font-size: 11px; color: var(--muted); } .chip b { font-size: 17px; }
.hero-age { margin-top: 12px; }
.qa { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.qa .btn { flex-direction: column; gap: 2px; min-height: 76px; font-size: 14px; padding: 0 6px; } .qa .g { font-size: 22px; line-height: 1; }
.skel { background: linear-gradient(90deg, var(--card2), #243656, var(--card2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: 10px; color: transparent; margin: 0 auto; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; } .check input { width: 22px; height: 22px; margin-top: 2px; }
main.enter > * { animation: rise .28s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes breathe { 50% { box-shadow: 0 0 64px #3ddc9788, inset 0 0 36px #3ddc9733; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { main.enter > *, .ring.run, .skel { animation: none; } }
