/* PaperPro web tools. Same look as the app and home page: solid blue, white paper, gold. No gradients. */
:root {
  --blue: #2563eb; --blue-deep: #1d4ed8; --blue-wash: #eff6ff; --gold: #b7791f; --gold-soft: #fff6e0;
  --ink: #0f172a; --muted: #475569; --faint: #94a3b8; --paper: #ffffff; --wash: #f8fafc; --rule: #e2e8f0;
  --danger: #dc2626;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
body { font: 16px/1.55 var(--font); color: var(--ink); background: var(--wash); }
a { color: inherit; }
button { font: inherit; cursor: pointer; }
a:focus-visible, button:focus-visible, label:focus-within { outline: 3px solid var(--gold); outline-offset: 2px; }

/* Header */
.top { background: var(--blue); color: #fff; }
.top .in { max-width: 1240px; margin: 0 auto; padding: 14px 16px; display: flex; align-items: center; gap: 10px; }
.top img { width: 34px; height: 34px; border-radius: 9px; box-shadow: 0 0 0 2px rgba(255,255,255,.85); }
.top b { font-size: 19px; letter-spacing: -.3px; }
.top .crumb { color: #bfdbfe; font-size: 15px; text-decoration: none; }
.top .app { margin-left: auto; background: #fff; color: var(--blue-deep); font-weight: 700; font-size: 14px; padding: 8px 14px; border-radius: 999px; text-decoration: none; white-space: nowrap; }

/* Main column with an ad column each side on wide screens; one ad below on phones */
.page { max-width: 1240px; margin: 0 auto; padding: 24px 16px 40px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.ad-side { display: none; }
.ad-bottom { min-height: 0; }
/* Until ads actually run (html.ads-live, set in common.js), wide screens get one centred column
   instead of two empty ad columns. */
.page > main { width: 100%; max-width: 920px; justify-self: center; }
@media (min-width: 1100px) {
  html.ads-live .page { grid-template-columns: 160px minmax(0, 1fr) 160px; }
  /* Pinned to the middle column: ad blockers hide .ad-side, which would otherwise pull main into the 160px slot. */
  html.ads-live .page > main { max-width: none; grid-column: 2; grid-row: 1; }
  html.ads-live .ad-side { display: block; position: sticky; top: 16px; align-self: start; width: 160px; min-height: 600px; }
  html.ads-live .ad-bottom { display: none; }
}
/* Shown only with ?ads=preview, until AdSense is approved */
.ad-preview .ad-side, .ad-preview .ad-bottom { border: 1.5px dashed var(--faint); border-radius: 10px; color: var(--faint); font-size: 13px; place-items: center; }
.ad-preview .ad-bottom { min-height: 60px; display: grid; }
@media (min-width: 1100px) { .ad-preview .ad-side { display: grid; } .ad-preview .ad-bottom { display: none; } }

main { min-width: 0; }
h1 { font-size: clamp(26px, 4vw, 34px); letter-spacing: -.6px; line-height: 1.15; }
.lead { color: var(--muted); margin-top: 6px; }
.safe { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; margin-top: 10px; }
.safe svg { color: var(--blue); flex: none; }

/* Hub */
.group { font-size: 13px; letter-spacing: .8px; text-transform: uppercase; color: var(--faint); font-weight: 700; margin: 28px 0 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
@media (max-width: 520px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tool { flex-direction: column; gap: 8px; padding: 14px; }
}
.tool { background: var(--paper); border: 1px solid var(--rule); border-radius: 14px; padding: 16px; text-decoration: none; display: flex; gap: 12px; align-items: flex-start; }
a.tool:hover { border-color: var(--blue); }
.tool .ic { width: 38px; height: 38px; border-radius: 10px; background: var(--blue-wash); color: var(--blue); display: grid; place-items: center; flex: none; }
.tool b { display: block; font-size: 16px; }
.tool span { display: block; color: var(--muted); font-size: 13px; line-height: 1.4; margin-top: 2px; }
.tool.soon { opacity: .6; }
.tool .tag { display: inline-block; margin-top: 6px; font-size: 11px; font-weight: 700; color: var(--muted); background: var(--wash); border: 1px solid var(--rule); border-radius: 999px; padding: 1px 8px; }

/* Tool screen */
.drop { margin-top: 20px; background: var(--paper); border: 2px dashed #93c5fd; border-radius: 16px; padding: 32px 16px; text-align: center; cursor: pointer; display: block; }
.drop.over { border-color: var(--blue); background: var(--blue-wash); }
.drop b { display: block; font-size: 18px; margin-top: 8px; }
.drop span { color: var(--muted); font-size: 14px; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop .pick { display: inline-block; margin-top: 14px; background: var(--blue); color: #fff; font-weight: 700; padding: 10px 20px; border-radius: 999px; }

.files { list-style: none; padding: 0; margin-top: 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.file { background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; padding: 10px 10px 10px 12px; display: flex; align-items: center; gap: 10px; }
.file .n { width: 26px; height: 26px; border-radius: 7px; background: var(--blue); color: #fff; font-size: 13px; font-weight: 700; display: grid; place-items: center; flex: none; }
.file .meta { flex: 1; min-width: 0; }
.file .meta b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file .meta span { color: var(--muted); font-size: 13px; }
.file .meta .err { color: var(--danger); }
.icon-btn { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--rule); background: var(--paper); color: var(--muted); display: grid; place-items: center; flex: none; }
.icon-btn:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.icon-btn:disabled { opacity: .35; cursor: default; }

.actions { margin-top: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.primary { background: var(--blue); color: #fff; border: 0; font-weight: 700; font-size: 16px; padding: 13px 26px; border-radius: 999px; }
.primary:disabled { opacity: .5; cursor: default; }
.secondary { background: var(--paper); color: var(--blue-deep); border: 1.5px solid var(--blue); font-weight: 700; padding: 11px 20px; border-radius: 999px; text-decoration: none; }
.note { color: var(--muted); font-size: 14px; }
.msg { margin-top: 14px; border-radius: 12px; padding: 12px 14px; font-size: 15px; }
.msg.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.msg.done { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.msg.limit { background: var(--gold-soft); color: #633806; border: 1.5px solid var(--gold); }
.msg a { font-weight: 700; }

.howto { margin-top: 36px; background: var(--paper); border: 1px solid var(--rule); border-radius: 16px; padding: 20px; }
.howto h2 { font-size: 19px; }
.howto ol { margin-top: 8px; padding-left: 20px; color: var(--muted); }
.howto li { margin: 4px 0; }

.app-card { margin-top: 20px; background: var(--ink); color: #fff; border-radius: 16px; padding: 18px 20px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.app-card p { color: #cbd5e1; font-size: 14px; }
.app-card a { background: #fff; color: var(--ink); font-weight: 700; padding: 10px 18px; border-radius: 999px; text-decoration: none; }

footer { max-width: 1240px; margin: 0 auto; padding: 8px 16px 40px; color: var(--muted); font-size: 14px; display: flex; flex-wrap: wrap; gap: 8px 20px; }
footer a { text-decoration: none; }
footer a:hover { color: var(--blue); }
@media (max-width: 520px) { .top .crumb { display: none; } }

/* Forms: exam picker, crop editor, result */
.step { margin-top: 22px; background: var(--paper); border: 1px solid var(--rule); border-radius: 16px; padding: 18px; }
.step h2 { font-size: 18px; display: flex; align-items: center; gap: 10px; }
.step h2 .num { width: 26px; height: 26px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 14px; display: grid; place-items: center; flex: none; }
.select { width: 100%; margin-top: 12px; font: inherit; font-size: 16px; padding: 12px 14px; border: 1.5px solid var(--rule); border-radius: 12px; background: var(--paper); color: var(--ink); }
.select:focus { outline: none; border-color: var(--blue); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pill { border: 1.5px solid var(--rule); background: var(--paper); color: var(--ink); font-weight: 700; font-size: 14px; padding: 8px 14px; border-radius: 999px; }
.pill[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }
.spec { margin-top: 12px; font-weight: 700; color: var(--blue-deep); font-variant-numeric: tabular-nums; }
.tip { margin-top: 6px; color: var(--muted); font-size: 14px; }
.tip a { color: var(--blue-deep); }
.custom { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.custom label { font-size: 13px; color: var(--muted); font-weight: 700; }
.custom input { width: 100%; margin-top: 4px; font: inherit; font-size: 16px; padding: 9px 10px; border: 1.5px solid var(--rule); border-radius: 10px; }
.custom input:focus { outline: none; border-color: var(--blue); }
@media (max-width: 520px) { .custom { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.editor { margin-top: 14px; display: grid; justify-items: center; gap: 12px; }
.stage { touch-action: none; cursor: grab; border-radius: 6px; box-shadow: 0 0 0 2px var(--blue); background: #fff; max-width: 100%; }
.stage:active { cursor: grabbing; }
.hint { color: var(--muted); font-size: 13px; text-align: center; }
.controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 14px; width: 100%; }
.controls input[type=range] { flex: 1; min-width: 140px; max-width: 260px; accent-color: var(--blue); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--ink); }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }

.result { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.result img { max-width: 160px; max-height: 200px; border: 1px solid var(--rule); border-radius: 6px; background: #fff; }
.result .facts b { display: block; font-size: 18px; }
.result .facts span { display: block; color: var(--muted); font-size: 14px; }
.result .ok { color: #166534; font-weight: 700; }

/* Compress: level choice */
.levels { display: grid; gap: 10px; margin-top: 12px; }
.level { display: flex; gap: 12px; align-items: flex-start; background: var(--paper); border: 1.5px solid var(--rule); border-radius: 14px; padding: 14px; cursor: pointer; }
.level:has(input:checked) { border-color: var(--blue); background: var(--blue-wash); }
.level input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--blue); flex: none; }
.level b { display: block; }
.level span { display: block; color: var(--muted); font-size: 14px; }
.level .pills { margin-top: 10px; }
.progress { height: 6px; border-radius: 999px; background: var(--rule); overflow: hidden; margin-top: 14px; }
.progress div { height: 100%; width: 0; background: var(--blue); transition: width .2s; }

/* Split: page thumbnails */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-top: 12px; }
.thumb { position: relative; background: var(--paper); border: 2px solid var(--rule); border-radius: 10px; padding: 6px; display: grid; gap: 4px; justify-items: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.thumb canvas { width: 100%; height: auto; background: #fff; box-shadow: 0 0 0 1px var(--rule); }
.thumb[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-wash); color: var(--blue-deep); }
.thumb[aria-pressed="true"]::after { content: '✓'; position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 12px; display: grid; place-items: center; }
.range { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.range input { font: inherit; font-size: 16px; padding: 9px 12px; border: 1.5px solid var(--rule); border-radius: 10px; min-width: 0; flex: 1; max-width: 260px; }
.range input[type=number] { max-width: 90px; }
.range input:focus { outline: none; border-color: var(--blue); }
.linkish { background: none; border: 0; color: var(--blue-deep); font-weight: 700; font-size: 14px; padding: 4px 2px; }
@media (max-width: 520px) { .thumbs { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Sign: page viewer, placed signatures, signature pad */
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; font-weight: 700; font-size: 14px; color: var(--muted); }
.sheet { position: relative; margin: 10px auto 0; width: fit-content; max-width: 100%; box-shadow: 0 0 0 1px var(--rule), 0 6px 20px rgba(15,23,42,.08); background: #fff; }
.sheet canvas { display: block; max-width: 100%; }
.placed { position: absolute; touch-action: none; cursor: move; outline: 1.5px dashed var(--blue); outline-offset: 2px; }
.placed img { width: 100%; height: 100%; display: block; pointer-events: none; }
.placed .x, .placed .grip { position: absolute; width: 26px; height: 26px; border-radius: 50%; background: var(--blue); color: #fff; border: 2px solid #fff; display: grid; place-items: center; padding: 0; }
.placed .x { top: -15px; right: -15px; font-size: 14px; line-height: 1; }
.placed .grip { bottom: -15px; right: -15px; cursor: nwse-resize; touch-action: none; }
.sigs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; align-items: center; }
.sig { background: var(--paper); border: 1.5px solid var(--rule); border-radius: 12px; padding: 8px 12px; height: 64px; display: grid; place-items: center; }
.sig:hover { border-color: var(--blue); }
.sig img { max-height: 46px; max-width: 180px; }
.pad-wrap { margin-top: 12px; }
.pad { width: 100%; height: 200px; display: block; background: #fff; border: 1.5px solid var(--rule); border-radius: 12px; touch-action: none; cursor: crosshair; }
.pad-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.ink { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--paper); box-shadow: 0 0 0 1.5px var(--rule); padding: 0; }
.ink[aria-pressed="true"] { box-shadow: 0 0 0 2.5px var(--blue); }
.pad-tools .spacer { flex: 1; }

/* Organize: square tiles so rotated pages still fit, and a sticky action bar */
.thumb .frame { position: relative; width: 100%; aspect-ratio: 1; }
.thumb .frame canvas { position: absolute; inset: 0; margin: auto; max-width: 100%; max-height: 100%; width: auto; height: auto; transition: transform .15s; }
.toolbar { position: sticky; top: 0; z-index: 2; background: var(--wash); padding: 10px 0; margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar .tb { display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--rule); background: var(--paper); color: var(--ink); font-weight: 700; font-size: 14px; padding: 8px 12px; border-radius: 999px; }
.toolbar .tb:hover:not(:disabled) { border-color: var(--blue); color: var(--blue-deep); }
.toolbar .tb:disabled { opacity: .4; cursor: default; }
.toolbar .tb.danger:hover:not(:disabled) { border-color: var(--danger); color: var(--danger); }
.toolbar .sel { color: var(--muted); font-size: 14px; margin-right: auto; }

/* Add text: typed items on the page, the text box, and fillable fields */
.placed .txt { font-family: Helvetica, Arial, sans-serif; line-height: 1.25; white-space: pre; pointer-events: none; }
.placed.mark { display: grid; place-items: center; }
.placed.mark svg { width: 100%; height: 100%; pointer-events: none; }
.placed.on { outline-style: solid; background: rgba(37,99,235,.06); }
.composer { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: flex-start; }
.composer textarea { flex: 1 1 240px; min-width: 0; font: inherit; font-size: 16px; padding: 10px 12px; border: 1.5px solid var(--rule); border-radius: 12px; resize: vertical; min-height: 46px; }
.composer textarea:focus { outline: none; border-color: var(--blue); }
.fields { display: grid; gap: 10px; margin-top: 12px; }
.fields label { display: grid; gap: 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.fields input[type=text], .fields select { font: inherit; font-size: 16px; padding: 9px 12px; border: 1.5px solid var(--rule); border-radius: 10px; color: var(--ink); background: var(--paper); }
.fields input[type=text]:focus, .fields select:focus { outline: none; border-color: var(--blue); }
.fields label.check { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--ink); }
.placed.item:not(.on) { outline-color: rgba(37,99,235,.35); }
.placed.item:not(.on) .x, .placed.item:not(.on) .grip { display: none; }

/* Page tiles chosen to remove (red) or keep (blue) */
.thumb.del, .thumb.pick { position: relative; }
.thumb.del { border-color: var(--danger); background: #fef2f2; color: var(--danger); }
.thumb.pick { border-color: var(--blue); background: var(--blue-wash); color: var(--blue-deep); }
.thumb.del::after, .thumb.pick::after { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; color: #fff; font-size: 12px; display: grid; place-items: center; }
.thumb.del::after { content: '✕'; background: var(--danger); }
.thumb.pick::after { content: '✓'; background: var(--blue); }
.thumb.del canvas { opacity: .45; }

/* Image converter */
.thumb-img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; flex: none; background: var(--wash); display: block; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 15px; color: var(--ink); }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }
.kb-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.kb-row input { width: 110px; font: inherit; font-size: 16px; padding: 9px 10px; border: 1.5px solid var(--rule); border-radius: 10px; }
.kb-row input:focus { outline: none; border-color: var(--blue); }

/* Word to PDF preview: docx-preview draws each page as a white sheet */
.docx-preview { margin-top: 18px; overflow-x: auto; border-radius: 12px; }
.docx-preview .docx-wrapper { background: var(--rule); padding: 16px; }
.docx-preview section.docx { box-shadow: 0 2px 10px rgba(15, 23, 42, .12); margin-bottom: 16px; }

/* Motion (see common.js). Quick and small; off for people who ask for less motion. */
@keyframes pp-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pp-drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
html.motion .reveal { opacity: 0; transform: translateY(14px); transition: opacity .45s cubic-bezier(.2,.8,.2,1), transform .45s cubic-bezier(.2,.8,.2,1); }
html.motion .reveal.in { opacity: 1; transform: none; }
.primary, .secondary, .pill, .icon-btn, .drop .pick, .app-card a, .top .app, .filter { transition: transform .12s ease, background-color .15s, border-color .15s, color .15s; }
.primary:active:not(:disabled), .secondary:active, .pill:active, .icon-btn:active:not(:disabled), .app-card a:active, .top .app:active, .filter:active { transform: scale(.96); }
.primary:hover:not(:disabled) { background: var(--blue-deep); }
.drop { transition: border-color .15s, background-color .15s, transform .15s; }
.drop:hover { border-color: var(--blue); }
.drop.over { transform: scale(1.01); }
.app-card a:hover, .top .app:hover { transform: translateY(-1px); }
.msg { animation: pp-drop .3s cubic-bezier(.2,.8,.2,1) both; }
#results .file:last-child { animation: pp-rise .3s cubic-bezier(.2,.8,.2,1) both; }
.card:active { transform: scale(.98); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Link from a tool's how-to box to its full guide on eryzanlabs.com */
.howto .guide-link { margin-top: 12px; color: var(--muted); font-size: 15px; }
.howto .guide-link a { color: var(--blue-deep); font-weight: 700; }

/* Picture tools (imgkit.js and friends) */
.stage { margin-top: 16px; background: var(--wash); border: 1px solid var(--rule); border-radius: 14px; padding: 10px; display: flex; justify-content: center; }
.stage canvas { max-width: 100%; max-height: 70vh; width: auto; height: auto; border-radius: 8px; display: block; }
.stage.checker { background: repeating-conic-gradient(#e2e8f0 0 25%, #fff 0 50%) 0 0 / 20px 20px; }
.fthumbs { display: flex; gap: 12px; overflow-x: auto; padding: 14px 2px 6px; }
.fthumb { flex: none; border: 0; background: none; padding: 0; width: 82px; font-size: 12px; font-weight: 700; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.fthumb canvas { width: 78px; height: 78px; object-fit: cover; border-radius: 12px; border: 1px solid var(--rule); }
.fthumb[aria-pressed="true"] { color: var(--blue-deep); }
.fthumb[aria-pressed="true"] canvas { outline: 3px solid var(--blue); outline-offset: 2px; }
.slider { display: grid; grid-template-columns: 104px minmax(0, 1fr) 42px; align-items: center; gap: 10px; margin-top: 10px; font-size: 14px; color: var(--muted); }
.slider input { width: 100%; accent-color: var(--blue); }
.slider output { text-align: right; font-variant-numeric: tabular-nums; }
.linkbtn { margin-left: auto; border: 0; background: none; color: var(--blue-deep); font-weight: 700; font-size: 14px; }
.layouts { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 10px; margin-top: 14px; }
.lthumb { border: 2px solid var(--rule); background: var(--paper); border-radius: 10px; padding: 5px; line-height: 0; }
.lthumb canvas { width: 100%; height: auto; }
.lthumb[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-wash); }
#board { touch-action: none; cursor: pointer; }
.cellbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; font-size: 14px; color: var(--muted); }
.cellbar input[type="range"] { flex: 1; min-width: 120px; accent-color: var(--blue); }
.cropbox { position: relative; display: inline-block; max-width: 100%; line-height: 0; touch-action: none; user-select: none; overflow: hidden; border-radius: 8px; }
.cropbox .cb-img { max-width: 100%; max-height: 65vh; width: auto; height: auto; display: block; }
.cb-frame { position: absolute; box-shadow: 0 0 0 9999px rgba(15, 23, 42, .55); outline: 2px solid #fff; cursor: move; touch-action: none; }
.cb-h { position: absolute; width: 20px; height: 20px; background: #fff; border: 2px solid var(--blue); border-radius: 50%; }
.cb-nw { left: -2px; top: -2px; cursor: nwse-resize; }
.cb-ne { right: -2px; top: -2px; cursor: nesw-resize; }
.cb-sw { left: -2px; bottom: -2px; cursor: nesw-resize; }
.cb-se { right: -2px; bottom: -2px; cursor: nwse-resize; }
#view.draggable { cursor: grab; touch-action: none; }
#view.drawable { cursor: crosshair; touch-action: none; }
.pill.swatch { width: 36px; height: 36px; padding: 0; background: var(--sw) !important; border: 2px solid var(--rule); }
.pill.swatch[aria-pressed="true"] { outline: 3px solid var(--blue); outline-offset: 2px; }
.textbox { width: 100%; margin-top: 12px; font: inherit; font-size: 16px; padding: 12px 14px; border: 1.5px solid var(--rule); border-radius: 12px; resize: vertical; min-height: 64px; }
.textbox:focus { outline: none; border-color: var(--blue); }
.row-inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; font-size: 14px; color: var(--muted); }
.row-inline input[type="number"], .row-inline select { width: 96px; font: inherit; font-size: 16px; padding: 8px 10px; border: 1.5px solid var(--rule); border-radius: 10px; background: var(--paper); }

/* About this tool + questions (scripts/tool_faqs.py) */
.faq { margin-top: 20px; background: var(--paper); border: 1px solid var(--rule); border-radius: 16px; padding: 20px; }
.faq h2 { font-size: 19px; }
.faq h2 + p { margin-top: 8px; color: var(--muted); }
.faq h2:not(:first-child) { margin-top: 18px; }
.faq details { border-top: 1px solid var(--rule); padding: 12px 0; }
.faq details:first-of-type { margin-top: 8px; }
.faq summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--blue); font-size: 20px; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin-top: 8px; color: var(--muted); }

/* Result preview: what was made, with a Download button (PaperPro.ready). */
.ready { margin-top: 18px; border: 1px solid var(--rule); border-radius: 20px; background: var(--paper); padding: 18px; box-shadow: 0 10px 30px rgba(15,23,42,.06); animation: pp-rise .4s cubic-bezier(.2,.8,.2,1) both; }
.ready-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.ready-head svg { flex: none; }
.ready-head .tick { stroke-dasharray: 40; stroke-dashoffset: 40; animation: pp-draw .5s .15s ease forwards; }
.ready-head b { display: block; font-size: 16px; word-break: break-word; }
.ready-head span { color: var(--muted); font-size: 14px; }
.ready-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); max-height: 520px; overflow: auto; padding: 4px; margin: 0 -4px; }
.ready-grid.slide { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.ready-tile { border: 0; background: none; padding: 0; color: var(--muted); font: 600 12px var(--font); display: flex; flex-direction: column; gap: 6px; cursor: zoom-in; animation: pp-rise .35s cubic-bezier(.2,.8,.2,1) both; }
.ready-frame { display: flex; align-items: center; justify-content: center; background: var(--wash); border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; aspect-ratio: 3 / 4; transition: transform .15s ease, box-shadow .15s ease; }
.ready-grid.slide .ready-frame { aspect-ratio: 16 / 9; background: #0f172a; }
.ready-grid.photo .ready-frame { aspect-ratio: 1; background-image: linear-gradient(45deg,#eef2f7 25%,transparent 25%,transparent 75%,#eef2f7 75%),linear-gradient(45deg,#eef2f7 25%,transparent 25%,transparent 75%,#eef2f7 75%); background-size: 14px 14px; background-position: 0 0, 7px 7px; }
.ready-frame canvas { max-width: 100%; max-height: 100%; display: block; box-shadow: 0 1px 4px rgba(15,23,42,.15); }
.ready-tile:hover .ready-frame { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(15,23,42,.12); }
.ready-more { margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.ready-doc { max-height: 560px; overflow: auto; border: 1px solid var(--rule); border-radius: 12px; background: #e2e8f0; }
.ready .actions { margin-top: 16px; }
.lightbox { position: fixed; inset: 0; z-index: 1000; background: rgba(15,23,42,.92); display: flex; flex-direction: column; animation: pp-fade .2s ease both; }
.lb-top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: #fff; }
.lb-top b { flex: 1; font-size: 15px; }
.lb-btn { background: #fff; color: var(--ink); border: 0; border-radius: 999px; padding: 9px 16px; font-weight: 700; }
.lb-x { width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 24px; line-height: 1; }
.lb-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px 56px 24px; }
.lb-stage canvas { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; box-shadow: 0 20px 60px rgba(0,0,0,.5); border-radius: 4px; animation: pp-pop .25s cubic-bezier(.2,.9,.25,1.1) both; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.18); color: #fff; font-size: 30px; line-height: 1; }
.lb-nav.prev { left: 8px; } .lb-nav.next { right: 8px; }
@media (max-width: 560px) { .lb-stage { padding: 8px 8px 72px; } .lb-nav { top: auto; bottom: 14px; transform: none; } .lb-nav.prev { left: calc(50% - 56px); } .lb-nav.next { right: calc(50% - 56px); } }
@keyframes pp-draw { to { stroke-dashoffset: 0; } }
@keyframes pp-fade { from { opacity: 0; } }
@keyframes pp-pop { from { opacity: 0; transform: scale(.96); } }
@media (prefers-reduced-motion: reduce) { .ready, .ready-tile, .lightbox, .lb-stage canvas { animation: none; } .ready-head .tick { stroke-dashoffset: 0; animation: none; } }
