* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root { --g: #111111; --g2: #f4f4f4; --y: #ffffff; --ink: #000000; }
html, body { height: 100%; overflow: hidden; background: #0a1020; color: #fff; font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; user-select: none; -webkit-user-select: none; overscroll-behavior: none; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; border: 0; cursor: pointer; }

/* ── HUD ── */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)); }
.hud-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.score { font-size: clamp(1.7rem, 6vw, 2.5rem); font-weight: 900; line-height: 1; text-shadow: 0 2px 0 rgba(0,0,0,.45), 0 0 14px rgba(0,0,0,.4); }
.score b { color: var(--y); font-size: .55em; margin-left: 8px; }
.sub { margin-top: 4px; font-weight: 800; font-size: clamp(.8rem, 3vw, 1rem); text-shadow: 0 2px 4px #000; }
.naira { color: var(--y); }
#zonechip { display: inline-block; margin-top: 6px; background: rgba(0,0,0,.45); backdrop-filter: blur(4px); border: 1px solid rgba(255,255,255,.35); padding: 4px 10px; border-radius: 999px; font-weight: 800; font-size: clamp(.68rem, 2.4vw, .85rem); text-align: left; max-width: 46vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-r { display: flex; gap: 8px; pointer-events: auto; }
.icon { width: 42px; height: 42px; border-radius: 12px; background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.4); font-size: 1rem; font-weight: 900; backdrop-filter: blur(4px); }
#powers { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; width: min(220px, 52vw); }
.pill { position: relative; display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; overflow: hidden; background: rgba(0,0,0,.55); border: 1.5px solid var(--c); font-weight: 800; font-size: .72rem; }
.pill em { font-style: normal; z-index: 1; white-space: nowrap; }
.pill span { z-index: 1; font-size: 1rem; }
.pill u { position: absolute; left: 0; top: 0; bottom: 0; background: var(--c); opacity: .35; text-decoration: none; transition: width .15s linear; }
@keyframes pulse { from { opacity: .75; } to { opacity: 1; } }
#toast { position: absolute; left: 50%; top: 24%; transform: translateX(-50%) scale(.9); max-width: 90vw; text-align: center; font-weight: 900; font-size: clamp(1rem, 4.4vw, 1.5rem); text-shadow: 0 2px 0 #000, 0 0 16px rgba(0,0,0,.7); opacity: 0; transition: opacity .2s, transform .2s; }
#toast.show { opacity: 1; transform: translateX(-50%) scale(1); }
#taunt { position: absolute; left: 50%; bottom: 17%; transform: translateX(-50%); max-width: 90vw; padding: 7px 14px; border-radius: 14px; background: #fff; color: #111; font-weight: 900; font-size: clamp(.8rem, 3.4vw, 1.05rem); border: 3px solid #111; opacity: 0; transition: opacity .2s; white-space: nowrap; }
#taunt.show { opacity: 1; }
#banner { position: absolute; left: 50%; top: max(62px, calc(env(safe-area-inset-top) + 54px)); transform: translate(-50%, -8px); text-align: center; opacity: 0; transition: opacity .4s, transform .4s; padding: 8px 18px; border-radius: 14px; background: linear-gradient(135deg, rgba(20,20,20,.94), rgba(0,0,0,.94)); border: 2px solid #fff; box-shadow: 0 8px 30px rgba(0,0,0,.5); max-width: min(92vw, 440px); }
#banner.show { opacity: 1; transform: translate(-50%, 0); }
#banner small { display: block; font-size: .65rem; letter-spacing: .2em; opacity: .85; font-weight: 800; }
#banner b { display: block; font-size: clamp(1.2rem, 5vw, 1.8rem); font-weight: 900; margin: 2px 0; }
#banner span { font-size: .8rem; opacity: .9; }

/* ── screens ── */
.screen { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom)); overflow-y: auto; }
#menu { background: linear-gradient(180deg, rgba(4,12,24,.55) 0%, rgba(4,12,24,0) 28%, rgba(4,12,24,0) 38%, rgba(4,12,24,.82) 66%, rgba(4,12,24,.94) 100%); pointer-events: none; }
#menu > * { pointer-events: none; }
#menu button, #menu .menu-panel { pointer-events: auto; }
.menu-head { text-align: center; }
.flag { display: flex; width: 74px; height: 8px; margin: 0 auto 8px; border-radius: 4px; overflow: hidden; }
.flag i { flex: 1; background: #111; } .flag i:nth-child(2) { background: #fff; }
h1 { font-size: clamp(2.1rem, 9vw, 3.4rem); line-height: .92; font-weight: 900; letter-spacing: .02em; text-shadow: 0 4px 0 rgba(0,0,0,.4), 0 0 24px rgba(0,0,0,.5); }
h1 span { color: #111; -webkit-text-stroke: 1px #fff; }
.tagline { font-size: clamp(.72rem, 2.8vw, .92rem); font-weight: 700; margin-top: 6px; text-shadow: 0 2px 4px #000; opacity: .95; }
.menu-panel { width: min(520px, 100%); text-align: center; }
.label { font-size: .68rem; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; opacity: .85; margin-bottom: 8px; }
.chars { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: none; }
.chars::-webkit-scrollbar { display: none; }
.char:first-child { margin-left: auto; } .char:last-child { margin-right: auto; }
.char { flex: 0 0 auto; width: 78px; padding: 8px 4px; border-radius: 14px; background: rgba(255,255,255,.1); border: 2px solid rgba(255,255,255,.28); backdrop-filter: blur(6px); transition: transform .12s, border-color .12s, background .12s; }
.char.locked { opacity: .72; }
.char em { display: block; font-style: normal; font-size: .55rem; font-weight: 800; margin-top: 2px; }
.char i { display: block; font-style: normal; font-size: 1.7rem; line-height: 1.1; }
.char b { display: block; font-size: .64rem; font-weight: 800; margin-top: 3px; line-height: 1.1; }
.char.sel { border-color: #fff; background: rgba(0,0,0,.82); transform: translateY(-4px) scale(1.05); box-shadow: 0 6px 18px rgba(0,0,0,.4); }
.info { margin: 2px 0 10px; }
.info h2 { font-size: 1.25rem; font-weight: 900; }
.ctag { font-size: .8rem; opacity: .9; font-weight: 700; }
.perk { font-size: .8rem; color: #fff; font-weight: 700; margin-top: 3px; text-shadow: 0 1px 3px #000; }
.charstory { font-size: .78rem; font-weight: 700; line-height: 1.35; margin: 8px 0 0; color: #e8e8e8; text-shadow: 0 1px 3px #000; }
.btn { display: block; width: 100%; padding: 14px; border-radius: 16px; font-weight: 900; font-size: 1.15rem; letter-spacing: .04em; }
.btn.go { background: linear-gradient(180deg, #2a2a2a, #111); border: 3px solid #fff; box-shadow: 0 6px 0 #000, 0 10px 24px rgba(0,0,0,.4); color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.35); animation: bob 1.4s ease-in-out infinite; }
.btn.go:active { transform: translateY(3px); box-shadow: 0 3px 0 #000; }
.btn.ghost { margin-top: 10px; background: rgba(255,255,255,.1); border: 2px solid rgba(255,255,255,.7); font-size: 1rem; }
@keyframes bob { 50% { transform: translateY(-2px); } }
.meta { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; font-size: .8rem; font-weight: 700; gap: 8px; }
.meta b { color: var(--y); }
.link { background: none; font-size: .8rem; font-weight: 700; opacity: .9; text-decoration: underline; }
.hint { margin-top: 8px; font-size: .7rem; opacity: .75; }

#over, #pause { justify-content: center; background: rgba(4,10,20,.72); backdrop-filter: blur(6px); }
.card { width: min(380px, 100%); text-align: center; padding: 22px 18px; border-radius: 22px; background: linear-gradient(160deg, #1a1a1a, #050505); border: 2.5px solid #fff; box-shadow: 0 18px 50px rgba(0,0,0,.55); }
.card.small { width: min(300px, 100%); }
.chip { display: inline-block; padding: 4px 12px; border-radius: 999px; background: #111; border: 1.5px solid #fff; font-size: .7rem; font-weight: 900; letter-spacing: .14em; }
#shop { z-index: 20; justify-content: center; background: rgba(0,0,0,.84); }
.shop-card { width: min(460px, 100%); max-height: min(92vh, 760px); overflow: auto; text-align: center; padding: 18px 14px 14px; border-radius: 22px; background: #0d0d0d; border: 2.5px solid #fff; }
.shop-card h2 { font-size: 1.3rem; margin: 6px 0; }
.shop-wallet { font-weight: 900; margin-bottom: 6px; }
.shop-msg { min-height: 1.2em; font-size: .8rem; font-weight: 800; margin-bottom: 8px; }
.shop-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; text-align: left; padding: 8px 10px; margin-bottom: 6px; border-radius: 12px; border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.06); }
.shop-row b { display: block; font-size: .82rem; }
.shop-row span { display: block; font-size: .68rem; opacity: .85; }
.shop-row .acts { display: flex; gap: 6px; flex: 0 0 auto; }
.shop-row button { padding: 8px 8px; border-radius: 10px; background: #fff; color: #111; font-weight: 900; font-size: .68rem; }
.shop-row button.on { background: #111; color: #fff; border: 1px solid #fff; }
#story { justify-content: flex-end; background: linear-gradient(180deg, rgba(0,0,0,.15), rgba(0,0,0,.88)); }
.story-card { width: min(460px, 100%); text-align: center; padding: 22px 18px 18px; border-radius: 22px; background: #0d0d0d; color: #fff; border: 2.5px solid #fff; box-shadow: 0 18px 50px rgba(0,0,0,.6); margin-bottom: 8px; }
.story-card h2 { font-size: 1.45rem; font-weight: 900; margin: 8px 0; }
#story-body { font-size: .95rem; font-weight: 700; line-height: 1.45; color: #eee; margin: 0 0 14px; }
.chip.bad { background: #c62828; }
.card h2 { font-size: 1.35rem; font-weight: 900; margin: 10px 0 4px; }
.reason { font-size: .85rem; opacity: .85; margin-bottom: 8px; min-height: 1em; }
.newbest { font-weight: 900; color: var(--y); margin-bottom: 6px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 14px; }
.grid div { background: rgba(0,0,0,.3); border: 1px solid rgba(255,255,255,.3); border-radius: 12px; padding: 9px 6px; }
.grid span { display: block; font-size: .65rem; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.grid b { font-size: 1.1rem; }

/* landscape / short screens: panel to the right so the 3D runner stays visible */
@media (orientation: landscape) and (max-height: 560px) {
  #menu { flex-direction: row; align-items: center; justify-content: space-between; background: linear-gradient(90deg, rgba(4,12,24,.55) 0%, rgba(4,12,24,0) 30%, rgba(4,12,24,0) 45%, rgba(4,12,24,.9) 70%); }
  .menu-head { align-self: flex-start; text-align: left; } .flag { margin-left: 0; }
  h1 { font-size: 1.9rem; } .menu-panel { width: min(400px, 52%); }
  .char { width: 64px; padding: 5px 2px; } .char i { font-size: 1.3rem; }
  .btn { padding: 10px; font-size: 1rem; } .hint, .tagline { display: none; }
}
@media (orientation: landscape) and (min-height: 561px) {
  #menu { flex-direction: row; align-items: center; justify-content: space-between; background: linear-gradient(90deg, rgba(4,12,24,.5) 0%, rgba(4,12,24,0) 35%, rgba(4,12,24,0) 45%, rgba(4,12,24,.88) 72%); padding: 24px 5vw; }
  .menu-head { align-self: flex-start; text-align: left; } .flag { margin-left: 0; }
  .menu-panel { width: min(440px, 44%); }
}
