/* ---------- Tokens ---------- */
:root {
  --bg: #f4f6fb;
  --bg-alt: #eef2f9;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --ink: #0d1b2e;
  --ink-2: #2b3a52;
  --muted: #5f6f86;
  --line: #e2e8f1;
  --line-strong: #c9d3e1;
  --brand: #1d4ed8;
  --brand-2: #2563eb;
  --brand-soft: #e8efff;
  --navy: #0a1a33;
  --navy-2: #13284d;
  --red: #c8102e;

  --ok: #0e9f6e;
  --ok-soft: #e3f7ee;
  --ok-ink: #046c4e;
  --warn: #d97706;
  --warn-soft: #fff4dc;
  --warn-ink: #92400e;
  --fail: #dc2626;
  --fail-soft: #fde8e8;
  --fail-ink: #9b1c1c;
  --skip: #94a3b8;
  --skip-soft: #f1f5f9;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(13, 27, 46, .06), 0 1px 1px rgba(13, 27, 46, .04);
  --shadow: 0 10px 30px -12px rgba(13, 27, 46, .18), 0 2px 6px rgba(13, 27, 46, .05);
  --shadow-lg: 0 30px 60px -20px rgba(10, 26, 51, .35);
  --font: 'Inter', 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Plus Jakarta Sans', var(--font);
  --mono: 'JetBrains Mono', 'IBM Plex Sans Arabic', ui-monospace, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a111e; --bg-alt: #0d1626; --surface: #111b2c; --surface-2: #142035;
    --ink: #e7edf7; --ink-2: #c3cede; --muted: #8b9ab1; --line: #1f2c43; --line-strong: #2c3c58;
    --brand: #5b8cff; --brand-2: #7aa2ff; --brand-soft: #16264a;
    --ok: #34d399; --ok-soft: #0e2a22; --ok-ink: #6ee7b7;
    --warn: #fbbf24; --warn-soft: #2d230d; --warn-ink: #fcd34d;
    --fail: #f87171; --fail-soft: #2f1416; --fail-ink: #fca5a5;
    --skip-soft: #172235;
    --shadow: 0 10px 30px -12px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a111e; --bg-alt: #0d1626; --surface: #111b2c; --surface-2: #142035;
  --ink: #e7edf7; --ink-2: #c3cede; --muted: #8b9ab1; --line: #1f2c43; --line-strong: #2c3c58;
  --brand: #5b8cff; --brand-2: #7aa2ff; --brand-soft: #16264a;
  --ok: #34d399; --ok-soft: #0e2a22; --ok-ink: #6ee7b7;
  --warn: #fbbf24; --warn-soft: #2d230d; --warn-ink: #fcd34d;
  --fail: #f87171; --fail-soft: #2f1416; --fail-ink: #fca5a5;
  --skip-soft: #172235;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.02em; margin: 0; line-height: 1.15; }
h2 { font-size: clamp(1.4rem, 1.1rem + 1vw, 2rem); }
h3 { font-size: 1.05rem; }
p { margin: 0; }
a { color: var(--brand); text-underline-offset: 3px; }
svg { flex-shrink: 0; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 600; font-size: 0.95rem; cursor: pointer; text-decoration: none;
  transition: transform .15s, background .15s, box-shadow .15s, border-color .15s;
}
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--brand) 70%, transparent); }
.btn-primary:hover { background: var(--brand-2); }
.btn-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-secondary:hover { border-color: var(--brand); color: var(--brand); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 0.84rem; border-radius: 10px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); cursor: pointer; color: #fff;
}
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.icon-btn .i-sun { display: none; }
:root[data-theme="dark"] .icon-btn .i-sun { display: block; }
:root[data-theme="dark"] .icon-btn .i-moon { display: none; }
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 0.74rem; font-weight: 700; letter-spacing: .02em; }
.chip-brand { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.2); }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; color: #fff;
  background: color-mix(in srgb, var(--navy) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.topbar-inner { display: flex; align-items: center; gap: 20px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand-mark { color: var(--brand-2); display: grid; }
.brand-mark svg { width: 32px; height: 32px; }
.brand-text { font-family: var(--display); font-weight: 700; font-size: 1.08rem; letter-spacing: -0.01em; }
.brand-text b { color: #93b4ff; font-weight: 800; }
.nav { display: none; gap: 4px; margin-inline-start: auto; }
.nav a { color: rgba(255,255,255,.78); text-decoration: none; font-weight: 500; font-size: .92rem; padding: 8px 12px; border-radius: 10px; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.lang-pick { position: relative; display: flex; align-items: center; margin-inline-start: auto; color: rgba(255,255,255,.85); }
.lang-pick svg { position: absolute; inset-inline-start: 11px; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; pointer-events: none; }
.lang-pick select { appearance: none; -webkit-appearance: none; height: 40px; padding-inline: 34px 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.08); color: #fff; font: 500 .88rem var(--font); cursor: pointer; }
.lang-pick select:hover { background: rgba(255,255,255,.14); }
.lang-pick select:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }
.lang-pick option { color: var(--ink); background: var(--surface); }
.topbar .icon-btn { flex-shrink: 0; }
@media (min-width: 820px) { .nav { display: flex; } .lang-pick { margin-inline-start: 8px; } }
@media (max-width: 400px) {
  .topbar-inner { gap: 10px; }
  .topbar .chip-brand, .lang-pick svg { display: none; }
  .brand-text { white-space: nowrap; }
  .lang-pick select { padding-inline: 10px; }
}

/* ---------- Hero ---------- */
.hero { position: relative; color: #fff; padding: 56px 0 72px; overflow: hidden; background: var(--navy); }
.hero-bg {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(37,99,235,.55), transparent 60%),
    radial-gradient(700px 420px at -10% 110%, rgba(200,16,46,.28), transparent 60%),
    linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
}
.hero-bg::before {
  content: ''; position: absolute; inset: 0; opacity: .5;
  background-image: radial-gradient(rgba(255,255,255,.35) 1px, transparent 1.2px);
  background-size: 26px 26px;
  mask-image: radial-gradient(ellipse at 70% 30%, #000 0%, transparent 70%);
}
.hero-bg::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 6px;
  background: repeating-linear-gradient(90deg, var(--red) 0 40px, #fff 40px 80px);
  opacity: .9;
}
.hero-grid { position: relative; display: grid; gap: 40px; align-items: center; }
@media (min-width: 980px) { .hero-grid { grid-template-columns: 1.05fr 1fr; gap: 56px; } .hero { padding: 80px 0 96px; } }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: .8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #a9c1ff; margin-bottom: 16px; }
.eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: #f87171; box-shadow: 0 0 0 4px rgba(248,113,113,.2); }
.eyebrow.dark { color: var(--brand); }
.hero h1 { font-size: clamp(2.1rem, 1.4rem + 3vw, 3.6rem); font-weight: 800; line-height: 1.04; letter-spacing: -0.035em; }
.hero h1 .hl { background: linear-gradient(90deg, #93b4ff, #fca5a5); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { margin-top: 18px; font-size: 1.08rem; color: rgba(255,255,255,.78); max-width: 560px; }
.hero-points { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 12px; }
.hero-points li { display: flex; gap: 12px; align-items: center; color: rgba(255,255,255,.82); }
.hero-points svg { width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); fill: none; stroke: #93b4ff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hero-points b { color: #fff; }

/* ---------- Upload card ---------- */
.upload-card { padding: 14px; box-shadow: var(--shadow-lg); border-color: transparent; color: var(--ink); }
.dropzone {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
  padding: 36px 20px 30px; border: 2px dashed var(--line-strong); border-radius: 14px; cursor: pointer;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  transition: border-color .2s, background .2s, transform .2s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.dropzone.drag { transform: scale(1.01); }
.dz-art { position: relative; margin-bottom: 10px; }
.dz-frame { position: relative; width: 112px; height: 112px; border-radius: 14px; background: var(--surface); display: grid; place-items: center; box-shadow: var(--shadow); }
.dz-frame svg { width: 64px; height: 64px; fill: var(--brand-soft); stroke: var(--brand); stroke-width: 2.5; }
.dz-corner { position: absolute; width: 18px; height: 18px; border: 3px solid var(--brand); }
.dz-corner.tl { top: -6px; left: -6px; border-right: 0; border-bottom: 0; border-radius: 8px 0 0 0; }
.dz-corner.tr { top: -6px; right: -6px; border-left: 0; border-bottom: 0; border-radius: 0 8px 0 0; }
.dz-corner.bl { bottom: -6px; left: -6px; border-right: 0; border-top: 0; border-radius: 0 0 0 8px; }
.dz-corner.br { bottom: -6px; right: -6px; border-left: 0; border-top: 0; border-radius: 0 0 8px 0; }
.dz-badge { position: absolute; inset-inline-end: -14px; bottom: -10px; width: 38px; height: 38px; border-radius: 50%; background: var(--brand); display: grid; place-items: center; box-shadow: 0 6px 16px -4px rgba(29,78,216,.6); border: 3px solid var(--surface); }
.dz-badge svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.dz-title { font-family: var(--display); font-weight: 700; font-size: 1.25rem; }
.dz-sub { color: var(--muted); font-size: .9rem; }
.dz-sub u { color: var(--brand); text-decoration-thickness: 1.5px; }
.dz-btn { margin-top: 12px; pointer-events: none; }
.upload-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 6px 2px; flex-wrap: wrap; }
.model-status { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; font-weight: 500; color: var(--muted); }
.model-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 0 rgba(217,119,6,.6); animation: pulse 1.4s infinite; }
.model-status[data-state="ready"] i { background: var(--ok); animation: none; }
.model-status[data-state="error"] i { background: var(--fail); animation: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(217,119,6,0); } 100% { box-shadow: 0 0 0 0 rgba(217,119,6,0); } }

/* ---------- Analyzing ---------- */
.analyzing { margin-top: -40px; position: relative; z-index: 2; }
.analyzing-card { display: grid; gap: 28px; padding: 28px; align-items: center; box-shadow: var(--shadow); }
@media (min-width: 720px) { .analyzing-card { grid-template-columns: 180px 1fr; } }
.scan-thumb { position: relative; width: 180px; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--surface-2) center/cover no-repeat; margin: 0 auto; }
.scan-line { position: absolute; left: 0; right: 0; height: 40%; background: linear-gradient(180deg, transparent, rgba(37,99,235,.35) 85%, #60a5fa 100%); animation: scan 1.6s ease-in-out infinite alternate; }
@keyframes scan { from { top: -40%; } to { top: 100%; } }
.analyzing h2 { margin-bottom: 14px; }
.stepper { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.stepper li { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.stepper li::before { content: ''; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); flex-shrink: 0; box-sizing: border-box; }
.stepper li.active { color: var(--ink); font-weight: 600; }
.stepper li.active::before { border-color: var(--brand); border-right-color: transparent; animation: spin .8s linear infinite; }
.stepper li.done { color: var(--ink-2); }
.stepper li.done::before { border: 0; background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center/14px no-repeat; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Results ---------- */
.results { margin-top: -40px; position: relative; z-index: 2; padding-bottom: 64px; display: grid; gap: 22px; }
.verdict { display: grid; gap: 20px; padding: 22px; align-items: center; box-shadow: var(--shadow); overflow: hidden; position: relative; }
.verdict::before { content: ''; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 6px; background: var(--v-color, var(--brand)); }
.verdict[data-verdict="ready"] { --v-color: var(--ok); --v-soft: var(--ok-soft); --v-ink: var(--ok-ink); }
.verdict[data-verdict="review"] { --v-color: var(--warn); --v-soft: var(--warn-soft); --v-ink: var(--warn-ink); }
.verdict[data-verdict="reject"] { --v-color: var(--fail); --v-soft: var(--fail-soft); --v-ink: var(--fail-ink); }
@media (min-width: 860px) { .verdict { grid-template-columns: 1fr auto; padding: 24px 28px; } .verdict-actions { grid-column: 1 / -1; justify-content: flex-start; } }
@media (min-width: 1180px) { .verdict { grid-template-columns: 1fr auto auto; } .verdict-actions { grid-column: auto; } }
.ring { position: relative; width: 104px; height: 104px; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring .bg { stroke: var(--line); }
.ring .fg { stroke: var(--v-color); stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(.2,.8,.2,1); }
.ring .val { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .val b { font-family: var(--display); font-size: 1.7rem; font-weight: 800; line-height: 1; display: block; }
.ring .val span { font-size: .68rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.verdict-main { display: flex; gap: 20px; align-items: center; }
.v-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: .76rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; background: var(--v-soft); color: var(--v-ink); margin-bottom: 6px; }
.v-badge svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.verdict h2 { font-size: clamp(1.25rem, 1rem + 1vw, 1.65rem); }
.verdict p { color: var(--muted); margin-top: 4px; }
.counts { display: flex; gap: 10px; flex-wrap: nowrap; }
.count { display: flex; flex-direction: column; min-width: 86px; padding: 10px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.count b { font-family: var(--display); font-size: 1.5rem; line-height: 1.1; }
.count span { font-size: .75rem; color: var(--muted); font-weight: 600; }
.count.fail b { color: var(--fail); } .count.warn b { color: var(--warn); } .count.pass b { color: var(--ok); }
.verdict-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.results-grid { display: grid; gap: 22px; align-items: start; }
@media (min-width: 1000px) { .results-grid { grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr); } }

/* Viewer */
.viewer { padding: 14px; position: sticky; top: 80px; }
@media (max-width: 999px) { .viewer { position: static; } }
.viewer-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 11px; border-radius: 9px; font-size: .82rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg button[aria-pressed="true"]::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); margin-inline-end: 6px; vertical-align: middle; }
.stage-wrap {
  display: grid; place-items: center; border-radius: 14px; padding: 10px;
  background:
    linear-gradient(45deg, var(--surface-2) 25%, transparent 25%, transparent 75%, var(--surface-2) 75%) 0 0/20px 20px,
    linear-gradient(45deg, var(--surface-2) 25%, transparent 25%, transparent 75%, var(--surface-2) 75%) 10px 10px/20px 20px,
    var(--bg-alt);
}
.stage { position: relative; width: 100%; border-radius: 6px; overflow: hidden; box-shadow: 0 10px 30px -10px rgba(0,0,0,.35); }
.stage img { display: block; width: 100%; height: 100%; object-fit: fill; user-select: none; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity .15s; }
.stage.peek canvas { opacity: 0; }
.stage-empty { display: grid; place-items: center; gap: 8px; padding: 50px 20px; text-align: center; color: var(--muted); }
.focus-tag { position: absolute; inset-inline-start: 10px; bottom: 10px; padding-block: 6px; padding-inline: 12px 10px; border-radius: 999px; background: rgba(10,18,32,.86); color: #fff; font-size: .78rem; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.focus-tag button { background: rgba(255,255,255,.18); border: 0; border-radius: 50%; width: 20px; height: 20px; cursor: pointer; color: #fff; line-height: 1; }
.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }
@media (min-width: 560px) { .metrics { grid-template-columns: repeat(4, 1fr); } }
.metric { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.metric span { display: block; font-size: .72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.metric b { white-space: nowrap; font-family: var(--mono); font-size: .92rem; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.metric b i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.metric.pass b i { background: var(--ok); } .metric.warn b i { background: var(--warn); } .metric.fail b i { background: var(--fail); } .metric.skip b i { background: var(--skip); }
.hint { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: .82rem; margin-top: 10px; }
.hint svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* Checks */
.checks-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.checks-head h2 { font-size: 1.3rem; }
.filter { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.filter button { border: 0; background: transparent; padding: 6px 12px; border-radius: 9px; font-size: .84rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.filter button[aria-selected="true"] { background: var(--ink); color: var(--surface); }
.group { margin-bottom: 14px; }
.group-head { display: flex; align-items: center; gap: 10px; padding: 4px 4px 8px; }
.group-head h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-family: var(--font); font-weight: 700; }
.group-head .mini { margin-inline-start: auto; display: flex; gap: 4px; }
.group-head .mini i { width: 18px; height: 6px; border-radius: 3px; display: block; }
.mini .pass { background: var(--ok); } .mini .warn { background: var(--warn); } .mini .fail { background: var(--fail); } .mini .skip { background: var(--line-strong); }
.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.check { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.check.is-fail { border-color: color-mix(in srgb, var(--fail) 35%, var(--line)); }
.check.is-warn { border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); }
.check.active { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 35%, transparent); border-color: var(--brand); }
.check-row { width: 100%; display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px; align-items: center; padding: 12px 14px; border: 0; background: transparent; text-align: start; cursor: pointer; }
.check-row:hover { background: var(--surface-2); }
.st { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; }
.st svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.is-pass .st { background: var(--ok-soft); color: var(--ok); }
.is-warn .st { background: var(--warn-soft); color: var(--warn); }
.is-fail .st { background: var(--fail-soft); color: var(--fail); }
.is-skip .st { background: var(--skip-soft); color: var(--skip); }
.check-title { font-weight: 600; display: block; line-height: 1.3; }
.check-req { font-size: .8rem; color: var(--muted); }
.check-val { font-family: var(--mono); font-size: .8rem; padding: 4px 9px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
.is-fail .check-val { background: var(--fail-soft); color: var(--fail-ink); border-color: transparent; }
.is-warn .check-val { background: var(--warn-soft); color: var(--warn-ink); border-color: transparent; }
.chev { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; transition: transform .2s; }
.check.open .chev { transform: rotate(180deg); }
.check-body { display: none; padding: 0 14px 14px 56px; }
.check.open .check-body { display: block; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } }
.check-detail { color: var(--ink-2); font-size: .92rem; }
.check-note { color: var(--muted); font-size: .8rem; margin-top: 4px; }
.fixbox { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--brand-soft); display: flex; gap: 10px; font-size: .88rem; color: var(--ink-2); }
.fixbox svg { width: 18px; height: 18px; fill: none; stroke: var(--brand); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-top: 1px; }
.fixbox b { color: var(--ink); }
.show-btn { margin-top: 10px; }
@media (max-width: 560px) {
  .check-row { grid-template-columns: auto 1fr auto; }
  .check-row .check-val { grid-column: 2 / 4; justify-self: start; grid-row: 2; max-width: none; }
  .check-body { padding-inline-start: 14px; }
}

/* Gauge */
.gauge { margin-top: 14px; padding-top: 22px; position: relative; }
.gauge-track { position: relative; height: 10px; border-radius: 6px; background: color-mix(in srgb, var(--fail) 18%, var(--line)); }
.gauge-zone { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--ok) 55%, transparent); border-radius: 6px; }
.gauge-marker { position: absolute; top: -26px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; }
.gauge-marker b { font-family: var(--mono); font-size: .74rem; font-weight: 500; padding: 2px 6px; border-radius: 6px; background: var(--ink); color: var(--surface); white-space: nowrap; }
.gauge-marker i { width: 2px; height: 22px; background: var(--ink); margin-top: 2px; border-radius: 2px; }
.gauge-labels { display: flex; justify-content: space-between; margin-top: 6px; font-family: var(--mono); font-size: .72rem; color: var(--muted); position: relative; height: 16px; }
.gauge-labels span { position: absolute; transform: translateX(-50%); }
.gauge-labels span.edge-l { transform: none; }
.gauge-labels span.edge-r { transform: translateX(-100%); }
.gauge-labels span.ok { color: var(--ok-ink); font-weight: 600; }

/* After grid: fix + manual */
.after-grid { display: grid; gap: 22px; }
@media (min-width: 1000px) { .after-grid { grid-template-columns: 1.2fr 1fr; } }
.fix-card, .manual-card { padding: 22px; }
.card-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; }
.card-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex-shrink: 0; }
.card-ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.card-head p { color: var(--muted); font-size: .9rem; margin-top: 2px; }
.fix-compare { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; margin: 4px 0 16px; }
.fix-compare figure { margin: 0; text-align: center; }
.fix-compare .ph { aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; }
.fix-compare img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fix-compare .ph.contain img { object-fit: contain; }
.fix-compare figcaption { font-size: .78rem; color: var(--muted); margin-top: 6px; font-family: var(--mono); }
.fix-compare .arrow svg { width: 28px; height: 28px; fill: none; stroke: var(--brand); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fix-list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 6px; font-size: .9rem; }
.fix-list li { display: flex; gap: 8px; align-items: flex-start; }
.fix-list svg { width: 18px; height: 18px; fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; margin-top: 2px; }
.fix-list .y svg { stroke: var(--ok); } .fix-list .n svg { stroke: var(--fail); }
.fix-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.notice { padding: 12px 14px; border-radius: 12px; font-size: .88rem; display: flex; gap: 10px; }
.notice svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; flex-shrink: 0; margin-top: 1px; }
.notice.warn { background: var(--warn-soft); color: var(--warn-ink); }
.notice.fail { background: var(--fail-soft); color: var(--fail-ink); }
.notice.ok { background: var(--ok-soft); color: var(--ok-ink); }
.notice + .fix-actions, .notice + .fix-list { margin-top: 14px; }

.manual-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.manual-list label { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer; transition: background .15s, border-color .15s; }
.manual-list label:hover { background: var(--surface-2); }
.manual-list input { appearance: none; width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line-strong); margin: 1px 0 0; display: grid; place-items: center; cursor: pointer; background: var(--surface); }
.manual-list input:checked { background: var(--ok); border-color: var(--ok); }
.manual-list input:checked::after { content: ''; width: 10px; height: 6px; border: solid #fff; border-width: 0 0 2.5px 2.5px; transform: rotate(-45deg) translate(1px, -1px); }
.manual-list input:checked + span b { color: var(--ok-ink); }
.manual-list b { display: block; font-weight: 600; font-size: .92rem; }
.manual-list small { color: var(--muted); font-size: .8rem; }
.progress { height: 6px; border-radius: 4px; background: var(--line); overflow: hidden; margin-top: 14px; }
.progress i { display: block; height: 100%; background: var(--ok); width: 0; transition: width .3s; }

/* ---------- Sections ---------- */
.section { padding: 80px 0; }
.section.alt { background: var(--bg-alt); }
.section-head { max-width: 720px; margin-bottom: 36px; }
.section-head .eyebrow { margin-bottom: 10px; }
.section-head p.muted { margin-top: 10px; font-size: 1rem; }
.tag-auto, .tag-self { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; font-size: .7rem; font-weight: 700; letter-spacing: .03em; vertical-align: middle; }
.tag-auto { background: var(--brand-soft); color: var(--brand); }
.tag-self { background: var(--warn-soft); color: var(--warn-ink); }
.spec-grid { display: grid; gap: 22px; }
@media (min-width: 980px) { .spec-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.template-card { margin: 0; padding: 22px; display: grid; place-items: center; background: linear-gradient(180deg, var(--surface), var(--surface-2)); }
.template-svg { width: 100%; max-width: 520px; height: auto; color: var(--ink); }
.template-card figcaption { color: var(--muted); font-size: .85rem; text-align: center; margin-top: 8px; }
.spec-lists { display: grid; gap: 14px; }
.spec-card { padding: 18px 20px; }
.spec-card h3 { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.spec-ico { font-family: var(--mono); font-size: .74rem; padding: 3px 7px; border-radius: 7px; background: var(--ink); color: var(--surface); }
.spec { list-style: none; padding: 0; margin: 0; }
.spec li { display: grid; grid-template-columns: 120px 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); font-size: .92rem; }
.spec li:first-child { border-top: 0; }
.spec li > span:first-child { color: var(--muted); }
@media (max-width: 480px) { .spec li { grid-template-columns: 1fr auto; } .spec li > span:first-child { grid-column: 1 / -1; font-size: .78rem; } }

.examples { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 600px) { .examples { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .examples { grid-template-columns: repeat(5, 1fr); gap: 18px; } }
.example { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 10px; transition: transform .2s, box-shadow .2s; }
.example:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.example .ex-img { position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 1; }
.example svg { display: block; width: 100%; height: 100%; }
.ex-mark { position: absolute; inset-inline-end: 8px; top: 8px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; box-shadow: 0 4px 10px rgba(0,0,0,.25); }
.ex-mark svg { width: 15px; height: 15px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; }
.example.good .ex-mark { background: var(--ok); }
.example.bad .ex-mark { background: var(--fail); }
.example.good { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 15%, transparent); }
.example figcaption { padding: 10px 4px 2px; }
.example figcaption b { display: block; font-size: .9rem; }
.example figcaption span { font-size: .78rem; color: var(--muted); }

.faq-wrap { max-width: 860px; }
.faq { display: grid; gap: 10px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 0 18px; }
.faq summary { cursor: pointer; list-style: none; padding: 16px 0; font-weight: 600; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-size: 1.3rem; line-height: 1; color: var(--brand); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 0 16px; color: var(--ink-2); }

.footer { border-top: 1px solid var(--line); padding: 28px 0 40px; font-size: .86rem; }
.footer-inner { display: grid; gap: 6px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; background: var(--ink); color: var(--surface); padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: .9rem; font-weight: 500; max-width: calc(100% - 32px); display: flex; gap: 12px; align-items: center; }
.toast button { background: transparent; border: 1px solid currentColor; color: inherit; border-radius: 8px; padding: 4px 10px; cursor: pointer; font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Support / donations ---------- */
.support-card { max-width: 760px; margin: 0 auto; padding: 36px 28px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.support-card .eyebrow { margin: 4px 0 0; }
.support-card > p.muted:not(.small) { max-width: 600px; font-size: 1rem; }
.support-ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--fail-soft); color: var(--fail); }
.support-ico svg, .support-strip p svg { width: 26px; height: 26px; fill: currentColor; stroke: none; }
.donate-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 6px 0 2px; }
.btn-donate { font-weight: 700; }
.btn-coffee { background: #ffdd00; color: #0d0c22; box-shadow: 0 8px 20px -10px rgba(180, 150, 0, .8); }
.btn-coffee:hover { background: #ffe633; }
.btn-paypal { background: #0070ba; color: #fff; box-shadow: 0 8px 20px -10px rgba(0, 112, 186, .8); }
.btn-paypal:hover { background: #005ea6; }
.btn-paypal svg { fill: currentColor; stroke: none; }
.support-strip { margin-top: 22px; padding: 16px 20px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; }
.support-strip p { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.support-strip p svg { width: 20px; height: 20px; color: var(--fail); }
.support-strip .donate-btns { margin: 0; }
.support-strip .btn { height: 38px; font-size: .88rem; }

/* Set by the inline script in index.html until the translation is applied. */
.i18n-pending body { visibility: hidden; }

/* ---------- Right-to-left (Arabic) ---------- */
/* Letter-spacing breaks the joins between Arabic letters. */
:lang(ar) * { letter-spacing: 0 !important; }
:lang(ar) h1, :lang(ar) h2, :lang(ar) h3 { line-height: 1.4; }
:lang(ar) .hero h1 { line-height: 1.3; }
/* Measurement scales and the template diagram are positioned left to right. */
.gauge, .template-svg { direction: ltr; }
/* Values such as "900 × 1100" take their direction from their own text, so
   numbers don't swap places inside right-to-left paragraphs. */
.check-val, .check-req, .metric b, .fix-compare figcaption { unicode-bidi: plaintext; }
[dir="rtl"] .fix-compare .arrow svg { transform: scaleX(-1); }
