/* ENT Run — styles. Chunky, playful, right-to-left. */
:root {
  --bg: #1a1226;
  --card: #261a38;
  --card2: #33244a;
  --line: #4a3668;
  --text: #f5eefc;
  --dim: #b7a6cf;
  --gold: #ffd166;
  --ok: #5fe0a0;
  --bad: #ff7b8a;
  --accent: #ffd166;
  --pixel: 'Heebo', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); overflow: hidden;
  font-family: 'Heebo', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif; font-size: 16px; line-height: 1.55;
  -webkit-text-size-adjust: 100%; touch-action: manipulation;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
bdi { unicode-bidi: isolate; }
[hidden] { display: none !important; }

#wrap { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 8px; }
#stage { position: relative; border-radius: 14px; overflow: hidden; box-shadow: 0 0 0 4px #2b1524, 0 18px 50px rgba(0, 0, 0, .55); background: #2b1524; }
#game { display: block; width: 100%; height: 100%; image-rendering: pixelated; touch-action: none; }

/* ---------- HUD ---------- */
#hud { position: absolute; top: 8px; inset-inline: 54px; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; pointer-events: none; direction: rtl; }
.hud-box { background: rgba(26, 14, 36, .78); border: 2px solid #2b1524; border-radius: 10px; padding: 3px 12px 4px; text-align: center; min-width: 74px; box-shadow: 0 3px 0 rgba(0, 0, 0, .35); }
.hud-box small:empty { display: none; }
.hud-box small { display: block; font-size: .68rem; color: var(--dim); line-height: 1.2; }
.hud-box b { font-family: var(--pixel); font-size: 1.25rem; line-height: 1.15; font-weight: 800; direction: ltr; display: block; }
.hud-box.score b { color: var(--gold); }
.hud-box.zone { border-color: var(--accent); }
.hud-box.zone b { font-family: 'Heebo', sans-serif; font-weight: 800; font-size: .95rem; direction: rtl; }
.corner { position: absolute; top: 8px; width: 38px; height: 38px; border-radius: 10px; background: rgba(26, 14, 36, .78); border: 2px solid #2b1524; font-size: 1.05rem; display: grid; place-items: center; z-index: 4; }
#pauseBtn { inset-inline-start: 8px; }
#muteBtn { inset-inline-end: 8px; }
#banner { position: absolute; top: 24%; inset-inline: 0; text-align: center; pointer-events: none; opacity: 0; transform: translateY(-10px) scale(.96); transition: opacity .25s, transform .25s; }
#banner.on { opacity: 1; transform: none; }
#banner b { display: block; font-size: clamp(1.3rem, 4.2vw, 2.2rem); font-weight: 800; text-shadow: 0 3px 0 #2b1524, 0 0 18px rgba(0, 0, 0, .6); }
#banner small { display: inline-block; margin-top: 2px; font-size: clamp(.8rem, 2vw, 1rem); background: rgba(26, 14, 36, .8); padding: 1px 12px; border-radius: 99px; }
#count { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; font-family: var(--pixel); font-weight: 800; font-size: clamp(4rem, 16vw, 8rem); color: #fff; text-shadow: 0 6px 0 #2b1524; }

/* ---------- Menu ---------- */
.layer { position: absolute; inset: 0; display: grid; place-items: center; padding: 10px; overflow-y: auto; }
.card { background: var(--card); border: 3px solid #2b1524; border-radius: 16px; box-shadow: 0 6px 0 rgba(0, 0, 0, .35); }
.menu-card { width: min(94%, 520px); max-height: 100%; overflow-y: auto; padding: 14px 18px 12px; text-align: center; }
.menu-card.small { width: min(90%, 320px); padding: 18px; }
.menu-card h1 { margin: 0; font-family: var(--pixel); font-weight: 800; font-size: clamp(1.7rem, 6vw, 2.6rem); line-height: 1.15; color: var(--gold); text-shadow: 0 3px 0 #2b1524; }
.tag { margin: 0 0 6px; color: var(--dim); font-size: .8rem; letter-spacing: .12em; direction: ltr; }
.who { margin: 4px 0 6px; font-weight: 700; }
.runners { display: flex; gap: 10px; justify-content: center; }
.runner { flex: 1; max-width: 170px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 6px 6px; border-radius: 14px; background: var(--card2); border: 3px solid var(--line); transition: transform .12s, border-color .12s; }
.runner img { height: clamp(60px, 15vh, 112px); image-rendering: pixelated; }
.runner b { font-size: 1.05rem; }
.runner:hover { transform: translateY(-2px); }
.runner.on { border-color: var(--gold); background: #46305f; box-shadow: 0 0 0 2px var(--gold) inset; }
.go { display: block; width: 100%; margin-top: 10px; padding: 11px 16px; border-radius: 12px; font-weight: 800; font-size: 1.1rem; color: #2b1524;
  background: linear-gradient(180deg, #ffe08f, var(--gold) 55%, #e0a93a); border: 3px solid #2b1524; box-shadow: 0 4px 0 #2b1524; transition: transform .08s, box-shadow .08s; }
.go:active { transform: translateY(3px); box-shadow: 0 1px 0 #2b1524; }
.link { margin-top: 10px; color: var(--dim); text-decoration: underline; font-size: .9rem; }
.how { margin: 8px 0 0; font-size: .86rem; }
.how.dim { color: var(--dim); font-size: .8rem; line-height: 1.45; }
.stats { margin: 6px 0 0; font-size: .82rem; color: var(--dim); }
.stats b { color: var(--text); }
.kbd { display: inline-block; min-width: 1.6em; padding: 0 6px; border-radius: 6px; border: 2px solid var(--line); background: var(--card2); font-size: .78rem; font-weight: 700; }

/* ---------- Touch buttons ---------- */
#pad { display: flex; gap: 12px; width: 100%; max-width: 560px; direction: ltr; }
.pad-btn { flex: 1; height: 118px; border-radius: 18px; font-weight: 800; font-size: 1.05rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  border: 3px solid #2b1524; box-shadow: 0 5px 0 #2b1524; touch-action: none; user-select: none; -webkit-user-select: none; }
.pad-btn span { font-size: 2rem; line-height: 1.1; }
.pad-btn.jump { background: linear-gradient(180deg, #ffe08f, var(--gold)); color: #2b1524; }
.pad-btn.slide { background: linear-gradient(180deg, #9ad1ff, #62a8ef); color: #12233a; }
.pad-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #2b1524; }

/* ---------- Question ---------- */
#quiz { position: fixed; inset: 0; z-index: 20; background: rgba(14, 8, 22, .9); overflow-y: auto; padding: 12px 10px 90px; -webkit-overflow-scrolling: touch; }
.quiz-card { max-width: 760px; margin: 0 auto; background: var(--card); border: 3px solid #2b1524; border-top: 6px solid var(--accent); border-radius: 16px; padding: 14px; }
.quiz-top { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.chip { background: var(--accent); color: #2b1524; font-weight: 800; font-size: .86rem; padding: 2px 12px; border-radius: 99px; }
.bump { font-size: .86rem; color: var(--dim); }
.bump b { color: var(--text); }
.stem { font-size: 1.05rem; line-height: 1.75; }
.qimg { display: block; max-width: 100%; max-height: 42vh; margin: 12px auto 0; border-radius: 10px; background: #fff; border: 2px solid var(--line); cursor: zoom-in; }
.qimg.zoom { max-height: none; width: 100%; cursor: zoom-out; }
.opts { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 11px 12px; border-radius: 12px; text-align: start; line-height: 1.6; background: var(--card2); border: 2px solid var(--line); transition: border-color .12s, background .12s; }
.opt[data-opt]:hover { border-color: var(--accent); background: #3e2c5a; }
.letter { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .9rem; background: rgba(255, 255, 255, .1); }
.opt.right { background: rgba(95, 224, 160, .16); border-color: var(--ok); }
.opt.right .letter { background: var(--ok); color: #0b2b1c; }
.opt.wrong { background: rgba(255, 123, 138, .14); border-color: var(--bad); }
.opt.wrong .letter { background: var(--bad); color: #3a0c14; }
.opt:disabled:not(.right):not(.wrong) { opacity: .6; }
.verdict { margin-top: 12px; padding: 11px 14px; border-radius: 12px; }
.verdict.ok { background: rgba(95, 224, 160, .14); border: 2px solid var(--ok); }
.verdict.bad { background: rgba(255, 123, 138, .13); border: 2px solid var(--bad); }
.verdict b { font-size: 1.1rem; }
.exp { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: #1f152e; border: 2px solid var(--line); }
.exp-head { font-size: .78rem; color: var(--dim); margin-bottom: 6px; }
.exp h4 { margin: 0 0 8px; font-size: 1.02rem; line-height: 1.45; color: var(--gold); }
.exp p { margin: 0 0 10px; line-height: 1.75; }
.exp p:last-child { margin-bottom: 0; }
.exp [dir='ltr'] { text-align: left; }
.quiz-bar { position: fixed; inset-inline: 0; bottom: 0; padding: 22px 12px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, transparent, rgba(14, 8, 22, .96) 40%); }
.quiz-bar .go { max-width: 736px; margin: 0 auto; }
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }

@media (max-width: 560px) {
  #wrap { justify-content: flex-start; padding-top: 6px; }
  .hud-box { min-width: 56px; padding: 2px 8px 3px; }
  .hud-box b { font-size: 1.02rem; }
  .hud-box.zone b { font-size: .8rem; }
  #hud { inset-inline: 48px; }
  .menu-card { padding: 10px 12px 8px; }
  .how.dim { display: none; }
}

/* The menu covers the whole screen, so it never has to fit inside the small game picture. */
#menu.layer { position: fixed; z-index: 10; background: rgba(20, 10, 30, .55); }

/* ---------- Helpers ---------- */
/* The timer of the helper who is running along. */
#power { position: absolute; top: 62px; left: 50%; transform: translateX(-50%); min-width: 190px; padding: 3px 12px 6px; text-align: center; pointer-events: none;
  background: rgba(26, 14, 36, .84); border: 2px solid var(--pc, #fff); border-radius: 10px; box-shadow: 0 3px 0 rgba(0, 0, 0, .35); }
#power b { display: block; font-size: .86rem; font-weight: 800; white-space: nowrap; }
#power i { display: block; height: 6px; margin-top: 2px; border-radius: 99px; background: rgba(255, 255, 255, .16); overflow: hidden; direction: ltr; }
#power u { display: block; height: 100%; width: 100%; background: var(--pc, #fff); border-radius: 99px; }
#power.low { animation: blink .5s steps(2) infinite; }
@keyframes blink { 50% { opacity: .45; } }
#pad.auto { opacity: .4; }
.who.small { margin: 10px 0 5px; font-size: .84rem; font-weight: 500; color: var(--dim); }
.helpers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.helper { display: flex; flex-direction: column; align-items: center; padding: 5px 2px 4px; border-radius: 10px; background: var(--card2); border: 2px solid var(--line); border-bottom-color: var(--pc); }
.helper img { height: clamp(40px, 8vh, 58px); image-rendering: pixelated; }
.helper b { font-size: .84rem; line-height: 1.25; }
.helper small { font-size: .66rem; color: var(--dim); line-height: 1.25; white-space: nowrap; }
@media (max-width: 560px) {
  #power { top: 52px; min-width: 160px; }
  #power b { font-size: .76rem; }
}
