:root {
  --bg: #f6f5f3;
  --surface: #fff;
  --text: #1a2233;
  --muted: #5d6676;
  --line: #e2e0dc;
  --brand: #3340d6;
  --brand-soft: #eceefd;
  --ok: #17794a;
  --note-bg: #fff8e6;
  --note-line: #e8c765;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161c;
    --surface: #1c1f27;
    --text: #e8eaf0;
    --muted: #9aa3b5;
    --line: #2d313c;
    --brand: #8d97ff;
    --brand-soft: #232744;
    --ok: #4cc58a;
    --note-bg: #2a2412;
    --note-line: #7a6522;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans Arabic', sans-serif;
}
a { color: var(--brand); }
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .6rem 1rem; background: var(--surface); border-block-end: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--text); text-decoration: none; }
.langs { display: flex; gap: .25rem; }
.langs a, .langs span { padding: .25rem .7rem; border-radius: 999px; text-decoration: none; font-size: .9rem; }
.langs span { background: var(--brand); color: #fff; }
.langs a:hover { background: var(--brand-soft); }
.layout { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 2rem; max-width: 76rem; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
aside nav { position: sticky; top: 4.5rem; max-height: calc(100vh - 6rem); overflow: auto; }
.toc-title { margin: 0 0 .5rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
aside ol { list-style: none; margin: 0; padding: 0; }
aside li a { display: block; padding: .25rem .6rem; border-radius: 6px; color: var(--text); text-decoration: none; font-size: .93rem; }
aside li a:hover { background: var(--brand-soft); color: var(--brand); }
main { min-width: 0; max-width: 52rem; }
h1 { font-size: 2.1rem; margin: .2rem 0 .3rem; line-height: 1.2; }
.lead { font-size: 1.15rem; color: var(--muted); margin-block-start: 0; }
section { margin-block-start: 3rem; }
h2 { font-size: 1.5rem; margin: 0 0 .8rem; padding-block-end: .4rem; border-block-end: 2px solid var(--line); }
h3 { font-size: 1.1rem; margin: 1.6rem 0 .4rem; }
figure { margin: 1.2rem 0; }
figure img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 2px 10px rgb(0 0 0 / .06); }
figcaption { font-size: .88rem; color: var(--muted); margin-block-start: .4rem; }
.table-wrap { overflow-x: auto; margin: 1rem 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { padding: .5rem .75rem; text-align: start; border-block-end: 1px solid var(--line); vertical-align: top; }
thead th { background: var(--brand-soft); font-weight: 600; }
tbody tr:last-child > * { border-block-end: 0; }
.matrix td { text-align: center; width: 5.5rem; }
.matrix th[scope='row'] { font-weight: 400; }
.matrix .group th { background: var(--bg); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.matrix td.yes { color: var(--ok); font-weight: 700; }
.matrix td.no { color: var(--muted); }
.note { background: var(--note-bg); border: 1px solid var(--note-line); border-inline-start-width: 4px; padding: .7rem 1rem; border-radius: 8px; margin: 1rem 0; }
.note > :first-child { margin-block-start: 0; }
.note > :last-child { margin-block-end: 0; }
kbd, code { font: .88em ui-monospace, Consolas, monospace; background: var(--brand-soft); padding: .1em .4em; border-radius: 4px; }
ol.steps { padding-inline-start: 1.4rem; }
ol.steps li { margin: .5rem 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .8rem; margin: 1rem 0; padding: 0; list-style: none; }
.cards li { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; }
.cards strong { display: block; }
footer { margin-block-start: 4rem; padding-block-start: 1rem; border-block-start: 1px solid var(--line); color: var(--muted); font-size: .88rem; }
body.choose { display: grid; place-items: center; min-height: 100vh; text-align: center; }
.choices { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; }
.choices a { padding: .6rem 1.4rem; background: var(--brand); color: #fff; border-radius: 10px; text-decoration: none; font-weight: 600; }
@media (max-width: 52rem) {
  .layout { grid-template-columns: 1fr; gap: 0; }
  aside nav { position: static; max-height: none; margin-block-end: 1rem; padding: .6rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
  aside ol { columns: 2; }
  h1 { font-size: 1.7rem; }
}
@media print {
  .top, aside { display: none; }
  .layout { display: block; }
  figure, .table-wrap { break-inside: avoid; }
}
