/* Build Am! — mobile-first, Nigerian green + gold. */

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --green-dark: #063216;
  --green: #0d7a35;
  --green-mid: #0a5426;
  --gold: #ffd84d;
  --cream: #f4f9f4;
  --ink: #10231a;
  --card: #ffffff;
}

html, body, #app { height: 100%; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--green-dark);
  color: var(--cream);
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

.hidden { display: none !important; }
.screen { height: 100%; display: flex; flex-direction: column; }

/* ——— Onboarding ——— */
#screen-onboard { overflow-y: auto; background: linear-gradient(170deg, var(--green-dark), var(--green-mid)); }
.onboard-inner { max-width: 430px; margin: 0 auto; padding: 26px 18px 40px; display: flex; flex-direction: column; gap: 10px; }
.logo { font-size: 30px; text-align: center; margin-bottom: 4px; color: var(--gold); }
#screen-onboard h1 { font-size: 22px; text-align: center; }
#screen-onboard p { text-align: center; color: #bfe8cd; font-size: 15px; line-height: 1.45; }
#screen-onboard label { margin-top: 10px; font-weight: 700; font-size: 14px; color: var(--gold); }
#screen-onboard input {
  padding: 13px 14px; border-radius: 12px; border: 2px solid var(--green);
  background: #052711; color: var(--cream); font-size: 17px; outline: none;
}
#screen-onboard input:focus { border-color: var(--gold); }
.state-list { display: flex; flex-direction: column; gap: 7px; max-height: 42vh; overflow-y: auto; border-radius: 12px; }
.state-opt {
  text-align: left; padding: 10px 12px; border-radius: 11px; border: 2px solid transparent;
  background: #0a4520; color: var(--cream); font-size: 14px; cursor: pointer;
  display: flex; flex-direction: column; gap: 2px;
}
.state-opt small { color: #a7d8ba; font-size: 12px; }
.state-opt em { color: var(--gold); font-style: normal; font-size: 12px; font-weight: 700; }
.state-opt.sel { border-color: var(--gold); background: var(--green-mid); }

/* ——— Buttons ——— */
button { font-family: inherit; cursor: pointer; border: none; }
.primary {
  background: linear-gradient(180deg, #17a34a, #0d7a35); color: #fff; font-weight: 800;
  border-radius: 13px; padding: 12px 16px; font-size: 16px;
  box-shadow: 0 3px 0 #05471d;
}
.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 #05471d; }
.primary:disabled { opacity: 0.45; }
.primary.big { width: 100%; margin-top: 12px; }
.btn-link { display: block; text-align: center; text-decoration: none; }
.ghost {
  width: 100%; margin-top: 8px; background: transparent; color: #6f8f7d;
  padding: 10px; font-size: 14px; border-radius: 10px;
}
.ghost.danger { color: #d9534f; }

/* ——— HUD ——— */
#hud {
  background: linear-gradient(180deg, #04240f, var(--green-mid));
  padding: calc(6px + env(safe-area-inset-top)) 10px 6px;
  display: flex; flex-direction: column; gap: 3px;
  border-bottom: 2px solid #0f5c2c;
}
.hud-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.res { font-size: 14px; font-weight: 700; white-space: nowrap; }
.hud-row.sub .res { font-size: 12.5px; color: #bfe8cd; font-weight: 600; }
.rate { color: #8fd6a8; font-weight: 600; font-size: 12.5px; }
.rank-chip {
  background: var(--gold); color: #4a3800; font-size: 12px; font-weight: 800;
  border-radius: 20px; padding: 3px 10px;
}
#r-eff.good { color: #6ee79a; } #r-eff.warn { color: var(--gold); } #r-eff.bad { color: #ff7b6b; }

/* ——— Wahala banner ——— */
#wahala-banner {
  background: linear-gradient(90deg, #a3230f, #d9542b); color: #fff; font-weight: 800;
  padding: 10px; font-size: 14px; width: 100%;
  animation: pulse 1.6s infinite;
}
@keyframes pulse { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.25); } }

/* ——— Map ——— */
#map-wrap { flex: 1; position: relative; background: #6da84e; min-height: 0; }
#map { width: 100%; height: 100%; display: block; touch-action: manipulation; }
#hint {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  background: rgba(4,36,15,0.92); color: var(--gold); padding: 9px 16px;
  border-radius: 20px; font-size: 13.5px; font-weight: 700; white-space: nowrap;
}

/* ——— Nav ——— */
#nav {
  display: flex; background: #04240f; border-top: 2px solid #0f5c2c;
  padding-bottom: env(safe-area-inset-bottom);
}
#nav button {
  flex: 1; background: none; color: #a7d8ba; padding: 8px 2px 9px;
  display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 11px; font-weight: 700;
}
#nav button i { font-style: normal; font-size: 21px; }

/* ——— Toasts ——— */
#toasts {
  position: fixed; top: 74px; left: 0; right: 0; z-index: 60;
  display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none;
}
.toast {
  background: rgba(4,36,15,0.95); color: #fff; border: 1px solid #1a8a3c;
  padding: 9px 16px; border-radius: 20px; font-size: 13.5px; font-weight: 700;
  opacity: 0; transform: translateY(-8px); transition: all 0.3s; max-width: 88vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ——— Modal ——— */
#modal {
  position: fixed; inset: 0; z-index: 50; background: rgba(2,18,8,0.72);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-box {
  background: var(--cream); color: var(--ink); width: 100%; max-width: 460px;
  border-radius: 20px 20px 0 0; padding: 20px 16px calc(18px + env(safe-area-inset-bottom));
  max-height: 86vh; overflow-y: auto; animation: rise 0.22s ease-out;
}
@keyframes rise { from { transform: translateY(40px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.modal-x {
  position: sticky; top: 0; float: right; margin: -6px -2px 0 8px; z-index: 2;
  width: 32px; height: 32px; border-radius: 50%; background: #e4ede6; color: #5c7466;
  font-size: 15px; font-weight: 800;
}
.modal-box h2 { font-size: 19px; display: flex; align-items: center; gap: 8px; }
.modal-box p { font-size: 14.5px; line-height: 1.5; margin-top: 8px; }
.muted { color: #5c7466; font-size: 13px !important; }
.stats { font-weight: 700; color: var(--green-mid); }
.celebrate { font-size: 52px; text-align: center; }
.big-earn { font-size: 22px; font-weight: 800; text-align: center; color: var(--green); }
.chip { width: 16px; height: 16px; border-radius: 5px; display: inline-block; flex-shrink: 0; }

/* ——— Build & lesson lists ——— */
.build-list, .lesson-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.build-opt, .lesson-opt {
  display: flex; align-items: center; gap: 10px; text-align: left;
  background: #fff; border: 2px solid #dce9df; border-radius: 13px; padding: 11px 12px; font-size: 14px;
}
.build-opt:active, .lesson-opt:active { border-color: var(--green); }
.build-opt.locked { opacity: 0.75; background: #eef3ee; }
.build-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.build-info b { font-size: 14.5px; }
.build-info small { color: #5c7466; font-size: 12.5px; line-height: 1.35; }
.build-info em { color: #b0641c; font-style: normal; font-size: 12px; font-weight: 700; }
.lesson-opt.done { background: #eaf6ec; border-color: #bfe0c6; }
.lesson-opt.legacy { background: #fdf7e3; border-color: #ecd98f; }
.tag {
  background: var(--green-mid); color: #fff; font-size: 11px; font-weight: 800;
  padding: 3px 8px; border-radius: 12px; flex-shrink: 0;
}
.legacy-tag { background: #b0641c; }
.go { color: var(--green); font-weight: 800; font-size: 13px; flex-shrink: 0; }

/* ——— Lessons & quiz ——— */
.lesson-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lesson-page {
  background: #fff; border: 2px solid #dce9df; border-radius: 13px; padding: 14px;
  margin-top: 12px; font-size: 15px; line-height: 1.6;
}
.dots { display: flex; gap: 6px; justify-content: center; margin-top: 12px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: #c6d6ca; }
.dots i.on { background: var(--green); }
.qq { font-size: 16.5px !important; line-height: 1.45; margin-top: 6px; }
.quiz-opts { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.quiz-opt {
  text-align: left; background: #fff; border: 2px solid #dce9df; border-radius: 12px;
  padding: 12px 13px; font-size: 14.5px; line-height: 1.4;
}
.quiz-opt.right { border-color: var(--green); background: #e2f5e6; font-weight: 700; }
.quiz-opt.wrong { border-color: #d9534f; background: #fbe9e8; }
.quiz-opt.off { pointer-events: none; }
.why {
  background: #e2f5e6; border-radius: 10px; padding: 10px 12px; font-size: 13.5px !important;
  color: #14522a; margin-top: 10px;
}
.tips { background: #fdf3e3; border-radius: 10px; padding: 8px 12px; margin-top: 8px; }
.tips p { margin: 4px 0; font-size: 13.5px; font-weight: 700; color: #7a4a10; }

/* ——— Leaderboard ——— */
.board { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.board-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 11px;
  background: #fff; border-radius: 10px; font-size: 14px;
}
.board-row.me { background: #ffeeb8; font-weight: 800; border: 2px solid var(--gold); }
.board-row .pos { width: 24px; font-weight: 800; color: #5c7466; }
.board-row .nm { flex: 1; }
.board-row .sc { font-weight: 700; color: var(--green-mid); }

/* ——— Share ——— */
.share-img { width: 100%; border-radius: 14px; margin-top: 12px; }

/* ——— Settings ——— */
.modal-box label { display: block; margin-top: 12px; font-weight: 800; font-size: 13px; color: var(--green-mid); }
.lang-row { display: flex; gap: 8px; margin-top: 8px; }
.lang {
  flex: 1; padding: 11px; border-radius: 11px; border: 2px solid #dce9df;
  background: #fff; font-size: 14.5px; font-weight: 700;
}
.lang.sel { border-color: var(--green); background: #e2f5e6; }

@media (min-width: 700px) {
  #screen-game { max-width: 460px; margin: 0 auto; width: 100%; border-left: 2px solid #0f5c2c; border-right: 2px solid #0f5c2c; }
}
