:root {
  color-scheme: light;
  --ink: #1a1a1a;
  --ink-soft: #575758;
  --muted: #909091;
  --ink-text: #f5f5f7;
  --line: #dcdce0;
  --line-soft: #e9e9ec;
  --bg: #f5f5f7;
  --bg-code: #e8e8ec;
  --bg-chip: #e8e8ec;
  --accent: #1a1a1a;
  --topbar-bg: rgba(245, 245, 247, .82);
  --focus-ring: rgba(26, 26, 26, .08);
  --scrim: rgba(0, 0, 0, .35);
  --shadow: rgba(0, 0, 0, .12);
  --topbar-h: 64px;
  --sidenav-w: 264px;
  --content-max: 860px;
}

:root[data-theme=dark] {
  color-scheme: dark;
  --ink: #f2f2f2;
  --ink-soft: #b6b6b8;
  --muted: #7d7e82;
  --ink-text: #1a1b23;
  --line: #2b2c32;
  --line-soft: #23242b;
  --bg: #1a1b23;
  --bg-code: #13141a;
  --bg-chip: #13141a;
  --accent: #f2f2f2;
  --topbar-bg: rgba(26, 27, 35, .82);
  --focus-ring: rgba(242, 242, 242, .1);
  --scrim: rgba(0, 0, 0, .6);
  --shadow: rgba(0, 0, 0, .55);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --ink: #f2f2f2;
    --ink-soft: #b6b6b8;
    --muted: #7d7e82;
    --ink-text: #1a1b23;
    --line: #2b2c32;
    --line-soft: #23242b;
    --bg: #1a1b23;
    --bg-code: #13141a;
    --bg-chip: #13141a;
    --accent: #f2f2f2;
    --topbar-bg: rgba(26, 27, 35, .82);
    --focus-ring: rgba(242, 242, 242, .1);
    --scrim: rgba(0, 0, 0, .6);
    --shadow: rgba(0, 0, 0, .55);
  }
}
*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 16px);
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--ink);
  text-decoration: none;
  text-underline-offset: 3px;
}
a:hover {
  text-decoration: underline;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: var(--topbar-h);
  padding: 0 1.5rem;
  background: var(--topbar-bg);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.brand:hover {
  text-decoration: none;
}
.brand i {
  font-size: 1.3rem;
}
.brand span {
  font-weight: 400;
  color: var(--muted);
}
.brand b {
  font-weight: 600;
  color: var(--ink);
}

.topbar-nav {
  display: flex;
  gap: 1.4rem;
  margin-left: 0.5rem;
}
.topbar-nav a {
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.topbar-nav a:hover {
  color: var(--ink);
  text-decoration: none;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-left: auto;
}

.version-pill {
  font: 600 0.72rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  background: var(--bg-chip);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.6rem;
}

.topbar-gh {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.topbar-gh:hover {
  color: var(--ink);
  text-decoration: none;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  font-size: 1.1rem;
}

.theme-toggle {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 0;
  position: relative;
  flex-shrink: 0;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: var(--bg-chip);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.theme-toggle:hover {
  border-color: var(--muted);
}
.theme-toggle:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}

.theme-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: 0 1px 2px var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: transform 0.18s ease, color 0.15s ease;
}

.theme-toggle:hover .theme-toggle-knob {
  color: var(--ink);
}

.theme-toggle-icon {
  position: absolute;
  width: 11px;
  height: 11px;
  display: block;
  transition: opacity 0.18s ease;
}

.theme-toggle-icon--sun {
  opacity: 1;
}

.theme-toggle-icon--moon {
  opacity: 0;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle-knob {
    transform: translateX(18px);
  }
  :root:not([data-theme]) .theme-toggle-icon--sun {
    opacity: 0;
  }
  :root:not([data-theme]) .theme-toggle-icon--moon {
    opacity: 1;
  }
}
:root[data-theme=dark] .theme-toggle-knob {
  transform: translateX(18px);
}

:root[data-theme=dark] .theme-toggle-icon--sun {
  opacity: 0;
}

:root[data-theme=dark] .theme-toggle-icon--moon {
  opacity: 1;
}

:root[data-theme=light] .theme-toggle-knob {
  transform: none;
}

:root[data-theme=light] .theme-toggle-icon--sun {
  opacity: 1;
}

:root[data-theme=light] .theme-toggle-icon--moon {
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle-knob, .theme-toggle-icon {
    transition: none;
  }
}
.shell {
  display: grid;
  grid-template-columns: var(--sidenav-w) minmax(0, 1fr);
  align-items: start;
  max-width: 1320px;
  margin: 0 auto;
}

.sidenav {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 1.5rem 1rem 2rem;
  border-right: 1px solid var(--line);
}

.sidenav-label {
  margin: 0.25rem 0.6rem 1rem;
  font: 600 0.68rem/1 Inter, system-ui, sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.sidenav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidenav a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  font-size: 0.92rem;
  color: var(--ink-soft);
  transition: background 0.12s ease, color 0.12s ease;
}
.sidenav a:hover {
  background: var(--line-soft);
  color: var(--ink);
  text-decoration: none;
}
.sidenav a i {
  font-size: 1.05rem;
  width: 1.2em;
  text-align: center;
  color: var(--muted);
}
.sidenav a.active {
  background: var(--ink);
  color: var(--ink-text);
}
.sidenav a.active i {
  color: var(--ink-text);
}

.docs-main {
  min-width: 0;
  padding: 2.5rem clamp(1.25rem, 4vw, 3.5rem) 4rem;
  max-width: calc(var(--content-max) + 7rem);
}

.docs-main h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.4rem;
}

.docs-main h2 {
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 3.5rem 0 1.25rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: calc(var(--topbar-h) + 12px);
}

.docs-main h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
}

.docs-main h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
}

.docs-main p,
.docs-main li {
  color: var(--ink-soft);
}

.docs-main ul {
  padding-left: 1.2rem;
}
.docs-main ul li {
  margin: 0.3rem 0;
}

.docs-main > *:first-child {
  margin-top: 0;
}

.docs-main code {
  font: 0.85em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--bg-chip);
  border-radius: 5px;
  padding: 0.12em 0.4em;
  color: var(--ink);
}

.hero {
  padding-bottom: 0.5rem;
}
.hero p {
  font-size: 1.05rem;
}

.hero-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
  align-items: center;
  margin-top: 1.5rem;
  color: var(--ink);
}
.hero-row i {
  color: var(--ink);
}

.highlighter-rouge {
  margin: 1rem 0;
}

.highlight,
div.highlighter-rouge .highlight {
  background: var(--bg-code);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: auto;
}
.highlight pre,
.highlight pre.highlight,
div.highlighter-rouge .highlight pre,
div.highlighter-rouge .highlight pre.highlight {
  margin: 0;
  padding: 1rem 1.1rem;
  background: none;
  border: 0;
}
.highlight code,
div.highlighter-rouge .highlight code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--ink);
}

.highlight .c, .highlight .c1, .highlight .cm {
  color: var(--muted);
  font-style: italic;
}

.highlight .nt, .highlight .k, .highlight .kd {
  color: var(--ink);
  font-weight: 600;
}

.highlight .na {
  color: var(--ink-soft);
}

.highlight .s, .highlight .s1, .highlight .s2, .highlight .dl {
  color: var(--ink-soft);
}

.example {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1.75rem;
  padding: 1.75rem 1.5rem;
  margin: 1.25rem 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  font-size: 2rem;
  color: var(--ink);
}

.example-item {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}
.example-item i {
  color: var(--ink);
}
.example-item label {
  cursor: pointer;
}
.example-item code {
  font-size: 0.62rem;
  background: none;
  padding: 0;
  color: var(--muted);
}

.example + .highlighter-rouge {
  margin-top: -0.25rem;
}

.gallery {
  margin: 1.25rem 0 0;
}

.gallery-search,
.builder-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.gallery-search:focus-within,
.builder-search:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.gallery-search > i,
.builder-search > i {
  color: var(--muted);
  font-size: 1.05rem;
}
.gallery-search input,
.builder-search input {
  flex: 1;
  border: 0;
  outline: 0;
  font: inherit;
  background: none;
  color: var(--ink);
}
.gallery-search input::placeholder,
.builder-search input::placeholder {
  color: var(--muted);
}
.gallery-search input:placeholder-shown + .clear,
.builder-search input:placeholder-shown + .clear {
  visibility: hidden;
}
.gallery-search .clear,
.builder-search .clear {
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0 0.2rem;
}
.gallery-search .clear:hover,
.builder-search .clear:hover {
  color: var(--ink);
}

.gallery-count {
  margin: 0.75rem 0.15rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.gallery-icons {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  gap: 0.5rem;
}
.gallery-icons li {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 1rem 0.5rem;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.08s ease;
}
.gallery-icons li:hover, .gallery-icons li:focus-visible {
  border-color: var(--ink);
  background: var(--line-soft);
  outline: none;
}
.gallery-icons li:active {
  transform: translateY(1px);
}
.gallery-icons li i {
  font-size: 2.5rem;
  color: var(--ink);
}
.gallery-icons li code {
  font-size: 0.68rem;
  background: none;
  padding: 0;
  color: var(--muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-top: 1.25rem;
  font-size: 0.85rem;
}
.gallery-actions a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink-soft);
}
.gallery-actions a i {
  color: var(--muted);
}

.builder {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: 1.5rem;
  margin-top: 1.25rem;
  align-items: stretch;
}

.builder-controls {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  height: 0;
  min-height: 100%;
  overflow-y: auto;
}

.options {
  display: flex;
  flex-direction: column;
  font-size: 0.82rem;
}
.options h4 {
  margin: 1.1rem 0 0.35rem;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.options h4:first-child {
  margin-top: 0;
}
.options label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.5rem;
  padding: 0.22rem 0;
  cursor: pointer;
  color: var(--ink-soft);
}
.options label code {
  white-space: nowrap;
}
.options .range-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0;
}
.options input[type=range] {
  flex: 1;
  accent-color: var(--ink);
}
.options form {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.35rem 0;
  padding: 0.25rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  width: fit-content;
  max-width: 220px;
}
.options form input[type=number] {
  border: 0;
  outline: 0;
  font: inherit;
  width: 72px;
  background: none;
}
.options form input[type=color] {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.options form input[type=color]::-webkit-color-swatch-wrapper {
  padding: 0;
}
.options form input[type=color]::-webkit-color-swatch {
  border: 0;
  border-radius: 5px;
}
.options form input[type=color]::-moz-color-swatch {
  border: 0;
  border-radius: 5px;
}
.options form input[type=submit] {
  display: none;
}
.options form [onclick] {
  cursor: pointer;
  color: var(--muted);
}

.builder-preview {
  min-width: 0;
}

.builder-icons {
  list-style: none;
  margin: 1rem 0;
  padding: 0.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.15rem;
  max-height: 460px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.builder-icons li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink-soft);
  transition: background 0.1s ease;
}
.builder-icons li:hover {
  background: var(--line-soft);
}
.builder-icons li code {
  font-size: 0.72rem;
  background: none;
  padding: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.builder-icons .li-ellipse, .builder-icons .li-rounded, .builder-icons .li-box {
  background-color: var(--accent);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 2rem;
  transform: translate(-50%, 1rem);
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--ink-text);
  font-size: 0.85rem;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted);
}
.site-footer a {
  color: var(--ink-soft);
}

.site-footer__brand {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.site-footer__legal {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.sidenav-scrim {
  display: none;
}

@media (max-width: 900px) {
  .builder {
    grid-template-columns: minmax(0, 1fr);
  }
  .builder-controls {
    height: auto;
    min-height: auto;
    overflow: visible;
  }
}
@media (max-width: 820px) {
  .topbar-nav {
    display: none;
  }
  .nav-toggle {
    display: inline-flex;
  }
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidenav {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    z-index: 40;
    width: min(82vw, var(--sidenav-w));
    background: var(--bg);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
  }
  .nav-open .sidenav {
    transform: translateX(0);
    box-shadow: 0 12px 40px var(--shadow);
  }
  .nav-open .sidenav-scrim {
    display: block;
    position: fixed;
    inset: var(--topbar-h) 0 0;
    z-index: 30;
    background: var(--scrim);
  }
}
