:root {
  --brand: #0f766e;
  --brand-dark: #0b5a54;
  --brand-soft: #e6f4f2;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #16191f;
  --muted: #5f6673;
  --border: #e1e4ea;
  --danger: #c2372e;
  --danger-soft: #fdecea;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  --shadow-lg: 0 8px 32px rgba(16, 24, 40, .14);
  --radius: 14px;

  --c-organize: #e0523f;
  --c-optimize: #2f9e44;
  --c-convert: #e8a019;
  --c-edit: #6c5ce7;
  --c-security: #1c7ed6;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #2bb3a5;
    --brand-dark: #1f8e83;
    --brand-soft: #12302d;
    --bg: #0f1115;
    --surface: #171a20;
    --surface-2: #1f232b;
    --text: #e9ebef;
    --muted: #9aa1ad;
    --border: #2a2f39;
    --danger: #f06a5f;
    --danger-soft: #3a1c1a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --brand: #2bb3a5;
  --brand-dark: #1f8e83;
  --brand-soft: #12302d;
  --bg: #0f1115;
  --surface: #171a20;
  --surface-2: #1f232b;
  --text: #e9ebef;
  --muted: #9aa1ad;
  --border: #2a2f39;
  --danger: #f06a5f;
  --danger-soft: #3a1c1a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
main { flex: 1; outline: none; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg, canvas { display: block; }
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header / footer */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; gap: 24px; height: 60px; }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-size: 21px; letter-spacing: -.02em; flex-shrink: 0; }
.logo img { width: 30px; height: 30px; }
.logo b { color: var(--brand); }
.main-nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.main-nav::-webkit-scrollbar { display: none; }
.main-nav a { text-decoration: none; color: var(--text); font-weight: 600; font-size: 14px; padding: 8px 12px; border-radius: 8px; white-space: nowrap; }
.main-nav a:hover { background: var(--surface-2); }
.main-nav .nav-all { color: var(--brand); }
.site-footer { border-top: 1px solid var(--border); background: var(--surface); margin-top: 48px; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 24px; padding-top: 20px; padding-bottom: 20px; font-size: 14px; }
.footer-inner p { margin: 0; }
.private-note { display: flex; align-items: center; gap: 8px; color: var(--brand); font-weight: 600; }
.private-note svg { width: 18px; height: 18px; flex-shrink: 0; }

@media (max-width: 720px) {
  .main-nav a:not(.nav-all):not(.nav-scan) { display: none; }
  .header-inner { justify-content: space-between; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 10px 16px; border-radius: 10px; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-big { font-size: 20px; padding: 18px 40px; border-radius: 14px; box-shadow: var(--shadow-lg); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 14px; border-radius: 8px; }
.icon-btn {
  width: 32px; height: 32px; padding: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); cursor: pointer; box-shadow: var(--shadow);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

/* Home */
.hero { text-align: center; padding: 56px 0 28px; }
.hero h1 { font-size: clamp(28px, 4.5vw, 44px); line-height: 1.15; letter-spacing: -.03em; margin: 0 auto 12px; max-width: 760px; }
.hero p { font-size: 18px; color: var(--muted); max-width: 640px; margin: 0 auto; }
.badge { display: inline-flex; align-items: center; gap: 6px; background: var(--brand-soft); color: var(--brand); font-weight: 600; font-size: 14px; padding: 6px 12px; border-radius: 999px; margin-bottom: 18px; }
.badge svg { width: 16px; height: 16px; }
.filters { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 8px 0 28px; }
.chip { border: 1px solid var(--border); background: var(--surface); padding: 8px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.tool-card {
  display: block; text-decoration: none; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: transparent; }
.tool-card h3 { margin: 14px 0 6px; font-size: 18px; letter-spacing: -.01em; }
.tool-card p { margin: 0; color: var(--muted); font-size: 14px; }
.tool-icon { width: 44px; height: 44px; border-radius: 11px; display: flex; align-items: center; justify-content: center; color: #fff; }
.tool-icon svg { width: 26px; height: 26px; }
.cat-organize { background: var(--c-organize); }
.cat-optimize { background: var(--c-optimize); }
.cat-convert { background: var(--c-convert); }
.cat-edit { background: var(--c-edit); }
.cat-security { background: var(--c-security); }

/* Tool: upload stage */
.tool-hero { text-align: center; padding: 56px 0 32px; }
.tool-hero h1 { font-size: clamp(28px, 4vw, 40px); letter-spacing: -.03em; margin: 0 0 10px; }
.tool-hero p { color: var(--muted); font-size: 18px; max-width: 640px; margin: 0 auto 32px; }
.dropzone {
  max-width: 720px; margin: 0 auto; border: 2px dashed var(--border); border-radius: 20px; padding: 48px 16px;
  background: var(--surface); transition: border-color .15s, background .15s;
}
.dropzone p { margin: 14px 0 0; font-size: 15px; }
body.dragging .dropzone { border-color: var(--brand); background: var(--brand-soft); }
.drop-overlay {
  position: fixed; inset: 0; z-index: 60; background: color-mix(in srgb, var(--brand) 85%, transparent);
  color: #fff; display: none; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; pointer-events: none;
}
body.dragging .drop-overlay { display: flex; }

/* Tool: workspace */
.workspace { display: grid; grid-template-columns: 1fr 340px; min-height: calc(100vh - 60px); }
.ws-main { padding: 24px 16px 40px; min-width: 0; }
.ws-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 auto 20px; max-width: 1000px; flex-wrap: wrap; }
.ws-toolbar h2 { margin: 0; font-size: 18px; }
.ws-toolbar .tb-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ws-side {
  background: var(--surface); border-left: 1px solid var(--border); padding: 24px 20px; display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto;
}
.ws-side h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; text-align: center; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.ws-side .side-body { flex: 1; display: flex; flex-direction: column; gap: 18px; }
.ws-side .side-foot { position: sticky; bottom: -24px; background: var(--surface); padding: 12px 0 0; margin-bottom: -4px; }
@media (max-width: 860px) {
  .workspace { grid-template-columns: 1fr; }
  .workspace { padding-bottom: 110px; }
  .ws-side { position: static; height: auto; border-left: 0; border-top: 1px solid var(--border); }
  .ws-side .side-foot {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; margin: 0;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); box-shadow: var(--shadow-lg);
  }
  .ws-side .side-foot .btn-big { font-size: 18px; padding: 14px 20px; box-shadow: none; }
  .workspace.sign-ws .ws-side { order: -1; border-top: 0; border-bottom: 1px solid var(--border); }
}

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px; max-width: 1000px; margin: 0 auto; }
.file-card, .page-card {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 8px; user-select: none;
}
.file-card[draggable="true"], .page-card[draggable="true"] { cursor: grab; }
.file-card.drag-over, .page-card.drag-over { outline: 2px dashed var(--brand); outline-offset: 3px; }
.file-card.dragging, .page-card.dragging { opacity: .4; }
.thumb { width: 100%; aspect-ratio: 3 / 4; display: flex; align-items: center; justify-content: center; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.thumb img, .thumb canvas { max-width: 100%; max-height: 100%; box-shadow: 0 1px 4px rgba(0,0,0,.18); background: #fff; transition: transform .2s; }
.thumb .ph { color: var(--muted); }
.thumb .ph svg { width: 40px; height: 40px; }
.card-name { font-size: 13px; font-weight: 600; width: 100%; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { font-size: 12px; color: var(--muted); margin-top: -6px; }
.card-actions { position: absolute; top: -10px; right: -10px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.file-card:hover .card-actions, .page-card:hover .card-actions, .file-card:focus-within .card-actions, .page-card:focus-within .card-actions { opacity: 1; }
@media (hover: none) { .card-actions { opacity: 1; } }
.page-card.selectable { cursor: pointer; }
.page-card.selected { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }
.page-card.marked .thumb { opacity: .35; }
.page-card .check {
  position: absolute; top: 8px; left: 8px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border);
  background: var(--surface); display: flex; align-items: center; justify-content: center; color: #fff;
}
.page-card.selected .check { background: var(--brand); border-color: var(--brand); }
.page-card.marked .check { background: var(--danger); border-color: var(--danger); }
.page-card .check svg { width: 14px; height: 14px; }
.add-card {
  border: 2px dashed var(--border); border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--muted); background: transparent; cursor: pointer; min-height: 220px; font-weight: 600; font-size: 14px;
}
.add-card:hover { border-color: var(--brand); color: var(--brand); }
.add-card svg { width: 32px; height: 32px; }

/* Form controls */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field-label { font-weight: 600; font-size: 14px; }
.field .hint { font-size: 13px; color: var(--muted); margin: 0; }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); outline: none;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.input[type="color"] { padding: 4px; height: 42px; cursor: pointer; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.seg label { position: relative; text-align: center; padding: 9px 6px; font-size: 14px; font-weight: 600; cursor: pointer; border-left: 1px solid var(--border); }
.seg label:first-child { border-left: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--brand-soft); color: var(--brand); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: -2px; }
.options-list { display: flex; flex-direction: column; gap: 8px; }
.option-card { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.option-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.option-card input { margin-top: 4px; accent-color: var(--brand); }
.option-card b { display: block; font-size: 15px; }
.option-card span { font-size: 13px; color: var(--muted); }
.check-row { display: flex; gap: 10px; align-items: center; font-size: 14px; cursor: pointer; }
.check-row input { accent-color: var(--brand); width: 18px; height: 18px; }
input[type="range"] { accent-color: var(--brand); width: 100%; }
.pos-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; width: 132px; }
.pos-grid label { aspect-ratio: 1; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.pos-grid input { position: absolute; opacity: 0; pointer-events: none; }
.pos-grid label::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.pos-grid label:has(input:checked) { border-color: var(--brand); }
.pos-grid label:has(input:checked)::after { background: var(--brand); }
.pos-grid label.blank { visibility: hidden; }
.notice { font-size: 14px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--muted); }
.notice.warn { background: #fff4e0; color: #8a5300; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .notice.warn { background: #33270f; color: #f0c674; } }
:root[data-theme="dark"] .notice.warn { background: #33270f; color: #f0c674; }
.error-msg { color: var(--danger); font-size: 14px; font-weight: 600; margin: 0; }

/* Processing + result */
.overlay { position: fixed; inset: 0; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(3px); z-index: 50; display: flex; align-items: center; justify-content: center; }
.overlay-box { text-align: center; }
.spinner { width: 56px; height: 56px; margin: 0 auto 18px; border-radius: 50%; border: 5px solid var(--border); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.overlay-box h2 { margin: 0 0 6px; }
.overlay-box p { margin: 0; color: var(--muted); }
.result { text-align: center; padding: 64px 0; }
.result-icon { width: 72px; height: 72px; margin: 0 auto 18px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; }
.result-icon svg { width: 36px; height: 36px; }
.result h1 { margin: 0 0 8px; letter-spacing: -.02em; font-size: clamp(26px, 4vw, 36px); }
.result .file-line { color: var(--muted); margin: 0 0 28px; word-break: break-all; }
.result .stat { font-size: 18px; margin: -12px 0 28px; }
.result .stat b { color: var(--brand); }
.result-actions { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.result-secondary { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* Sign tool */
.sign-pages { display: flex; flex-direction: column; align-items: center; gap: 24px; }
.sign-page { position: relative; box-shadow: var(--shadow-lg); background: #fff; max-width: 100%; touch-action: pan-y; }
.sign-page canvas { width: 100%; height: auto; }
.sign-page.placing { cursor: crosshair; }
.sign-page .pg-label { position: absolute; top: -22px; left: 0; font-size: 12px; color: var(--muted); }
.placed { position: absolute; border: 1.5px dashed var(--brand); cursor: move; touch-action: none; }
.placed img { width: 100%; height: 100%; pointer-events: none; }
.placed .del { position: absolute; top: -14px; right: -14px; width: 26px; height: 26px; }
.placed .resize { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; cursor: nwse-resize; touch-action: none; }
.sig-pad { width: 100%; height: 160px; border: 1px solid var(--border); border-radius: 10px; background: #fff; touch-action: none; cursor: crosshair; }
.sig-list { display: flex; flex-direction: column; gap: 8px; }
.sig-item { display: flex; align-items: center; gap: 8px; border: 2px solid var(--border); border-radius: 10px; padding: 6px; background: #fff; cursor: pointer; }
.sig-item.active { border-color: var(--brand); }
.sig-item img { height: 44px; max-width: 200px; object-fit: contain; flex: 1; }
.tabs { display: flex; border-bottom: 1px solid var(--border); }
.tabs button { flex: 1; background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 4px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }
.swatches { display: flex; gap: 8px; }
.swatches button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); cursor: pointer; }
.swatches button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--brand); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 10px; font-weight: 600; z-index: 70; box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px); }

/* Scan to PDF */
.scan-ws { max-width: 1000px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.scan-cam { position: relative; background: #000; border-radius: 16px; overflow: hidden; height: min(62vh, 640px); }
.scan-cam video, .scan-cam .cam-overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.scan-cam video { object-fit: contain; }
.cam-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.cam-flash.go { animation: camflash .35s ease-out; }
@keyframes camflash { from { opacity: .85; } to { opacity: 0; } }
.cam-msg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; color: #fff; background: #111; }
.cam-msg p { margin: 6px 0 0; color: #bbb; max-width: 420px; }
.cam-msg .row { flex-wrap: wrap; }
.cam-msg .row > * { flex: 0 0 auto; }
.cam-controls { display: flex; align-items: center; justify-content: center; gap: 28px; }
.cam-btn { background: none; border: 0; color: var(--text); display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; cursor: pointer; padding: 6px; border-radius: 10px; min-width: 56px; }
.cam-btn svg { width: 26px; height: 26px; }
.cam-btn:hover { background: var(--surface-2); }
.cam-btn[aria-pressed="true"] { color: #e8a019; }
.shutter { width: 76px; height: 76px; border-radius: 50%; border: 5px solid var(--brand); background: var(--surface); padding: 5px; cursor: pointer; flex-shrink: 0; }
.shutter span { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--brand); transition: transform .1s; }
.shutter:active span { transform: scale(.88); }
.shutter:disabled { opacity: .4; cursor: not-allowed; }
.scan-strip { display: flex; gap: 14px; overflow-x: auto; padding: 12px 4px 8px; scroll-snap-type: x proximity; }
.scan-strip:empty { display: none; }
.scan-card { position: relative; flex: 0 0 120px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 6px; }
.scan-thumb { width: 120px; height: 156px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; padding: 6px; cursor: pointer; }
.scan-thumb img { max-width: 100%; max-height: 100%; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.scan-thumb:hover { border-color: var(--brand); }
.scan-card-bar { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 700; }
.scan-card-bar .icon-btn { width: 28px; height: 28px; box-shadow: none; }
.scan-card-bar .icon-btn:disabled { opacity: .3; cursor: default; }
.scan-del { position: absolute; top: -8px; right: -8px; width: 28px; height: 28px; }
.spinner.small { width: 22px; height: 22px; border-width: 3px; margin: 0; }

.scan-editor { position: fixed; inset: 0; z-index: 80; background: #0b0c0f; color: #eee; display: flex; flex-direction: column; }
.se-top { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; gap: 12px; border-bottom: 1px solid #222; }
.se-top .btn:not(.btn-primary) { background: #1c1f26; border-color: #2a2f39; color: #eee; }
.se-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; }
.se-frame { position: relative; touch-action: none; }
.se-photo { width: 100%; height: 100%; }
.se-poly { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.se-poly polygon { fill: rgba(43, 179, 165, .16); stroke: #2bb3a5; stroke-width: 2.5; }
.se-handle { position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; border: 3px solid #2bb3a5; background: rgba(255,255,255,.35); cursor: grab; touch-action: none; }
.se-handle::after { content: ""; position: absolute; inset: -12px; border-radius: 50%; }
.se-loupe { position: absolute; width: 120px; height: 120px; margin: -150px 0 0 -60px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 6px 20px rgba(0,0,0,.5); pointer-events: none; }
.se-loupe.below { margin-top: 30px; }
.se-tools { padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid #222; display: flex; flex-direction: column; gap: 12px; }
.se-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.se-row .btn { background: #1c1f26; border-color: #2a2f39; color: #eee; }
.se-filters { display: flex; gap: 10px; justify-content: center; overflow-x: auto; }
.se-filter { background: none; border: 0; color: #ccc; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; cursor: pointer; padding: 0; }
.se-fthumb { width: 68px; height: 88px; border-radius: 8px; border: 2px solid #2a2f39; background: #1c1f26; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.se-fthumb canvas { max-width: 100%; max-height: 100%; }
.se-filter[aria-pressed="true"] { color: #2bb3a5; }
.se-filter[aria-pressed="true"] .se-fthumb { border-color: #2bb3a5; }
@media (max-width: 860px) {
  .scan-cam { height: 56vh; border-radius: 12px; }
}
