/* DevYaz Docs — design system pulled from the DevYaz store */

:root {
  --bg: #07060c;
  --bg-2: #0a0910;
  --surface: #0f0c17;
  --surface-2: #141021;
  --card-grad: linear-gradient(135deg, #171021, #0c0a12 70%);

  --text: #f2eefc;
  --text-2: #dbd4ec;
  --muted: #cac2dd;
  --dim: #b3aacb;
  --faint: #938ba6;

  --brand: #8f6bff;
  --brand-light: #b79bff;
  --brand-pale: #c9b4ff;
  --brand-deep: #6b3ff0;
  --brand-grad: linear-gradient(180deg, #c7adff 0%, #9a74ff 38%, #6b3ff0 70%, #4a1fb8 100%);
  --icon-grad: linear-gradient(145deg, #9b7bff, #5a2fc4 70%, #3d1f8f);

  --green: #7dffb3;
  --amber: #ffc46b;
  --red: #ff6b8a;

  --line: rgba(183, 155, 255, .12);
  --line-2: rgba(183, 155, 255, .22);
  --line-3: rgba(183, 155, 255, .4);

  --font-display: 'Archivo', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans Arabic', 'Manrope', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --sidebar-w: 320px;
  --topbar-h: 70px;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  /* Arabic at 400 reads thin on a dark background — 500 is the comfortable base */
  font-weight: 500;
  font-size: 17px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body { overflow-x: hidden; }

a { color: var(--brand-pale); text-decoration: none; transition: color .2s; }
a:hover { color: #fff; }
::selection { background: var(--brand); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(183,155,255,.18); border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: rgba(183,155,255,.35); }

/* ---------------- A11y: focus + skip link ---------------- */
:focus-visible {
  outline: 2px solid var(--brand-light);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: fixed; top: -100px; inset-inline-start: 16px; z-index: 200;
  padding: 12px 20px; border-radius: 0 0 12px 12px;
  background: var(--brand); color: #fff; font-weight: 700;
  transition: top .2s;
}
.skip-link:focus { top: 0; color: #fff; }

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

/* ---------------- Ambient background ---------------- */
.ambient {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(900px 500px at 85% -5%, rgba(143,107,255,.14), transparent 60%),
    radial-gradient(700px 400px at 10% 100%, rgba(107,63,240,.10), transparent 60%);
}

/* ---------------- Topbar ---------------- */
.topbar {
  position: fixed; top: 0; inset-inline: 0; height: var(--topbar-h); z-index: 50;
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  background: rgba(7,6,12,.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 11px; flex: none; }
.brand img { width: 34px; height: 34px; object-fit: contain; filter: drop-shadow(0 0 14px rgba(143,107,255,.5)); }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name {
  font-family: var(--font-display); font-stretch: 118%; font-weight: 900;
  font-size: 19px; letter-spacing: -.01em; color: var(--text);
}
.brand-sub {
  font-family: var(--font-mono); font-size: 8.5px; letter-spacing: .2em;
  color: var(--dim); margin-top: 4px; text-transform: uppercase;
}

.topbar-spacer { flex: 1; }

.search-box {
  position: relative; flex: none; width: min(360px, 38vw);
  min-width: 0;
}
.search-box input {
  width: 100%; height: 42px;
  padding-inline: 40px 56px;
  border-radius: 11px;
  background: rgba(20,16,33,.8);
  border: 1px solid var(--line-2);
  color: var(--text); font-family: var(--font-body);
  font-size: 15px; font-weight: 500;
  outline: none; transition: all .2s;
}
.search-box input::placeholder { color: var(--faint); }
.search-box input:focus { border-color: var(--line-3); box-shadow: 0 0 22px rgba(143,107,255,.22); }
.search-icon {
  position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--faint); pointer-events: none;
}
.search-kbd {
  position: absolute; inset-inline-end: 9px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 10px; color: var(--faint);
  border: 1px solid var(--line-2); border-radius: 6px; padding: 3px 6px;
  pointer-events: none;
}

.topbar-link {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px;
  border-radius: 11px; font-size: 14.5px; font-weight: 700;
  border: 1px solid var(--line-2); background: rgba(143,107,255,.1);
  color: var(--text); transition: all .22s; white-space: nowrap;
}
.topbar-link:hover { border-color: var(--line-3); background: rgba(143,107,255,.2); box-shadow: 0 0 20px rgba(143,107,255,.3); color: #fff; }
.topbar-link svg { width: 17px; height: 17px; flex: none; }

.lang-btn {
  flex: none; height: 42px; min-width: 50px; padding: 0 14px;
  border-radius: 11px; cursor: pointer;
  font-family: var(--font-display); font-weight: 800; font-size: 14px;
  letter-spacing: .06em;
  background: rgba(143,107,255,.14); border: 1px solid var(--line-2);
  color: var(--brand-pale); transition: all .22s;
}
.lang-btn:hover {
  background: rgba(143,107,255,.3); border-color: var(--line-3); color: #fff;
  box-shadow: 0 0 20px rgba(143,107,255,.3);
}

/* LTR: the sidebar flips to the left edge */
html[dir="ltr"] .sidebar { border-inline-end: 1px solid var(--line); }
html[dir="ltr"] .brand-name { letter-spacing: -.01em; }

.menu-btn {
  display: none; width: 38px; height: 38px; flex: none;
  align-items: center; justify-content: center;
  border-radius: 11px; border: 1px solid var(--line-2);
  background: rgba(143,107,255,.1); color: var(--text); cursor: pointer;
}
.menu-btn svg { width: 18px; height: 18px; }

/* ---------------- Layout ---------------- */
/* no z-index here: it would create a stacking context that traps
   the mobile sidebar underneath the backdrop */
.shell {
  position: relative;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  max-width: 1500px; margin: 0 auto;
  padding-top: var(--topbar-h);
}

/* ---------------- Sidebar ---------------- */
.sidebar {
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 26px 14px 60px;
  border-inline-end: 1px solid var(--line);
}

.nav-group { margin-bottom: 26px; }
.nav-group-title {
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px 12px;
  font-family: var(--font-body); font-size: 13.5px; font-weight: 700;
  letter-spacing: .06em; color: var(--brand-light);
}
.nav-group-title svg { width: 16px; height: 16px; flex: none; }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px; margin-bottom: 3px;
  border-radius: 11px;
  font-size: 15.5px; font-weight: 600; line-height: 1.5;
  color: var(--text-2);
  cursor: pointer; transition: all .18s;
  border: 1px solid transparent;
  text-decoration: none;
}
.nav-item:hover { background: rgba(143,107,255,.11); color: #fff; }
.nav-item.active {
  background: rgba(143,107,255,.18);
  border-color: var(--line-2);
  color: #fff; font-weight: 700;
}
.nav-item.active .nav-num { background: var(--brand); color: #fff; }

.nav-num {
  flex: none; width: 24px; height: 24px; border-radius: 7px;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 600;
  background: rgba(183,155,255,.16); color: var(--brand-light);
  transition: all .18s;
}
.nav-item img.nav-ico { width: 22px; height: 22px; border-radius: 6px; object-fit: contain; }
.nav-item svg.nav-ico { width: 19px; height: 19px; flex: none; color: var(--brand-light); }

.nav-sub { padding-inline-start: 14px; margin-inline-start: 10px; border-inline-start: 1px solid var(--line); }

/* ---------------- Content ---------------- */
.content {
  min-width: 0;
  padding: 44px clamp(20px, 4vw, 60px) 100px;
}

.page { animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 15px; margin-bottom: 20px;
  border-radius: 999px;
  border: 1px solid var(--line-2); background: rgba(20,14,34,.6);
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; color: var(--brand-pale);
}
.eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand-light); box-shadow: 0 0 10px var(--brand-light);
}

h1.page-title {
  margin: 0 0 16px;
  font-family: var(--font-display); font-stretch: 100%; font-weight: 800;
  font-size: clamp(34px, 4.6vw, 52px); line-height: 1.18; color: #fff;
}
p.page-lead {
  margin: 0 0 36px; max-width: 68ch;
  font-size: 19px; font-weight: 500; line-height: 1.8; color: var(--text-2);
}

h2.section {
  display: flex; align-items: center; gap: 13px;
  margin: 56px 0 22px;
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(24px, 2.7vw, 31px); line-height: 1.4; color: #fff;
}
h2.section::before {
  content: ''; flex: none; width: 5px; height: 28px; border-radius: 99px;
  background: var(--brand-grad); box-shadow: 0 0 14px rgba(143,107,255,.6);
}

p { font-size: 17px; line-height: 1.85; color: var(--text-2); margin: 0 0 17px; }
strong { color: #fff; font-weight: 700; }

code.inline {
  font-family: var(--font-mono); font-size: .9em; font-weight: 500;
  padding: 4px 9px; border-radius: 7px;
  background: rgba(143,107,255,.14); border: 1px solid var(--line-2);
  color: var(--brand-pale); direction: ltr; display: inline-block;
  cursor: pointer; transition: all .18s; user-select: all;
}
code.inline:hover {
  background: rgba(143,107,255,.3);
  border-color: var(--line-3);
  color: #fff;
}
code.inline.copied {
  background: rgba(125,255,179,.18);
  border-color: rgba(125,255,179,.5);
  color: var(--green);
  direction: rtl; user-select: none;
}
code.inline.failed {
  background: rgba(255,196,107,.16);
  border-color: rgba(255,196,107,.45);
  color: var(--amber);
  direction: rtl; user-select: none;
}

/* ---------------- Cards grid ---------------- */
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); margin: 26px 0; }

.card {
  position: relative; overflow: hidden;
  padding: 22px;
  border-radius: 18px;
  background: var(--card-grad);
  border: 1px solid var(--line);
  transition: all .25s;
  text-align: start;
  display: block; text-decoration: none;
}
/* only cards that actually navigate look clickable */
a.card { cursor: pointer; }
a.card:hover { border-color: var(--line-3); transform: translateY(-3px); box-shadow: 0 18px 44px -18px rgba(143,107,255,.5); }
.card-ico {
  width: 46px; height: 46px; border-radius: 13px; margin-bottom: 15px;
  display: grid; place-items: center;
  background: var(--icon-grad);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 10px 26px -8px rgba(143,107,255,.85);
}
.card-ico svg { width: 22px; height: 22px; color: #fff; }
.card-ico img { width: 26px; height: 26px; object-fit: contain; }
.card h3 { margin: 0 0 9px; font-family: var(--font-display); font-weight: 800; font-size: 19px; line-height: 1.4; color: #fff; }
.card p { margin: 0; font-size: 15.5px; line-height: 1.75; color: var(--muted); }
.card-arrow {
  margin-top: 16px; display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700; color: var(--brand-pale);
}
.card-arrow svg { width: 14px; height: 14px; }

/* ---------------- Stepper ---------------- */
.stepper { margin: 26px 0; }
.step {
  position: relative;
  padding-inline-start: 50px; padding-bottom: 30px;
}
.step:last-child { padding-bottom: 4px; }
.step::before {
  content: attr(data-n);
  position: absolute; inset-inline-start: 0; top: 0;
  width: 34px; height: 34px; border-radius: 11px;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  background: var(--icon-grad); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 8px 20px -8px rgba(143,107,255,.9);
}
.step::after {
  content: ''; position: absolute;
  inset-inline-start: 17px; top: 40px; bottom: 6px;
  width: 1px; background: linear-gradient(var(--line-2), transparent);
}
.step:last-child::after { display: none; }
.step h3 {
  margin: 4px 0 12px;
  font-family: var(--font-display); font-weight: 800; font-size: 20px;
  line-height: 1.45; color: #fff;
}
.step p { font-size: 16.5px; }
.step .bullet { display: flex; gap: 11px; margin-bottom: 11px; }
.step .bullet::before {
  content: ''; flex: none; width: 6px; height: 6px; border-radius: 50%;
  margin-top: 12px; background: var(--brand-light); box-shadow: 0 0 8px var(--brand-light);
}
.step .bullet > span { flex: 1; line-height: 1.85; color: var(--text-2); font-size: 16.5px; }

/* ---------------- Figure ---------------- */
figure {
  margin: 18px 0 20px;
  border-radius: 16px; overflow: hidden;
  border: 1px solid var(--line-2);
  background: var(--surface);
}
.fig-btn {
  display: block; width: 100%; padding: 0; border: 0;
  background: none; cursor: zoom-in; position: relative;
}
figure img {
  display: block; width: 100%; height: auto;
  max-height: 460px; object-fit: contain; object-position: center;
  background: #0b0912; min-height: 140px;
}
.fig-zoom {
  position: absolute; inset-block-start: 12px; inset-inline-end: 12px;
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(13,10,21,.82); backdrop-filter: blur(6px);
  border: 1px solid var(--line-2); color: var(--brand-pale);
  opacity: 0; transform: scale(.9); transition: all .2s;
}
.fig-zoom svg { width: 17px; height: 17px; }
.fig-btn:hover .fig-zoom, .fig-btn:focus-visible .fig-zoom { opacity: 1; transform: none; }

/* ---------------- Lightbox ---------------- */
.lightbox {
  position: fixed; inset: 0; z-index: 150;
  display: none; place-items: center;
  padding: clamp(16px, 5vw, 56px);
  background: rgba(5,4,10,.93); backdrop-filter: blur(10px);
}
.lightbox.open { display: grid; animation: fade .2s ease; }
.lb-inner { margin: 0; max-width: 100%; max-height: 100%; border: 0; background: none; overflow: visible; }
.lightbox img {
  display: block; max-width: 100%; max-height: 82vh;
  width: auto; min-height: 0; border-radius: 14px;
  border: 1px solid var(--line-2);
  box-shadow: 0 40px 90px -30px #000;
  object-fit: contain; background: #0b0912;
}
.lb-cap {
  margin-top: 14px; text-align: center;
  font-size: 14px; color: var(--muted);
  border: 0; padding: 0; background: none;
}
.lb-close {
  position: absolute; top: 18px; inset-inline-end: 18px;
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; cursor: pointer;
  background: rgba(20,16,33,.9); border: 1px solid var(--line-2);
  color: var(--text); transition: all .2s;
}
.lb-close:hover { background: rgba(143,107,255,.3); color: #fff; }
.lb-close svg { width: 20px; height: 20px; }

/* ---------------- Back to top ---------------- */
.to-top {
  position: fixed; bottom: 26px; inset-inline-start: 26px; z-index: 60;
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center; cursor: pointer;
  background: var(--icon-grad); color: #fff; border: 0;
  box-shadow: 0 14px 34px -12px rgba(143,107,255,.95);
  opacity: 0; visibility: hidden; transform: translateY(14px);
  transition: all .28s cubic-bezier(.2,.8,.2,1);
}
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { transform: translateY(-3px); }
.to-top svg { width: 20px; height: 20px; }

/* ---------------- Heading anchor ---------------- */
.h-anchor {
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  display: grid; place-items: center; cursor: pointer;
  background: transparent; border: 1px solid transparent;
  color: var(--faint); opacity: 0; transition: all .2s;
}
.h-anchor svg { width: 14px; height: 14px; }
h2.section:hover .h-anchor, .h-anchor:focus-visible { opacity: 1; }
.h-anchor:hover { background: rgba(143,107,255,.16); border-color: var(--line-2); color: var(--brand-pale); }
.h-anchor.ok { opacity: 1; color: var(--green); border-color: rgba(125,255,179,.4); background: rgba(125,255,179,.14); }
.h-anchor.failed { opacity: 1; color: var(--amber); }
figcaption {
  padding: 13px 18px;
  font-size: 14.5px; font-weight: 500; line-height: 1.7; color: var(--dim);
  border-top: 1px solid var(--line);
  background: rgba(20,16,33,.55);
}

/* ---------------- Video ---------------- */
.video {
  margin: 22px 0;
  border-radius: 18px; overflow: hidden;
  border: 1px solid var(--line-2);
  background: var(--card-grad);
  transition: all .25s;
}
.video:hover { border-color: var(--line-3); box-shadow: 0 18px 44px -20px rgba(143,107,255,.55); }

.video-thumb, .video-frame {
  position: relative; aspect-ratio: 16/9;
  background: #0b0912; cursor: pointer;
  display: block; overflow: hidden;
  width: 100%; padding: 0; border: 0;
}
.video-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .4s cubic-bezier(.2,.8,.2,1), filter .3s;
}
.video-thumb::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(7,6,12,.1), rgba(7,6,12,.55));
  pointer-events: none; transition: opacity .3s;
}
.video:hover .video-thumb img { transform: scale(1.04); }
.video-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

.video-play {
  position: absolute; inset: 0; margin: auto;
  width: 72px; height: 72px; border-radius: 50%;
  display: grid; place-items: center; z-index: 2;
  background: var(--icon-grad);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 14px 38px -10px rgba(143,107,255,1);
  transition: transform .25s cubic-bezier(.2,.8,.2,1);
}
/* physical left: optically centres the right-pointing triangle in both directions */
.video-play svg { width: 32px; height: 32px; color: #fff; margin-left: 3px; }
.video:hover .video-play { transform: scale(1.09); }

.video-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 18px;
  border-top: 1px solid var(--line);
  background: rgba(20,16,33,.6);
}
.video-title { font-size: 16px; font-weight: 700; line-height: 1.6; color: var(--text); }
.video-yt {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; border-radius: 9px;
  font-family: var(--font-mono); font-size: 11.5px;
  background: rgba(255,60,60,.14); border: 1px solid rgba(255,90,90,.3);
  color: #ff9b9b;
}
.video-yt:hover { background: rgba(255,60,60,.26); color: #fff; }

/* ---------------- Tabs ---------------- */
.tabs { margin: 26px 0; }
.tab-bar {
  display: flex; gap: 6px; padding: 5px;
  border-radius: 13px;
  background: rgba(20,16,33,.7); border: 1px solid var(--line);
  width: fit-content; max-width: 100%; overflow-x: auto;
}
.tab-btn {
  padding: 9px 20px; border-radius: 9px;
  font-family: var(--font-body); font-size: 14px; font-weight: 700;
  background: transparent; border: none; color: var(--muted);
  cursor: pointer; transition: all .2s; white-space: nowrap;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  background: var(--icon-grad); color: #fff;
  box-shadow: 0 8px 20px -8px rgba(143,107,255,.9);
}
.tab-panel { display: none; padding-top: 22px; }
.tab-panel.active { display: block; animation: fade .3s ease; }

/* ---------------- Callouts ---------------- */
.callout {
  display: flex; gap: 13px;
  padding: 16px 18px; margin: 20px 0;
  border-radius: 14px;
  border: 1px solid var(--line-2);
  background: rgba(143,107,255,.07);
  border-inline-start: 3px solid var(--brand);
}
.callout svg { flex: none; width: 19px; height: 19px; margin-top: 2px; color: var(--brand-light); }
.callout-body { flex: 1; min-width: 0; }
.callout-body p { margin: 0; font-size: 16.5px; line-height: 1.8; }
.callout-body p + p { margin-top: 10px; }
.callout-title { font-weight: 800; color: #fff; font-size: 17px !important; margin-bottom: 7px !important; }

.callout.warn { background: rgba(255,196,107,.07); border-color: rgba(255,196,107,.3); border-inline-start-color: var(--amber); }
.callout.warn svg { color: var(--amber); }
.callout.ok { background: rgba(125,255,179,.06); border-color: rgba(125,255,179,.26); border-inline-start-color: var(--green); }
.callout.ok svg { color: var(--green); }

/* ---------------- Code block ---------------- */
.codeblock { margin: 18px 0; border-radius: 13px; overflow: hidden; border: 1px solid var(--line-2); }
.codeblock-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px;
  background: rgba(20,16,33,.9); border-bottom: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 11.5px; color: var(--dim);
}
.copy-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 7px; cursor: pointer;
  background: rgba(143,107,255,.14); border: 1px solid var(--line-2);
  color: var(--brand-pale); font-family: var(--font-mono); font-size: 11px;
  transition: all .2s;
}
.copy-btn:hover { background: rgba(143,107,255,.28); color: #fff; }
.copy-btn svg { width: 12px; height: 12px; }
.codeblock pre {
  margin: 0; padding: 16px;
  background: #0b0912; overflow-x: auto;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.7;
  color: #d9cfff; direction: ltr; text-align: left;
}

/* ---------------- Buttons ---------------- */
.btn-row { display: flex; flex-wrap: wrap; gap: 11px; margin: 20px 0; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  height: 50px; padding: 0 24px; border-radius: 13px;
  font-family: var(--font-body); font-size: 16px; font-weight: 700;
  cursor: pointer; transition: all .25s; border: 1px solid transparent;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary {
  background: var(--icon-grad); color: #fff;
  box-shadow: 0 12px 30px -12px rgba(143,107,255,.95);
}
.btn-primary:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 18px 38px -14px rgba(143,107,255,1); }
.btn-secondary {
  background: rgba(20,14,34,.6); border-color: var(--line-2); color: var(--text);
}
.btn-secondary:hover { border-color: var(--brand-light); background: rgba(143,107,255,.18); box-shadow: 0 0 26px rgba(143,107,255,.35); color: #fff; }

/* ---------------- Password / value pill ---------------- */
.pill-value {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 9px 14px; border-radius: 11px;
  background: rgba(143,107,255,.12); border: 1px dashed var(--line-3);
  font-family: var(--font-mono); font-size: 14px; color: #fff;
  direction: ltr;
}
.pill-value button {
  background: none; border: none; color: var(--brand-pale); cursor: pointer;
  display: inline-flex; padding: 0;
}
.pill-value button svg { width: 14px; height: 14px; }

/* ---------------- Support block ---------------- */
.support {
  margin-top: 60px; padding: 30px;
  border-radius: 20px;
  background: var(--card-grad);
  border: 1px solid var(--line-2);
  position: relative; overflow: hidden;
}
.support::after {
  content: ''; position: absolute; inset-block: -40%; inset-inline-end: -10%; width: 50%;
  background: radial-gradient(circle, rgba(143,107,255,.18), transparent 70%);
  pointer-events: none;
}
.support h2 { margin: 0 0 9px; font-family: var(--font-display); font-weight: 800; font-size: 25px; line-height: 1.4; color: #fff; }
.support .tag {
  font-family: var(--font-body); font-size: 13.5px; font-weight: 700;
  letter-spacing: .04em; color: var(--brand-light); margin-bottom: 12px;
}
.support p { max-width: 62ch; font-size: 16.5px; }

/* ---------------- Page nav (prev/next) ---------------- */
.pagenav {
  display: grid; gap: 13px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  margin-top: 46px; padding-top: 30px; border-top: 1px solid var(--line);
}
.pagenav a {
  padding: 16px 19px; border-radius: 14px;
  border: 1px solid var(--line); background: rgba(20,16,33,.5);
  transition: all .22s;
}
.pagenav a:hover { border-color: var(--line-3); background: rgba(143,107,255,.1); }
.pagenav .dir { font-family: var(--font-body); font-size: 13px; font-weight: 600; color: var(--dim); margin-bottom: 7px; }
.pagenav .ttl { font-weight: 700; font-size: 17px; line-height: 1.5; color: var(--text); }
.pagenav a.next { text-align: end; }

/* ---------------- On this page ---------------- */
.toc {
  position: sticky; top: calc(var(--topbar-h) + 30px);
  align-self: start;
  padding: 0 14px;
  max-height: calc(100vh - var(--topbar-h) - 60px); overflow-y: auto;
}
.toc-title {
  font-family: var(--font-body); font-size: 13px; font-weight: 700;
  letter-spacing: .04em; color: var(--dim); margin-bottom: 14px;
}
.toc a {
  display: block; padding: 8px 12px; margin-bottom: 3px;
  border-radius: 8px; font-size: 14.5px; font-weight: 500; line-height: 1.6;
  color: var(--muted);
  border-inline-start: 2px solid transparent;
}
.toc a:hover { color: var(--text); background: rgba(143,107,255,.08); }
.toc a.active { color: var(--brand-pale); border-inline-start-color: var(--brand); background: rgba(143,107,255,.1); }

.with-toc { display: grid; grid-template-columns: minmax(0,1fr) 230px; gap: 40px; }

/* ---------------- Search overlay ---------------- */
.search-results {
  position: absolute; top: 46px; inset-inline: 0; z-index: 60;
  max-height: 60vh; overflow-y: auto;
  border-radius: 14px; padding: 7px;
  background: rgba(13,10,21,.97); backdrop-filter: blur(16px);
  border: 1px solid var(--line-2);
  box-shadow: 0 24px 60px -20px rgba(0,0,0,.9);
  display: none;
}
.search-results.open { display: block; }
.sr-item { display: block; padding: 11px 13px; border-radius: 10px; cursor: pointer; transition: background .15s; text-decoration: none; }
.sr-item:hover, .sr-item.sel { background: rgba(143,107,255,.16); }
.sr-item .sr-t { font-size: 15.5px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.sr-item .sr-p { font-size: 13.5px; line-height: 1.6; color: var(--dim); }
.sr-empty { padding: 22px; text-align: center; color: var(--dim); font-size: 15px; }

/* ---------------- Game hero ---------------- */
.game-hero {
  position: relative; overflow: hidden;
  border-radius: 20px; padding: 30px;
  margin-bottom: 30px;
  background: var(--card-grad);
  border: 1px solid var(--line-2);
  display: flex; align-items: center; gap: 22px;
}
.game-hero img.ico {
  width: 66px; height: 66px; flex: none; border-radius: 17px;
  object-fit: contain; background: rgba(143,107,255,.12);
  border: 1px solid var(--line-2); padding: 9px;
}
.game-hero h1 { margin: 0 0 6px; font-family: var(--font-display); font-weight: 900; font-size: clamp(24px,3.4vw,34px); color: #fff; }
.game-hero p { margin: 0; font-size: 14.5px; color: var(--muted); }

/* ---------------- Shop ---------------- */
.shop-cat {
  margin: 20px 0;
  border-radius: 18px; overflow: hidden;
  border: 1px solid var(--line);
  background: var(--card-grad);
  transition: border-color .22s;
  scroll-margin-top: calc(var(--topbar-h) + 20px);
}
.shop-cat:hover { border-color: var(--line-2); }

.shop-head {
  display: flex; align-items: center; gap: 15px;
  padding: 19px 22px;
  border-bottom: 1px solid var(--line);
}
.shop-ico {
  flex: none; width: 46px; height: 46px; border-radius: 13px;
  object-fit: contain; padding: 8px;
  background: rgba(143,107,255,.12); border: 1px solid var(--line-2);
}
.shop-ico.ph { display: grid; place-items: center; padding: 0; }
.shop-ico.ph svg { width: 21px; height: 21px; color: var(--brand-light); }

.shop-meta { flex: 1; min-width: 0; }
.shop-meta h3 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 19px; line-height: 1.4; color: #fff; }
.shop-meta p { margin: 5px 0 0; font-size: 14.5px; color: var(--dim); }

.shop-buy { flex: none; height: 44px; padding: 0 22px; font-size: 15px; }

.shop-rows { padding: 8px 10px 12px; }
.shop-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 11px 13px; border-radius: 11px;
  transition: background .18s;
}
.shop-row:hover { background: rgba(143,107,255,.08); }
.shop-row + .shop-row { border-top: 1px solid rgba(183,155,255,.07); }
.shop-row .n { font-size: 16.5px; font-weight: 500; color: var(--text-2); }
.shop-row .price {
  flex: none; font-family: var(--font-display); font-weight: 800; font-size: 17px;
  color: var(--brand-pale); white-space: nowrap;
}
.shop-row .was {
  color: var(--faint); text-decoration: line-through;
  font-size: 14px; font-weight: 600; margin-inline-start: 6px;
}

/* ---------------- Mobile ---------------- */
.backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0,0,0,.6); backdrop-filter: blur(3px);
  display: none;
}
.backdrop.open { display: block; }

@media (max-width: 1150px) {
  .with-toc { grid-template-columns: minmax(0,1fr); }
  .toc { display: none; }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-flex; }
  .sidebar {
    position: fixed; z-index: 45; top: var(--topbar-h);
    inset-inline-start: 0; width: min(310px, 86vw);
    background: #0a0812;
    transform: translateX(var(--off, -110%));
    transition: transform .28s cubic-bezier(.2,.8,.2,1);
  }
  html[dir="rtl"] .sidebar { transform: translateX(calc(var(--off, -110%) * -1)); }
  .sidebar.open { --off: 0%; }
  .topbar { gap: 10px; padding: 0 12px; }
  .search-box { width: auto; flex: 1 1 0; min-width: 0; }
  /* the input's intrinsic width would otherwise push it past its box */
  .search-box input { min-width: 0; padding-inline: 38px 12px; }
  .search-kbd { display: none; }
  /* icon-only here; the store lives in the sidebar on small screens */
  .topbar-link span { display: none; }
  .topbar-link { width: 42px; padding: 0; justify-content: center; flex: none; }
  .store-link { display: none; }
  .lang-btn { width: 44px; min-width: 0; padding: 0; font-size: 13px; }
  .content { padding: 30px 18px 80px; }
  .brand-sub { display: none; }
  .brand { flex: none; }
  .brand img { width: 30px; height: 30px; }
  .brand-name { font-size: 17px; }
}

@media (max-width: 420px) {
  .brand-name { display: none; }
}

/* ---------------- Print ---------------- */
@media print {
  .topbar, .sidebar, .toc, .to-top, .backdrop, .ambient,
  .lightbox, .skip-link, .pagenav, .h-anchor, .fig-zoom, .video-play { display: none !important; }

  html, body { background: #fff !important; color: #111 !important; }
  .shell { display: block; padding: 0; max-width: none; }
  .content { padding: 0; }
  .with-toc { display: block; }

  h1.page-title, h2.section, .step h3, .card h3, .shop-meta h3 { color: #000 !important; }
  p, .step .bullet > span, .shop-row .n { color: #222 !important; }

  .card, .shop-cat, .callout, .support, figure, .video, .codeblock {
    border: 1px solid #ccc !important; background: #fff !important;
    box-shadow: none !important; break-inside: avoid;
  }
  .step { break-inside: avoid; }
  figure img { max-height: none; }
  code.inline { background: #f1eefc !important; color: #4a1fb8 !important; }
  .codeblock pre { background: #f7f5ff !important; color: #222 !important; }

  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 10px; color: #666; }
}

@media (max-width: 560px) {
  .game-hero { flex-direction: column; align-items: flex-start; }
  .btn { width: 100%; justify-content: center; }
  .step { padding-inline-start: 42px; }
  .shop-head { flex-wrap: wrap; }
  .shop-buy { width: 100%; justify-content: center; }
  .video-play { width: 58px; height: 58px; }
  .video-play svg { width: 26px; height: 26px; }
}
