/* zimankit website. Light by default: shadcn/ui neutral tokens, with the logo's gold and the flag as accents only.
   Components use only these tokens, so dark mode is a change of values. */
/* Fonts are hosted with the site, so the image export can rely on them. Licences: OFL, see site/fonts/. */
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("../fonts/Manrope-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("../fonts/Manrope-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Estedad"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("../fonts/Estedad-arabic.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC7, U+10EC9-10EEE, U+10EF0-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1; }
@font-face { font-family: "Vazirmatn"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("../fonts/Vazirmatn-arabic.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC7, U+10EC9-10EEE, U+10EF0-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1; }
@font-face { font-family: "Sahel"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/Sahel.woff2") format("woff2"); }
@font-face { font-family: "Sahel"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/Sahel-Bold.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --background: #FFFFFF;
  --foreground: #0A0A0A;
  --card: #FFFFFF;
  --surface: #FAFAFA;
  --muted: #F5F5F5;
  --muted-foreground: #5C5C5C;
  --border: #E5E5E5;
  --input: #D4D4D4;
  --primary: #171717;
  --primary-foreground: #FAFAFA;
  --accent: #F5F5F5;
  --ring: #737373;
  --destructive: #C8201F;
  --sun: #FEBD11;
  --ok: #1B7A3D;

  /* the relations in the sentence diagram */
  --rel-root: #171717; --rel-nsubj: #C4302B; --rel-obj: #A85400; --rel-obl: #1F6FB5; --rel-case: #7A45C4;
  --rel-mod: #1B7A3D; --rel-det: #0B7A80; --rel-conj: #B8327D; --rel-adv: #7D6000; --rel-fn: #5C5C5C;

  --radius: .625rem;
  --radius-sm: .375rem;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .05);
  --max: 1200px;
  --gutter: clamp(1rem, 4vw, 2rem);
  --section: clamp(3rem, 7vw, 5.5rem);
  --ease: 160ms cubic-bezier(.2, 0, 0, 1);
  /* Manrope has no Arabic letters, so they always fall through to the chosen right-to-left font. */
  --rtl-font: "Sahel";
  --font: "Manrope", var(--rtl-font), system-ui, -apple-system, "Segoe UI", sans-serif;
  --latin: var(--font);
  --arabic: var(--font);
  --mono: "IBM Plex Mono", var(--rtl-font), ui-monospace, "SFMono-Regular", monospace;
  --touch: 2.5rem;
}
@media (pointer: coarse) { :root { --touch: 2.75rem; } }
:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #0A0A0A;
  --foreground: #FAFAFA;
  --card: #141414;
  --surface: #101010;
  --muted: #1F1F1F;
  --muted-foreground: #A8A8A8;
  --border: #2B2B2B;
  --input: #3A3A3A;
  --primary: #FAFAFA;
  --primary-foreground: #171717;
  --accent: #262626;
  --ring: #8C8C8C;
  --destructive: #FF7B72;
  --ok: #63D18D;
  --rel-root: #FAFAFA; --rel-nsubj: #FF8077; --rel-obj: #FFAE5C; --rel-obl: #6FB8F5; --rel-case: #BC97F5;
  --rel-mod: #63D18D; --rel-det: #4FD0D6; --rel-conj: #F58AC4; --rel-adv: #E5C757; --rel-fn: #A8A8A8;
  --shadow-sm: none;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5rem; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-width: 0; background: var(--background); color: var(--foreground); font: 400 1rem/1.65 var(--latin); -webkit-font-smoothing: antialiased; overflow-wrap: break-word; }
img, svg { max-width: 100%; }
img { height: auto; }
[hidden] { display: none !important; }
[lang="ckb"], .ar { font-family: var(--arabic); }
bdi { unicode-bidi: isolate; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.02em; font-weight: 600; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(2.25rem, 6vw, 3.75rem); font-weight: 700; letter-spacing: -.03em; line-height: 1.08; }
h2 { font-size: clamp(1.5rem, 3.2vw, 2.25rem); }
h3 { font-size: 1.0625rem; }
p { margin: 0 0 1rem; }
a { color: inherit; text-decoration: underline; text-decoration-color: var(--input); text-decoration-thickness: 1px; text-underline-offset: 3px; transition: text-decoration-color var(--ease), color var(--ease); }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: var(--radius-sm); }
.icon { width: 1em; height: 1em; flex: none; vertical-align: -.125em; }
code, pre, kbd { font-family: var(--mono); font-size: .875em; }
:not(pre) > code { background: var(--muted); border-radius: var(--radius-sm); padding: .125em .375em; overflow-wrap: anywhere; }
pre { position: relative; background: var(--muted); color: var(--foreground); border: 1px solid var(--border); border-radius: var(--radius); padding: .875rem 1rem; margin: .75rem 0 1.25rem; overflow-x: auto; line-height: 1.6; font-size: .8125rem; tab-size: 4; }
pre code { background: none; padding: 0; font-size: inherit; }
pre .c { color: var(--muted-foreground); }
pre .p { color: var(--muted-foreground); user-select: none; }
.has-copy { padding-right: 3rem; }
.copy { position: absolute; top: .375rem; right: .375rem; display: inline-grid; place-items: center; width: var(--touch); height: var(--touch); padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted-foreground); cursor: pointer; transition: background var(--ease), color var(--ease); }
.copy:hover { background: var(--background); color: var(--foreground); }
.copy.done { color: var(--ok); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); margin: 1rem 0 1.5rem; background: var(--card); }
table { border-collapse: collapse; width: 100%; font-size: .9375rem; }
th, td { text-align: left; padding: .625rem .875rem; vertical-align: top; }
thead th, tr:first-child > th { background: var(--muted); color: var(--muted-foreground); font-weight: 500; font-size: .8125rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { border-top: 1px solid var(--border); }
tr:first-child > td { border-top: 0; }
td { transition: background var(--ease); }
tr:hover > td { background: var(--muted); }
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.muted { color: var(--muted-foreground); }
.small { font-size: .875rem; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--background) 90%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); }
.top .wrap { display: flex; align-items: center; gap: .5rem; min-height: 3.75rem; }
.brand { display: inline-flex; align-items: center; gap: .5rem; min-height: var(--touch); margin-right: auto; text-decoration: none; font-weight: 600; font-size: 1.0625rem; letter-spacing: -.01em; }
.brand img { width: 1.75rem; height: 1.75rem; }
.nav { display: flex; align-items: center; gap: .125rem; }
.nav a { display: inline-flex; align-items: center; min-height: var(--touch); padding: 0 .75rem; border-radius: var(--radius-sm); text-decoration: none; font-size: .9375rem; font-weight: 500; color: var(--muted-foreground); transition: background var(--ease), color var(--ease); }
.nav a:hover, .nav a[aria-current="page"] { color: var(--foreground); background: var(--accent); }
.icon-btn { display: inline-grid; place-items: center; width: var(--touch); height: var(--touch); padding: 0; flex: none; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted-foreground); font-size: 1.125rem; text-decoration: none; cursor: pointer; transition: background var(--ease), color var(--ease); }
.icon-btn:hover { background: var(--accent); color: var(--foreground); }
.menu { display: none; }
@media (max-width: 860px) {
  :root { --touch: 2.75rem; }
  .menu { display: inline-grid; }
  .nav { display: none; position: absolute; inset: 100% 0 auto; flex-direction: column; align-items: stretch; gap: .125rem; padding: .5rem var(--gutter) 1rem; background: var(--background); border-bottom: 1px solid var(--border); box-shadow: 0 8px 24px rgb(0 0 0 / .06); }
  .nav.open { display: flex; }
  .nav a { font-size: 1rem; }
}

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: var(--touch); padding: .5rem 1rem; border: 1px solid var(--input); border-radius: var(--radius); background: var(--card); color: var(--foreground); font: 500 .9375rem/1.2 var(--latin); text-decoration: none; cursor: pointer; box-shadow: var(--shadow-sm); transition: background var(--ease), opacity var(--ease), transform var(--ease); }
.btn:hover { background: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.btn.primary:hover { opacity: .88; background: var(--primary); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- layout ---------- */
section { padding: var(--section) 0; }
section.alt { background: var(--surface); border-block: 1px solid var(--border); }
.head { max-width: 42rem; margin-bottom: clamp(1.5rem, 4vw, 2.5rem); }
.intro { color: var(--muted-foreground); font-size: 1.0625rem; margin: .625rem 0 0; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr)); }
.grid.middle { align-items: center; gap: clamp(1.5rem, 5vw, 3.5rem); }
.grid > * { min-width: 0; }
.card { display: block; min-width: 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow-sm); text-decoration: none; }
.card p { margin: .375rem 0 0; color: var(--muted-foreground); font-size: .9375rem; }
.card pre { margin: .75rem 0 0; }
a.card { transition: background var(--ease), border-color var(--ease); }
a.card:hover { border-color: var(--input); background: var(--surface); }
a.card h3 { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
a.card h3 .icon { color: var(--muted-foreground); transition: transform var(--ease); }
a.card:hover h3 .icon { transform: translateX(2px); }
.tile-icon { display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; margin-bottom: .75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--background); font-size: 1.125rem; }
:not(pre) > code.eg { display: block; margin-top: .75rem; padding: .375rem .625rem; overflow-x: auto; overflow-wrap: normal; white-space: nowrap; font-size: .8125rem; }

/* ---------- hero ---------- */
.hero { padding: clamp(3rem, 8vw, 6rem) 0 clamp(2.5rem, 6vw, 4rem); text-align: center; }
.hero .mark { width: clamp(84px, 14vw, 112px); height: auto; margin-bottom: 1rem; }
.pill { display: inline-flex; align-items: center; gap: .5rem; margin: 0 0 1.25rem; padding: .25rem .75rem; border: 1px solid var(--border); border-radius: 999px; font-size: .8125rem; font-weight: 500; color: var(--muted-foreground); }
.pill i { width: .5rem; height: .5rem; border-radius: 50%; background: var(--sun); }
.hero .lead { max-width: 44rem; margin: 1.25rem auto 0; font-size: clamp(1.0625rem, 2vw, 1.25rem); line-height: 1.55; color: var(--muted-foreground); }
.cta { display: flex; flex-wrap: wrap; gap: .625rem; justify-content: center; margin: 2rem 0 0; }
.install-line { display: flex; justify-content: center; margin-top: 1.25rem; }
.install-line pre { max-width: 100%; margin: 0; text-align: left; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 1rem; max-width: 52rem; margin: clamp(2.5rem, 6vw, 3.5rem) auto 0; text-align: left; }
.facts div { padding-top: .75rem; border-top: 1px solid var(--border); }
.facts strong { display: block; font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; }
.facts span { font-size: .875rem; color: var(--muted-foreground); }
.shot { display: block; width: 100%; border: 1px solid var(--border); border-radius: var(--radius); }
.band { position: relative; height: 3px; background: linear-gradient(to right, #ED2024 0 33.3%, #E5E5E5 33.3% 66.6%, #278E43 66.6%); }
/* the flag's sun, in the middle of the band */
.band::after { content: ""; position: absolute; left: 50%; top: 50%; width: 1.5rem; height: 1.5rem; transform: translate(-50%, -50%); background: url("../brand/logo/svg/zimankit-sun.svg") center / contain no-repeat; }
.closing { text-align: center; }
.closing .head { margin-inline: auto; }

/* images that change with the theme */
.on-dark { display: none; }
:root[data-theme="dark"] .on-light { display: none; }
:root[data-theme="dark"] .on-dark { display: inline; }

/* ---------- steps ---------- */
.steps { counter-reset: s; list-style: none; padding: 0; margin: .75rem 0 1.25rem; }
.steps li { counter-increment: s; position: relative; padding-left: 2.5rem; margin-bottom: 1rem; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: .1rem; display: grid; place-items: center; width: 1.625rem; height: 1.625rem; border: 1px solid var(--border); border-radius: 50%; background: var(--muted); font-size: .8125rem; font-weight: 600; }

/* ---------- docs pages ---------- */
.doc { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: clamp(2rem, 5vw, 4rem); max-width: var(--max); margin: 0 auto; padding: clamp(1.5rem, 4vw, 3rem) var(--gutter) var(--section); }
.toc { position: sticky; top: 5rem; align-self: start; max-height: calc(100vh - 6rem); overflow-y: auto; font-size: .875rem; }
.toc summary { display: flex; align-items: center; min-height: var(--touch); font-weight: 600; cursor: pointer; list-style: none; }
.toc summary::-webkit-details-marker { display: none; }
.toc a { display: flex; align-items: center; min-height: 1.875rem; padding: .125rem .625rem; border-left: 1px solid var(--border); color: var(--muted-foreground); text-decoration: none; transition: color var(--ease), border-color var(--ease); }
.toc a:hover { color: var(--foreground); }
.toc a.active { color: var(--foreground); border-left-color: var(--foreground); font-weight: 500; }
.doc article { min-width: 0; max-width: 48rem; }
.doc article > h1 { font-size: clamp(2rem, 5vw, 2.75rem); margin-bottom: .5rem; }
.doc article h2 { margin: 3rem 0 .75rem; padding-top: 2rem; border-top: 1px solid var(--border); font-size: 1.5rem; }
.doc article h3 { margin: 1.75rem 0 .5rem; }
.doc article ul { padding-left: 1.25rem; }
.doc article li { margin-bottom: .375rem; }
@media (max-width: 900px) {
  .doc { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .toc { position: static; max-height: none; border: 1px solid var(--border); border-radius: var(--radius); padding: 0 1rem; background: var(--card); }
  .toc[open] { padding-bottom: .75rem; }
  .toc summary::after { content: "+"; margin-left: auto; font-size: 1.25rem; font-weight: 400; color: var(--muted-foreground); }
  .toc[open] summary::after { content: "–"; }
  .toc a { min-height: var(--touch); }
}
.note { margin: 1.25rem 0; padding: .875rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--muted); font-size: .9375rem; }

/* ---------- story ---------- */
.figure { margin: 1.5rem 0; }
.figure img { display: block; width: 100%; border: 1px solid var(--border); border-radius: var(--radius); }
.figure figcaption { margin-top: .5rem; color: var(--muted-foreground); font-size: .875rem; }
.gallery { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(46%, 13rem), 1fr)); margin: 1.25rem 0; }
.gallery figure { margin: 0; overflow: hidden; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.gallery img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: #FAFAFA; }
.gallery img.contain { object-fit: contain; padding: .75rem; }
.gallery figcaption { padding: .5rem .75rem; font-size: .8125rem; color: var(--muted-foreground); }

/* ---------- brand ---------- */
.swatch { display: flex; align-items: center; gap: .75rem; font-size: .9375rem; line-height: 1.4; }
.swatch i { flex: none; width: 2.75rem; height: 2.75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.tile { display: grid; place-items: center; aspect-ratio: 4 / 3; margin-bottom: .875rem; padding: 1rem; background: #FAFAFA; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.tile.dark { background: #0A0A0A; }
.tile.check { background: repeating-conic-gradient(#EFEFEF 0 25%, #FFF 0 50%) 0 0 / 18px 18px; }
.tile img { width: auto; height: 100%; min-height: 0; }
.dl { display: flex; flex-wrap: wrap; gap: .375rem; margin-top: .75rem; }
.dl a { display: inline-flex; align-items: center; min-height: var(--touch); padding: 0 .75rem; border: 1px solid var(--input); border-radius: var(--radius-sm); font-size: .8125rem; font-weight: 500; text-decoration: none; transition: background var(--ease); }
.dl a:hover { background: var(--accent); }
.row-media { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-start; margin-bottom: .75rem; }
.row-media img { flex: 1 1 8rem; width: 8rem; min-width: 0; }
.narrow { display: block; width: 100%; max-width: 15rem; margin-inline: auto; }
.mt { margin-top: clamp(2.5rem, 5vw, 3.5rem); margin-bottom: .75rem; }
.card > h3:not(:first-child) { margin-top: .875rem; }

.page-section { padding-top: 0; }
.sub { margin-bottom: .75rem; }
.cta.start { justify-content: flex-start; }
.note-after { margin-top: 1rem; }
.grid + p { margin-top: 1rem; }

/* ---------- playground ---------- */
.page-head { padding: clamp(1.75rem, 5vw, 3rem) 0 1.25rem; }
.page-head h1 { font-size: clamp(2rem, 5vw, 2.75rem); }
.page-head .intro { max-width: 44rem; }
.tools { display: flex; gap: .25rem; margin: 0 calc(var(--gutter) * -1) .75rem; padding: 0 var(--gutter); overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--border); }
.tools::-webkit-scrollbar { display: none; }
.tools button { flex: none; min-height: var(--touch); padding: 0 .75rem; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted-foreground); font: 500 .9375rem var(--latin); cursor: pointer; transition: color var(--ease), border-color var(--ease); }
.tools button:hover { color: var(--foreground); }
.tools button[aria-pressed="true"] { color: var(--foreground); border-bottom-color: var(--foreground); }
.status { display: flex; align-items: center; gap: .5rem; min-height: 1.5rem; margin: 0 0 1rem; font-size: .875rem; color: var(--muted-foreground); }
.dot { flex: none; width: .5rem; height: .5rem; border-radius: 50%; background: var(--sun); animation: pulse 1.2s ease-in-out infinite; }
.dot.ok { background: var(--ok); animation: none; }
.dot.err { background: var(--destructive); animation: none; }
@keyframes pulse { 50% { opacity: .35; } }
.field-label { display: block; margin-bottom: .375rem; font-size: .875rem; font-weight: 500; }
textarea, input[type="text"], select { width: 100%; min-height: var(--touch); background: var(--background); color: var(--foreground); border: 1px solid var(--input); border-radius: var(--radius); font: 1rem/1.5 var(--arabic); transition: border-color var(--ease), box-shadow var(--ease); }
textarea, input[type="text"] { padding: .5rem .75rem; }
textarea { resize: vertical; }
select { width: auto; max-width: 100%; padding: 0 .5rem; font-size: .9375rem; cursor: pointer; }
textarea:focus-visible, input[type="text"]:focus-visible, select:focus-visible { outline: 0; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 30%, transparent); }
.sent-input { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
.sent-input > div:first-child { flex: 1 1 18rem; min-width: 0; }
.ex-group { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem; margin-top: .625rem; }
.ex-group > span:not(.ex-list) { width: 4.75rem; flex: none; font-size: .8125rem; color: var(--muted-foreground); }
.examples { display: flex; flex-wrap: wrap; gap: .375rem; margin: .5rem 0 0; }
.ex-group button, .examples button { min-height: 2rem; padding: .125rem .625rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); color: var(--foreground); font: .875rem var(--arabic); cursor: pointer; transition: background var(--ease), border-color var(--ease); }
.ex-group button:hover, .examples button:hover { background: var(--accent); border-color: var(--input); }
@media (pointer: coarse), (max-width: 860px) {
  .ex-group button, .examples button { min-height: var(--touch); padding-inline: .75rem; }
  /* one sideways-scrolling row each, so the diagram stays near the top */
  .ex-group { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); }
  .ex-group::-webkit-scrollbar { display: none; }
  .ex-group button { flex: none; }
  .ex-group > span:not(.ex-list) { width: auto; margin-right: .25rem; }
  .ex-list { flex: none; flex-wrap: nowrap; }
}
#s-trans { min-height: 1.5em; margin: .75rem 0 0; font-size: .9375rem; color: var(--muted-foreground); }
.play { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); margin-bottom: var(--section); }
.play > * { min-width: 0; }
@media (max-width: 860px) { .play { grid-template-columns: minmax(0, 1fr); } }
.opts { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin: .75rem 0; font-size: .9375rem; }
.opts label { display: inline-flex; align-items: center; gap: .5rem; min-height: var(--touch); cursor: pointer; }
.opts input[type="checkbox"] { width: 1.125rem; height: 1.125rem; accent-color: var(--primary); }
.out { min-height: 14rem; margin: 0; white-space: pre-wrap; word-break: break-word; }
.result { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.result td { font-family: var(--arabic); }
.result td.f { font-family: var(--mono); font-size: .75rem; color: var(--muted-foreground); min-width: 9rem; }
.result tr.alt td { color: var(--muted-foreground); }
.cmdline { margin: .75rem 0 0; color: var(--muted-foreground); font: .8125rem var(--mono); overflow-wrap: anywhere; }

/* sentence diagram */
.g-root { --c: var(--rel-root); } .g-nsubj { --c: var(--rel-nsubj); } .g-obj { --c: var(--rel-obj); } .g-obl { --c: var(--rel-obl); }
.g-case { --c: var(--rel-case); } .g-mod { --c: var(--rel-mod); } .g-det { --c: var(--rel-det); } .g-conj { --c: var(--rel-conj); }
.g-adv { --c: var(--rel-adv); } .g-fn { --c: var(--rel-fn); }
.panel-title { margin: 1.25rem 0 .5rem; font-size: .9375rem; font-weight: 600; letter-spacing: -.01em; }
.diagram { min-height: 16rem; overflow-x: auto; overscroll-behavior-x: contain; padding: .5rem; text-align: center; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.diagram svg { display: inline-block; max-width: none; }
.diagram-state { display: grid; place-items: center; align-content: center; gap: .5rem; min-height: 15rem; padding: 1rem; color: var(--muted-foreground); font-size: .9375rem; }
.diagram-state .icon { font-size: 1.5rem; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hint { margin: .375rem 0 0; font-size: .8125rem; color: var(--muted-foreground); }
.diagram .arc { fill: none; stroke: var(--c); stroke-width: 2; transition: opacity var(--ease), stroke-width var(--ease); }
.diagram .hit { fill: none; stroke: transparent; stroke-width: 16; cursor: pointer; }
.diagram .tip { fill: var(--c); }
.diagram .lab rect { fill: var(--card); }
.diagram .lab text { fill: var(--c); font: 700 13px var(--font); text-anchor: middle; }
.diagram .lab { cursor: pointer; }
.diagram .edge:hover .arc { stroke-width: 3; }
.diagram .w { cursor: pointer; outline: none; }
.diagram .w rect { fill: transparent; stroke: transparent; transition: fill var(--ease); }
.diagram .w:hover rect { fill: color-mix(in srgb, var(--c) 8%, transparent); }
.diagram .w.sel rect, .diagram .w:focus-visible rect { fill: color-mix(in srgb, var(--c) 12%, transparent); stroke: var(--c); }
.diagram .w .t { fill: var(--c); font: 700 20px var(--font); text-anchor: middle; }
.diagram .w .p { fill: var(--muted-foreground); font: 500 12px var(--font); text-anchor: middle; }
.diagram .w .s { fill: var(--muted-foreground); font: 12px var(--arabic); text-anchor: middle; }
.diagram .dim { opacity: .38; }
.legend { display: flex; flex-wrap: wrap; gap: .375rem; margin: .75rem 0 0; }
.legend button { display: inline-flex; align-items: center; gap: .375rem; min-height: 2rem; padding: 0 .625rem; border: 1px solid var(--border); border-radius: 999px; background: var(--card); color: var(--foreground); font: 500 .8125rem var(--latin); cursor: pointer; transition: background var(--ease); }
.legend button:hover { background: var(--accent); }
.legend button i { width: .625rem; height: .625rem; border-radius: 50%; background: var(--c); }
.legend button[aria-pressed="true"] { border-color: var(--c); box-shadow: inset 0 0 0 1px var(--c); }
@media (pointer: coarse), (max-width: 860px) { .legend button { min-height: var(--touch); padding-inline: .875rem; } }
.s-grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; margin: 1.25rem 0; }
.s-grid > * { min-width: 0; }
.s-grid .panel-title { margin-top: 0; }
@media (max-width: 900px) { .s-grid { grid-template-columns: minmax(0, 1fr); } .s-panel { order: -1; } }
.s-panel { padding: 1.125rem 1.25rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); scroll-margin-top: 5rem; }
.s-panel h3 { margin: 0; color: var(--c, var(--foreground)); font: 600 1.5rem/1.3 var(--arabic); letter-spacing: 0; text-align: left; }
.s-panel .role { margin: .375rem 0; font-weight: 500; text-align: left; }
.s-panel .role .ku { font-family: var(--arabic); font-weight: 400; color: var(--muted-foreground); }
.s-panel p { margin: .375rem 0; text-align: left; font-size: .9375rem; }
.s-panel dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .5rem 1rem; margin: 1rem 0 0; padding-top: 1rem; border-top: 1px solid var(--border); font-size: .9375rem; }
.s-panel dt { color: var(--muted-foreground); font-size: .875rem; }
.s-panel dd { margin: 0; min-width: 0; }
@media (max-width: 560px) { .s-panel dl { grid-template-columns: minmax(0, 1fr); gap: .125rem; } .s-panel dt { margin-top: .625rem; } }
.chip { display: inline-flex; align-items: baseline; gap: .375rem; margin: 0 .25rem .25rem 0; padding: .125rem .5rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: transparent; color: var(--foreground); font: .875rem var(--arabic); }
button.chip { min-height: 2rem; align-items: center; border-color: var(--input); cursor: pointer; transition: background var(--ease); }
button.chip:hover { background: var(--accent); }
@media (pointer: coarse), (max-width: 860px) { button.chip { min-height: var(--touch); } }
.chip small { color: var(--c, var(--muted-foreground)); font: 500 .75rem var(--latin); }
.s-words .table-wrap { margin: 0; }
.s-words tbody tr, .s-words tr[data-id] { cursor: pointer; }
.s-words tr.sel > td { background: var(--muted); }
.s-words td { padding-block: .5rem; }
.s-words .w-text { font: 600 1rem var(--arabic); color: var(--c); }
.s-words .w-rel { display: inline-flex; align-items: center; gap: .375rem; white-space: nowrap; font-size: .875rem; }
.s-words .w-rel i { width: .5rem; height: .5rem; border-radius: 50%; background: var(--c); }
.s-words .w-head { font-family: var(--arabic); font-size: .875rem; color: var(--muted-foreground); }
.s-words button { all: unset; display: block; width: 100%; min-height: 1.5rem; cursor: pointer; }
.s-words button:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: var(--radius-sm); }
@media (pointer: coarse), (max-width: 860px) { .s-words td { padding-block: .75rem; } }
.s-foot { margin: 0 0 var(--section); font-size: .875rem; color: var(--muted-foreground); max-width: 48rem; }

/* tool pages */
.tool-head { margin-bottom: 1rem; }
.tool-head h2 { font-size: 1.5rem; }
.tool-head .intro { font-size: 1rem; }
.tool-input { padding: 1rem 1.125rem; margin-bottom: 1rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.tool-fields { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-start; }
.tool-text { flex: 1 1 20rem; min-width: 0; }
.tool-input .opts { margin: .5rem 0 0; }
.tool-input .opts:empty { display: none; }
.tool-input #t-ex { margin-top: .5rem; }
.ex-list { display: flex; flex: 1 1 0; min-width: 0; flex-wrap: wrap; gap: .375rem; }
.field-inline { flex-wrap: wrap; }
.field-inline input { width: auto; flex: 1 1 10rem; }
.res { margin-bottom: 1.25rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.res-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; padding: .625rem .875rem; border-bottom: 1px solid var(--border); }
.res-count { margin: 0 auto 0 0; font-size: .875rem; font-weight: 500; color: var(--muted-foreground); }
.res-actions { display: flex; flex-wrap: wrap; gap: .25rem; }
.res-body { padding: .875rem; min-width: 0; }
.res-body > .table-wrap:first-child { margin-top: 0; }
.res-body > .table-wrap:last-child { margin-bottom: 0; }
.seg { display: inline-flex; padding: .1875rem; background: var(--muted); border-radius: var(--radius-sm); }
.seg button { min-height: calc(var(--touch) - .375rem); padding: 0 .75rem; border: 0; border-radius: .25rem; background: transparent; color: var(--muted-foreground); font: 500 .875rem var(--font); cursor: pointer; transition: color var(--ease), background var(--ease); }
.seg button:hover { color: var(--foreground); }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--foreground); box-shadow: var(--shadow-sm); }
.btn.small { min-height: var(--touch); padding: .25rem .75rem; font-size: .875rem; }
.word { font-weight: 700; }
.mono { font-family: var(--mono); font-size: .9375rem; }
.mono.big { font-size: 1.0625rem; }
.code { font-family: var(--mono); font-size: .75rem; }
.badge { display: inline-flex; align-items: center; padding: .0625rem .5rem; border: 1px solid var(--border); border-radius: 999px; background: var(--muted); font-size: .75rem; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.badge.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); border-color: color-mix(in srgb, var(--ok) 35%, transparent); color: var(--ok); }
.badge.err { background: color-mix(in srgb, var(--destructive) 10%, transparent); border-color: color-mix(in srgb, var(--destructive) 35%, transparent); color: var(--destructive); }
.badge.warn { background: color-mix(in srgb, var(--rel-adv) 12%, transparent); border-color: color-mix(in srgb, var(--rel-adv) 35%, transparent); color: var(--rel-adv); }
.syll { display: inline-block; margin: 0 .125rem .125rem 0; padding: .0625rem .375rem; background: var(--muted); border-radius: .25rem; font-size: .8125rem; }
.chips { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; margin-bottom: .75rem; }
.chips .chip { margin: 0; }
tr.alt td { color: var(--muted-foreground); }
tr.row-err td:first-child { box-shadow: inset 3px 0 0 var(--destructive); }
.notes { margin: .375rem 0 0; padding-left: 1.125rem; font-size: .875rem; color: var(--muted-foreground); }
.meter { display: inline-block; width: 5rem; height: .5rem; margin-right: .5rem; overflow: hidden; vertical-align: middle; background: var(--muted); border-radius: 999px; }
.meter span { display: block; height: 100%; background: var(--ok); border-radius: 999px; }
.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: .75rem; margin-bottom: .875rem; padding: .875rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.compare-label { margin: 0 0 .125rem; font-size: .75rem; font-weight: 500; color: var(--muted-foreground); }
.compare-text { margin: 0; font-size: 1.125rem; line-height: 1.6; }
.compare-text.strong { font-weight: 700; }
.compare-note { grid-column: 1 / -1; min-width: 0; }
.compare-note .table-wrap { margin: 0; background: var(--card); }
.verb-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.verb-title { font-size: 1.5rem; font-weight: 700; margin-right: .25rem; }
.verb-grid { display: grid; gap: .875rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); margin-bottom: 1rem; }
.verb-card { min-width: 0; }
.verb-card h3 { margin-bottom: .375rem; font-size: .9375rem; }
.verb-card .table-wrap { margin: 0; }
.person { font-size: .875rem; }
.result-card { margin-bottom: .875rem; padding: .875rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.result-card:last-child { margin-bottom: 0; }
.result-card h3 { margin-bottom: .5rem; font-size: 1.125rem; font-weight: 700; letter-spacing: 0; }
.facts-list { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .25rem 1rem; margin: 0; font-size: .9375rem; }
.facts-list dt { color: var(--muted-foreground); font-size: .875rem; }
.facts-list dd { margin: 0; }
.token-row { padding: .625rem; margin-bottom: .75rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.k-word { --c: var(--rel-obl); border-color: color-mix(in srgb, var(--rel-obl) 40%, transparent); }
.k-number { --c: var(--rel-obj); border-color: color-mix(in srgb, var(--rel-obj) 40%, transparent); }
.k-punct { --c: var(--rel-fn); }
pre.json { margin: 0; max-height: 34rem; overflow: auto; background: var(--surface); font-size: .8125rem; }
pre.json span { unicode-bidi: isolate; }
.j-key { color: var(--rel-obl); }
.j-str { color: var(--rel-mod); }
.j-num { color: var(--rel-obj); }
.j-bool { color: var(--rel-case); }
.j-null { color: var(--rel-fn); }
.learn { margin-top: 1rem; padding-top: .875rem; border-top: 1px solid var(--border); text-align: left; }
#t-learn .learn { margin: 0 0 var(--section); padding: 1rem 1.125rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.learn:empty { display: none; }
.learn-title { margin: 0 0 .5rem; font-size: .875rem; font-weight: 600; }
.learn ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .125rem; }
.learn a { display: flex; align-items: center; gap: .5rem; min-height: var(--touch); padding: .25rem .5rem; margin-inline: -.5rem; border-radius: var(--radius-sm); font-size: .9375rem; text-decoration: none; transition: background var(--ease); }
.learn a:hover { background: var(--accent); }
.tag { flex: none; padding: 0 .375rem; border: 1px solid var(--border); border-radius: .25rem; font-size: .6875rem; font-weight: 600; color: var(--muted-foreground); }
.back { margin-top: .875rem; }
/* result tables become labelled rows on a phone */
@media (max-width: 640px) {
  .rt thead { display: none; }
  .rt, .rt tbody, .rt tr, .rt td { display: block; width: 100%; }
  .rt tr { padding: .5rem 0; border-top: 1px solid var(--border); }
  .rt tr:first-child { border-top: 0; }
  .rt td { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: .5rem; padding: .25rem .875rem; border: 0; direction: ltr; }
  .rt td::before { content: attr(data-label); color: var(--muted-foreground); font-size: .8125rem; }
  .rt .cell { min-width: 0; }
  tr:hover > td { background: transparent; }
}

/* diagram tools: colours and export */
.diagram-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin: 1.25rem 0 .5rem; }
.diagram-bar .panel-title { margin: 0; }
.diagram-bar .actions { display: flex; flex-wrap: wrap; gap: .375rem; }
.colours { margin-bottom: .75rem; padding: 1rem 1.125rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.presets { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem; margin-bottom: .875rem; }
.presets > span { margin-right: .25rem; font-size: .875rem; color: var(--muted-foreground); }
.presets button { min-height: var(--touch); padding: 0 .75rem; border: 1px solid var(--input); border-radius: var(--radius-sm); background: var(--card); color: var(--foreground); font: 500 .875rem var(--font); cursor: pointer; transition: background var(--ease); }
.presets button:hover { background: var(--accent); }
.presets button[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.swatches { display: grid; gap: .5rem .875rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 12.5rem), 1fr)); }
.swatches label { display: flex; align-items: center; gap: .625rem; min-height: var(--touch); font-size: .9375rem; cursor: pointer; }
.swatches input[type="color"] { flex: none; width: 2.25rem; height: 2.25rem; padding: .125rem; border: 1px solid var(--input); border-radius: var(--radius-sm); background: var(--background); cursor: pointer; }
.swatches small { display: block; color: var(--destructive); font-size: .75rem; line-height: 1.2; }
dialog.export { width: min(68rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); padding: 0; color: var(--foreground); background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 24px 64px rgb(0 0 0 / .25); }
dialog.export::backdrop { background: rgb(0 0 0 / .5); }
.export-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .625rem .75rem .625rem 1.25rem; border-bottom: 1px solid var(--border); }
.export-head h2 { font-size: 1.0625rem; letter-spacing: -.01em; }
.export-body { display: grid; grid-template-columns: minmax(0, 1fr) 17rem; gap: 1.25rem; padding: 1.25rem; }
.preview { display: grid; place-items: center; min-height: 16rem; padding: .75rem; background: var(--muted); border-radius: var(--radius-sm); }
.preview canvas { display: block; max-width: 100%; max-height: min(62dvh, 40rem); width: auto; height: auto; box-shadow: 0 2px 12px rgb(0 0 0 / .18); }
.export-opts { display: grid; align-content: start; gap: .875rem; }
.export-opts select { width: 100%; }
.export-opts .btn { width: 100%; }
.export-opts p { margin: 0; font-size: .8125rem; color: var(--muted-foreground); }
.export-check { display: flex; align-items: center; gap: .5rem; min-height: var(--touch); font-size: .9375rem; cursor: pointer; }
.export-check input { width: 1.125rem; height: 1.125rem; accent-color: var(--primary); }
@media (max-width: 760px) {
  dialog.export { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; }
  .export-body { grid-template-columns: minmax(0, 1fr); padding: 1rem; }
  .preview canvas { max-height: 46dvh; }
}

/* ---------- footer ---------- */
footer { padding: 1.5rem 0 2rem; color: var(--muted-foreground); font-size: .875rem; }
footer .wrap { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; align-items: center; }
.font-pick { display: inline-flex; align-items: center; gap: .5rem; }
.font-pick select { font-size: .875rem; }
footer nav { display: flex; flex-wrap: wrap; gap: 0 1rem; margin-left: auto; }
footer nav a { display: inline-flex; align-items: center; min-height: var(--touch); text-decoration: none; transition: color var(--ease); }
footer nav a:hover { color: var(--foreground); }
@media (max-width: 860px) { footer nav { margin-left: 0; } }

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