@font-face {
  font-family: 'Kenney Future';
  src: url('../assets/font/kenney-future.ttf') format('truetype');
  font-display: swap;
}
/* Every color comes from the Sweetie 16 palette by GrafxKid (see CREDITS.md);
   the darkest backgrounds are the palette's night blue shaded toward black.
   Panels and buttons copied from Hairpin Rush and recolored. */
:root {
  --bg: #0e0f18;
  --ink: #f4f4f4;
  --dim: #94b0c2;
  --accent: #ffcd75;
  --hot: #b13e53;
  --coral: #ef7d57;
  --good: #73eff7;
  --lime: #a7f070;
  --glass: rgba(26, 28, 44, 0.9);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  user-select: none; -webkit-user-select: none; touch-action: none;
}
canvas#game { display: block; width: 100vw; height: 100vh; height: 100dvh; touch-action: none; }
.hidden { display: none !important; }

#pauseBtn {
  position: fixed; top: calc(10px + env(safe-area-inset-top)); left: calc(12px + env(safe-area-inset-left));
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.18);
  background: rgba(26,28,44,0.55); color: var(--ink); font-weight: 800; font-size: 15px; cursor: pointer; z-index: 5;
}

.panel {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(14, 15, 24, 0.35); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  padding: 12px; z-index: 10; animation: fade 0.25s ease-out;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.card {
  width: 100%; max-width: 360px; max-height: 100%; overflow-y: auto; background: var(--glass); border: 1px solid rgba(115,239,247,0.24);
  border-radius: 22px; padding: 20px 20px 16px; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: pop 0.3s cubic-bezier(.2,1.4,.4,1);
}
.card.wide { max-width: 720px; display: flex; gap: 22px; align-items: stretch; }
.card.wide .col { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
@media (max-aspect-ratio: 1/1), (max-width: 600px) {
  .card.wide { flex-direction: column; max-width: 380px; gap: 8px; }
}
@media (max-height: 460px) {
  .card { padding: 12px 14px 10px; }
  .card.wide .btn { padding: 9px 12px; margin: 5px 0; }
  .card .how { display: none; }
  .logo { font-size: 30px !important; }
  .sub { margin: 4px 0 8px !important; }
  .best-line { margin-bottom: 6px !important; }
}
@keyframes pop { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.logo {
  font-family: 'Kenney Future', system-ui, sans-serif; font-weight: 400;
  margin: 4px 0 2px; font-size: 42px; letter-spacing: 1px; line-height: 1;
  color: var(--good); text-shadow: 0 0 18px rgba(115,239,247,0.55), 0 4px 0 #257179;
}
.logo span { display: block; color: var(--accent); text-shadow: 0 0 18px rgba(255,205,117,0.55), 0 4px 0 #b13e53; }
.sub { margin: 8px 0 14px; color: var(--dim); font-size: 14px; }
h2 { font-family: 'Kenney Future', system-ui, sans-serif; font-weight: 400; margin: 2px 0 6px; font-size: 24px; letter-spacing: 2px; color: var(--accent); }
.best-line { color: var(--dim); font-size: 13px; letter-spacing: 2px; margin-bottom: 12px; }
.best-line b { color: var(--accent); font-size: 18px; margin-left: 6px; }
.best-line small { letter-spacing: 0.5px; }

.btn {
  display: block; width: 100%; margin: 7px 0; padding: 12px 14px; border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14); background: rgba(255,255,255,0.07);
  color: var(--ink); font-family: inherit; font-weight: 800; font-size: 16px; line-height: 1.1; letter-spacing: 1.5px; cursor: pointer;
  transition: transform 0.08s, background 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn.primary {
  background: linear-gradient(180deg, #ef7d57, #b13e53); color: #f4f4f4; border: none; font-size: 19px;
  box-shadow: 0 5px 0 #5d275d, 0 8px 22px rgba(177,62,83,0.35);
}
.btn.primary:active { box-shadow: 0 2px 0 #5d275d; transform: translateY(3px); }
.btn.daily { background: linear-gradient(180deg, rgba(115,239,247,0.22), rgba(37,113,121,0.18)); border-color: rgba(115,239,247,0.45); }
.btn.daily .t { display: block; }
.btn.daily .s { display: block; font-weight: 500; font-size: 12px; letter-spacing: 0.3px; color: #c9f6f8; margin-top: 4px; }
.btn.ghost { background: transparent; color: var(--dim); font-size: 14px; }
.btn.small { width: 40px; flex: 0 0 40px; margin: 0; padding: 8px 0; font-size: 13px; }
.row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.pick { flex: 1; min-width: 0; }
.pick b { display: block; font-size: 15px; letter-spacing: 0.5px; }
.pick small { display: block; color: var(--dim); font-size: 11px; margin-top: 2px; min-height: 13px; }
#skinPreview { width: 240px; max-width: 100%; height: 96px; display: block; margin: 0 auto 4px; border-radius: 10px; }
.toggles { gap: 6px; margin: 0; }
.toggles .btn { margin: 4px 0; padding: 9px 6px; font-size: 13px; }
.garage { padding: 10px 12px 6px; border-radius: 14px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); }
.garage .mh b { display: flex; align-items: center; gap: 5px; font-size: 14px; }
.btn.buy { margin: 6px 0 4px; padding: 9px 12px; font-size: 14px; background: linear-gradient(180deg, rgba(255,205,117,0.3), rgba(239,125,87,0.18)); border-color: rgba(255,205,117,0.5); }
.btn.buy:disabled { opacity: 0.45; cursor: default; }
i.coin { display: inline-block; width: 13px; height: 13px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #f4f4f4 0 18%, #ffcd75 22% 60%, #ef7d57 64%); box-shadow: 0 0 8px rgba(255,205,117,0.7); vertical-align: -2px; }
.eyebrow { font-size: 11px; letter-spacing: 3px; color: var(--good); margin-bottom: 2px; }
.days { display: flex; gap: 5px; margin: 10px 0; }
.days span { flex: 1; padding: 7px 0; border-radius: 10px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); font-size: 10px; color: var(--dim); }
.days span b { display: block; font-size: 11px; color: var(--ink); letter-spacing: 1px; }
.days span.got { opacity: 0.45; }
.days span.on { border-color: var(--accent); background: rgba(255,205,117,0.14); color: var(--accent); }
.pay { font-size: 30px; font-weight: 900; color: var(--accent); margin: 4px 0 10px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.pay i.coin { width: 24px; height: 24px; }
#debug { position: fixed; right: 8px; bottom: 8px; z-index: 20; background: rgba(14,15,24,0.9); color: var(--ink); border: 1px solid rgba(255,255,255,0.15); border-radius: 10px; padding: 8px 10px; font-size: 11px; width: 220px; }
#debug label { display: flex; justify-content: space-between; gap: 6px; margin: 3px 0; }
#debug input { width: 100px; }
#debug b { width: 34px; text-align: right; font-weight: 600; }
#dbgInfo { margin-top: 4px; color: var(--dim); }

.missions { text-align: left; margin-top: 8px; padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); }
.mh { display: flex; justify-content: space-between; font-size: 11px; letter-spacing: 2px; color: var(--dim); margin-bottom: 4px; }
.mh b { color: var(--accent); letter-spacing: 0.5px; font-size: 12px; }
.missions ul, ul.done { list-style: none; margin: 0; padding: 0; }
.missions li { font-size: 12.5px; line-height: 1.3; padding: 3px 0; display: flex; gap: 8px; justify-content: space-between; }
.missions li span { color: var(--dim); white-space: nowrap; }
.missions li.ok { color: var(--good); }
.missions li.ok span { color: var(--good); }
.how { color: var(--dim); font-size: 12px; line-height: 1.45; margin: 10px 4px 0; }

.cause { color: var(--dim); font-size: 14px; min-height: 18px; }
.score-big { font-size: 54px; font-weight: 900; color: #fff; text-shadow: 0 4px 0 rgba(0,0,0,0.35); margin: 2px 0; }
.near { font-size: 15px; color: var(--accent); font-weight: 700; min-height: 20px; }
.near.newbest { color: var(--good); font-size: 18px; letter-spacing: 2px; }
.stats { color: var(--dim); font-size: 13px; line-height: 1.6; margin: 8px 0 6px; }
ul.done li { color: var(--good); font-size: 13px; margin: 2px 0; }
ul.done li.rank { color: var(--accent); font-weight: 800; }
.unlock { color: var(--good); font-weight: 800; font-size: 14px; margin: 6px 0; }

#safe { position: fixed; left: 0; top: 0; width: 0; height: 0; visibility: hidden; pointer-events: none;
  padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
ul.board { list-style: none; margin: 8px auto 2px; padding: 0; max-width: 240px; text-align: left; }
ul.board li { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 3px 8px; border-radius: 8px; color: var(--dim); }
ul.board li i { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 10px; }
ul.board li span { flex: 1; }
ul.board li b { color: var(--dim); font-weight: 700; }
ul.board li.me { background: rgba(255,255,255,0.08); color: var(--ink); }
ul.board li.me b { color: var(--accent); }
.coinline { color: var(--accent); font-weight: 700; }
