/* ---------- tokens ----------
   The palette is sampled from the case illustrations: a dark navy room, one
   warm pool of lamplight, and three flat accents — red, gold, green.          */
:root {
  color-scheme: dark;
  --bg: #061020;
  --bg-2: #030A16;
  --surface: #0E1A2C;
  --surface-2: #152338;
  --surface-3: #1C2C44;
  --line: #22324C;
  --line-2: #2E4162;

  --lamp: #F3E2B3;
  --text: #ECE3CF;
  --text-2: #C3CAD8;
  --muted: #8D9AB4;

  /* one colour per category, used everywhere the category appears */
  --red: #E05C4A;
  --red-soft: rgba(224, 92, 74, .15);
  --red-line: rgba(224, 92, 74, .38);
  --gold: #EFA63C;
  --gold-soft: rgba(239, 166, 60, .15);
  --gold-line: rgba(239, 166, 60, .38);
  --green: #4FA97F;
  --green-soft: rgba(79, 169, 127, .15);
  --green-line: rgba(79, 169, 127, .38);

  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  --sh-1: 0 1px 2px rgba(0, 0, 0, .35);
  --sh-2: 0 10px 26px rgba(0, 0, 0, .40);
  --sh-3: 0 20px 50px rgba(0, 0, 0, .55);
  --edge: inset 0 1px 0 rgba(243, 226, 179, .07);

  --cell: 46px;
  --cellmin: 30px;
  --rowico: 40px;
  --hdr: 22px;
  --gap: 4px;

  --font-en: "Inter", "Segoe UI", system-ui, sans-serif;
  --font-display: "Playfair Display", Georgia, serif;
  --font-ar: "Tajawal", "Segoe UI", system-ui, sans-serif;
}

.tint-red { --tint: var(--red); --tint-soft: var(--red-soft); --tint-line: var(--red-line); }
.tint-gold { --tint: var(--gold); --tint-soft: var(--gold-soft); --tint-line: var(--gold-line); }
.tint-green { --tint: var(--green); --tint-soft: var(--green-soft); --tint-line: var(--green-line); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; background: var(--bg); }
body {
  margin: 0;
  background:
    radial-gradient(900px 420px at 72% -6%, rgba(255, 161, 49, .10), transparent 60%),
    radial-gradient(760px 420px at 4% 8%, rgba(45, 110, 93, .13), transparent 62%),
    radial-gradient(1200px 700px at 50% 100%, rgba(216, 75, 61, .07), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-en);
  font-size: 17px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
html[lang="ar"] body { font-family: var(--font-ar); font-size: 18px; line-height: 1.8; }
h1, h2, h3 { line-height: 1.2; margin: 0; font-weight: 800; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
svg { display: block; }
q { quotes: "“" "”"; }
html[lang="ar"] q { quotes: "«" "»"; }
::selection { background: rgba(239, 166, 60, .32); color: #fff; }

.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding-inline: 16px; }
@media (min-width: 720px) { .wrap { padding-inline: 28px; } }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(6, 16, 32, .82);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 12px; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px;
  background: var(--surface-2); box-shadow: var(--sh-1), var(--edge); color: var(--lamp);
  border: 1px solid var(--line); flex: none;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name {
  font-family: var(--font-display); font-weight: 800; font-size: 1.42rem; line-height: 1.05;
  white-space: nowrap; position: relative; padding-bottom: 6px; color: var(--lamp); letter-spacing: 0;
}
html[lang="ar"] .brand-name { font-family: var(--font-ar); font-weight: 800; font-size: 1.3rem; }
.brand-name::after { content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--gold), var(--red) 60%, transparent); }
.brand-tag { font-size: .74rem; color: var(--muted); white-space: nowrap; margin-top: 4px; }

.nav-inline { display: none; gap: 4px; background: var(--surface); border: 1px solid var(--line); padding: 4px; border-radius: 999px; }
.nav-link { font-weight: 700; color: var(--muted); padding: 8px 18px; border-radius: 999px; font-size: .93rem; transition: background .15s, color .15s; }
.nav-link:hover { color: var(--text); }
.nav-link.active { color: var(--bg); background: var(--lamp); box-shadow: 0 2px 12px rgba(243, 226, 179, .22); }
@media (min-width: 760px) { .nav-inline { display: flex; } .site-header .tabs { display: none; } }

.header-end { display: flex; align-items: center; gap: 8px; flex: none; }
.lang-switch { display: flex; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px 6px; }
.lang-btn { border: 0; background: transparent; padding: 6px 9px; min-height: 34px; font-weight: 700; color: var(--muted); border-radius: 999px; transition: color .15s; }
.lang-btn[aria-pressed="true"] { color: var(--lamp); }
.lang-btn[lang="ar"] { font-family: var(--font-ar); }
.lang-btn[lang="en"] { font-family: var(--font-en); }
.lang-sep { color: var(--line-2); }
.lang-btn .short { display: none; }

.streak { display: flex; align-items: center; gap: 7px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 13px 4px 9px; min-height: 38px; }
.streak .flame { width: 20px; height: 20px; }
.streak-text { display: flex; flex-direction: column; line-height: 1.05; font-size: .7rem; color: var(--muted); font-weight: 600; }
.streak-text b { font-size: 1rem; color: var(--lamp); }
.streak-text b:empty { display: none; }
@media (max-width: 600px) {
  .brand-tag { display: none; }
  .brand-name { font-size: 1.2rem; }
  .brand-mark { width: 38px; height: 38px; }
  .lang-btn .full { display: none; } .lang-btn .short { display: inline; }
  .lang-btn { padding: 6px 7px; min-height: 32px; }
  .streak { padding: 3px 10px 3px 6px; min-height: 34px; gap: 4px; }
  .streak .flame { width: 17px; height: 17px; }
  .streak-text span { display: none; }
  .streak.label-only .streak-text span { display: inline; font-size: .78rem; color: var(--lamp); }
  .header-end { gap: 6px; }
}

.tabs { display: flex; gap: 6px; padding-bottom: 10px; }
.tab { flex: 1; text-align: center; padding: 10px 8px; min-height: 44px; border-radius: 999px; font-weight: 700; color: var(--muted); border: 1px solid transparent; display: flex; align-items: center; justify-content: center; line-height: 1.25; }
@media (max-width: 480px) { .tab { font-size: .84rem; padding: 8px 4px; } }
.tab.active { background: var(--lamp); color: var(--bg); border-color: transparent; }

/* ---------- main ---------- */
main { flex: 1; padding-block: 22px 44px; display: flex; flex-direction: column; gap: 16px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-2), var(--edge);
  padding: 20px 18px;
}
@media (min-width: 720px) { .card { padding: 26px 28px; } }

.sec-head { display: flex; align-items: center; gap: 11px; margin-bottom: 16px; }
.sec-head h2 { font-size: 1.02rem; font-weight: 800; letter-spacing: .01em; color: var(--text); }
html[lang="en"] .sec-head h2 { text-transform: uppercase; letter-spacing: .16em; font-size: .82rem; }
.sec-icon {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 11px;
  background: var(--surface-2); color: var(--lamp); border: 1px solid var(--line); flex: none;
}
.sec-icon svg { width: 19px; height: 19px; }
.sec-icon.red { background: var(--red-soft); color: var(--red); border-color: var(--red-line); }
.sec-icon.gold { background: var(--gold-soft); color: var(--gold); border-color: var(--gold-line); }
.sec-icon.green { background: var(--green-soft); color: var(--green); border-color: var(--green-line); }
.sec-icon.coral { background: var(--red-soft); color: var(--red); border-color: var(--red-line); }
.sec-icon.mustard { background: var(--gold-soft); color: var(--gold); border-color: var(--gold-line); }
.sec-head.red .sec-title { color: var(--red); }
.sec-head.gold .sec-title { color: var(--gold); }
.sec-head.green .sec-title { color: var(--green); }
.sec-hint { color: var(--muted); font-size: .9rem; margin: -6px 0 16px; }
.note {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--gold-soft); color: var(--gold); border: 1px solid var(--gold-line);
  border-radius: var(--r-sm); padding: 11px 14px; font-size: .92rem; font-weight: 600; margin-bottom: 14px;
}
.note svg { width: 17px; height: 17px; flex: none; margin-top: 4px; opacity: .8; }

/* hero — the illustration bleeds into the card, the text sits in the lamplight */
.hero { padding: 0; overflow: hidden; display: grid; position: relative; }
.hero-body {
  padding: 26px 20px 24px; display: flex; flex-direction: column; justify-content: center;
  position: relative; z-index: 2;
  background: radial-gradient(120% 90% at 0% 0%, rgba(243, 226, 179, .07), transparent 62%);
}
html[dir="rtl"] .hero-body { background: radial-gradient(120% 90% at 100% 0%, rgba(243, 226, 179, .07), transparent 62%); }
.hero-media { position: relative; background: var(--bg-2); aspect-ratio: 3 / 2; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; }
.hero-media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(14, 26, 44, .85), transparent 38%); }
.hero-media.no-art { display: none; }
@media (min-width: 780px) {
  .hero { grid-template-columns: 1.05fr 1fr; }
  .hero-body { padding: 40px 34px; }
  .hero-media { aspect-ratio: auto; min-height: 340px; }
  .hero-media::after { background: linear-gradient(to right, var(--surface), rgba(14, 26, 44, .55) 26%, transparent 55%); }
  html[dir="rtl"] .hero-media::after { background: linear-gradient(to left, var(--surface), rgba(14, 26, 44, .55) 26%, transparent 55%); }
  .hero.no-scene { grid-template-columns: 1fr; }
}
.case-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.case-date { font-size: .86rem; color: var(--muted); font-weight: 500; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: 999px;
  font-weight: 700; font-size: .76rem; letter-spacing: .04em;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line);
}
html[lang="en"] .badge { text-transform: uppercase; }
.badge svg { width: 13px; height: 13px; }
.badge.today { background: var(--lamp); color: var(--bg); border-color: transparent; font-weight: 800; }
.badge.coral { background: var(--red-soft); color: var(--red); border-color: var(--red-line); }
.badge.mustard { background: var(--gold-soft); color: var(--gold); border-color: var(--gold-line); }
.diff-easy { background: var(--green-soft); color: var(--green); border-color: var(--green-line); }
.diff-medium { background: var(--gold-soft); color: var(--gold); border-color: var(--gold-line); }
.diff-hard { background: var(--red-soft); color: var(--red); border-color: var(--red-line); }
.diff-expert { background: rgba(191, 163, 232, .14); color: #BFA3E8; border-color: rgba(191, 163, 232, .38); }
.case-title {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(1.9rem, 4.8vw, 2.8rem); line-height: 1.12; letter-spacing: -.015em;
  margin: 0 0 14px; color: var(--lamp);
}
html[lang="ar"] .case-title { font-family: var(--font-ar); font-weight: 800; line-height: 1.3; }
.case-intro { color: var(--text-2); font-size: 1.02rem; max-width: 58ch; }

.countdown {
  display: inline-flex; align-items: center; gap: 9px; margin-top: 22px; align-self: flex-start;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 999px; padding: 8px 17px 8px 13px;
}
.cd-ic { display: grid; place-items: center; color: var(--gold); }
.cd-ic svg { width: 17px; height: 17px; }
.cd-label { font-size: .78rem; color: var(--muted); font-weight: 600; }
.cd-time { font-size: 1.02rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .05em; color: var(--lamp); }

/* entity cards */
.ents { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
@media (max-width: 719px) { .ents { grid-template-columns: repeat(2, 1fr); gap: 10px; } .ents-3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 980px) { .ents-5 { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 720px) {
  .ents { gap: 14px; }
  .ents-3 { grid-template-columns: repeat(3, 1fr); }
  .ents-4 { grid-template-columns: repeat(4, 1fr); }
  .ents-5 { grid-template-columns: repeat(3, 1fr); }
}
.ent {
  min-width: 0; position: relative;
  background: linear-gradient(180deg, var(--tint-soft), rgba(21, 35, 56, .35) 55%, var(--surface-2));
  border: 1px solid var(--tint-line);
  border-radius: var(--r-md); padding: 16px 12px 14px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 5px;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.ent:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: var(--tint); }
/* a case can ship painted icons per entity; they sit in the same boxes as the SVGs.
   The art already carries its category colour, so it gets a dark plate to sit on. */
.pic { width: 100%; height: 100%; object-fit: contain; }
.icon-box .pic { width: 94%; height: 94%; }
.gico .pic { width: 92%; height: 92%; }
.ent.has-art .icon-box { background: rgba(3, 10, 22, .8); }
.gico-art { background: rgba(3, 10, 22, .55); }

.icon-box {
  width: 60px; height: 60px; border-radius: 17px; display: grid; place-items: center;
  background: var(--surface); color: var(--tint, var(--lamp));
  border: 1px solid var(--tint-line, var(--line));
  box-shadow: var(--sh-1), var(--edge); margin-bottom: 4px;
}
.icon-box svg { width: 58%; height: 58%; }
@media (min-width: 720px) { .icon-box { width: 68px; height: 68px; border-radius: 19px; } }
.ent-name { font-weight: 700; font-size: 1rem; line-height: 1.25; overflow-wrap: anywhere; color: var(--text); }
.ent-sub { color: var(--tint, var(--muted)); font-size: .68rem; font-weight: 800; letter-spacing: .1em; }
html[lang="en"] .ent-sub { text-transform: uppercase; }
.ent-desc { color: var(--muted); font-size: .85rem; line-height: 1.5; overflow-wrap: anywhere; }
.ent-stats { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; margin-top: 8px; }
.stat {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(6, 16, 32, .45); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 9px; font-size: .69rem; font-weight: 600; color: var(--text-2);
  max-width: 100%; overflow-wrap: anywhere;
}
.stat svg { width: 12px; height: 12px; opacity: .7; }
@media (min-width: 720px) { .ent-name { font-size: 1.05rem; } .ent-desc { font-size: .88rem; } }

/* clues */
.clues { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.clue {
  display: flex; gap: 13px; align-items: flex-start; padding: 13px 15px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line);
}
.clue-num {
  flex: none; width: 27px; height: 27px; border-radius: 9px; display: grid; place-items: center;
  background: var(--surface-3); color: var(--lamp); font-weight: 700; font-size: .8rem; margin-top: 1px;
  border: 1px solid var(--line-2);
}
.clue-text { color: var(--text-2); }
.clue.said { background: rgba(28, 44, 68, .5); }
.clue-say { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.say-who { display: inline-flex; align-items: center; gap: 6px; background: var(--tint-soft); color: var(--tint); border: 1px solid var(--tint-line); border-radius: 999px; padding: 3px 12px 3px 7px; font-size: .82rem; }
.say-who svg { width: 17px; height: 17px; }
.say-who b { color: var(--text); font-weight: 700; }
.clue-say q { font-style: italic; color: var(--lamp); }

/* ---- one L-shaped deduction grid: icons only, equal cells ---- */
.gridbox { position: relative; }
.lwrap { overflow-x: auto; max-width: 100%; padding-bottom: 2px; display: flex; justify-content: safe center;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.lwrap::-webkit-scrollbar { height: 8px; }
.lwrap::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; }
.lwrap::-webkit-scrollbar-track { background: transparent; }
.lgrid {
  border-collapse: separate; border-spacing: var(--gap); table-layout: fixed; flex: none;
  width: 100%; max-width: calc(var(--hdr) + (2 * var(--n, 4) + 1) * (var(--cell) + var(--gap)) + var(--gap));
}
.lgrid th, .lgrid td { padding: 0; }
/* a fixed-layout table takes its widths from the first row, where the corner spans two
   columns — so the two header columns are sized with <col>, or they split the corner evenly */
.lgrid col.c-cat { width: var(--hdr); }
.cat, .rowcat {
  font-size: .66rem; font-weight: 800; letter-spacing: .12em; color: var(--muted);
  background: rgba(6, 16, 32, .5); border: 1px solid var(--line); border-radius: 8px;
  white-space: nowrap; overflow: hidden;
}
html[lang="en"] .cat, html[lang="en"] .rowcat { text-transform: uppercase; }
.cat { height: 24px; }
/* rotated 180deg so the label reads downward in both scripts */
.rowcat span { display: block; writing-mode: vertical-rl; transform: rotate(180deg); margin-inline: auto; }
.gico {
  width: 100%; max-width: var(--rowico); aspect-ratio: 1; margin-inline: auto;
  border-radius: 50%; display: grid; place-items: center; padding: 0;
  background: var(--tint-soft); color: var(--tint);
  border: 1px solid var(--tint-line);
  transition: transform .1s, box-shadow .14s;
}
.lgrid thead .gico { max-width: var(--cell); }
.gico svg { width: 58%; height: 58%; }
.gico:hover { transform: translateY(-1px); }
.gico.on { box-shadow: 0 0 0 3px var(--tint-soft), 0 0 14px var(--tint-soft); border-color: var(--tint); }
.blank { background: transparent; }
.gtip {
  position: absolute; z-index: 5; pointer-events: none;
  background: var(--lamp); color: #10192A; font-size: .74rem; font-weight: 700;
  padding: 6px 11px; border-radius: 9px; box-shadow: var(--sh-2); max-width: 90%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cell {
  width: 100%; min-width: var(--cellmin); aspect-ratio: 1; border-radius: 8px;
  border: 1px solid var(--line); background: rgba(6, 16, 32, .55);
  display: grid; place-items: center; padding: 0; color: #4A5D7B;
  transition: transform .09s, background .14s, border-color .14s, color .14s;
}
.cell:hover { border-color: var(--line-2); background: rgba(28, 44, 68, .7); }
.cell:active { transform: scale(.88); }
.cell svg { width: 58%; height: 58%; }
.cell[data-state=""] svg { width: 32%; height: 32%; }
.cell[data-state="x"] { background: var(--red-soft); border-color: var(--red-line); color: var(--red); }
.cell[data-state="ok"] { background: var(--green-soft); border-color: var(--green-line); color: var(--green); }
@media (max-width: 719px) {
  :root { --cell: 38px; --cellmin: 26px; --rowico: 32px; --hdr: 18px; --gap: 2px; }
  .cat { height: 20px; font-size: .58rem; }
  .cell { border-radius: 7px; }
}
/* on the narrowest phones let the cells scale freely so the L still fits whole */
@media (max-width: 400px) { :root { --cellmin: 0px; --rowico: 28px; --hdr: 15px; } }
/* ---- evidence sheet: an opt-in recessed grid panel, dark like the rest of the site ---- */
.gridbox.sheet {
  --gap: 2px;
  --rule: rgba(157, 186, 226, .30);
  /* row icons get the same box as the column icons, so every icon renders the same size */
  --rowico: var(--cell);
  position: relative;
  padding: 16px 12px 14px;
  width: 100%;
  /* the sheet is only as wide as the grid it carries, and sits centred on the page */
  max-width: calc(var(--hdr) + (2 * var(--n, 4) + 1) * (var(--cell) + var(--gap)) + var(--gap) + 34px);
  margin-inline: auto;
  border-radius: 14px;
  background:
    radial-gradient(130% 90% at 16% -12%, rgba(157, 186, 226, .10), transparent 58%),
    linear-gradient(180deg, #0A1423, #060E1A);
  border: 1px solid var(--line);
  box-shadow: inset 0 2px 14px rgba(0, 0, 0, .55), 0 1px 0 rgba(243, 226, 179, .05);
}
/* on phones the sheet runs into the card's padding so the cells keep their size */
@media (max-width: 719px) { .gridbox.sheet { width: calc(100% + 32px); margin-inline: -16px; padding: 12px 8px 10px; } }
@media (min-width: 720px) {
  .gridbox.sheet { padding: 22px 20px 18px;
    max-width: calc(var(--hdr) + (2 * var(--n, 4) + 1) * (var(--cell) + var(--gap)) + var(--gap) + 50px); }
}

/* category headers: solid tabs in the category colour */
.sheet .cat, .sheet .rowcat {
  background: var(--tint, var(--line-2)); color: #07101E; border: 0;
  letter-spacing: .16em; border-radius: 5px; font-weight: 800;
}
.sheet .cat { height: 22px; }

/* icons sit straight on the sheet, no disc behind them */
.sheet .gico { background: transparent; border: 0; border-radius: 6px; }
.sheet .gico .pic { width: 100%; height: 100%; }
.sheet .gico svg { width: 82%; height: 82%; color: var(--tint); }
.sheet .gico:hover { transform: none; background: rgba(157, 186, 226, .10); }
.sheet .gico.on { box-shadow: none; background: rgba(157, 186, 226, .12); outline: 2px solid var(--tint); outline-offset: 1px; }

/* ruled cells: neutral navy lines, clearly drawn */
.sheet .cell {
  background: rgba(157, 186, 226, .05); border: 1px solid var(--rule); border-radius: 3px;
  color: rgba(157, 186, 226, .32);
}
.sheet .cell:hover { background: rgba(157, 186, 226, .13); border-color: rgba(157, 186, 226, .55); }
.sheet .cell svg { width: 66%; height: 66%; stroke-width: 2.6; }
.sheet .cell[data-state=""] svg { width: 34%; height: 34%; stroke-width: 2.2; }
.sheet .cell[data-state="x"] { background: rgba(224, 92, 74, .20); border-color: rgba(224, 92, 74, .8); color: #FF8E7B; }
.sheet .cell[data-state="ok"] { background: rgba(79, 169, 127, .20); border-color: rgba(79, 169, 127, .8); color: #74D7A7; }
.sheet .blank { background: transparent; }

/* the key under the sheet uses the same ink */
.sheet-card .legend-items .mini { background: rgba(157, 186, 226, .05); border-color: rgba(157, 186, 226, .3); color: rgba(157, 186, 226, .32); }
.sheet-card .legend-items .mini.x { background: rgba(224, 92, 74, .2); border-color: rgba(224, 92, 74, .8); color: #FF8E7B; }
.sheet-card .legend-items .mini.ok { background: rgba(79, 169, 127, .2); border-color: rgba(79, 169, 127, .8); color: #74D7A7; }

.grid-legend { display: flex; flex-wrap: wrap; gap: 10px 16px; color: var(--muted); font-size: .82rem; align-items: center; margin-top: 18px; justify-content: space-between; }
.legend-items { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.legend-items .mini { display: inline-grid; place-items: center; width: 21px; height: 21px; border-radius: 7px; border: 1px solid var(--line); background: rgba(6, 16, 32, .55); vertical-align: middle; margin-inline-end: 5px; color: #4A5D7B; }
.legend-items .mini svg { width: 12px; height: 12px; }
.legend-items .mini.x { border-color: var(--red-line); color: var(--red); background: var(--red-soft); }
.legend-items .mini.ok { border-color: var(--green-line); color: var(--green); background: var(--green-soft); }

/* answer */
.answers { display: grid; gap: 14px; }
@media (min-width: 720px) { .answers { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1rem; color: var(--tint, var(--text)); }
html[lang="en"] .field-label { text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; }
.field-label svg { width: 17px; height: 17px; color: var(--tint, var(--lamp)); }
.select-wrap { position: relative; }
.select-wrap select {
  width: 100%; min-height: 54px; padding: 12px 42px 12px 15px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--surface-2); font-weight: 600; appearance: none; -webkit-appearance: none;
  color: var(--text); cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s;
}
html[dir="rtl"] .select-wrap select { padding: 12px 15px 12px 42px; }
.select-wrap select option { background: #152338; color: #ECE3CF; }
.select-wrap select.empty { color: var(--muted); font-weight: 500; }
.select-wrap select:focus { outline: none; border-color: var(--tint, var(--gold)); box-shadow: 0 0 0 3px var(--tint-soft, var(--gold-soft)); }
.select-wrap select.picked { border-color: var(--tint, var(--gold)); background: var(--tint-soft, var(--gold-soft)); color: var(--lamp); }
.select-wrap::after { content: ""; position: absolute; top: 50%; inset-inline-end: 17px; width: 8px; height: 8px; border-right: 2.5px solid var(--muted); border-bottom: 2.5px solid var(--muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 20px; }
.btn { border: 0; border-radius: 999px; min-height: 52px; padding: 13px 28px; font-weight: 700; font-size: 1.02rem; display: inline-flex; align-items: center; justify-content: center; gap: 10px; transition: transform .09s, filter .15s, box-shadow .15s; }
.btn svg { width: 20px; height: 20px; }
.btn:active { transform: scale(.98); }
.btn-primary {
  background: linear-gradient(180deg, #E8674F, #C03F33); color: #FFF3E2;
  box-shadow: 0 10px 26px rgba(216, 75, 61, .35), var(--edge); width: 100%;
}
.btn-primary:hover { filter: brightness(1.07); box-shadow: 0 14px 34px rgba(216, 75, 61, .45); }
.btn-ghost { background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text); min-height: 42px; padding: 9px 18px; font-size: .88rem; font-weight: 600; }
.btn-ghost:hover { border-color: var(--muted); color: var(--lamp); }
.btn-teal { background: var(--green); color: #07160F; font-weight: 800; }
.btn-teal:hover { filter: brightness(1.08); }

.msg { margin-top: 16px; padding: 14px 16px; border-radius: var(--r-sm); font-weight: 600; display: none; border: 1px solid transparent; }
.msg.show { display: block; }
.msg.bad { background: var(--red-soft); border-color: var(--red-line); color: var(--red); animation: shake .4s; }
.msg.warn { background: var(--gold-soft); border-color: var(--gold-line); color: var(--gold); }
@keyframes shake { 0%,100% { transform: translateX(0);} 25% { transform: translateX(-6px);} 75% { transform: translateX(6px);} }

/* result */
.result { border-color: var(--green-line); background: linear-gradient(180deg, rgba(79, 169, 127, .12), var(--surface) 55%); }
.result-head { display: flex; align-items: center; gap: 15px; margin-bottom: 18px; }
.result-icon { width: 54px; height: 54px; border-radius: 16px; background: var(--green); color: #07160F; display: grid; place-items: center; flex: none; box-shadow: 0 10px 24px rgba(79, 169, 127, .3); }
.result-icon svg { width: 28px; height: 28px; }
.result h2 { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; color: var(--lamp); }
html[lang="ar"] .result h2 { font-family: var(--font-ar); }
.result-sub { color: var(--muted); font-size: .92rem; }
.solution-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0 22px; }
.sol { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 10px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.sol .k { font-size: .68rem; color: var(--muted); font-weight: 800; letter-spacing: .1em; }
html[lang="en"] .sol .k { text-transform: uppercase; }
.sol .icon-box { width: 50px; height: 50px; border-radius: 14px; margin: 0; }
.sol .v { font-weight: 700; font-size: .92rem; line-height: 1.25; color: var(--text); }
.steps-title { font-size: .8rem; font-weight: 800; letter-spacing: .14em; color: var(--muted); margin-bottom: 12px; }
html[lang="en"] .steps-title { text-transform: uppercase; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.step { display: flex; gap: 13px; align-items: flex-start; }
.step-num { flex: none; width: 27px; height: 27px; border-radius: 9px; background: var(--gold); color: #1A1204; font-weight: 800; display: grid; place-items: center; font-size: .82rem; }
.step-text { color: var(--text-2); padding-top: 1px; }
.result .btn-teal { width: auto; }

/* archive */
.page-head { padding-inline: 2px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 4px; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 9px 17px; min-height: 42px; font-weight: 700; font-size: .86rem; transition: transform .1s, border-color .15s, background .15s, color .15s; }
.chip:hover { border-color: var(--line-2); color: var(--text); }
.chip:active { transform: scale(.97); }
.chip.on { background: var(--lamp); color: var(--bg); border-color: transparent; }
.chip.diff-easy.on { background: var(--green); color: #07160F; }
.chip.diff-medium.on { background: var(--gold); color: #1A1204; }
.chip.diff-hard.on { background: var(--red); color: #1E0C09; }
.chip.diff-expert.on { background: #BFA3E8; color: #180F28; }
.archive-list { display: grid; gap: 14px; }
@media (min-width: 640px) { .archive-list { grid-template-columns: repeat(2, 1fr); gap: 16px; } }
@media (min-width: 980px) { .archive-list { grid-template-columns: repeat(3, 1fr); } }
.arch { display: flex; flex-direction: column; overflow: hidden; padding: 0; transition: transform .14s, box-shadow .14s, border-color .14s; }
.arch:hover { transform: translateY(-3px); box-shadow: var(--sh-3); border-color: var(--line-2); }
.arch-img { aspect-ratio: 3/2; background: var(--bg-2); position: relative; }
.arch-img img { width: 100%; height: 100%; object-fit: cover; }
.arch-img::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, var(--surface), rgba(14, 26, 44, .15) 42%, transparent 70%); }
/* the badge sits on artwork, so it carries its own dark plate */
.arch-img .badge { position: absolute; inset-block-start: 12px; inset-inline-start: 12px; z-index: 2;
  background: rgba(3, 10, 22, .82); box-shadow: 0 2px 10px rgba(0, 0, 0, .45);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.arch-img.no-art { aspect-ratio: 5/2; background: repeating-linear-gradient(135deg, var(--surface-2), var(--surface-2) 12px, var(--surface) 12px, var(--surface) 24px); }
.arch-img.no-art img { display: none; }
.arch-body { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.arch-date { font-size: .8rem; color: var(--muted); font-weight: 500; }
.arch-title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; color: var(--lamp); line-height: 1.25; }
html[lang="ar"] .arch-title { font-family: var(--font-ar); font-weight: 800; font-size: 1.12rem; }
.arch-foot { margin-top: auto; padding-top: 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.arch-foot .btn { min-height: 38px; padding: 7px 17px; font-size: .88rem; }
.page-title { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.7rem, 4vw, 2.2rem); margin-bottom: 6px; color: var(--lamp); }
html[lang="ar"] .page-title { font-family: var(--font-ar); }
.page-sub { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 44px 0; }

/* ---- how to play ---- */
.how-band {
  font-size: .8rem; font-weight: 800; letter-spacing: .16em; color: var(--muted);
  margin: 26px 2px 2px;
}
html[lang="en"] .how-band { text-transform: uppercase; }
.tour { display: grid; gap: 16px; }
.tour-step { display: grid; gap: 12px; }
@media (min-width: 900px) { .tour-step { grid-template-columns: 300px 1fr; gap: 20px; align-items: start; } }
.tour-note {
  background: linear-gradient(180deg, rgba(239, 166, 60, .10), var(--surface-2));
  border: 1px solid var(--gold-line); border-radius: var(--r-md); padding: 16px 18px;
  position: relative;
}
.tour-note h3 { font-size: 1rem; color: var(--gold); margin-bottom: 6px; }
.tour-note p { color: var(--text-2); font-size: .93rem; }
@media (min-width: 900px) { .tour-note { position: sticky; top: 92px; } }
.tour-demo > .card { margin: 0; }
.tour-demo .hero-media { min-height: 0; }

.thinks { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; counter-reset: think; }
.think {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-2), var(--edge); padding: 18px 16px;
}
@media (min-width: 720px) { .think { padding: 22px 24px; } }
.think-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.think-clue { font-weight: 700; color: var(--lamp); }
.think-text { color: var(--text-2); margin-bottom: 16px; }
.think-grid .gridbox.sheet { margin-inline: auto; }

/* the worked example is not clickable */
.gridbox.static .cell, .gridbox.static .gico { cursor: default; pointer-events: none; }
.gridbox.static .cell:hover { background: rgba(157, 186, 226, .05); border-color: var(--rule); }
.gridbox.static .cell[data-state="x"]:hover { background: rgba(224, 92, 74, .20); border-color: rgba(224, 92, 74, .8); }
.gridbox.static .cell[data-state="ok"]:hover { background: rgba(79, 169, 127, .20); border-color: rgba(79, 169, 127, .8); }
.btn.demo { cursor: default; opacity: .75; }
.tour-demo select[disabled] { opacity: 1; cursor: default; }

/* footer */
.site-footer { text-align: center; color: var(--muted); font-size: .86rem; padding-block: 18px 34px; border-top: 1px solid var(--line); }
.foot-tag { font-weight: 700; color: var(--text-2); margin-bottom: 5px; letter-spacing: .02em; }
.foot-tag::before, .foot-tag::after { content: " — "; color: var(--gold); }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; width: 100%; height: 100%; display: none; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } html { scroll-behavior: auto; } }
