/* Egg Hunt: Sadat English Club
   Themes are switched with body[data-theme] and match the printed posters. */

:root {
  --navy: #0a1b3d;
  --navy2: #12295a;
  --card: #0d2150;
  --card-line: rgba(255,255,255,.14);
  --white: #fff;
  --ok: #3ddc84;
  --bad: #ff5d5d;
  --font-d: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
  --font-b: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* theme vars (default = B2 poster: royal blue / orange / lime) */
  --bg1: #0b2a8a; --bg2: #061a55;
  --accent: #ff7a1a; --accent2: #d6ff1f;
  --on-bg: #fff; --on-accent: #0a1b3d;
  --glow: rgba(255,122,26,.35);
}
body[data-theme="grammar"] { --bg1:#0e2a55; --bg2:#050f26; --accent:#ff7a1a; --accent2:#32c5ff; --glow:rgba(50,197,255,.35); }
body[data-theme="context"] { --bg1:#1646c8; --bg2:#0a1b5e; --accent:#ffc61a; --accent2:#ff8a1f; --on-accent:#0a1b3d; --glow:rgba(255,198,26,.35); }
body[data-theme="vocab"]   { --bg1:#ffd21a; --bg2:#ff9d1a; --accent:#1646c8; --accent2:#ff7a1a; --on-bg:#0a1b3d; --on-accent:#fff; --glow:rgba(22,70,200,.35); }
body[data-theme="colloc"]  { --bg1:#10224a; --bg2:#050d22; --accent:#ffb21a; --accent2:#ff6a1a; --glow:rgba(255,178,26,.4); }
body[data-theme="final"]   { --bg1:#10224a; --bg2:#050c1f; --accent:#ffd34d; --accent2:#ff9d1a; --glow:rgba(255,211,77,.5); }

* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh; min-height: 100dvh;
  font-family: var(--font-b); font-weight: 600; font-size: 17px; line-height: 1.4;
  color: var(--on-bg);
  background: radial-gradient(120% 80% at 50% 0%, var(--bg1), var(--bg2)) fixed;
  overflow-x: hidden;
  transition: background .4s;
}

/* diagonal decor like the posters */
.bg-decor { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.bg-decor i { position: absolute; width: 60vmax; height: 14px; background: var(--accent); opacity: .85; transform: rotate(-35deg); border-radius: 4px; }
.bg-decor i:nth-child(1) { top: 8%;  left: -30vmax; }
.bg-decor i:nth-child(2) { top: 14%; left: -34vmax; height: 6px; background: var(--accent2); }
.bg-decor i:nth-child(3) { bottom: 10%; right: -30vmax; }
.bg-decor i:nth-child(4) { bottom: 16%; right: -34vmax; height: 6px; background: var(--accent2); }

#app { position: relative; z-index: 1; max-width: 640px; margin: 0 auto; padding: 14px 16px 40px; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }

/* ---------- type ---------- */
h1, h2, h3, .display { font-family: var(--font-d); font-weight: 800; font-style: italic; text-transform: uppercase; letter-spacing: .02em; line-height: 1; }
.title { font-size: clamp(3.4rem, 17vw, 5.6rem); color: var(--white); text-shadow: 0 4px 0 rgba(0,0,0,.35), 0 0 30px var(--glow); }
.title b { color: var(--accent); font-weight: 800; }
body[data-theme="vocab"] .title { color: var(--navy); text-shadow: 0 3px 0 rgba(255,255,255,.4); }
h2 { font-size: 2rem; }
h3 { font-size: 1.35rem; }
.muted { opacity: .8; font-weight: 500; }
.center { text-align: center; }

/* ---------- layout bits ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0 10px; }
.topbar .brand { display: flex; align-items: center; gap: 10px; }
.topbar img { width: 46px; height: 46px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,.25); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: rgba(0,0,0,.35); color: #fff; font-size: .85rem; font-weight: 700; border: 1px solid var(--card-line); white-space: nowrap; }
.chip.accent { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.icon-btn { background: rgba(0,0,0,.35); color: #fff; border: 1px solid var(--card-line); width: 38px; height: 38px; border-radius: 50%; font-size: 1rem; cursor: pointer; display: grid; place-items: center; }

.card {
  background: linear-gradient(180deg, var(--card), #081739);
  color: #fff;
  border: 1px solid var(--card-line);
  border-radius: 18px; padding: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35), 0 0 0 1px rgba(0,0,0,.2) inset;
  position: relative;
}
/* HUD corner brackets */
.card.hud::before, .card.hud::after { content: ""; position: absolute; width: 26px; height: 26px; border: 3px solid var(--accent); pointer-events: none; }
.card.hud::before { top: -2px; left: -2px; border-right: 0; border-bottom: 0; border-radius: 14px 0 0 0; }
.card.hud::after { bottom: -2px; right: -2px; border-left: 0; border-top: 0; border-radius: 0 0 14px 0; }
.stack > * + * { margin-top: 14px; }
.stack-lg > * + * { margin-top: 22px; }
.grow { flex: 1; display: flex; flex-direction: column; justify-content: center; }

.hero { text-align: center; padding: 10px 0 6px; }
.hero .logo { width: 128px; height: 128px; border-radius: 50%; box-shadow: 0 0 0 4px rgba(255,255,255,.18), 0 0 40px var(--glow); }
.ribbon { display: inline-block; margin-top: 8px; padding: 8px 26px; font-family: var(--font-d); font-weight: 800; font-size: 1.25rem; text-transform: uppercase; letter-spacing: .06em; color: var(--on-accent); background: var(--accent); clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 12px 100%, 0 50%); }
.tagline { font-family: var(--font-d); font-weight: 800; font-style: italic; text-transform: uppercase; font-size: 1.35rem; margin-top: 12px; color: var(--on-bg); }

/* ---------- buttons ---------- */
.btn {
  appearance: none; border: 0; cursor: pointer; width: 100%;
  font-family: var(--font-d); font-weight: 800; font-style: italic; text-transform: uppercase; letter-spacing: .04em;
  font-size: 1.5rem; padding: 14px 18px; border-radius: 14px;
  background: linear-gradient(180deg, var(--accent2), var(--accent)); color: var(--on-accent);
  box-shadow: 0 5px 0 rgba(0,0,0,.35), 0 8px 24px var(--glow);
  transition: transform .08s, box-shadow .08s, opacity .2s;
  text-decoration: none; text-align: center; display: block;
}
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.35); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: rgba(255,255,255,.08); color: #fff; border: 2px solid rgba(255,255,255,.35); box-shadow: none; font-size: 1.2rem; }
.btn.small { width: auto; display: inline-block; font-size: 1.05rem; padding: 8px 16px; }
.linkish { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; opacity: .85; }
a { color: var(--accent2); }

/* ---------- forms ---------- */
label { display: block; font-size: .9rem; margin-bottom: 6px; font-weight: 700; opacity: .95; }
input {
  width: 100%; padding: 13px 14px; border-radius: 12px; font: inherit; font-size: 1.05rem;
  background: rgba(255,255,255,.08); color: #fff; border: 2px solid rgba(255,255,255,.2); outline: none;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--glow); }
input::placeholder { color: rgba(255,255,255,.45); }
.hint { font-size: .82rem; opacity: .75; margin-top: 5px; font-weight: 500; }
.pw-wrap { position: relative; }
.pw-wrap button { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
.msg { padding: 12px 14px; border-radius: 12px; font-size: .95rem; font-weight: 600; }
.msg.err { background: rgba(255,93,93,.16); border: 1px solid rgba(255,93,93,.6); color: #ffd3d3; }
.msg.ok { background: rgba(61,220,132,.16); border: 1px solid rgba(61,220,132,.6); color: #cdf8df; }
.msg.info { background: rgba(255,255,255,.1); border: 1px solid var(--card-line); }

/* ---------- lists ---------- */
.steps { list-style: none; padding: 0; counter-reset: s; }
.steps li { counter-increment: s; display: flex; gap: 12px; padding: 7px 0; font-weight: 600; }
.steps li::before { content: counter(s); flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-family: var(--font-d); font-weight: 800; font-size: 1.1rem; }
.bullets { padding-left: 1.2rem; } .bullets li { padding: 3px 0; }
details.card summary { cursor: pointer; font-family: var(--font-d); font-weight: 800; font-style: italic; text-transform: uppercase; font-size: 1.35rem; list-style: none; }
details.card summary::-webkit-details-marker { display: none; }
details.card summary::after { content: "+"; float: right; color: var(--accent); }
details[open].card summary::after { content: "–"; }
details.card > div { margin-top: 10px; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: rgba(255,255,255,.07); border-radius: 14px; padding: 12px; text-align: center; border: 1px solid var(--card-line); }
.stat .n { font-family: var(--font-d); font-weight: 800; font-style: italic; font-size: 2.3rem; color: var(--accent); line-height: 1; }
.stat .l { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; opacity: .8; margin-top: 4px; }
.bar { height: 12px; border-radius: 99px; background: rgba(255,255,255,.12); overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); border-radius: 99px; transition: width .5s; }

/* ---------- question ---------- */
.q-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.q-badge { font-family: var(--font-d); font-weight: 800; font-style: italic; text-transform: uppercase; color: var(--on-accent); background: var(--accent); padding: 5px 16px; font-size: 1.05rem; clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 10px 100%, 0 50%); }
.timer { position: relative; height: 18px; border-radius: 99px; background: rgba(0,0,0,.4); overflow: hidden; border: 1px solid var(--card-line); }
.timer > i { position: absolute; inset: 0; transform-origin: left; background: linear-gradient(90deg, var(--ok), #ffd34d 60%, var(--bad)); background-size: 300% 100%; transition: transform .1s linear; }
.timer-num { font-family: var(--font-d); font-weight: 800; font-style: italic; font-size: 2.4rem; line-height: 1; min-width: 2.2ch; text-align: right; }
.timer-num.low { color: var(--bad); animation: pulse .5s infinite alternate; }
@keyframes pulse { to { transform: scale(1.15); } }
.q-text { font-size: 1.22rem; font-weight: 700; line-height: 1.45; margin: 16px 0 6px; }
.opts { display: grid; gap: 10px; margin-top: 14px; }
.opt {
  appearance: none; cursor: pointer; text-align: left; width: 100%; display: flex; gap: 12px; align-items: center;
  padding: 13px 14px; border-radius: 14px; font: inherit; font-size: 1.08rem; font-weight: 700; color: #fff;
  background: rgba(255,255,255,.08); border: 2px solid rgba(255,255,255,.22); transition: transform .08s, background .15s, border-color .15s;
}
.opt .k { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font-family: var(--font-d); font-weight: 800; font-size: 1.25rem; }
.opt:active:not([disabled]) { transform: scale(.98); }
.opt[disabled] { cursor: default; opacity: .6; }
.opt.picked { opacity: 1; border-color: var(--accent2); background: rgba(255,255,255,.18); }

/* ---------- feedback ---------- */
.result { text-align: center; padding: 10px 0; }
.result .big { font-size: clamp(3rem, 15vw, 4.6rem); }
.result.correct .big { color: var(--ok); text-shadow: 0 0 30px rgba(61,220,132,.5); }
.result.wrong .big, .result.timeout .big { color: var(--bad); text-shadow: 0 0 30px rgba(255,93,93,.4); }
.score-big { font-family: var(--font-d); font-weight: 800; font-style: italic; font-size: 3rem; color: var(--accent); line-height: 1; }

/* ---------- waiting radar ---------- */
.radar { width: 180px; height: 180px; margin: 6px auto 0; position: relative; display: grid; place-items: center; }
.radar::before, .radar::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--accent); animation: ping 2.4s ease-out infinite; opacity: 0; }
.radar::after { animation-delay: 1.2s; }
@keyframes ping { 0% { transform: scale(.35); opacity: .9; } 100% { transform: scale(1.1); opacity: 0; } }
.egg { width: 74px; height: 96px; border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; background: radial-gradient(circle at 35% 30%, #8fe0ff, #2b7bd6 45%, #0e2f73); position: relative; box-shadow: 0 6px 20px rgba(0,0,0,.5), 0 0 24px var(--glow); animation: wobble 2.2s ease-in-out infinite; }
.egg::after { content: ""; position: absolute; left: 50%; top: 52%; width: 26px; height: 26px; transform: translate(-50%,-50%); border-radius: 50%; background: radial-gradient(circle, #ffd88a, #ff7a1a 70%); box-shadow: 0 0 14px #ff7a1a; }
@keyframes wobble { 0%,100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
.egg.gold { background: radial-gradient(circle at 35% 30%, #fff3b0, #ffc61a 45%, #b8740a); }
body[data-theme="vocab"] .egg { box-shadow: 0 6px 20px rgba(0,0,0,.4); }

/* ---------- leaderboard ---------- */
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 8px; align-items: end; margin-bottom: 14px; }
.pod { text-align: center; padding: 12px 6px; border-radius: 14px 14px 6px 6px; background: rgba(255,255,255,.09); border: 1px solid var(--card-line); min-width: 0; }
.pod .medal { font-family: var(--font-d); font-weight: 800; font-style: italic; font-size: 2.2rem; line-height: 1; }
.pod .nm { font-size: .95rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 4px; }
.pod .sc { font-family: var(--font-d); font-weight: 800; font-size: 1.3rem; color: var(--accent); }
.pod.p1 { background: linear-gradient(180deg, rgba(255,211,77,.35), rgba(255,211,77,.08)); border-color: #ffd34d; padding-top: 22px; padding-bottom: 20px; }
.pod.p1 .medal { color: #ffd34d; }
.pod.p2 .medal { color: #d5dde8; } .pod.p3 .medal { color: #e0935a; }
.lb-row { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.06); }
.lb-row + .lb-row { margin-top: 6px; }
.lb-row .rk { font-family: var(--font-d); font-weight: 800; font-size: 1.3rem; opacity: .9; }
.lb-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .sc { font-family: var(--font-d); font-weight: 800; font-size: 1.25rem; color: var(--accent); }
.lb-row .sub { font-size: .75rem; opacity: .7; }
.lb-row.me { outline: 2px solid var(--accent); background: rgba(255,255,255,.14); }
.me-bar { position: sticky; bottom: 10px; margin-top: 14px; }

footer { margin-top: auto; padding-top: 26px; text-align: center; font-size: .8rem; opacity: .8; font-weight: 500; }
body[data-theme="vocab"] footer, body[data-theme="vocab"] .muted { opacity: 1; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 5px solid rgba(255,255,255,.25); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.pop { animation: pop .35s cubic-bezier(.2,1.6,.4,1); }
@keyframes pop { from { transform: scale(.7); opacity: 0; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

[hidden] { display: none !important; }
.q-badge { white-space: nowrap; }
.q-head { flex-wrap: wrap; }
.topbar .brand span { white-space: nowrap; }
