@font-face {
  font-family: 'Fredoka';
  src: url('../shared/fonts/fredoka.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --bg: #2a1a12;
  --ink: #fff8ec;
  --muted: #d9c6b0;
  --panel: rgba(32, 18, 10, 0.86);
  --card: #3a2416;
  --line: rgba(255, 255, 255, 0.1);
  --gold: #ffd23f;
  --red: #e94f37;
  --green: #36c26b;
  --orange: #f0822b;
}

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

/* ---------- HUD ---------- */
.hud { position: fixed; inset: 0; pointer-events: none; padding: max(8px, env(safe-area-inset-top)) 10px 0; }
.hud-top { display: grid; grid-template-columns: 42px 44px 1fr 54px; gap: 8px; align-items: center; max-width: 520px; margin: 0 auto; }
.round {
  pointer-events: auto; width: 42px; height: 42px; border-radius: 14px; border: 0; cursor: pointer;
  background: var(--panel); display: grid; place-items: center;
}
.round svg { width: 22px; height: 22px; stroke: var(--ink); stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.mama-face { width: 44px; height: 44px; border-radius: 50%; background: #f6e3c8; border: 2px solid var(--gold); }
.till { background: var(--panel); border-radius: 14px; padding: 5px 10px 7px; }
.till-row { display: flex; align-items: baseline; gap: 2px; }
.naira { color: var(--gold); font-weight: 700; }
.till-row b { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; }
.till-row small { margin-left: auto; color: var(--muted); font-size: 13px; font-weight: 500; }
.goal { position: relative; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.15); margin-top: 3px; }
.goal i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: inherit; background: var(--orange); transition: width 0.25s, background 0.3s; }
.goal i.passed { background: var(--green); }
.goal .mark { position: absolute; top: -3px; width: 3px; height: 14px; background: var(--ink); border-radius: 2px; opacity: 0.85; }
.clock { position: relative; width: 54px; height: 54px; background: var(--panel); border-radius: 16px; display: grid; place-items: center; }
.clock svg { position: absolute; inset: 5px; width: 44px; height: 44px; transform: rotate(-90deg); }
.clock circle { fill: none; stroke-width: 4; }
.clock .track { stroke: rgba(255, 255, 255, 0.15); }
.clock .hand { stroke: var(--gold); stroke-linecap: round; stroke-dasharray: 94.25; stroke-dashoffset: 0; transition: stroke-dashoffset 0.25s linear; }
.clock.low .hand { stroke: var(--red); }
.clock span { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.strikes { display: flex; gap: 6px; justify-content: center; margin-top: 6px; }
.strikes i { width: 22px; height: 22px; border-radius: 50%; background: var(--panel); border: 2px solid rgba(255, 255, 255, 0.4); }
.strikes i.gone { background: var(--red); border-color: var(--red); }
.vs { margin: 6px auto 0; max-width: 520px; background: var(--panel); border-radius: 12px; padding: 5px 10px; font-size: 14px; display: flex; justify-content: space-between; }
.quip {
  position: absolute; top: calc(max(8px, env(safe-area-inset-top)) + 58px); left: 50%; transform: translateX(-50%);
  background: #fffdf7; color: #2a1a12; font-weight: 600; font-size: 15px; padding: 7px 14px; border-radius: 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3); white-space: nowrap; animation: pop 0.25s ease;
}
@keyframes pop { from { transform: translateX(-50%) scale(0.6); opacity: 0; } }

.banner {
  position: fixed; left: 50%; top: 34%; transform: translate(-50%, -50%) rotate(-3deg); z-index: 40; pointer-events: none;
  background: var(--red); color: #fff; padding: 10px 22px 12px; border-radius: 16px; text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); border: 3px solid #fff; animation: slam 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.banner small { display: block; font-size: 13px; font-weight: 600; letter-spacing: 1.5px; opacity: 0.9; }
.banner b { display: block; font-size: 30px; font-weight: 700; line-height: 1.05; }
.banner.good { background: var(--green); }
.banner.gold { background: #d9a521; color: #2a1a12; }
@keyframes slam { from { transform: translate(-50%, -50%) rotate(-3deg) scale(2.2); opacity: 0; } }

.coach {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 30; pointer-events: none;
  background: var(--gold); color: #2a1a12; font-weight: 700; font-size: 16px; padding: 9px 16px; border-radius: 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4); white-space: nowrap; animation: bob 1s ease-in-out infinite alternate;
}
@keyframes bob { to { margin-top: -5px; } }

/* ---------- screens ---------- */
.screen {
  position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  overflow-y: auto; touch-action: pan-y;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: radial-gradient(120% 80% at 50% 0%, #5a3320, #2a1a12 70%);
}
.screen.scroll { justify-content: flex-start; overflow-y: auto; touch-action: pan-y; }
.title-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 12px; text-align: center; margin: auto 0; }
#titleArt { width: 100%; max-width: 320px; aspect-ratio: 640 / 420; margin: 0 auto -6px; }
h1 { margin: 0; font-size: 44px; line-height: 0.95; font-weight: 700; letter-spacing: -0.5px; color: #fff3d6; text-shadow: 0 4px 0 #8a2f1a; }
h1 span { color: var(--gold); }
.hello { margin: 0; color: var(--muted); font-size: 16px; }
.wallet { display: inline-flex; gap: 4px; align-items: baseline; justify-content: center; font-size: 18px; }
.wallet b { font-size: 22px; font-variant-numeric: tabular-nums; }
.wallet small { color: var(--muted); font-size: 14px; margin-left: 4px; }
.wallet.mini { background: var(--panel); padding: 6px 12px; border-radius: 12px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.row.small { justify-content: center; gap: 16px; }
.row.small > * { flex: none; }
.btn {
  border: 0; border-radius: 16px; padding: 13px 14px; font-size: 17px; font-weight: 600; cursor: pointer;
  background: rgba(255, 255, 255, 0.1); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25);
}
.btn:active { transform: translateY(2px); }
.btn.big { font-size: 21px; padding: 16px; }
.btn.primary { background: linear-gradient(#ffb43b, #f0822b); color: #2a1a12; box-shadow: inset 0 -4px 0 #b9541a; }
.btn.green { background: linear-gradient(#4fd780, #2aa75a); color: #0f2a19; box-shadow: inset 0 -4px 0 #1d7a40; }
.btn.naija { background: linear-gradient(#ffe27a, #ffcc33); color: #2a1a12; box-shadow: inset 0 -4px 0 #c49512; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.btn small { display: block; font-size: 12px; font-weight: 500; opacity: 0.8; }
.link { background: none; border: 0; color: var(--muted); font-size: 14px; text-decoration: underline; cursor: pointer; padding: 4px; }

.bar { width: 100%; max-width: 520px; display: grid; grid-template-columns: 42px 1fr auto; gap: 10px; align-items: center; margin-bottom: 12px; }
.bar h2 { margin: 0; font-size: 22px; }

/* map */
#mapList { width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 14px; padding-bottom: 20px; }
.place { background: var(--card); border-radius: 18px; padding: 12px; border: 1px solid var(--line); }
.place h3 { margin: 0; font-size: 19px; }
.place p { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.place.locked { opacity: 0.55; }
.days { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.day {
  border: 0; border-radius: 14px; padding: 8px 0 6px; background: rgba(255, 255, 255, 0.08); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 17px; font-weight: 700;
}
.day.next { background: var(--orange); color: #2a1a12; }
.day[disabled] { opacity: 0.4; pointer-events: none; }
.stars { font-size: 11px; letter-spacing: 1px; color: var(--gold); }
.stars .off { color: rgba(255, 255, 255, 0.25); }

/* shop */
.tabs { width: 100%; max-width: 520px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: rgba(0, 0, 0, 0.3); border-radius: 14px; padding: 4px; margin-bottom: 12px; }
.tabs button { border: 0; background: transparent; padding: 9px 2px; border-radius: 10px; font-size: 15px; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button.on { background: var(--ink); color: #2a1a12; }
.shop-list { width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 10px; padding-bottom: 24px; }
.item { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px; }
.item canvas { width: 64px; height: 64px; border-radius: 12px; background: rgba(0, 0, 0, 0.25); }
.item h4 { margin: 0; font-size: 17px; }
.item p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.pips { display: flex; gap: 4px; margin-top: 5px; }
.pips i { width: 16px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.2); }
.pips i.on { background: var(--gold); }
.item .btn { padding: 9px 12px; font-size: 15px; min-width: 92px; }
.item.current { border-color: var(--gold); }
.note { color: var(--muted); font-size: 13px; text-align: center; margin: 4px 0 0; }

/* sheets */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(10, 5, 2, 0.6); display: grid; place-items: center; padding: 16px; touch-action: pan-y; }
.card {
  width: 100%; max-width: 390px; max-height: 100%; overflow-y: auto; background: var(--card); border-radius: 22px; padding: 18px;
  display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--line); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  animation: rise 0.25s ease;
}
@keyframes rise { from { transform: translateY(20px); opacity: 0; } }
.card h2 { margin: 0; font-size: 26px; text-align: center; }
.card .sub { margin: -6px 0 2px; text-align: center; color: var(--muted); }
.how { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: 15px; line-height: 1.35; }
.how b { color: var(--ink); }
.target { display: flex; justify-content: center; gap: 6px; align-items: baseline; font-size: 18px; }
.target b { font-size: 30px; color: var(--gold); }
.news { background: rgba(255, 255, 255, 0.06); border-radius: 14px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; }
.news canvas { width: 46px; height: 46px; flex: none; }
.news b { display: block; font-size: 15px; }
.news span { color: var(--muted); font-size: 14px; }
.big-stars { display: flex; justify-content: center; gap: 8px; margin: 2px 0; }
.big-stars svg { width: 54px; height: 54px; fill: rgba(255, 255, 255, 0.15); }
.big-stars svg.on { fill: var(--gold); animation: star 0.45s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
.big-stars svg.on:nth-child(2) { animation-delay: 0.25s; }
.big-stars svg.on:nth-child(3) { animation-delay: 0.5s; }
@keyframes star { from { transform: scale(0) rotate(-40deg); } }
.tally { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 16px; background: rgba(0, 0, 0, 0.2); border-radius: 14px; padding: 10px 14px; }
.tally span { color: var(--muted); }
.tally b { text-align: right; font-variant-numeric: tabular-nums; }
.tally .total { border-top: 1px solid var(--line); padding-top: 6px; color: var(--ink); font-size: 18px; }

.board { display: flex; flex-direction: column; gap: 4px; }
.board div { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; padding: 6px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); font-size: 15px; }
.board div.me { background: rgba(255, 210, 63, 0.18); }
.board b { font-variant-numeric: tabular-nums; }

.battle-body { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 12px; }
.battle-body .lead { color: var(--muted); text-align: center; margin: 0; font-size: 15px; }
.stakes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; min-width: 0; border-radius: 14px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.3); color: var(--ink); font: inherit; font-size: 18px; padding: 10px 12px; text-transform: uppercase; touch-action: manipulation; user-select: text; -webkit-user-select: text; }
.waiting { text-align: center; padding: 18px; background: var(--card); border-radius: 18px; }
.waiting b { font-size: 34px; letter-spacing: 6px; color: var(--gold); display: block; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 90;
  background: #fffdf7; color: #2a1a12; padding: 10px 16px; border-radius: 14px; font-weight: 600; font-size: 15px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); max-width: 90vw; text-align: center;
}

/* short screens, like the Lagos Life game window: everything still fits */
@media (max-height: 780px) {
  #titleArt { max-width: 230px; }
  h1 { font-size: 36px; }
  .title-card { gap: 9px; }
  .btn { padding: 11px 12px; }
  .btn.big { padding: 13px; font-size: 19px; }
}
@media (max-height: 640px) {
  #titleArt { max-width: 170px; margin-bottom: -10px; }
  h1 { font-size: 31px; }
  .hello { font-size: 14px; }
  .title-card { gap: 7px; }
  .btn { padding: 9px 10px; font-size: 16px; }
  .btn.big { padding: 11px; font-size: 18px; }
}
