@font-face {
  font-family: Unbounded;
  src: url("../assets/fonts/unbounded-cyrillic-wght-normal.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: Unbounded;
  src: url("../assets/fonts/unbounded-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
  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+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: Golos;
  src: url("../assets/fonts/golos-text-cyrillic-wght-normal.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: Golos;
  src: url("../assets/fonts/golos-text-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
  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+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../assets/fonts/ibm-plex-mono-cyrillic-400-normal.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../assets/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-display: swap;
  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+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

:root {
  color-scheme: dark;
  --background: #101010;
  --foreground: #f0f0f0;
  --muted: #ababab;
  --surface: #181818;
  --inset: #131313;
  --overlay: #212121;
  --border: #343434;
  --separator: #2d2d2d;
  --default: #282828;
  --default-foreground: var(--foreground);
  --segment: #383838;
  --segment-hover: #454545;
  --segment-foreground: var(--foreground);
  --field-background: #202020;
  --field-foreground: var(--foreground);
  --field-border: #464646;
  --field-border-hover: #666;
  --field-border-focus: var(--accent);
  --field-border-width: 1px;
  --field-radius: 9px;
  --accent: #ededed;
  --accent-foreground: #141414;
  --accent-hover: #fff;
  --accent-soft: #303030;
  --accent-soft-foreground: #dedede;
  --focus: #d0d0d0;
  --error-text: #ffafaa;
  --display: Unbounded, Golos, sans-serif;
  --mono: "IBM Plex Mono", Consolas, monospace;
  font: 14px/1.5 Golos, sans-serif;
  color: var(--foreground);
  background: var(--background);
}

[hidden] { display: none !important; }
body { margin: 0; }
:focus-visible:not(.button, .input, .tabs__tab) { outline: 2px solid var(--focus); outline-offset: 3px; }
button:disabled, input:disabled { cursor: default; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

.icon {
  display: inline-block;
  flex: none;
  width: 16px;
  height: 16px;
  background: currentColor;
  mask: var(--symbol) center / contain no-repeat;
}
.icon-search { --symbol: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='m16 16 4 4'/%3E%3C/svg%3E"); }
.icon-download { --symbol: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12m-4-4 4 4 4-4M4 16v4h16v-4'/%3E%3C/svg%3E"); }
.icon-upload { transform: scaleY(-1); }
.icon-canvas { --symbol: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='3.5' width='17' height='17' rx='3'/%3E%3Cpath d='m4 16 5-5 4 4 2.5-2.5 4.5 4.5'/%3E%3Ccircle cx='15.5' cy='8.5' r='1' fill='black' stroke='none'/%3E%3C/svg%3E"); }
.icon-sliders { --symbol: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round'%3E%3Cpath d='M4 6h16M4 12h16M4 18h16M9 4v4m6 2v4m-5 2v4'/%3E%3C/svg%3E"); }
.icon-refresh { --symbol: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 11a8 8 0 1 0-2.3 6.7M20 5v6h-6'/%3E%3C/svg%3E"); }
.icon-chevron { --symbol: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }

.masthead {
  grid-area: navigation;
  position: relative;
  z-index: 2;
  background: var(--surface);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--separator);
}
.masthead-inner {
  position: relative;
  width: calc(100% - 32px);
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding-block: 10px 8px;
}
.wordmark { display: flex; align-items: center; gap: 10px; width: fit-content; font: 650 16px/1 var(--display); letter-spacing: -.035em; }
.mark { width: 28px; height: 28px; }
.quick-nav { grid-column: 1 / -1; grid-row: 2; display: flex; align-items: center; gap: 3px; min-width: 0; }
.quick-link {
  display: flex;
  flex: 1;
  justify-content: center;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 4px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
  transition: background-color 140ms, color 140ms;
}
.quick-link:hover { color: var(--foreground); background: var(--default); }
.quick-link[aria-current="page"] { color: var(--foreground); border-color: var(--field-border); background: var(--accent-soft); }
.generator-thumbnail { background: var(--segment); object-fit: cover; }
.quick-link .generator-thumbnail { display: none; width: 16px; height: 16px; border-radius: 4px; }
.masthead-actions { justify-self: end; display: flex; align-items: center; gap: 8px; }
.generator-nav { min-width: 0; }
.generator-nav summary { list-style: none; gap: 8px; }
.generator-nav summary::-webkit-details-marker { display: none; }
.generator-nav details[open] summary { --button-bg: var(--accent-soft); color: var(--accent-soft-foreground); }
.generator-panel {
  position: absolute;
  inset: 50px 0 auto auto;
  width: min(345px, 100%);
  border: 1px solid var(--field-border);
  border-radius: 14px;
  padding: 10px;
  background: var(--overlay);
  box-shadow: 0 16px 46px #000b;
}
.generator-panel input { width: 100%; min-height: 40px; }
.generator-panel ul { max-height: min(58vh, 360px); overflow-y: auto; margin: 7px 0 0; padding: 0; list-style: none; }
.generator-panel a {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 60px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--foreground);
}
.generator-panel a:hover { background: var(--default); }
.generator-panel a[aria-current="page"] { border-color: var(--field-border-hover); background: var(--accent-soft); }
.generator-panel a:focus-visible { outline-offset: -2px; }
.generator-panel .generator-thumbnail { width: 38px; height: 38px; border-radius: 6px; }
.generator-panel a strong { display: block; margin-bottom: 1px; font-size: 13px; font-weight: 650; }
.generator-panel a span span { display: block; color: var(--muted); font-size: 12px; }
.generator-empty { margin: 10px; color: var(--muted); }

.studio {
  display: grid;
  grid-template-columns: clamp(336px, 29vw, 416px) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "navigation canvas" "sidebar canvas";
  height: 100dvh;
}
.sidebar {
  grid-area: sidebar;
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden auto;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--field-border) transparent;
  border-right: 1px solid var(--border);
  background: var(--surface);
}
.intro {
  display: grid;
  gap: 14px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--separator);
}
h1 {
  margin: 0;
  font: 570 clamp(29px, 2.5vw, 36px)/1.12 var(--display);
  letter-spacing: -.045em;
  text-wrap: balance;
}
h1 em { color: #bdbdbd; font-style: normal; white-space: nowrap; }
.intro p { max-width: 70ch; margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.export { position: relative; display: flex; align-items: end; gap: 8px; }
.export-size-field { display: grid; gap: 4px; }
.export-size-field label { color: var(--muted); font-size: 11px; }
.export #export-size { width: 100%; min-width: 105px; height: 42px; font: 12px var(--mono); }
.export .download { flex: 1; min-width: 0; height: 42px; padding-inline: 14px; font-weight: 650; }
.export .download .icon { width: 17px; height: 17px; }
.export .error {
  position: absolute;
  z-index: 1;
  top: calc(100% + 4px);
  right: 0;
  width: min(310px, 100%);
  margin: 0;
  padding: 9px 12px;
  border: 1px solid #683d3d;
  border-radius: 9px;
  background: #2d1b1b;
}

.proof { grid-area: canvas; min-width: 0; min-height: 0; }
.controls { min-width: 0; }
.proof-bar, .proof-footer, .controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding-inline: 16px;
}
.proof-bar, .controls-bar { min-height: 46px; }
.controls-bar { border-bottom: 1px solid var(--separator); }
.proof-bar { flex-wrap: wrap; padding-block: 6px 3px; }
.proof-label, .controls-bar { font-size: 14px; font-weight: 650; }
.proof-label, .controls-bar h2 { display: flex; align-items: center; gap: 8px; }
.controls-bar h2 { margin: 0; font: inherit; }
.proof-label .icon, .controls-bar .icon { color: var(--accent); }
.proof-actions { display: flex; align-items: center; gap: 7px; margin-left: auto; }
.proof-footer { min-height: 28px; padding-block: 3px 7px; border-bottom: 1px solid var(--separator); color: var(--muted); font: 11px/1.4 var(--mono); }
.proof-footer .chip { font: inherit; }
.proof-meta { display: flex; align-items: center; min-width: 0; gap: 8px; }
.studio:has(.sheet.ready) .proof-meta::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}
.stage {
  --stage-height: 100dvh;
  --stage-padding: clamp(16px, 2.2vmin, 28px);
  --display-height: calc(var(--stage-height) - 2 * var(--stage-padding));
  position: relative;
  display: grid;
  place-items: center;
  height: var(--stage-height);
  padding: var(--stage-padding);
  background-color: var(--inset);
  background-image:
    radial-gradient(ellipse at 50% 44%, #33333370, transparent 72%),
    linear-gradient(#ffffff0c 1px, transparent 1px),
    linear-gradient(90deg, #ffffff0c 1px, transparent 1px);
  background-size: auto, 24px 24px, 24px 24px;
  background-position: center;
}
.sheet {
  position: relative;
  width: min(100%, calc(var(--display-height) * var(--aspect, .8)));
  aspect-ratio: var(--aspect, .8);
  opacity: 0;
}
.sheet.ready { opacity: 1; }
.sheet::before, .sheet::after {
  content: "";
  position: absolute;
  pointer-events: none;
  inset: -9px;
  color: #828282;
  background:
    linear-gradient(currentColor, currentColor) top left / 9px 1px,
    linear-gradient(currentColor, currentColor) top left / 1px 9px,
    linear-gradient(currentColor, currentColor) bottom right / 9px 1px,
    linear-gradient(currentColor, currentColor) bottom right / 1px 9px;
  background-repeat: no-repeat;
}
.sheet::after { transform: scaleX(-1); }
.sheet canvas, .sheet img { box-shadow: 0 12px 36px #0009, 0 1px 3px #000a; }
.sheet canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.stage-status { position: absolute; margin: 0; padding: 8px 12px; text-align: center; color: var(--muted); }

.panel { padding: 16px 17px; }
.panel + .panel { border-top: 1px solid var(--separator); }
.panel h2, .panel h3 { margin: 0 0 11px; font-size: 14px; font-weight: 650; letter-spacing: -.015em; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.panel-heading :is(h2, h3) { margin: 0; }
.setting + .setting { margin-top: 10px; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.label-row label, .seed-setting > label { color: var(--accent-soft-foreground); font-size: 12px; font-weight: 500; }
.setting output { color: var(--accent-soft-foreground); font: 11px/1.3 var(--mono); font-variant-numeric: tabular-nums; }
.hint, .error { margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.error { color: var(--error-text); }

.button { border-radius: 9px; }
.button--outline { --button-bg-hover: var(--default); border-color: var(--field-border); }
.button--ghost { color: var(--muted); }
.button--ghost:hover { color: var(--foreground); }
.rotate, .invert { min-height: 32px; padding-inline: 9px; font-size: 12px; }
.rotate .icon, .invert .icon { width: 14px; height: 14px; }
.button[aria-pressed="true"].button--outline { --button-bg: var(--segment); color: var(--foreground); border-color: var(--field-border-hover); }
.view-switch {
  display: flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--inset);
}
.view-switch button { height: 28px; min-width: 0; padding: 0 9px; border-radius: 6px; font-size: 12px; color: var(--muted); }
.view-switch button[aria-pressed="true"] { --button-bg: var(--segment); --button-bg-hover: var(--segment-hover); color: var(--segment-foreground); }
.view-switch button[aria-pressed="false"]:hover { color: var(--foreground); }
.locale-switch button { height: 25px; min-width: 29px; padding-inline: 5px; font: 11px/1 var(--mono); }
.native-select {
  appearance: none;
  min-width: 0;
  max-width: 100%;
  min-height: 35px;
  padding: 5px 27px 5px 9px;
  border: 1px solid var(--field-border);
  border-radius: var(--field-radius);
  background: var(--field-background) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23c5c5c5' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E") right 8px center / 13px no-repeat;
  font: 12px/1.3 Golos, sans-serif;
  cursor: pointer;
}
.native-select:focus, .native-select:hover { background-color: var(--field-background); }
.native-select option, .native-select optgroup { color: var(--foreground); background: var(--field-background); }
.panel-heading .native-select { min-height: 32px; }
input.input { border-width: 1px; }
.seed-row { display: grid; grid-template-columns: minmax(0, 1fr) 38px; gap: 6px; margin-top: 5px; }
.seed-row input { width: 100%; min-height: 36px; padding: 5px 10px; font: 12px var(--mono); }
.seed-row button { height: 100%; width: 100%; padding: 0; }
.seed-row .icon { width: 16px; height: 16px; }
.palette-label { min-height: 18px; margin-bottom: 6px; }
.palette-swatches { display: flex; width: 66px; height: 12px; border: 1px solid var(--field-border); border-radius: 4px; overflow: hidden; }
.palette-swatches span { flex: 1; }

input[type="range"] {
  appearance: none;
  display: block;
  width: 100%;
  height: 22px;
  margin: 1px 0 0;
  background: transparent;
  cursor: pointer;
  --progress: 50%;
  --track: linear-gradient(to right, var(--accent) var(--progress), var(--field-border-hover) var(--progress));
}
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 10px; background: var(--track); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 10px; background: var(--track); }
input[type="range"]::-webkit-slider-thumb { appearance: none; margin-top: -4px; width: 12px; height: 12px; border: 0; border-radius: 50%; background: var(--accent); }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: var(--accent); }
input[type="range"]:disabled { opacity: .42; cursor: default; }

.mobile-jump { display: none; }
@media (max-width: 760px) {
  .studio {
    --mobile-gutter: 13px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas: "navigation" "title" "tools" "canvas" "metadata" "settings";
    reading-flow: grid-rows;
    height: auto;
    padding-bottom: 20px;
  }
  .sidebar { display: contents; }
  .masthead { border-right: 0; }
  .masthead-inner { width: calc(100% - 2 * var(--mobile-gutter)); }
  .intro, .proof-bar, .proof, .proof-footer, .controls { margin-inline: var(--mobile-gutter); }
  .intro { grid-area: title; padding: 21px 0 15px; border: 0; }
  h1 { font-size: clamp(27px, 5.8vw, 43px); text-wrap: wrap; }
  h1 em { white-space: normal; }
  .intro p { margin-top: 7px; line-height: 1.4; }
  .proof-bar, .proof, .proof-footer, .controls { border: 1px solid var(--border); }
  .proof-bar, .proof-footer, .controls { background: var(--surface); }
  .proof-bar { grid-area: tools; padding-block: 6px; border-radius: 16px 16px 0 0; scroll-margin-top: 10px; }
  .proof { border-block: 0; }
  .proof-footer { grid-area: metadata; min-height: 38px; padding-block: 3px; gap: 5px; border-radius: 0 0 16px 16px; }
  .stage { --stage-height: clamp(258px, 93vw, 460px); --stage-padding: 16px; --display-height: calc(var(--stage-height) - 44px); }
  .controls { grid-area: settings; margin-top: 12px; border-radius: 16px; scroll-margin-top: 10px; }
  .proof-bar, .proof-footer, .controls-bar { padding-inline: 12px; }
  .proof-bar, .controls-bar { min-height: 47px; }
  .controls-bar {
    position: sticky;
    z-index: 1;
    top: 0;
    border-radius: 15px 15px 0 0;
    background: var(--surface);
  }
  .controls :is(button, input, select, summary) { scroll-margin-top: 54px; }
  .proof-label, .controls-bar { font-size: 13px; }
  .panel { padding: 14px; }
  .mobile-jump {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    font: 11px/1.3 Golos, sans-serif;
    color: var(--accent-soft-foreground);
    white-space: nowrap;
    cursor: pointer;
  }
  .controls-bar .mobile-jump .icon { width: 13px; height: 13px; transform: rotate(180deg); }
  .proof-footer .mobile-jump { margin-left: auto; }
  .mobile-jump + .chip { margin-left: 3px; }
}
@media (max-width: 560px) {
  .intro { display: grid; gap: 10px; }
  .export { width: 100%; gap: 7px; }
  .export-size-field { grid-template-columns: auto 97px; align-items: center; gap: 6px; }
  .export-size-field label { max-width: 63px; line-height: 1.2; }
  .export #export-size { min-width: 0; height: 37px; font-size: 11px; }
  .export .download { flex: 1; height: 37px; min-width: 0; padding-inline: 8px; font-size: 12px; }
}
@media (max-width: 380px) {
  .quick-link { gap: 4px; font-size: 11px; }
  .proof-bar { padding-inline: 9px; gap: 4px; }
  .proof-actions { gap: 4px; }
  .proof-bar .view-switch button { padding-inline: 7px; font-size: 11px; }
  .proof-footer { padding-inline: 9px; font-size: 10px; }
  .proof-meta { gap: 4px; }
}
@media (min-width: 440px) and (max-width: 760px) {
  .quick-link .generator-thumbnail { display: block; }
}
@media (pointer: coarse) {
  .generator-panel input, .seed-row input { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
}
