/* Strumenti PDF — loshop3d */
@font-face { font-family: "Barlow Condensed"; src: url("/assets/barlow-condensed-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Barlow Condensed"; src: url("/assets/barlow-condensed-latin-ext-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF; }
:root {
  --bg: #f4f2ee; --panel: #ffffff; --panel-2: #f7f5f1; --border: #dedad2; --border-strong: #c9c4ba;
  --text: #1f1d19; --text-dim: #67625a; --accent: #ff6b2c; --accent-ink: #c4471a; --on-accent: #1b1410;
  --danger: #b8472b; --ok: #2f7d45; --radius: 6px; --shadow: 0 1px 2px rgba(30,25,15,.06), 0 4px 14px rgba(30,25,15,.05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17191c; --panel: #212428; --panel-2: #2a2e33; --border: #363b42; --border-strong: #4a5059;
    --text: #eceae4; --text-dim: #a0a5ad; --accent-ink: #ff8a55; --danger: #e0714f; --ok: #77b985;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.2);
  }
}
:root[data-theme="dark"] {
  --bg: #17191c; --panel: #212428; --panel-2: #2a2e33; --border: #363b42; --border-strong: #4a5059;
  --text: #eceae4; --text-dim: #a0a5ad; --accent-ink: #ff8a55; --danger: #e0714f; --ok: #77b985;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
body { min-height: 100vh; display: flex; flex-direction: column; line-height: 1.5; }
main { flex: 1; }
a { color: var(--accent-ink); }
button, input, select, textarea { font-family: inherit; }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.skip { position: absolute; top: 8px; inset-inline-start: 8px; background: var(--panel); padding: 8px 12px; z-index: 200; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; white-space: nowrap; }
.skip:focus { clip-path: none; width: auto; height: auto; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- header ---------- */
.site-header { background: var(--panel); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; gap: 18px; min-height: 60px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-icon { width: 34px; height: 34px; border-radius: 8px; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.22rem; letter-spacing: .01em; text-transform: uppercase; }
.brand-by { display: flex; align-items: center; gap: 5px; font-size: .68rem; color: var(--text-dim); }
.brand-logo svg { height: 11px; width: auto; display: block; color: var(--text); }
.site-nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a { color: var(--text-dim); text-decoration: none; font-size: .86rem; font-weight: 550; padding: 7px 10px; border-radius: var(--radius); white-space: nowrap; }
.site-nav a:hover { color: var(--text); background: var(--panel-2); }
.site-nav a[aria-current="page"] { color: var(--accent-ink); background: var(--panel-2); }
.install-btn { background: transparent; border: 1px solid var(--accent); color: var(--accent-ink); border-radius: var(--radius); padding: 7px 12px; font-size: .82rem; font-weight: 600; cursor: pointer; }
.install-btn:hover { background: var(--accent); color: var(--on-accent); }

/* ---------- hero & content ---------- */
.hero { padding-top: 26px; padding-bottom: 14px; }
.hero h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.8rem, 4.2vw, 2.6rem); line-height: 1.05; letter-spacing: .005em; text-transform: uppercase; margin: 0 0 8px; }
.hero p { margin: 0 0 8px; color: var(--text-dim); max-width: 760px; font-size: .98rem; }
.privacy-badge { display: inline-flex; align-items: center; gap: 7px; font-size: .84rem !important; color: var(--ok) !important; background: color-mix(in srgb, var(--ok) 10%, transparent); border-radius: 99px; padding: 5px 12px 5px 9px; margin-top: 4px !important; }
.privacy-badge svg { width: 17px; height: 17px; flex-shrink: 0; }
.content { padding-top: 34px; padding-bottom: 10px; }
.content > * { max-width: 860px; }
.content > .tool-links, .content > .home-tools { max-width: none; }
.content > .home-tools { margin-top: -18px; }
.content h2, .shop h2, .support h2 { font-family: var(--font-display); font-weight: 700; text-transform: uppercase; font-size: 1.45rem; letter-spacing: .01em; margin: 30px 0 10px; line-height: 1.1; }
.content h3 { font-size: 1.02rem; margin: 18px 0 6px; }
.content p, .content li { color: var(--text-dim); font-size: .95rem; }
.content ol, .content ul { padding-left: 22px; }
.content li { margin: 4px 0; }
.content strong { color: var(--text); }
.faq { border: 1px solid var(--border); background: var(--panel); border-radius: var(--radius); margin: 8px 0; }
.faq summary { cursor: pointer; padding: 12px 14px; font-weight: 600; font-size: .94rem; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent-ink); font-weight: 700; }
.faq[open] summary::after { content: "−"; }
.faq p { margin: 0; padding: 0 14px 14px; }
.tool-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; padding: 0; list-style: none; }
.tool-links li { margin: 0; }
.tool-links a { display: block; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; text-decoration: none; color: var(--text); font-weight: 600; font-size: .92rem; }
.tool-links a span { display: block; font-weight: 400; color: var(--text-dim); font-size: .82rem; margin-top: 2px; }
.tool-links a:hover { border-color: var(--accent); }

/* ---------- app shell ---------- */
.app-wrap { padding-top: 6px; }
.app { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px; box-shadow: var(--shadow); }
.sub { color: var(--text-dim); font-size: .86rem; margin: 0 0 14px; line-height: 1.5; }
.tabs { display: flex; gap: 18px; margin-bottom: 16px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tab { background: transparent; border: none; color: var(--text-dim); padding: 10px 2px; font-size: .94rem; font-weight: 650; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.drop { border: 1.5px dashed var(--border-strong); border-radius: var(--radius); background: var(--panel-2); padding: 30px 16px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.drag, .drop:focus-visible { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--panel-2)); }
.drop-icon { width: 34px; height: 34px; color: var(--accent); margin-bottom: 6px; }
.drop p { margin: 0; color: var(--text-dim); font-size: .9rem; line-height: 1.5; }
.drop strong { color: var(--text); font-weight: 650; font-size: 1rem; }
input[type=file] { display: none; }

input[type=text], input[type=number], input[type=password], select {
  background: var(--panel); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius);
  padding: 8px 10px; font-size: .86rem; min-height: 38px; }
input[type=text]:focus, input[type=number]:focus, input[type=password]:focus, select:focus { outline: none; border-color: var(--accent); }

/* merge list */
.filelist { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.fitem { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; display: grid; grid-template-columns: 58px 1fr auto; align-items: center; gap: 12px; }
.fitem.dragging { opacity: .4; }
.fitem.dragover { border-color: var(--accent); }
.thumb-wrap { width: 58px; height: 58px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 4px; display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: zoom-in; padding: 0; }
.thumb-wrap img { max-width: 100%; max-height: 100%; display: block; transition: transform .15s ease; }
.thumb-wrap .thumb-fallback { color: var(--text-dim); font-size: .7rem; }
.finfo { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.finfo .name { font-size: .88rem; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: grab; }
.finfo .meta { color: var(--text-dim); font-size: .75rem; }
.finfo .range-in { min-height: 32px; padding: 5px 8px; font-size: .8rem; max-width: 260px; }
.fctrl { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.sqbtn { background: transparent; border: 1px solid var(--border); color: var(--text); border-radius: var(--radius); width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-size: .95rem; padding: 0; }
.sqbtn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-ink); }
.sqbtn.danger:hover:not(:disabled) { border-color: var(--danger); color: var(--danger); }
.sqbtn:disabled { opacity: .35; cursor: default; }
.angle-tag { font-size: .72rem; color: var(--text-dim); min-width: 30px; text-align: center; }
.merge-summary { color: var(--text-dim); font-size: .8rem; margin: 10px 0 0; }
.empty-hint { color: var(--text-dim); font-size: .82rem; margin: 14px 0 0; text-align: center; }

.actions { margin-top: 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
button.primary { background: var(--accent); color: var(--on-accent); border: none; border-radius: var(--radius); padding: 11px 18px; font-size: .92rem; font-weight: 700; cursor: pointer; min-height: 44px; }
button.primary:hover:not(:disabled) { filter: brightness(1.06); }
button.primary:disabled { background: var(--border); color: var(--text-dim); cursor: not-allowed; }
button.primary.small { min-height: 36px; padding: 7px 12px; font-size: .82rem; }
button.ghost { background: transparent; border: 1px solid var(--border); color: var(--text-dim); border-radius: var(--radius); padding: 9px 13px; font-size: .85rem; cursor: pointer; min-height: 40px; }
button.ghost:hover:not(:disabled) { color: var(--text); border-color: var(--border-strong); }
button.ghost:disabled { opacity: .4; cursor: default; }
button.ghost.small { min-height: 34px; padding: 6px 10px; font-size: .8rem; }
.namefield { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--text-dim); }
.namefield input { width: 200px; }
.check-opt { display: inline-flex; align-items: flex-start; gap: 8px; font-size: .82rem; color: var(--text); cursor: pointer; line-height: 1.35; max-width: 520px; }
.check-opt small { color: var(--text-dim); }
.check-opt input { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; margin: 0; }

.status { margin-top: 10px; font-size: .86rem; color: var(--text-dim); min-height: 1.2em; }
.status.ok { color: var(--ok); } .status.err { color: var(--danger); }
.note { color: var(--text-dim); font-size: .8rem; margin-top: 12px; line-height: 1.55; background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.note b { color: var(--text); font-weight: 600; }
.note p { margin: 6px 0 0; }
.tips summary { cursor: pointer; font-weight: 600; color: var(--text); }

/* ---------- after download ---------- */
.after-dl { margin-top: 12px; border: 1px solid color-mix(in srgb, var(--ok) 35%, var(--border)); background: color-mix(in srgb, var(--ok) 6%, var(--panel)); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; animation: fadein .25s ease; }
.after-dl-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: .88rem; }
.after-dl-head strong { color: var(--ok); }
.after-dl .mini-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.after-dl .close-x { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 1rem; padding: 2px 6px; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- products ---------- */
.shop { padding-top: 10px; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.product { display: flex; gap: 12px; align-items: flex-start; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; text-decoration: none; color: var(--text); transition: border-color .15s; }
.product:hover { border-color: var(--accent); }
.product-icon { width: 40px; height: 40px; flex-shrink: 0; border-radius: 8px; background: color-mix(in srgb, var(--accent) 12%, var(--panel-2)); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; }
.product-icon svg { width: 22px; height: 22px; }
.product-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.product-title { font-weight: 650; font-size: .9rem; line-height: 1.3; }
.product-desc { color: var(--text-dim); font-size: .8rem; line-height: 1.4; }
.product-price { font-size: .86rem; font-weight: 700; margin-top: 2px; }
.product-price s { color: var(--text-dim); font-weight: 400; font-size: .8rem; }
.product-price .disc { background: var(--accent-ink); color: #fff; border-radius: 3px; padding: 0 4px; font-size: .72rem; font-weight: 700; }
.product-price small { font-weight: 400; color: var(--text-dim); font-size: .72rem; }
.product-cta { font-size: .8rem; color: var(--accent-ink); font-weight: 600; margin-top: 3px; }
.product.compact { padding: 9px 10px; }
.product.compact .product-icon { width: 32px; height: 32px; }
.product.compact .product-icon svg { width: 18px; height: 18px; }
.shop-note, .ad-label { color: var(--text-dim); font-size: .74rem; margin: 8px 0 0; }
.ad-label { margin: 0; }

/* photo, store label, top ad slots */
.product-photo { width: 72px; height: 72px; flex-shrink: 0; border-radius: 8px; overflow: hidden; background: #fff; border: 1px solid var(--border); }
.product-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-store { align-self: flex-start; font-size: .66rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-dim); border: 1px solid var(--border-strong); border-radius: 3px; padding: 0 5px; margin-bottom: 2px; line-height: 1.5; }
.product.compact .product-photo, .product-compact .product-photo { width: 46px; height: 46px; border-radius: 6px; }
.product-compact { padding: 9px 10px; }
.product-compact .product-icon { width: 32px; height: 32px; }
.product-compact .product-icon svg { width: 18px; height: 18px; }
.product-hero { padding: 14px; box-shadow: var(--shadow); }
.product-hero .product-photo { width: 96px; height: 96px; }
.product-strip { padding: 10px 12px; align-items: center; }
.product-strip .product-photo { width: 56px; height: 56px; }
.product-strip .product-cta { margin-top: 1px; }
.hero-ad .ad-label, .mid-ad .ad-label { margin: 0 0 5px; }
.mid-ad { padding-top: 14px; }
@media (min-width: 1000px) {
  body.has-hero-ad .hero { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: center; }
  .mid-ad { display: none !important; }
}
@media (max-width: 999px) {
  .hero-ad { display: none !important; }
}

/* ---------- support ---------- */
.support { padding-top: 26px; padding-bottom: 34px; }
.support-card { display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; }
.support-card h2 { margin: 0 0 4px; }
.support-card p { margin: 0; color: var(--text-dim); font-size: .9rem; max-width: 560px; }
.support-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.donate-btn { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; border-radius: var(--radius); padding: 10px 14px; font-weight: 650; font-size: .88rem; border: 1px solid var(--border); color: var(--text); background: var(--panel-2); }
.donate-btn:hover { border-color: var(--accent); }
.donate-btn.coffee { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.donate-btn svg { width: 18px; height: 18px; }
.inline-donate { font-size: .84rem; color: var(--text-dim); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-donate a { font-weight: 600; }

/* ---------- footer ---------- */
.site-footer { background: var(--panel); border-top: 1px solid var(--border); padding: 22px 0 calc(22px + env(safe-area-inset-bottom)); }
.footer-inner { display: grid; gap: 16px; grid-template-columns: 1fr; align-items: start; }
.footer-made { display: flex; gap: 14px; align-items: center; }
.footer-logo svg { height: 22px; width: auto; display: block; color: var(--text); }
.footer-made p { margin: 0; font-size: .86rem; color: var(--text-dim); }
.footer-nav { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: flex-start; }
.footer-nav a { color: var(--text-dim); font-size: .82rem; text-decoration: none; }
.footer-nav a:hover { color: var(--text); text-decoration: underline; }
.footer-legal { grid-column: 1 / -1; color: var(--text-dim); font-size: .74rem; margin: 0; border-top: 1px solid var(--border); padding-top: 12px; }

/* ---------- editor ---------- */
.file-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.file-bar .fname { font-size: .88rem; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.file-bar .fname b { color: var(--text); font-weight: 650; }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.editor-main { min-width: 0; }

.editor-toolbar { container-type: inline-size; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px; margin-bottom: 10px; position: sticky; top: 0; z-index: 20; box-shadow: var(--shadow); }
.tool-row { display: flex; gap: 4px; align-items: center; }
.tool-scroll { display: flex; flex-wrap: wrap; gap: 2px; flex: 1; min-width: 0; }
.tool-fixed { display: flex; gap: 2px; padding-left: 6px; border-left: 1px solid var(--border); align-self: flex-start; }
@container (max-width: 980px) {
  .tool-btn .lbl { display: none; }
  .tool-btn { min-width: 40px; justify-content: center; padding: 6px 8px; }
}
.opt-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; min-height: 40px; }
.tool-btn { background: transparent; border: 1px solid transparent; color: var(--text); border-radius: var(--radius); padding: 6px 9px; font-size: .8rem; cursor: pointer; min-height: 40px; display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; white-space: nowrap; }
.tool-btn:hover:not(:disabled) { background: var(--panel-2); }
.tool-btn.active { color: var(--accent-ink); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.tool-btn:disabled { opacity: .35; cursor: default; }
.lbl-m { display: none; }
.tool-btn svg { width: 19px; height: 19px; flex-shrink: 0; }
.tool-btn.pulse { animation: pulse 1.4s ease 3; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); } 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 0%, transparent); border-color: var(--accent); } }
.spacer { flex: 1; }
.tool-opt { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--text-dim); }
.tool-opt input[type=color] { width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 4px; padding: 0; background: none; cursor: pointer; }
.tool-opt input[type=range] { width: 100px; accent-color: var(--accent); }
.tool-opt input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); }
.tool-opt select { min-height: 34px; padding: 4px 6px; font-size: .8rem; }
.size-val { min-width: 44px; color: var(--text); font-variant-numeric: tabular-nums; }
.swatches { display: inline-flex; gap: 5px; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border-strong); cursor: pointer; padding: 0; }
.swatch.on { outline: 2px solid var(--accent); outline-offset: 2px; }
.swatch-black { background: #111111; } .swatch-blue { background: #1f3fbf; }
.opt-hint { font-size: .76rem; color: var(--text-dim); line-height: 1.35; flex: 1; min-width: 200px; }

.stage-scroll { overflow: auto; background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 0; max-height: 80vh; overscroll-behavior: contain; }
.canvas-stage { position: relative; margin: 0 auto; }
#edCanvas { display: block; background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.18); touch-action: manipulation; }
.canvas-stage.drawing #edCanvas { touch-action: none; }
.floating-input { position: absolute; z-index: 5; border: 1px dashed var(--accent); background: rgba(255,255,255,.88); padding: 0; margin: 0; outline: none; resize: none; overflow: hidden; white-space: pre; line-height: 1.2; min-width: 40px; }

.page-nav { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.page-nav button { min-width: 42px; }
.page-nav .pnum { font-size: .84rem; color: var(--text-dim); display: inline-flex; align-items: center; gap: 6px; }
.page-nav .pnum input { width: 58px; text-align: center; min-height: 38px; padding: 4px; }
.nav-sep { width: 1px; height: 26px; background: var(--border); margin: 0 4px; }

/* pages panel */
.pages-panel summary { cursor: pointer; font-family: var(--font-display); font-weight: 700; text-transform: uppercase; font-size: 1.1rem; padding: 4px 0; }
.pages-panel summary span { color: var(--text-dim); font-family: var(--font); font-weight: 400; text-transform: none; font-size: .85rem; }
.split-controls, .sel-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 10px 0 0; }
.split-controls input[type=text] { flex: 1; min-width: 120px; min-height: 34px; padding: 5px 8px; }
.sel-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.page-add { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.sel-info { font-size: .8rem; color: var(--text-dim); width: 100%; }
.pg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-top: 12px; }
.pg-cell { position: relative; border: 2px solid var(--border); border-radius: 4px; cursor: pointer; background: var(--panel-2); aspect-ratio: .74; display: flex; align-items: center; justify-content: center; padding: 6px; user-select: none; }
.pg-cell.current { border-color: var(--border-strong); background: color-mix(in srgb, var(--accent) 5%, var(--panel-2)); }
.pg-cell.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.pg-cell.dragover { outline: 2px dashed var(--accent); outline-offset: 2px; }
.pg-cell canvas { visibility: hidden; }
.pg-cell.ready canvas { visibility: visible; }
.pg-cell canvas { max-width: 100%; max-height: 100%; display: block; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.pg-cell .pg-num { position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.72); color: #fff; font-size: .68rem; padding: 0 6px; border-radius: 3px; }
.pg-cell .pg-check, .pg-cell .pg-btn { position: absolute; top: 3px; width: 26px; height: 26px; border: none; border-radius: 4px; background: rgba(0,0,0,.6); color: #fff; font-size: .78rem; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.pg-cell .pg-check { left: 3px; }
.pg-cell.selected .pg-check { background: var(--accent); color: var(--on-accent); }
.pg-cell .pg-btn.rot { right: 32px; }
.pg-cell .pg-btn.del { right: 3px; }
.pg-cell .pg-btn:hover { background: var(--accent); color: var(--on-accent); }
.pg-cell .pg-btn.del:hover { background: var(--danger); color: #fff; }
.pg-cell .pg-btn { opacity: 0; transition: opacity .12s; }
.pg-cell:hover .pg-btn, .pg-cell.selected .pg-btn { opacity: 1; }
@media (hover: none) { .pg-cell .pg-btn { opacity: 1; } }

/* ---------- lightbox & modal ---------- */
.lightbox-overlay, .modal-overlay { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; }
.lightbox-overlay { background: rgba(10,10,10,.93); }
.lightbox-overlay img { max-width: 100%; max-height: 78vh; background: #fff; box-shadow: 0 10px 34px rgba(0,0,0,.5); }
.lightbox-nav { display: flex; align-items: center; gap: 18px; margin-top: 14px; color: #efece4; }
.lightbox-nav button, .lightbox-close { background: transparent; border: 1px solid #565b62; color: #efece4; border-radius: var(--radius); min-width: 44px; min-height: 44px; cursor: pointer; font-size: 1rem; }
.lightbox-close { position: absolute; top: max(14px, env(safe-area-inset-top)); right: 14px; }
#lightboxCaption { min-width: 160px; text-align: center; font-size: .82rem; color: #c4c7cc; }
.modal-overlay { background: rgba(10,10,10,.6); }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 18px; width: 100%; max-width: 640px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.modal h2 { font-family: var(--font-display); text-transform: uppercase; font-size: 1.3rem; margin: 0 0 4px; }
.sig-wrap { position: relative; background: #fff; border: 1px solid var(--border); border-radius: 4px; touch-action: none; }
.sig-wrap canvas { display: block; width: 100%; cursor: crosshair; touch-action: none; }
.sig-line { position: absolute; left: 8%; right: 8%; bottom: 24%; border-bottom: 1px dashed #b9b4aa; pointer-events: none; }
.sig-remember { margin-top: 12px; }
.sig-opts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; font-size: .82rem; color: var(--text-dim); }

#previewBtn { display: inline-flex; align-items: center; gap: 6px; }
#previewBtn svg { width: 17px; height: 17px; }
.pg-cell:not(.ready)::before { content: ""; position: absolute; inset: 14px 12px 22px; background: var(--panel); border-radius: 2px; opacity: .7; }

/* ---------- responsive ---------- */
@media (min-width: 1100px) {
  .editor-layout { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
  .editor-side { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
  .editor-side .pg-grid { grid-template-columns: repeat(2, 1fr); }
  .stage-scroll { max-height: calc(100vh - 210px); min-height: 420px; }
}
@media (max-width: 1099px) {
  .editor-side { border-top: 1px solid var(--border); padding-top: 12px; }
}
@media (max-width: 720px) {
  .hero { padding-top: 18px; }
  .app { padding: 12px; border-radius: 8px; margin-left: -4px; margin-right: -4px; }
  .fitem { grid-template-columns: 58px 1fr; }
  .fctrl { grid-column: 1 / -1; justify-content: space-between; }
  /* phone: icon + short name on every tool, 6 per row */
  .tool-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px; }
  .tool-scroll, .tool-fixed { display: contents; }
  .editor-toolbar .tool-btn { flex-direction: column; justify-content: center; gap: 3px; padding: 6px 1px 5px; min-width: 0; min-height: 54px; }
  .editor-toolbar .tool-btn .lbl { display: block; font-size: 10.5px; line-height: 1.1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -.01em; }
  .tool-btn:disabled .lbl { opacity: .8; }
  .opt-row { gap: 8px; min-height: 0; }
  .opt-hint { flex-basis: 100%; min-width: 0; font-size: .74rem; order: 10; }
  .tool-opt input[type=range] { width: 84px; }
  .stage-scroll { max-height: 68vh; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-nav { justify-content: flex-start; }
  .footer-made { flex-direction: column; align-items: flex-start; }
  .namefield { width: 100%; }
  .namefield input { flex: 1; width: auto; }
  .support-card { padding: 16px; }
  .brand-by { display: none; }
  .header-inner { gap: 6px 12px; }
  .site-nav { order: 3; flex-basis: 100%; margin: 0 -6px; }
  .install-btn { margin-left: auto; }
}
@media (max-width: 420px) {
  .page-nav .nav-sep { display: none; }
  #previewBtn { order: 0; }
}
@media (display-mode: standalone) {
  .install-btn { display: none !important; }
}
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- phone layout (≤720px): full-width tool, compact controls ---------- */
@media (max-width: 720px) {
  .app-wrap { padding-left: 0; padding-right: 0; }
  .app { border-left: none; border-right: none; border-radius: 0; margin: 0; padding: 10px 12px 14px; box-shadow: none; }
  .tabs { gap: 14px; margin-bottom: 12px; }
  .tab { font-size: .9rem; }
  .drop { padding: 22px 12px; }
  .stage-scroll { margin: 0 -12px; border-left: none; border-right: none; border-radius: 0; padding: 8px 0; }
  .editor-toolbar { margin-left: -6px; margin-right: -6px; }
  .page-nav { flex-wrap: nowrap; gap: 4px; justify-content: space-between; }
  .page-nav .ghost { min-width: 36px; min-height: 38px; padding: 6px 8px; }
  .page-nav .pnum { gap: 4px; }
  .page-nav .pnum-label, #previewBtn .lbl, .page-nav .nav-sep { display: none; }
  .page-nav .pnum input { width: 44px; }
  #zoomFitBtn { min-width: 50px; padding: 6px 4px; }
  .save-actions { flex-direction: column; align-items: stretch; }
  .save-actions .primary { width: 100%; }
  #tab-merge > .actions { display: grid; grid-template-columns: 1fr 1fr; }
  #tab-merge > .actions .primary, #tab-merge > .actions .namefield { grid-column: 1 / -1; }
  #tab-merge > .actions .primary { width: 100%; }
  #tab-merge > .actions #clearBtn[hidden] + .namefield { grid-column: 1 / -1; }
  #mergeEditBtn:only-of-type { grid-column: 1 / -1; }
  .fitem { padding: 10px; gap: 10px; }
  .fctrl .sqbtn { width: 40px; height: 40px; }
  .split-controls input[type=text] { flex-basis: 100%; }
  .sel-info { margin-top: 4px; }
  .pg-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .editor-side .actions { display: grid; grid-template-columns: 1fr 1fr; }
  .editor-side .actions button { width: 100%; }
  .file-bar { margin-bottom: 8px; }
  .check-opt { font-size: .8rem; }
}

/* ======================================================================
   New tools
   ====================================================================== */
.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 14px; margin-top: 14px; }
.opt-grid label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; font-weight: 600; color: var(--text-dim); }
.opt-grid label.wide { grid-column: 1 / -1; }
.opt-grid select, .opt-grid input[type=text], .opt-grid input[type=number], .opt-grid input[type=password] { width: 100%; font-weight: 400; color: var(--text); }
.opt-grid input[type=color] { width: 100%; height: 38px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); padding: 2px; }
.hint-line { color: var(--text-dim); font-size: .84rem; margin: 10px 0 0; }
.fld-full { display: flex; flex-direction: column; gap: 6px; font-size: .84rem; font-weight: 600; margin-top: 14px; }
.fld-full textarea { width: 100%; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); color: var(--text); padding: 10px; font: inherit; font-weight: 400; font-size: .86rem; line-height: 1.5; resize: vertical; }

.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 14px; }
.img-card { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.img-thumb { aspect-ratio: 0.8; display: flex; align-items: center; justify-content: center; background: var(--panel); padding: 8px; cursor: grab; }
.img-thumb img { max-width: 100%; max-height: 100%; display: block; box-shadow: 0 1px 4px rgba(0,0,0,.2); transition: transform .15s; }
.img-card-bar { display: flex; align-items: center; gap: 3px; padding: 5px; border-top: 1px solid var(--border); }
.img-card-bar .sqbtn { width: 30px; height: 30px; font-size: .85rem; }
.thumb-wait { color: var(--text-dim); font-size: 1.4rem; }
.img-num { font-size: .78rem; font-weight: 700; color: var(--text-dim); margin-right: auto; padding-left: 4px; }

.level-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 14px 0 12px; }
.level { position: relative; border: 1.5px solid var(--border); border-radius: 8px; padding: 12px 12px 12px 38px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; background: var(--panel); }
.level input { position: absolute; left: 12px; top: 14px; accent-color: var(--accent); width: 17px; height: 17px; }
.level b { font-size: .92rem; }
.level span { font-size: .78rem; color: var(--text-dim); line-height: 1.35; }
.level:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--panel)); }

.progress { height: 8px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 99px; overflow: hidden; margin-top: 12px; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 14px; }
.result-card { display: flex; flex-direction: column; gap: 4px; align-items: center; text-decoration: none; color: var(--text); background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; font-size: .76rem; }
.result-card img { width: 100%; aspect-ratio: .75; object-fit: contain; background: #fff; }
.result-card b { color: var(--accent-ink); }
.result-card:hover { border-color: var(--accent); }

.stamp-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; margin-top: 12px; align-items: start; }
.opt-set { border: 1px solid var(--border); border-radius: 8px; padding: 6px 14px 14px; margin: 0 0 12px; }
.opt-set legend { padding: 0 6px; }
.stamp-preview { position: sticky; top: 12px; display: flex; flex-direction: column; align-items: center; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.stamp-preview canvas { max-width: 100%; height: auto !important; box-shadow: 0 1px 6px rgba(0,0,0,.2); background: #fff; }

.form-pages { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 12px; background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 8px; overflow-x: auto; }
.form-page { position: relative; box-shadow: 0 1px 6px rgba(0,0,0,.2); background: #fff; flex-shrink: 0; }
.form-page canvas { display: block; }
.form-ctl { position: absolute; box-sizing: border-box; margin: 0; border: 1px solid rgba(31,79,209,.45); background: rgba(219,232,255,.55); color: #111; padding: 0 3px; font-family: Helvetica, Arial, sans-serif; border-radius: 2px; }
.form-ctl:focus { outline: 2px solid var(--accent); background: rgba(255,255,255,.95); }
textarea.form-ctl { resize: none; line-height: 1.2; }
input[type=checkbox].form-ctl, input[type=radio].form-ctl { accent-color: #1f4fd1; padding: 0; }
.form-inline { display: block; margin-top: 4px; width: 100%; }
.frm-extra h3 { font-size: .95rem; margin: 18px 0 4px; }
.sticky-actions { position: sticky; bottom: 0; background: var(--panel); padding: 10px 0; border-top: 1px solid var(--border); z-index: 5; }

.scan-start { display: flex; gap: 10px; flex-wrap: wrap; }
.big-btn { display: inline-flex; align-items: center; gap: 9px; border-radius: var(--radius); padding: 14px 20px; font-weight: 650; font-size: .95rem; cursor: pointer; }
.big-btn.primary { background: var(--accent); color: var(--on-accent); }
.big-btn.ghost { border: 1px solid var(--border); color: var(--text); background: var(--panel); }
.big-btn svg { width: 22px; height: 22px; }
.scan-modal { max-width: 760px; }
.scan-stage { display: flex; justify-content: center; background: #222; border-radius: 4px; padding: 6px; touch-action: none; }
.scan-stage canvas { touch-action: none; cursor: crosshair; }
.scan-tools { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-top: 10px; }
.scan-tools label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; font-weight: 600; color: var(--text-dim); }

.next-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; font-size: .84rem; color: var(--text-dim); }
.next-row span { margin-right: 4px; }

@media (max-width: 860px) {
  .stamp-layout { grid-template-columns: 1fr; }
  .stamp-preview { position: static; order: -1; }
}
@media (max-width: 720px) {
  .img-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .scan-start .big-btn { flex: 1 1 100%; justify-content: center; }
  .modal { padding: 14px; }
}

/* ======================================================================
   Navigation: tools menu (desktop dropdown, phone full-screen sheet) and home grid
   ====================================================================== */
.menu-btn { display: inline-flex; align-items: center; gap: 7px; background: var(--panel-2); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius); padding: 8px 12px; font-weight: 650; font-size: .88rem; cursor: pointer; }
.menu-btn svg { width: 18px; height: 18px; }
.mb-short { display: none; }
.menu-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent-ink); }
.quick-nav { display: flex; gap: 2px; flex: 1; min-width: 0; overflow: hidden; }
.quick-nav a { color: var(--text-dim); text-decoration: none; font-size: .86rem; font-weight: 550; padding: 7px 10px; border-radius: var(--radius); white-space: nowrap; }
.quick-nav a:hover { color: var(--text); background: var(--panel-2); }
.quick-nav a[aria-current="page"] { color: var(--accent-ink); background: var(--panel-2); }
.site-header { position: relative; z-index: 60; }
.mega { position: absolute; left: 0; right: 0; top: 100%; background: var(--panel); border-bottom: 1px solid var(--border); box-shadow: 0 18px 40px rgba(0,0,0,.18); z-index: 70; max-height: calc(100vh - 70px); overflow: auto; }
.mega-inner { padding-top: 16px; padding-bottom: 22px; }
.mega-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.mega-search { flex: 1; max-width: 420px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: var(--radius); padding: 0 10px; background: var(--panel-2); }
.mega-search svg { width: 17px; height: 17px; color: var(--text-dim); flex-shrink: 0; }
.mega-search input { border: none; background: transparent; min-height: 40px; flex: 1; font-size: .92rem; padding: 0; }
.mega-search input:focus { outline: none; }
.mega-close { margin-left: auto; background: transparent; border: 1px solid var(--border); border-radius: var(--radius); width: 40px; height: 40px; cursor: pointer; color: var(--text); font-size: 1rem; }
.tool-groups { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 18px 16px; }
@media (max-width: 1200px) { .tool-groups { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tool-group h3 { font-family: var(--font-display); text-transform: uppercase; font-size: .95rem; letter-spacing: .02em; color: var(--text-dim); margin: 0 0 6px; }
.tool-link { display: flex; gap: 10px; align-items: flex-start; padding: 8px; border-radius: 8px; text-decoration: none; color: var(--text); }
.tool-link:hover, .tool-link:focus-visible { background: var(--panel-2); }
.tool-link[aria-current="page"] { background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.tool-ico, .tool-link .tool-ico { width: 44px; height: 44px; border-radius: 11px; flex-shrink: 0; display: flex; margin: 0; align-items: center; justify-content: center; background: color-mix(in srgb, var(--accent) 12%, var(--panel-2)); color: var(--accent-ink); }
.tool-ico svg { width: 30px; height: 30px; display: block; }
.tool-link b { display: block; font-size: .88rem; font-weight: 650; }
.tool-link > span:last-child > span { display: block; font-size: .76rem; color: var(--text-dim); line-height: 1.35; margin-top: 1px; }
.tool-link { align-items: center; }
.tool-link.is-hidden, .tool-group.is-hidden { display: none; }
.mega-empty { color: var(--text-dim); font-size: .88rem; }
body.menu-open { overflow: hidden; }

/* home: all tools as cards */
.home-tools { padding-top: 8px; }
.home-tools .mega-search { max-width: 520px; margin-bottom: 18px; background: var(--panel); }
.home-tools .tool-groups { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 22px; }
.home-tools .tool-link { background: var(--panel); border: 1px solid var(--border); margin-bottom: 8px; padding: 12px; }
.home-tools .tool-link:hover { border-color: var(--accent); }

/* related tools under each tool */
.related { padding-top: 6px; }
.related h2 { margin-top: 26px; }
.related .tool-groups { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.related .tool-link { background: var(--panel); border: 1px solid var(--border); }

@media (max-width: 1000px) {
  .tool-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-nav a:nth-child(n+4) { display: none; }
}
@media (max-width: 720px) {
  .quick-nav { display: none; }
  .header-inner { flex-wrap: nowrap; }
  .menu-btn { margin-left: auto; }
  .mb-long, .install-btn { display: none !important; }
  .mb-short { display: inline; }
  .mega { position: fixed; inset: 0; top: 0; max-height: none; border: none; }
  .mega-inner { padding-top: 12px; }
  .tool-groups { grid-template-columns: 1fr; gap: 14px; }
  .home-tools .tool-groups { grid-template-columns: 1fr; }
  .mega-search { max-width: none; }
}

/* ======================================================================
   Group colours (home, menu, related) and home layout
   ====================================================================== */
:root { --g-org: #2563c9; --g-edit: #d9541a; --g-conv: #13875a; --g-opt: #7c4dd8; --g-sec: #b42a5c; --g-ship: #a15c07; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --g-org: #6c9cf0; --g-edit: #ff8a55; --g-conv: #4cc293; --g-opt: #ac8bf5; --g-sec: #ef7aa5; --g-ship: #e0a14a; } }
:root[data-theme="dark"] { --g-org: #6c9cf0; --g-edit: #ff8a55; --g-conv: #4cc293; --g-opt: #ac8bf5; --g-sec: #ef7aa5; --g-ship: #e0a14a; }
.g-org { --g: var(--g-org); } .g-edit { --g: var(--g-edit); } .g-conv { --g: var(--g-conv); } .g-opt { --g: var(--g-opt); } .g-sec { --g: var(--g-sec); } .g-ship { --g: var(--g-ship); }
.tool-link .tool-ico, .tile .tile-ico { background: color-mix(in srgb, var(--g, var(--accent)) 14%, var(--panel)); color: var(--g, var(--accent-ink)); }
.tool-group:has(.g-org) h3, .tool-group:has(.g-edit) h3, .tool-group:has(.g-conv) h3, .tool-group:has(.g-opt) h3, .tool-group:has(.g-sec) h3, .tool-group:has(.g-ship) h3 { color: var(--text-dim); }

/* drop zone */
.home-drop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 34px 16px; margin-top: -10px; background: var(--panel); border-width: 2px; border-radius: 12px; }
.home-drop .drop-icon { width: 42px; height: 42px; margin: 0; }
.home-drop strong { font-size: 1.15rem; }
.btn-like { display: inline-flex; background: var(--accent); color: var(--on-accent); font-weight: 700; border-radius: var(--radius); padding: 10px 20px; font-size: .92rem; margin-top: 4px; }
.content > .home-drop, .content > .home-tools { max-width: none; }

/* tiles */
.home-tools { margin-top: 26px !important; }
.home-h { margin: 0 0 12px !important; }
.tile { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px; transition: border-color .15s, transform .15s, box-shadow .15s; position: relative; min-width: 0; }
.tile:hover, .tile:focus-visible { border-color: var(--g, var(--accent)); transform: translateY(-2px); box-shadow: var(--shadow); }
.tile .tile-ico { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; margin-bottom: 6px; flex-shrink: 0; }
.tile .tile-ico svg { width: 30px; height: 30px; display: block; }
.tile b { font-size: .95rem; font-weight: 700; line-height: 1.25; }
.tile-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tile-txt > span { font-size: .8rem; color: var(--text-dim); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile.is-hidden, .tool-sec.is-hidden { display: none; }
.tile-big { padding: 18px 16px; }
.tile-big .tile-ico { width: 58px; height: 58px; border-radius: 14px; }
.tile-big .tile-ico svg { width: 36px; height: 36px; }
.tile-big b { font-size: 1.05rem; }
.pop-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 30px; }

.home-filter { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-bottom: 18px; position: sticky; top: 0; z-index: 10; background: var(--bg); padding: 10px 0; }
.home-filter .mega-search { max-width: 340px; flex: 1 1 240px; background: var(--panel); margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 99px; padding: 7px 13px; font-size: .84rem; font-weight: 600; cursor: pointer; }
.chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--g); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip.on i { box-shadow: 0 0 0 2px var(--bg); }

.tool-sections { display: flex; flex-direction: column; gap: 26px; }
.tool-sec h2 { display: flex; align-items: center; gap: 9px; margin: 0 0 10px !important; font-size: 1.2rem !important; }
.tool-sec h2 i { width: 12px; height: 12px; border-radius: 3px; background: var(--g); }
.tool-sec h2 small { font-family: var(--font); text-transform: none; font-weight: 400; font-size: .8rem; color: var(--text-dim); letter-spacing: 0; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 10px; }
.tile-grid .tile { flex-direction: row; align-items: center; gap: 12px; padding: 12px; }
.tile-grid .tile .tile-ico { margin: 0; flex-shrink: 0; }
.tile-grid .tile b { display: block; }


/* "what do you want to do" after dropping a file */
.choose-modal { max-width: 860px; max-height: 88vh; overflow: auto; }
.choose-modal h2 { overflow-wrap: anywhere; }
.choose-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-top: 12px; }
.choose-grid .tile { flex-direction: row; gap: 10px; align-items: center; padding: 11px; }
.choose-grid .tile .tile-ico { margin: 0; width: 42px; height: 42px; flex-shrink: 0; }
.choose-grid .tile b { display: block; font-size: .9rem; }
.choose-grid .tile-pop { border-color: color-mix(in srgb, var(--g) 45%, var(--border)); }

@media (max-width: 1000px) {
  .pop-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .home-drop { padding: 24px 14px; margin-top: -16px; }
  .pop-grid { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; margin: 0 -12px 24px; padding: 2px 12px 8px; scrollbar-width: none; }
  .pop-grid::-webkit-scrollbar { display: none; }
  .pop-grid .tile { flex: 0 0 42%; scroll-snap-align: start; }
  .home-filter { margin-left: -12px; margin-right: -12px; padding: 8px 12px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex-shrink: 0; }
  .home-filter .mega-search { max-width: none; flex-basis: 100%; }
  .tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile-grid .tile { flex-direction: column; gap: 6px; padding: 12px 10px; }
  .tile-grid .tile b { font-size: .88rem; }
  .tile-grid .tile-txt > span { font-size: .75rem; }
  .choose-grid { grid-template-columns: 1fr 1fr; }
  .choose-grid .tile { flex-direction: column; }
}

/* ---------- new tools ---------- */
.level.is-off { opacity: .45; pointer-events: none; }
.found-box { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin: 4px 0 12px; }
.found-box h3 { margin: 0 0 8px; font-size: .95rem; }
.found-box p { margin: 8px 0 0; font-size: .88rem; }
.meta-table { border-collapse: collapse; width: 100%; font-size: .86rem; }
.meta-table th { text-align: left; font-weight: 600; color: var(--text-dim); padding: 4px 12px 4px 0; width: 9.5em; vertical-align: top; }
.meta-table td { padding: 4px 0; word-break: break-word; }
.meta-table tr + tr th, .meta-table tr + tr td { border-top: 1px solid var(--border); }
.found-list { margin: 0; padding-left: 18px; font-size: .86rem; }
.found-list li + li { margin-top: 4px; }
.opt-set legend { font-weight: 600; }
.opt-set > label.check-opt { display: flex; margin: 7px 0; }

/* ---------- signature: tabs, saved list, photo ---------- */
.sig-tabs { display: inline-flex; gap: 2px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 3px; margin: 2px 0 10px; }
.sig-tab { background: transparent; border: 0; border-radius: 6px; padding: 7px 14px; font-size: .85rem; font-weight: 600; color: var(--text-dim); cursor: pointer; }
.sig-tab.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.sig-saved { margin: 0 0 12px; }
.sig-saved-lbl { margin: 0 0 6px; font-size: .82rem; font-weight: 600; }
.sig-saved-lbl small { font-weight: 400; color: var(--text-dim); }
.sig-saved-list { display: flex; flex-wrap: wrap; gap: 8px; }
.sig-saved-item { position: relative; width: 132px; height: 58px; display: flex; align-items: center; justify-content: center; background: #fff; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; padding: 4px; }
.sig-saved-item.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.sig-saved-item img { max-width: 100%; max-height: 100%; display: block; }
.sig-del { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border); background: var(--panel); color: var(--text-dim); font-size: .7rem; cursor: pointer; line-height: 1; padding: 0; }
.sig-del:hover { color: var(--danger); border-color: var(--danger); }
.sig-photo-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.small-btn { display: inline-flex; align-items: center; border-radius: var(--radius); padding: 9px 14px; font-size: .86rem; font-weight: 650; cursor: pointer; }
.small-btn.primary { background: var(--accent); color: var(--on-accent); }
.small-btn.ghost { border: 1px solid var(--border); color: var(--text); background: var(--panel); }
.sig-photo-prev { display: flex; justify-content: center; padding: 10px; border: 1px solid var(--border); border-radius: 8px;
  background-color: #fff; background-image: linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%), linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%);
  background-size: 16px 16px; background-position: 0 0, 8px 8px; }
.sig-photo-prev canvas { display: block; }
.sig-thr { display: inline-flex; align-items: center; gap: 6px; }
.sig-thr input { width: 110px; accent-color: var(--accent); }
.swatch-orig { background: linear-gradient(135deg, #2b3a8c 50%, #222 50%); }

/* ---------- theme switch ---------- */
.theme-btn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); background: var(--panel-2); color: var(--text-dim); border-radius: 8px; cursor: pointer; padding: 0; flex-shrink: 0; }
.theme-btn:hover { color: var(--text); }
.theme-btn svg { width: 20px; height: 20px; }
.theme-btn g { display: none; }
.theme-btn[data-t="auto"] .ti-auto, .theme-btn:not([data-t]) .ti-auto, .theme-btn[data-t="light"] .ti-light, .theme-btn[data-t="dark"] .ti-dark { display: inline; }
#editLoadStatus:empty { display: none; }

/* ---------- guides ---------- */
.crumbs { font-size: .8rem; color: var(--text-dim); margin: 0 0 6px; }
.crumbs a { color: var(--text-dim); }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin: 10px 0 20px; }
.guide-card { display: flex; flex-direction: column; gap: 6px; padding: 16px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; text-decoration: none; color: var(--text); }
.guide-card:hover { border-color: var(--accent); }
.guide-card b { font-size: 1rem; }
.guide-card span { font-size: .86rem; color: var(--text-dim); }
.guide-card i { font-style: normal; font-size: .82rem; font-weight: 600; color: var(--accent-ink); margin-top: auto; }
.guide-mini { columns: 2 260px; margin: 6px 0 10px; padding-left: 18px; }
.guide-mini li { margin: 4px 0; break-inside: avoid; }
.home-guides { margin-top: 30px; }

/* ---------- language menu ---------- */
.lang-menu { position: relative; flex-shrink: 0; }
.lang-menu > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 10px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); border-radius: 8px; cursor: pointer; font-weight: 650; font-size: .82rem; user-select: none; }
.lang-menu > summary::-webkit-details-marker { display: none; }
.lang-menu > summary svg { width: 18px; height: 18px; color: var(--text-dim); }
.lang-menu[open] > summary { border-color: var(--accent); }
.lang-menu ul { position: absolute; top: calc(100% + 6px); inset-inline-end: 0; z-index: 60; list-style: none; margin: 0; padding: 6px; min-width: 170px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.15); }
.lang-menu li a { display: block; padding: 8px 12px; border-radius: 6px; color: var(--text); text-decoration: none; font-size: .9rem; }
.lang-menu li a:hover, .lang-menu li a:focus-visible { background: var(--panel-2); }
.lang-menu li a[aria-current] { font-weight: 700; color: var(--accent-ink); }
.lang-menu li a[aria-current]::after { content: " ✓"; }

/* ---------- Arabic and Chinese: system fonts for headings, no letter-spacing tricks ---------- */
:lang(ar) h1, :lang(ar) h2, :lang(ar) h3, :lang(ar) .brand-name, :lang(ar) .home-h,
:lang(zh-Hans) h1, :lang(zh-Hans) h2, :lang(zh-Hans) h3, :lang(zh-Hans) .brand-name, :lang(zh-Hans) .home-h { font-family: var(--font); letter-spacing: 0; text-transform: none; font-weight: 800; }
:lang(ar) body, :lang(ar) button, :lang(ar) input, :lang(ar) select, :lang(ar) textarea { font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", "Geeza Pro", Arial, sans-serif; }

/* ---------- right-to-left (Arabic): the page mirrors, the PDF pages and canvases do not ---------- */
[dir="rtl"] .canvas-stage, [dir="rtl"] .stage-scroll, [dir="rtl"] .pg-grid, [dir="rtl"] .sig-wrap, [dir="rtl"] .scan-stage, [dir="rtl"] .form-page, [dir="rtl"] .stamp-preview canvas, [dir="rtl"] .lightbox-overlay img { direction: ltr; }
[dir="rtl"] .page-nav, [dir="rtl"] .range-in, [dir="rtl"] input[type=text][id$="Range"], [dir="rtl"] #rangeInput, [dir="rtl"] input[type=password] { direction: ltr; }
[dir="rtl"] .product-cta, [dir="rtl"] .guide-card i { unicode-bidi: plaintext; }
@media (max-width: 720px) {
  .header-inner { gap: 8px; }
  .lang-menu > summary { padding: 0 9px; gap: 5px; height: 38px; }
  .theme-btn { width: 38px; height: 38px; }
  .menu-btn { padding: 8px 10px; }
}
@media (max-width: 420px) {
  .lang-menu > summary span { display: none; }
  .brand-name { font-size: 1rem; }
  .brand { gap: 7px; }
  .brand-icon { width: 30px; height: 30px; }
}

/* ---------- shipping labels ---------- */
.bar-btns { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.lbl-formats { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.lbl-src { margin-top: 14px; }
.lbl-src-title { margin: 0 0 6px; font-size: .84rem; font-weight: 600; }
.lbl-src-title small { font-weight: 400; color: var(--text-dim); }
.lbl-src-stage { position: relative; display: inline-block; border: 1px solid var(--border); background: #fff; cursor: crosshair; touch-action: none; direction: ltr; }
.lbl-src-stage canvas { display: block; }
.lbl-crop { position: absolute; border: 2px solid var(--accent); background: rgba(255, 107, 44, .12); box-shadow: 0 0 0 9999px rgba(0, 0, 0, .28); pointer-events: none; }
.lbl-src-stage { overflow: hidden; }

/* ---------- loshop3d banner after a download ---------- */
.promo-wrap { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.promo-card { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 10px; text-decoration: none; color: var(--text);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, var(--panel)), var(--panel)); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); }
.promo-card:hover { border-color: var(--accent); }
.promo-logo { flex-shrink: 0; width: 92px; color: var(--text); }
.promo-logo svg { width: 100%; height: auto; display: block; }
.promo-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.promo-body b { font-size: .95rem; }
.promo-body span { font-size: .84rem; color: var(--text-dim); }
.promo-cta { margin-inline-start: auto; flex-shrink: 0; font-weight: 700; font-size: .86rem; color: var(--accent-ink); white-space: nowrap; }
@media (max-width: 560px) {
  .promo-card { flex-wrap: wrap; gap: 8px 12px; }
  .promo-logo { width: 72px; }
  .promo-cta { margin-inline-start: 0; }
}
