/* workspace/codecards/styles/scanner.css */
:root { --ground:#0b0e13; --panel:#141923; --line:#263041; --text:#e8ecf2; --dim:#8a94a6; --accent:#3ddc84; --warn:#ff5c5c; }
:root { --top:env(safe-area-inset-top); --bottom:env(safe-area-inset-bottom); }
* { box-sizing:border-box; }
[hidden] { display:none !important; }
html, body { margin:0; background:var(--ground); color:var(--text); -webkit-text-size-adjust:100%; }
body { font:15px/1.4 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
a { color:var(--accent); }
button, .button, input[type=text] { font:inherit; color:var(--text); background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:12px 14px; }
button, .button { cursor:pointer; text-decoration:none; text-align:center; display:inline-flex; align-items:center; justify-content:center; gap:8px; }
button:disabled { opacity:.45; cursor:default; }
button.on { border-color:var(--accent); color:var(--accent); }
.primary { background:var(--accent); color:#06120b; border-color:var(--accent); font-weight:700; }
.warn { color:var(--warn); border-color:var(--warn); }
label.file input { display:none; }
input[type=text] { width:100%; min-width:0; }
.mono { font:12px ui-monospace, Menlo, Consolas, monospace; color:var(--dim); }
#err { color:var(--warn); font:12px ui-monospace, Menlo, Consolas, monospace; padding:0 16px; white-space:pre-wrap; }
.screen { max-width:520px; margin:0 auto; padding:calc(12px + var(--top)) 16px calc(24px + var(--bottom)); }
.screen { display:flex; flex-direction:column; gap:14px; }
header.top { display:flex; align-items:baseline; justify-content:space-between; gap:12px; flex-wrap:wrap; }
header.top h1 { margin:0; font-size:22px; }
header.top a { font-size:13px; }
header.top .links { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:4px 14px; }
header.sub { display:flex; align-items:center; gap:12px; }
header.sub h2 { margin:0; font-size:18px; }
h2 { margin:8px 0 0; font-size:17px; }
.big { padding:20px; font-size:20px; border-radius:16px; }
.row { display:grid; grid-template-columns:repeat(3, 1fr); gap:10px; }
.bar { display:flex; gap:8px; align-items:center; }
.box { background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:12px; display:flex; flex-direction:column; gap:8px; }
.box h2 { margin:0; font-size:15px; }
.box input[type=text] { background:var(--ground); }
.note { color:var(--warn); font-size:13px; min-height:1.2em; }
.status { color:var(--dim); font-size:13px; min-height:1.2em; }
.empty { color:var(--dim); font-size:14px; }
#cards { display:flex; flex-direction:column; gap:8px; }
.kept { display:flex; gap:12px; align-items:center; background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:10px; }
.kept { color:var(--text); text-decoration:none; }
.kept canvas { width:56px; height:56px; border-radius:10px; flex:none; }
.kept .title { font-weight:600; line-height:1.25; }
.kept .facts { font:12px ui-monospace, Menlo, Consolas, monospace; color:var(--dim); margin-top:3px; }
canvas.still { width:100%; height:auto; border-radius:12px; background:#000; display:block; }
#scan { position:fixed; inset:0; max-width:none; padding:0; margin:0; display:block; background:#000; }
#viewfinder { position:absolute; inset:0; }
#video, #box { position:absolute; inset:0; width:100%; height:100%; }
#video { object-fit:cover; background:#000; }
#scan .topbar { position:absolute; top:calc(8px + var(--top)); left:12px; right:12px; display:flex; justify-content:space-between; gap:8px; }
#scan .topbar button, #scan .topbar .button { background:rgba(11,14,19,.78); }
#zoomRow { position:absolute; top:calc(62px + var(--top)); left:12px; right:12px; display:flex; align-items:center; gap:8px; }
#zoomRow { background:rgba(11,14,19,.78); border-radius:12px; padding:8px 10px; }
#zoomRow input[type=range] { flex:1; min-width:0; }
#zoomRow button { padding:6px 10px; font-size:13px; min-height:44px; }
#cameraHelp { position:absolute; left:16px; right:16px; top:50%; transform:translateY(-50%); display:flex; flex-direction:column; gap:12px; max-width:420px; margin:0 auto; }
#cameraHelp .message { margin:0 0 8px; font-size:19px; line-height:1.4; text-align:center; color:var(--text); }
#cameraHelp .button { min-height:56px; font-size:19px; }
#viewfinder { touch-action:none; }
#scan .tools { flex-wrap:wrap; justify-content:space-between; }
label.check { display:inline-flex; align-items:center; gap:8px; min-height:44px; padding:0 6px; cursor:pointer; }
label.check input { width:22px; height:22px; margin:0; accent-color:var(--accent); }
#readerfail { display:flex; flex-direction:column; gap:10px; }
#readerfail .failtext { margin:0; color:var(--warn); font-size:16px; }
#readerfail .retry { min-height:48px; }
#scan .sheet { position:absolute; left:0; right:0; bottom:0; max-height:64%; overflow:auto; background:rgba(11,14,19,.94); border-top:1px solid var(--line); }
#scan .sheet { border-radius:18px 18px 0 0; padding:12px 16px calc(16px + var(--bottom)); display:flex; flex-direction:column; gap:10px; }
#preview { display:flex; flex-direction:column; gap:10px; }
#preview .facing { display:flex; gap:12px; align-items:stretch; }
#preview canvas.cardcanvas { width:140px; height:196px; border-radius:10px; flex:none; box-shadow:0 8px 24px rgba(0,0,0,.5); }
#preview .side { display:flex; flex-direction:column; gap:8px; flex:1; min-width:0; }
#preview .badge { display:flex; flex-direction:column; gap:4px; }
#preview .badge canvas { width:100%; max-width:200px; height:auto; border-radius:8px; display:block; }
#preview .via { color:var(--accent); font-size:13px; }
#card .firstseen { color:var(--dim); font-size:13px; padding:4px 0; }
#card .unique summary { display:inline-block; cursor:pointer; list-style:none; padding:2px 10px; border-radius:11px; }
#card .unique summary { background:var(--accent); color:var(--ground); font-size:13px; font-weight:700; }
#card .unique p { color:var(--dim); font-size:13px; margin:6px 0 0; }
#card .firstseen.first { color:var(--accent); font-weight:600; }
#preview details { font-size:13px; color:var(--dim); }
#preview details canvas { width:100%; height:auto; display:block; border-radius:6px; margin-top:6px; }
#preview.noframes .badge, #preview.noframes details { display:none; }
#catches { display:flex; flex-direction:column; gap:8px; }
#catches > .head { display:flex; align-items:center; justify-content:space-between; gap:10px; }
#catches .keepall { min-height:44px; }
#catches .clearall, #catches .keepselected, #catches .debugmode { min-height:44px; }
#catches .debugmode[aria-pressed="true"] { border-color:var(--accent); color:var(--accent); }
#catches .keeps { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
#catches .rows { display:flex; flex-direction:column; gap:6px; }
.catch { min-height:48px; background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:6px 6px 6px 10px; cursor:pointer; }
.catch { display:grid; grid-template-columns:40px minmax(0, 1fr) 44px; column-gap:10px; row-gap:2px; align-items:center; }
.catch .head { grid-column:2; grid-row:1; display:flex; align-items:baseline; justify-content:space-between; gap:8px; }
.catch .facts { grid-column:2; grid-row:2; }
.catch .debug { grid-column:2; grid-row:3; font:12px ui-monospace, Menlo, Consolas, monospace; color:var(--accent); word-break:break-all; }
.catch .debug .devline { margin:2px 0; }
.catch .debug .devrow { display:flex; flex-wrap:wrap; gap:6px; align-items:flex-end; margin:4px 0; }
.catch .debug .devswatch { width:38px; }
.catch .debug .devchip { height:22px; border:1px solid rgba(255,255,255,0.25); border-radius:3px; }
.catch .debug .devlabel { font-size:10px; text-align:center; opacity:0.8; margin-top:2px; }
.catch .debug .devnote { font-size:11px; opacity:0.8; align-self:center; }
#catches .devtools { display:flex; flex-direction:column; gap:8px; }
#catches .devsection { background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:8px 10px; }
#catches .devsection > summary { min-height:44px; display:flex; align-items:center; cursor:pointer; color:var(--accent); }
#catches .devsection > * { margin-top:6px; }
#catches .devsection .bar { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
#catches .devsection select { flex:1 1 140px; min-height:44px; background:var(--panel); color:inherit; border:1px solid var(--line); border-radius:8px; padding:0 8px; }
#catches .devsection button { min-height:44px; }
#catches .devpayload { width:100%; box-sizing:border-box; font:12px ui-monospace, Menlo, Consolas, monospace; background:var(--panel);
  color:inherit; border:1px solid var(--line); border-radius:8px; padding:8px; resize:vertical; }
#catches .devsection .devnote, #catches .devsection .devlines { font:12px ui-monospace, Menlo, Consolas, monospace; color:var(--accent); word-break:break-word; }
#catches .devsection .devline { margin:2px 0; }
.catch canvas.thumb { grid-column:1; grid-row:1 / -1; width:40px; height:40px; border-radius:8px; display:block; }
.catch .remove { grid-column:3; grid-row:1 / -1; width:44px; height:44px; padding:0; font-size:22px; line-height:1; }
.catch.selected { border-color:var(--accent); box-shadow:inset 0 0 0 1px var(--accent); }
.catch.fresh { animation:rowin .45s ease-out; }
.catch.shake { animation:rowshake .45s ease-in-out; }
@keyframes rowin { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:none; } }
@keyframes rowshake { 0%, 100% { transform:none; } 20% { transform:translateX(-7px); } 40% { transform:translateX(6px); }
60% { transform:translateX(-4px); } 80% { transform:translateX(3px); } }
@media (prefers-reduced-motion: reduce) { .catch.fresh, .catch.shake { animation:none; } }
.catch .title { font-weight:600; line-height:1.25; min-width:0; overflow-wrap:anywhere; }
.catch .time, .catch .facts { font:12px ui-monospace, Menlo, Consolas, monospace; color:var(--dim); }
.catch .time { flex:none; }
#card canvas.cardcanvas { width:min(100%, 360px); height:auto; border-radius:16px; display:block; margin:0 auto; box-shadow:0 10px 30px rgba(0,0,0,.5); }
.copyline { display:flex; gap:8px; align-items:center; }
.copyline code { flex:1; font:14px ui-monospace, Menlo, Consolas, monospace; word-break:break-word; }
.copyline button { padding:6px 12px; font-size:13px; min-height:44px; }
.actions { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.facts { font:13px ui-monospace, Menlo, Consolas, monospace; color:var(--dim); word-break:break-word; }
.confirm { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.stage { position:relative; touch-action:pan-y; }
.stage canvas.marks { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
.photonav { justify-content:space-between; }
.photonav button { min-width:104px; }
.photonav .counter { font-size:15px; color:var(--text); }
.stilltools input[type=range] { flex:1; min-width:0; height:44px; accent-color:var(--accent); }
.stilltools .zoomline { flex:none; min-width:8em; text-align:right; }
#leave { position:fixed; left:12px; right:12px; top:calc(12px + var(--top)); z-index:20; max-width:480px; margin:0 auto; }
#leave { background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:14px; display:flex; flex-direction:column; gap:10px; }
#leave { box-shadow:0 12px 30px rgba(0,0,0,.6); font-size:17px; }
#leave .bar button { flex:1; min-height:48px; }
.runbadge { position:absolute; left:12px; bottom:12px; z-index:15; display:flex; flex-direction:column; align-items:flex-start; gap:4px; }
.runbadge-name { min-height:28px; padding:3px 10px; border-radius:999px; border:1px solid var(--line); background:rgba(11,14,19,.78); }
.runbadge-name { color:var(--text); font:12px ui-monospace, Menlo, Consolas, monospace; letter-spacing:.04em; cursor:pointer; }
.runbadge-line { max-width:min(92vw, 420px); padding:4px 8px; border-radius:8px; border:1px solid var(--line); background:rgba(11,14,19,.9); }
.runbadge-line { color:var(--dim); font:11px ui-monospace, Menlo, Consolas, monospace; overflow-wrap:anywhere; }
.diag-button { position:fixed; right:10px; bottom:10px; z-index:200; min-height:32px; padding:4px 10px; border-radius:6px; border:1px solid var(--line); }
.diag-button { background:rgba(11,14,19,.85); color:var(--dim); font:11px ui-monospace, Menlo, Consolas, monospace; letter-spacing:.08em; }
.diag-button-err { color:#f87171; border-color:#f87171; }
.diag-overlay { position:fixed; inset:0; z-index:300; overflow:auto; background:rgba(11,14,19,.97); color:#cbd5e1; padding:10px 12px; }
.diag-overlay { font:11px/1.5 ui-monospace, Menlo, Consolas, monospace; }
.diag-bar { position:sticky; top:0; display:flex; gap:8px; margin-bottom:6px; }
.diag-bar button { min-height:44px; padding:2px 14px; border:0; border-radius:4px; font:12px ui-monospace, Menlo, Consolas, monospace; }
.diag-close { background:#f87171; color:#200; }
.diag-copy { background:#e2e8f0; color:#200; }
.diag-text { white-space:pre-wrap; overflow-wrap:anywhere; }
.diag-err { color:#f87171; }
.diag-warn { color:#fbbf24; }
