/* DocPro web app: "Sticker Pop" design system. Light + dark. */
@font-face { font-family: "Bricolage Grotesque"; src: url("../fonts/BricolageGrotesque.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/JetBrainsMono.woff2") format("woff2"); font-weight: 100 800; font-display: swap; }

:root {
  --chassis: #EFEBE2;
  --card: #FFFDF8;
  --ink: #111111;
  --outline: #111111;
  --muted: #5A5853;
  --label: #3C3A36;
  --shadow: #111111;
  --orange: #FF5B1A;
  --lime: #D4FF3A;
  --sticker-line: #111111;
  --field: #FFFDF8;
  --hover: #F6F1E6;
  --danger: #D92D20;
  --ok: #1A7F37;
  --cat-pdf: #FF6B6B; --cat-sign: #B197FC; --cat-scan: #3BC9DB;
  --cat-images: #F783AC; --cat-convert: #FFD43B; --cat-security: #69DB7C;
  --font: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --gutter: 16px;
  --maxw: 1120px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --chassis: #17161A; --card: #232127; --ink: #F2F0EB; --outline: #F2F0EB;
    --muted: #B3B0A8; --label: #D6D3CB; --shadow: #000000; --field: #1C1B20; --hover: #2C2A32;
    --sticker-line: #0B0B0C; --danger: #FF8A80; --ok: #7EE08F; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --chassis: #17161A; --card: #232127; --ink: #F2F0EB; --outline: #F2F0EB;
  --muted: #B3B0A8; --label: #D6D3CB; --shadow: #000000; --field: #1C1B20; --hover: #2C2A32;
  --sticker-line: #0B0B0C; --danger: #FF8A80; --ok: #7EE08F; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--chassis); color: var(--ink);
  font: 400 16px/1.5 var(--font); min-height: 100vh; overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.has-modal { overflow: hidden; }
h1, h2, h3, h4 { font-family: var(--font); line-height: 1.12; margin: 0; letter-spacing: -.015em; font-weight: 800; }
h1 { font-size: clamp(30px, 6vw, 52px); }
h2 { font-size: 24px; } h3 { font-size: 19px; }
p { margin: 0 0 12px; }
a { color: inherit; }
img, svg, canvas { max-width: 100%; }
.mono, .eyebrow, .label, .chip-count { font-family: var(--mono); }
.muted { color: var(--muted); }
.mono { font-size: 12px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.eyebrow, .label {
  font: 600 11px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--label);
  display: flex; align-items: center; gap: 6px;
}
.label { justify-content: space-between; margin-bottom: 6px; }

:focus-visible { outline: 3px solid var(--lime); outline-offset: 0; box-shadow: 0 0 0 5px var(--ink); border-radius: 12px; }
:focus:not(:focus-visible) { outline: none; }

.ic { display: inline-flex; width: 22px; height: 22px; flex: none; }
.ic svg { width: 100%; height: 100%; }

/* ------------------------------------------------------------ layout */
.shell { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter) 64px; }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--chassis); border-bottom: 2px solid var(--outline); }
.topbar-in { max-width: var(--maxw); margin: 0 auto; padding: 10px var(--gutter); display: flex; align-items: center; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; text-decoration: none; letter-spacing: -.02em; flex: none; }
.brand img { width: 30px; height: 30px; border-radius: 9px; border: 2px solid var(--outline); display: block; }
.topbar .spacer { flex: 1; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { text-decoration: none; font-weight: 600; font-size: 14px; padding: 6px 12px; border-radius: 99px; border: 2px solid transparent; }
.nav a:hover { background: var(--hover); }
.nav a.is-active { background: var(--lime); border-color: #111; color: #111; }
.search { position: relative; flex: 1; max-width: 360px; margin-inline-start: auto; }
.search .ic { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; pointer-events: none; }
.search .input { padding-inline-start: 38px; height: 42px; }
.icon-btn { width: 42px; height: 42px; padding: 0; justify-content: center; flex: none; }
@media (max-width: 640px) { .nav { display: none; } .brand span { display: none; } }

/* -------------------------------------------------------------- cards */
.card { background: var(--card); border: 2px solid var(--outline); border-radius: 14px; box-shadow: 3px 3px 0 var(--shadow); padding: 16px; }
.card.flat { box-shadow: none; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 520px) { .grid-2 { grid-template-columns: 1fr; } }

/* ----------------------------------------------------------- stickers */
.sticker { display: inline-flex; align-items: center; justify-content: center; flex: none; background: var(--cat-pdf); color: #111; border: 2px solid var(--sticker-line); border-radius: 12px; }
.sticker .ic { width: 60%; height: 60%; }
.sticker-sm { width: 36px; height: 36px; border-radius: 10px; }
.sticker-md { width: 48px; height: 48px; }
.sticker-lg { width: 60px; height: 60px; border-radius: 14px; }
[data-cat="pdf"] { --c: var(--cat-pdf); } [data-cat="sign"] { --c: var(--cat-sign); } [data-cat="scan"] { --c: var(--cat-scan); }
[data-cat="images"] { --c: var(--cat-images); } [data-cat="convert"] { --c: var(--cat-convert); } [data-cat="security"] { --c: var(--cat-security); }
.sticker[data-cat] { background: var(--c); }

/* ------------------------------------------------------------ buttons */
.btn {
  --bg: var(--card); --fg: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 18px;
  font: 700 15px/1.2 var(--font); color: var(--fg); background: var(--bg); border: 2px solid var(--outline); border-radius: 12px;
  box-shadow: 3px 3px 0 var(--shadow); cursor: pointer; text-decoration: none; transition: transform .08s, box-shadow .08s;
}
.btn .ic { width: 20px; height: 20px; }
.btn:hover { background: var(--hover); }
.btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--shadow); }
.btn-primary { --bg: var(--orange); --fg: #111; border-color: var(--sticker-line); box-shadow: 4px 4px 0 var(--shadow); }
.btn-primary:hover { background: #FF6E35; }
.btn-primary:active:not(:disabled) { box-shadow: 2px 2px 0 var(--shadow); }
.btn-ink { --bg: var(--ink); --fg: var(--card); }
.btn-ink:hover { background: var(--ink); filter: brightness(1.15); }
.btn-ghost { box-shadow: none; --bg: transparent; }
.btn-ghost:hover { background: var(--hover); }
.btn-ghost:active:not(:disabled) { box-shadow: none; transform: translate(1px, 1px); }
.btn-danger { --bg: var(--danger); --fg: #111; }
.btn-sm { min-height: 36px; padding: 4px 12px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn.is-busy { cursor: progress; }

/* -------------------------------------------------------------- chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 14px; font: 600 14px/1 var(--font);
  color: var(--ink); background: var(--card); border: 2px solid var(--outline); border-radius: 99px; cursor: pointer;
}
.chip .ic { width: 16px; height: 16px; }
.chip:hover { background: var(--hover); }
.chip[aria-pressed="true"], .chip.is-on, .chip[aria-checked="true"] { background: var(--ink); color: var(--card); }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 4px 4px 8px; margin: 0 -4px; scrollbar-width: thin; }
.chip-row .chip { flex: none; }

/* ------------------------------------------------------------- inputs */
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 8px 12px; font: 500 16px/1.3 var(--font); color: var(--ink);
  background: var(--field); border: 2px solid var(--outline); border-radius: 12px;
}
.textarea { min-height: 96px; resize: vertical; }
.input::placeholder { color: var(--muted); }
.input[type="color"] { padding: 3px; width: 64px; cursor: pointer; }
.select { appearance: none; padding-inline-end: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
[dir="rtl"] .select { background-position: left 10px center; }
.field { display: flex; flex-direction: column; min-width: 0; }
.hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; min-height: 32px; }
.check input { width: 22px; height: 22px; accent-color: var(--orange); flex: none; }

.range { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; cursor: pointer; }
.range::-webkit-slider-runnable-track { height: 10px; background: var(--card); border: 2px solid var(--outline); border-radius: 99px; }
.range::-moz-range-track { height: 10px; background: var(--card); border: 2px solid var(--outline); border-radius: 99px; }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; margin-top: -9px; background: var(--orange); border: 2px solid var(--sticker-line); border-radius: 50%; box-shadow: 2px 2px 0 var(--shadow); }
.range::-moz-range-thumb { width: 20px; height: 20px; background: var(--orange); border: 2px solid var(--sticker-line); border-radius: 50%; box-shadow: 2px 2px 0 var(--shadow); }
.range-out { font-weight: 600; color: var(--ink); text-transform: none; letter-spacing: 0; }

/* ----------------------------------------------------------- dropzone */
.dropzone {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 40px 20px; cursor: pointer;
  background: var(--card); border: 2px dashed var(--outline); border-radius: 14px; transition: background .12s;
}
.dropzone:hover, .dropzone.is-over { background: var(--lime); color: #111; border-style: solid; }
.dropzone.is-over .dropzone-sub, .dropzone:hover .dropzone-sub, .dropzone:hover .dropzone-hint { color: #111; }
.dropzone-ic { width: 56px; height: 56px; display: grid; place-items: center; background: #111; color: var(--lime); border-radius: 14px; margin-bottom: 6px; }
.dropzone-ic .ic { width: 28px; height: 28px; }
.dropzone-title { font-weight: 800; font-size: 22px; letter-spacing: -.01em; }
.dropzone-sub { color: var(--muted); }
.dropzone-hint { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-top: 6px; }
.privacy-note { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; color: var(--muted); margin: 16px 0 0; text-align: center; }
.privacy-note .ic { width: 16px; height: 16px; }

/* ------------------------------------------------------ misc components */
.badge-pro { font: 600 10px/1 var(--mono); letter-spacing: .1em; padding: 3px 6px; border: 2px solid var(--outline); border-radius: 6px; background: var(--lime); color: #111; border-color: #111; vertical-align: middle; }
.badge { font: 600 10px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; padding: 3px 6px; border: 2px solid var(--outline); border-radius: 6px; background: var(--card); }
.notice { padding: 12px 14px; border: 2px solid var(--outline); border-radius: 12px; background: var(--card); font-size: 15px; }
.notice-error { background: #FFD9D4; color: #111; border-color: #111; }
.notice-warn { background: #FFF1B8; color: #111; border-color: #111; }
.notice-ok { background: #D4F8DA; color: #111; border-color: #111; }
.notice-info { background: var(--card); }

.filebar { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
.filebar-text { flex: 1; min-width: 0; }
.filebar-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px; background: var(--card); border: 2px solid var(--outline); border-radius: 14px; box-shadow: 3px 3px 0 var(--shadow); }
.toolbar .sep { width: 2px; align-self: stretch; background: var(--outline); opacity: .25; margin: 0 4px; }
.toolbar .grow { flex: 1; }

.progress { margin-top: 12px; }
.progress-track { height: 14px; background: var(--card); border: 2px solid var(--outline); border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--orange); border-inline-end: 2px solid var(--sticker-line); transition: width .15s; }
.progress-bar[style*="width: 0%"] { border-inline-end: 0; }
.progress-label { margin-top: 4px; color: var(--muted); min-height: 1em; }

.result { background: var(--lime); color: #111; border-color: #111; }
.result .eyebrow { color: #111; }
.result .muted { color: #3a3a2a; }
.result .btn-ghost { --fg: #111; }
.result .btn-ghost:hover { background: rgba(0,0,0,.08); }
.result h3 { margin: 6px 0 4px; }
.result .row { margin-top: 12px; }

/* page thumbnails */
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; }
.thumb { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 8px; background: var(--card); border: 2px solid var(--outline); border-radius: 12px; box-shadow: 3px 3px 0 var(--shadow); user-select: none; }
.thumb canvas, .thumb img { width: 100%; height: auto; display: block; border: 1px solid rgba(0,0,0,.25); background: #fff; border-radius: 4px; transition: transform .2s; }
.thumb-label { display: flex; align-items: center; justify-content: space-between; font: 600 11px var(--mono); letter-spacing: .06em; }
.thumb-actions { display: flex; gap: 4px; justify-content: center; }
.thumb-actions .btn { min-height: 30px; padding: 2px 6px; box-shadow: 2px 2px 0 var(--shadow); border-radius: 8px; }
.thumb-actions .btn .ic { width: 16px; height: 16px; }
.thumb.is-selected { outline: 3px solid var(--orange); outline-offset: 2px; }
.thumb.is-deleted { opacity: .4; }
.thumb.is-deleted canvas { filter: grayscale(1); }
.thumb.is-dragging { opacity: .4; }
.thumb.is-target { box-shadow: -6px 0 0 var(--orange), 3px 3px 0 var(--shadow); }
.thumb[draggable="true"] { cursor: grab; }

/* toast */
#toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--ink); color: var(--card); border: 2px solid var(--outline); border-radius: 12px; padding: 10px 14px; font-weight: 600; box-shadow: 3px 3px 0 var(--shadow); animation: pop .18s ease-out; pointer-events: auto; }
.toast-error { background: #FFD9D4; color: #111; border-color: #111; }
.toast.out { opacity: 0; transition: opacity .25s; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

/* modal */
.backdrop { position: fixed; inset: 0; background: rgba(17,17,17,.55); z-index: 50; display: grid; place-items: center; padding: 16px; animation: fade .12s; }
.modal { width: min(100%, 460px); max-height: 88vh; overflow: auto; background: var(--card); border: 2px solid var(--outline); border-radius: 14px; box-shadow: 6px 6px 0 var(--shadow); padding: 18px; }
.modal-wide { width: min(100%, 720px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
.next-list { display: grid; gap: 8px; }
.next-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; font: 700 15px var(--font); color: var(--ink); background: var(--card); border: 2px solid var(--outline); border-radius: 12px; cursor: pointer; text-align: left; }
.next-item:hover { background: var(--hover); }

/* ---------------------------------------------------------------- home */
.hero {
  position: relative; display: grid; grid-template-columns: 1fr; gap: 20px; margin-top: 24px; padding: 24px;
  background: var(--orange); color: #111; border: 2px solid var(--sticker-line); border-radius: 18px; box-shadow: 4px 4px 0 var(--shadow);
}
.hero .eyebrow { color: #111; }
.hero h1 { margin: 8px 0 8px; }
.hero p { font-size: 18px; max-width: 46ch; margin: 0; }
.hero-drop {
  display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--card); color: var(--ink); cursor: pointer;
  border: 2px dashed var(--outline); border-radius: 14px; transition: transform .08s;
}
.hero-drop:hover, .hero-drop.is-over { background: var(--lime); color: #111; border-style: solid; }
.hero-drop-ic { width: 56px; height: 56px; flex: none; display: grid; place-items: center; background: #111; color: var(--lime); border-radius: 14px; }
.hero-drop-ic .ic { width: 28px; height: 28px; }
.hero-drop b { display: block; font-size: 20px; letter-spacing: -.01em; }
.hero-drop span.s { font-size: 14px; color: var(--muted); }
.hero-drop:hover span.s, .hero-drop.is-over span.s { color: #111; }
.hero-trust { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 14px; font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: .1em; }
.hero-trust span { display: inline-flex; align-items: center; gap: 6px; }
.hero-trust .ic { width: 16px; height: 16px; }
@media (min-width: 860px) { .hero { grid-template-columns: 1.1fr 1fr; align-items: center; padding: 36px; gap: 40px; } }

.suggest { margin-top: 20px; }
.suggest-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-top: 10px; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 32px 0 12px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
@media (max-width: 560px) { .tool-grid { grid-template-columns: 1fr; } }
.tool-card {
  display: flex; align-items: center; gap: 14px; padding: 14px; text-decoration: none; color: var(--ink); min-width: 0;
  background: var(--card); border: 2px solid var(--outline); border-radius: 14px; box-shadow: 3px 3px 0 var(--shadow);
  transition: transform .08s, box-shadow .08s;
}
.tool-card:hover { background: var(--hover); }
.tool-card:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--shadow); }
.tool-card-text { min-width: 0; }
.tool-card-title { font-weight: 800; font-size: 17px; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; line-height: 1.2; }
.tool-card-sub { font-size: 14px; color: var(--muted); line-height: 1.3; margin-top: 2px; }
.tool-card.is-app { border-style: dashed; box-shadow: none; }
.tool-card.is-app .ext { margin-inline-start: auto; width: 18px; height: 18px; flex: none; color: var(--muted); }
.empty { text-align: center; padding: 40px 0; color: var(--muted); }
.footer { margin-top: 56px; padding-top: 20px; border-top: 2px solid var(--outline); display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 14px; color: var(--muted); }
.footer a { font-weight: 600; }

/* ---------------------------------------------------------- tool page */
.tool-head { display: flex; align-items: center; gap: 14px; margin: 24px 0 20px; }
.tool-head h1 { font-size: clamp(24px, 4.5vw, 36px); }
.tool-head p { margin: 2px 0 0; color: var(--muted); }
.tool-back { margin-top: 20px; }
.tool-root { min-height: 200px; }
.tool-narrow { max-width: 720px; }
.loading { display: flex; align-items: center; gap: 10px; padding: 40px 0; justify-content: center; color: var(--muted); font-family: var(--mono); font-size: 13px; }
.spinner { width: 20px; height: 20px; border: 3px solid var(--outline); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.soon { text-align: center; padding: 36px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.soon .sticker { margin-bottom: 8px; }

/* pdf viewer */
.viewer { display: flex; flex-direction: column; gap: 14px; }
.viewer-pages { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 16px; background: var(--hover); border: 2px solid var(--outline); border-radius: 14px; max-height: 78vh; overflow: auto; }
.viewer-pages canvas { background: #fff; border: 2px solid var(--outline); box-shadow: 3px 3px 0 var(--shadow); max-width: none; }

/* watermark preview, small helpers */
.preview { background: #fff; border: 2px solid var(--outline); border-radius: 8px; padding: 6px; display: flex; justify-content: center; }
.preview canvas, .preview img { max-width: 100%; height: auto; max-height: 360px; }
.kv { display: grid; grid-template-columns: minmax(110px, 160px) 1fr; gap: 8px 16px; margin: 0; }
.kv dt { font: 600 11px/1.6 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--label); }
.kv dd { margin: 0; word-break: break-word; }
.next-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-width: 168px; }
.next-grid .chip { justify-content: center; padding: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
#app:focus, #app:focus-visible { outline: none; box-shadow: none; }
.thumb-grid { align-items: start; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.thumb-actions { flex-wrap: wrap; gap: 3px; }
.thumb-actions .btn { min-width: 0; width: 27px; min-height: 27px; padding: 0; box-shadow: 1px 1px 0 var(--shadow); border-radius: 7px; }
.thumb-actions .btn .ic { width: 15px; height: 15px; }

/* ------------------------------------------- server-rendered copy (scripts/gen-tool-pages.mjs) */
.ssr-home { min-height: 100vh; padding-top: 28px; }
.ssr-home h1 { margin-bottom: 12px; }
.ssr-home h2 { font-size: 20px; margin: 24px 0 8px; }
.ssr-home ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.ssr-home a { font-weight: 600; }
#app[data-tool] .tool-root { min-height: 340px; }
.seo { padding-top: 8px; }
.seo h2 { font-size: 22px; margin: 36px 0 12px; }
.seo h3 { font-size: 17px; margin: 18px 0 4px; }
.seo p { max-width: 68ch; }
.seo ol { max-width: 68ch; padding-inline-start: 22px; margin: 0; }
.seo li { margin: 6px 0; }
.seo .related { list-style: none; padding: 0; max-width: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.seo .related a { display: block; padding: 12px 14px; border: 2px solid var(--outline); border-radius: 12px; background: var(--card); font-weight: 600; text-decoration: none; }
.seo .related a:hover { background: var(--hover); }
.seo .related span { display: block; font-weight: 400; font-size: 14px; color: var(--muted); }

/* ------------------------------------------- landing pages (scripts/gen-landing-pages.mjs) */
.chip-row.chip-wrap { flex-wrap: wrap; overflow: visible; }
a.chip { text-decoration: none; }
.crumbs { margin-top: 20px; font: 600 12px/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 2px 8px; margin: 0; padding: 0; max-width: none; }
.crumbs li { margin: 0; }
.crumbs li + li::before { content: "/"; margin-inline-end: 8px; }
.crumbs a { color: inherit; }
.crumbs + .tool-head { margin-top: 14px; }
.facts { margin: 0 0 20px; }
.facts .kv { grid-template-columns: minmax(96px, 150px) 1fr; }
.prefill { margin: 0 0 12px; font-size: 13px; }
.callout { max-width: 68ch; padding: 12px 14px; font-weight: 600; background: var(--card); border: 2px solid var(--outline); border-inline-start: 8px solid var(--orange); border-radius: 12px; }
.seo ul:not(.related) { max-width: 68ch; padding-inline-start: 22px; margin: 0; }
.seo.page { padding-top: 0; }
.page-head { margin: 4px 0 8px; }
.page-head h1 { font-size: clamp(28px, 5.5vw, 44px); margin: 12px 0 10px; }
.page-head .lead { font-size: 18px; color: var(--muted); max-width: 62ch; margin: 0 0 8px; }
.byline { font-size: 12px; margin: 10px 0 0; }
.toc { max-width: 68ch; margin: 18px 0 8px; padding: 14px 16px; }
.toc ol { margin: 8px 0 0; padding-inline-start: 20px; }
.toc li { margin: 4px 0; }
.article { max-width: 68ch; }
.article h2 { scroll-margin-top: 80px; }
.article p, .article li { font-size: 17px; line-height: 1.6; }
.article ul, .article ol { max-width: 68ch; padding-inline-start: 22px; margin: 0 0 1em; }
.az h2 { font: 800 22px var(--font); margin: 28px 0 10px; }
.az [hidden], .seo [hidden] { display: none; }

/* ------------------------------------------------ accounts + Pro (lib/accountUi.js) */
.account-slot { position: relative; flex: none; }
.signin-btn { min-height: 42px; white-space: nowrap; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; cursor: pointer;
  font: 800 18px/1 var(--font); color: #111; background: var(--orange); border: 2px solid var(--sticker-line); box-shadow: 3px 3px 0 var(--shadow); padding: 0;
}
.avatar.is-pro { background: var(--lime); }
.avatar:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--shadow); }
.avatar-lg { width: 56px; height: 56px; font-size: 24px; cursor: default; }
.menu {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 40; width: min(300px, calc(100vw - 2 * var(--gutter)));
  background: var(--card); border: 2px solid var(--outline); border-radius: 14px; box-shadow: 4px 4px 0 var(--shadow); padding: 6px; animation: pop .12s ease-out;
}
.menu-head { padding: 10px 10px 12px; border-bottom: 2px solid var(--outline); margin-bottom: 6px; display: grid; gap: 4px; }
.menu-name { font-weight: 800; font-size: 17px; line-height: 1.2; overflow-wrap: anywhere; }
.menu-email { color: var(--muted); overflow-wrap: anywhere; }
.menu-pro { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.menu-pro.on { color: var(--ink); font-weight: 600; }
.menu-item {
  display: flex; align-items: center; width: 100%; min-height: 44px; padding: 8px 10px; border: 0; border-radius: 10px; background: transparent;
  font: 700 15px var(--font); color: var(--ink); text-align: start; text-decoration: none; cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); }
.menu-hint { margin-top: 6px; padding: 10px; border-top: 2px solid var(--outline); font-size: 14px; color: var(--muted); }
.toast-update { display: flex; align-items: center; gap: 8px; }
.toast-update span { flex: 1; }
.toast-update .btn-ghost { color: inherit; }
.install-btn { flex: none; }

.btn-block { width: 100%; }
.linklike { background: none; border: 0; padding: 0; font: 700 inherit var(--font); color: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 24px; }
.linklike:hover { color: var(--orange); }
a { text-underline-offset: 3px; }

/* forms */
.auth-form .field { gap: 0; }
.auth-form .label { justify-content: flex-start; }
.field-error { color: var(--danger); font-weight: 600; font-size: 14px; margin-top: 4px; }
.input[aria-invalid="true"], input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 2px var(--danger); }
.check-top { align-items: flex-start; }
.check-top input { margin-top: 1px; }
.check-top span { font-weight: 600; line-height: 1.35; }
.pw { position: relative; }
.pw .input { padding-inline-end: 76px; }
.pw-toggle {
  position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); min-height: 34px; padding: 0 10px; border-radius: 8px;
  background: var(--card); color: var(--ink); border: 2px solid var(--outline); font: 700 13px var(--mono); cursor: pointer;
}
.pw-toggle:hover { background: var(--hover); }
.code-input { font: 700 28px/1.2 var(--mono); letter-spacing: .5em; text-align: center; padding-inline-start: calc(12px + .5em); direction: ltr; }
.auth-lead { margin: 0 0 14px; color: var(--muted); }
.auth-links { margin-top: -4px; font-size: 14px; }
.auth-switch { margin: 14px 0 0; font-size: 14px; color: var(--muted); }
.auth-switch .linklike { color: var(--ink); }
.form-alert:empty { display: none; }
.auth-card { padding: 20px; }
.acct-shell { padding-top: 28px; }
.acct { max-width: 480px; margin: 0 auto; display: grid; gap: 16px; }
.acct:has(.acct-wide) { max-width: none; }
.acct-title { font-size: clamp(26px, 5vw, 36px); margin-bottom: 4px; }
.acct-id { display: flex; align-items: center; gap: 14px; }
.acct-id-text { min-width: 0; }
.acct-email { overflow-wrap: anywhere; }
.acct .kv { margin: 6px 0; }
.fine { font-size: 13px; }

/* upgrade sheet + modals */
.sheet-body { display: grid; gap: 14px; }
.sheet-tool { display: flex; align-items: center; gap: 12px; }
.sheet-tool p { margin: 0; }
.perks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.perks li { display: flex; align-items: flex-start; gap: 10px; line-height: 1.35; }
.perks .ic { width: 22px; height: 22px; padding: 3px; margin-top: -1px; background: var(--lime); color: #111; border: 2px solid #111; border-radius: 7px; }
.price-box { padding: 12px 14px; background: var(--hover); border: 2px solid var(--outline); border-radius: 12px; }
.price-big { font: 800 30px/1.1 var(--font); letter-spacing: -.02em; }
.price-sub { font: 600 13px/1.4 var(--mono); color: var(--muted); margin-top: 2px; }
.sheet-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; font-size: 14px; color: var(--muted); }
.sheet-more { font-weight: 700; }
@media (max-width: 560px) {
  .backdrop.sheet { align-items: end; padding: 0; }
  .backdrop.sheet .modal { width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; border-bottom: 0; animation: rise .18s ease-out; }
}
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }

/* plans page */
.plan-hero { background: var(--orange); color: #111; border: 2px solid var(--sticker-line); border-radius: 18px; box-shadow: 4px 4px 0 var(--shadow); padding: 24px; display: grid; gap: 14px; justify-items: start; margin-top: 4px; }
.plan-hero .eyebrow { color: #111; }
.plan-hero h1 { margin: 0; font-size: clamp(28px, 6vw, 46px); }
.plan-hero .lead { font-size: 18px; max-width: 52ch; margin: 0; }
.plan-hero .price-box { background: var(--card); color: var(--ink); }
.plan-hero .price-sub { color: var(--muted); }
.plan-hero .btn-primary { --bg: #111; --fg: var(--lime); }
.plan-hero .btn-primary:hover { background: #111; filter: brightness(1.2); }
.plan-hero .btn-ink { --bg: #111; --fg: var(--lime); }
.plan-hero .badge-pro { background: #111; color: var(--lime); border-color: #111; }
.plan-note { margin: 0; font-size: 14px; }
.faq details { padding: 0; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 800; padding: 14px 16px; min-height: 44px; list-style-position: inside; }
.faq details p { padding: 0 16px 14px; margin: 0; color: var(--muted); max-width: 70ch; }
.faq details[open] summary { border-bottom: 2px solid var(--outline); margin-bottom: 12px; }

/* celebration + checkout return */
.celebrate { text-align: center; display: grid; justify-items: center; gap: 4px; padding: 6px 0 14px; position: relative; }
.celebrate-ic { width: 64px; height: 64px; display: grid; place-items: center; background: var(--lime); color: #111; border: 2px solid #111; border-radius: 18px; box-shadow: 3px 3px 0 var(--shadow); }
.celebrate-ic .ic { width: 34px; height: 34px; }
.celebrate .lead { margin: 10px 0 0; font-weight: 700; font-size: 18px; }
.confetti { position: absolute; inset: 0 0 auto; height: 0; pointer-events: none; overflow: visible; }
.confetti i { position: absolute; top: 0; left: var(--x); width: 10px; height: 14px; background: var(--c); border: 2px solid #111; border-radius: 3px; animation: fall 1.6s calc(var(--i) * 60ms) ease-in both; }
@keyframes fall { from { transform: translateY(-20px) rotate(0); opacity: 1; } to { transform: translateY(380px) rotate(300deg); opacity: 0; } }
.sheet-dlg { position: relative; overflow-x: hidden; }
.pro-pending { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 90; display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--card); border: 2px solid var(--outline); border-radius: 99px; box-shadow: 3px 3px 0 var(--shadow); font-weight: 700; }
@media (max-width: 400px) {
  .topbar-in { gap: 8px; }
  .signin-btn { padding: 4px 10px; }
}
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; box-shadow: none; }

/* ------------------------------------------------------- language switcher + banner */
.langsw { position: relative; flex: none; }
.langsw-btn { list-style: none; display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 10px; cursor: pointer; font: 700 13px var(--mono); letter-spacing: .04em; color: var(--ink); background: var(--card); border: 2px solid var(--outline); border-radius: 12px; box-shadow: 2px 2px 0 var(--shadow); user-select: none; }
.langsw-btn::-webkit-details-marker { display: none; }
.langsw-btn:hover { background: var(--hover); }
.langsw-globe { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.langsw-list { position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 45; margin: 0; padding: 6px; list-style: none; width: 200px; max-height: min(70vh, 460px); overflow-y: auto; background: var(--card); border: 2px solid var(--outline); border-radius: 14px; box-shadow: 3px 3px 0 var(--shadow); }
.langsw-list a { display: block; padding: 8px 12px; border-radius: 9px; font-weight: 600; font-size: 15px; text-decoration: none; }
.langsw-list a:hover { background: var(--hover); }
.langsw-list a[aria-current] { background: var(--lime); color: #111; }
.lang-banner { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 8px var(--gutter, 16px); background: var(--lime); color: #111; border-bottom: 2px solid #111; font-weight: 700; font-size: 14px; }
.lang-banner a { color: #111; text-decoration: underline; text-underline-offset: 3px; }
.lang-banner-x { flex: none; width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: #111; font-size: 22px; line-height: 1; cursor: pointer; }
.lang-banner-x:hover { background: rgba(0, 0, 0, .12); }
@media (max-width: 640px) { .langsw-btn { padding: 0 8px; } .langsw-code { display: none; } .langsw-btn { min-width: 42px; justify-content: center; } }

/* ----------------------------------------------------------------------- RTL */
/* Layout mirrors through flex/grid and logical properties above; icons that point somewhere flip here. */
[dir="rtl"] .tool-back .ic svg, [dir="rtl"] .ic-flip svg { transform: scaleX(-1); }
[dir="rtl"] .tool-card.is-app .ext svg { transform: scaleX(-1); }
[dir="rtl"] .mono, [dir="rtl"] .code-input, [dir="rtl"] input[type="email"] { unicode-bidi: plaintext; }
