:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #f1efea;
  --ink: #1b1a17;
  --ink-2: #5d5951;
  --ink-3: #8c877e;
  --line: #e6e2da;
  --accent: #e5484d;
  --accent-ink: #ffffff;
  --accent-soft: #fde8e8;
  --pro: #6e56cf;
  --pro-soft: #efeafd;
  --ok: #1f9d55;
  --ok-soft: #e3f5ea;
  --warn: #b25e09;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 18, 14, .04), 0 6px 24px rgba(20, 18, 14, .06);
  --font: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141311;
    --surface: #1c1b18;
    --surface-2: #24221e;
    --ink: #f1efea;
    --ink-2: #b9b4aa;
    --ink-3: #8a857c;
    --line: #2f2c27;
    --accent: #f2555a;
    --accent-soft: #3a1d1e;
    --pro: #9d8cf0;
    --pro-soft: #29233f;
    --ok: #3ccf7c;
    --ok-soft: #173023;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
img, canvas { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.site-header .container { display: flex; align-items: center; gap: 16px; height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; font-size: 19px; letter-spacing: -.02em; text-decoration: none; }
.logo-mark { width: 26px; height: 30px; border-radius: 5px 11px 5px 5px; background: var(--accent); position: relative; box-shadow: inset 0 -7px 0 rgba(0,0,0,.12); }
.logo-mark::after { content: ""; position: absolute; top: 0; right: 0; width: 10px; height: 10px; background: rgba(255,255,255,.55); border-radius: 0 9px 0 4px; }
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav a, .nav button.link { padding: 8px 12px; border-radius: 9px; text-decoration: none; color: var(--ink-2); font-weight: 550; font-size: 15px; background: none; border: 0; cursor: pointer; }
.nav a:hover, .nav button.link:hover { color: var(--ink); background: var(--surface-2); }
.nav .lang { font-size: 13px; font-weight: 700; letter-spacing: .04em; }
.nav-tools { position: relative; }
.menu { position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); width: min(560px, 92vw); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.menu a { display: flex; gap: 10px; align-items: center; padding: 10px; color: var(--ink); font-size: 14px; }
.menu .ico { width: 30px; height: 30px; font-size: 15px; }
@media (max-width: 720px) {
  .nav .hide-sm { display: none; }
  .menu { position: fixed; top: 64px; left: 12px; right: 12px; width: auto; transform: none; grid-template-columns: 1fr; max-height: 70vh; overflow: auto; }
}

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 650; font-size: 15px; text-decoration: none; cursor: pointer; transition: transform .06s ease, background .15s, border-color .15s, opacity .15s; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { border-color: var(--accent); filter: brightness(1.05); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn-pro { background: var(--pro); border-color: var(--pro); color: #fff; }
.btn-lg { padding: 14px 22px; font-size: 16px; border-radius: 12px; }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; padding: 3px 7px; border-radius: 6px; background: var(--pro-soft); color: var(--pro); vertical-align: middle; }
.badge.free { background: var(--ok-soft); color: var(--ok); }

/* Hero */
.hero { padding: 64px 0 32px; text-align: center; }
.hero h1 { font-size: clamp(34px, 6vw, 58px); line-height: 1.04; letter-spacing: -.035em; margin: 0 auto 16px; max-width: 820px; font-weight: 800; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p.lead { font-size: clamp(17px, 2.2vw, 20px); color: var(--ink-2); max-width: 620px; margin: 0 auto 24px; }
.trust { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: center; color: var(--ink-2); font-size: 14px; }
.trust span::before { content: "✓ "; color: var(--ok); font-weight: 800; }

/* Tool grid */
.section { padding: 32px 0 56px; }
.section h2 { font-size: 28px; letter-spacing: -.02em; margin: 0 0 18px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.tool-card { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; transition: transform .15s ease, box-shadow .15s ease, border-color .15s; }
.tool-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: transparent; }
.tool-card h3 { margin: 4px 0 0; font-size: 17px; letter-spacing: -.01em; }
.tool-card p { margin: 0; color: var(--ink-2); font-size: 14px; }
.tool-card .badge { position: absolute; top: 16px; right: 16px; }
.ico { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-size: 20px; background: var(--accent-soft); color: var(--accent); flex: none; }
.ico.pro { background: var(--pro-soft); color: var(--pro); }
.ico svg { width: 55%; height: 55%; }

/* Tool page */
.tool-head { padding: 40px 0 20px; text-align: center; }
.tool-head .ico { margin: 0 auto 14px; width: 56px; height: 56px; border-radius: 15px; }
.tool-head h1 { font-size: clamp(30px, 5vw, 44px); letter-spacing: -.03em; margin: 0 0 8px; line-height: 1.1; }
.tool-head p { color: var(--ink-2); font-size: 18px; margin: 0 auto; max-width: 620px; }
.workspace { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 20px; margin-bottom: 40px; }
.dropzone { border: 2px dashed var(--line); border-radius: 14px; padding: 48px 20px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; background: var(--surface-2); }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .btn { margin: 4px 0 12px; }
.dropzone .hint { color: var(--ink-3); font-size: 14px; }
.dropzone strong { display: block; font-size: 18px; margin-bottom: 6px; }

.work { display: grid; grid-template-columns: 1fr 300px; gap: 20px; }
@media (max-width: 860px) { .work { grid-template-columns: 1fr; } }
.panel { background: var(--surface-2); border-radius: 14px; padding: 16px; }
.panel h3 { margin: 0 0 12px; font-size: 15px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label, .field .label { font-size: 13px; font-weight: 650; color: var(--ink-2); }
.field input[type=text], .field input[type=password], .field input[type=number], .field input[type=email], .field select, .field textarea, .input {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); outline: none; }
.field input:focus, .field select:focus, .input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field input[type=range] { width: 100%; accent-color: var(--accent); }
.field input[type=color] { width: 44px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 2px; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; background: var(--surface); padding: 4px; border-radius: 10px; border: 1px solid var(--line); }
.seg button { flex: 1; border: 0; background: transparent; padding: 7px 8px; border-radius: 7px; font-weight: 600; font-size: 13px; cursor: pointer; color: var(--ink-2); min-width: 0; }
.seg button.on { background: var(--ink); color: var(--bg); }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }

.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-item { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.file-item[draggable=true] { cursor: grab; }
.file-item.dragging { opacity: .4; }
.file-item .thumb { width: 44px; height: 56px; border-radius: 6px; background: var(--surface-2); flex: none; overflow: hidden; display: grid; place-items: center; font-size: 11px; color: var(--ink-3); border: 1px solid var(--line); }
.file-item .thumb canvas, .file-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-item .meta { flex: 1; min-width: 0; }
.file-item .name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .sub { font-size: 12px; color: var(--ink-3); }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid transparent; background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--ink-2); flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
.page { position: relative; background: var(--surface); border: 2px solid var(--line); border-radius: 10px; padding: 8px; text-align: center; cursor: pointer; user-select: none; transition: border-color .12s, opacity .12s; }
.page canvas { display: block; margin: 0 auto; max-height: 150px; width: auto; box-shadow: 0 1px 4px rgba(0,0,0,.15); background: #fff; transition: transform .2s; }
.page .pnum { font-size: 12px; color: var(--ink-3); margin-top: 6px; font-weight: 600; }
.page.sel { border-color: var(--accent); }
.page.del { opacity: .35; }
.page.del canvas { filter: grayscale(1); }
.page .tools { position: absolute; top: 6px; right: 6px; display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.page:hover .tools, .page:focus-within .tools { opacity: 1; }
.page .tools button { width: 26px; height: 26px; border: 0; border-radius: 7px; background: var(--ink); color: var(--bg); cursor: pointer; font-size: 13px; display: grid; place-items: center; }
@media (hover: none) { .page .tools { opacity: 1; } }
.page.dragging { opacity: .3; }
.page.drop-before { box-shadow: -4px 0 0 var(--accent); }

.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 14px; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.status { font-size: 14px; color: var(--ink-2); margin-top: 8px; }
.status:empty { margin: 0; }
.error-box { background: var(--accent-soft); color: var(--accent); padding: 10px 14px; border-radius: 10px; font-size: 14px; font-weight: 550; margin-top: 12px; }
.result { text-align: center; padding: 36px 16px; }
.result .done { width: 60px; height: 60px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; margin: 0 auto 14px; font-size: 28px; font-weight: 800; }
.result h2 { margin: 0 0 6px; }
.result .stats { color: var(--ink-2); margin-bottom: 18px; }

.pro-gate { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 12px; background: var(--pro-soft); margin-bottom: 16px; flex-wrap: wrap; }
.pro-gate p { margin: 0; flex: 1; min-width: 200px; font-size: 14px; }

/* Signature */
.sig-pad { width: 100%; height: 160px; background: #fff; border: 1px solid var(--line); border-radius: 10px; touch-action: none; cursor: crosshair; display: block; }
.place-wrap { position: relative; display: inline-block; max-width: 100%; }
.place-wrap canvas.page-canvas { display: block; max-width: 100%; max-height: 78vh; width: auto; height: auto; box-shadow: var(--shadow); background: #fff; cursor: crosshair; }
.place-wrap .sig-ghost { position: absolute; pointer-events: none; outline: 2px dashed var(--accent); outline-offset: 2px; }

/* Content */
.content { max-width: 760px; margin: 0 auto; padding: 8px 0 56px; }
.content h2 { font-size: 24px; letter-spacing: -.02em; margin: 36px 0 12px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; counter-reset: s; padding: 0; list-style: none; }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; counter-increment: s; font-size: 15px; }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--bg); font-weight: 750; font-size: 14px; margin-bottom: 8px; }
@media (max-width: 640px) { .steps { grid-template-columns: 1fr; } }
details.faq { border-bottom: 1px solid var(--line); padding: 14px 0; }
details.faq summary { font-weight: 650; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
details.faq summary::after { content: "+"; color: var(--ink-3); font-weight: 400; font-size: 22px; line-height: 1; }
details.faq[open] summary::after { content: "–"; }
details.faq p { margin: 10px 0 0; color: var(--ink-2); }
.related { display: flex; flex-wrap: wrap; gap: 8px; }
.related a { padding: 8px 14px; border: 1px solid var(--line); border-radius: 99px; text-decoration: none; font-size: 14px; font-weight: 550; background: var(--surface); }
.related a:hover { border-color: var(--ink-3); }

/* Pricing */
.pricing { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; max-width: 820px; margin: 0 auto; }
@media (max-width: 720px) { .pricing { grid-template-columns: 1fr; } }
.plan { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px; display: flex; flex-direction: column; }
.plan.featured { border: 2px solid var(--pro); box-shadow: var(--shadow); position: relative; }
.plan h3 { margin: 0; font-size: 20px; }
.plan .price { font-size: 44px; font-weight: 800; letter-spacing: -.03em; margin: 10px 0 2px; }
.plan .price small { font-size: 16px; color: var(--ink-2); font-weight: 550; letter-spacing: 0; }
.plan .note { color: var(--ink-3); font-size: 14px; min-height: 1.5em; }
.plan ul { list-style: none; padding: 0; margin: 20px 0 24px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.plan li { padding-left: 26px; position: relative; font-size: 15px; }
.plan li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 800; }
.plan li.no { color: var(--ink-3); }
.plan li.no::before { content: "–"; color: var(--ink-3); }
.toggle { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 4px; margin: 0 auto 24px; }
.toggle button { border: 0; background: transparent; padding: 8px 16px; border-radius: 99px; font-weight: 650; cursor: pointer; color: var(--ink-2); }
.toggle button.on { background: var(--ink); color: var(--bg); }
.save-tag { color: var(--ok); font-size: 12px; font-weight: 750; margin-left: 4px; }

/* Account / auth */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 32px; box-shadow: var(--shadow); text-align: center; }
.auth-card .logo { margin-bottom: 20px; }
.auth-card h1 { font-size: 24px; margin: 0 0 6px; letter-spacing: -.02em; }
.auth-card form { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; }
.account-grid { display: grid; gap: 16px; max-width: 640px; margin: 0 auto; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--ink-2); }
.notice { padding: 14px 16px; border-radius: 12px; background: var(--ok-soft); color: var(--ok); font-weight: 600; margin-bottom: 16px; }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(10, 9, 8, .5); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade .15s ease; }
.modal { width: 100%; max-width: 420px; background: var(--surface); border-radius: 18px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.3); position: relative; animation: pop .18s ease; }
.modal h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -.02em; }
.modal .close { position: absolute; top: 12px; right: 12px; }
.modal form { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.code-input { font-size: 28px !important; letter-spacing: 10px; text-align: center; font-weight: 700; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 36px 0; color: var(--ink-2); font-size: 14px; }
.site-footer .container { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--ink); }
.prose { max-width: 720px; margin: 0 auto; padding: 40px 0 64px; }
.prose h1 { letter-spacing: -.03em; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 600; z-index: 200; box-shadow: var(--shadow); font-size: 14px; max-width: calc(100vw - 32px); }
