:root {
  --bg: #111318;
  --fg: #fff;
  --muted: #9aa0ab;
  --red: #ef3e4a;
  --red-dk: #b8242f;
  --blue: #2f7bf6;
  --blue-dk: #1b52b3;
  --pill: #1f232c;
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--fg);
  font-family: Cairo, system-ui, sans-serif;
  display: flex; flex-direction: column;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; }

.bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  width: 100%; max-width: 760px; margin: 0 auto;
}
.logo { font-weight: 900; font-size: 24px; color: var(--fg); text-decoration: none; letter-spacing: -0.5px; }
.logo::after { content: "؟"; color: var(--red); }
.stats { display: flex; gap: 6px; margin-inline-start: auto; }
.pill { background: var(--pill); border-radius: 99px; padding: 3px 10px; font-size: 14px; white-space: nowrap; }
.pill.bump { animation: bump .4s; }
@keyframes bump { 40% { transform: scale(1.25); } }

main {
  flex: 1; display: flex; flex-direction: column; gap: 0;
  padding: 0 16px 16px; padding-bottom: max(16px, env(safe-area-inset-bottom));
  max-width: 720px; width: 100%; margin: 0 auto; position: relative;
}
.prompt { text-align: center; color: var(--muted); font-weight: 700; font-size: 18px; margin: 4px 0 10px; }

.side {
  flex: 1; min-height: 150px; border: 0; border-radius: 22px; cursor: pointer;
  position: relative; overflow: hidden; padding: 24px 20px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  transition: transform .12s, filter .2s;
  isolation: isolate;
}
.side.red { background: var(--red-dk); }
.side.blue { background: var(--blue-dk); }
/* fill bar that grows to the vote percentage after answering */
.side::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  transform-origin: right; transform: scaleX(1);
  transition: transform .7s cubic-bezier(.2,.8,.2,1);
}
.side.red::before { background: var(--red); }
.side.blue::before { background: var(--blue); }
.revealed .side::before { transform: scaleX(var(--p, 0)); }
.side:active { transform: scale(.98); }
.revealed .side:active { transform: none; }

.text { font-size: clamp(20px, 5.4vw, 30px); font-weight: 900; line-height: 1.35; text-align: center; text-wrap: balance; }
.pct { font-size: 44px; font-weight: 900; line-height: 1; display: none; }
.n { font-size: 13px; opacity: .8; display: none; }
.revealed .pct, .revealed .n { display: block; }
.revealed .text { font-size: clamp(16px, 4.2vw, 22px); font-weight: 700; }
.side.picked { outline: 4px solid #fff; outline-offset: -4px; }
.side.picked .pct::after { content: " ✓"; font-size: 28px; }
.revealed .side:not(.picked) { filter: saturate(.7) brightness(.85); }

.or {
  align-self: center; margin: -22px 0; z-index: 2;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--bg); border: 4px solid var(--bg);
  display: grid; place-items: center; font-weight: 900; font-size: 20px;
  box-shadow: 0 0 0 3px #ffffff22;
}

.actions { display: flex; justify-content: center; gap: 10px; margin-top: 14px; }
.ghost { background: var(--pill); border: 0; border-radius: 99px; padding: 8px 16px; cursor: pointer; font-weight: 700; font-size: 15px; }
.ghost:hover { background: #2a2f3a; }
.hint { text-align: center; color: var(--muted); font-size: 14px; margin-top: 10px; visibility: hidden; }
.revealed .hint { visibility: visible; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .45; } }

main.out { animation: out .18s forwards; }
main.in { animation: in .25s; }
@keyframes out { to { opacity: 0; transform: translateY(-14px); } }
@keyframes in { from { opacity: 0; transform: translateY(14px); } }

.toast {
  position: fixed; top: 70px; left: 50%; transform: translate(-50%, -20px);
  background: #fff; color: #111; font-weight: 900; padding: 8px 18px; border-radius: 99px;
  opacity: 0; transition: .25s; pointer-events: none; z-index: 10; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 9; width: 100%; height: 100%; }

@media (min-width: 760px) {
  main { flex-direction: row; flex-wrap: wrap; align-content: center; }
  .prompt { width: 100%; }
  .side { min-height: 360px; }
  .or { margin: 0 -22px; align-self: center; }
  .actions, .hint { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- play with friends ---------- */
.friendsPill { border: 0; cursor: pointer; font-weight: 700; }
.friendsPill:hover { background: #2a2f3a; }
.friendsPill.on { background: #2b4d2f; }
@media (max-width: 420px) { .bar { gap: 6px; padding-inline: 12px; } .pill { padding: 3px 8px; } .friendsPill:not(.on) .lbl { display: none; } }
.friends { display: none; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 4px; }
.revealed .friends { display: flex; }
.chip { background: var(--pill); border-radius: 99px; padding: 2px 10px; font-size: 13px; white-space: nowrap; }
.friends .chip { background: #0006; animation: pop .3s; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.waiting { text-align: center; color: var(--muted); font-size: 14px; margin-top: 10px; min-height: 1.4em; }
.waiting:empty { display: none; }
dialog { margin: auto; background: var(--bg); color: var(--fg); border: 1px solid #2a2f3a; border-radius: 22px; padding: 8px 0; width: min(92vw, 440px); }
dialog::backdrop { background: #000a; }
.card { margin: 16px auto; padding: 0 20px; text-align: center; display: flex; flex-direction: column; gap: 12px; }
.card section { display: flex; flex-direction: column; gap: 12px; }
.card [hidden] { display: none; }
.card h1, .card h2 { font-size: 24px; font-weight: 900; line-height: 1.4; }
.card p { color: var(--muted); }
.card input { background: var(--pill); border: 2px solid #2a2f3a; border-radius: 16px; padding: 14px; font: inherit; font-size: 18px; color: var(--fg); text-align: center; }
.card input:focus { outline: none; border-color: var(--blue); }
.cta { background: var(--red); border: 0; border-radius: 16px; padding: 14px; font-size: 20px; font-weight: 900; cursor: pointer; }
.cta:active { transform: scale(.98); }
.members { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.members .chip { font-size: 15px; padding: 4px 12px; }
.members .me { outline: 2px solid #fff3; }
.linkRow { display: flex; gap: 8px; }
.linkRow input { flex: 1; min-width: 0; font-size: 14px; padding: 10px; }
.linkRow .ghost { border-radius: 14px; white-space: nowrap; }

/* ---------- SEO content ---------- */
/* On the game page this sits entirely below the first screen and outside the
   game's flex layout, so the game looks and behaves exactly as before. */
.seo {
  position: absolute; top: 100dvh; left: 0; right: 0;
  max-width: 720px; margin: 0 auto; padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
  color: var(--muted); font-size: 15px; line-height: 1.8;
}
.seoCard { background: var(--pill); border-radius: 18px; padding: 18px 18px 14px; }
.seoCard h2 { color: var(--fg); font-size: 19px; font-weight: 900; line-height: 1.5; margin-bottom: 6px; }
.seoCard p { font-size: 14px; margin-top: 8px; }
.seo h3 { color: var(--fg); font-size: 16px; font-weight: 900; margin: 24px 0 10px; }
.seo .rel li { padding: 10px 14px; }
.seo .rel li > a::before { content: none; }
.seo .rel li > a { font-size: 15px; }
.cats a.on { background: var(--fg); color: var(--bg) !important; }
.siteFoot { display: flex; justify-content: space-between; align-items: center; margin-top: 32px; padding-top: 16px; border-top: 1px solid #ffffff14; font-size: 14px; }
.siteFoot .logo { font-size: 20px; }
.seo a, .list a { color: #8ab4ff; text-decoration: none; }
.seo a:hover, .list a:hover { text-decoration: underline; }
.seo .cats a, .list .cats a { color: var(--fg); }

/* ---------- list pages (/questions, /c/…) ---------- */
body.list { display: block; height: auto; }
.list .bar { justify-content: space-between; }
.playPill { color: var(--fg) !important; background: var(--red); font-weight: 700; text-decoration: none !important; }
.listMain { max-width: 720px; margin: 0 auto; padding: 8px 16px 48px; line-height: 1.8; }
.crumbs { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.listMain h1 { font-size: 28px; font-weight: 900; line-height: 1.4; }
.listMain h1 small { font-size: 16px; color: var(--muted); font-weight: 700; }
.listMain h2 { font-size: 20px; margin: 28px 0 10px; }
.intro { color: var(--muted); margin: 8px 0 16px; }
.playCta { display: block; text-align: center; text-decoration: none !important; color: var(--fg) !important; margin: 16px 0; }
.qlist { padding: 0; list-style: none; counter-reset: q; display: flex; flex-direction: column; gap: 10px; }
.qlist li { background: var(--pill); border-radius: 14px; padding: 12px 14px; counter-increment: q; }
.qlist li > a { color: var(--fg) !important; font-weight: 700; display: block; }
.qlist li > a::before { content: counter(q) ". "; color: var(--muted); }
.qa { color: #ff8a92; } .qb { color: #8ab4ff; } .or2 { color: var(--muted); font-weight: 500; }
.split { display: flex; height: 6px; border-radius: 6px; overflow: hidden; margin-top: 8px; }
.split i { display: block; } .ra { background: var(--red); } .rb { background: var(--blue); }
.pcts { display: flex; justify-content: space-between; font-size: 13px; margin-top: 2px; }
.pa { color: #ff8a92; } .pb { color: #8ab4ff; }
.cats { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; }
.cats a { display: block; background: var(--pill); border-radius: 99px; padding: 6px 14px; font-size: 14px; }
