/* ichakaev pdf — the same identity as the site, tasks and english:
   dark ink, bone type, one signal colour (≤ 5% of the screen), Unbounded / Manrope / JetBrains Mono.
   Pages themselves stay white paper: the document is the only bright thing in the editor. */
:root {
  --bg: #07080a;
  --surface: #0b0d10;
  --surface-2: #101318;
  --surface-3: #161a20;
  --surface-4: #1c2129;
  --line: rgba(236, 235, 230, .08);
  --line-2: rgba(236, 235, 230, .15);
  --line-3: rgba(236, 235, 230, .24);
  --text: #ecebe6;
  --text-2: #b6b8bd;
  --muted: #80868f;
  --signal: #c9f73a;
  --signal-rgb: 201, 247, 58;
  --alert: #ff5a4e;
  --alert-rgb: 255, 90, 78;
  --ink-blue: #5b6cff;
  --display: "Unbounded", "Manrope", system-ui, sans-serif;
  --body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --gutter: 16px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --top-h: 60px;
  --tools-h: 52px;
  --side-w: 188px;
  color-scheme: dark;
}

/* the fonts output PDFs are written with — the editor shows text exactly as it will be saved */
@font-face { font-family: LibSerif; src: url(vendor/fonts/LiberationSerif-Regular.ttf); font-display: block; }
@font-face { font-family: LibSerif; src: url(vendor/fonts/LiberationSerif-Bold.ttf); font-weight: 700; font-display: block; }
@font-face { font-family: LibSerif; src: url(vendor/fonts/LiberationSerif-Italic.ttf); font-style: italic; font-display: block; }
@font-face { font-family: LibSerif; src: url(vendor/fonts/LiberationSerif-BoldItalic.ttf); font-weight: 700; font-style: italic; font-display: block; }
@font-face { font-family: LibSans; src: url(vendor/fonts/LiberationSans-Regular.ttf); font-display: block; }
@font-face { font-family: LibSans; src: url(vendor/fonts/LiberationSans-Bold.ttf); font-weight: 700; font-display: block; }
@font-face { font-family: LibSans; src: url(vendor/fonts/LiberationSans-Italic.ttf); font-style: italic; font-display: block; }
@font-face { font-family: LibSans; src: url(vendor/fonts/LiberationSans-BoldItalic.ttf); font-weight: 700; font-style: italic; font-display: block; }
@font-face { font-family: LibMono; src: url(vendor/fonts/LiberationMono-Regular.ttf); font-display: block; }
@font-face { font-family: LibMono; src: url(vendor/fonts/LiberationMono-Bold.ttf); font-weight: 700; font-display: block; }
@font-face { font-family: LibMono; src: url(vendor/fonts/LiberationMono-Italic.ttf); font-style: italic; font-display: block; }
@font-face { font-family: LibMono; src: url(vendor/fonts/LiberationMono-BoldItalic.ttf); font-weight: 700; font-style: italic; font-display: block; }

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  min-height: 100vh; min-height: 100dvh;
  background: var(--bg); color: var(--text);
  font: 400 15px/1.55 var(--body);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
body.in-app { height: 100vh; height: 100dvh; overflow: hidden; }
img, svg { display: block; max-width: 100%; }
ul, ol { list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; text-align: inherit; }
b, strong { font-weight: 600; }
::selection { background: var(--signal); color: var(--bg); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); letter-spacing: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.ic { width: 18px; height: 18px; flex: none; }
.wrap { width: min(1180px, 100%); margin: 0 auto; padding: 0 var(--gutter); }
.narrow { width: min(820px, 100%); }
.skip { position: fixed; top: 12px; left: 12px; z-index: 300; padding: 10px 16px; border-radius: 10px; background: var(--signal); color: var(--bg); font-weight: 600; transform: translateY(-160%); transition: transform .3s var(--ease); }
.skip:focus { transform: none; }
.loading { padding: 30vh 16px 0; text-align: center; color: var(--muted); }

.kicker { margin-bottom: 14px; font-size: 12px; letter-spacing: .06em; text-transform: lowercase; color: var(--muted); }
.kicker b { color: var(--signal); font-weight: 500; }
.display { font: 500 clamp(34px, 5.6vw, 64px)/1.02 var(--display); letter-spacing: -.045em; }
.h2 { font: 500 clamp(26px, 3.6vw, 40px)/1.08 var(--display); letter-spacing: -.04em; max-width: 22ch; }
.lead { margin-top: 18px; max-width: 58ch; color: var(--text-2); font-size: clamp(15px, 1.6vw, 18px); }
.link { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-3); text-underline-offset: 3px; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: 999px;
  font: 600 14px/1 var(--body); white-space: nowrap;
  transition: transform .3s var(--ease), box-shadow .3s, border-color .2s, color .2s, background .2s, opacity .2s;
}
.btn .ic { width: 16px; height: 16px; }
.btn--primary { background: var(--signal); color: #090a0c; }
.btn--primary:hover { box-shadow: 0 10px 34px -10px rgba(var(--signal-rgb), .6); transform: translateY(-1px); }
.btn--ghost { border: 1px solid var(--line-2); color: var(--text); background: rgba(7, 8, 10, .35); }
.btn--ghost:hover { border-color: rgba(var(--signal-rgb), .55); color: var(--signal); }
.btn--sm { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn:disabled { opacity: .4; cursor: default; box-shadow: none; transform: none; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: var(--text-2); transition: color .2s, background .2s; flex: none; }
.icon-btn:hover { color: var(--text); background: var(--surface-4); }
.icon-btn:disabled { opacity: .35; pointer-events: none; }
.icon-btn.is-on { color: var(--signal); background: rgba(var(--signal-rgb), .1); }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--text-2); font-size: 13px; font-weight: 600; transition: border-color .2s, color .2s, background .2s; }
.chip .ic { width: 15px; height: 15px; }
.chip:hover { color: var(--text); border-color: var(--line-3); }
.chip.is-on { color: var(--signal); border-color: rgba(var(--signal-rgb), .55); background: rgba(var(--signal-rgb), .07); }
.field { display: block; width: 100%; min-height: 36px; padding: 7px 10px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg); font-size: 13px; }
.field:focus { outline: none; border-color: rgba(var(--signal-rgb), .7); box-shadow: 0 0 0 3px rgba(var(--signal-rgb), .12); }
select.field { appearance: none; padding-right: 28px; background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2380868f' stroke-width='2'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E") right 6px center / 16px no-repeat; }

/* ------------------------------------------------------------------ header */
.top {
  position: sticky; top: 0; z-index: 50; flex: none;
  display: flex; align-items: center; gap: 22px;
  height: var(--top-h); padding: 0 var(--gutter);
  background: rgba(7, 8, 10, .82); -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.top__logo img { width: auto; height: 19px; }
.top__nav { display: flex; gap: 4px; }
.top__nav a { padding: 7px 12px; border-radius: 999px; color: var(--text-2); font-size: 13px; font-weight: 600; transition: color .2s, background .2s; }
.top__nav a:hover { color: var(--text); background: var(--surface-3); }
.top__right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
@media (max-width: 760px) { .top__nav { display: none; } }

/* ------------------------------------------------------------------ landing */
.cover--grid {
  background:
    radial-gradient(50rem 32rem at 92% -12%, rgba(var(--signal-rgb), .08), transparent 60%),
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 76px 76px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 76px 76px,
    var(--bg);
}
.hero { padding: clamp(48px, 9vw, 110px) 0 clamp(56px, 8vw, 100px); border-bottom: 1px solid var(--line); }
.hero__grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(28px, 5vw, 64px); align-items: center; }
.hero__facts { display: grid; gap: 8px; margin-top: 26px; color: var(--text-2); }
.hero__facts li { display: flex; align-items: center; gap: 9px; }
.hero__facts .ic { width: 15px; height: 15px; color: var(--signal); }
@media (max-width: 900px) { .hero__grid { grid-template-columns: 1fr; } }

.drop {
  position: relative; display: grid; min-height: 360px; padding: 10px; border-radius: 26px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .03), transparent 50%), var(--surface);
  border: 1px solid var(--line-2); cursor: pointer;
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, .9);
  transition: border-color .25s, transform .4s var(--ease);
}
.drop:hover, .drop.is-over { border-color: rgba(var(--signal-rgb), .5); }
.drop.is-over { transform: scale(1.01); }
.drop__inner {
  display: grid; place-items: center; align-content: center; gap: 6px; padding: 30px 18px; text-align: center;
  border: 1.5px dashed var(--line-3); border-radius: 18px;
}
.drop__icon { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 12px; border-radius: 18px; background: rgba(var(--signal-rgb), .1); color: var(--signal); }
.drop__icon .ic { width: 30px; height: 30px; }
.drop__title { font: 500 clamp(18px, 2.2vw, 22px)/1.25 var(--display); letter-spacing: -.03em; }
.drop__intents { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 22px; }

.section { padding: clamp(64px, 9vw, 120px) 0; border-bottom: 1px solid var(--line); }
.section--alt { background: var(--surface); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 6vw, 80px); align-items: start; }
.split--center { align-items: center; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
.steps { display: grid; gap: 18px; margin-top: 30px; }
.steps li { display: grid; grid-template-columns: 44px 1fr; gap: 12px; color: var(--text-2); }
.steps b { color: var(--text); }
.steps__n { color: var(--signal); font-size: 13px; padding-top: 2px; }

.layers { position: relative; height: 420px; perspective: 1400px; }
.layers__sheet {
  position: absolute; left: 50%; top: 50%; width: 250px; height: 330px; margin: -165px 0 0 -125px;
  border-radius: 6px; border: 1px solid var(--line-2);
  transform: rotateX(56deg) rotateZ(-38deg); transform-style: preserve-3d;
  transition: transform .9s var(--ease);
}
.layers__sheet em { position: absolute; right: -86px; top: 8px; font-style: normal; font-size: 11px; color: var(--muted); transform: rotateZ(38deg) rotateX(-56deg); }
.layers__sheet--text { background: #f4f3ef; translate: 0 70px; padding: 34px 26px; display: grid; gap: 12px; align-content: start; }
.layers__sheet--text span { height: 7px; border-radius: 3px; background: #2a2b2f; opacity: .78; }
.layers__sheet--text span.short { width: 62%; }
.layers__sheet--table { background: rgba(255, 255, 255, .05); translate: 0 0; display: grid; align-content: center; gap: 0; padding: 0 26px; }
.layers__sheet--table i { display: block; height: 30px; border: 1.5px solid rgba(236, 235, 230, .5); border-top: 0; }
.layers__sheet--table i:first-child { border-top: 1.5px solid rgba(236, 235, 230, .5); }
.layers__sheet--stamp { background: rgba(91, 108, 255, .05); translate: 0 -70px; border-color: rgba(91, 108, 255, .35); }
.layers__sheet--stamp svg { position: absolute; left: 34px; bottom: 30px; width: 120px; height: 120px; }
.layers:hover .layers__sheet--text { transform: rotateX(56deg) rotateZ(-38deg) translateZ(-20px); }
.layers:hover .layers__sheet--stamp { transform: rotateX(56deg) rotateZ(-38deg) translateZ(30px); }
@media (prefers-reduced-motion: reduce) { .layers__sheet { transition: none; } }

.tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 36px; }
@media (max-width: 1000px) { .tools { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .tools { grid-template-columns: 1fr; } }
.tool {
  display: grid; gap: 8px; align-content: start; padding: 22px 20px; min-height: 178px; border-radius: 18px;
  border: 1px solid var(--line); background: var(--bg); transition: border-color .25s, transform .4s var(--ease);
}
.tool:hover { border-color: rgba(var(--signal-rgb), .45); transform: translateY(-2px); }
.tool .ic { width: 24px; height: 24px; color: var(--signal); margin-bottom: 8px; }
.tool b { font: 500 16px/1.25 var(--display); letter-spacing: -.03em; }
.tool span { color: var(--text-2); font-size: 13.5px; }

.facts { display: grid; gap: 12px; }
.facts li { display: flex; align-items: baseline; gap: 18px; padding: 20px 22px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); }
.facts b { min-width: 64px; color: var(--signal); font-size: 26px; font-weight: 500; }
.facts span { color: var(--text-2); }

.faq { border-bottom: 1px solid var(--line); }
.faq:first-of-type { margin-top: 30px; border-top: 1px solid var(--line); }
.faq summary { display: flex; justify-content: space-between; gap: 16px; padding: 20px 0; cursor: pointer; font-weight: 600; font-size: 16px; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--signal); font: 400 22px/1 var(--mono); transition: transform .3s var(--ease); }
.faq[open] summary::after { transform: rotate(45deg); }
.faq p { padding: 0 0 22px; color: var(--text-2); max-width: 70ch; }
.foot { padding: 36px 0 48px; }
.foot__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.foot img { height: 15px; width: auto; opacity: .8; }

.dropveil { position: fixed; inset: 0; z-index: 700; display: grid; place-items: center; background: rgba(7, 8, 10, .82); border: 2px dashed rgba(var(--signal-rgb), .6); pointer-events: none; }
.dropveil p { font: 500 22px/1 var(--display); letter-spacing: -.03em; color: var(--signal); }

/* ------------------------------------------------------------------ editor shell */
.app { display: grid; grid-template-rows: var(--top-h) var(--tools-h) 1fr; height: 100vh; height: 100dvh; }
.app .top { gap: 12px; }
.app__mark { width: 28px; height: 28px; border-radius: 8px; }
.app__name { min-width: 0; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 14px; }
.app__meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
@media (max-width: 760px) { .app__meta, .hide-sm { display: none; } }

.bar {
  display: flex; align-items: center; gap: 4px; padding: 0 var(--gutter); overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--line); background: var(--surface);
}
.bar::-webkit-scrollbar { display: none; }
.bar__sep { flex: none; width: 1px; height: 22px; margin: 0 8px; background: var(--line-2); }
.bar__tool { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 11px; border-radius: 10px; color: var(--text-2); font-size: 13px; font-weight: 600; white-space: nowrap; transition: color .2s, background .2s; flex: none; }
.bar__tool:hover { color: var(--text); background: var(--surface-4); }
.bar__tool.is-on { color: var(--signal); background: rgba(var(--signal-rgb), .1); }
.bar__tool kbd { font: 500 10px/1 var(--mono); color: var(--muted); padding: 3px 5px; border: 1px solid var(--line-2); border-radius: 5px; }
.bar__zoom { min-width: 48px; text-align: center; font: 500 12px/1 var(--mono); color: var(--text-2); }
.bar__spacer { flex: 1; }

.work { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 0; }
@media (max-width: 760px) { .work { grid-template-columns: 1fr; } .side { display: none; } }
.side { overflow-y: auto; border-right: 1px solid var(--line); background: var(--surface); padding: 14px 14px 30px; }
.thumbs { display: grid; gap: 14px; }
.thumb { position: relative; display: grid; gap: 6px; justify-items: center; cursor: grab; border-radius: 10px; padding: 6px; transition: background .2s; }
.thumb:hover { background: var(--surface-3); }
.thumb.is-current { background: var(--surface-4); }
.thumb.is-drag { opacity: .4; }
.thumb.is-target::before { content: ""; position: absolute; left: 6px; right: 6px; top: -9px; height: 3px; border-radius: 2px; background: var(--signal); }
.thumb canvas { width: 100%; height: auto; background: #fff; border-radius: 3px; box-shadow: 0 6px 20px -8px rgba(0, 0, 0, .8); }
.thumb__n { font: 500 11px/1 var(--mono); color: var(--muted); }
.thumb__acts { position: absolute; top: 10px; right: 10px; display: flex; gap: 4px; opacity: 0; transition: opacity .2s; }
.thumb:hover .thumb__acts, .thumb:focus-within .thumb__acts { opacity: 1; }
.thumb__acts button { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: rgba(7, 8, 10, .86); color: var(--text); border: 1px solid var(--line-2); }
.thumb__acts button:hover { color: var(--signal); }
.thumb__acts button.is-danger:hover { color: var(--alert); }
.thumb__acts .ic { width: 15px; height: 15px; }
.side__add { width: 100%; margin-top: 16px; }

.stage { position: relative; overflow: auto; background: #1a1d22 radial-gradient(60rem 40rem at 50% -10%, rgba(255, 255, 255, .03), transparent 70%); overscroll-behavior: contain; }
.pages { display: grid; justify-content: center; gap: 22px; padding: 26px 20px 120px; }
.pagebox { position: relative; margin: 0 auto; }
.pagebox__label { position: absolute; left: 0; top: -18px; font: 500 11px/1 var(--mono); color: var(--muted); }
.pageframe { position: absolute; left: 0; top: 0; transform-origin: 0 0; background: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .04), 0 18px 50px -14px rgba(0, 0, 0, .85); }
.pageframe > canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.layer { position: absolute; inset: 0; }
.stage[data-tool="text"] .layer, .stage[data-tool="rect"] .layer, .stage[data-tool="highlight"] .layer, .stage[data-tool="place"] .layer { cursor: crosshair; touch-action: none; }

/* editable pieces of the page's own text */
.piece { position: absolute; border-radius: 2px; cursor: text; }
.stage[data-tool="edit"] .piece { outline: 1px dashed rgba(70, 90, 255, .32); }
.stage[data-tool="edit"] .piece:hover { outline: 1.5px solid rgba(70, 90, 255, .75); background: rgba(70, 90, 255, .05); }
.stage:not([data-tool="edit"]) .piece:not(.is-edited) { pointer-events: none; }
.mask { position: absolute; pointer-events: none; }
.over { position: absolute; pointer-events: none; mix-blend-mode: multiply; }
.ed {
  position: absolute; color: #000; white-space: pre-wrap; overflow-wrap: break-word; outline: none;
  caret-color: #2340ff; font-kerning: normal; font-variant-ligatures: none;
}
.ed[contenteditable="true"] { box-shadow: 0 0 0 1.5px #3a55ff, 0 0 0 5px rgba(58, 85, 255, .15); background: rgba(255, 255, 255, .0); }
.ed::selection, .ed *::selection { background: rgba(58, 85, 255, .28); color: inherit; }
.stage[data-tool="edit"] .ed:not([contenteditable="true"]) { cursor: text; }
.ed.is-edited { pointer-events: auto; }

/* objects added by the user */
.obj { position: absolute; touch-action: none; }
.obj img { width: 100%; height: 100%; object-fit: fill; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.obj--text .ed { position: static; min-height: 100%; }
.obj--highlight { mix-blend-mode: multiply; }
.obj.is-sel { outline: 1.5px solid #3a55ff; outline-offset: 1px; }
.obj.is-sel::after { content: ""; position: absolute; inset: -6px; pointer-events: none; }
.handle { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; border-radius: 4px; background: #fff; border: 2px solid #3a55ff; cursor: nwse-resize; touch-action: none; }
.obj:not(.is-sel) .handle { display: none; }
.draft { position: absolute; border: 1.5px dashed #3a55ff; background: rgba(58, 85, 255, .06); pointer-events: none; }

.scanbar {
  position: absolute; left: 50%; top: 14px; z-index: 5; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 999px;
  background: rgba(11, 13, 16, .94); color: var(--text); border: 1px solid var(--line-2); font-size: 13px; white-space: nowrap;
  box-shadow: 0 16px 40px -14px rgba(0, 0, 0, .8);
}

/* properties bar */
.props {
  position: fixed; left: 50%; bottom: 22px; z-index: 60; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px; max-width: calc(100% - 24px); padding: 7px; overflow-x: auto;
  border-radius: 16px; border: 1px solid var(--line-2); background: rgba(16, 19, 24, .96);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: 0 24px 60px -16px rgba(0, 0, 0, .9);
}
.props .field { width: auto; min-height: 34px; padding: 5px 26px 5px 9px; }
.props input[type="number"].field { width: 68px; padding-right: 6px; }
.props input[type="color"] { width: 34px; height: 34px; padding: 3px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg); cursor: pointer; }
.props__label { padding: 0 6px 0 8px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.props__sep { width: 1px; height: 22px; margin: 0 4px; background: var(--line-2); flex: none; }

/* menus and dialogs */
.menu { position: fixed; z-index: 400; min-width: 260px; padding: 6px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface-3); box-shadow: 0 24px 60px -12px rgba(0, 0, 0, .9); }
.menu button { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.menu button:hover { background: var(--surface-4); }
.menu button .ic { margin-top: 2px; color: var(--signal); }
.menu small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

.modal {
  width: min(640px, 100% - 24px); max-height: calc(100dvh - 48px); margin: auto;
  padding: 0; border: 1px solid var(--line-2); border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .025), transparent 140px), var(--surface); color: var(--text);
  box-shadow: 0 40px 100px -20px rgba(0, 0, 0, .9); overflow: auto;
}
.modal[open] { animation: modal-in .28s var(--ease); }
@keyframes modal-in { from { opacity: 0; translate: 0 10px; } }
.modal::backdrop { background: rgba(3, 4, 5, .72); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.modal__body { padding: 22px clamp(16px, 3vw, 26px) 24px; display: grid; gap: 16px; }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal__title { font: 500 20px/1.25 var(--display); letter-spacing: -.035em; }
.modal__foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.tabs { display: flex; gap: 6px; }
.pad { position: relative; height: 220px; border-radius: 14px; background: #fff; touch-action: none; cursor: crosshair; overflow: hidden; }
.pad canvas { width: 100%; height: 100%; }
.pad__line { position: absolute; left: 24px; right: 24px; bottom: 54px; border-top: 1px dashed #c4c6cc; pointer-events: none; }
.pad__hint { position: absolute; left: 24px; bottom: 30px; color: #9a9ca3; font-size: 12px; pointer-events: none; }
.swatches { display: flex; gap: 8px; align-items: center; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; }
.swatch.is-on { border-color: var(--signal); }
.pick { display: grid; place-items: center; min-height: 200px; padding: 18px; border-radius: 14px; border: 1.5px dashed var(--line-3); background: #fff; color: #555; text-align: center; cursor: pointer; }
.pick img { max-height: 240px; width: auto; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--signal); }
.saved { display: flex; flex-wrap: wrap; gap: 8px; }
.saved button { width: 120px; height: 56px; padding: 6px; border-radius: 10px; background: #fff; border: 2px solid transparent; }
.saved button:hover { border-color: var(--signal); }
.saved img { width: 100%; height: 100%; object-fit: contain; }

/* toast with progress */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 600; display: flex; align-items: center; gap: 14px;
  max-width: min(560px, calc(100% - 32px)); padding: 12px 14px 12px 18px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--surface-4); color: var(--text); font-size: 13px;
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, .9);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: opacity .25s, transform .35s var(--ease);
}
.toast.is-on { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast.is-alert { border-color: rgba(var(--alert-rgb), .5); }
.toast__spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(var(--signal-rgb), .25); border-top-color: var(--signal); animation: spin .8s linear infinite; flex: none; }
.toast__btn { flex: none; padding: 6px 10px; border-radius: 8px; color: var(--signal); font-weight: 600; }
@keyframes spin { to { transform: rotate(360deg); } }
.props:not([hidden]) ~ .toast { bottom: 84px; }
