/* Same look as TCG Speed Shipper: cream page, dark green accent, dark top bar, serif text, mono labels. Own copy, no imports. */
:root {
  --bg: #f7f5f0; --bg-warm: #efeade; --surface: #fff; --border: #e4e0d8; --border-mid: #ccc7bb;
  --text: #1c1b18; --text-secondary: #4a473e; --muted: #5f5c53; --hint: #716d64;
  --accent: #2d6a4f; --accent-light: #40916c; --accent-bg: #edf7f1; --accent-border: #b7e4c7;
  --warn-bg: #fff6dd; --warn-border: #e2c46b; --danger: #9b2c2c;
  --radius: 12px; --radius-sm: 8px; --radius-xs: 5px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.07), 0 1px 4px rgba(0,0,0,.04);
  --nav-h: 52px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
button, select, input, label, summary { touch-action: manipulation; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--text); font: 16px/1.45 'Source Serif 4', Georgia, serif; -webkit-font-smoothing: antialiased; padding-bottom: 92px; }
.top-nav { position: sticky; top: 0; z-index: 300; background: var(--text); display: flex; align-items: stretch; height: calc(var(--nav-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); box-shadow: 0 2px 12px rgba(0,0,0,.3); }
.nav-brand { display: flex; align-items: center; padding: 0 16px; font: 15px 'DM Serif Display', Georgia, serif; color: #fff; white-space: nowrap; letter-spacing: -.02em; border-right: 1px solid rgba(255,255,255,.08); }
.nav-tabs { display: flex; flex: 1; }
.nav-tab { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; background: none; border: none; border-bottom: 2px solid transparent; border-radius: 0; min-height: 0; color: rgba(255,255,255,.7); font: 500 12px 'JetBrains Mono', ui-monospace, monospace; text-transform: uppercase; letter-spacing: .02em; padding: 0 6px; cursor: pointer; transition: color .2s, border-color .2s; }
.nav-tab:hover { color: #fff; }
.nav-tab.active { color: #fff; border-bottom-color: var(--accent-light); }
.nav-tab span { background: var(--accent); color: #fff; border-radius: 99px; padding: 0 7px; font-size: 11px; }
@media (max-width: 520px) { .nav-brand { padding: 0 8px; font-size: 12px; } .nav-tab { font-size: 9px; padding: 0 2px; } }
main { max-width: 760px; margin: 0 auto; padding: 14px max(16px, env(safe-area-inset-right)) 14px max(16px, env(safe-area-inset-left)); display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.tab { display: grid; gap: 12px; }
.tab[hidden] { display: none; }
h2 { font: 20px 'DM Serif Display', Georgia, serif; margin: 0 0 8px; font-weight: 400; }
.muted { color: var(--muted); margin: 2px 0 8px; }
.notice { background: var(--warn-bg); border: 1px solid var(--warn-border); border-radius: var(--radius); padding: 10px 12px; margin: 0; font-size: .92rem; }
details.notice > summary { cursor: pointer; min-height: 24px; }
details.notice > p { margin: 8px 0 0; }
.credit { color: var(--muted); font-size: .9rem; margin: 0; }
.credit a { color: var(--accent); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 14px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.wide { grid-column: 1 / -1; }
label { display: grid; gap: 4px; min-width: 0; font: 500 11px 'JetBrains Mono', ui-monospace, monospace; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.check { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; color: var(--text); text-transform: none; font: 15px 'Source Serif 4', serif; letter-spacing: 0; }
.check input { width: 24px; height: 24px; flex: none; min-height: 0; }
/* 16px or more: iPhone/iPad Safari zooms the page when a smaller field is tapped */
input, select, button, textarea { font: 16px 'Source Serif 4', Georgia, serif; min-height: 48px; border-radius: var(--radius-sm); border: 1px solid var(--border-mid); padding: 8px 12px; background: #fff; color: var(--text); text-transform: none; letter-spacing: 0; }
label input, label select, input[type=search] { width: 100%; min-width: 0; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(45,106,79,.15); }
button { cursor: pointer; font-weight: 600; }
.btn-dl { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: linear-gradient(135deg, #2d6a4f 0%, #1b4332 100%); color: #fff; border: none; padding: 10px 22px; box-shadow: 0 3px 10px rgba(45,106,79,.3); transition: transform .15s, box-shadow .15s; }
.btn-dl:hover { transform: translateY(-1px); box-shadow: 0 5px 16px rgba(45,106,79,.35); }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border-mid); min-height: 44px; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
:focus-visible { outline: 3px solid #1b4d37; outline-offset: 2px; }
.btn-row, .row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.upload-zone { display: grid; gap: 2px; justify-items: center; text-align: center; padding: 18px 12px; border: 2px dashed var(--border-mid); border-radius: var(--radius); background: var(--bg); cursor: pointer; font: 15px 'Source Serif 4', serif; text-transform: none; letter-spacing: 0; color: var(--text-secondary); transition: border-color .2s, background .2s; }
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); background: var(--accent-bg); }
.upload-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; min-height: 0; padding: 0; }
.upload-zone:focus-within { outline: 3px solid #1b4d37; outline-offset: 2px; }
.upload-zone small { color: var(--hint); }
.stage { position: relative; }
.stage video, .stage img { display: block; width: 100%; max-height: 52vh; object-fit: contain; background: #000; border-radius: var(--radius); margin: 8px 0; }
.stage canvas { position: absolute; left: 0; top: 8px; width: 100%; height: calc(100% - 16px); pointer-events: none; }
.stage [hidden] { display: none; }
.list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; display: grid; gap: 6px; background: var(--surface-raised, #fafaf8); }
.item .title { font-weight: 600; }
.item .meta { color: var(--muted); font: 500 12px 'JetBrains Mono', ui-monospace, monospace; }
.item .controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.item .controls button { min-width: 48px; }
.item .controls input { width: 6rem; }
.price { font: 600 16px 'JetBrains Mono', ui-monospace, monospace; color: var(--accent); }
.status { min-height: 1.4em; margin: 6px 0 0; color: var(--muted); }
.row-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.bar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); padding: 10px max(16px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); display: flex; justify-content: space-between; align-items: center; gap: 12px; box-shadow: 0 -4px 12px rgba(0,0,0,.05); }
.bar > div { font: 600 13px 'JetBrains Mono', ui-monospace, monospace; }
.danger { color: var(--danger); }
.thumbs { display: grid; gap: 6px; }
textarea { font: 16px 'JetBrains Mono', ui-monospace, monospace; width: 100%; border: 1px solid var(--border-mid); border-radius: var(--radius-sm); padding: 10px 12px; }
textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(45,106,79,.15); }

.update-bar { position: fixed; left: 0; right: 0; top: env(safe-area-inset-top); z-index: 400; display: flex; gap: 10px; align-items: center; justify-content: center; padding: 8px 16px; background: var(--accent-bg); border-bottom: 1px solid var(--accent-border); font-weight: 600; }
.update-bar[hidden] { display: none; }
.ok { color: var(--accent); font-weight: 600; }
.bulk { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; margin: 8px 0; background: var(--bg); }
.pick { display: flex; align-items: center; gap: 10px; font: 16px 'Source Serif 4', serif; text-transform: none; letter-spacing: 0; color: var(--text); }
.pick input { width: 28px; height: 28px; min-height: 0; flex: none; }
.item.chosen { border-color: var(--accent); background: var(--accent-bg); }
.cand-pic { width: 60px; height: 84px; object-fit: contain; border-radius: 4px; background: #0001; }
/* The Add tab leads with the scan; settings and help fold away with a one-line summary. */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.scan-card .btn-row { margin-top: 4px; }
.scan-card #camStart { flex: 1 1 auto; min-height: 52px; font-size: 17px; }
.link-btn { background: none; border: none; min-height: 44px; padding: 0; color: var(--accent); text-decoration: underline; font-weight: 500; text-align: left; }
.dev-line { margin: 4px 0 0; }
details.fold > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-height: 28px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: 'Change'; margin-left: auto; color: var(--accent); font: 600 14px 'Source Serif 4', Georgia, serif; text-decoration: underline; }
details.fold[open] > summary::after { content: 'Done'; }
details#trouble > summary::after { content: 'Open'; }
details#trouble[open] > summary::after { content: 'Close'; }
.fold-title { font: 20px 'DM Serif Display', Georgia, serif; }
.fold-sum { color: var(--muted); font-size: .95rem; flex-basis: 100%; }
details.fold[open] > .muted { margin-top: 8px; }
.page-notes { display: grid; gap: 10px; margin-top: 8px; }
.scan-card #camShot:disabled, .scan-card #camStop:disabled { display: none; }
