/*
 * LuckyWheel: design system + site chrome (owner: Foundation). Budget ≤ 15 KB gz.
 * Tokens (spec §9.2) · base · layout · header/menus · buttons · chips · cards · content · FAQ · forms ·
 * dialogs · hub · 404/offline · footer · language banner · utilities.
 * Logical properties only (RTL works from dir="rtl"). Motion durations collapse to 0 in reduced motion.
 * Other stylesheets (wheel.css, tools/*.css) may use every custom property defined here.
 */

/* ───────────── 1. Tokens ───────────── */
:root {
  color-scheme: light;
  --bg: #F7F7FB;
  --surface: #FFFFFF;
  --surface-2: #EFEFF6;
  --border: #E3E4EC;
  --border-strong: #8A8FA0;
  --text: #14151A;
  --text-muted: #5B6070;
  --brand: #5B3DF5;
  --brand-hover: #4A2DE6;
  --brand-press: #3F25C7;
  --brand-ink: #FFFFFF;
  --brand-soft: #ECE8FF;
  --brand-soft-ink: #5B3DF5;
  --accent: #FFB800;
  --accent-ink: #14151A;
  --success: #12805C;
  --success-soft: #E6F4EE;
  --danger: #C62828;
  --danger-soft: #FCEBEB;
  --warning: #B45309;
  --warning-soft: #FDF1E3;
  --focus: #5B3DF5;
  --focus-ring: rgba(91, 61, 245, .22);
  --link: #5B3DF5;
  --overlay: rgba(14, 15, 19, .55);

  --shadow-sm: 0 1px 2px rgba(20, 21, 26, .08);
  --shadow-md: 0 4px 16px rgba(20, 21, 26, .10);
  --shadow-lg: 0 12px 40px rgba(20, 21, 26, .18);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", Tahoma, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --fs-12: .75rem; --fs-14: .875rem; --fs-16: 1rem; --fs-18: 1.125rem; --fs-20: 1.25rem;
  --fs-24: 1.5rem; --fs-30: 1.875rem; --fs-36: 2.25rem; --fs-48: 3rem;
  --fs-h1: clamp(1.375rem, 4.5vw, 2.25rem);
  --fs-h2: clamp(1.25rem, 3vw, 1.75rem);

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;
  --r-field: 10px; --r-btn: 14px; --r-card: 16px; --r-sheet: 20px; --r-dialog: 24px; --r-pill: 999px;

  --dur-1: 120ms; --dur-2: 200ms; --dur-3: 320ms;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --spring: linear(0, .009, .035 2.1%, .141 4.4%, .723 12.9%, .938 16.7%, 1.017 19.4%, 1.043 21.8%, 1.044 24%, 1.031 27.4%, 1.003 34.4%, .994 39.3%, .996 47.5%, 1);

  --wrap: 1200px;
  --gutter: 16px;
  --header-h: 52px;
  --measure: 72ch;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0E0F13; --surface: #171922; --surface-2: #1F2230; --border: #2A2D3A; --border-strong: #737891;
    --text: #ECEDF2; --text-muted: #A3A8B8;
    --brand: #8F7BFF; --brand-hover: #A291FF; --brand-press: #7A64F0; --brand-ink: #0E0F13;
    --brand-soft: #2A2350; --brand-soft-ink: #C9BFFF;
    --success: #3DD68C; --success-soft: #0F2A1F; --danger: #FF6B6B; --danger-soft: #3A1618;
    --warning: #FBBF24; --warning-soft: #33250A;
    --focus: #8F7BFF; --focus-ring: rgba(143, 123, 255, .32); --link: #A99BFF; --overlay: rgba(0, 0, 0, .65);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .32); --shadow-md: 0 4px 16px rgba(0, 0, 0, .36); --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0E0F13; --surface: #171922; --surface-2: #1F2230; --border: #2A2D3A; --border-strong: #737891;
  --text: #ECEDF2; --text-muted: #A3A8B8;
  --brand: #8F7BFF; --brand-hover: #A291FF; --brand-press: #7A64F0; --brand-ink: #0E0F13;
  --brand-soft: #2A2350; --brand-soft-ink: #C9BFFF;
  --success: #3DD68C; --success-soft: #0F2A1F; --danger: #FF6B6B; --danger-soft: #3A1618;
  --warning: #FBBF24; --warning-soft: #33250A;
  --focus: #8F7BFF; --focus-ring: rgba(143, 123, 255, .32); --link: #A99BFF; --overlay: rgba(0, 0, 0, .65);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .32); --shadow-md: 0 4px 16px rgba(0, 0, 0, .36); --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
}
@media (min-width: 768px) { :root { --gutter: 24px; --header-h: 64px; } }
@media (min-width: 1024px) { :root { --gutter: 32px; } }
@media (prefers-reduced-motion: reduce) { :root { --dur-1: 0ms; --dur-2: 0ms; --dur-3: 0ms; } }

/* ───────────── 2. Base ───────────── */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  scroll-padding-block: 16px 0;
  -webkit-tap-highlight-color: transparent;
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: 400 1rem/1.6 var(--font);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
[lang="ar"] body { font-size: 1.0625rem; line-height: 1.75; }
h1, h2, h3, h4 { line-height: 1.25; text-wrap: balance; }
p, li { text-wrap: pretty; }
img, svg, video, canvas { max-width: 100%; }
img { height: auto; }
a { color: var(--link); text-decoration-thickness: .07em; text-underline-offset: .2em; }
a:hover { text-decoration-thickness: .12em; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: var(--brand-soft); color: var(--text); }
[hidden] { display: none !important; }
.icon { width: 20px; height: 20px; flex: none; display: inline-block; vertical-align: middle; overflow: visible; }
.icon--dir:dir(rtl) { transform: scaleX(-1); }

/* ───────────── 3. Layout ───────────── */
.c-main {
  display: block; width: 100%; max-width: var(--wrap); margin-inline: auto;
  padding: 0 var(--gutter) var(--s-8); flex: 1 0 auto;
}
.c-main:focus { outline: none; }
.c-main--narrow { max-width: 760px; padding-top: var(--s-7); text-align: center; }
.c-main--embed { max-width: none; padding: var(--s-2); }
.c-content { margin-top: var(--s-7); }
.c-pagehead { padding-block: var(--s-4) var(--s-6); }
.c-pagehead + .c-content { margin-top: 0; }
.c-sec.c-sec--templates { margin-bottom: var(--s-4); }
.c-hub + .c-content { margin-top: var(--s-6); }
.c-sec > .c-contact, .c-sec > .lh-block:not(:empty) { margin-top: var(--s-5); }
.c-pagehead .c-h1 { max-width: 30ch; }

/* Tool pages: visual order on mobile (DOM order unchanged, spec §7.0). */
.c-main--tool { display: flex; flex-direction: column; }
@media (max-width: 767.98px) {
  .c-main--tool > .c-h1 { order: 1; }
  .c-main--tool > .c-tool { order: 2; }
  .c-main--tool > .c-chips { order: 3; }
  .c-main--tool > .c-crumbs { order: 4; margin-top: var(--s-4); }
  .c-main--tool > .c-subtitle { order: 5; margin-top: var(--s-5); color: var(--text); font-size: 1rem; }
  .c-main--tool > .c-content { order: 6; margin-top: var(--s-5); }
}

/* ───────────── 4. Headings, lead ───────────── */
.c-h1 { margin: 0; font-size: var(--fs-h1); font-weight: 800; line-height: 1.15; letter-spacing: -.02em; }
.c-main--tool > .c-h1 { padding-block: var(--s-3) var(--s-2); text-align: center; }
.c-subtitle { margin: 0; max-width: var(--measure); color: var(--text-muted); font-size: var(--fs-18); line-height: 1.5; }
.c-lead { margin: var(--s-3) 0 0; max-width: 62ch; color: var(--text-muted); font-size: var(--fs-18); line-height: 1.55; }
.c-main--narrow .c-lead { margin-inline: auto; }
@media (min-width: 768px) {
  .c-main--tool > .c-h1 { text-align: start; padding-block: var(--s-5) var(--s-1); }
  .c-main--tool > .c-crumbs + .c-h1 { padding-top: var(--s-1); }
  .c-main--tool > .c-subtitle { margin-bottom: var(--s-2); }
}
:lang(ar) .c-h1, :lang(ar) h2, :lang(ar) h3 { letter-spacing: 0; line-height: 1.35; }

/* ───────────── 5. Header ───────────── */
.c-skip {
  position: absolute; z-index: 100; inset-inline-start: var(--s-2); top: var(--s-2);
  padding: var(--s-3) var(--s-4); border-radius: var(--r-btn);
  background: var(--brand); color: var(--brand-ink); font-weight: 700; text-decoration: none;
  transform: translateY(-160%); transition: transform var(--dur-2) var(--ease-out);
}
.c-skip:focus { transform: none; }
.c-header { position: relative; z-index: 40; background: var(--bg); border-bottom: 1px solid var(--border); }
.c-header__in {
  display: flex; align-items: center; gap: var(--s-1);
  max-width: var(--wrap); height: var(--header-h); margin-inline: auto; padding-inline: var(--gutter);
}
.c-brand {
  display: inline-flex; align-items: center; gap: var(--s-2); min-height: 48px; margin-inline-end: auto;
  color: var(--text); text-decoration: none; font-weight: 800; font-size: 1.125rem; letter-spacing: -.015em; white-space: nowrap;
}
.c-brand__word span { color: var(--brand); }
.c-mark { flex: none; }
.c-mark__s path { stroke: var(--bg); }
.c-mark__hub { fill: #fff; }
.c-mark__ptr { fill: var(--text); }
.c-mark__s { transform-box: fill-box; transform-origin: center; transition: transform calc(var(--dur-3) * 3) var(--ease-out); }
.c-brand:hover .c-mark__s { transform: rotate(360deg); }

.c-iconbtn {
  display: inline-grid; place-items: center; width: 48px; height: 48px; padding: 0;
  border: 0; border-radius: var(--r-btn); background: none; color: var(--text);
  transition: background-color var(--dur-2);
}
.c-iconbtn:hover { background: var(--surface-2); }
.c-iconbtn .icon { width: 22px; height: 22px; }

.c-nav__list { display: flex; align-items: center; gap: 2px; margin: 0; padding: 0; list-style: none; }
.c-nav__link {
  display: inline-flex; align-items: center; gap: 6px; min-height: 48px; padding: 0 var(--s-3);
  border: 0; border-radius: var(--r-btn); background: none; color: var(--text);
  font-weight: 600; font-size: .9375rem; text-decoration: none; white-space: nowrap;
  transition: background-color var(--dur-2), color var(--dur-2);
}
.c-nav__link:hover { background: var(--surface-2); }
.c-nav__link[aria-current="page"] { color: var(--brand); }
.c-dd { position: relative; }
.c-dd__chev { width: 16px; height: 16px; color: var(--text-muted); transition: transform var(--dur-2) var(--ease-out); }
.c-dd.is-open .c-dd__chev { transform: rotate(180deg); }
.c-dd__code { font-variant-numeric: tabular-nums; }
.c-dd__panel {
  position: absolute; z-index: 50; top: calc(100% + 6px); inset-inline-start: 0; display: none;
  min-width: 220px; padding: var(--s-2);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-lg);
}
.c-dd.is-open > .c-dd__panel { display: block; animation: lh-pop var(--dur-2) var(--ease-out); }
html:not(.js) .c-dd:hover > .c-dd__panel, html:not(.js) .c-dd:focus-within > .c-dd__panel { display: block; }
.c-dd--grid .c-dd__panel { width: min(600px, calc(100vw - 2 * var(--gutter))); }
.c-dd__mlabel { display: none; }
.c-dd--lang .c-dd__panel { inset-inline-start: auto; inset-inline-end: 0; }
@keyframes lh-pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

.c-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; margin: 0; padding: 0; list-style: none; }
.c-tools__link {
  display: flex; align-items: center; gap: var(--s-3); min-height: 52px; padding: 6px 10px;
  border-radius: var(--s-3); color: var(--text); text-decoration: none; font-weight: 600; font-size: .9375rem; line-height: 1.3;
}
.c-tools__link:hover { background: var(--surface-2); }
.c-tools__link[aria-current="page"] { background: var(--brand-soft); }
.c-tools__ic {
  display: grid; place-items: center; flex: none; width: 36px; height: 36px;
  border-radius: 10px; background: var(--brand-soft); color: var(--brand-soft-ink);
}
.c-tools__ic .icon { width: 19px; height: 19px; }
.c-dd__more {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-2);
  margin-top: var(--s-2); padding: var(--s-3) 10px 6px; border-top: 1px solid var(--border);
  color: var(--link); font-weight: 600; text-decoration: none; min-height: 48px;
}
.c-dd__more:hover { text-decoration: underline; }
.c-menu__label { margin: 0 0 var(--s-1); padding-inline: 10px; font-size: var(--fs-12); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.c-langs { margin: 0; padding: 0; list-style: none; }
.c-langs__link {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-height: 48px;
  padding: 0 var(--s-3); border-radius: var(--s-3); color: var(--text); text-decoration: none; font-weight: 500;
}
.c-langs__link:hover { background: var(--surface-2); }
.c-langs__link[aria-current] { color: var(--brand); font-weight: 700; }
.c-langs__link .icon { width: 18px; height: 18px; }

.c-theme .i-light, .c-theme .i-dark { display: none; }
:root[data-theme="light"] .c-theme .i-system, :root[data-theme="dark"] .c-theme .i-system { display: none; }
:root[data-theme="light"] .c-theme .i-light, :root[data-theme="dark"] .c-theme .i-dark { display: inline-block; }
html:not(.js) .c-theme, html:not(.js) .c-burger { display: none; }

.c-mywheels {
  position: relative; display: inline-flex; align-items: center; gap: var(--s-2); height: 40px; padding: 0 14px 0 12px;
  border-radius: var(--r-pill); background: var(--brand-soft); color: var(--brand-soft-ink);
  font-weight: 700; font-size: var(--fs-14); text-decoration: none; white-space: nowrap;
  transition: background-color var(--dur-2), transform var(--dur-1) var(--ease-out);
}
.c-mywheels::after { content: ""; position: absolute; inset: -4px 0; }
.c-mywheels:hover { background: color-mix(in srgb, var(--brand-soft) 80%, var(--brand)); }
.c-mywheels:active { transform: scale(.96); }
.c-mywheels .icon { width: 18px; height: 18px; }
.c-burger .i-close, .c-burger[aria-expanded="true"] .i-open { display: none; }
.c-burger[aria-expanded="true"] .i-close { display: inline-block; }

@media (max-width: 767.98px) {
  .c-menu {
    position: absolute; z-index: 45; inset-inline: 0; top: 100%; display: none;
    max-height: calc(100dvh - var(--header-h)); overflow: auto; overscroll-behavior: contain;
    padding: var(--s-2) var(--gutter) var(--s-4);
    background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg);
  }
  .c-menu.is-open { display: block; animation: lh-pop var(--dur-2) var(--ease-out); }
  html:not(.js) .c-header__in { flex-wrap: wrap; height: auto; min-height: var(--header-h); }
  html:not(.js) .c-menu { display: block; position: static; order: 9; flex-basis: 100%; margin-inline: calc(-1 * var(--gutter)); box-shadow: none; }
  .c-nav__list { flex-direction: column; align-items: stretch; }
  .c-dd--grid > .c-dd__btn { display: none; }
  .c-dd__mlabel { display: block; margin-top: var(--s-3); padding-inline: 4px; }
  .c-dd > .c-dd__panel { position: static; display: block; width: auto; min-width: 0; padding: 0; border: 0; box-shadow: none; animation: none; }
  .c-tools__link { padding-inline: 4px; }
  .c-dd__more { padding-inline: 4px; }
  .c-nav__list > li > .c-nav__link { width: 100%; padding-inline: 4px; border-top: 1px solid var(--border); border-radius: 0; }
  .c-nav__list:has(.c-dd__more) > li:not(.c-dd) { display: none; } /* "All templates" already closes the tools grid */
  .c-menu__end { display: flex; align-items: center; gap: var(--s-3); padding-top: var(--s-3); border-top: 1px solid var(--border); }
  .c-dd--lang { flex: 1; }
  .c-dd--lang > .c-dd__btn, .c-dd--lang .c-menu__label { display: none; }
  .c-langs { display: flex; flex-wrap: wrap; gap: 6px; }
  .c-langs__link { min-height: 40px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--r-pill); }
  .c-langs__link[aria-current] { border-color: var(--brand); background: var(--brand-soft); }
  .c-langs__link .icon { display: none; }
}
@media (max-width: 359.98px) {
  .c-mywheels { width: 44px; padding: 0; justify-content: center; }
  .c-mywheels span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (min-width: 768px) {
  .c-header__in { gap: var(--s-2); position: relative; }
  /* Tools and Templates menus open as panels aligned on the header container (never off-screen) */
  .c-dd--grid { position: static; }
  .c-dd--grid > .c-dd__panel { inset-inline-start: var(--gutter); }
  .c-brand { margin-inline-end: var(--s-4); }
  .c-menu { display: flex; flex: 1; align-items: center; gap: var(--s-1); }
  .c-menu__end { display: flex; align-items: center; gap: 2px; margin-inline-start: auto; }
  .c-burger { display: none; }
}

/* ───────────── 6. Buttons ───────────── */
.c-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 48px; padding: 0 20px; border: 1px solid transparent; border-radius: var(--r-btn);
  font-weight: 700; font-size: 1rem; line-height: 1.2; text-decoration: none; white-space: nowrap;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
  transition: transform var(--dur-1) var(--ease-out), background-color var(--dur-2), border-color var(--dur-2), box-shadow var(--dur-2);
}
.c-btn:active { transform: scale(.96); }
.c-btn--primary {
  background: var(--brand); color: var(--brand-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 2px 0 var(--brand-press);
}
.c-btn--primary:hover { background: var(--brand-hover); }
.c-btn--ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.c-btn--ghost:hover { background: var(--surface-2); }
.c-btn--soft { background: var(--brand-soft); color: var(--brand-soft-ink); }
.c-btn--lg { min-height: 56px; padding: 0 28px; border-radius: var(--r-pill); font-size: 1.0625rem; }
.c-btn--sm { min-height: 40px; padding: 0 14px; font-size: var(--fs-14); border-radius: var(--s-3); }
.c-btn--sm::after { content: ""; position: absolute; inset: -4px 0; }
.c-btn .icon { width: 20px; height: 20px; }

/* ───────────── 7. Breadcrumbs, chips ───────────── */
.c-crumbs { font-size: var(--fs-14); color: var(--text-muted); }
.c-crumbs ol { display: flex; flex-wrap: wrap; align-items: center; margin: 0; padding: 0; list-style: none; }
.c-crumbs li { display: inline-flex; align-items: center; min-width: 0; }
.c-crumbs a { display: inline-block; padding: 12px 2px; color: var(--text-muted); text-decoration: none; }
.c-crumbs a:hover { color: var(--text); text-decoration: underline; }
.c-crumbs [aria-current] { padding: 12px 2px; color: var(--text); font-weight: 600; }
.c-crumbs__sep { width: 14px; height: 14px; margin-inline: 4px; opacity: .55; }
@media (min-width: 768px) { .c-crumbs { padding-top: var(--s-1); } .c-crumbs a, .c-crumbs [aria-current] { padding-block: 10px; } }

.c-chips { margin-top: var(--s-5); }
.c-chips__label { margin: 0 0 var(--s-2); font-size: var(--fs-12); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.c-chips__list {
  display: flex; gap: var(--s-2); margin: 0 calc(-1 * var(--gutter)); padding: 6px var(--gutter);
  list-style: none; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent);
}
.c-chips__list::-webkit-scrollbar { display: none; }
.c-chip {
  position: relative; display: inline-flex; align-items: center; gap: var(--s-2); height: 40px; padding: 0 16px 0 12px;
  border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--surface);
  color: var(--text); font-weight: 600; font-size: var(--fs-14); white-space: nowrap; text-decoration: none;
  scroll-snap-align: start; box-shadow: var(--shadow-sm);
  transition: border-color var(--dur-2), background-color var(--dur-2), transform var(--dur-1) var(--ease-out);
}
.c-chip::after { content: ""; position: absolute; inset: -4px -2px; }
.c-chip .icon { width: 18px; height: 18px; color: var(--brand); }
.c-chip:hover { border-color: var(--brand); background: var(--brand-soft); }
.c-chip:active { transform: scale(.96); }
@media (min-width: 768px) {
  .c-chips__list { flex-wrap: wrap; margin: 0; padding: 4px 0; overflow: visible; -webkit-mask-image: none; mask-image: none; }
}

/* ───────────── 8. Content ───────────── */
.c-sec { margin: 0 0 var(--s-7); }
.c-sec > h2, .c-faq > h2, .c-related > h2, .c-404__h {
  margin: 0 0 var(--s-4); max-width: var(--measure);
  font-size: var(--fs-h2); font-weight: 750; line-height: 1.25; letter-spacing: -.012em;
}
.c-prose { max-width: var(--measure); font-size: 1.0625rem; }
[lang="ar"] .c-prose { font-size: 1.125rem; }
.c-prose > :first-child { margin-top: 0; }
.c-prose > :last-child { margin-bottom: 0; }
.c-prose p, .c-prose ul, .c-prose ol, .c-prose blockquote, .c-prose table, .c-prose .c-table { margin: 0 0 1em; }
.c-prose h3 { margin: 1.6em 0 .5em; font-size: var(--fs-20); font-weight: 700; line-height: 1.3; }
.c-prose ul, .c-prose ol { padding-inline-start: 1.4em; }
.c-prose li { margin-block: .35em; padding-inline-start: .2em; }
.c-prose li::marker { color: var(--brand); font-weight: 700; }
.c-prose ol { counter-reset: step; list-style: none; padding-inline-start: 0; }
.c-prose ol > li { position: relative; counter-increment: step; padding-inline-start: 2.6em; margin-block: .8em; }
.c-prose ol > li::before {
  content: counter(step); position: absolute; inset-inline-start: 0; top: .05em;
  display: grid; place-items: center; width: 1.75em; height: 1.75em; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-soft-ink); font-size: .875em; font-weight: 800; font-variant-numeric: tabular-nums;
}
.c-prose strong { font-weight: 700; }
.c-prose blockquote { padding: var(--s-3) var(--s-4); border-inline-start: 4px solid var(--brand); background: var(--surface); border-radius: 0; border-start-end-radius: var(--s-3); border-end-end-radius: var(--s-3); color: var(--text-muted); }
.c-prose code { padding: .1em .35em; border-radius: 6px; background: var(--surface-2); font-family: var(--mono); font-size: .9em; overflow-wrap: anywhere; }
.c-prose pre { margin: 0 0 1em; padding: var(--s-4); overflow-x: auto; border-radius: var(--s-3); background: var(--surface-2); font-size: .875rem; line-height: 1.55; direction: ltr; text-align: start; }
.c-prose pre code { padding: 0; background: none; font-size: inherit; overflow-wrap: normal; }
kbd {
  display: inline-block; min-width: 1.6em; padding: .05em .45em; border: 1px solid var(--border-strong); border-bottom-width: 2px;
  border-radius: 6px; background: var(--surface); font: 600 .85em/1.4 var(--mono); text-align: center; white-space: nowrap;
}
/* Tables scroll inside their own wrapper (.c-table, added by the sections view), never the page. */
.c-table { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; border: 1px solid var(--border); border-radius: var(--s-3); background: var(--surface); }
.c-table:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.c-prose .c-table > table { margin: 0; }
.c-prose table { width: 100%; border-collapse: collapse; font-size: .9375rem; line-height: 1.5; }
.c-prose th, .c-prose td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: start; vertical-align: top; }
.c-prose tbody tr:last-child > * { border-bottom: 0; }
.c-prose th { background: var(--surface-2); font-weight: 700; }
.c-prose td code, .c-prose th code { white-space: nowrap; overflow-wrap: normal; word-break: normal; }

.c-features {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: var(--s-3);
  margin: var(--s-5) 0 0; padding: 0; list-style: none;
}
.c-feature { padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); }
.c-feature__ic { display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: var(--s-3); border-radius: 10px; background: var(--brand-soft); color: var(--brand-soft-ink); }
.c-feature__ic .icon { width: 18px; height: 18px; }
.c-feature h3 { margin: 0 0 6px; font-size: 1.0625rem; font-weight: 700; }
.c-feature p { margin: 0; color: var(--text-muted); font-size: .9375rem; line-height: 1.55; }

.c-entries {
  margin: var(--s-5) 0 0; padding: 0; list-style: none; counter-reset: entry;
  columns: 200px 4; column-gap: var(--s-6);
}
.c-entries > li {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; padding: 9px 0;
  border-bottom: 1px solid var(--border); break-inside: avoid; counter-increment: entry;
}
.c-entries > li::before {
  content: counter(entry); min-width: 2.2ch; color: var(--text-muted);
  font-size: var(--fs-12); font-weight: 600; font-variant-numeric: tabular-nums; text-align: end;
}
.c-entries--long { columns: 1; max-width: var(--measure); }
.c-entries__t { flex: 1 1 13em; min-width: 0; overflow-wrap: anywhere; }
.c-entries__tags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.c-entries__p { font-size: var(--fs-14); font-weight: 700; color: var(--brand-soft-ink); font-variant-numeric: tabular-nums; }
.c-tag {
  display: inline-block; padding: 1px 8px; border-radius: var(--r-pill); background: var(--surface-2);
  color: var(--text-muted); font-size: var(--fs-12); font-weight: 600; line-height: 1.6; white-space: nowrap;
}

/* ───────────── 9. Cards (hub, related, blocks) ───────────── */
.c-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: var(--s-3);
  margin: 0; padding: 0; list-style: none;
}
.c-sec .c-cards { margin-top: var(--s-5); }
.c-card {
  position: relative; display: flex; align-items: center; gap: 14px; padding: 14px 16px 14px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  transition: border-color var(--dur-2), box-shadow var(--dur-2), transform var(--dur-2) var(--ease-out);
}
.c-card:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.c-card:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.c-card__thumb {
  position: relative; flex: none; width: 64px; height: 64px; border-radius: 50%;
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--border);
}
.c-card__thumb > svg, .c-card__thumb--css { transition: transform calc(var(--dur-3) * 2.5) var(--ease-out); }
.c-card__thumb > svg { display: block; width: 100%; height: 100%; }
.c-card__thumb .lh-sl path { stroke: var(--surface); stroke-width: 12; stroke-linejoin: round; }
.c-card__thumb::after {
  content: ""; position: absolute; inset: 37%; border-radius: 50%;
  background: var(--surface); box-shadow: 0 0 0 1.5px rgba(20, 21, 26, .12);
}
.c-card:hover .c-card__thumb > svg, .c-card:hover .c-card__thumb--css { transform: rotate(-40deg); }
.c-card__body { min-width: 0; }
.c-card__title { margin: 0; font-size: 1rem; font-weight: 700; line-height: 1.3; }
.c-card__link { color: var(--text); text-decoration: none; }
.c-card__link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.c-card__link:focus-visible { outline: none; }
.c-card__text { margin: 3px 0 0; color: var(--text-muted); font-size: var(--fs-14); line-height: 1.45; }
.c-card__meta {
  display: inline-block; margin: 8px 0 0; padding: 1px 9px; border-radius: var(--r-pill);
  background: var(--brand-soft); color: var(--brand-soft-ink); font-size: var(--fs-12); font-weight: 700; line-height: 1.7;
}
.c-related { margin: 0 0 var(--s-6); }

/* ───────────── 10. FAQ ───────────── */
.c-faq { max-width: 820px; margin: 0 0 var(--s-7); }
.c-faq__list { border-top: 1px solid var(--border); }
.c-faq__item { border-bottom: 1px solid var(--border); }
.c-faq__item > summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
  min-height: 56px; padding: 14px 4px; cursor: pointer; list-style: none;
  font-weight: 650; font-size: 1.0625rem; line-height: 1.4; transition: color var(--dur-2);
}
.c-faq__item > summary::-webkit-details-marker { display: none; }
.c-faq__item > summary:hover { color: var(--brand); }
.c-faq__chev { color: var(--text-muted); transition: transform var(--dur-2) var(--ease-out); }
.c-faq__item[open] .c-faq__chev { transform: rotate(180deg); }
.c-faq__a { padding: 0 4px var(--s-5); }
.c-faq__a p { margin: 0; max-width: var(--measure); color: var(--text-muted); font-size: 1rem; line-height: 1.65; }
.c-faq__item[open] > .c-faq__a { animation: lh-fade var(--dur-3) var(--ease-out); }
@keyframes lh-fade { from { opacity: 0; transform: translateY(-4px); } }
.c-updated { display: flex; align-items: center; gap: var(--s-2); margin: 0; color: var(--text-muted); font-size: var(--fs-14); }
.c-updated .icon { width: 18px; height: 18px; }

/* ───────────── 11. Forms, alerts, dialogs ───────────── */
.c-label { display: block; margin-bottom: 6px; font-weight: 650; font-size: .9375rem; }
.c-input {
  display: block; width: 100%; min-height: 48px; padding: 11px 14px;
  border: 1px solid var(--border-strong); border-radius: var(--r-field); background: var(--surface); color: var(--text);
  line-height: 1.45; transition: border-color var(--dur-2), box-shadow var(--dur-2);
}
.c-input::placeholder { color: var(--text-muted); opacity: .8; }
.c-input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--focus-ring); }
.c-input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.c-input[aria-invalid="true"] { border-color: var(--danger); }
textarea.c-input { min-height: 160px; resize: vertical; }
.c-select { position: relative; display: block; }
.c-select select { appearance: none; -webkit-appearance: none; padding-inline-end: 44px; cursor: pointer; }
.c-select > .icon { position: absolute; inset-inline-end: 14px; top: 50%; margin-top: -10px; color: var(--text-muted); pointer-events: none; }
.c-field { margin-bottom: 20px; min-width: 0; }
.c-field__help { display: flex; justify-content: space-between; gap: var(--s-2); margin: 6px 0 0; color: var(--text-muted); font-size: var(--fs-14); }
.c-field__count { font-variant-numeric: tabular-nums; }
.c-field__err { margin: 6px 0 0; color: var(--danger); font-size: var(--fs-14); font-weight: 650; }
.c-form { max-width: 680px; padding: var(--s-5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-sm); }
@media (min-width: 640px) { .c-form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--s-4); } }
.c-form__foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-4); margin-top: var(--s-2); }
.c-form__note { flex: 1 1 260px; margin: 0; color: var(--text-muted); font-size: var(--fs-14); }
.c-hp { position: absolute; inset-inline-start: -10000px; width: 1px; height: 1px; overflow: hidden; }
.c-contact { scroll-margin-top: 16px; }
.c-alert {
  display: flex; align-items: flex-start; gap: var(--s-3); max-width: 680px; margin: 0 0 20px; padding: var(--s-4) 18px;
  border: 1px solid; border-radius: var(--r-card); color: var(--text);
}
.c-alert p { margin: 0 0 6px; }
.c-alert p:last-child, .c-alert ul { margin-bottom: 0; }
.c-alert ul { padding-inline-start: 1.2em; }
.c-alert a { color: inherit; }
.c-alert .c-btn { color: var(--brand-ink); margin-top: 6px; }
.c-alert__t { font-weight: 700; }
.c-alert__ic { margin-top: 2px; }
.c-alert--ok { background: var(--success-soft); border-color: var(--success); }
.c-alert--ok .c-alert__ic { color: var(--success); }
.c-alert--err { background: var(--danger-soft); border-color: var(--danger); }
.c-alert--err .c-alert__ic { color: var(--danger); }
.c-alert--warn { background: var(--warning-soft); border-color: var(--warning); }
.c-alert--warn .c-alert__ic { color: var(--warning); }

:where(dialog) {
  max-width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0;
  border: 0; border-radius: var(--r-dialog); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
:where(dialog)::backdrop { background: rgba(14, 15, 19, .55); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) :where(dialog)::backdrop { background: rgba(0, 0, 0, .65); } }
:root[data-theme="dark"] :where(dialog)::backdrop { background: rgba(0, 0, 0, .65); }
@media (max-width: 767.98px) {
  :where(dialog.c-sheet) {
    width: 100%; max-width: 100%; max-height: 90dvh; margin: auto 0 0;
    border-radius: var(--r-sheet) var(--r-sheet) 0 0; padding-bottom: env(safe-area-inset-bottom); overscroll-behavior: contain;
  }
}

/* ───────────── 12. Hub ───────────── */
.c-hub { margin-bottom: var(--s-6); }
.c-filter { margin: 0 0 var(--s-6); }
.c-filter__list {
  display: flex; gap: var(--s-2); margin: 0 calc(-1 * var(--gutter)); padding: 6px var(--gutter);
  list-style: none; overflow-x: auto; scrollbar-width: none;
}
.c-filter__list::-webkit-scrollbar { display: none; }
.c-filter__btn {
  position: relative; display: inline-flex; align-items: center; gap: var(--s-2); height: 44px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--surface); color: var(--text);
  font-weight: 650; font-size: var(--fs-14); white-space: nowrap; text-decoration: none;
  transition: background-color var(--dur-2), border-color var(--dur-2), color var(--dur-2);
}
.c-filter__btn::after { content: ""; position: absolute; inset: -2px 0; }
.c-filter__btn .icon { width: 18px; height: 18px; color: var(--brand); }
.c-filter__btn:hover { border-color: var(--brand); }
.c-filter__btn[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.c-filter__btn[aria-pressed="true"] .icon { color: inherit; }
.c-filter__n {
  min-width: 22px; padding: 0 6px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--text-muted);
  font-size: var(--fs-12); line-height: 20px; text-align: center; font-variant-numeric: tabular-nums;
}
.c-filter__btn[aria-pressed="true"] .c-filter__n { background: rgba(127, 127, 127, .28); color: inherit; }
@media (min-width: 768px) { .c-filter__list { flex-wrap: wrap; margin: 0; padding: 0; overflow: visible; } }
.c-cat { margin-bottom: var(--s-7); scroll-margin-top: var(--s-4); }
.c-cat__h { display: flex; align-items: center; gap: var(--s-3); margin: 0 0 var(--s-4); font-size: var(--fs-h2); font-weight: 750; }
.c-cat__ic { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: var(--s-3); background: var(--brand-soft); color: var(--brand-soft-ink); }
.c-hub .c-card__thumb { width: 72px; height: 72px; }

/* ───────────── 13. Tool placeholder, 404, offline ───────────── */
.c-toolph { display: grid; justify-items: center; gap: var(--s-4); padding: var(--s-4) 0; }
.c-toolph__wheel { width: min(100%, 440px); aspect-ratio: 1; }
.c-toolph__wheel > svg { display: block; width: 100%; height: 100%; }
.c-toolph__wheel .lh-sl path { stroke: var(--surface); stroke-width: 4; }
.c-toolph__disc { display: block; width: 100%; height: 100%; border-radius: 50%; }
.c-toolph__msg { max-width: 52ch; margin: 0; color: var(--text-muted); text-align: center; }

.c-404__art { position: relative; width: 132px; height: 132px; margin: 0 auto var(--s-5); }
.c-404__wheel {
  position: absolute; inset: 0; border-radius: 50%; transform: rotate(-24deg);
  box-shadow: 0 0 0 6px var(--surface), 0 0 0 7px var(--border), var(--shadow-md);
}
.c-404__wheel > svg { display: block; width: 100%; height: 100%; }
.c-404__wheel .lh-sl path { stroke: var(--surface); stroke-width: 10; stroke-linejoin: round; }
.c-404__q {
  position: absolute; inset: 31%; display: grid; place-items: center; border-radius: 50%;
  background: var(--surface); color: var(--brand); font-size: 1.75rem; font-weight: 800; box-shadow: var(--shadow-md);
}
.c-404__q .icon { width: 24px; height: 24px; }
.c-search { max-width: 540px; margin: var(--s-6) auto 0; text-align: start; }
.c-search__box { position: relative; display: block; }
.c-search__box > .icon { position: absolute; inset-inline-start: 16px; top: 50%; margin-top: -10px; color: var(--text-muted); pointer-events: none; }
.c-search__box .c-input { min-height: 54px; padding-inline-start: 48px; border-radius: var(--r-pill); font-size: 1.0625rem; }
.c-results { margin: var(--s-2) 0 0; padding: 0; list-style: none; }
.c-results a {
  display: flex; align-items: center; gap: var(--s-3); padding: 10px var(--s-3); border-radius: var(--s-3);
  color: var(--text); text-decoration: none;
}
.c-results a:hover, .c-results a:focus-visible { background: var(--surface); box-shadow: var(--shadow-sm); }
.c-results b { display: block; font-weight: 650; }
.c-results small { display: block; color: var(--text-muted); font-size: var(--fs-14); line-height: 1.4; }
.c-results .c-tools__ic { width: 40px; height: 40px; }
.c-results__none { padding: var(--s-3); color: var(--text-muted); }
.c-404__h { margin: var(--s-7) auto var(--s-3); font-size: var(--fs-20); }
.c-chips__list--wrap { flex-wrap: wrap; justify-content: center; margin: 0; padding: 4px 0; overflow: visible; -webkit-mask-image: none; mask-image: none; }
.c-404__home, .c-offline__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-3); margin: var(--s-6) 0 0; }

/* ───────────── 14. Footer ───────────── */
.c-footer { margin-top: auto; background: var(--surface); border-top: 1px solid var(--border); font-size: .9375rem; }
.c-footer__in {
  display: grid; gap: var(--s-6); max-width: var(--wrap); margin-inline: auto;
  padding: var(--s-7) var(--gutter) var(--s-6);
}
@media (min-width: 1024px) { .c-footer__in { grid-template-columns: minmax(250px, 1fr) 3fr; gap: var(--s-7); } }
.c-footer .c-brand { margin: 0; }
.c-footer .c-mark__s path { stroke: var(--surface); }
.c-footer__slogan { margin: 4px 0 var(--s-5); color: var(--text-muted); font-weight: 600; }
.c-footer__nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-6) var(--s-5); }
@media (min-width: 768px) { .c-footer__nav { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.c-footer__h { margin: 0 0 var(--s-2); color: var(--text); font-size: var(--fs-12); font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.c-footer__col .c-footer__h ~ .c-footer__h { margin-top: var(--s-5); }
.c-footer ul { margin: 0; padding: 0; list-style: none; }
.c-footer__nav a {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding-block: 4px;
  color: var(--text-muted); text-decoration: none; line-height: 1.35;
}
.c-footer__nav a:hover { color: var(--brand); text-decoration: underline; }
@media (min-width: 1024px) and (pointer: fine) { .c-footer__nav a { min-height: 34px; } }
.c-footer__nav a[aria-current] { color: var(--text); font-weight: 650; }
.c-footer__more { font-weight: 650; color: var(--link) !important; }
.c-footer__more .icon { width: 16px; height: 16px; }
.c-commit li { display: flex; align-items: flex-start; gap: 10px; padding: 5px 0; color: var(--text-muted); line-height: 1.45; }
.c-commit .icon { width: 18px; height: 18px; margin-top: 1px; color: var(--success); }
.c-footer__bottom {
  padding: var(--s-4) var(--gutter) calc(var(--s-4) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border); color: var(--text-muted); font-size: .8125rem; text-align: center;
}
.c-footer__bottom p { margin: 0; }
:lang(ar) .c-footer__h, :lang(ar) .c-chips__label, :lang(ar) .c-menu__label { letter-spacing: 0; }

/* ───────────── 15. Language suggestion banner ─────────────
 * Fixed at the bottom (never shifts the layout). site.js only reveals it while it cannot overlap the tool. */
.c-langbar {
  position: fixed; z-index: 60; inset-inline: var(--s-3); bottom: calc(var(--s-3) + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "ic t x" "ic go x";
  align-items: center; column-gap: var(--s-3); padding: 10px 4px 8px var(--s-3);
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(16px);
  transition: opacity var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-out), visibility 0s linear var(--dur-3);
}
.c-langbar.is-in { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.c-langbar__ic { grid-area: ic; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-soft-ink); }
.c-langbar__t { grid-area: t; margin: 0; font-size: var(--fs-14); line-height: 1.4; color: var(--text-muted); }
.c-langbar__go {
  grid-area: go; justify-self: start; position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 32px;
  color: var(--link); font-weight: 700; font-size: .9375rem; text-decoration: none;
}
.c-langbar__go::after { content: ""; position: absolute; inset: -8px -6px; }
.c-langbar__go:hover { text-decoration: underline; }
.c-langbar__go .icon { width: 18px; height: 18px; transition: transform var(--dur-2) var(--ease-out); }
.c-langbar__go:hover .icon { transform: translateX(3px); }
.c-langbar__go:hover .icon:dir(rtl) { transform: scaleX(-1) translateX(3px); }
.c-langbar__x { grid-area: x; align-self: start; width: 44px; height: 44px; margin-top: -6px; color: var(--text-muted); }
.c-langbar__x .icon { width: 20px; height: 20px; }
@media (min-width: 768px) { .c-langbar { inset-inline: auto var(--s-5); bottom: var(--s-5); width: 420px; } }

/* ───────────── 16. Utilities, embed, print ───────────── */
.u-sr {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.u-nowrap { white-space: nowrap; }
.is-embed { background: var(--bg); }
@media print {
  .c-header, .c-footer, .c-chips, .c-skip, .c-langbar, .c-filter { display: none !important; }
  body { background: #fff; color: #000; }
  .c-faq__a { display: block !important; }
}

/* ───────────── Ad units (app/lib/thirdparty.php ad_slot) ─────────────
   Below the fold only; the space is reserved so that a filled ad never shifts the content (CLS);
   hidden in classroom mode (.no-ads) and collapsed when AdSense has nothing to show. */
.c-ad {
  display: block; margin-block: var(--s-6, 32px); padding: var(--s-2) var(--s-2) var(--s-3);
  min-height: 300px; border-radius: var(--r-card); background: var(--surface-2); text-align: center; overflow: hidden;
}
.c-ad__label { display: block; margin-bottom: var(--s-2); font-size: var(--fs-12, 12px); letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.c-ad ins.adsbygoogle { min-height: 250px; }
.c-ad:has(ins[data-ad-status="unfilled"]) { display: none; }
.no-ads .c-ad { display: none; }
@media print { .c-ad { display: none; } }
