:root {
  --bg: #f4f1ea;
  --bg2: #ebe6db;
  --card: #fffdf8;
  --card2: #f7f3ea;
  --line: #ddd5c5;
  --text: #1d1a24;
  --muted: #6d6676;
  --accent: #ff4f7b;
  --accent2: #7a45d6;
  --gold: #e8a400;
  --ok: #1e9e5a;
  --bad: #d63a3a;
  --code-bg: #1d1a24;
  --code-text: #f2eefc;
  --stage: #e9e3d6;
  --shadow: 0 1px 0 rgba(0, 0, 0, .04), 0 8px 24px -12px rgba(40, 20, 60, .18);
  --r: 14px;
  --pix: 4px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121019;
    --bg2: #1a1724;
    --card: #1c1927;
    --card2: #242033;
    --line: #322d44;
    --text: #efeaf8;
    --muted: #a39cb6;
    --accent: #ff6b92;
    --accent2: #a67cff;
    --gold: #ffd23f;
    --ok: #46d17f;
    --bad: #ff6b6b;
    --code-bg: #0c0a12;
    --code-text: #efeaf8;
    --stage: #0e0c15;
    --shadow: 0 1px 0 rgba(255, 255, 255, .03), 0 10px 30px -14px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #121019;
  --bg2: #1a1724;
  --card: #1c1927;
  --card2: #242033;
  --line: #322d44;
  --text: #efeaf8;
  --muted: #a39cb6;
  --accent: #ff6b92;
  --accent2: #a67cff;
  --gold: #ffd23f;
  --ok: #46d17f;
  --bad: #ff6b6b;
  --code-bg: #0c0a12;
  --code-text: #efeaf8;
  --stage: #0e0c15;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03), 0 10px 30px -14px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}

a {
  color: var(--accent2);
  text-underline-offset: 3px;
}

h1, h2, h3, .pixel {
  font-family: "Tiny5", "Inter", system-ui, sans-serif;
  font-weight: 400;
  font-synthesis: none;
  letter-spacing: .02em;
  line-height: 1.15;
}

h1 {
  font-size: clamp(34px, 7vw, 64px);
  margin: 0 0 14px;
}

h2 {
  font-size: clamp(26px, 4.4vw, 38px);
  margin: 0 0 14px;
}

h3 {
  font-size: 22px;
  margin: 28px 0 8px;
}

p {
  margin: 0 0 14px;
}

code, pre, kbd {
  font-family: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}

:not(pre) > code {
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 5px;
  font-size: .88em;
  white-space: nowrap;
}

pre {
  margin: 0 0 16px;
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: 12px;
  padding: 14px 16px;
  overflow: auto;
  font-size: 13.5px;
  line-height: 1.5;
  max-width: 100%;
}

kbd {
  background: var(--card2);
  border: 1px solid var(--line);
  border-bottom-width: 3px;
  border-radius: 6px;
  padding: 0 6px;
  font-size: .85em;
}

.wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---- шапка ---- */

.top {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.top .wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 60px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-family: "Tiny5", sans-serif;
  font-size: 24px;
  font-weight: 400;
  white-space: nowrap;
}

.brand .pe-canvas {
  display: block;
}

.nav {
  display: flex;
  gap: 2px;
  margin-left: auto;
  align-items: center;
}

.nav a, .icon-btn {
  color: var(--text);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 15px;
  white-space: nowrap;
  border: 0;
  background: none;
  cursor: pointer;
  font-family: inherit;
}

.nav a:hover, .icon-btn:hover {
  background: var(--card2);
}

.nav a[aria-current="page"] {
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--line);
}

.menu-btn {
  display: none;
}

@media (max-width: 760px) {
  .menu-btn {
    display: inline-flex;
    margin-left: auto;
  }

  .nav {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 8px 16px 14px;
  }

  .nav.open {
    display: flex;
  }

  .nav a {
    padding: 12px;
  }
}

/* ---- кнопки ---- */

.btn {
  --b: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 20px;
  border-radius: 12px;
  border: 0;
  background: var(--b);
  color: #fff;
  font: 600 16px/1.2 "Inter", system-ui, sans-serif;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 0 color-mix(in srgb, var(--b) 62%, #000);
  transition: transform .08s, box-shadow .08s;
}

.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--b) 62%, #000);
}

.btn.alt {
  --b: var(--card);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line), 0 4px 0 var(--line);
}

.btn.alt:active {
  box-shadow: inset 0 0 0 1px var(--line), 0 1px 0 var(--line);
}

.btn.small {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 14px;
  border-radius: 10px;
}

.btn.purple {
  --b: var(--accent2);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font: 14px/1.2 "Inter", system-ui, sans-serif;
  cursor: pointer;
  white-space: nowrap;
}

.chip:hover {
  border-color: var(--accent2);
}

.chip.on {
  background: var(--accent2);
  border-color: var(--accent2);
  color: #fff;
}

/* ---- блоки ---- */

section {
  padding: 56px 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}

.stage {
  background: var(--stage);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  position: relative;
  overflow: hidden;
}

.stage.checker {
  background-color: var(--stage);
  background-image:
    linear-gradient(45deg, color-mix(in srgb, var(--text) 5%, transparent) 25%, transparent 25%),
    linear-gradient(-45deg, color-mix(in srgb, var(--text) 5%, transparent) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, color-mix(in srgb, var(--text) 5%, transparent) 75%),
    linear-gradient(-45deg, transparent 75%, color-mix(in srgb, var(--text) 5%, transparent) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.pe-canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  max-width: 100%;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.muted {
  color: var(--muted);
}

.lead {
  font-size: 19px;
  color: var(--muted);
  max-width: 640px;
}

.grid2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.grid3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.note {
  border-left: 4px solid var(--accent2);
  background: var(--card);
  border-radius: 0 12px 12px 0;
  padding: 12px 16px;
  margin: 0 0 16px;
}

.note.warn {
  border-color: var(--gold);
}

.note.bad {
  border-color: var(--bad);
}

.note > :last-child {
  margin-bottom: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.table-wrap {
  overflow-x: auto;
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}

th, td {
  text-align: left;
  vertical-align: top;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

tr:last-child td {
  border-bottom: 0;
}

th {
  background: var(--card2);
  font-weight: 600;
  white-space: nowrap;
}

td code {
  white-space: nowrap;
}

/* ---- герой ---- */

.hero {
  padding: 48px 0 40px;
  text-align: center;
}

.hero .stage {
  min-height: 220px;
  margin: 0 auto 28px;
  max-width: 760px;
  background: radial-gradient(ellipse at 50% 40%, color-mix(in srgb, var(--accent2) 14%, var(--stage)), var(--stage) 70%);
}

.hero .lead {
  margin: 0 auto 24px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero .chips {
  justify-content: center;
  margin: 0 auto 26px;
  max-width: 760px;
}

.stage-hint {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  pointer-events: none;
}

/* ---- шаги установки ---- */

.steps {
  counter-reset: s;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  padding: 0;
  margin: 0;
  list-style: none;
}

.steps li {
  counter-increment: s;
  padding: 18px 18px 18px 64px;
  position: relative;
}

.steps li::before {
  content: counter(s);
  position: absolute;
  left: 16px;
  top: 16px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font: 400 20px "Tiny5", sans-serif;
}

.steps b {
  display: block;
  margin-bottom: 4px;
}

/* ---- реакции ---- */

.react {
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  font: inherit;
  width: 100%;
}

.react:hover {
  border-color: var(--accent2);
}

.react .emo {
  font-size: 28px;
  line-height: 1;
}

.react b {
  display: block;
}

.react span {
  color: var(--muted);
  font-size: 14px;
}

/* ---- галерея ---- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.skin-card {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.skin-card .stage {
  height: 150px;
  padding: 8px;
}

.skin-card h3 {
  margin: 0;
  font-size: 20px;
}

.skin-card .meta {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skin-card .desc {
  font-size: 14px;
  color: var(--muted);
  flex: 1;
}

.skin-card .row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  font-size: 12px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--card2);
  border: 1px solid var(--line);
  color: var(--muted);
}

.filter {
  margin-bottom: 18px;
}

/* ---- документация ---- */

.doc {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 36px;
  padding-top: 32px;
  padding-bottom: 80px;
}

.toc {
  position: sticky;
  top: 80px;
  align-self: start;
  max-height: calc(100vh - 100px);
  overflow: auto;
  font-size: 14px;
  padding-bottom: 20px;
}

.toc a {
  display: block;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 8px;
  border-left: 2px solid transparent;
}

.toc a.sub {
  padding-left: 22px;
  font-size: 13px;
}

.toc a:hover, .toc a.on {
  color: var(--text);
  background: var(--card2);
}

.toc a.on {
  border-left-color: var(--accent);
}

.toc-mobile {
  display: none;
}

.doc article > section {
  padding: 0 0 36px;
  border-bottom: 1px dashed var(--line);
  margin-bottom: 36px;
}

.doc article > section:last-child {
  border-bottom: 0;
}

.doc article h2 {
  padding-top: 4px;
}

.doc article ol, .doc article ul {
  padding-left: 22px;
  margin: 0 0 16px;
}

.doc article li {
  margin-bottom: 6px;
}

@media (max-width: 900px) {
  .doc {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .toc {
    display: none;
  }

  .toc-mobile {
    display: block;
    margin-bottom: 24px;
  }

  .toc-mobile summary {
    cursor: pointer;
    padding: 12px 16px;
    font-weight: 600;
  }

  .toc-mobile nav {
    padding: 0 8px 12px;
    font-size: 15px;
  }

  .toc-mobile a {
    display: block;
    padding: 6px 10px;
    color: var(--text);
    text-decoration: none;
  }

  .toc-mobile a.sub {
    padding-left: 24px;
    color: var(--muted);
  }
}

/* живые примеры в инструкции */

.demo {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 0;
  margin: 0 0 20px;
  overflow: hidden;
}

.demo pre {
  margin: 0;
  border-radius: 0;
  max-height: 460px;
  font-size: 12.5px;
}

.demo .side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
}

.demo .stage {
  flex: 1;
  min-height: 170px;
}

.demo .chips .chip {
  font-size: 13px;
  padding: 4px 10px;
}

.demo-title {
  padding: 10px 14px;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

@media (max-width: 760px) {
  .demo {
    grid-template-columns: minmax(0, 1fr);
  }

  .demo pre {
    max-height: 300px;
    order: 2;
  }
}

.anatomy {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 0 0 18px;
}

.anatomy figure {
  margin: 0;
  padding: 10px;
  text-align: center;
}

.anatomy figcaption {
  font-size: 14px;
  margin-top: 6px;
}

.anatomy figcaption small {
  display: block;
  color: var(--muted);
}

.emo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin: 0 0 18px;
}

.emo-grid .card {
  padding: 10px;
  text-align: center;
}

.emo-grid .stage {
  height: 96px;
  padding: 6px;
}

.emo-grid b {
  display: block;
  margin-top: 6px;
  font-size: 15px;
}

.emo-grid small {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.35;
  display: block;
}

.gridpic {
  font-family: "JetBrains Mono", monospace;
  line-height: 1;
  letter-spacing: .25em;
}

/* ---- подвал ---- */

footer {
  border-top: 1px solid var(--line);
  padding: 30px 0 50px;
  color: var(--muted);
  font-size: 14px;
}

footer .wrap {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: space-between;
}

/* плавающие глаза поверх страницы, как в плагине */

.floating-eyes {
  position: fixed;
  z-index: 60;
  right: 18px;
  bottom: 18px;
  touch-action: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(120px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 15px;
  z-index: 100;
  transition: transform .25s;
  max-width: calc(100vw - 32px);
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.chat-demo {
  max-width: 560px;
  margin: 0 auto 24px;
}

.chat-demo .chips {
  justify-content: center;
  margin: 0 0 10px;
}

.type-hint {
  font-size: 14.5px;
  color: var(--muted);
  min-height: 2.8em;
  margin: 8px 0 0;
}

.type-hint b {
  color: var(--text);
}

.typing-demo {
  display: flex;
  gap: 8px;
  max-width: 520px;
  margin: 0 auto 26px;
}

.chat-demo .typing-demo {
  margin: 0 auto;
}

.typing-demo input {
  flex: 1;
  min-width: 0;
  height: 46px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  padding: 0 14px;
  font: 16px "Inter", system-ui, sans-serif;
}

.typing-demo input:focus {
  outline: 2px solid var(--accent2);
  outline-offset: 1px;
}

/* ---- редактор ---- */

.editor {
  padding-top: 24px;
  padding-bottom: 60px;
}

.ed-head h1 {
  font-size: clamp(30px, 5vw, 44px);
  margin-bottom: 6px;
}

.small {
  font-size: 13.5px;
}

.fld {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
  min-width: 0;
  margin-bottom: 10px;
}

.fld > span {
  color: var(--muted);
  font-size: 13px;
}

.fld small {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.35;
}

.fld.grow {
  flex: 1 1 220px;
}

.fld.narrow {
  width: 74px;
}

input[type="text"], input[type="number"], select, textarea {
  font: 15px/1.3 "Inter", system-ui, sans-serif;
  color: var(--text);
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  min-width: 0;
  width: 100%;
}

textarea {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12.5px;
  resize: vertical;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent2);
  outline-offset: 1px;
}

input[type="color"] {
  width: 52px;
  height: 52px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card2);
  cursor: pointer;
  flex: none;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent2);
}

input[type="checkbox"] {
  accent-color: var(--accent2);
  width: 18px;
  height: 18px;
  flex: none;
}

select.chip {
  width: auto;
  padding: 6px 10px;
  border-radius: 999px;
}

select.chip.on {
  background: var(--accent2);
  color: #fff;
  border-color: var(--accent2);
}

.chk {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 14px;
  margin: 6px 0;
  cursor: pointer;
}

.rng {
  display: flex;
  gap: 10px;
  align-items: center;
}

.rng output {
  min-width: 36px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 13px;
}

.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.err {
  color: var(--bad);
  font-size: 14px;
}

.row-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.ed-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  align-items: flex-end;
  padding: 14px 14px 4px;
  margin: 18px 0 16px;
}

.ed-bar-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.file-btn {
  position: relative;
  overflow: hidden;
}

.file-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.paste-box {
  flex-basis: 100%;
  margin-bottom: 12px;
}

.paste-box textarea {
  margin-bottom: 8px;
}

.ed-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

@media (max-width: 900px) {
  .ed-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .ed-side {
    display: contents !important;
  }

  .ed-preview {
    order: -2;
    position: sticky;
    top: 62px;
    z-index: 5;
  }

  .ed-main {
    order: -1;
  }

  .ed-preview .stage {
    min-height: 110px !important;
  }

  .ed-preview > p {
    display: none;
  }

  .ed-preview .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .ed-preview-row {
    flex-wrap: nowrap;
  }

  .ed-preview-row .rng {
    display: none;
  }
}

.ed-paint, .ed-preview, .ed-out {
  padding: 14px;
}

.ed-paint h3 {
  margin: 18px 0 8px;
  font-size: 20px;
}

.ed-paint .chips {
  margin-bottom: 8px;
}

.ed-ops {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-bottom: 10px;
}

.op-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 2px;
}

.op-group .icon-btn {
  padding: 6px 10px;
  font-size: 15px;
  min-width: 36px;
}

.op-group .icon-btn:disabled {
  opacity: .35;
  cursor: default;
}

.op-group .size {
  font: 600 14px "JetBrains Mono", monospace;
  padding: 0 6px;
  white-space: nowrap;
}

.canvas-holder {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 160px;
  background: var(--card2);
  border-radius: 12px;
  padding: 2px;
  overflow: hidden;
}

#ed-canvas {
  touch-action: none;
  cursor: crosshair;
  display: block;
  border-radius: 4px;
}

.empty {
  text-align: center;
  padding: 30px 16px;
}

.ed-under {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.palette {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.swatch {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(-45deg, #ccc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(-45deg, transparent 75%, #ccc 75%);
  background-size: 10px 10px;
  background-position: 0 0, 0 5px, 5px -5px, -5px 0;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
}

.swatch .sw-fill {
  position: absolute;
  inset: 0;
}

.swatch .sw-ch {
  position: absolute;
  left: 3px;
  bottom: 1px;
  font: 600 11px "JetBrains Mono", monospace;
  color: #fff;
  text-shadow: 0 0 2px #000, 0 0 2px #000;
}

.swatch .sw-dot {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent2);
  box-shadow: 0 0 0 2px #fff;
}

.swatch .sw-ring {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 3px solid #111;
  box-shadow: 0 0 0 1px #fff;
}

.swatch.on {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.swatch.unused {
  opacity: .6;
}

.swatch.add {
  background: var(--card2);
  color: var(--text);
  font-size: 22px;
  border-style: dashed;
}

.color-box {
  background: var(--card2);
  border-radius: 12px;
  padding: 12px;
}

.color-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.color-row .fld {
  flex: 1 1 120px;
  margin-bottom: 0;
}

.color-row .fld.narrow {
  flex: none;
}

.color-box > .fld {
  margin: 10px 0;
}

.color-box input[type="text"] {
  background: var(--card);
}

.presets {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 4px;
  margin-top: 10px;
}

.preset {
  aspect-ratio: 1;
  border-radius: 6px;
  border: 1px solid rgba(128, 128, 128, .35);
  cursor: pointer;
  padding: 0;
  min-width: 0;
}

@media (max-width: 520px) {
  .presets {
    grid-template-columns: repeat(8, 1fr);
  }
}

.ed-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.ed-preview .stage {
  min-height: 190px;
  margin-bottom: 10px;
  transition: background .2s;
}

.ed-preview .stage[data-bg="dark"] {
  background: #121019;
}

.ed-preview .stage[data-bg="light"] {
  background: #f4f1ea;
}

.ed-preview .stage[data-bg="chat-dark"] {
  background: linear-gradient(160deg, #1d2a33, #2b3b2e 60%, #1f2a25);
}

.ed-preview .stage[data-bg="chat-light"] {
  background: linear-gradient(160deg, #b8d5a4, #d9e6b5 50%, #a9cfa8);
}

.ed-preview .chips {
  margin-bottom: 8px;
}

.ed-preview .chips .chip {
  padding: 5px 10px;
}

.ed-preview-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.ed-preview-row .rng {
  flex: 0 1 180px;
}

#ed-status .note {
  margin: 0 0 8px;
  font-size: 14px;
}

#ed-status .note:last-child {
  margin-bottom: 0;
}

.ed-sect summary {
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 600;
  list-style: none;
}

.ed-sect summary::-webkit-details-marker {
  display: none;
}

.ed-sect summary::before {
  content: "▸ ";
  color: var(--muted);
}

.ed-sect[open] summary::before {
  content: "▾ ";
}

.sect-body {
  padding: 0 14px 12px;
}

.eyes-list {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.eyes-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 60px 36px;
  gap: 6px;
  align-items: center;
}

.eyes-row.head span {
  font-size: 12.5px;
  color: var(--muted);
}

.eyes-row input[type="number"], .eyes-row select {
  padding: 6px 8px;
}

.ed-out textarea {
  margin: 10px 0;
  min-height: 220px;
}
