:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1c1f23;
  --muted: #5b636e;
  --border: #dcdfe3;
  --accent: #0f766e;
  --accent-text: #ffffff;
  --accent-soft: #e2f3f1;
  --warn: #8a5a00;
  --warn-soft: #fff4d6;
  --bad: #b42318;
  --bad-soft: #fdecea;
  --focus: #1d4ed8;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #121416;
    --surface: #1b1e21;
    --text: #eceef0;
    --muted: #a3abb5;
    --border: #30353b;
    --accent: #2dd4bf;
    --accent-text: #06201d;
    --accent-soft: #10302c;
    --warn: #f5c451;
    --warn-soft: #2e2710;
    --bad: #ff8a80;
    --bad-soft: #3a1a18;
    --focus: #93b4ff;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Tahoma, 'Noto Sans Arabic', 'Noto Sans', sans-serif;
  font-size: 17px;
  line-height: 1.75;
}
a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible, .chip input:focus-visible + span {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; inset-inline-start: -999px; top: 0; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { inset-inline-start: 8px; }

/* Header / footer */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-block: 10px; }
.brand { display: inline-flex; min-height: 44px; align-items: center; gap: 8px; font-weight: 700; font-size: 1.2rem; color: var(--text); text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: var(--accent-text); }
.main-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.main-nav a { padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--muted); min-height: 44px; display: inline-flex; align-items: center; }
.main-nav a[aria-current='page'] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.site-footer { margin-top: 48px; padding-block: 24px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.92rem; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.footer-nav a { color: var(--muted); display: inline-block; padding-block: 8px; }

/* Typography */
h1 { font-size: 1.7rem; line-height: 1.4; margin: 20px 0 6px; }
h2 { font-size: 1.25rem; margin: 0 0 8px; }
h3 { font-size: 1.05rem; margin: 0 0 6px; }
.lead { color: var(--muted); margin: 0 0 16px; }
.breadcrumbs { margin-top: 14px; color: var(--muted); font-size: 0.9rem; display: flex; gap: 6px; }

/* Tool */
.tool { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.input-label { display: block; font-weight: 600; margin-bottom: 6px; }
.input-row { display: flex; gap: 8px; }
.input-row input {
  flex: 1; min-width: 0; font: inherit; font-size: 1.25rem; padding: 10px 12px; min-height: 52px;
  border: 2px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text);
}
.input-row input:focus { border-color: var(--accent); }
.clear { min-width: 52px; font-size: 1.5rem; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--muted); cursor: pointer; }
.input-stats { margin: 6px 0 0; color: var(--muted); font-size: 0.88rem; min-height: 1.5em; }
.platforms { border: 0; padding: 0; margin: 10px 0 0; }
.platforms legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg); cursor: pointer;
}
.chip input:checked + span { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.platform-note { margin-top: 10px; font-size: 0.88rem; color: var(--muted); background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.rule-list { margin: 0; padding-inline-start: 18px; }
.rule-list li { margin: 2px 0; }
.src { opacity: 0.85; }
.ev { display: inline-block; font-size: 0.78rem; font-weight: 700; padding: 0 7px; border-radius: 6px; margin-inline-end: 4px; }
.ev-estimated { background: var(--warn-soft); color: var(--warn); }
.ev-unverified { background: var(--bad-soft); color: var(--bad); }
.ev-verified { background: var(--accent-soft); color: var(--accent); }
.disclaimer-inline { margin: 10px 0 0; font-size: 0.88rem; color: var(--warn); background: var(--warn-soft); padding: 6px 10px; border-radius: 8px; }

.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 14px -14px 0; padding: 0 14px 4px; scrollbar-width: thin; }
.tabs button {
  flex: none; min-height: 44px; padding: 6px 14px; border-radius: 999px; font: inherit; font-size: 0.95rem;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
}
.tabs button[aria-pressed='true'] { background: var(--text); color: var(--surface); border-color: var(--text); }
.results-count { margin: 8px 0; color: var(--muted); font-size: 0.9rem; }
.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; background: var(--surface); }
.card.status-warn { border-color: var(--warn); }
.card.status-block, .card.status-over { border-color: var(--bad); }
.out { margin: 0; font-size: 1.35rem; line-height: 1.9; overflow-wrap: anywhere; unicode-bidi: plaintext; min-height: 2.6rem; }
.meta { display: flex; justify-content: space-between; gap: 8px; font-size: 0.82rem; color: var(--muted); }
.count { font-variant-numeric: tabular-nums; white-space: nowrap; }
.status-over .count, .status-block .count { color: var(--bad); font-weight: 700; }
.issue { margin: 0; font-size: 0.82rem; color: var(--bad); }
.status-warn .issue { color: var(--warn); }
.actions { display: flex; gap: 8px; margin-top: 4px; }
.actions button, .primary {
  min-height: 44px; font: inherit; border-radius: 10px; cursor: pointer; border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.fav { width: 48px; font-size: 1.2rem; }
.fav[aria-pressed='true'] { color: #d97706; }
.copy, .primary { flex: 1; background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.copy.copied { opacity: 0.85; }
.more { display: block; width: 100%; margin-top: 12px; min-height: 48px; font: inherit; font-weight: 600; border-radius: 10px; cursor: pointer; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.more[hidden] { display: none; }
.empty { color: var(--muted); text-align: center; padding: 16px; }

/* Content */
.content { margin-top: 28px; }
.content p, .content li { max-width: 72ch; }
.faq details { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); padding: 0 12px; margin-bottom: 8px; }
.faq summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.faq details p { margin-top: 0; }
.example-row { margin-top: 12px; }
.example-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.copy-inline {
  font: inherit; font-size: 1.1rem; min-height: 44px; padding: 4px 12px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); unicode-bidi: plaintext;
}
.related-list { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; }
.related-list a { display: inline-flex; align-items: center; min-height: 44px; padding: 4px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); text-decoration: none; }
.contact-email { font-size: 1.1rem; direction: ltr; text-align: right; }

/* Symbols */
.compose { position: sticky; top: 0; background: var(--surface); padding-bottom: 8px; z-index: 2; }
.compose-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.compose-actions .primary { flex: none; padding: 0 20px; }
.sym-group { margin-top: 18px; }
.sym-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
.sym {
  min-height: 52px; font-size: 1.4rem; border: 1px solid var(--border); border-radius: 10px; background: var(--bg);
  color: var(--text); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.sym small { font-size: 0.7rem; color: var(--muted); }
.sym-invisible { outline: 1px dashed var(--border); }

/* Consent banner: accept and reject are deliberately styled the same (no nudging). */
.consent {
  position: fixed; inset-inline: 12px; bottom: 12px; z-index: 30; max-width: 560px; margin-inline: auto;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
}
.consent[hidden] { display: none; }
.consent p { margin: 0 0 8px; font-size: 0.95rem; }
.consent-title { font-weight: 700; }
.consent-actions { display: flex; gap: 8px; }
.consent-actions button {
  flex: 1; min-height: 44px; font: inherit; font-weight: 600; border-radius: 10px; cursor: pointer;
  border: 2px solid var(--text); background: var(--surface); color: var(--text);
}
.consent-settings {
  font: inherit; font-size: inherit; color: var(--muted); background: none; border: 0; padding: 8px 0;
  text-decoration: underline; cursor: pointer;
}
.toast {
  position: fixed; inset-inline: 0; bottom: 20px; margin: 0 auto; width: max-content; max-width: 90vw;
  background: var(--text); color: var(--surface); padding: 10px 18px; border-radius: 999px; z-index: 20; font-weight: 600;
}
@media (min-width: 720px) {
  h1 { font-size: 2rem; }
  .tool { padding: 18px; }
}
@media (prefers-reduced-motion: no-preference) {
  .chip span, .tabs button, .copy { transition: background-color 0.15s, color 0.15s; }
}
