:root {
  --bg: #f3f2ea;
  --surface: #fffdf8;
  --surface-2: #eceee4;
  --surface-3: #e2e5d9;
  --ink: #1e2d25;
  --ink-2: #55655b;
  --ink-3: #86938a;
  --line: #e0e3d7;
  --line-2: #cbd2c3;
  --green: #244d3c;
  --green-deep: #183828;
  --green-soft: #e1ebde;
  --approve: #2b6a44;
  --approve-deep: #1f5535;
  --deny: #b0424a;
  --deny-soft: #fbecea;
  --deny-line: #f0c8c4;
  --focus: #bb781e;
  --stage-solid: #141a16;
  --header: 56px;
  --radius: 14px;
  --font-ui: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, 'Times New Roman', serif;
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--bg);
  color-scheme: light;
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { min-height: 100dvh; display: flex; flex-direction: column; }
body[data-screen="review-screen"] { overflow: hidden; height: 100dvh; }
main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
[hidden] { display: none !important; }
h1, h2, p { margin-top: 0; }
h1, h2 { font-family: var(--font-display); font-weight: 400; letter-spacing: -.02em; line-height: 1.1; }
p { line-height: 1.55; }
a { color: var(--green); text-underline-offset: 3px; }
button, input, textarea, select { font: inherit; color: inherit; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
button { border: 0; background: none; padding: 0; cursor: pointer; touch-action: manipulation; }
a { touch-action: manipulation; }
button:disabled { cursor: default; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- Shared components ---------- */
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #7d8a6a; margin: 0 0 10px; }
.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 20px; border-radius: 12px; font-size: 15px; font-weight: 600; text-decoration: none; transition: background .15s, transform .1s; }
.primary { background: var(--green); color: #fff; }
.primary:hover { background: var(--green-deep); }
.secondary { background: var(--surface-2); color: var(--green); }
.secondary:hover { background: var(--surface-3); }
.primary:active, .secondary:active { transform: scale(.985); }
.primary:disabled, .secondary:disabled { opacity: .5; }
.secondary svg { width: 18px; height: 18px; }
.quiet { color: var(--ink-2); padding: 8px 12px; font-size: 13px; font-weight: 600; border-radius: 10px; min-height: 38px; }
.quiet:hover { background: var(--surface-2); color: var(--ink); }
.quiet:disabled { opacity: .45; }
.icon-button { width: 40px; height: 40px; border-radius: 999px; display: inline-grid; place-items: center; color: var(--ink-2); flex-shrink: 0; }
.icon-button svg { width: 21px; height: 21px; }
.icon-button:hover { background: var(--surface-2); color: var(--ink); }
.icon-button:disabled { opacity: .4; }
.icon-button.dark { color: #fff; }
.icon-button.dark:hover { background: rgba(255, 255, 255, .14); }
.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px 3px 8px; font-size: 11px; font-weight: 700; letter-spacing: .01em; background: #e4e7dc; color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.badge.approved { background: #dcede0; color: #23603b; }
.badge.denied { background: #f8e2e1; color: #9c3940; }
.error { color: #8a3239; background: #fff1ee; padding: 10px 14px; border: 1px solid #ecc2bc; border-radius: 10px; font-size: 13px; line-height: 1.5; margin: 0; }
.segmented { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); gap: 2px; }
.segmented button { border-radius: 999px; padding: 6px 14px; min-height: 34px; font-size: 13px; font-weight: 600; color: var(--ink-2); transition: background .15s, color .15s; white-space: nowrap; }
.segmented button.active { background: #fff; color: var(--green); box-shadow: 0 1px 3px rgba(20, 40, 30, .16); }
.segmented.dark, .stage-tools .segmented { background: rgba(255, 255, 255, .12); }
.segmented.dark button, .stage-tools .segmented button { color: #d6ddd7; }
.segmented.dark button.active, .stage-tools .segmented button.active { background: #fff; color: var(--green); }
.spinner { display: inline-block; width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid currentColor; border-top-color: transparent; opacity: .75; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
kbd { font-family: var(--font-ui); font-size: 10px; font-weight: 700; padding: 1px 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; background: #fff; color: var(--ink-2); }

/* ---------- Header ---------- */
.topbar { height: var(--header); flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand-mark { width: 36px; height: 36px; border-radius: 50%; background: var(--green); color: #faf8ed; display: grid; place-items: center; font-family: var(--font-display); font-size: 21px; letter-spacing: -.06em; padding-right: 2px; flex-shrink: 0; }
.brand-text { font-size: 13px; font-weight: 700; letter-spacing: .02em; line-height: 1.15; white-space: nowrap; }
.brand-text small { display: block; font-size: 11px; font-weight: 400; color: var(--ink-3); }
.topbar nav { display: flex; align-items: center; gap: 4px; }
.tabs { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); margin-right: 6px; }
.tab { padding: 6px 14px; min-height: 34px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.tab[aria-current="page"] { background: #fff; color: var(--green); box-shadow: 0 1px 3px rgba(20, 40, 30, .16); }
.tab:disabled { opacity: .5; }

/* ---------- Welcome ---------- */
.welcome { max-width: 1060px; width: 100%; margin: 0 auto; padding: 56px 32px 72px; display: grid; grid-template-columns: 1.1fr .9fr; gap: 72px; align-items: center; }
.welcome h1 { font-size: clamp(40px, 4.6vw, 62px); margin-bottom: 18px; }
.lede { font-size: 17px; color: var(--ink-2); max-width: 460px; line-height: 1.65; margin: 0; }
.how-to { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 16px; counter-reset: step; }
.how-to li { display: grid; grid-template-columns: 30px 1fr; column-gap: 14px; align-items: start; }
.how-to li::before { counter-increment: step; content: counter(step, decimal-leading-zero); grid-row: 1 / span 2; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line-2); display: grid; place-items: center; font-family: var(--font-display); font-size: 12px; color: var(--ink-2); }
.how-to strong { font-size: 14px; font-weight: 600; }
.how-to span { font-size: 13px; color: var(--ink-2); line-height: 1.5; max-width: 400px; }
.login-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 30px; box-shadow: 0 20px 50px rgba(30, 55, 40, .08); }
.login-panel h2 { font-size: 30px; margin-bottom: 8px; }
.login-panel > p { font-size: 14px; color: var(--ink-2); margin-bottom: 20px; }
.login-panel label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; margin-bottom: 14px; }
input:not([type=range]), textarea { border: 1px solid var(--line-2); border-radius: 10px; background: #fff; padding: 11px 13px; width: 100%; min-width: 0; line-height: 1.4; font-size: 16px; }
input:not([type=range]):focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(36, 77, 60, .15); }
input::placeholder, textarea::placeholder { color: #9aa398; }
.login-panel .primary { width: 100%; margin-top: 6px; }
.login-panel .error { margin-bottom: 12px; }
.login-fine { font-size: 12px; color: var(--ink-3); line-height: 1.6; margin: 16px 0 10px; }
.login-panel > a { font-size: 12px; color: var(--ink-3); }

/* ---------- Review screen ---------- */
.review-screen { display: flex; flex-direction: column; flex: 1; min-height: 0; height: calc(100dvh - var(--header)); overflow: auto; background: var(--surface); }
progress { flex-shrink: 0; width: 100%; height: 3px; display: block; border: 0; background: var(--surface-3); appearance: none; -webkit-appearance: none; }
progress::-webkit-progress-bar { background: var(--surface-3); }
progress::-webkit-progress-value { background: var(--approve); transition: width .3s; }
progress::-moz-progress-bar { background: var(--approve); }
.review-top { flex-shrink: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; padding: 6px 8px; min-height: 52px; }
.nav-button { display: inline-flex; align-items: center; gap: 2px; padding: 8px 10px 8px 6px; min-height: 40px; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.nav-button:last-child { justify-self: end; padding: 8px 6px 8px 10px; }
.nav-button svg { width: 20px; height: 20px; }
.nav-button:hover { background: var(--surface-2); color: var(--ink); }
.nav-button:disabled { opacity: .35; }
.review-title { text-align: center; min-width: 0; }
.review-title h1 { font-family: var(--font-ui); font-size: 15px; font-weight: 600; letter-spacing: 0; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.review-title p { margin: 2px 0 0; font-size: 12px; color: var(--ink-3); display: flex; align-items: center; justify-content: center; gap: 8px; }
.workspace { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.stage { flex: 1; min-height: 212px; display: flex; flex-direction: column; background: var(--stage-solid); }
.gesture-area { flex: 1; min-height: 160px; position: relative; display: grid; place-items: center; container-type: size; touch-action: pan-y; user-select: none; -webkit-user-select: none; overflow: hidden; will-change: transform; }
.comparison { container-type: inline-size; position: relative; width: min(100%, calc(100cqh * var(--r, 1.4))); aspect-ratio: var(--r, 1.4); max-height: 100%; overflow: hidden; background: #0e1310; }
.comparison img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.comparison .before { clip-path: inset(0 calc(100% - var(--split)) 0 0); }
.image-tag { position: absolute; top: 10px; padding: 5px 10px; border-radius: 999px; background: rgba(10, 18, 14, .62); color: #fff; font-size: 11px; font-weight: 600; letter-spacing: .02em; pointer-events: none; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 2; }
.original-tag { left: 10px; }
.edited-tag { right: 10px; }
.mode-original .edited-tag, .mode-edited .original-tag, .peeking .edited-tag { display: none; }
.peeking .original-tag { display: inline-block; }
.mode-original .compare-handle, .mode-edited .compare-handle, .peeking .compare-handle { display: none; }
.compare-handle { position: absolute; top: 0; bottom: 0; left: var(--split); width: 56px; transform: translateX(-50%); cursor: ew-resize; touch-action: none; z-index: 3; display: flex; align-items: center; justify-content: center; }
.compare-handle::before { content: ''; position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; box-shadow: 0 0 6px rgba(0, 0, 0, .45); }
.compare-handle > span { position: relative; width: 40px; height: 40px; border-radius: 50%; background: #fff; color: var(--green); display: grid; place-items: center; box-shadow: 0 2px 10px rgba(0, 0, 0, .35); }
.compare-handle svg { width: 20px; height: 20px; stroke-width: 2.4; }
.image-loading { position: absolute; inset: 0; z-index: 4; background: var(--stage-solid); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; font-size: 13px; color: #a5b0a8; text-align: center; padding: 20px; }
.swipe-stamp { position: absolute; z-index: 5; top: 16%; border: 3px solid currentColor; border-radius: 10px; padding: 8px 16px; font-size: 24px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; opacity: 0; pointer-events: none; }
.stamp-approve { color: #8ee3a5; background: rgba(20, 70, 40, .72); left: 8%; transform: rotate(-10deg); }
.stamp-deny { color: #ffa0a0; background: rgba(90, 20, 26, .72); right: 8%; transform: rotate(10deg); }
.stage-tools { flex-shrink: 0; position: relative; display: flex; align-items: center; justify-content: center; padding: 8px 56px; min-height: 52px; }
.stage-tools .icon-button { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: #e8ede9; }
.stage-tools .icon-button:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.panel { flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); }
.tip { display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left; background: #faf7ea; border: 1px solid #ede7d0; border-radius: 10px; padding: 9px 12px; color: #5a5640; font-size: 13px; line-height: 1.45; }
.tip svg { width: 18px; height: 18px; flex-shrink: 0; color: #a48d47; margin-top: 1px; }
.tip > span { min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tip[aria-expanded="true"] > span { display: block; }
.tip strong { font-weight: 700; color: #4b4730; margin-right: 6px; }
.note-field { display: block; }
.note-field textarea { display: block; resize: none; min-height: 44px; max-height: 140px; padding: 11px 13px; border-radius: 10px; overflow: hidden; }
.choice-bar { display: grid; grid-template-columns: 1fr 1.25fr; gap: 10px; }
.decision-button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; border-radius: 14px; font-size: 16px; font-weight: 700; transition: transform .1s, background .15s, opacity .15s; }
.decision-button svg { width: 22px; height: 22px; stroke-width: 2.6; }
.decision-button:active { transform: scale(.97); }
.decision-button.deny { color: var(--deny); background: var(--deny-soft); border: 1px solid var(--deny-line); }
.decision-button.deny:hover { background: #f6dfdc; }
.decision-button.approve { color: #fff; background: var(--approve); box-shadow: 0 6px 18px rgba(43, 106, 68, .28); }
.decision-button.approve:hover { background: var(--approve-deep); }
.decision-button:disabled { opacity: .45; box-shadow: none; transform: none; }
.hints { display: none; }
.mobile-hint { margin: 0; font-size: 11px; color: var(--ink-3); text-align: center; line-height: 1.4; }
@media (min-width: 900px), (orientation: landscape) and (max-height: 600px) {
  .review-top { padding: 8px 16px; }
  .workspace { flex-direction: row; }
  .stage { flex: 1; min-width: 0; }
  .panel { width: min(380px, 42%); border-left: 1px solid var(--line); padding: 16px; gap: 12px; overflow: auto; }
  .note-field textarea { font-size: 14px; min-height: 72px; max-height: 240px; }
  .tip > span { display: block; }
  .mobile-hint { display: none; }
}
@media (min-width: 900px) {
  .panel { padding: 20px; gap: 14px; }
  .note-field textarea { min-height: 96px; }
  .hints { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: auto 0 0; font-size: 11px; color: var(--ink-3); }
  .hints kbd { margin-right: 2px; }
  .stage-tools { padding: 10px 56px; }
}

@container (max-width: 360px) {
  .image-tag { font-size: 10px; padding: 3px 7px; top: 8px; }
  .original-tag { left: 8px; }
  .edited-tag { right: 8px; }
}

/* ---------- Toast ---------- */
.toast { position: fixed; z-index: 30; top: calc(var(--header) + 66px); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; max-width: calc(100% - 24px); padding: 8px 8px 8px 16px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 500; box-shadow: 0 10px 30px rgba(20, 30, 25, .3); animation: toast-in .2s ease-out; }
.toast span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast-action { color: #9fe3b6; font-weight: 700; padding: 6px 14px; border-radius: 999px; background: rgba(255, 255, 255, .1); min-height: 34px; }
.toast-action:hover { background: rgba(255, 255, 255, .2); }
.toast-action:disabled { opacity: .5; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- Finished ---------- */
.finished { text-align: center; max-width: 560px; width: 100%; margin: 0 auto; padding: 72px 24px; }
.finish-mark { width: 72px; height: 72px; border-radius: 50%; background: var(--green-soft); color: var(--approve); display: grid; place-items: center; margin: 0 auto 24px; }
.finish-mark svg { width: 34px; height: 34px; stroke-width: 2.5; }
.finished h1 { font-size: clamp(34px, 6vw, 46px); margin-bottom: 12px; }
.finished > p { color: var(--ink-2); font-size: 15px; }
.finish-counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 28px 0; }
.finish-counts > div { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 10px; }
.finish-counts strong { display: block; font-family: var(--font-display); font-weight: 400; font-size: 32px; line-height: 1; margin-bottom: 6px; }
.finish-counts span { font-size: 12px; color: var(--ink-3); }
.finish-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* ---------- Results ---------- */
.results-screen { max-width: 1200px; width: 100%; margin: 0 auto; padding: 28px 24px 64px; }
.results-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.results-heading h1 { font-size: clamp(30px, 4vw, 40px); margin-bottom: 8px; }
.results-heading p:last-child { font-size: 14px; color: var(--ink-2); margin: 0; }
.results-actions { display: flex; gap: 8px; flex-shrink: 0; }
.summary-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.summary-cards > div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.summary-cards strong { display: block; font-family: var(--font-display); font-weight: 400; font-size: 28px; line-height: 1; }
.summary-cards span { display: block; font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.filter-bar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 0; margin-bottom: 14px; background: var(--bg); }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; max-width: 100%; padding: 2px; margin: -2px; }
.chips::-webkit-scrollbar { display: none; }
.chips button { border: 1px solid var(--line-2); border-radius: 999px; padding: 7px 13px; min-height: 36px; font-size: 13px; font-weight: 600; color: var(--ink-2); background: var(--surface); white-space: nowrap; transition: background .15s, color .15s; }
.chips button:hover { background: var(--surface-2); }
.chips button.active { background: var(--green); color: #fff; border-color: var(--green); }
.search { position: relative; flex: 1; min-width: 200px; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--ink-3); pointer-events: none; }
.search input { border-radius: 999px; padding: 8px 14px 8px 38px; min-height: 40px; font-size: 15px; }
#results-count { font-size: 12px; color: var(--ink-3); margin-left: auto; white-space: nowrap; }
.results-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.result-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s; }
.result-card:hover { box-shadow: 0 10px 28px rgba(30, 55, 40, .1); }
.result-card > button { display: block; width: 100%; aspect-ratio: 4 / 3; background: #e6e9df; position: relative; overflow: hidden; }
.result-card > button:focus-visible { outline-offset: -3px; }
.result-card img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.result-card > button:hover img { transform: scale(1.03); }
.result-card > button .badge { position: absolute; left: 8px; top: 8px; box-shadow: 0 1px 4px rgba(0, 0, 0, .15); }
.result-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.result-body h2 { font-family: var(--font-ui); font-size: 14px; font-weight: 600; letter-spacing: 0; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-body .result-meta { font-size: 12px; color: var(--ink-3); margin: 0; }
.result-body .result-note { font-size: 13px; color: var(--ink); line-height: 1.5; margin: 6px 0 0; padding: 8px 10px; background: #f7f5ea; border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.result-body button { align-self: flex-start; margin-top: auto; padding: 8px 0 0; font-size: 13px; font-weight: 600; color: var(--green); display: inline-flex; align-items: center; gap: 4px; }
.result-body button svg { width: 16px; height: 16px; }
.result-body button:hover { text-decoration: underline; text-underline-offset: 3px; }
.empty { text-align: center; color: var(--ink-3); padding: 40px 0; }
.history-panel { margin-top: 32px; font-size: 13px; color: var(--ink-2); }
.history-panel summary { cursor: pointer; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; font-weight: 600; color: var(--ink); }
.history-panel[open] summary { border-radius: 12px 12px 0 0; }
#history-list { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 12px 12px; background: var(--surface); }
#history-list > p { padding: 16px; margin: 0; }
.history-entry { padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 13px; line-height: 1.5; }
.history-entry:last-child { border-bottom: 0; }
.history-entry strong { color: var(--ink); font-weight: 600; }
.history-entry small { display: block; color: var(--ink-3); font-size: 12px; }
.history-entry p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0 0; padding: 8px 10px; background: #f7f5ea; border-radius: 8px; }

/* ---------- Loading ---------- */
.loading-screen { text-align: center; padding: 100px 24px; color: var(--ink-3); }
.loading-screen p { margin-top: 16px; }
.loading-screen .error { max-width: 460px; margin: 16px auto; text-align: left; }
.fine { font-size: 12px; color: var(--ink-3); line-height: 1.6; }

/* ---------- Dialogs ---------- */
dialog { border: 0; border-radius: 18px; padding: 28px; max-width: 520px; width: calc(100% - 32px); background: var(--surface); color: var(--ink); max-height: 90dvh; overflow: auto; box-shadow: 0 24px 80px rgba(15, 35, 25, .35); }
dialog::backdrop { background: rgba(18, 40, 32, .55); backdrop-filter: blur(3px); }
dialog h2 { font-size: 28px; padding-right: 32px; margin-bottom: 14px; }
.dialog-close { position: absolute; top: 12px; right: 12px; }
.help-list { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 12px; }
.help-list li { font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.help-list strong { display: block; color: var(--ink); font-weight: 600; }
dialog .primary { width: 100%; }
.zoom-dialog { max-width: none; max-height: none; width: 100vw; height: 100dvh; margin: 0; padding: 0; border-radius: 0; background: #0f1411; color: #fff; }
.zoom-dialog[open] { display: flex; flex-direction: column; }
.zoom-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); flex-shrink: 0; }
.zoom-title { flex: 1; text-align: center; font-size: 13px; color: #cfd8d0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zoom-scroll { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y pinch-zoom; overscroll-behavior: contain; }
.zoom-scroll img { display: block; max-width: none; }
.zoom-hint { flex-shrink: 0; margin: 0; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); text-align: center; font-size: 12px; color: #8e9a91; }
.inspect-dialog { max-width: 1100px; }
.inspect-meta { font-size: 13px; color: var(--ink-2); margin-bottom: 14px; }
.inspect-images { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.inspect-images figure { margin: 0; min-width: 0; }
.inspect-images img { width: 100%; height: 55dvh; object-fit: contain; background: #e9ece4; border-radius: 10px; }
.inspect-images figcaption { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.inspect-notes { margin: 14px 0 6px; font-size: 14px; line-height: 1.55; padding: 10px 12px; background: #f7f5ea; border-radius: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Footer ---------- */
.site-footer { display: none; max-width: 1200px; width: 100%; margin: auto auto 0; border-top: 1px solid var(--line); padding: 22px 24px calc(22px + env(safe-area-inset-bottom)); font-size: 11px; color: var(--ink-3); justify-content: space-between; gap: 12px; }
body[data-screen="welcome"] .site-footer, body[data-screen="results-screen"] .site-footer, body[data-screen="finished"] .site-footer { display: flex; }

/* ---------- Responsive ---------- */
@media (max-width: 799px) {
  .welcome { display: flex; flex-direction: column; gap: 26px; padding: 32px 20px 48px; }
  .welcome-copy { display: contents; }
  .welcome h1 { font-size: 38px; margin-bottom: 10px; }
  .lede { font-size: 15px; }
  .login-panel { order: 2; padding: 24px 20px; }
  .how-to { order: 3; margin-top: 4px; }
  .results-heading { flex-direction: column; align-items: stretch; }
  .results-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .summary-cards { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .summary-cards > div { padding: 10px 8px; text-align: center; }
  .summary-cards strong { font-size: 22px; }
  .summary-cards span { font-size: 10px; margin-top: 4px; }
  .inspect-images { grid-template-columns: 1fr; }
  .inspect-images img { height: 38dvh; }
}
@media (max-width: 600px) {
  .topbar { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
  .tab { padding: 6px 11px; font-size: 12px; }
  .quiet { padding: 8px 8px; font-size: 12px; }
  .results-screen { padding: 20px 14px 48px; }
  .results-heading { margin-bottom: 16px; }
  .results-heading .eyebrow { margin-bottom: 6px; }
  .results-actions .primary, .results-actions .secondary { flex: 1; min-height: 42px; font-size: 14px; }
  .result-card > button { aspect-ratio: 1; }
  .result-body { padding: 10px 11px 12px; }
  .result-body h2 { font-size: 13px; }
  .result-body .result-note { font-size: 12px; }
  #results-count { width: 100%; text-align: right; margin-top: -4px; }
  .search { min-width: 100%; }
  dialog:not(.zoom-dialog) { position: fixed; bottom: 0; top: auto; margin: 0; width: 100%; max-width: none; border-radius: 20px 20px 0 0; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); max-height: 92dvh; }
  dialog h2 { font-size: 25px; }
  .finished { padding: 48px 20px; }
}
@media (max-width: 480px) {
  body:not([data-screen="welcome"]) .brand-text { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
