/* «مختبر المحقق»: what the lab's games share. One dark look on purpose, the same board-at-night as «كيف صارت؟»:
   Almarai text, Baloo Bhaijaan 2 titles, sun-yellow actions. Each game adds its own board in its own stylesheet.
   Layout: one column, phone first. */
:root {
  --bg: #0F1C2E; --bg2: #132440; --panel: #182B47; --panel2: #203757; --line: #2F4B71; --ink: #F3F7FF; --soft: #A9BBD6; --mute: #6F86A8;
  --sun: #FFD23F; --sunD: #D9A90F; --sunInk: #2A1B00; --ok: #3DDC97; --bad: #FF6B6B; --warn: #FFB347;
  --accent: var(--sun);
  --display: "Baloo Bhaijaan 2", "Almarai", "IBM Plex Sans Arabic", sans-serif;
  --body: "Almarai", "IBM Plex Sans Arabic", "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.7 var(--body); -webkit-text-size-adjust: 100%; }
.app { min-height: 100%; background: radial-gradient(1200px 600px at 50% -200px, #1B3356 0, var(--bg) 60%); }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; font-family: var(--display); text-wrap: balance; }
[hidden] { display: none !important; }
svg { overflow: visible; }

/* header */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding-block: 8px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: rgba(15, 28, 46, .9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.back { color: var(--soft); text-decoration: none; font-weight: 700; white-space: nowrap; }
.brand .q { font: 800 1.5rem/1.2 var(--display); color: var(--accent); text-shadow: 0 2px 0 rgba(0, 0, 0, .5); }
.pill { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: .9rem; white-space: nowrap; }
.pill.sun { background: var(--sun); color: var(--sunInk); border-color: var(--sunD); }
.pill.on { border-color: var(--sun); color: var(--sun); }
.pill:disabled { opacity: .45; cursor: not-allowed; }
.pill:focus-visible, .btn:focus-visible, .chip:focus-visible, .caseCard:focus-visible, .labCard:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }

.main { padding-block: 14px 24px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); max-width: 560px; margin: 0 auto; }
.lead { color: var(--soft); margin: 4px 0 16px; font-size: 1.02rem; }
.h3 { font-size: 1.15rem; margin: 18px 0 8px; color: var(--sun); }
.note { color: var(--soft); font-size: .92rem; margin: 8px 0 0; }

/* the cases */
.caseList { display: grid; gap: 12px; }
.caseCard { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; text-align: start; padding: 14px 16px; border-radius: 18px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 6px 0 #0B1526; color: var(--ink); }
.caseCard:active { transform: translateY(2px); box-shadow: 0 4px 0 #0B1526; }
.caseNo { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--sun); color: var(--sunInk); font: 800 1.4rem/1 var(--display); flex: none; }
.caseCard b { font: 800 1.25rem/1.2 var(--display); display: block; }
.caseCard small { color: var(--soft); font-weight: 700; }
.starRow { display: inline-flex; gap: 2px; }
.starRow svg { width: 20px; height: 20px; fill: #3A4D6B; }
.starRow svg.on { fill: var(--sun); }

/* the cover */
.cover { background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 20px 18px; }
.coverHead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.coverHead h2 { font-size: 1.7rem; }
.lvl { margin-inline-start: auto; color: var(--soft); font-weight: 700; font-size: .9rem; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }
.story { font-size: 1.08rem; margin: 14px 0 6px; }
.question { font: 800 1.35rem/1.4 var(--display); color: var(--sun); margin: 0 0 12px; }
.who { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.who span { display: inline-flex; align-items: center; gap: 8px; background: var(--panel2); border-radius: 999px; padding: 4px 12px 4px 6px; font-weight: 700; }
.who i { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font: 800 .85rem/1 var(--display); color: #fff; font-style: normal; }
.coverBtns { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { border: 0; border-radius: 16px; padding: 12px 22px; font: 800 1.1rem/1.2 var(--display); }
.btn.primary { background: var(--sun); color: var(--sunInk); box-shadow: 0 5px 0 var(--sunD); }
.btn.primary:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--sunD); }
.btn.primary:disabled { background: #3A4D6B; color: #8EA2C2; box-shadow: 0 5px 0 #243653; cursor: not-allowed; transform: none; }
.btn.ghost { background: transparent; color: var(--soft); border: 1px solid var(--line); }
.btn.big { width: 100%; padding: 14px 22px; font-size: 1.25rem; }

/* the board's top row and the hint */
.boardTop { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.meta { display: flex; flex-direction: column; align-items: center; line-height: 1.2; min-width: 0; }
.meta b { font: 800 1.15rem/1.2 var(--display); }
.meta span { color: var(--soft); font-size: .85rem; font-weight: 700; }
.hint { display: flex; gap: 10px; align-items: flex-start; background: #2A2A14; border: 1px solid #5B5420; border-radius: 16px; padding: 10px 12px; margin-bottom: 10px; }
.hint img { width: 54px; height: auto; flex: none; }
.hint small { color: var(--sun); font-weight: 800; }
.hint p { margin: 2px 0 0; font-size: .98rem; }
.instr { font-weight: 700; color: var(--soft); margin: 0 0 8px; font-size: .95rem; }
.instr b { color: var(--ink); }

.banner { margin-top: 10px; border-radius: 14px; padding: 10px 14px; font-weight: 800; background: #3A2A2A; border: 1px solid #7A3B3B; }
.banner.good { background: #16382B; border-color: #2E7D5B; }
.banner.info { background: var(--panel2); border-color: var(--line); }

/* evidence cards: a claim, then what the player's answer would give, then ✔ or ✖ */
.evidence { display: grid; gap: 10px; }
.ev { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: start; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; }
.ev .ico { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--panel2); color: var(--soft); }
.ev .ico svg { width: 24px; height: 24px; fill: currentColor; }
.ev .body { min-width: 0; }
.ev b { display: block; font-size: 1rem; }
.ev small { color: var(--soft); display: block; line-height: 1.5; }
.ev .st { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-weight: 800; background: var(--panel2); color: var(--soft); }
.ev .st.ok { background: var(--ok); color: #05301C; }
.ev .st.bad { background: var(--bad); color: #3A0A0A; }
.ev .mine { margin-top: 4px; font-weight: 700; }
.ev .mine.bad { color: var(--bad); }
.ev .mine.ok { color: var(--ok); }
.legend { margin-top: 12px; color: var(--soft); font-size: .9rem; display: grid; gap: 4px; }
.legend div { display: flex; gap: 8px; align-items: center; }
.legend i { font-style: normal; flex: none; }
.spacer { height: 84px; }

/* the main action, fixed at the bottom */
.bar { position: fixed; inset: auto 0 0 0; z-index: 25; padding-block: 10px calc(10px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: linear-gradient(180deg, rgba(15, 28, 46, 0), rgba(15, 28, 46, .95) 40%); }
.bar .btn { max-width: 560px; margin: 0 auto; display: block; }

/* sheets */
.sheet { position: fixed; inset: 0; z-index: 40; background: rgba(5, 10, 20, .7); display: grid; place-items: center; padding: 16px; overflow: auto; }
.sheetCard { width: min(100%, 460px); background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 22px 20px; box-shadow: 0 20px 50px rgba(0, 0, 0, .5); }
.sheetCard h2 { font-size: 1.6rem; margin-bottom: 8px; }
.how { padding-inline-start: 22px; margin: 0 0 10px; display: grid; gap: 8px; }
.stars { color: var(--soft); font-size: .92rem; margin: 0 0 14px; }
.reveal { text-align: center; position: relative; }
.stamp { display: inline-block; border: 3px solid var(--ok); color: var(--ok); border-radius: 10px; padding: 2px 14px; font: 800 1.1rem/1.4 var(--display); transform: rotate(-6deg); margin-bottom: 8px; }
.stamp.bad { border-color: var(--bad); color: var(--bad); }
.reveal .big { font: 800 1.2rem/1.5 var(--display); margin: 4px 0; }
.reveal .starRow svg { width: 34px; height: 34px; }
.reveal .coverBtns { justify-content: center; margin-top: 14px; }
.sheetBtns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 14px; }

.toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 45; background: #fff; color: #0F1C2E;
  padding: 10px 16px; border-radius: 14px; font-weight: 800; max-width: min(92vw, 420px); text-align: center; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }

/* the hub's cards */
.labCard { display: grid; grid-template-columns: 1fr 96px; gap: 14px; align-items: center; padding: 16px; border-radius: 22px; background: var(--panel); border: 1px solid var(--line);
  box-shadow: 0 6px 0 #0B1526; color: var(--ink); text-decoration: none; }
.labCard:active { transform: translateY(2px); box-shadow: 0 4px 0 #0B1526; }
.labCard .art { width: 96px; height: 96px; border-radius: 20px; background: var(--bg2); border: 1px solid var(--line); display: grid; place-items: center; }
.labCard .art svg { width: 70px; height: 70px; }
.labCard b { font: 800 1.35rem/1.2 var(--display); color: var(--accent); display: block; }
.labCard p { margin: 4px 0 8px; color: var(--soft); font-size: .95rem; line-height: 1.6; }
.labCard .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.labCard .tags span { font-size: .78rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--panel2); color: var(--soft); }
.labCard .go { display: inline-block; margin-top: 8px; padding: 6px 16px; border-radius: 12px; background: var(--sun); color: var(--sunInk); font: 800 1rem/1.2 var(--display); box-shadow: 0 4px 0 var(--sunD); }
.labGrid { display: grid; gap: 14px; }

@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
