:root {
  --bg: #0a0b14;
  --bg-2: #0f1120;
  --panel: rgba(22, 25, 42, .72);
  --panel-solid: #161a2b;
  --panel-2: #1e2236;
  --border: rgba(148, 160, 220, .16);
  --border-strong: rgba(148, 160, 220, .3);
  --text: #eef0fa;
  --muted: #9aa2c0;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-hover: #7c7ff7;
  --accent-soft: rgba(99, 102, 241, .16);
  --on-accent: #fff;
  --ok: #22c55e;
  --ok-soft: rgba(34, 197, 94, .14);
  --gold: #f5b942;
  --danger: #f87171;
  --warn-bg: #3a2f12;
  --warn-text: #fcd58a;
  --err-bg: #3b1518;
  --err-text: #fca5a5;
  --info-bg: #1a2142;
  --info-text: #b4c2ff;
  --shadow: 0 16px 48px rgba(0, 0, 0, .4);
  --radius: 18px;
  --glow: radial-gradient(1200px 500px at 50% -120px, rgba(99, 102, 241, .28), transparent 70%);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f5f6fc;
  --bg-2: #eceefa;
  --panel: rgba(255, 255, 255, .78);
  --panel-solid: #ffffff;
  --panel-2: #f0f1f9;
  --border: rgba(60, 70, 130, .13);
  --border-strong: rgba(60, 70, 130, .26);
  --text: #12142a;
  --muted: #586080;
  --accent: #4f46e5;
  --accent-2: #7c3aed;
  --accent-hover: #4338ca;
  --accent-soft: rgba(79, 70, 229, .1);
  --ok: #16a34a;
  --ok-soft: rgba(22, 163, 74, .1);
  --gold: #c58a12;
  --danger: #dc2626;
  --warn-bg: #fff6e0;
  --warn-text: #7a5300;
  --err-bg: #fdecec;
  --err-text: #9b1c1c;
  --info-bg: #eaeeff;
  --info-text: #2c3a9a;
  --shadow: 0 16px 48px rgba(30, 40, 90, .1);
  --glow: radial-gradient(1200px 500px at 50% -120px, rgba(99, 102, 241, .16), transparent 70%);
  color-scheme: light;
}
@media (prefers-contrast: more) {
  :root { --border: var(--border-strong); --muted: var(--text); }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body {
  background: var(--glow), var(--bg);
  background-repeat: no-repeat;
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--accent); }
:root[data-theme="dark"] a { color: #a5b4fc; }
button, select, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { letter-spacing: -.02em; line-height: 1.2; }
kbd { font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 3px 6px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--panel-2); color: var(--muted); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.wrap.narrow { max-width: 820px; }
.center { text-align: center; }
.grad-text { background: linear-gradient(100deg, #818cf8, #a78bfa 55%, #f0abfc); -webkit-background-clip: text; background-clip: text; color: transparent; }
:root[data-theme="light"] .grad-text { background-image: linear-gradient(100deg, var(--accent), var(--accent-2) 60%, #c026d3); }
.ico { width: 20px; height: 20px; flex: none; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 10px; }
.skip:focus { left: 8px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--panel-2); color: var(--text); font-weight: 600; text-decoration: none;
  transition: transform .12s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
:root[data-theme="dark"] a.btn { color: var(--text); }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: var(--on-accent); box-shadow: 0 8px 24px rgba(99, 102, 241, .32); }
.btn.primary:hover:not(:disabled) { box-shadow: 0 10px 30px rgba(99, 102, 241, .45); filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.danger { color: var(--danger); }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; font-size: inherit; }
:root[data-theme="dark"] .linkish { color: #a5b4fc; }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; border: 1px solid var(--border); background: var(--panel); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.nav .wrap { display: flex; align-items: center; gap: 18px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 17px; letter-spacing: -.01em; color: var(--text) !important; text-decoration: none; }
.logo {
  width: 30px; height: 30px; border-radius: 9px; flex: none; position: relative;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 14px rgba(99, 102, 241, .4);
}
.logo::before { content: ""; position: absolute; left: 9px; top: 6px; width: 13px; height: 18px; border-radius: 2px 5px 2px 2px; background: #fff; }
.logo::after { content: ""; position: absolute; left: 11.5px; top: 14px; width: 8px; height: 2px; border-radius: 2px; background: var(--accent); box-shadow: 0 4px 0 var(--accent); }
.nav-links { display: flex; gap: 22px; margin-left: 12px; }
.nav-links a { color: var(--muted) !important; text-decoration: none; font-weight: 550; font-size: 14px; }
.nav-links a:hover { color: var(--text) !important; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.search-btn { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 12px; border-radius: 11px; border: 1px solid var(--border); background: var(--panel); color: var(--muted); font-size: 13.5px; }
.search-btn .ico { width: 16px; height: 16px; }
.search-btn:hover { border-color: var(--border-strong); color: var(--text); }
.plan-pill { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); font-size: 13px; font-weight: 600; white-space: nowrap; }
.plan-pill .pdot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.plan-pill.low .pdot { background: var(--gold); box-shadow: 0 0 0 3px rgba(245, 185, 66, .18); }
.plan-pill.out .pdot { background: var(--danger); box-shadow: 0 0 0 3px rgba(248, 113, 113, .18); }
.plan-pill.pro { border-color: transparent; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.plan-pill.pro .pdot { background: #fff; box-shadow: none; }
#themeBtn svg { display: none; }
#themeBtn[data-mode="dark"] .t-dark, #themeBtn[data-mode="light"] .t-light, #themeBtn[data-mode="system"] .t-system { display: block; }
.menu-btn { display: none; }
.mobile-menu { display: flex; flex-direction: column; padding: 8px 20px 16px; border-top: 1px solid var(--border); }
.mobile-menu a { padding: 10px 0; color: var(--text) !important; text-decoration: none; font-weight: 600; }

/* ---------- Hero & drop zones ---------- */
.app { padding: 36px 0 24px; }
.hero { text-align: center; max-width: 780px; margin: 10px auto 26px; }
.hero-title { font-size: clamp(32px, 5.4vw, 56px); font-weight: 800; margin: 14px 0 12px; letter-spacing: -.035em; line-height: 1.06; }
.lead { color: var(--muted); font-size: 17px; margin: 0 auto; max-width: 620px; }
.badge-device { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); font-size: 12.5px; font-weight: 650; white-space: nowrap; }
.badge-device .ico { width: 14px; height: 14px; }
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  padding: 28px 20px; border-radius: var(--radius); cursor: pointer;
  border: 2px dashed var(--border-strong); background: var(--panel);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop.over { transform: scale(1.01); }
.drop b { font-size: 17px; }
.drop span { color: var(--muted); font-size: 14px; }
.drop u { color: var(--accent); text-decoration: none; font-weight: 600; }
.drop-ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff !important; margin-bottom: 6px; box-shadow: 0 10px 30px rgba(99, 102, 241, .35); }
.drop-ico .ico { width: 24px; height: 24px; }
.drop.big { max-width: 780px; margin: 0 auto; padding: 54px 24px; }
.drop.big b { font-size: 22px; }
.drop.compact { flex-direction: row; padding: 12px 16px; gap: 12px; }
.drop.compact .drop-ico { width: 34px; height: 34px; border-radius: 10px; margin: 0; box-shadow: none; }
.drop.compact .drop-ico .ico { width: 18px; height: 18px; }
.drop.compact b { font-size: 15px; }
.suggest { max-width: 980px; margin: 8px auto 0; scroll-margin-top: 84px; }
.picked { display: flex; flex-direction: column; gap: 8px; max-width: 640px; margin: 0 auto; }
.picked .file-row { border: 0; background: transparent; padding: 4px 0; }
.picked .fine { margin: 0; }
.picked-actions { display: flex; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.pick-title { text-align: center; font-size: clamp(22px, 3vw, 28px); margin: 30px 0 16px; }
.pick-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.pick-card {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left;
  padding: 20px 20px 22px; border-radius: var(--radius); border: 1px solid var(--accent); color: var(--text);
  background: linear-gradient(160deg, var(--accent-soft), var(--panel) 70%);
  transition: transform .15s ease, box-shadow .15s ease;
}
.pick-card:hover { transform: translateY(-2px); box-shadow: 0 14px 40px rgba(99, 102, 241, .25); }
.pick-card b { font-size: 18px; margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.pick-card > span:not(.ti):not(.go) { color: var(--muted); font-size: 14px; }
.pick-card .go { position: absolute; top: 20px; right: 18px; color: var(--accent); }
.pick-sub { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 30px 0 12px; }
button.tool-card { font: inherit; text-align: left; cursor: pointer; width: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--panel-solid); font-weight: 600; font-size: 13.5px; color: var(--text); }
.chip .ico { width: 16px; height: 16px; color: var(--accent); }
.chip:hover { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Tool grid ---------- */
.tools { margin-top: 44px; }
.tool-group { margin-top: 26px; }
.tool-group h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 12px; font-weight: 700; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tool-card {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; row-gap: 2px; align-items: center;
  padding: 16px; border-radius: 16px; border: 1px solid var(--border); background: var(--panel);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  text-decoration: none; color: var(--text) !important;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.tool-card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow); }
.tool-card.dim { opacity: .38; }
.tool-card.hl { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tool-card .ti { grid-row: span 2; }
.tool-card b { font-size: 15px; display: flex; align-items: center; gap: 6px; }
.tool-card span:not(.ti):not(.pro-tag) { color: var(--muted); font-size: 13px; line-height: 1.35; }
.ti { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
:root[data-theme="dark"] .ti { color: #a5b4fc; }
.ti.big { width: 52px; height: 52px; border-radius: 15px; }
.ti.big .ico { width: 26px; height: 26px; }
.ti.gold { background: rgba(245, 185, 66, .14); color: var(--gold) !important; }
.ti.ok { background: var(--ok-soft); color: var(--ok) !important; }
.pro-tag { font-size: 10.5px; font-weight: 800; letter-spacing: .04em; padding: 2px 7px; border-radius: 999px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }

/* ---------- Tool view ---------- */
.back { display: inline-block; color: var(--muted) !important; text-decoration: none; font-weight: 600; font-size: 14px; margin-bottom: 14px; }
.back:hover { color: var(--text) !important; }
.tool-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.tool-head-text { flex: 1; min-width: 200px; }
.tool-head h1 { margin: 0; font-size: clamp(24px, 3.4vw, 32px); }
.tool-head p { margin: 2px 0 0; color: var(--muted); }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.files-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.opts-col { position: sticky; top: 82px; }
.card { border: 1px solid var(--border); background: var(--panel); border-radius: var(--radius); padding: 18px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.opts-title { font-size: 16px; margin: 0 0 12px; }
.opt { margin-bottom: 14px; }
.opt > label, .opt-label { display: block; font-size: 13px; font-weight: 650; color: var(--muted); margin-bottom: 6px; }
.opt input[type="text"], .opt input[type="number"], .opt select, .stack input, .stack textarea, #okKey {
  width: 100%; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--border-strong); background: var(--panel-solid); color: var(--text);
}
.opt input:focus, .opt select:focus, .stack input:focus, .stack textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.opt .hint { font-size: 12.5px; color: var(--muted); margin: 5px 0 0; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border); }
.seg button { flex: 1 1 auto; padding: 7px 10px; border: 0; border-radius: 9px; background: transparent; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--panel-solid); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .18); }
:root[data-theme="dark"] .seg button[aria-pressed="true"] { background: #4f46e5; color: #fff; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; font-weight: 600; }
.switch-row input { width: 40px; height: 22px; appearance: none; -webkit-appearance: none; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border-strong); position: relative; cursor: pointer; transition: background .15s; flex: none; }
.switch-row input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.switch-row input:checked { background: var(--accent); border-color: var(--accent); }
.switch-row input:checked::after { transform: translateX(18px); }
.opt-info { font-size: 13.5px; padding: 10px 12px; border-radius: 11px; background: var(--info-bg); color: var(--info-text); margin: 0 0 14px; }
.opt-info.warn { background: var(--warn-bg); color: var(--warn-text); }
.fine { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; }
.fine.center { text-align: center; }

/* ---------- File list ---------- */
.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--panel-solid);
}
.file-row.dragging { opacity: .5; }
.file-row.drop-before { box-shadow: 0 -3px 0 var(--accent); }
.thumb { width: 44px; height: 56px; border-radius: 6px; background: var(--panel-2); flex: none; overflow: hidden; display: grid; place-items: center; border: 1px solid var(--border); }
.thumb img, .thumb canvas { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-meta { flex: 1; min-width: 0; }
.file-meta b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.file-meta span { font-size: 12.5px; color: var(--muted); }
.file-meta span.err { color: var(--danger); }
.row-actions { display: flex; gap: 4px; }
.mini { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; border: 1px solid var(--border); background: transparent; color: var(--muted); }
.mini:hover:not(:disabled) { color: var(--text); border-color: var(--border-strong); }
.mini svg { width: 16px; height: 16px; }
.grip { cursor: grab; color: var(--muted); display: grid; place-items: center; }

/* ---------- Page grid (organize) ---------- */
.page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; }
.page-tile { border: 1px solid var(--border); background: var(--panel-solid); border-radius: 14px; padding: 8px; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.page-tile.dragging { opacity: .4; }
.page-tile.drop-before { box-shadow: -3px 0 0 var(--accent); }
.page-tile.deleted .pg-thumb { opacity: .25; filter: grayscale(1); }
.pg-thumb { width: 100%; aspect-ratio: 3 / 4; display: grid; place-items: center; overflow: hidden; border-radius: 8px; background: var(--panel-2); cursor: grab; }
.pg-thumb canvas { max-width: 100%; max-height: 100%; box-shadow: 0 2px 10px rgba(0, 0, 0, .25); transition: transform .2s ease; background: #fff; }
.pg-num { font-size: 12px; color: var(--muted); font-weight: 600; }
.pg-actions { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; }
.pg-actions .mini { width: 28px; height: 28px; }
.panel-note { font-size: 13px; color: var(--muted); margin: 0 0 10px; }

/* ---------- Sign ---------- */
.sign-box { display: flex; flex-direction: column; gap: 14px; }
.pad-wrap { position: relative; border-radius: 14px; border: 1px solid var(--border-strong); background: #fff; overflow: hidden; touch-action: none; }
.pad-wrap canvas { display: block; width: 100%; height: 170px; cursor: crosshair; }
.pad-hint { position: absolute; inset: auto 0 10px 0; text-align: center; font-size: 12.5px; color: #8a90a8; pointer-events: none; }
.pad-line { position: absolute; left: 24px; right: 24px; bottom: 36px; border-bottom: 1px dashed #c8cbe0; pointer-events: none; }
.type-preview { height: 170px; border-radius: 14px; border: 1px solid var(--border-strong); background: #fff; color: #1a1f4a; display: grid; place-items: center; font-size: 46px; overflow: hidden; padding: 0 16px; white-space: nowrap; }
.sig-colors { display: flex; gap: 8px; align-items: center; }
.sig-colors button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; }
.sig-colors button[aria-pressed="true"] { border-color: var(--text); }
.place-wrap { position: relative; margin: 0 auto; max-width: 100%; user-select: none; -webkit-user-select: none; touch-action: none; box-shadow: var(--shadow); }
.place-wrap canvas { display: block; max-width: 100%; height: auto; background: #fff; }
.sig-overlay { position: absolute; border: 1.5px dashed var(--accent); cursor: move; touch-action: none; background: rgba(99, 102, 241, .06); }
.sig-overlay img { width: 100%; height: 100%; display: block; pointer-events: none; }
.sig-overlay .rs { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; cursor: nwse-resize; }
.page-nav { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 13.5px; font-weight: 600; }

/* ---------- Progress & result ---------- */
.progress, .result { margin-top: 18px; }
.bar { height: 10px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .2s ease; }
.progress p { margin: 10px 0 8px; color: var(--muted); font-size: 14px; }
.result { animation: pop .3s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.result-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.result-head h2 { margin: 0; font-size: 20px; }
.result-head p { margin: 2px 0 0; color: var(--muted); }
.ok-ico { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); flex: none; }
.compare { display: grid; gap: 8px; margin-bottom: 16px; }
.cmp-row { display: grid; grid-template-columns: 64px 1fr 80px; gap: 10px; align-items: center; font-size: 13.5px; }
.cmp-row span:first-child { color: var(--muted); font-weight: 600; }
.cmp-row b { text-align: right; }
.cmp-bar { height: 12px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.cmp-bar i { display: block; height: 100%; border-radius: inherit; background: var(--muted); }
.cmp-bar.after i { background: linear-gradient(90deg, var(--ok), #4ade80); }
.res-text { width: 100%; min-height: 220px; padding: 12px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--panel-solid); font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; margin-bottom: 14px; }
.res-files { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; max-height: 260px; overflow: auto; }
.res-file { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 11px; background: var(--panel-2); font-size: 13.5px; }
.res-file span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-file small { color: var(--muted); }
.res-actions, .row-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.continue { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.continue > span { font-size: 13px; color: var(--muted); font-weight: 600; }
.continue .chips { justify-content: flex-start; }

/* ---------- Sections ---------- */
.section { padding: 64px 0; }
.sec-title { text-align: center; font-size: clamp(26px, 3.6vw, 36px); margin: 0 0 10px; }
.sec-sub { text-align: center; color: var(--muted); max-width: 640px; margin: 0 auto 32px; font-size: 16px; }
.feats { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.feat { padding: 20px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--panel); }
.feat h3 { margin: 12px 0 6px; font-size: 17px; }
.feat p { margin: 0; color: var(--muted); font-size: 14px; }
.plans { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; align-items: stretch; }
.plan { position: relative; display: flex; flex-direction: column; padding: 22px 18px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--panel); }
.plan.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 20px 50px rgba(99, 102, 241, .22); }
.plan h3 { margin: 0 0 6px; font-size: 16px; }
.plan .price { font-size: 30px; font-weight: 800; margin: 0 0 14px; letter-spacing: -.03em; }
.plan .price .cur { font-size: 20px; margin-right: 1px; }
.plan .price small { font-size: 13px; color: var(--muted); font-weight: 600; margin-left: 4px; letter-spacing: 0; }
.plan ul { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.plan li, .checks li { display: flex; gap: 8px; font-size: 13.5px; align-items: flex-start; }
.plan li .ico, .checks li .ico { width: 16px; height: 16px; color: var(--ok); margin-top: 2px; }
.plan-flag { position: absolute; top: -11px; left: 18px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 750; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.pay-note { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 13.5px; margin-top: 22px; text-align: center; }
.pay-note .ico { width: 16px; height: 16px; }
.faq { display: flex; flex-direction: column; gap: 10px; }
.faq details { border: 1px solid var(--border); background: var(--panel); border-radius: 14px; padding: 4px 18px; }
.faq summary { cursor: pointer; font-weight: 650; padding: 12px 0; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--muted); font-size: 20px; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq p { margin: 0 0 14px; color: var(--muted); }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0 0 24px; display: flex; flex-direction: column; gap: 10px; }
.steps li { counter-increment: s; display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--panel); }
.steps li::before { content: counter(s); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 14px; }
.why { text-align: center; color: var(--muted); }

/* ---------- Legal ---------- */
.legal { padding: 48px 20px 64px; }
.legal h1 { font-size: 34px; margin: 0 0 6px; }
.legal h2 { font-size: 19px; margin: 28px 0 8px; }
.legal p, .legal li { color: var(--muted); }
.legal strong { color: var(--text); }
.legal .updated { font-size: 13px; }
.legal .tool-grid { margin: 24px 0; text-align: left; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 44px 0 28px; margin-top: 20px; background: var(--bg-2); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 28px; }
.footer-brand p { color: var(--muted); font-size: 14px; max-width: 300px; }
.footer-brand > a:last-child { font-size: 14px; }
.site-footer nav { display: flex; flex-direction: column; gap: 8px; }
.site-footer .foot-h { margin: 0 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.site-footer nav a { color: var(--text) !important; text-decoration: none; font-size: 14px; opacity: .85; }
.site-footer nav a:hover { opacity: 1; color: var(--accent) !important; }
.footer-bottom { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }

/* ---------- Dialogs ---------- */
.dlg {
  width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto;
  border: 1px solid var(--border-strong); border-radius: 22px; padding: 26px 24px 22px;
  background: var(--panel-solid); color: var(--text); box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}
.dlg[open] { animation: pop .22s ease; }
.dlg::backdrop { background: rgba(5, 6, 15, .62); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.dlg h2 { margin: 12px 0 6px; font-size: 22px; }
.dlg > p { color: var(--muted); margin: 0 0 14px; }
.dlg-x { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 10px; border: 0; background: var(--panel-2); font-size: 20px; line-height: 1; color: var(--muted); }
.dlg { position: fixed; }
.checks { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; }
.pw-plans { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pw-plan { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border-strong); background: var(--panel-2); text-align: left; }
.pw-plan b { font-size: 14.5px; }
.pw-plan span { font-size: 13px; color: var(--muted); }
.pw-plan.featured { border-color: var(--accent); background: var(--accent-soft); }
.pw-plan:hover:not(:disabled) { border-color: var(--accent); }
.stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.stack label, .dlg > label { font-size: 13px; font-weight: 650; color: var(--muted); }
.stack textarea, #okKey { font: 12.5px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; word-break: break-all; }
#okKey { margin: 6px 0 12px; }
.recover { margin-bottom: 14px; }
.recover summary { cursor: pointer; font-weight: 600; font-size: 14px; margin-bottom: 10px; color: var(--accent); }
:root[data-theme="dark"] .recover summary { color: #a5b4fc; }
.palette { padding: 0; width: min(600px, calc(100vw - 32px)); top: 12vh; margin-top: 0; }
.pal-input { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.pal-input input { flex: 1; border: 0; background: transparent; font-size: 17px; outline: none; }
.pal-input .ico { color: var(--muted); }
.pal-list { list-style: none; margin: 0; padding: 8px; max-height: 50vh; overflow: auto; }
.pal-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; cursor: pointer; }
.pal-list li .ti { width: 34px; height: 34px; border-radius: 10px; }
.pal-list li .ti .ico { width: 18px; height: 18px; }
.pal-list li div { flex: 1; min-width: 0; }
.pal-list li b { display: block; font-size: 14.5px; }
.pal-list li span.d { font-size: 12.5px; color: var(--muted); }
.pal-list li[aria-selected="true"] { background: var(--accent-soft); }
.pal-list .empty { color: var(--muted); justify-content: center; cursor: default; }
.pal-foot { margin: 0; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 12px; max-width: min(560px, calc(100vw - 32px));
  padding: 12px 14px 12px 16px; border-radius: 14px; box-shadow: var(--shadow);
  background: var(--info-bg); color: var(--info-text); border: 1px solid var(--border); font-size: 14px; font-weight: 550;
  animation: pop .2s ease;
}
.toast.warn { background: var(--warn-bg); color: var(--warn-text); }
.toast.error { background: var(--err-bg); color: var(--err-text); }
.toast.ok { background: var(--ok-soft); color: var(--ok); backdrop-filter: blur(12px); }
.toast button { border: 0; background: transparent; font-size: 20px; line-height: 1; color: inherit; opacity: .7; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .plans { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .opts-col { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .nav-links, .search-btn span, .search-btn kbd { display: none; }
  .search-btn { width: 38px; padding: 0; justify-content: center; }
  .menu-btn { display: grid; }
  .plans { grid-template-columns: 1fr 1fr; }
  .section { padding: 48px 0; }
}
@media (max-width: 520px) {
  .wrap { padding: 0 16px; }
  .nav .wrap { gap: 10px; }
  .brand > span:last-child { display: none; }
  .plan-pill { padding: 0 11px; font-size: 12px; }
  .plans { grid-template-columns: 1fr; }
  .pw-plans { grid-template-columns: 1fr; }
  .drop.big { padding: 38px 18px; }
  .tool-grid { grid-template-columns: 1fr; }
  .tool-head .badge-device { order: 3; }
  .page-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cmp-row { grid-template-columns: 52px 1fr 70px; }
  .row-actions .mini { width: 30px; height: 30px; }
}

/* ---------- Motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes drift {
  0% { transform: translate(-10%, -6%) scale(1); }
  50% { transform: translate(8%, 6%) scale(1.15); }
  100% { transform: translate(-10%, -6%) scale(1); }
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes stripes { to { background-position: 40px 0; } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 1px var(--accent), 0 20px 50px rgba(99, 102, 241, .18); } 50% { box-shadow: 0 0 0 1px var(--accent), 0 24px 70px rgba(139, 92, 246, .38); } }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, .45); } 100% { box-shadow: 0 0 0 18px rgba(99, 102, 241, 0); } }

/* Slow aurora behind the page */
body::before {
  content: ""; position: fixed; z-index: -1; pointer-events: none;
  width: 70vmax; height: 70vmax; left: 15vw; top: -35vmax; border-radius: 50%;
  background: radial-gradient(circle at 30% 40%, rgba(99, 102, 241, .22), transparent 55%), radial-gradient(circle at 70% 60%, rgba(192, 132, 252, .16), transparent 55%);
  filter: blur(40px); animation: drift 22s ease-in-out infinite;
}
:root[data-theme="light"] body::before { opacity: .55; }
body { transition: background-color .3s ease, color .3s ease; }

/* Entrances (they replay each time a hidden view is shown) */
.hero > * { animation: rise .6s cubic-bezier(.2, .7, .2, 1) both; }
.hero > :nth-child(2) { animation-delay: .06s; }
.hero > :nth-child(3) { animation-delay: .12s; }
.drop.big { animation: rise .6s .18s cubic-bezier(.2, .7, .2, 1) both; }
.tool-view, .suggest, .progress { animation: rise .4s cubic-bezier(.2, .7, .2, 1) both; }
.result { animation: rise .45s cubic-bezier(.2, .7, .2, 1) both; }
.result .ok-ico { animation: ring 1s .2s ease-out; }
.result .ok-ico path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: draw .5s .2s ease forwards; }
.pick-card { animation: rise .45s cubic-bezier(.2, .7, .2, 1) both; }
.pick-card:nth-child(2) { animation-delay: .07s; }
.pick-card:nth-child(3) { animation-delay: .14s; }
.toast { animation: rise .25s ease both; }
.dlg[open] { animation: rise .25s cubic-bezier(.2, .7, .2, 1); }
.dlg::backdrop { animation: fade .2s ease; }

/* Scroll reveal (class added by app.js, so nothing is hidden without JavaScript) */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .55s ease, transform .55s cubic-bezier(.2, .7, .2, 1); transition-delay: var(--d, 0s); }
.reveal.in { opacity: 1; transform: none; }

/* Hover life */
.drop.big .drop-ico { animation: bob 3.2s ease-in-out infinite; }
.drop:hover .drop-ico { transform: scale(1.06); }
.tool-card .ti, .pick-card .ti { transition: transform .25s cubic-bezier(.2, .7, .2, 1), background .2s ease; }
.tool-card:hover .ti, .pick-card:hover .ti { transform: scale(1.1) rotate(-6deg); background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff !important; }
.pick-card .go { transition: transform .2s ease; }
.pick-card:hover .go { transform: translateX(4px); }
.btn.primary { position: relative; overflow: hidden; }
.btn.primary::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .28) 50%, transparent 70%);
  transform: translateX(-120%); transition: transform .7s ease;
}
.btn.primary:hover:not(:disabled)::after { transform: translateX(120%); }
.plan.featured { animation: glow 4s ease-in-out infinite; }
.plan, .feat { transition: transform .2s ease, border-color .2s ease; }
.plan:hover, .feat:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.faq details[open] p { animation: rise .3s ease both; }
.bar span { background-image: linear-gradient(90deg, var(--accent), var(--accent-2)), repeating-linear-gradient(45deg, rgba(255, 255, 255, .18) 0 10px, transparent 10px 20px); background-blend-mode: overlay; background-size: 100% 100%, 40px 40px; animation: stripes .8s linear infinite; }
.nav { transition: box-shadow .2s ease, background .2s ease; }
.nav.scrolled { box-shadow: 0 8px 30px rgba(0, 0, 0, .18); }
.page-tile { transition: transform .15s ease, border-color .15s ease; }
.page-tile:hover { border-color: var(--accent); transform: translateY(-2px); }

/* ---------- Phone layout ---------- */
@media (max-width: 900px) {
  /* Keep the main button in reach while scrolling through pages or options */
  .tool-view.has-files { padding-bottom: 84px; }
  .tool-view.has-files #runBtn {
    position: fixed; left: 16px; right: 16px; bottom: calc(14px + env(safe-area-inset-bottom)); width: auto; z-index: 25;
    padding: 15px 18px; font-size: 16px; box-shadow: 0 12px 34px rgba(99, 102, 241, .5);
  }
}
@media (max-width: 520px) {
  .app { padding-top: 22px; }
  .hero { margin-bottom: 20px; }
  .lead { font-size: 15.5px; }
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tool-card { grid-template-columns: 1fr; grid-template-rows: auto; padding: 14px; row-gap: 6px; }
  .tool-card .ti { grid-row: auto; width: 36px; height: 36px; }
  .tool-card b { font-size: 14px; }
  .tool-card span:not(.ti):not(.pro-tag) { font-size: 12px; }
  .pick-top { grid-template-columns: 1fr; gap: 10px; }
  .pick-card { flex-direction: row; flex-wrap: wrap; align-items: center; column-gap: 12px; padding: 14px 44px 14px 14px; }
  .pick-card .ti.big { width: 44px; height: 44px; }
  .pick-card b { margin: 0; font-size: 16px; }
  .pick-card > span:not(.ti):not(.go) { flex-basis: 100%; padding-left: 56px; margin-top: -6px; font-size: 13px; }
  .pick-card .go { top: 50%; transform: translateY(-50%); }
  .pick-card:hover .go { transform: translate(4px, -50%); }
  .pick-title { margin-top: 22px; }
  /* Swipe through plans */
  .plans { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px; padding: 14px 16px 10px; margin: 0 -16px; scrollbar-width: none; }
  .plans::-webkit-scrollbar { display: none; }
  .plan { flex: 0 0 82%; scroll-snap-align: center; }
  .section { padding: 40px 0; }
  .sec-sub { margin-bottom: 20px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 22px; }
  .dlg { padding: 22px 18px 18px; border-radius: 20px; }
}

/* ---------- Edit PDF ---------- */
.editor { padding: 14px; }
.ed-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.ed-tools button { display: inline-flex; align-items: center; gap: 7px; padding: 9px 13px; border-radius: 11px; border: 1px solid var(--border-strong); background: var(--panel-2); font-weight: 650; font-size: 13.5px; color: var(--text); transition: background .15s ease, transform .12s ease; }
.ed-tools button .ico { width: 17px; height: 17px; }
.ed-tools button:hover { border-color: var(--accent); }
.ed-tools button:active { transform: scale(.97); }
.ed-tools button[aria-pressed="true"] { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-color: transparent; box-shadow: 0 6px 18px rgba(99, 102, 241, .35); }
.ed-props { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 40px; margin-bottom: 10px; padding: 6px 10px; border-radius: 12px; background: var(--panel-2); font-size: 13px; }
.ed-props select { padding: 6px 8px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--panel-solid); }
.ed-props .mini.on { background: var(--accent); color: #fff; border-color: transparent; }
.ed-group { display: flex; align-items: center; gap: 6px; }
.ed-size { min-width: 44px; text-align: center; font-weight: 650; }
.ed-hint { color: var(--muted); }
.ed-stage { position: relative; margin: 10px auto 0; max-width: 100%; box-shadow: var(--shadow); border-radius: 4px; }
.ed-stage canvas { display: block; max-width: 100%; height: auto; background: #fff; border-radius: 4px; }
.ed-layer { position: absolute; inset: 0; }
.ed-stage[data-mode="text"] .ed-layer { cursor: text; }
.ed-stage[data-mode="whiteout"] .ed-layer, .ed-stage[data-mode="highlight"] .ed-layer { cursor: crosshair; }
.ed-hit { position: absolute; border-radius: 2px; cursor: text; background: rgba(99, 102, 241, .07); outline: 1px dashed rgba(99, 102, 241, .45); transition: background .12s ease; }
.ed-hit:hover { background: rgba(99, 102, 241, .22); }
.eo { position: absolute; }
.eo.sel { outline: 1.5px solid var(--accent); outline-offset: 2px; }
.eo-txt { white-space: pre; line-height: 1.2; outline: none; min-width: 14px; cursor: text; user-select: text; -webkit-user-select: text; }
.eo-txt:empty::before { content: "Type here"; color: #9aa0b8; }
.eo-grip { position: absolute; left: -26px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 7px; background: var(--accent); color: #fff; display: none; place-items: center; cursor: move; touch-action: none; }
.eo-grip .ico { width: 14px; height: 14px; }
.eo.sel .eo-grip, .eo-text:hover .eo-grip { display: grid; }
.eo-del { position: absolute; right: -11px; top: -11px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; background: #ef4444; color: #fff; font-size: 14px; line-height: 16px; padding: 0; display: none; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }
.eo.sel .eo-del { display: block; }
.eo-rect, .eo-image { cursor: move; touch-action: none; }
.eo-image img { width: 100%; height: 100%; display: block; pointer-events: none; }
.eo .rs { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; cursor: nwse-resize; display: none; touch-action: none; }
.eo.sel .rs { display: block; }
.eo-rect.sel { outline-style: dashed; }

/* ---------- Trust strip, how it works, popular ---------- */
.trust { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; padding: 0; margin: 18px auto 0; max-width: 780px; color: var(--muted); font-size: 13.5px; font-weight: 600; animation: rise .6s .26s cubic-bezier(.2, .7, .2, 1) both; }
.trust li { display: flex; align-items: center; gap: 7px; }
.trust .ico { width: 16px; height: 16px; color: var(--ok); }
.suggest:not([hidden]) ~ .tools, .drop[hidden] + .trust { display: none; }
.hows { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; counter-reset: h; }
.how { position: relative; padding: 24px 22px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--panel); text-align: center; }
.how .ti { margin: 0 auto; }
.how h3 { margin: 14px 0 6px; font-size: 17px; }
.how p { margin: 0; color: var(--muted); font-size: 14px; }
.how:not(:last-child)::after { content: ""; position: absolute; top: 48px; right: -12px; width: 10px; height: 10px; border-top: 2px solid var(--border-strong); border-right: 2px solid var(--border-strong); transform: rotate(45deg); }
.popular .chips { justify-content: flex-start; }
.popular .chip { text-decoration: none; }
.footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1.1fr 1fr; }
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) {
  .hows { grid-template-columns: 1fr; }
  .how:not(:last-child)::after { display: none; }
  .trust { gap: 6px 14px; font-size: 12.5px; }
}

/* ---------- Editor v2 ---------- */
.ed-sep { width: 1px; align-self: stretch; background: var(--border-strong); margin: 2px 4px; }
.ed-tools button:disabled { opacity: .4; }
.ed-find { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; padding: 10px; border-radius: 12px; border: 1px solid var(--accent); background: var(--accent-soft); animation: rise .25s ease both; }
.ed-find input:not([type]) { flex: 1 1 140px; min-width: 0; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--panel-solid); }
.ed-check { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.ed-seg { flex-wrap: nowrap; padding: 3px; }
.ed-seg button { padding: 5px 9px; font-size: 12.5px; }
.eo-shape svg, .eo-line svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.eo-shape { cursor: move; touch-action: none; }
.eo-line { pointer-events: none; }
.eo-line svg path[pointer-events="stroke"] { cursor: move; touch-action: none; }
.eo-line .eo-del, .eo-line .ep { pointer-events: auto; }
.eo-line.sel { outline: none; }
.eo-line.sel svg { filter: drop-shadow(0 0 2px var(--accent)); }
.ep { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; cursor: grab; display: none; touch-action: none; }
.eo.sel .ep { display: block; }
.ed-stage[data-mode="draw"] .ed-layer, .ed-stage[data-mode="shape"] .ed-layer { cursor: crosshair; touch-action: none; }
.crop-stage { touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none; }
.crop-box { position: absolute; border: 2px solid var(--accent); box-shadow: 0 0 0 9999px rgba(10, 11, 20, .55); cursor: move; }
.crop-stage { overflow: hidden; }
.crop-box .rs { position: absolute; right: -8px; bottom: -8px; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; cursor: nwse-resize; }
@media (max-width: 640px) {
  .ed-tools { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px 10px; padding: 0 14px 2px; }
  .ed-tools::-webkit-scrollbar { display: none; }
  .ed-tools button { flex: none; }
  .ed-tools { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
}

/* ---------- Languages ---------- */
html.i18n-pending body { opacity: 0; }
body { transition: opacity .15s ease, background-color .3s ease, color .3s ease; }
.lang-wrap { position: relative; }
.lang-btn { width: auto; padding: 0 10px; gap: 5px; display: flex; align-items: center; font-size: 12.5px; font-weight: 700; }
.lang-btn .ico { width: 17px; height: 17px; }
.lang-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; min-width: 190px; padding: 6px; border-radius: 14px; border: 1px solid var(--border-strong); background: var(--panel-solid); box-shadow: var(--shadow); display: flex; flex-direction: column; animation: rise .18s ease both; }
.lang-menu button { text-align: left; padding: 9px 12px; border: 0; border-radius: 9px; background: transparent; font-size: 14px; font-weight: 550; color: var(--text); }
.lang-menu button:hover { background: var(--panel-2); }
.lang-menu button[aria-checked="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.mm-lang, .foot-lang { display: flex; align-items: center; gap: 8px; }
.mm-lang { padding: 10px 0; font-weight: 600; }
.mm-lang .ico, .foot-lang .ico { width: 17px; height: 17px; color: var(--muted); }
.lang-select { padding: 6px 10px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--panel-solid); color: var(--text); font-size: 13.5px; }
.mm-lang .lang-select { margin-left: auto; }
@media (max-width: 760px) { .lang-wrap { display: none; } }

/* ---------- Menu highlight, tablet header, large screens ---------- */
.nav-links a { position: relative; padding: 6px 2px; transition: color .15s ease; }
.nav-links a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transform: scaleX(0); transition: transform .2s ease; }
.nav-links a.active { color: var(--text) !important; }
.nav-links a.active::after, .nav-links a:hover::after { transform: scaleX(1); }
.nav-links a:hover::after { opacity: .5; }
.nav-links a.active:hover::after { opacity: 1; }
.mobile-menu a.active { color: var(--accent) !important; }
:root[data-theme="dark"] .mobile-menu a.active { color: #a5b4fc !important; }
.search-btn { white-space: nowrap; }
@media (max-width: 1100px) {
  .search-btn span { display: none; }
  .nav-links { gap: 18px; margin-left: 6px; }
}
@media (min-width: 1600px) {
  .wrap { max-width: 1400px; }
  .wrap.narrow { max-width: 900px; }
  body { font-size: 16px; }
}
