@font-face { font-family: "Vazirmatn"; src: url("fonts/Vazirmatn.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #fbfaf7; --surface: #ffffff; --text: #1f1d1a; --muted: #6b665e; --line: #e7e3dc;
  --accent: #b5452f; --accent-text: #ffffff; --focus: #1f6feb;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #191816; --surface: #22201d; --text: #ece8e1; --muted: #a39d93; --line: #35322d;
    --accent: #e0775f; --accent-text: #191816; --focus: #79a8ff;
  }
}
:root[data-theme="dark"] {
  --bg: #191816; --surface: #22201d; --text: #ece8e1; --muted: #a39d93; --line: #35322d;
  --accent: #e0775f; --accent-text: #191816; --focus: #79a8ff;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.8 "Vazirmatn", system-ui, sans-serif; }
main { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; }
a { color: var(--accent); }
.back { font-weight: 700; text-decoration: none; }
h1 { font-size: clamp(26px, 5vw, 36px); line-height: 1.3; margin: 12px 0 8px; }
h2 { font-size: 19px; margin: 28px 0 8px; }
.lead { color: var(--muted); margin: 0 0 24px; }
code, pre { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 13px; }
code { background: var(--surface); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
pre { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
pre code { border: 0; padding: 0; background: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.opts { display: grid; gap: 4px 24px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
[hidden] { display: none !important; }
fieldset { border: 0; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; align-items: center; align-content: flex-start; gap: 6px; }
legend { font-weight: 700; font-size: 14px; margin-bottom: 6px; padding: 0; width: 100%; }
fieldset > label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 12px; cursor: pointer; min-height: 40px; }
fieldset > label:has(:checked) { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
fieldset input[type=radio] { accent-color: var(--accent); }
fieldset input:not([type]) { font: inherit; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; width: 120px; }
.swatches { display: flex; gap: 8px; }
.swatches label { cursor: pointer; }
.swatches input { position: absolute; opacity: 0; }
.swatches span { display: block; width: 32px; height: 32px; border-radius: 50%; background: var(--c); border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--line); }
.swatches input:checked + span { box-shadow: 0 0 0 2px var(--text); }
.swatches input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

.preview { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin: 12px 0; background: var(--surface); }
.preview iframe { display: block; width: 100%; border: 0; }
.copy { display: flex; gap: 8px; }
.copy input { flex: 1; min-width: 0; font: 13px ui-monospace, monospace; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); }
button { font: inherit; font-weight: 700; border: 0; border-radius: 10px; padding: 10px 18px; background: var(--accent); color: var(--accent-text); cursor: pointer; min-height: 44px; }
ol { padding-inline-start: 22px; }
.doc ul { padding-inline-start: 22px; }
