/* ==========================================================================
   Paji Scan — design system
   Dark navy base · teal→violet gradient identity
   Type scale: 13 / 15 / 17 / 22 / 28 · spacing on a 4/8px grid
   ========================================================================== */
:root {
  --bg: #0a0e1a;
  --bg2: #0e1424;
  --surface: #101728;
  --surface-2: #141c30;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #eef1f8;
  --muted: #98a1b6;
  --faint: #6b7590;
  --accent1: #2dd4bf;
  --accent2: #8b5cf6;
  --grad: linear-gradient(120deg, var(--accent1), var(--accent2));
  --on-grad: #071019;
  --danger: #f87171;
  --ok: #34d399;

  --fs-xs: 13px;
  --fs-s: 15px;
  --fs-m: 17px;
  --fs-l: 22px;
  --fs-xl: 28px;

  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;

  --r-s: 10px; --r-m: 14px; --r-l: 18px; --r-xl: 20px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.35), 0 4px 16px rgba(0, 0, 0, 0.22);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, 0.4), 0 16px 40px rgba(0, 0, 0, 0.35);
  --ease: cubic-bezier(0.25, 0.6, 0.3, 1);
  --t-fast: 150ms; --t-med: 220ms;
  --tabbar-h: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { color-scheme: dark; }
body {
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(139, 92, 246, 0.13), transparent 60%),
    radial-gradient(900px 420px at 10% 110%, rgba(45, 212, 191, 0.08), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100dvh;
  font-size: var(--fs-m);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
a { color: var(--accent1); }
.num, .count-pill, .cam-shots, .fr-sub { font-variant-numeric: tabular-nums; }

:focus-visible { outline: 2px solid var(--accent1); outline-offset: 2px; border-radius: 4px; }

/* ---------- Icons ---------- */
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.icon-s { width: 16px; height: 16px; }
.icon-l { width: 28px; height: 28px; }
.icon.ok { color: var(--ok); }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-5);
  background: rgba(10, 14, 26, 0.82); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: var(--sp-3); font-weight: 700; font-size: 19px; letter-spacing: -0.01em; }
.logo { width: 32px; height: 32px; display: block; filter: drop-shadow(0 2px 6px rgba(45, 212, 191, 0.25)); }
.brand-name em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.topbar-right { display: flex; align-items: center; gap: var(--sp-2); }
.privacy-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em; color: var(--muted);
  border: 1px solid var(--border); padding: 5px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}
.privacy-chip .icon-s { color: var(--accent1); }
.pro-badge { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; background: var(--grad); color: var(--on-grad); padding: 4px 9px; border-radius: 999px; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: transparent; border: none; border-radius: var(--r-s);
  color: var(--muted); cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.icon-btn:active { transform: scale(0.94); }

/* ---------- Layout ---------- */
main { max-width: 680px; margin: 0 auto; padding: var(--sp-5) var(--sp-4) calc(var(--tabbar-h) + var(--sp-10)); }
.view { display: none; animation: viewin var(--t-med) var(--ease); }
.view.active { display: block; }
@keyframes viewin { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hero { padding-top: var(--sp-2); }
.hero h1 { font-size: clamp(30px, 7.5vw, 40px); line-height: 1.12; font-weight: 800; letter-spacing: -0.02em; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sub { color: var(--muted); margin-top: var(--sp-2); font-size: var(--fs-s); }
.trust-badge {
  display: inline-flex; align-items: center; gap: 6px; margin-top: var(--sp-3);
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.02em; color: var(--accent1);
  border: 1px solid rgba(45, 212, 191, 0.3); background: rgba(45, 212, 191, 0.07);
  padding: 6px 12px; border-radius: 999px;
}

.section-head { display: flex; align-items: center; justify-content: space-between; margin: var(--sp-6) 0 var(--sp-3); }
.section-head h1 { font-size: var(--fs-xl); font-weight: 800; letter-spacing: -0.02em; }
.section-head h2 { font-size: var(--fs-l); font-weight: 700; letter-spacing: -0.01em; }
.count-pill { background: var(--surface); border: 1px solid var(--border); font-size: var(--fs-xs); font-weight: 600; padding: 2px 10px; border-radius: 999px; color: var(--muted); vertical-align: middle; }

/* ---------- Scan actions ---------- */
.scan-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); margin-top: var(--sp-6); }
.big-action {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-l);
  padding: var(--sp-5) var(--sp-4); color: var(--text); cursor: pointer; min-height: 112px;
  box-shadow: var(--shadow-1);
  transition: transform var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.big-action:hover { transform: translateY(-2px); border-color: rgba(45, 212, 191, 0.45); background: var(--surface-2); }
.big-action:active { transform: scale(0.98); }
.ba-icon { color: var(--accent1); }
.big-action:nth-child(2) .ba-icon { color: var(--accent2); }
.ba-label { font-weight: 700; font-size: var(--fs-m); margin-top: var(--sp-2); }
.ba-hint { color: var(--muted); font-size: var(--fs-xs); }

/* ---------- Session strip ---------- */
.page-strip { display: flex; gap: var(--sp-3); overflow-x: auto; padding: var(--sp-1) 2px var(--sp-3); scroll-snap-type: x mandatory; }
.page-thumb {
  position: relative; flex: 0 0 auto; width: 112px; scroll-snap-align: start;
  border-radius: var(--r-s); overflow: hidden; border: 1px solid var(--border);
  cursor: pointer; background: var(--bg2); box-shadow: var(--shadow-1);
  transition: transform var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
  animation: thumbin var(--t-med) var(--ease);
}
@keyframes thumbin { from { opacity: 0; transform: translateY(8px) scale(0.96); } to { opacity: 1; transform: none; } }
.page-thumb:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.page-thumb img, .page-thumb canvas { width: 100%; display: block; }
.page-thumb .pt-num {
  position: absolute; top: 6px; left: 6px; background: rgba(4, 7, 13, 0.7);
  font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.export-row { display: flex; gap: var(--sp-3); margin-top: var(--sp-2); }

/* ---------- Buttons ---------- */
.primary-btn, .secondary-btn, .ghost-btn, .danger-btn {
  border: none; border-radius: var(--r-m); padding: var(--sp-3) var(--sp-5);
  font-size: var(--fs-s); font-weight: 700; letter-spacing: 0.01em;
  cursor: pointer; min-height: 48px;
  transition: transform var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); text-decoration: none;
}
.primary-btn { background: var(--grad); color: var(--on-grad); flex: 1; box-shadow: 0 4px 14px rgba(45, 212, 191, 0.22); }
.primary-btn:hover { box-shadow: 0 6px 20px rgba(139, 92, 246, 0.3); }
.secondary-btn { background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); flex: 1; }
.secondary-btn:hover { background: var(--surface-2); }
.ghost-btn { background: transparent; color: var(--muted); border: 1px solid var(--border); padding: var(--sp-2) var(--sp-4); min-height: 40px; font-size: var(--fs-xs); }
.ghost-btn:hover { color: var(--text); border-color: var(--border-strong); }
.danger-btn { background: rgba(248, 113, 113, 0.1); color: var(--danger); border: 1px solid rgba(248, 113, 113, 0.3); }
.primary-btn:active, .secondary-btn:active, .ghost-btn:active, .danger-btn:active { transform: scale(0.97); }
button:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

.tiny-note { color: var(--muted); font-size: var(--fs-xs); margin-top: var(--sp-3); }

/* ---------- Empty states ---------- */
.empty-state { text-align: center; color: var(--muted); padding: var(--sp-10) var(--sp-6); font-size: var(--fs-s); }
.empty-art { width: 132px; height: auto; margin: 0 auto var(--sp-4); display: block; }

/* ---------- Tools ---------- */
.tool-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
.tool-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-l);
  color: var(--text); padding: var(--sp-4); text-align: left; cursor: pointer; min-height: 96px;
  display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-s); font-weight: 700;
  box-shadow: var(--shadow-1);
  transition: transform var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.tool-card:hover { transform: translateY(-2px); border-color: rgba(139, 92, 246, 0.5); background: var(--surface-2); }
.tool-card:active { transform: scale(0.98); }
.tool-card small { color: var(--muted); font-weight: 400; font-size: var(--fs-xs); }
.tc-icon { color: var(--accent1); margin-bottom: var(--sp-2); }
.tool-card:nth-child(even) .tc-icon { color: var(--accent2); }

.tool-panel {
  margin-top: var(--sp-4); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-l); padding: var(--sp-5); box-shadow: var(--shadow-1);
  animation: viewin var(--t-med) var(--ease);
}
.tool-panel h2 { font-size: var(--fs-l); margin-bottom: var(--sp-1); letter-spacing: -0.01em; }
.tool-panel .tp-desc { color: var(--muted); font-size: var(--fs-xs); margin-bottom: var(--sp-4); }
.tool-panel label {
  display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--muted); margin: var(--sp-4) 0 var(--sp-2);
}
.tool-panel input[type="text"], .tool-panel input[type="number"], .tool-panel select, .license-row input, #sigTypeInput {
  width: 100%; background: var(--bg2); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--r-s); padding: var(--sp-3) var(--sp-4); font-size: var(--fs-s); outline: none;
  transition: border-color var(--t-fast) var(--ease);
}
.tool-panel input:focus, .license-row input:focus, #sigTypeInput:focus { border-color: var(--accent1); }
.tool-panel input[type="file"] { width: 100%; color: var(--muted); font-size: var(--fs-xs); padding: var(--sp-2) 0; }
.tool-panel input[type="range"] { width: 100%; accent-color: var(--accent1); }
.tp-actions { display: flex; gap: var(--sp-3); margin-top: var(--sp-5); }
.tp-result { margin-top: var(--sp-4); }
.tp-result > p { font-size: var(--fs-s); display: flex; align-items: center; gap: var(--sp-2); }
.file-pill-list { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-3); }
.file-pill {
  display: flex; align-items: center; gap: var(--sp-2); background: var(--bg2);
  border: 1px solid var(--border); border-radius: var(--r-s); padding: var(--sp-2) var(--sp-3); font-size: var(--fs-xs);
}
.file-pill > .icon { color: var(--muted); }
.file-pill .fp-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-pill button {
  background: none; border: none; color: var(--muted); cursor: pointer;
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.file-pill button:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.ocr-out {
  width: 100%; min-height: 160px; background: var(--bg2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-s); padding: var(--sp-3); font-size: var(--fs-xs);
  font-family: ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; resize: vertical;
}

/* ---------- Segmented control ---------- */
.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-s); padding: 3px; gap: 3px; }
.seg button {
  background: transparent; border: none; color: var(--muted); font-size: var(--fs-xs); font-weight: 600;
  padding: var(--sp-2) var(--sp-4); border-radius: 8px; cursor: pointer; min-height: 38px;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.seg button.on { background: var(--grad); color: var(--on-grad); }

/* ---------- Files ---------- */
.files-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.file-row {
  display: flex; align-items: center; gap: var(--sp-3); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-m); padding: var(--sp-3) var(--sp-4);
  box-shadow: var(--shadow-1); animation: thumbin var(--t-med) var(--ease);
}
.file-row .fr-icon { color: var(--accent1); display: grid; place-items: center; }
.file-row .fr-meta { flex: 1; min-width: 0; }
.file-row .fr-name { font-weight: 700; font-size: var(--fs-s); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .fr-sub { color: var(--muted); font-size: var(--fs-xs); }
.file-row .fr-actions { display: flex; gap: 0; }
.file-row .fr-actions button {
  background: none; border: none; cursor: pointer; color: var(--muted);
  width: 40px; height: 40px; border-radius: var(--r-s); display: grid; place-items: center;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.file-row .fr-actions button:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.file-row .fr-actions button:active { transform: scale(0.92); }

/* ---------- Cards (Discover / About) ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-l);
  padding: var(--sp-5); margin-bottom: var(--sp-4); box-shadow: var(--shadow-1);
}
.card h2 { font-size: var(--fs-l); margin-bottom: var(--sp-3); letter-spacing: -0.01em; }
.pro-card { border-color: rgba(139, 92, 246, 0.35); }
.pro-list { list-style: none; margin-bottom: var(--sp-4); }
.pro-list li { padding: var(--sp-1) 0 var(--sp-1) 26px; position: relative; color: var(--text); font-size: var(--fs-s); }
.pro-list li::before { content: "✦"; position: absolute; left: 2px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.license-row { display: flex; gap: var(--sp-2); margin-top: var(--sp-3); }
.license-row .secondary-btn { flex: 0 0 auto; }
.pro-active-msg { font-size: var(--fs-s); display: flex; align-items: center; gap: var(--sp-2); }
.discover-link {
  display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-1); text-decoration: none;
  color: var(--text); border-bottom: 1px solid var(--border); font-size: var(--fs-s);
  transition: background var(--t-fast) var(--ease);
}
.discover-link:last-child { border-bottom: none; }
.discover-link small { display: block; color: var(--muted); font-size: var(--fs-xs); }
.dl-icon { color: var(--accent1); display: grid; place-items: center; }
.dl-arrow { margin-left: auto; color: var(--faint); display: grid; place-items: center; transition: color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.discover-link:hover .dl-arrow { color: var(--accent1); transform: translateX(2px); }
.about-note { color: var(--muted); font-size: var(--fs-xs); text-align: center; padding: var(--sp-2) var(--sp-5) var(--sp-5); }

/* ---------- About sheet ---------- */
.about-rows { display: flex; flex-direction: column; margin: var(--sp-2) 0; }
.about-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-1); border-bottom: 1px solid var(--border);
  font-size: var(--fs-s); color: var(--text); text-decoration: none;
}
.about-row:last-child { border-bottom: none; }
.about-row.link { transition: color var(--t-fast) var(--ease); }
.about-row.link:hover { color: var(--accent1); }
.about-row.link .icon-s { color: var(--faint); }
.about-row.promise { justify-content: flex-start; color: var(--muted); font-size: var(--fs-xs); }
.about-row.promise .icon { color: var(--accent1); }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  display: flex; padding-bottom: env(safe-area-inset-bottom);
  background: rgba(10, 14, 26, 0.88); backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}
.tab {
  position: relative; flex: 1; background: none; border: none; color: var(--faint);
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  cursor: pointer; transition: color var(--t-fast) var(--ease);
}
.tab .icon { transition: transform var(--t-med) var(--ease), color var(--t-fast) var(--ease); }
.tab::after {
  content: ""; position: absolute; top: 0; left: 50%; width: 24px; height: 3px;
  border-radius: 0 0 3px 3px; background: var(--grad);
  transform: translateX(-50%) scaleX(0); transform-origin: center;
  transition: transform var(--t-med) var(--ease);
}
.tab.active { color: var(--text); }
.tab.active::after { transform: translateX(-50%) scaleX(1); }
.tab.active .icon { transform: translateY(-1px); color: var(--accent1); }
.tab:active .icon { transform: scale(0.9); }

/* ---------- Modals ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50; background: rgba(4, 6, 12, 0.72);
  backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: var(--sp-4);
  animation: modalfade var(--t-fast) var(--ease);
}
@keyframes modalfade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: var(--bg2); border: 1px solid var(--border-strong); border-radius: var(--r-xl);
  padding: var(--sp-5); width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto;
  box-shadow: var(--shadow-2); animation: sheetin var(--t-med) var(--ease);
}
@keyframes sheetin { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-3); }
.modal-head h2 { font-size: var(--fs-l); letter-spacing: -0.01em; }
.close-x {
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
  width: 36px; height: 36px; border-radius: var(--r-s); cursor: pointer;
  display: grid; place-items: center;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.close-x:hover { background: var(--surface-2); color: var(--text); }

/* ---------- Onboarding ---------- */
.onboard {
  position: fixed; inset: 0; z-index: 100; background: rgba(6, 9, 17, 0.92);
  backdrop-filter: blur(10px); display: flex; align-items: center; justify-content: center; padding: var(--sp-5);
  animation: modalfade var(--t-med) var(--ease);
}
.ob-card {
  width: 100%; max-width: 420px; background: var(--bg2); border: 1px solid var(--border-strong);
  border-radius: var(--r-xl); padding: var(--sp-8) var(--sp-6) var(--sp-6);
  box-shadow: var(--shadow-2); text-align: center; animation: sheetin var(--t-med) var(--ease);
}
.ob-slide { display: none; animation: viewin var(--t-med) var(--ease); }
.ob-slide.active { display: block; }
.ob-art {
  width: 72px; height: 72px; margin: 0 auto var(--sp-5); display: grid; place-items: center;
  border-radius: 22px; background: linear-gradient(120deg, rgba(45, 212, 191, 0.14), rgba(139, 92, 246, 0.14));
  border: 1px solid rgba(45, 212, 191, 0.3);
}
.ob-art .icon { width: 34px; height: 34px; color: var(--accent1); }
.ob-slide h2 { font-size: var(--fs-l); letter-spacing: -0.01em; margin-bottom: var(--sp-2); }
.ob-slide p { color: var(--muted); font-size: var(--fs-s); min-height: 72px; }
.ob-dots { display: flex; justify-content: center; gap: var(--sp-2); margin: var(--sp-5) 0; }
.ob-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); transition: background var(--t-med) var(--ease), width var(--t-med) var(--ease); }
.ob-dots span.on { background: var(--accent1); width: 20px; border-radius: 4px; }
.ob-actions { display: flex; gap: var(--sp-3); }
.ob-actions .primary-btn { flex: 1; }

/* ---------- Camera ---------- */
.camera-modal { padding: 0; }
.camera-stage { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; }
#cameraVideo { flex: 1; width: 100%; min-height: 0; object-fit: contain; background: #000; }
.cam-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.cam-flash.on { animation: camflash 0.25s var(--ease); }
@keyframes camflash { 0% { opacity: 0.85; } 100% { opacity: 0; } }
.camera-controls { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-4) var(--sp-6) calc(var(--sp-4) + env(safe-area-inset-bottom)); }
.shutter {
  width: 72px; height: 72px; border-radius: 50%; cursor: pointer;
  background: #fff; border: 5px solid rgba(255, 255, 255, 0.35); background-clip: padding-box;
  transition: transform 0.1s var(--ease);
}
.shutter:active { transform: scale(0.88); }
.cam-shots { min-width: 44px; text-align: center; color: var(--text); font-weight: 700; font-size: var(--fs-m); }

/* ---------- Editor ---------- */
.editor-stage { display: flex; justify-content: center; background: #05070d; border-radius: var(--r-m); overflow: hidden; }
#editorCanvas { max-width: 100%; max-height: 56dvh; touch-action: none; }
.editor-controls { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-4); }
.editor-btns { display: flex; gap: var(--sp-2); }
.editor-btns .primary-btn { flex: 1; }

/* ---------- Signature ---------- */
.sig-pane { margin: var(--sp-3) 0; display: flex; flex-direction: column; gap: var(--sp-2); align-items: flex-start; }
#sigCanvas, #sigTypeCanvas, #sigUploadCanvas {
  width: 100%; background: #f5f6fa; border-radius: var(--r-s); touch-action: none; cursor: crosshair;
}
.sign-stage { position: relative; margin-top: var(--sp-3); border-radius: var(--r-m); overflow: hidden; background: #05070d; }
.sign-stage canvas.pdf-page { width: 100%; display: block; }
.sig-overlay {
  position: absolute; border: 2px dashed var(--accent1); border-radius: 6px; cursor: grab;
  touch-action: none; display: flex; align-items: center; justify-content: center;
}
.sig-overlay img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.sig-handle {
  position: absolute; right: -12px; bottom: -12px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent1); cursor: nwse-resize; touch-action: none; border: 3px solid var(--bg2);
}
.page-nav { display: flex; align-items: center; justify-content: center; gap: var(--sp-4); margin-top: var(--sp-3); color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }

/* ---------- Toast + busy ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--sp-5)); transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text);
  padding: var(--sp-3) var(--sp-5); border-radius: 999px; font-size: var(--fs-xs); font-weight: 600; z-index: 80;
  box-shadow: var(--shadow-2); animation: toastin var(--t-med) var(--ease); max-width: 90vw; text-align: center;
}
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.busy {
  position: fixed; inset: 0; z-index: 90; background: rgba(4, 6, 12, 0.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.busy-card {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-4);
  background: var(--bg2); border: 1px solid var(--border-strong); border-radius: var(--r-xl);
  padding: var(--sp-8) var(--sp-8); min-width: 240px; box-shadow: var(--shadow-2);
  color: var(--text); font-weight: 600; font-size: var(--fs-s); text-align: center;
  animation: sheetin var(--t-med) var(--ease);
}
.spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 3.5px solid rgba(255, 255, 255, 0.12); border-top-color: var(--accent1);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.busy-bar { width: 100%; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.busy-bar span { display: block; width: 40%; height: 100%; border-radius: 2px; background: var(--grad); animation: busyslide 1.2s var(--ease) infinite; }
@keyframes busyslide { 0% { transform: translateX(-110%); } 100% { transform: translateX(280%); } }

/* ---------- Skeletons ---------- */
.skeleton {
  border-radius: var(--r-s); background: linear-gradient(100deg, var(--surface) 40%, var(--surface-2) 50%, var(--surface) 60%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

@media (min-width: 640px) {
  .tool-grid { grid-template-columns: repeat(3, 1fr); }
  .hero h1 { font-size: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- Stickiness: saved signatures, moment cards, Discover rework ---------- */
.sig-saved { margin-bottom: var(--sp-4); }
.sig-saved-label { font-size: var(--fs-xs); color: var(--muted); margin-bottom: var(--sp-2); }
.sig-saved-list { display: flex; gap: var(--sp-2); overflow-x: auto; padding-bottom: var(--sp-1); }
.sig-saved-item {
  display: flex; align-items: center; gap: var(--sp-1); flex: 0 0 auto;
  background: #fff; border: 1px solid var(--border-strong); border-radius: var(--r-s); padding: var(--sp-1);
}
.sig-saved-use { background: none; border: none; cursor: pointer; padding: var(--sp-1); }
.sig-saved-use img { height: 44px; max-width: 150px; object-fit: contain; display: block; }
.sig-saved-del {
  background: none; border: none; cursor: pointer; color: #6b7590; padding: var(--sp-1);
  border-radius: var(--r-s);
}
.sig-saved-del:hover { color: var(--danger); }

.moment-area { margin: 0 var(--sp-4); }
.moment-card {
  position: relative; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-l); padding: var(--sp-4) var(--sp-5); margin-bottom: var(--sp-4);
  box-shadow: var(--shadow-1); animation: toastin var(--t-med) var(--ease);
}
.moment-card h3 { font-size: var(--fs-m); margin-bottom: var(--sp-1); }
.moment-card p { font-size: var(--fs-s); color: var(--muted); margin-bottom: var(--sp-3); }
.moment-card .mc-close { position: absolute; top: var(--sp-2); right: var(--sp-2); }
.mc-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
.mc-actions .primary-btn, .mc-actions .secondary-btn { font-size: var(--fs-xs); text-decoration: none; }

.soon-pill {
  flex: 0 0 auto; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--faint); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px;
}
.discover-link.is-soon { opacity: 0.72; cursor: default; }
.follow-row { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.follow-chip {
  font-size: var(--fs-xs); color: var(--text); text-decoration: none;
  border: 1px solid var(--border-strong); border-radius: 999px; padding: 6px 14px;
  transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.follow-chip:hover { border-color: var(--accent1); color: var(--accent1); }
.builtby-text { font-size: var(--fs-s); color: var(--muted); margin-bottom: var(--sp-3); }
.biz-toggle { width: 100%; background: none; border: none; text-align: left; color: var(--text); cursor: pointer; font: inherit; }
.biz-content { padding-top: var(--sp-3); }
.growth-card { border-color: rgba(45, 212, 191, 0.35); }
.growth-card .primary-btn { text-decoration: none; display: inline-block; }

/* ========== Paji Suite unified Discover launcher (identical across all 3 apps) ========== */
/* Uses only the shared design-system vars — no re-skin; each app keeps its teal→violet look. */
.suite-launcher { display: block; }
/* Pro ladder */
.pro-ladder { display: grid; grid-template-columns: 1fr; gap: var(--sp-2); margin: var(--sp-3) 0 var(--sp-4); }
.pro-tier { border: 1px solid var(--border); border-radius: var(--r-m); padding: var(--sp-3) var(--sp-4); background: var(--surface-2); }
.pro-tier.on { border-color: var(--accent1); box-shadow: 0 0 0 1px var(--accent1) inset; }
.pro-tier.mega { border-color: rgba(139, 92, 246, 0.4); }
.pro-tier.mega.on { border-color: var(--accent2); box-shadow: 0 0 0 1px var(--accent2) inset; }
.pt-name { font-size: var(--fs-s); font-weight: 600; color: var(--text); }
.pt-you { color: var(--accent1); font-weight: 600; }
.pt-price { font-size: var(--fs-xs); color: var(--muted); }
.pt-blurb { font-size: var(--fs-xs); color: var(--faint); margin-top: 2px; }
.pro-status-line { font-size: var(--fs-s); color: var(--muted); display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.pro-status-line .ok { color: var(--ok); }
.pro-card .primary-btn { text-decoration: none; display: inline-block; margin-bottom: var(--sp-2); }
.pro-card .secondary-btn { text-decoration: none; display: inline-block; }
/* "Also on the web" chips for tools this app covers */
.suite-tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.suite-tool-chip { display: flex; flex-direction: column; gap: 2px; padding: var(--sp-2) var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-s); text-decoration: none; color: var(--text); font-size: var(--fs-xs); transition: border-color var(--t-fast) var(--ease); }
.suite-tool-chip:hover { border-color: var(--accent1); }
.stc-name { font-weight: 600; }
.stc-web { color: var(--faint); font-size: 11px; }
/* All-tools-by-category */
.suite-cat { padding: var(--sp-2) 0; border-bottom: 1px solid var(--border); }
.suite-cat:last-of-type { border-bottom: none; }
.suite-cat-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-2); }
.scat-name { font-size: var(--fs-s); font-weight: 600; color: var(--text); }
.scat-count { font-size: var(--fs-xs); color: var(--faint); }
.suite-cat-tools { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.suite-cat-tool { font-size: var(--fs-xs); color: var(--muted); text-decoration: none; border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.suite-cat-tool:hover { border-color: var(--accent1); color: var(--accent1); }
.suite-cat-tool.hidden { display: none; }
.suite-showall { margin-top: var(--sp-2); }
.suite-launcher .secondary-btn[href] { text-decoration: none; display: inline-block; margin-top: var(--sp-3); }
