/* پی‌ام‌تراز — سیستم طراحی. همه‌ی منابع روی خود سرور. */
@font-face {
  font-family: 'Vazirmatn';
  src: local('Vazirmatn'), url('/fonts/Vazirmatn[wght].woff2') format('woff2-variations'), url('/fonts/Vazirmatn[wght].woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #f4f5f0;
  --surface: #ffffff;
  --surface-2: #eef0ea;
  --ink: #142330;
  --ink-2: #44535f;
  --muted: #76838d;
  --line: #dde2db;
  --brand: #0d6b67;
  --brand-2: #0a5450;
  --brand-ink: #ffffff;
  --brand-soft: #dfefec;
  --accent: #e3a13a;
  --accent-ink: #3a2605;
  --accent-soft: #fbf0db;
  --ok: #1d8049;
  --ok-soft: #e1f3e8;
  --bad: #bf3e2b;
  --bad-soft: #fbe6e2;
  --warn: #a8701a;
  --warn-soft: #fbf0dc;
  --at: #1d8049; --t: #4c9a2a; --bt: #c88a1b; --ni: #bf3e2b;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 35, 48, .06), 0 6px 20px rgba(20, 35, 48, .06);
  --font: 'Vazirmatn', Tahoma, 'Segoe UI', system-ui, sans-serif;
  --font-en: 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f171d; --surface: #16212a; --surface-2: #1c2a35; --ink: #e8eef1; --ink-2: #b5c2ca; --muted: #8796a1; --line: #273743;
    --brand: #3fb3a9; --brand-2: #5cc7bd; --brand-ink: #062320; --brand-soft: #173a39;
    --accent: #f0b555; --accent-ink: #2b1b02; --accent-soft: #3a2c14;
    --ok: #4cc27f; --ok-soft: #17382a; --bad: #f0745f; --bad-soft: #43201b; --warn: #e8ad4e; --warn-soft: #3a2c14;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f171d; --surface: #16212a; --surface-2: #1c2a35; --ink: #e8eef1; --ink-2: #b5c2ca; --muted: #8796a1; --line: #273743;
  --brand: #3fb3a9; --brand-2: #5cc7bd; --brand-ink: #062320; --brand-soft: #173a39;
  --accent: #f0b555; --accent-ink: #2b1b02; --accent-soft: #3a2c14;
  --ok: #4cc27f; --ok-soft: #17382a; --bad: #f0745f; --bad-soft: #43201b; --warn: #e8ad4e; --warn-soft: #3a2c14;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.75;
  direction: rtl; text-align: right; -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.35; margin: 0 0 .5em; font-weight: 800; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 5vw, 3rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.85rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
.en, [lang="en"] { direction: ltr; text-align: left; font-family: var(--font-en); }
.ltr { direction: ltr; unicode-bidi: isolate; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }

/* ---- چیدمان ---- */
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 760px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.spacer { flex: 1; }

/* ---- سربرگ ---- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 14px; min-height: 62px; }
.logo { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-weight: 900; font-size: 1.2rem; }
.logo:hover { text-decoration: none; }
.logo svg { width: 34px; height: 34px; flex: none; }
.logo small { display: block; font-weight: 500; font-size: .72rem; color: var(--muted); line-height: 1.2; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--ink-2); padding: 7px 12px; border-radius: 999px; white-space: nowrap; font-weight: 600; font-size: .95rem; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.on { background: var(--brand-soft); color: var(--brand); }
@media (max-width: 760px) {
  .topbar .wrap { flex-wrap: wrap; gap: 6px 10px; padding-top: 8px; padding-bottom: 6px; }
  .topbar .nav { order: 3; width: 100%; }
  .logo small { display: none; }
}

/* ---- دکمه‌ها ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 9px 18px;
  border-radius: 11px; border: 1px solid transparent; background: var(--brand); color: var(--brand-ink);
  font-weight: 700; cursor: pointer; text-decoration: none; transition: transform .06s, background .15s, box-shadow .15s; white-space: nowrap;
}
.btn:hover { background: var(--brand-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.soft { background: var(--brand-soft); color: var(--brand); }
.btn.accent { background: var(--accent); color: var(--accent-ink); }
.btn.accent:hover { filter: brightness(1.05); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.sm { min-height: 36px; padding: 5px 12px; font-size: .9rem; border-radius: 9px; }
.btn.lg { min-height: 52px; padding: 12px 26px; font-size: 1.05rem; }
.btn.block { width: 100%; }
.linkbtn { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; font-weight: 600; }

/* ---- کارت و برچسب ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card.pad-lg { padding: 28px; }
.card h3 { margin-bottom: .35em; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.chip.brand { background: var(--brand-soft); color: var(--brand); }
.chip.accent { background: var(--accent-soft); color: var(--warn); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.lvl-AT { background: var(--ok-soft); color: var(--at); }
.chip.lvl-T { background: color-mix(in srgb, var(--t) 16%, var(--surface)); color: var(--t); }
.chip.lvl-BT { background: var(--warn-soft); color: var(--bt); }
.chip.lvl-NI { background: var(--bad-soft); color: var(--ni); }
.notice { border-radius: var(--radius-sm); padding: 12px 14px; background: var(--brand-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent); }
.notice.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.notice.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.notice.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }

/* ---- فرم ---- */
label.field { display: block; }
label.field > span { display: block; font-weight: 700; font-size: .92rem; margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { min-height: 96px; resize: vertical; line-height: 1.7; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); }
.input.code { letter-spacing: .5em; text-align: center; font-size: 1.4rem; direction: ltr; }
.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 12px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 9px 10px; border-radius: 9px; cursor: pointer; font-weight: 700; color: var(--ink-2); }
.tabs button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; background: var(--surface); font-size: .92rem; user-select: none; }
.check input { accent-color: var(--brand); margin: 0; }
.check:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.check:has(input:disabled) { opacity: .45; cursor: not-allowed; }

/* ---- جدول ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; }
th { background: var(--surface-2); font-weight: 700; color: var(--ink-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

/* ---- نوار پیشرفت ---- */
.bar { height: 9px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.bar.accent > i { background: var(--accent); }
.meter-row { display: grid; grid-template-columns: minmax(110px, 1fr) 2fr auto; gap: 12px; align-items: center; padding: 6px 0; }
@media (max-width: 520px) { .meter-row { grid-template-columns: 1fr auto; } .meter-row .bar { grid-column: 1 / -1; grid-row: 2; } }

/* ---- تراز ---- */
.taraz-hero { position: relative; overflow: hidden; background: linear-gradient(160deg, #0d3f45, #0d6b67 60%, #1c8a7c); color: #fff; border: 0; }
.taraz-hero .label { opacity: .8; font-weight: 600; }
.taraz-num { font-size: clamp(3rem, 10vw, 4.6rem); font-weight: 900; line-height: 1; letter-spacing: -.02em; }
.taraz-num small { font-size: .32em; font-weight: 600; opacity: .7; margin-inline-start: 6px; }
.taraz-hero .chip { background: rgba(255,255,255,.14); color: #fff; }
.taraz-hero .chip.lvl-AT { background: #c9f1d9; color: #0f5a31; }
.taraz-hero .chip.lvl-T { background: #def3c9; color: #3b6d14; }
.taraz-hero .chip.lvl-BT { background: #fde8bf; color: #7a5103; }
.taraz-hero .chip.lvl-NI { background: #fdd3cb; color: #8a2414; }
.level-track { position: relative; height: 14px; background: rgba(255,255,255,.16); border-radius: 999px; margin: 18px 0 30px; }
.level-track .fill { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--accent); border-radius: 999px; }
.level-track .target { position: absolute; top: -6px; bottom: -6px; width: 3px; background: #fff; border-radius: 2px; }
.level-track .target span { position: absolute; top: 24px; transform: translateX(50%); white-space: nowrap; font-size: .78rem; opacity: .9; }
.bubble-level { display: block; width: 100%; height: auto; }
.honest { font-size: .82rem; opacity: .8; }
.domain-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 560px) { .domain-tiles { grid-template-columns: 1fr; } }
.domain-tile { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); border-radius: 12px; padding: 12px 14px; }
.domain-tile b { display: block; font-size: 1.4rem; }

/* ---- آزمون ---- */
.exam-shell { min-height: 100vh; display: flex; flex-direction: column; }
.exam-top { position: sticky; top: 0; z-index: 15; background: var(--surface); border-bottom: 1px solid var(--line); }
.exam-top .wrap { display: flex; align-items: center; gap: 10px; min-height: 58px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.timer { font-weight: 800; font-size: 1.15rem; padding: 4px 12px; border-radius: 9px; background: var(--surface-2); direction: ltr; font-variant-numeric: tabular-nums; }
.timer.low { background: var(--bad-soft); color: var(--bad); }
.langsw { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.langsw button { border: 0; background: var(--surface); padding: 6px 11px; cursor: pointer; font-weight: 700; font-size: .85rem; color: var(--ink-2); min-height: 36px; }
.langsw button + button { border-inline-start: 1px solid var(--line); }
.langsw button.on { background: var(--ink); color: var(--surface); }
.exam-body { flex: 1; padding: 20px 0 110px; }
.case-box { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: var(--radius); padding: 14px 16px; }
.case-box summary { cursor: pointer; font-weight: 800; }
.bi { display: grid; gap: 12px; }
.bi .en { font-size: 1.04rem; line-height: 1.65; }
.bi .fa { color: var(--ink); }
.bi.both .fa { color: var(--ink-2); border-top: 1px dashed var(--line); padding-top: 10px; }
.stem { font-size: 1.08rem; font-weight: 600; white-space: pre-line; }
.options { display: grid; gap: 10px; margin-top: 16px; }
.opt { display: flex; gap: 12px; align-items: flex-start; padding: 13px 15px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; transition: border-color .12s, background .12s; text-align: inherit; width: 100%; }
.opt:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.opt .key { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--surface-2); font-family: var(--font-en); font-size: .9rem; }
.opt .txt { flex: 1; display: grid; gap: 6px; }
.opt .txt .fa { color: var(--ink-2); font-size: .95rem; }
.opt .txt.only-fa .fa { color: var(--ink); font-size: 1rem; }
.opt.sel { border-color: var(--brand); background: var(--brand-soft); }
.opt.sel .key { background: var(--brand); color: var(--brand-ink); }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.right .key { background: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .key { background: var(--bad); color: #fff; }
.opt[disabled] { cursor: default; }
.feedback { border-radius: var(--radius); padding: 16px; margin-top: 16px; border: 1px solid var(--line); background: var(--surface); }
.feedback.ok { border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: var(--ok-soft); }
.feedback.bad { border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: var(--bad-soft); }
.exam-foot { position: fixed; bottom: 0; inset-inline: 0; background: var(--surface); border-top: 1px solid var(--line); z-index: 15; padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); }
.exam-foot .wrap { display: flex; gap: 8px; align-items: center; }
@media (max-width: 520px) {
  .exam-foot .btn { padding: 8px 12px; font-size: .92rem; }
  .exam-top .logo { display: none; }
}
.qmap { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 7px; }
.qmap button { position: relative; aspect-ratio: 1; border: 1px solid var(--line); background: var(--surface); border-radius: 9px; cursor: pointer; font-weight: 700; font-size: .85rem; }
.qmap button.ans { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 40%, transparent); color: var(--brand); }
.qmap button.cur { outline: 2px solid var(--ink); outline-offset: 1px; }
.qmap button.flag::after { content: ''; position: absolute; top: 3px; inset-inline-end: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.qmap button.locked { opacity: .35; cursor: not-allowed; }
.qmap button.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.qmap button.no { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .85rem; color: var(--ink-2); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: middle; margin-inline-end: 5px; border: 1px solid var(--line); }

/* ---- مودال ---- */
.modal-back { position: fixed; inset: 0; background: rgba(10, 18, 24, .5); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 16px; width: 100%; max-width: 640px; max-height: calc(100vh - 32px); overflow: auto; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { max-width: 860px; }

/* ---- اعلان ---- */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60; background: var(--ink); color: var(--surface); padding: 11px 18px; border-radius: 12px; box-shadow: var(--shadow); max-width: calc(100vw - 32px); font-weight: 600; }
.toast.bad { background: var(--bad); color: #fff; }

/* ---- صفحه‌ی اصلی ---- */
.hero { padding: 56px 0 40px; }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
@media (max-width: 880px) { .hero-grid { grid-template-columns: 1fr; gap: 28px; } .hero { padding-top: 32px; } }
.eyebrow { display: inline-flex; gap: 8px; align-items: center; font-weight: 700; color: var(--brand); background: var(--brand-soft); padding: 4px 12px; border-radius: 999px; font-size: .88rem; margin-bottom: 16px; }
.hero h1 .hl { color: var(--brand); }
.lead { font-size: 1.12rem; color: var(--ink-2); max-width: 36em; }
.section { padding: 56px 0; }
.section.alt { background: var(--surface); border-block: 1px solid var(--line); }
.section-head { max-width: 640px; margin-bottom: 28px; }
.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stat-strip > div { background: var(--surface); padding: 18px; }
.stat-strip b { display: block; font-size: 1.6rem; font-weight: 900; color: var(--ink); }
.stat-strip span { color: var(--muted); font-size: .9rem; }
@media (max-width: 720px) { .stat-strip { grid-template-columns: repeat(2, 1fr); } }
.steps { counter-reset: s; }
.step { position: relative; padding-top: 52px; }
.step::before { counter-increment: s; content: counter(s, persian); position: absolute; top: 0; inset-inline-start: 0; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--brand); color: var(--brand-ink); font-weight: 900; }
.domain-col h3 { display: flex; justify-content: space-between; align-items: baseline; }
.task-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 4px; }
.task-list li { display: flex; gap: 10px; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: .93rem; }
.task-list li:last-child { border-bottom: 0; }
.task-list code { font-family: var(--font-en); font-size: .8rem; color: var(--muted); }
.plan { position: relative; display: flex; flex-direction: column; gap: 10px; }
.plan.hl { border: 2px solid var(--brand); }
.plan .price { font-size: 1.8rem; font-weight: 900; }
.plan .price small { font-size: .9rem; font-weight: 600; color: var(--muted); }
.plan .badge { position: absolute; top: -12px; inset-inline-start: 18px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; }
.faq details + details { margin-top: 10px; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq details p { margin: 10px 0 0; color: var(--ink-2); }
.footer { padding: 40px 0 56px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: .92rem; }
.footer .disclaimer { font-size: .82rem; color: var(--muted); max-width: 52em; }
.prose { max-width: 720px; }
.prose p { color: var(--ink-2); }

/* ---- کارت اشتراک‌گذاری ---- */
.share-preview { width: 100%; max-width: 420px; border-radius: 16px; display: block; margin: 0 auto; box-shadow: var(--shadow); }

/* ---- اسکلت بارگذاری ---- */
.loading { padding: 60px 0; text-align: center; color: var(--muted); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
