:root {
  --paper: #f6f1e7;
  --paper-2: #efe7d6;
  --ink: #141414;
  --ink-2: #3a3a3a;
  --muted: #6b665c;
  --line: #d9cfbb;
  --yellow: #ffd23f;
  --red: #d7263d;
  --green: #1b998b;
  --blue: #2e86ab;
  --orange: #f46036;
  --purple: #7b5ea7;
  --card: #fffdf8;
  --radius: 14px;
  --shadow: 4px 4px 0 var(--ink);
  --font: "IBM Plex Sans Arabic", system-ui, sans-serif;
  --display: "Noto Kufi Arabic", "IBM Plex Sans Arabic", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
.wrap { width: min(1160px, 100%); margin-inline: auto; padding-inline: 20px; }
.muted { color: var(--muted); font-size: 15px; }
.red { color: var(--red); }

/* ── Topbar ── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--ink);
}
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 62px; }
.logo { display: inline-flex; align-items: center; gap: 2px; text-decoration: none; font-family: var(--display); font-weight: 900; }
.bubble {
  position: relative; background: var(--yellow); border: 2px solid var(--ink);
  border-radius: 14px; padding: 0 12px; font-size: 20px; line-height: 1.7;
}
.bubble::after {
  content: ""; position: absolute; bottom: -9px; right: 14px;
  border: 7px solid transparent; border-top: 8px solid var(--ink); border-bottom: 0;
}
.tld { font-size: 18px; direction: ltr; unicode-bidi: isolate; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { text-decoration: none; font-weight: 700; font-size: 15px; padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
.nav a:hover { background: var(--ink); color: var(--paper); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 2px solid var(--ink); border-radius: 999px; padding: 9px 20px;
  font-weight: 700; text-decoration: none; cursor: pointer; background: var(--card);
  transition: transform .12s, box-shadow .12s; box-shadow: 3px 3px 0 var(--ink);
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-yellow { background: var(--yellow); }
.btn-wa { background: #25d366; }
.btn-fb { background: #1877f2; color: #fff; }
.btn-ghost-ink { background: transparent; }
.btn-ghost { background: transparent; color: var(--paper); border-color: var(--paper); box-shadow: 3px 3px 0 var(--yellow); }
.btn-lg { font-size: 20px; padding: 12px 28px; }

/* ── Hero ── */
.hero { border-bottom: 2px solid var(--ink); position: relative; overflow: hidden; }
.hero-in { padding-block: 56px 40px; }
.kicker { display: inline-block; font-weight: 700; font-size: 14px; border: 2px solid var(--ink); border-radius: 999px; padding: 2px 14px; margin: 0 0 18px; background: var(--card); }
.hero h1 { font-family: var(--display); font-weight: 900; font-size: clamp(40px, 8vw, 92px); line-height: 1.25; margin: 0 0 18px; letter-spacing: -0.5px; }
.hero h1 mark { background: linear-gradient(transparent 55%, var(--yellow) 55%); color: inherit; padding-inline: 4px; }
.lead { font-size: clamp(18px, 2.2vw, 22px); max-width: 720px; margin: 0 0 26px; color: var(--ink-2); }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 40px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.stat .num { font-family: var(--display); font-weight: 900; font-size: clamp(30px, 4.4vw, 50px); line-height: 1.3; font-variant-numeric: tabular-nums; }
.stat .lbl { font-size: 14px; color: var(--muted); font-weight: 500; line-height: 1.5; }
.stat:nth-child(2) .num { color: var(--red); }

.ticker { background: var(--ink); color: var(--yellow); overflow: hidden; white-space: nowrap; border-top: 2px solid var(--ink); }
.ticker-track { display: inline-flex; gap: 34px; padding: 10px 0; font-family: var(--display); font-weight: 800; font-size: 18px; animation: tick 60s linear infinite; }
.ticker-track span::after { content: "✦"; margin-inline-start: 34px; color: var(--paper); opacity: .5; }
@keyframes tick { from { transform: translateX(0); } to { transform: translateX(50%); } }

/* ── Sections ── */
.section { padding-block: 72px; border-bottom: 2px solid var(--ink); }
.section-ink { background: var(--ink); color: var(--paper); }
.section-yellow { background: var(--yellow); }
.sec-head { margin-bottom: 30px; max-width: 760px; }
.sec-num { font-family: var(--display); font-weight: 900; font-size: 15px; border: 2px solid currentColor; border-radius: 999px; padding: 0 12px; }
.sec-head h2 { font-family: var(--display); font-weight: 900; font-size: clamp(32px, 5vw, 56px); line-height: 1.3; margin: 12px 0 6px; }
.sec-head p { margin: 0; font-size: 18px; opacity: .85; }

/* ── Tabs / filters ── */
.tabs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.tab { border: 2px solid var(--ink); background: var(--card); border-radius: 12px; padding: 10px 18px; cursor: pointer; text-align: start; box-shadow: 3px 3px 0 var(--ink); }
.tab b { display: block; font-family: var(--display); font-size: 18px; }
.tab small { color: var(--muted); font-weight: 500; }
.tab[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.tab[aria-selected="true"] small { color: var(--yellow); }
.gov-note { color: var(--muted); margin: 6px 0 18px; font-size: 15px; }

.summary { display: flex; height: 38px; border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; margin-bottom: 22px; background: var(--card); }
.summary span { display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; color: #fff; white-space: nowrap; overflow: hidden; transition: flex-grow .4s; min-width: 0; }

.filters { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 2px solid var(--ink); background: var(--card); border-radius: 999px; padding: 4px 14px; font-weight: 700; font-size: 15px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.chips-dark .chip { background: transparent; border-color: var(--paper); color: var(--paper); }
.chips-dark .chip[aria-pressed="true"] { background: var(--yellow); color: var(--ink); border-color: var(--yellow); }
.filters-row { display: flex; gap: 10px; flex-wrap: wrap; }
.filters-row select, .filters-row input { border: 2px solid var(--ink); border-radius: 10px; background: var(--card); padding: 8px 12px; min-width: 0; }
.filters-row input { flex: 1 1 220px; }

/* ── Status colors ── */
.st-done     { --st: var(--green); }
.st-partial  { --st: #e0a100; }
.st-progress { --st: var(--blue); }
.st-running  { --st: var(--purple); }
.st-disputed { --st: var(--orange); }
.st-broken   { --st: var(--red); }

/* ── Cards ── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.card {
  position: relative; background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius);
  padding: 18px 18px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px;
  cursor: pointer; transition: transform .15s, box-shadow .15s; text-align: start;
}
.card:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 7px; background: var(--st); border-radius: 12px 12px 0 0; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-top: 4px; }
.tag { display: inline-block; font-size: 13px; font-weight: 700; background: var(--paper-2); border-radius: 6px; padding: 1px 8px; }
.tag-line { background: transparent; border: 1px solid var(--line); }
.tag-vague { background: #fde2e4; color: var(--red); }
.card h3 { font-family: var(--display); font-weight: 800; font-size: 20px; line-height: 1.55; margin: 0; }
.card .q { color: var(--muted); font-size: 15px; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clock { font-size: 14px; font-weight: 700; }
.clock .bar { height: 8px; border: 1.5px solid var(--ink); border-radius: 99px; overflow: hidden; margin-top: 4px; background: var(--paper); }
.clock .bar i { display: block; height: 100%; background: var(--st); }
.card-foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; font-size: 14px; color: var(--muted); }
.card-foot b { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }

.stamp {
  font-family: var(--display); font-weight: 900; color: var(--st); border: 3px solid var(--st);
  border-radius: 8px; padding: 0 10px; font-size: 15px; transform: rotate(-6deg); white-space: nowrap;
  background: color-mix(in srgb, var(--st) 8%, transparent); line-height: 1.8; flex-shrink: 0;
}
.stamp-lg { display: inline-block; font-size: 26px; padding: 2px 18px; border-width: 4px; margin: 6px 0 4px; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }

.suggest { margin-top: 36px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; border: 2px dashed var(--ink); border-radius: var(--radius); padding: 20px 22px; }
.suggest h3 { margin: 0; font-family: var(--display); }
.suggest p { margin: 0; color: var(--muted); }

/* ── Generator ── */
.speech {
  background: var(--paper); color: var(--ink); border-radius: var(--radius); padding: 26px; margin: 22px 0;
  border: 2px solid var(--paper); box-shadow: 6px 6px 0 var(--yellow); max-width: 860px;
}
.speech-head { display: flex; align-items: center; gap: 14px; border-bottom: 2px solid var(--ink); padding-bottom: 14px; margin-bottom: 16px; }
.speech-head small { display: block; color: var(--muted); }
.seal { width: 46px; height: 46px; border-radius: 50%; background: var(--yellow); display: grid; place-items: center; font-size: 22px; flex-shrink: 0; border: 2px solid var(--ink); }
.speech-body { font-size: clamp(19px, 2.3vw, 24px); line-height: 1.9; margin: 0 0 20px; font-weight: 500; min-height: 5em; }
.speech-body.pop { animation: pop .35s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.meters { display: grid; gap: 8px; }
.meter { display: grid; grid-template-columns: 140px 1fr 50px; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
.meter .bar { height: 14px; border: 2px solid var(--ink); border-radius: 99px; overflow: hidden; background: #fff; }
.meter .bar i { display: block; height: 100%; width: 0; background: var(--red); transition: width .6s; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ── Bingo ── */
.bingo-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 26px; align-items: start; }
.bingo { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; background: var(--ink); padding: 6px; border-radius: var(--radius); box-shadow: 6px 6px 0 var(--yellow); }
.cell {
  aspect-ratio: 1; background: var(--card); border: 0; border-radius: 8px; padding: 6px; cursor: pointer;
  font-weight: 700; font-size: clamp(11px, 1.7vw, 16px); line-height: 1.4; display: grid; place-items: center; text-align: center; position: relative;
  transition: background .15s;
}
.cell:hover { background: var(--paper-2); }
.cell.on { background: var(--yellow); }
.cell.on::after { content: "✓"; position: absolute; top: 2px; left: 6px; font-size: 14px; color: var(--red); }
.cell.free { background: var(--red); color: #fff; font-family: var(--display); font-weight: 900; }
.cell.win { background: var(--green); color: #fff; }
.bingo-side { display: flex; flex-direction: column; gap: 12px; }
.bingo-score { font-family: var(--display); font-weight: 900; font-size: 56px; line-height: 1; }
.bingo-score small { font-size: 18px; color: var(--muted); }
.bingo-lines { margin: 0; font-size: 18px; }
.tip { font-size: 14px; color: var(--muted); border-inline-start: 3px solid var(--yellow); padding-inline-start: 10px; }

/* ── Lexicon ── */
.lex { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.lex-card { perspective: 900px; height: 190px; cursor: pointer; border: 0; background: none; padding: 0; text-align: start; }
.lex-in { position: relative; width: 100%; height: 100%; transition: transform .5s; transform-style: preserve-3d; }
.lex-card.flip .lex-in { transform: rotateY(180deg); }
.lex-face { position: absolute; inset: 0; backface-visibility: hidden; border: 2px solid var(--ink); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); }
.lex-front { background: var(--card); }
.lex-back { background: var(--ink); color: var(--paper); transform: rotateY(180deg); }
.lex-face b { font-family: var(--display); font-size: 22px; }
.lex-face small { font-weight: 700; font-size: 13px; opacity: .7; }
.lex-back small { color: var(--yellow); opacity: 1; }
.lex-face p { margin: 0; font-size: 16px; }
.lex-back p { font-size: 18px; font-weight: 700; }
.lex-hint { margin-top: auto; font-size: 13px; color: var(--muted); }

/* ── About ── */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; }
.about h3 { font-family: var(--display); font-size: 22px; margin: 0 0 14px; }
.legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.legend li { display: flex; gap: 12px; align-items: flex-start; }
.legend p { margin: 0; font-size: 15px; color: var(--ink-2); }
.rules { padding-inline-start: 20px; margin: 0 0 14px; display: grid; gap: 8px; }

/* ── Footer ── */
.footer { background: var(--ink); color: var(--paper); padding-block: 40px; }
.footer-in { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.footer p { margin: 0; }
.footer .muted { color: #a9a395; }
.logo-light .bubble { color: var(--ink); }
.logo-light .bubble::after { border-top-color: var(--paper); }

/* ── Modal ── */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-bg { position: absolute; inset: 0; background: rgba(20, 20, 20, .6); }
.modal-card {
  position: relative; background: var(--card); border: 2px solid var(--ink); border-radius: 18px; box-shadow: 8px 8px 0 var(--yellow);
  width: min(640px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 26px; animation: pop .25s ease;
}
.modal-x { position: absolute; top: 10px; left: 12px; width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--ink); background: var(--paper); font-size: 24px; line-height: 1; cursor: pointer; }
.m-top { display: flex; gap: 8px; flex-wrap: wrap; padding-inline-end: 44px; }
.modal-card h3 { font-family: var(--display); font-weight: 900; font-size: 26px; line-height: 1.5; margin: 8px 0; }
.modal-card blockquote { margin: 0 0 14px; padding: 10px 14px; border-inline-start: 4px solid var(--yellow); background: var(--paper); font-size: 17px; border-radius: 0 8px 8px 0; }
.m-clock { margin-bottom: 14px; }
.m-verdict, .m-sources { margin-bottom: 10px; font-size: 16px; }
.m-sources a { font-weight: 700; margin-inline-end: 10px; }
.vote { border: 2px solid var(--ink); border-radius: 12px; padding: 14px; margin: 16px 0; background: var(--paper); }
.vote p { margin: 0 0 10px; font-weight: 700; }
.vote-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vote-btn { border: 2px solid var(--ink); border-radius: 10px; padding: 10px; font-weight: 800; cursor: pointer; font-size: 17px; background: var(--card); }
.vote-btn span { display: block; font-size: 14px; font-weight: 700; color: var(--muted); }
.vote-btn.real:hover, .vote-btn.real.mine { background: #d6f2ee; }
.vote-btn.blw:hover, .vote-btn.blw.mine { background: #fde2e4; }
.vote-btn[disabled] { cursor: default; }
.vote-bar { height: 10px; border-radius: 99px; background: var(--red); overflow: hidden; margin-top: 10px; border: 1.5px solid var(--ink); }
.vote-bar i { display: block; height: 100%; width: 50%; background: var(--green); transition: width .5s; }
.share { display: flex; flex-wrap: wrap; gap: 8px; }
.share .btn { padding: 7px 14px; font-size: 15px; }

/* ── Toast / celebrate ── */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 120px); background: var(--ink); color: var(--paper); padding: 10px 20px; border-radius: 999px; font-weight: 700; z-index: 200; transition: transform .3s; box-shadow: 3px 3px 0 var(--yellow); }
.toast.show { transform: translate(-50%, 0); }
.celebrate { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; pointer-events: none; }
.celebrate[hidden] { display: none; }
.celebrate-in { font-family: var(--display); font-weight: 900; font-size: clamp(60px, 16vw, 180px); color: var(--red); background: var(--yellow); border: 6px solid var(--ink); border-radius: 30px; padding: 0 40px; transform: rotate(-8deg); animation: boom .9s ease; box-shadow: 10px 10px 0 var(--ink); }
@keyframes boom { 0% { transform: scale(.2) rotate(-30deg); opacity: 0; } 60% { transform: scale(1.1) rotate(-6deg); opacity: 1; } 100% { transform: scale(1) rotate(-8deg); } }

:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .bingo-wrap { grid-template-columns: 1fr; }
  .bingo-side { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .about-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .wrap { padding-inline: 16px; }
  .topbar-in { height: auto; flex-wrap: wrap; padding-block: 8px 4px; gap: 4px; }
  .nav { width: 100%; margin-inline: -10px; }
  .nav a { font-size: 14px; padding: 4px 10px; }
  .hero-in { padding-block: 36px 28px; }
  .section { padding-block: 52px; }
  .stat { padding: 12px; }
  .meter { grid-template-columns: 110px 1fr 44px; font-size: 13px; }
  .speech { padding: 18px; }
  .bingo { gap: 4px; padding: 4px; }
  .cell { padding: 3px; font-size: 10.5px; border-radius: 6px; }
  .modal-card { padding: 20px 16px; }
  .modal-card h3 { font-size: 22px; }
  .grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
