/* HobbsBrew Grand Prix */
:root {
  --espresso: #2a1a12;
  --roast: #4a2d1e;
  --caramel: #d98e32;
  --caramel-2: #f2b25c;
  --crema: #f6e3c6;
  --cream: #fff8ef;
  --paper: #ffffff;
  --red: #e23b3b;
  --red-deep: #a8262a;
  --green: #23966a;
  --gold: #f1b51c;
  --ink: #2a1a12;
  --ink-2: #6f5a4d;
  --line: #ecdfcd;
  --asphalt: #3b3640;
  --r-lg: 22px;
  --shadow: 0 12px 30px -12px rgba(42, 26, 18, 0.45);
  --shadow-sm: 0 2px 8px rgba(42, 26, 18, 0.08);
  --display: 'Racing Sans One', 'Arial Black', system-ui, sans-serif;
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(circle at 50% 0, #3b2619, #1c110b 70%) fixed;
  color: var(--ink);
  font: 600 16px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--cream);
  position: relative;
  overflow-x: hidden;
}
@media (min-width: 520px) { .app { box-shadow: 0 0 60px rgba(0, 0, 0, 0.45); } }

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
input { font: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 400; }
a { color: inherit; }
.ic { width: 22px; height: 22px; flex: none; }
.muted { color: var(--ink-2); font-weight: 600; font-size: 14px; }
.stack { display: grid; gap: 14px; }
.pad { padding: 16px; }
.eyebrow { font-size: 11px; font-weight: 900; letter-spacing: 0.14em; text-transform: uppercase; color: var(--red); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 999px;
  font-weight: 900; font-size: 16px; text-decoration: none;
  background: var(--paper); color: var(--ink); border: 2px solid var(--line);
  transition: transform 0.12s, box-shadow 0.12s;
}
.btn:active { transform: scale(0.97); }
.btn.primary {
  background: var(--red); color: #fff; border-color: transparent;
  box-shadow: 0 5px 0 var(--red-deep), 0 10px 20px -8px rgba(226, 59, 59, 0.7);
}
.btn.primary:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--red-deep); }
.btn.dark { background: var(--espresso); color: var(--cream); border-color: transparent; }
.btn.block { width: 100%; }
.btn.big { min-height: 56px; font-size: 18px; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn.primary.small { box-shadow: 0 3px 0 var(--red-deep); }
.btn[disabled] { opacity: 0.55; pointer-events: none; }
.link {
  color: var(--roast); font-weight: 800; font-size: 15px;
  text-decoration: underline; text-underline-offset: 3px; justify-self: center; padding: 4px;
}

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; font-weight: 800; font-size: 14px; color: var(--ink-2); }
.input, .field input {
  width: 100%; min-height: 50px; padding: 0 16px; border-radius: 14px;
  border: 2px solid var(--line); background: #fff; color: var(--ink);
  font-size: 16px; font-weight: 700; outline: none;
}
.input:focus, .field input:focus { border-color: var(--caramel); box-shadow: 0 0 0 4px rgba(217, 142, 50, 0.2); }
.form-msg { min-height: 1.2em; font-weight: 800; font-size: 14px; margin: 0; text-align: center; }
.form-msg.err { color: var(--red); }
.form-msg.ok { color: var(--green); }

.card { background: var(--paper); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); border: 1px solid var(--line); }

/* ---------- boot ---------- */
.boot { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 4px solid var(--crema); border-top-color: var(--red);
  animation: spin 0.8s linear infinite;
}
.center-msg { text-align: center; padding: 24px; max-width: 360px; }
.center-msg h2 { font: 400 28px var(--display); margin-bottom: 8px; }
.center-msg p { color: var(--ink-2); }

/* ---------- auth ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--espresso); color: var(--cream); }
.auth-hero { padding: calc(36px + env(safe-area-inset-top)) 24px 0; text-align: center; overflow: hidden; }
.auth-hero .logo { width: 68px; height: 68px; display: block; margin: 0 auto 12px; filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4)); }
.brand { font: 400 46px/1 var(--display); letter-spacing: 0.01em; }
.brand-tag {
  display: inline-block; margin-top: 10px; padding: 5px 14px; border-radius: 999px;
  background: var(--red); color: #fff; font-weight: 900; font-size: 11.5px; letter-spacing: 0.16em; text-transform: uppercase;
}
.lede { margin: 16px auto 0; max-width: 32ch; color: var(--crema); font-weight: 700; }
.hero-road { margin: 26px -24px 0; height: 76px; background: var(--asphalt); position: relative; overflow: hidden; }
.hero-road::before, .hero-road::after, .preview-road::before {
  content: ""; position: absolute; left: 0; right: 0; height: 6px;
  background: repeating-linear-gradient(90deg, #fff 0 16px, var(--red) 16px 32px);
  background-size: 32px 6px; animation: roll 0.6s linear infinite;
}
.hero-road::before { top: 0; }
.hero-road::after { bottom: 0; }
.lane {
  position: absolute; left: 0; right: 0; top: 50%; height: 3px; margin-top: -1.5px;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.7) 0 20px, transparent 20px 44px);
  background-size: 44px 3px; animation: roll2 0.45s linear infinite;
}
.hero-road .avatar { position: absolute; left: 50%; bottom: 7px; width: 88px; margin-left: -44px; animation: bob 0.35s ease-in-out infinite alternate; }

.auth-body {
  flex: 1; background: var(--cream); color: var(--ink);
  border-radius: 28px 28px 0 0; margin-top: -16px; position: relative;
  padding: 22px 20px calc(28px + env(safe-area-inset-bottom));
}
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--crema); padding: 4px; border-radius: 999px; margin-bottom: 18px; }
.seg button { min-height: 44px; border-radius: 999px; font-weight: 900; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.how { list-style: none; padding: 0; margin: 24px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.how li { text-align: center; padding: 12px 6px; border-radius: 16px; background: #fff; border: 1px solid var(--line); font-size: 12.5px; font-weight: 800; color: var(--ink-2); line-height: 1.25; }
.how b { display: grid; place-items: center; width: 30px; height: 30px; margin: 0 auto 6px; border-radius: 50%; background: var(--espresso); color: var(--cream); font: 400 16px var(--display); }

/* ---------- picker ---------- */
.picker { padding: calc(18px + env(safe-area-inset-top)) 18px calc(26px + env(safe-area-inset-bottom)); display: grid; gap: 18px; align-content: start; min-height: 100dvh; }
.picker-head { text-align: center; position: relative; padding: 0 44px; }
.picker-head h1 { font: 400 32px var(--display); margin-top: 2px; }
.picker-head p { margin: 4px 0 0; color: var(--ink-2); }
.picker-back { position: absolute; left: 0; top: 0; width: 42px; height: 42px; border-radius: 50%; background: var(--crema); display: grid; place-items: center; }
.preview { position: relative; height: 156px; border-radius: 24px; background: linear-gradient(#bfe3f0, #e7f4ea 72%); overflow: hidden; border: 1px solid var(--line); }
.preview-road { position: absolute; left: 0; right: 0; bottom: 0; height: 34px; background: var(--asphalt); }
.preview-road::before { top: 0; }
.preview .avatar { position: absolute; left: 50%; bottom: 14px; width: 168px; margin-left: -84px; animation: bob 0.4s ease-in-out infinite alternate; }
.veh-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.veh {
  display: grid; justify-items: center; gap: 2px; padding: 8px 4px 7px; border-radius: 16px;
  background: #fff; border: 2px solid var(--line); font-size: 11px; font-weight: 800; color: var(--ink-2); line-height: 1.15; text-align: center;
}
.veh .avatar { width: 100%; height: auto; }
.veh[aria-pressed="true"] { border-color: var(--red); background: #fff3f2; color: var(--ink); box-shadow: 0 0 0 3px rgba(226, 59, 59, 0.15); }
.swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.sw { aspect-ratio: 1; border-radius: 50%; background: var(--c); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--line); }
.sw[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ink); transform: scale(1.06); }
.stepper { display: flex; gap: 8px; }
.stepper button { flex: none; width: 54px; min-height: 50px; border-radius: 14px; background: var(--crema); font-size: 24px; font-weight: 900; }
.stepper input { text-align: center; font: 400 24px var(--display) !important; }

/* ---------- shell ---------- */
.shell { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.demo-bar { flex: none; background: var(--gold); color: var(--espresso); font-size: 12px; font-weight: 800; text-align: center; padding: calc(5px + env(safe-area-inset-top)) 12px 5px; }
.topbar {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px; background: var(--espresso); color: var(--cream);
}
.demo-bar + .topbar { padding-top: 10px; }
.brand-sm { display: flex; align-items: center; gap: 8px; font: 400 22px var(--display); }
.brand-sm .logo { width: 32px; height: 32px; }
.me-chip {
  display: flex; align-items: center; gap: 6px; padding: 3px 12px 3px 4px; border-radius: 999px;
  background: rgba(255, 248, 239, 0.12); color: var(--cream); font-weight: 800; font-size: 14px; max-width: 52%; min-height: 40px;
}
.me-chip .avatar { width: 42px; height: 28px; flex: none; }
.me-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.view { flex: 1; min-height: 0; overflow-y: auto; position: relative; -webkit-overflow-scrolling: touch; }
.view.no-scroll { overflow: hidden; }
.tabbar {
  flex: none; display: grid; grid-template-columns: repeat(4, 1fr);
  background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button { position: relative; display: grid; justify-items: center; gap: 2px; padding: 9px 0 8px; font-size: 11.5px; font-weight: 800; color: var(--ink-2); }
.tabbar button[aria-current="page"] { color: var(--red); }
.tabbar button[aria-current="page"]::before {
  content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--red);
}
.badge {
  position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--red); color: #fff; font: 900 11px/18px var(--font); font-style: normal;
  border: 2px solid #fff; box-sizing: content-box;
}
.badge:empty { display: none; }

/* ---------- race ---------- */
.race { position: absolute; inset: 0; }
.map-scroll { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; background: #e3ecf6; -webkit-overflow-scrolling: touch; }
.map-scroll > svg { display: block; width: 100%; height: auto; }
.hud {
  position: absolute; top: 10px; left: 10px; right: 10px; z-index: 3;
  padding: 11px 14px 12px; border-radius: 20px;
  background: rgba(255, 255, 255, 0.95); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: var(--shadow); border: 1px solid rgba(255, 255, 255, 0.8);
}
.hud-row { display: flex; align-items: center; gap: 12px; }
.hud-pos { flex: none; }
.hud-label { font-size: 10.5px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }
.hud-big { font: 400 34px/1 var(--display); color: var(--ink); }
.hud-big small { font-size: 15px; color: var(--ink-2); margin-left: 2px; }
.hud-next { flex: 1; min-width: 0; padding-left: 12px; border-left: 2px dashed var(--line); }
.hud-next-title { font-weight: 900; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-sub { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.cups { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; margin-top: 9px; }
.cup { width: 100%; height: 22px; }
.cup path { fill: none; stroke: #d8c8b4; stroke-width: 1.8; stroke-linejoin: round; transition: fill 0.2s; }
.cup.on path:first-child { fill: var(--caramel); stroke: var(--roast); }
.cup.on path:last-child { stroke: var(--roast); }
.cup.pop { animation: pop 0.5s; }
.fab {
  position: absolute; z-index: 3; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 0 26px 0 20px; border-radius: 999px;
  background: var(--red); color: #fff; font-weight: 900; font-size: 17px; white-space: nowrap;
  box-shadow: 0 5px 0 var(--red-deep), 0 16px 30px -8px rgba(0, 0, 0, 0.5);
}
.fab:active { transform: translateX(-50%) translateY(3px); box-shadow: 0 2px 0 var(--red-deep); }
.fab[disabled] { opacity: 0.7; pointer-events: none; }
.fab .ic { width: 26px; height: 26px; }
.locate {
  position: absolute; z-index: 3; right: 14px; bottom: 94px; width: 46px; height: 46px; border-radius: 50%;
  background: #fff; display: grid; place-items: center; box-shadow: var(--shadow); color: var(--ink);
}

/* map svg */
.dot { fill: rgba(255, 255, 255, 0.28); stroke: rgba(255, 255, 255, 0.35); stroke-width: 1; transition: fill 0.25s; }
.dot.on { fill: var(--caramel); stroke: #fff; stroke-width: 1.6; }
.zone-label .zl-k { font: 900 9px var(--font); letter-spacing: 0.2em; fill: rgba(42, 26, 18, 0.5); }
.zone-label .zl-n { font: 400 17px var(--display); fill: rgba(42, 26, 18, 0.72); }
.cafe-name, .banner-t { font: 400 13px var(--display); fill: #fff; letter-spacing: 0.06em; }
.cafe-name { fill: var(--cream); }
.cp { cursor: pointer; outline: none; }
.cp-in { transform-box: fill-box; transform-origin: center; }
.cp.pop .cp-in { animation: pop 0.6s; }
.cp-bg { fill: #fff; stroke: var(--roast); stroke-width: 2; }
.cp-ic { fill: var(--crema); }
.cp-m { font: 900 8.5px var(--font); letter-spacing: 0.05em; fill: var(--ink-2); }
.cp-t { font: 900 11.5px var(--font); fill: var(--ink); }
.cp-pole { stroke: var(--roast); stroke-width: 3; stroke-linecap: round; }
.cp:focus-visible .cp-bg { stroke: var(--red); stroke-width: 3; }
.cp.locked .cp-ic { fill: #efe7dc; }
.cp.ready .cp-bg { fill: #fff4cf; stroke: var(--gold); stroke-width: 3; }
.cp.done .cp-bg { fill: #e8f5ee; stroke: var(--green); }
.cp.done .cp-ic { fill: #cfe9db; }
.cp.grand .cp-bg { fill: var(--espresso); stroke: var(--gold); stroke-width: 3; }
.cp.grand .cp-t { fill: #fff; }
.cp.grand .cp-m { fill: var(--gold); }
.cp.grand .cp-ic { fill: #4a2d1e; }
.chip { display: none; }
.cp.ready .chip-ready, .cp.done .chip-done { display: inline; }
.chip-ready rect { fill: var(--red); }
.chip-ready text { font: 900 9.5px var(--font); fill: #fff; letter-spacing: 0.06em; }
.chip-done circle { fill: var(--green); stroke: #fff; stroke-width: 2; }
.chip-done path { stroke: #fff; stroke-width: 2.4; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ghost { opacity: 0.82; }
.ghost text { font: 800 8.5px var(--font); fill: #fff; stroke: rgba(42, 26, 18, 0.8); stroke-width: 2.6px; paint-order: stroke; }
.me-pulse { fill: rgba(226, 59, 59, 0.35); transform-box: fill-box; transform-origin: center; animation: pulse 1.8s ease-out infinite; }
.me-bob { transform-box: fill-box; transform-origin: center bottom; }
#me.moving .me-bob { animation: bob 0.18s ease-in-out infinite alternate; }
.me-tag rect { fill: var(--red); stroke: #fff; stroke-width: 2; }
.me-tag text { font: 900 10px var(--font); fill: #fff; letter-spacing: 0.1em; }

/* ---------- sheets ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(28, 17, 11, 0.55); opacity: 0; transition: opacity 0.25s; }
.sheet {
  position: relative; width: 100%; max-width: 480px; max-height: 94vh; max-height: 94dvh; overflow-y: auto;
  background: var(--cream); border-radius: 28px 28px 0 0;
  padding: 10px 18px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-grip { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 8px; }
.sheet-x { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--crema); }
.sheet-head { text-align: center; padding: 4px 34px 14px; }
.sheet h2 { font: 400 25px/1.1 var(--display); margin-top: 4px; }
.sheet-head p { margin: 8px 0 0; color: var(--ink-2); font-size: 14.5px; }
.sheet-actions { display: grid; gap: 10px; margin-top: 18px; }

.drinks { display: flex; align-items: center; justify-content: space-between; background: #fff; border: 2px solid var(--line); border-radius: 20px; padding: 7px; margin-bottom: 12px; }
.drinks button { width: 54px; height: 54px; border-radius: 14px; background: var(--crema); font-size: 28px; font-weight: 900; }
.drinks button:active { background: var(--caramel-2); }
.drinks div { text-align: center; }
.drinks b { display: block; font: 400 32px/1 var(--display); }
.drinks span { font-size: 11.5px; font-weight: 900; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.12em; }

.pin-dots { display: flex; justify-content: center; gap: 18px; margin: 6px 0 8px; }
.pin-dots span { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--roast); transition: background 0.1s, transform 0.1s; }
.pin-dots span.on { background: var(--roast); transform: scale(1.1); }
.pin-dots.shake { animation: shake 0.4s; }
.pin-msg { text-align: center; min-height: 22px; font-weight: 800; font-size: 14px; color: var(--ink-2); margin-bottom: 10px; }
.pin-msg.err { color: var(--red); }
.pin-msg.ok { color: var(--green); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keypad button {
  min-height: 60px; border-radius: 18px; background: #fff; border: 2px solid var(--line);
  font: 400 28px var(--display); box-shadow: 0 3px 0 var(--line); display: grid; place-items: center;
}
.keypad button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); background: var(--crema); }
.keypad .k-sub { font: 800 15px var(--font); color: var(--ink-2); }
.pinpad.busy .keypad { opacity: 0.5; pointer-events: none; }
.pinpad.busy .pin-dots span { animation: blink 0.8s infinite; }

.celebrate { text-align: center; padding: 6px 4px 0; }
.celebrate h2 { font-size: 30px; }
.celebrate p { margin: 10px 0 0; color: var(--ink-2); }
.big-icon {
  width: 96px; height: 96px; margin: 10px auto 10px; border-radius: 28px; display: grid; place-items: center;
  font-size: 52px; background: #fff4cf; border: 3px solid var(--gold); animation: pop 0.6s;
}
.big-icon.locked { background: #f3ece2; border-color: var(--line); filter: grayscale(0.6); }
.big-icon.done { background: #e8f5ee; border-color: var(--green); }

/* ---------- pages ---------- */
.page { padding: 20px 16px 32px; }
.page-title { font: 400 32px var(--display); }
.page-sub { margin: 6px 0 18px; color: var(--ink-2); }
.pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 11px; border-radius: 999px;
  background: var(--crema); font-size: 12.5px; font-weight: 900; white-space: nowrap; color: var(--ink-2);
}
.pill .ic { width: 15px; height: 15px; }
.pill.done { background: #e1f3e9; color: var(--green); }
.pill.ready { background: #fff1c4; color: #8a5a00; }
.ready-banner {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-bottom: 14px; border-radius: 16px;
  background: var(--espresso); color: var(--cream);
}
.ready-banner .ic { color: var(--gold); }

.reward-list { display: grid; gap: 10px; }
.reward { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 18px; background: #fff; border: 2px solid var(--line); }
.r-icon { flex: none; width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; font-size: 27px; background: var(--crema); }
.r-body { flex: 1; min-width: 0; }
.r-m { font-size: 11px; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); }
.r-title { font-weight: 900; font-size: 16px; line-height: 1.2; }
.r-desc { font-size: 13px; color: var(--ink-2); }
.r-act { flex: none; }
.reward.locked .r-icon { filter: grayscale(1); opacity: 0.55; }
.reward.ready { border-color: var(--gold); background: #fffaeb; box-shadow: 0 0 0 4px rgba(241, 181, 28, 0.18); }
.reward.done { opacity: 0.72; }
.reward.done .r-icon { background: #e1f3e9; }
.reward.grand { background: var(--espresso); color: var(--cream); border-color: var(--gold); }
.reward.grand .r-m, .reward.grand .r-desc { color: var(--crema); }
.reward.grand .r-icon { background: #4a2d1e; filter: none; opacity: 1; }

.board { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.board li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #fff; border-radius: 16px; border: 2px solid var(--line); }
.board li.me { border-color: var(--red); background: #fff3f2; }
.board li.gap { justify-content: center; padding: 0; border: 0; background: none; color: var(--ink-2); font-weight: 900; letter-spacing: 0.3em; }
.rank { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font: 400 16px var(--display); background: var(--crema); }
.rank.r1 { background: #f8d34a; }
.rank.r2 { background: #dfe3e8; }
.rank.r3 { background: #e8b07a; }
.board .avatar { width: 54px; height: 36px; flex: none; }
.b-body { flex: 1; min-width: 0; }
.b-name { font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.you { font-size: 10px; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; background: var(--red); color: #fff; padding: 2px 6px; border-radius: 6px; vertical-align: 2px; }
.bar { height: 6px; border-radius: 3px; background: var(--crema); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; min-width: 4px; background: linear-gradient(90deg, var(--caramel), var(--red)); border-radius: 3px; }
.b-score { flex: none; text-align: right; font: 400 22px/1 var(--display); }
.b-score small { display: block; font: 900 9px var(--font); color: var(--ink-2); letter-spacing: 0.1em; margin-top: 2px; }
.empty { padding: 22px; text-align: center; color: var(--ink-2); font-weight: 700; }

.garage-hero { padding: 18px 18px 20px; text-align: center; background: var(--espresso); color: var(--cream); border-radius: var(--r-lg); position: relative; overflow: hidden; }
.garage-hero::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px;
  background: repeating-linear-gradient(90deg, #fff 0 16px, var(--red) 16px 32px);
}
.garage-hero .avatar { width: 190px; height: 127px; display: block; margin: 0 auto; }
.garage-hero h2 { font: 400 28px var(--display); margin-top: 2px; }
.garage-hero p { margin: 4px 0 14px; color: var(--crema); font-weight: 700; }
.section-title { font: 900 12.5px var(--font); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); margin: 26px 4px 10px; }
.log { list-style: none; padding: 0; margin: 0; background: #fff; border-radius: 18px; border: 2px solid var(--line); overflow: hidden; }
.log li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); font-weight: 800; }
.log li:first-child { border-top: 0; }
.log .when { color: var(--ink-2); font-size: 12.5px; font-weight: 700; }
.log .plus { font-weight: 900; color: var(--green); white-space: nowrap; }
.log .minus { font-weight: 900; color: var(--red); white-space: nowrap; }
.log li.empty { justify-content: center; }
.acct-email { font-weight: 900; word-break: break-all; }

/* ---------- toast & confetti ---------- */
.toast {
  position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top)); z-index: 80;
  transform: translate(-50%, -20px); opacity: 0; pointer-events: none;
  background: var(--espresso); color: var(--cream); padding: 12px 18px; border-radius: 999px;
  font-weight: 800; font-size: 14.5px; box-shadow: var(--shadow); transition: 0.25s; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--red); color: #fff; }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 90; }

/* ---------- admin ---------- */
.admin-page .app { max-width: 880px; }
.admin-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px; background: var(--espresso); color: var(--cream);
}
.admin-head .actions { display: flex; gap: 8px; }
.admin-head .btn { background: rgba(255, 248, 239, 0.12); color: var(--cream); border-color: transparent; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; padding: 16px 16px 6px; }
.stat { padding: 14px 16px; }
.stat b { display: block; font: 400 30px/1 var(--display); }
.stat span { font-size: 11px; font-weight: 900; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.1em; }
.stat.warn { border-color: var(--red); background: #fff3f2; }
.admin-tabs { display: flex; gap: 6px; padding: 10px 16px; overflow-x: auto; }
.admin-tabs button { padding: 10px 16px; border-radius: 999px; font-weight: 900; background: var(--crema); white-space: nowrap; }
.admin-tabs button[aria-pressed="true"] { background: var(--espresso); color: var(--cream); }
.admin-body { padding: 6px 16px 40px; display: grid; gap: 14px; }
.admin-body h2 { font: 400 22px var(--display); margin-bottom: 4px; }
.rows { background: #fff; border: 2px solid var(--line); border-radius: 18px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.rows > .row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 150px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; width: 100%; }
.inline-form .input { flex: 1; min-width: 120px; min-height: 44px; }
.tag { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 900; }
.tag.on { background: #e1f3e9; color: var(--green); }
.tag.off { background: #eee6dc; color: var(--ink-2); }
.score { font: 400 22px var(--display); }
.score small { font-size: 12px; color: var(--ink-2); }
.m-badge { flex: none; width: 46px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--espresso); color: var(--cream); font: 400 15px var(--display); }
.icon-in { flex: none !important; width: 64px !important; min-width: 0 !important; text-align: center; font-size: 20px !important; }
.kind { flex: none; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; font-size: 18px; background: var(--crema); }
.admin-login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.admin-login .card { width: 100%; max-width: 380px; text-align: center; }
.admin-login .logo { width: 56px; height: 56px; }
.admin-login h1 { font: 400 30px var(--display); margin: 6px 0 4px; }
.admin-login form { text-align: left; margin: 16px 0 10px; }
code.sql { display: block; text-align: left; white-space: pre-wrap; background: var(--espresso); color: var(--cream); padding: 12px; border-radius: 12px; font-size: 12.5px; margin: 12px 0; }

/* ---------- motion ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes roll { to { background-position: -32px 0; } }
@keyframes roll2 { to { background-position: -44px 0; } }
@keyframes bob { from { transform: translateY(0); } to { transform: translateY(-3px); } }
@keyframes pop { 0% { transform: scale(0.6); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes pulse { 0% { transform: scale(0.6); opacity: 0.8; } 100% { transform: scale(1.7); opacity: 0; } }
@keyframes shake { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
@keyframes blink { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
