@font-face {
  font-family: 'Bricolage';
  src: url('../shared/fonts/bricolagegrotesque.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --yellow: #f7c51e;
  --ink: #fff8e6;
  --night: #140c26;
  --panel: rgba(16, 10, 34, 0.78);
  --red: #e94f37;
  --green: #36c26b;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--night);
  color: var(--ink);
  font-family: 'Bricolage', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- HUD ---------- */
.hud { position: fixed; inset: 0; pointer-events: none; padding: max(10px, env(safe-area-inset-top)) 12px max(14px, env(safe-area-inset-bottom)); }
.hud[hidden] { display: none; }
.hud-top { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 10px; }
.round-btn {
  pointer-events: auto;
  width: 44px; height: 44px; border-radius: 14px; border: 0;
  background: var(--panel); display: grid; place-items: center; cursor: pointer;
}
.round-btn svg { width: 22px; height: 22px; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; fill: none; }
.money { justify-self: center; display: flex; align-items: baseline; gap: 3px; background: var(--panel); padding: 6px 16px; border-radius: 99px; }
.money .naira { color: var(--yellow); font-weight: 800; font-size: 20px; }
.money b { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.5px; }
.dist { background: var(--panel); padding: 8px 12px; border-radius: 14px; display: flex; align-items: baseline; gap: 3px; }
.dist b { font-size: 18px; font-variant-numeric: tabular-nums; }
.dist small { color: #c9bfe0; font-weight: 600; }

.hud-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; margin-top: 8px; align-items: center; }
.meter, .seats, .health { background: var(--panel); border-radius: 14px; padding: 7px 10px; display: flex; align-items: center; gap: 8px; }
.meter svg, .seats svg { width: 18px; height: 18px; stroke: var(--ink); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.bar { flex: 1; height: 10px; border-radius: 99px; background: rgba(255, 255, 255, 0.15); overflow: hidden; min-width: 70px; }
.bar i { display: block; height: 100%; width: 100%; background: var(--green); border-radius: inherit; transition: width 0.2s, background 0.3s; }
.bar i.low { background: var(--red); animation: blink 0.6s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.4; } }
.seats b { font-size: 17px; font-variant-numeric: tabular-nums; }
.seats small { color: #c9bfe0; font-weight: 600; margin-left: -6px; }
.health { gap: 4px; }
.health i { width: 18px; height: 12px; border-radius: 3px; background: var(--yellow); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25); }
.health i.gone { background: rgba(255, 255, 255, 0.18); box-shadow: none; }

.stop-alert {
  position: absolute; right: 12px; top: 128px;
  background: #2c6fd6; color: #fff; font-weight: 800; font-size: 15px;
  padding: 8px 10px 8px 14px; border-radius: 12px; display: flex; align-items: center; gap: 4px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  animation: nudge 0.8s ease-in-out infinite;
}
.stop-alert.crowd { background: #d9781a; }
.stop-alert.warn { background: #c62f2f; }
.stop-alert svg { width: 20px; height: 20px; stroke: #fff; stroke-width: 3; fill: none; stroke-linecap: round; }
.stop-alert[hidden] { display: none; }
@keyframes nudge { 50% { transform: translateX(4px); } }

.callout {
  position: absolute; left: 50%; top: 34%;
  transform: translate(-50%, -50%) scale(0.7); opacity: 0;
  font-weight: 800; font-size: 30px; text-align: center; white-space: nowrap;
  color: var(--yellow); text-shadow: 0 3px 0 #000, 0 8px 22px rgba(0, 0, 0, 0.6);
  transition: transform 0.22s cubic-bezier(0.2, 1.4, 0.4, 1), opacity 0.2s;
}
.callout.show { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.callout.bad { color: #ff8a7a; }
.callout small { display: block; font-size: 17px; color: var(--ink); font-weight: 700; }

.honk {
  pointer-events: auto;
  position: absolute; right: 16px; bottom: max(18px, env(safe-area-inset-bottom));
  width: 84px; height: 84px; border-radius: 50%; border: 4px solid rgba(0, 0, 0, 0.35);
  background: radial-gradient(circle at 40% 35%, #ffe27a, var(--yellow) 60%, #c99410);
  color: #2a1a00; font: 800 17px 'Bricolage', system-ui, sans-serif; letter-spacing: 0.5px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45); cursor: pointer;
}
.honk:active, .honk.on { transform: scale(0.93); }
.honk.cool { filter: grayscale(0.7) brightness(0.8); }

.chips { display: flex; gap: 6px; margin-top: 8px; min-height: 0; }
.chip { font-weight: 800; font-size: 14px; padding: 5px 10px; border-radius: 99px; background: var(--panel); }
.chip[hidden] { display: none; }
.chip.streak { color: var(--yellow); }
.chip.boost { background: #a3123f; color: #fff; animation: blink 0.5s steps(2) infinite; }

/* jobs */
.jobs-box { background: rgba(16, 10, 34, 0.7); border-radius: 16px; padding: 10px 12px; text-align: left; }
.jobs-box h3 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: #c9bfe0; }
.jobs { display: flex; flex-direction: column; gap: 7px; }
.job { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; font-size: 14px; font-weight: 600; line-height: 1.25; }
.job b { color: var(--yellow); font-size: 14px; white-space: nowrap; }
.job.done b { color: var(--green); }
.job.done span { color: #c9bfe0; text-decoration: line-through; }
.jbar { height: 5px; border-radius: 99px; background: rgba(255, 255, 255, 0.14); margin-top: 4px; overflow: hidden; }
.jbar i { display: block; height: 100%; background: var(--yellow); border-radius: inherit; }
.job.done .jbar i { background: var(--green); }

/* ---------- screens and sheets ---------- */
.screen { position: fixed; inset: 0; display: grid; place-items: end center; padding: 16px 16px max(28px, env(safe-area-inset-bottom)); background: linear-gradient(180deg, transparent 30%, rgba(10, 6, 24, 0.85) 75%); }
.screen[hidden] { display: none; }
.title-card { width: min(420px, 100%); display: flex; flex-direction: column; gap: 12px; text-align: center; }
.title-card h1 { margin: 0; font-size: 62px; line-height: 0.95; font-weight: 800; letter-spacing: -2px; text-shadow: 0 4px 0 rgba(0, 0, 0, 0.35); }
.title-card h1 span { color: var(--yellow); display: block; }
.tag { margin: 0; color: #e8dfff; font-weight: 600; }
.bank { font-weight: 600; color: #e8dfff; }
.bank b { color: var(--yellow); }
.best { margin: 0; color: #c9bfe0; font-size: 14px; min-height: 1.2em; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn {
  font: inherit; font-weight: 700; font-size: 17px; color: var(--ink);
  background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px; padding: 13px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:active { transform: translateY(1px); }
.btn.big { font-size: 21px; padding: 17px; }
.btn.primary { background: var(--yellow); color: #2a1a00; border-color: transparent; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.18); }
.btn.reward { background: #36c26b; color: #062611; border-color: transparent; }
.btn.reward svg { width: 18px; height: 18px; fill: currentColor; }
.btn[hidden] { display: none; }
.btn:disabled { opacity: 0.55; }

.sheet { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(8, 4, 20, 0.62); backdrop-filter: blur(3px); }
.sheet[hidden] { display: none; }
.card {
  width: min(380px, 100%); max-height: 100%; overflow-y: auto;
  background: linear-gradient(180deg, #2a1d4d, #1b1236); border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 22px; padding: 22px 18px 18px; display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}
.card.wide { width: min(520px, 100%); }
.card h2 { margin: 0 0 4px; font-size: 26px; font-weight: 800; }
.card h3 { margin: 8px 0 0; font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: #c9bfe0; }
.how { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; line-height: 1.45; color: #ece6ff; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; padding: 4px 0; }
.check input { width: 20px; height: 20px; accent-color: var(--yellow); }
.small-link { color: #c9bfe0; text-align: center; font-size: 14px; }

.kicker { margin: 0; text-align: center; color: #c9bfe0; font-weight: 700; }
#overTitle { text-align: center; }
.earned { text-align: center; font-size: 52px; font-weight: 800; color: var(--yellow); line-height: 1; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0; }
.stats div { background: rgba(255, 255, 255, 0.07); border-radius: 12px; padding: 8px 10px; }
.stats dt { font-size: 12px; color: #c9bfe0; font-weight: 600; }
.stats dd { margin: 2px 0 0; font-size: 19px; font-weight: 800; }

.garage-head { display: flex; justify-content: space-between; align-items: center; }
.garage-head .bank { font-size: 22px; font-weight: 800; color: var(--yellow); }
.paints { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.paint {
  font: inherit; color: var(--ink); background: rgba(255, 255, 255, 0.06); border: 2px solid transparent;
  border-radius: 14px; padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer;
}
.paint.on { border-color: var(--yellow); }
.paint canvas { position: static; width: 100%; height: auto; }
.paint b { font-size: 14px; }
.paint small { color: #c9bfe0; font-weight: 600; }
.upgrades { display: flex; flex-direction: column; gap: 8px; }
.upgrade { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; background: rgba(255, 255, 255, 0.06); border-radius: 14px; padding: 10px 12px; }
.upgrade b { display: block; }
.upgrade small { color: #c9bfe0; }
.pips { display: flex; gap: 4px; margin-top: 4px; }
.pips i { width: 16px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.2); }
.pips i.on { background: var(--yellow); }
.upgrade .btn { padding: 9px 12px; font-size: 15px; }

.toast {
  position: fixed; left: 50%; top: 22%; transform: translateX(-50%); z-index: 80;
  background: #fff8e6; color: #2a1a00; font-weight: 700; padding: 10px 16px; border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35); pointer-events: none; max-width: calc(100% - 32px); text-align: center;
}
.toast[hidden] { display: none; }

@media (min-aspect-ratio: 5/4) {
  .screen { place-items: center end; padding-right: 7vw; background: linear-gradient(90deg, transparent 35%, rgba(10, 6, 24, 0.82) 70%); }
}
