
:root {
  --ink: #0f172a;
  --muted: #475569;
  --bg: #f1f5f9;
  --card: #ffffff;
  --line: #e2e8f0;
  --brand: #0f4c81;
  --brand-2: #0ea5a4;
  --code-bg: #0b1220;
  --code-fg: #e2e8f0;
  --warn: #b45309;
  --ok: #047857;
  --font: "Segoe UI", Tahoma, "Noto Naskh Arabic", "Noto Sans Arabic", Arial, sans-serif;
  --mono: "Cascadia Code", Consolas, "Courier New", monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  direction: ltr !important;
  background:
    radial-gradient(1200px 500px at 10% -10%, #dbeafe 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #ccfbf1 0%, transparent 50%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.75;
}
a { color: var(--brand); text-decoration-thickness: 1px; }
a:hover { color: var(--brand-2); }
.topbar {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(10px);
  background: rgba(255,255,255,.88);
  border-bottom: 1px solid var(--line);
  display: flex; gap: 1rem; align-items: center; justify-content: space-between;
  padding: .75rem 1.25rem;
}
.topbar .brand { font-weight: 700; color: var(--brand); letter-spacing: .02em; }
.topbar nav { display: flex; flex-wrap: wrap; gap: .65rem; font-size: .92rem; }
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  background: #ecfeff; color: #155e75; border: 1px solid #a5f3fc;
  border-radius: 999px; padding: .15rem .65rem; font-size: .78rem; font-weight: 600;
}
.layout {
  max-width: 1100px; margin: 0 auto; padding: 1.25rem 1.25rem 4rem;
}
.hero {
  background: linear-gradient(135deg, #0f4c81 0%, #0ea5a4 100%);
  color: #fff; border-radius: 18px; padding: 1.6rem 1.7rem; margin: 1rem 0 1.5rem;
  box-shadow: 0 18px 40px rgba(15,76,129,.22);
}
.hero h1 { margin: 0 0 .4rem; font-size: clamp(1.45rem, 2.4vw, 2rem); }
.hero p { margin: .25rem 0; opacity: .95; }
.meta-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .65rem; margin-top: 1rem;
}
.meta-grid div {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2);
  border-radius: 12px; padding: .55rem .7rem; font-size: .88rem;
}
.meta-grid strong { display: block; font-size: .72rem; opacity: .85; font-weight: 600; }
.content {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 1.4rem 1.5rem 2rem; box-shadow: 0 8px 24px rgba(15,23,42,.04);
}
.content h1, .content h2, .content h3, .content h4,
.content p, .content li, .content td, .content th, .content blockquote {
  unicode-bidi: plaintext;
}
.content h1 { font-size: 1.55rem; border-bottom: 1px solid var(--line); padding-bottom: .4rem; }
.content h2 { font-size: 1.28rem; margin-top: 1.8rem; color: var(--brand); }
.content h3 { font-size: 1.08rem; margin-top: 1.3rem; }
.content table {
  width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .92rem;
  direction: ltr !important;
}
.content th, .content td {
  border: 1px solid var(--line); padding: .45rem .55rem; vertical-align: top; text-align: start;
}
.content th { background: #f8fafc; }
.content blockquote {
  margin: 1rem 0; padding: .7rem 1rem; border-left: 4px solid var(--brand-2);
  background: #f0fdfa; color: var(--muted);
}
.content code:not(pre code) {
  direction: ltr !important; unicode-bidi: isolate;
  font-family: var(--mono); font-size: .88em;
  background: #eef2ff; color: #312e81; padding: .08rem .3rem; border-radius: 5px;
}
.pre-wrap {
  position: relative; margin: 1rem 0;
}
.pre-wrap pre {
  direction: ltr !important; text-align: left !important; unicode-bidi: isolate;
  background: var(--code-bg); color: var(--code-fg);
  border-radius: 12px; padding: 2.4rem 1rem 1rem; overflow-x: auto;
  font-family: var(--mono); font-size: .86rem; line-height: 1.55;
  white-space: pre;
}
.copy-btn {
  position: absolute; top: .55rem; right: .55rem; z-index: 2;
  border: 0; border-radius: 8px; cursor: pointer;
  background: #1e293b; color: #e2e8f0; font-size: .75rem; font-weight: 600;
  padding: .35rem .6rem;
}
.copy-btn.copied { background: var(--ok); color: #fff; }
.url-box {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
  background: #fff7ed; border: 1px solid #fed7aa; border-radius: 10px;
  padding: .55rem .75rem; margin: .7rem 0; font-family: var(--mono); font-size: .84rem;
  direction: ltr !important; unicode-bidi: isolate;
}
.url-box a { word-break: break-all; }
.direct-link {
  display: inline-flex; align-items: center; gap: .25rem;
  direction: ltr !important; unicode-bidi: isolate;
  margin-inline-start: .35rem; padding: .1rem .5rem;
  border: 1px solid #93c5fd; border-radius: 999px;
  background: #eff6ff; color: #1d4ed8; font-size: .76rem;
  font-weight: 700; text-decoration: none; white-space: nowrap;
}
.direct-link:hover { background: #dbeafe; color: #1e40af; }
.section-links {
  display: flex; flex-wrap: wrap; gap: .4rem; align-items: center;
  margin: -.55rem 0 1rem; padding: .55rem .65rem;
  background: linear-gradient(90deg, #eff6ff, #f0fdfa);
  border: 1px solid #bfdbfe; border-radius: 10px;
  direction: ltr !important; unicode-bidi: isolate;
}
.section-links strong { color: #334155; font-size: .78rem; margin-right: .2rem; }
.section-links a {
  display: inline-flex; align-items: center; padding: .15rem .5rem;
  border: 1px solid #93c5fd; border-radius: 999px;
  background: #fff; color: #1d4ed8; font-size: .76rem;
  font-weight: 700; text-decoration: none; white-space: nowrap;
}
.section-links a:hover { background: #dbeafe; }
.nav-coverage {
  background: #f0fdf4; border: 1px solid #bbf7d0;
  border-radius: 10px; padding: .6rem .75rem; color: #166534;
}
.cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: .9rem; margin: 1.2rem 0;
}
.card {
  background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.05rem;
  transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(15,23,42,.08); }
.card h3 { margin: 0 0 .35rem; font-size: 1rem; color: var(--brand); }
.card p { margin: 0; color: var(--muted); font-size: .9rem; }
.footer {
  margin-top: 1.5rem; color: var(--muted); font-size: .85rem; text-align: center;
}
.toc {
  background: #f8fafc; border: 1px solid var(--line); border-radius: 12px;
  padding: .8rem 1rem; margin: 0 0 1.2rem;
}
.toc ul { margin: .3rem 0; padding-left: 1.2rem; }
.side-note { font-size: .86rem; color: var(--muted); }
@media (max-width: 720px) {
  .content { padding: 1rem; }
  .topbar { flex-direction: column; align-items: flex-start; }
}

/* ============================================================
   VISUAL TUTORIAL SYSTEM — diagrams, flows, screens, chips
   Read the pictures first; text is optional backup.
   ============================================================ */

.ok   { background: #f0fdf4; border: 1px solid #bbf7d0; border-left: 4px solid var(--ok);   border-radius: 10px; padding: .6rem .85rem; margin: .9rem 0; }
.warn { background: #fffbeb; border: 1px solid #fde68a; border-left: 4px solid var(--warn); border-radius: 10px; padding: .6rem .85rem; margin: .9rem 0; }
.ok p:last-child, .warn p:last-child { margin-bottom: 0; }
.note-sm { font-size: .85rem; color: var(--muted); margin: .4rem 0 0; }

.viz-banner {
  margin: 0 0 1.4rem; padding: 1rem 1.15rem; border-radius: 14px; color: #fff;
  background: linear-gradient(135deg, #0f4c81 0%, #0ea5a4 100%);
  box-shadow: 0 12px 28px rgba(15,76,129,.2);
}
.viz-banner h2 { margin: 0; color: #fff !important; border: 0; font-size: 1.2rem; }
.viz-banner p { margin: .3rem 0 0; opacity: .92; font-size: .9rem; }

.track {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin: 1rem 0;
}
@media (max-width: 800px) { .track { grid-template-columns: 1fr; } }
.track .lane {
  border-radius: 14px; padding: .85rem; border: 1px solid var(--line); background: #fff;
}
.track .lane.dev  { border-top: 4px solid #2563eb; }
.track .lane.adm  { border-top: 4px solid #059669; }
.track .lane.impl { border-top: 4px solid #d97706; }
.track .lane h3 { margin: 0 0 .5rem; font-size: 1rem; }
.track .lane ul { margin: 0; padding-left: 1.1rem; font-size: .88rem; color: var(--muted); }
.track .lane a { font-weight: 700; font-size: .82rem; }

.flow {
  display: flex; flex-wrap: wrap; gap: .45rem; align-items: center;
  margin: 1rem 0; padding: .85rem; background: #0b1220; border-radius: 14px;
  color: #e2e8f0; font-family: var(--mono); font-size: .82rem;
}
.flow .n {
  background: #1e293b; border: 1px solid #334155; border-radius: 10px;
  padding: .45rem .65rem; min-width: 5.5rem; text-align: center;
}
.flow .n b { display: block; color: #7dd3fc; font-size: .72rem; letter-spacing: .04em; }
.flow .n.dev b { color: #93c5fd; }
.flow .n.adm b { color: #6ee7b7; }
.flow .n.impl b { color: #fcd34d; }
.flow .arrow { color: #64748b; font-weight: 700; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .7rem 0; }
.chip {
  display: inline-flex; align-items: center; gap: .3rem;
  border-radius: 999px; padding: .2rem .65rem; font-size: .78rem; font-weight: 700;
  border: 1px solid var(--line); background: #fff;
}
.chip.do   { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.chip.dont { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.chip.url  { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.chip.mod  { background: #faf5ff; color: #6b21a8; border-color: #e9d5ff; }

.screen {
  margin: 1rem 0; border-radius: 14px; overflow: hidden;
  border: 1px solid #1e293b; background: #0b1220; color: #e2e8f0;
  box-shadow: 0 14px 30px rgba(15,23,42,.18); font-family: var(--mono); font-size: .82rem;
}
.screen .bar {
  display: flex; gap: .4rem; align-items: center; padding: .45rem .7rem;
  background: #111827; border-bottom: 1px solid #1f2937;
}
.screen .dot { width: .5rem; height: .5rem; border-radius: 50%; }
.screen .dot.r { background: #f87171; }
.screen .dot.a { background: #fbbf24; }
.screen .dot.g { background: #34d399; }
.screen .ttl { color: #7dd3fc; font-weight: 700; margin-left: .4rem; }
.screen .path { margin-left: auto; color: #94a3b8; font-size: .74rem; }
.screen .body { display: grid; grid-template-columns: 160px 1fr; min-height: 160px; }
@media (max-width: 700px) { .screen .body { grid-template-columns: 1fr; } }
.screen .side { background: #111827; padding: .55rem; border-right: 1px solid #1f2937; }
.screen .side div { padding: .28rem .4rem; border-radius: 6px; color: #94a3b8; margin: .15rem 0; }
.screen .side div.on { background: rgba(14,165,164,.22); color: #99f6e4; }
.screen .main { padding: .7rem .85rem; }
.screen .row {
  display: grid; grid-template-columns: 110px 1fr; gap: .5rem;
  padding: .28rem 0; border-bottom: 1px dashed #1f2937;
}
.screen .row span:first-child { color: #94a3b8; }
.screen .cap {
  background: #f8fafc; color: var(--ink); border-top: 1px solid var(--line);
  padding: .55rem .75rem; font-family: var(--font); font-size: .88rem;
}
.screen .cap strong { color: var(--brand); }

.stepboard {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .55rem; margin: 1rem 0; counter-reset: st;
}
.stepboard .s {
  counter-increment: st; position: relative;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: .7rem .7rem .7rem .7rem; min-height: 88px;
}
.stepboard .s::before {
  content: counter(st); display: inline-grid; place-items: center;
  width: 1.4rem; height: 1.4rem; border-radius: 50%; margin-bottom: .35rem;
  background: var(--brand); color: #fff; font-size: .75rem; font-weight: 700;
}
.stepboard .s b { display: block; font-size: .9rem; color: var(--brand); }
.stepboard .s span { display: block; font-size: .8rem; color: var(--muted); margin-top: .2rem; }

.modmap {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: .65rem; margin: 1rem 0;
}
.modmap a {
  display: block; text-decoration: none; color: inherit;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: .7rem .8rem; transition: transform .15s ease, box-shadow .15s ease;
}
.modmap a:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(15,23,42,.08); }
.modmap a h4 { margin: 0 0 .25rem; color: var(--brand); font-size: .95rem; }
.modmap a p { margin: 0; font-size: .82rem; color: var(--muted); }
.modmap a .go { display: inline-block; margin-top: .4rem; font-size: .76rem; font-weight: 700; color: #1d4ed8; }

.pathline {
  display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin: 1rem 0;
}
.pathline a, .pathline span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.4rem; padding: .35rem .55rem; border-radius: 10px;
  font-weight: 800; font-size: .85rem; text-decoration: none;
}
.pathline a { background: #0f4c81; color: #fff; }
.pathline a:hover { background: #0ea5a4; color: #fff; }
.pathline span.sep { background: transparent; color: #94a3b8; min-width: auto; padding: 0; }

.glance {
  border: 1px solid var(--line); border-radius: 14px; background: #fff;
  padding: .85rem 1rem; margin: 0 0 1.4rem;
  box-shadow: 0 8px 20px rgba(15,23,42,.04);
}
.glance h3 { margin: 0 0 .55rem; font-size: 1.05rem; color: var(--brand); }
.glance .grid3 {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .65rem;
}
@media (max-width: 800px) { .glance .grid3 { grid-template-columns: 1fr; } }
.glance .box {
  background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: .55rem .65rem;
}
.glance .box strong { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.glance .box p { margin: .25rem 0 0; font-size: .88rem; }

@media print {
  .screen, .flow, .stepboard .s, .glance { break-inside: avoid; }
  .screen { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
