:root {
  color-scheme: dark;
  --background: #0d0f13;
  --surface: #14171d;
  --surface-raised: #181c23;
  --line: #1e232c;
  --line-strong: #2b323d;
  --text: #e7eaf0;
  --text-secondary: #98a1b0;
  --text-dim: #6d7686;
  --text-faint: #525b6a;
  --accent: #f0a92e;
  --accepted: #6fc292;
  --accepted-deep: #4a9d6e;
  --ambiguous: #e8b45c;
  --refused: #e0796a;
  --radius-chip: 5px;
  --radius-control: 8px;
  --radius-row: 11px;
  --radius-panel: 13px;
  --page-width: 760px;
  font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  min-width: 0;
  height: 100%;
  height: 100dvh;
  margin: 0;
  overscroll-behavior: none;
  touch-action: pan-x pan-y;
}

body {
  background: var(--background);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select {
  color: inherit;
  font: inherit;
}

button,
a,
input,
select,
summary { outline: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Containers that clip (segmented pills, settings groups, disclosure panels) would
   swallow an outset ring entirely — draw it inside the control there instead. */
.segmented button:focus-visible,
.advanced-settings > summary:focus-visible,
.boot-log summary:focus-visible,
.settings-list .settings-row input[type="checkbox"]:focus-visible {
  outline-offset: -2px;
}

button { min-width: 44px; min-height: 44px; }
button:not(:disabled), summary { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }

img { display: block; max-width: 100%; }
h1, h2, p { margin: 0; }

.mono,
select,
input[type="search"],
.verdict-badge {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

[hidden],
.route[hidden],
#liveView[hidden] { display: none !important; }

#app-shell,
.route {
  width: 100%;
  height: 100%;
  height: 100dvh;
  min-height: 0;
}

#app-shell { position: relative; overflow: hidden; }

.route {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.pipeline-controls { display: none !important; }

.brand-mark,
.account-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 13px;
  background: var(--accent);
  color: #12141a;
  font: 700 19px "IBM Plex Mono", monospace;
}

.primary-button,
.secondary-button,
.resolve-button {
  min-height: 48px;
  padding: 13px 16px;
  border-radius: var(--radius-row);
  font-size: 13.5px;
  font-weight: 600;
}

.primary-button { border: 1px solid var(--accent); background: var(--accent); color: #12141a; }
.primary-button:disabled { border-color: #1c212a; background: #1c212a; color: var(--text-faint); opacity: 1; }
.secondary-button { border: 1px solid var(--line-strong); background: transparent; color: var(--text-secondary); font-weight: 500; }
.resolve-button { border: 1px solid color-mix(in srgb, var(--ambiguous) 42%, transparent); background: color-mix(in srgb, var(--ambiguous) 13%, transparent); color: var(--ambiguous); }
.ghost-button {
  align-self: flex-start;
  min-height: 36px;
  padding: 6px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: none;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
}

.accent-text { color: var(--accent); }
.accepted-text { color: var(--accepted) !important; }
.ambiguous-text { color: var(--ambiguous) !important; }
.refused-text { color: var(--refused) !important; }

.progress-track {
  display: block;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.progress-track > i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 180ms ease;
}

/* Boot */
.boot-view {
  display: flex;
  flex-direction: column;
  justify-content: safe center;
  gap: 26px;
  max-width: 540px;
  margin: 0 auto;
  padding: max(32px, env(safe-area-inset-top)) 26px max(32px, env(safe-area-inset-bottom));
  overflow-y: auto;
}

.boot-copy { display: flex; flex-direction: column; gap: 11px; }
.boot-copy h1 { max-width: 16ch; font-size: clamp(23px, 6vw, 32px); line-height: 1.15; letter-spacing: -.025em; text-wrap: balance; }
.boot-copy p { color: var(--text-secondary); font-size: 13px; line-height: 1.65; text-wrap: pretty; }
.boot-meter { display: flex; flex-direction: column; gap: 13px; }
.boot-numbers { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.boot-numbers strong { color: var(--accent); font-size: 30px; letter-spacing: -.03em; }
.boot-numbers span { color: var(--text-dim); font-size: 11px; text-align: right; }
.boot-stages {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid #1a1e26;
  border-radius: 10px;
  background: #1a1e26;
}
.boot-stages:empty { display: none; }
.boot-stages li {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) minmax(0, auto);
  gap: 4px 10px;
  align-items: center;
  padding: 9px 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
}
.boot-stages li > span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.boot-stages li::before { content: "·"; grid-row: 1; color: var(--accent); font: 600 10px "IBM Plex Mono", monospace; }
.boot-stages li.done::before { content: "✓"; color: var(--accepted); }
.boot-stages li.fail::before { content: "✕"; color: var(--refused); }
.boot-stages .size { max-width: 190px; overflow: hidden; color: var(--text-faint); font: 400 10.5px "IBM Plex Mono", monospace; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.boot-stages li.fail .size { color: var(--refused); }
.boot-stages .bar { grid-column: 2 / -1; height: 3px; overflow: hidden; border-radius: 999px; background: var(--line); }
.boot-stages .bar i { display: block; width: 0; height: 100%; background: var(--accent); }
.boot-stages li.done .bar, .boot-stages li.fail .bar { display: none; }
.boot-log { border: 1px solid var(--line); border-radius: 10px; background: #101319; overflow: hidden; }
.boot-log summary { min-height: 40px; padding: 10px 13px; color: var(--text-faint); font-size: 11.5px; }
.boot-log pre { max-height: 140px; overflow: auto; margin: 0; padding: 10px 12px; border-top: 1px solid var(--line); color: var(--text-dim); font: 10px/1.55 "IBM Plex Mono", monospace; white-space: pre-wrap; }
.boot-log pre.err { color: var(--refused); }

/* Scanner */
.scanner-view { overflow: hidden; background: #07090c; }
.camera-surface { position: relative; width: 100%; height: 100%; overflow: hidden; background: #07090c; }
.camera-fallback { position: absolute; inset: 0; background: repeating-linear-gradient(122deg, #0f1319, #0f1319 9px, #12171e 9px, #12171e 18px); }
.camera-fallback::after { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 70% at 50% 42%, transparent 30%, rgba(5, 7, 10, .84) 100%); }
#liveView { position: absolute; inset: 0; z-index: 1; background: #07090c; }
#liveCanvas { width: 100%; height: 100%; display: block; object-fit: cover; }
.camera-topbar { position: absolute; z-index: 8; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: max(14px, calc(env(safe-area-inset-top) + 8px)) 16px 0; pointer-events: none; }
.camera-topbar > * { pointer-events: auto; }
.camera-status { display: inline-flex; align-items: center; gap: 7px; min-width: 0; flex: 0 1 auto; min-height: 32px; padding: 6px 11px; border: 1px solid var(--line-strong); border-radius: 999px; background: rgba(13, 15, 19, .72); color: var(--text-secondary); font-size: 10.5px; font-weight: 500; backdrop-filter: blur(10px); }
.camera-status > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-dot { width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--accepted); }
.live-dot.is-live { background: var(--accent); animation: pulse 2.2s infinite; }
.live-dot.is-ok { background: var(--accepted); }
.live-dot.is-warning { background: var(--ambiguous); }
.live-dot.is-error { background: var(--refused); }
.topbar-actions { display: flex; flex: none; gap: 8px; }
.floating-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: rgba(13, 15, 19, .72);
  color: var(--text-secondary);
  backdrop-filter: blur(10px);
}
.floating-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.floating-icon.active { color: #12141a; background: var(--accent); border-color: var(--accent); }

.reticle-wrap { position: absolute; z-index: 4; inset: 0; display: grid; place-items: center; padding: 60px 20px 150px; pointer-events: none; }
.reticle-stack { position: relative; width: min(61vw, 240px); max-height: calc(100vh - 250px); aspect-ratio: 5/7; }
.camera-reticle { position: relative; width: 100%; height: 100%; overflow: hidden; border: 1px solid rgba(240, 169, 46, .1); border-radius: 12px; background: transparent; transition: border-color 180ms ease, background-color 180ms ease; }
.camera-reticle[data-state="reading"] { border-color: rgba(240, 169, 46, .22); background: rgba(240, 169, 46, .05); }
.camera-reticle[data-state="accepted"] { border-color: color-mix(in srgb, var(--accepted) 55%, transparent); }
.camera-reticle[data-state="ambiguous"] { border-color: color-mix(in srgb, var(--ambiguous) 60%, transparent); }
.camera-reticle[data-state="refused"], .camera-reticle[data-state="error"] { border-color: color-mix(in srgb, var(--refused) 60%, transparent); }
.corner { position: absolute; width: 26px; height: 26px; border-color: rgba(240, 169, 46, .55); border-style: solid; transition: border-color 180ms ease; }
.camera-reticle[data-state="reading"] .corner { border-color: var(--accent); }
.camera-reticle[data-state="accepted"] .corner { border-color: var(--accepted); }
.camera-reticle[data-state="ambiguous"] .corner { border-color: var(--ambiguous); }
.camera-reticle[data-state="refused"] .corner, .camera-reticle[data-state="error"] .corner { border-color: var(--refused); }
.corner.top-left { top: -2px; left: -2px; border-width: 2.5px 0 0 2.5px; border-radius: 10px 0 0; }
.corner.top-right { top: -2px; right: -2px; border-width: 2.5px 2.5px 0 0; border-radius: 0 10px 0 0; }
.corner.bottom-left { bottom: -2px; left: -2px; border-width: 0 0 2.5px 2.5px; border-radius: 0 0 0 10px; }
.corner.bottom-right { right: -2px; bottom: -2px; border-width: 0 2.5px 2.5px 0; border-radius: 0 0 10px; }
.reading-sweep { position: absolute; left: 0; right: 0; top: 0; height: 9%; background: linear-gradient(180deg, transparent, rgba(240, 169, 46, .5)); animation: sweep 1.5s linear infinite; }

.latest-scan { position: absolute; left: -8px; right: -8px; top: 100%; margin-top: 14px; height: 64px; overflow: hidden; padding: 10px 13px; border: 1px solid var(--line-strong); border-radius: 13px; background: rgba(13, 15, 19, .93); box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .9); backdrop-filter: blur(14px); animation: rise 220ms ease-out; pointer-events: auto; }
.latest-scan > div { display: flex; align-items: center; gap: 9px; height: 20px; min-width: 0; }
.latest-scan > div + div { margin-top: 4px; gap: 7px; }
.latest-scan strong { min-width: 0; flex: 1; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.latest-scan strong.dim { color: var(--text-dim); }
.latest-scan b { flex: none; color: var(--accent); font-size: 13px; }
.latest-scan #latest-sub { min-width: 0; flex: 1; overflow: hidden; color: var(--text-dim); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.latest-scan button { min-height: 24px; min-width: auto; flex: none; padding: 2px 9px; border: 1px solid color-mix(in srgb, var(--ambiguous) 40%, transparent); border-radius: 6px; background: color-mix(in srgb, var(--ambiguous) 12%, transparent); color: var(--ambiguous); font-size: 10px; font-weight: 600; }
.verdict-dot { display: inline-block; width: 7px; height: 7px; flex: none; border-radius: 50%; background: #3f4753; }
.verdict-dot.accepted, .latest-scan.accepted .verdict-dot { background: var(--accepted); }
.verdict-dot.ambiguous, .latest-scan.ambiguous .verdict-dot { background: var(--ambiguous); }
.verdict-dot.refused, .latest-scan.refused .verdict-dot { background: var(--refused); }

.history-rail { position: absolute; z-index: 6; left: 16px; bottom: max(20px, calc(env(safe-area-inset-bottom) + 12px)); display: flex; flex-direction: column; gap: 5px; width: min(206px, calc(100% - 110px)); }
.history-chip { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 4px 10px; border: 1px solid #232833; border-radius: 9px; background: rgba(13, 15, 19, .72); backdrop-filter: blur(10px); text-align: left; }
.history-chip > span { flex: 1; min-width: 0; overflow: hidden; color: var(--text); font-size: 11.5px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.history-chip > b { flex: none; color: var(--text-secondary); font: 500 10.5px "IBM Plex Mono", monospace; }
.history-chip .verdict-dot { width: 6px; height: 6px; }

.scan-rail { position: absolute; z-index: 8; right: 13px; bottom: max(20px, calc(env(safe-area-inset-bottom) + 12px)); display: flex; flex-direction: column; gap: 8px; align-items: center; }
.shutter { display: grid; place-items: center; width: 52px; height: 52px; min-width: 52px; padding: 0; border: none; border-radius: 50%; background: var(--text); color: #12141a; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .95); }
.shutter.is-running { background: var(--refused); color: #12141a; }
.rail-square { display: grid; place-items: center; width: 46px; height: 46px; min-width: 46px; padding: 0; border: 1px solid var(--line-strong); border-radius: 14px; background: rgba(20, 23, 29, .82); backdrop-filter: blur(12px); }
.cards-glyph { display: block; width: 12px; height: 16px; border: 1.5px solid var(--text-secondary); border-radius: 2.5px; box-shadow: 4px -4px 0 -1px var(--text-faint); }
.tally-tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; width: 58px; padding: 9px 4px; border: 1px solid var(--line-strong); border-radius: 16px; background: rgba(20, 23, 29, .9); backdrop-filter: blur(12px); }
.tally-tile > b { color: var(--text); font-size: 17px; font-weight: 600; letter-spacing: -.03em; }
.tally-tile > small { color: var(--text-faint); font-size: 8px; font-weight: 500; letter-spacing: .1em; }
.tally-tile > i { display: block; width: 26px; height: 1px; margin: 4px 0; background: var(--line-strong); }
.tally-tile > em { color: var(--accent); font-size: 11px; font-style: normal; font-weight: 600; letter-spacing: -.02em; }
.fix-badge { position: absolute; top: -6px; left: -6px; display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border: 2px solid #0d0f13; border-radius: 11px; background: var(--ambiguous); color: #20180a; font-size: 11px; font-weight: 700; }

/* Shared page shell */
.page-view { display: flex; flex-direction: column; min-height: 0; max-width: var(--page-width); margin: 0 auto; background: var(--background); }
.scanner-view.camera-background { position: absolute; z-index: 0; inset: 0; }
.scanner-view.camera-background .camera-topbar,
.scanner-view.camera-background .reticle-wrap,
.scanner-view.camera-background .history-rail,
.scanner-view.camera-background .scan-rail { visibility: hidden; pointer-events: none; }
.page-view.camera-overlay { position: absolute; z-index: 10; inset: 0; width: 100%; height: 100%; background: rgba(13, 15, 19, .96); }
.page-view.camera-overlay .page-header { background: rgba(13, 15, 19, .96); backdrop-filter: blur(14px); }
.page-view.camera-overlay > .scroll-body { background: rgba(13, 15, 19, .96); }
.page-header { display: flex; flex: none; align-items: center; gap: 12px; min-height: 72px; padding: max(16px, calc(env(safe-area-inset-top) + 10px)) 18px 12px; border-bottom: 1px solid var(--line); background: var(--background); }
.page-header h1 { font-size: 17px; letter-spacing: -.01em; }
.page-header p { color: var(--text-dim); font-size: 11px; }
.page-header:not(.stacked) > div { min-width: 0; flex: 1; }
.page-header.stacked { flex-direction: column; align-items: stretch; gap: 13px; }
.header-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.header-row > div { min-width: 0; flex: 1; }
.back-button { width: 44px; min-width: 44px; padding: 0; border: 0; background: none; color: var(--text-secondary); font: 400 18px "IBM Plex Mono", monospace; }
.scroll-body { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-color: var(--line-strong) transparent; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.sticky-actions { display: flex; flex: none; flex-direction: column; gap: 9px; padding: 12px 16px max(16px, calc(env(safe-area-inset-bottom) + 10px)); border-top: 1px solid var(--line); background: #101319; }
.sticky-actions.horizontal { flex-direction: row; }
.sticky-actions.horizontal .primary-button { flex: 1; }
.sticky-actions.horizontal .secondary-button { flex: none; padding-inline: 15px; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; grid-column: 1/-1; padding: 70px 28px; color: var(--text-dim); text-align: center; }
.empty-state h2 { color: var(--text-secondary); font-size: 14px; font-weight: 500; }
.empty-state p { max-width: 42ch; font-size: 12.5px; line-height: 1.6; }
.empty-inline { color: var(--text-dim); font-size: 12px; }

/* Segmented controls */
.segmented { display: inline-flex; gap: 1px; overflow: hidden; border-radius: 9px; background: var(--line); }
.segmented button { min-height: 36px; min-width: 0; padding: 8px 12px; border: 0; background: var(--surface); color: var(--text-dim); font-size: 12px; font-weight: 500; }
.segmented button.active { background: var(--line-strong); color: var(--text); }
.segmented.wide { display: flex; }
.segmented.wide button { flex: 1; }

/* Tray */
#tray-value { font-size: 17px; font-weight: 600; }
.scan-list { display: flex; flex-direction: column; }
.scan-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 76px; padding: 11px 18px; border: 0; border-bottom: 1px solid #171b22; background: none; text-align: left; }
.card-thumb { width: 38px; height: 53px; flex: none; border: 1px solid #262c38; border-radius: var(--radius-chip); background: repeating-linear-gradient(135deg, #171b22, #171b22 5px, #1e232c 5px, #1e232c 10px) center/cover; }
.card-thumb.has-image { background-position: center; background-size: cover; }
.row-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 4px; }
.row-title { display: flex; align-items: center; gap: 7px; overflow: hidden; font-size: 14px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { overflow: hidden; color: var(--text-dim); font: 400 11px "IBM Plex Mono", monospace; text-overflow: ellipsis; white-space: nowrap; }
.row-value { display: flex; flex: none; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 13px; font-weight: 500; }
.row-value small { color: var(--text-faint); font-size: 10px; font-weight: 400; }

/* Resolver */
.resolver-header h1 { overflow: hidden; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.resolver-header p { display: flex; align-items: center; gap: 8px; margin-top: 5px; }
.verdict-badge { display: inline-flex; align-items: center; min-height: 22px; padding: 3px 8px; border-radius: 6px; font-size: 10px; font-weight: 600; letter-spacing: .07em; }
.verdict-badge.accepted { background: color-mix(in srgb, var(--accepted) 15%, transparent); color: var(--accepted); }
.verdict-badge.ambiguous { background: color-mix(in srgb, var(--ambiguous) 16%, transparent); color: var(--ambiguous); }
.verdict-badge.refused { background: color-mix(in srgb, var(--refused) 16%, transparent); color: var(--refused); }
.resolver-body { display: flex; flex-direction: column; gap: 16px; padding: 16px 0 18px; }
.crop-panel { display: flex; flex-direction: column; gap: 8px; margin: 0 18px; padding: 11px; border: 1px solid #212630; border-radius: 13px; background: var(--surface); }
.crop-window { position: relative; display: block; height: 104px; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 9px; background: repeating-linear-gradient(118deg, #12161c, #12161c 8px, #191e26 8px, #191e26 16px); }
.crop-window img { position: absolute; left: 0; bottom: 0; width: 100%; height: auto; }
.crop-fallback { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-faint); font-size: 9.5px; }
.crop-tag { position: absolute; left: 8px; top: 7px; padding: 2px 7px; border-radius: 5px; background: rgba(13, 15, 19, .82); color: var(--text-secondary); font-size: 8.5px; font-weight: 500; letter-spacing: .1em; }
.crop-panel p { color: var(--text-dim); font-size: 11px; line-height: 1.5; text-wrap: pretty; }
.rail-section { gap: 10px; }
.rail-label { padding: 0 18px; color: var(--text-faint); font-size: 9.5px; font-weight: 500; letter-spacing: .13em; text-transform: uppercase; }
.candidate-rail { display: flex; gap: 11px; padding: 4px 18px 8px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.candidate-rail .empty-inline { padding: 0; }
.printing-candidate { display: flex; width: 128px; min-width: 128px; flex: none; flex-direction: column; gap: 7px; padding: 10px; border: 1px solid #212630; border-radius: 13px; background: var(--surface); text-align: left; }
.printing-candidate.selected { border-color: rgba(240, 169, 46, .45); background: rgba(240, 169, 46, .09); }
.candidate-art { position: relative; display: block; width: 100%; aspect-ratio: 5/7; overflow: hidden; border: 1px solid #3a4250; border-radius: 8px; background: repeating-linear-gradient(135deg, #1b2029, #1b2029 6px, #232a34 6px, #232a34 12px); }
.candidate-art img { width: 100%; height: 100%; object-fit: cover; }
.printing-candidate > b { overflow: hidden; color: var(--text-secondary); font: 600 11.5px "IBM Plex Mono", monospace; text-overflow: ellipsis; white-space: nowrap; }
.printing-candidate.selected > b { color: var(--accent); }
.printing-candidate > span:not(.candidate-art) { overflow: hidden; color: var(--text-secondary); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.candidate-meta { display: flex; align-items: center; gap: 6px; }
.candidate-meta em { flex: 1; color: var(--text-secondary); font: 600 12.5px "IBM Plex Mono", monospace; font-style: normal; }
.printing-candidate.selected .candidate-meta em { color: var(--accent); }
.spread-panel { display: flex; flex-direction: column; gap: 6px; margin: 0 18px; padding: 11px 13px; border: 1px dashed #262c38; border-radius: var(--radius-row); background: #101319; }
.spread-panel > span { color: var(--text-faint); font-size: 10px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; }
.spread-panel p { color: var(--text-dim); font-size: 11.5px; line-height: 1.5; }
.text-button { align-self: flex-start; min-width: 0; min-height: 0; margin: 0 18px; padding: 0; border: 0; background: none; color: var(--text-dim); font-size: 12px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }

/* Collection */
.collection-header h1 { font-size: 21px; letter-spacing: -.02em; }
#collection-value { align-self: flex-end; font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.collection-tools { display: flex; align-items: center; gap: 9px; }
.collection-tools input { flex: 1; min-width: 0; min-height: 36px; padding: 7px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-control); background: var(--surface); font-size: 12px; }
.collection-tools .segmented { flex: none; }
.collection-tools .segmented button { min-height: 36px; padding: 6px 11px; font-size: 11px; }
.collection-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-content: start; gap: 10px; padding: 14px 18px max(28px, calc(env(safe-area-inset-bottom) + 16px)); }
.collection-card { display: flex; min-width: 0; flex-direction: column; gap: 6px; min-height: 0; padding: 0; border: 0; background: none; color: var(--text-secondary); text-align: left; }
.collection-card > span:last-child { width: 100%; overflow: hidden; font-size: 10.5px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.collection-art { position: relative; width: 100%; aspect-ratio: 5/7; overflow: hidden; border: 1px solid #262c38; border-radius: var(--radius-control); background: repeating-linear-gradient(135deg, #171b22, #171b22 5px, #1d232c 5px, #1d232c 10px); }
.collection-art img { width: 100%; height: 100%; object-fit: cover; }
.collection-art b { position: absolute; top: 5px; right: 5px; padding: 2px 6px; border: 1px solid #333b47; border-radius: var(--radius-chip); background: rgba(13, 15, 19, .9); color: var(--text); font-size: 9.5px; font-weight: 600; }
.collection-art .rarity-dot { position: absolute; bottom: 5px; left: 5px; width: 7px; height: 7px; }
.collection-ledger { display: flex; flex-direction: column; padding-bottom: max(28px, calc(env(safe-area-inset-bottom) + 16px)); }
.ledger-row { display: grid; grid-template-columns: 6px minmax(0, 1fr) 38px 26px 56px; align-items: center; gap: 11px; width: 100%; min-height: 46px; padding: 10px 18px; border: 0; border-bottom: 1px solid #171b22; background: none; text-align: left; }
.ledger-row > span { overflow: hidden; color: var(--text); font-size: 13px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.ledger-row small { overflow: hidden; color: var(--text-faint); font-size: 10.5px; text-align: right; }
.ledger-row small + small { color: var(--text-dim); }
.ledger-row strong { color: var(--text); font-size: 12px; font-weight: 500; text-align: right; }
.rarity-dot { width: 6px; height: 6px; flex: none; border-radius: 50%; background: #8d95a3; }
.rarity-dot.uncommon { background: #a9bcc9; }
.rarity-dot.rare { background: #d0a94a; }
.rarity-dot.mythic { background: #d2652f; }

/* Card detail */
.card-detail-scroll { padding-bottom: 24px; }
.card-hero { padding: max(16px, calc(env(safe-area-inset-top) + 10px)) 18px 20px; background: linear-gradient(180deg, #141920, var(--background)); }
.card-hero .back-button { display: block; margin-bottom: 14px; text-align: left; }
.card-overview { display: flex; gap: 15px; }
.card-overview img { width: 118px; aspect-ratio: 5/7; flex: none; border: 1px solid var(--line-strong); border-radius: 10px; background: repeating-linear-gradient(135deg, #171b22, #171b22 6px, #1d232c 6px, #1d232c 12px); object-fit: cover; }
.card-overview > div { display: flex; min-width: 0; flex: 1; flex-direction: column; align-items: flex-start; gap: 9px; padding-top: 2px; }
.card-overview h1 { font-size: 19px; line-height: 1.2; letter-spacing: -.02em; text-wrap: balance; }
.card-overview p { color: var(--text-secondary); font-size: 11px; }
.card-price-line { display: flex; align-items: baseline; gap: 9px; margin-top: 2px; }
.card-price-line strong { font-size: 22px; letter-spacing: -.02em; }
.card-price-line small { color: var(--text-dim); font-size: 11px; }
.card-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; border-block: 1px solid #1a1e26; background: #1a1e26; }
.card-stats span { display: flex; min-width: 0; flex-direction: column; gap: 4px; padding: 14px 12px; background: #111419; }
.card-stats b { overflow: hidden; font-size: 17px; font-weight: 600; letter-spacing: -.02em; text-overflow: ellipsis; white-space: nowrap; }
.card-stats small { color: var(--text-faint); font: 500 9px "IBM Plex Mono", monospace; letter-spacing: .11em; text-transform: uppercase; }
.card-sections { display: flex; flex-direction: column; gap: 18px; padding: 18px; }
.content-section { display: flex; flex-direction: column; gap: 9px; }
.content-section h2 { color: var(--text-faint); font: 500 9.5px "IBM Plex Mono", monospace; letter-spacing: .13em; text-transform: uppercase; }
.stack-list { display: flex; flex-direction: column; gap: 1px; overflow: hidden; border: 1px solid #1a1e26; border-radius: 10px; background: #1a1e26; }
.stack-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface); }
.stack-row > b { width: 40px; flex: none; color: var(--text-secondary); font: 600 11px "IBM Plex Mono", monospace; }
.stack-row > b.accent-text { color: var(--accent); }
.stack-row > span { flex: 1; min-width: 0; overflow: hidden; color: var(--text-secondary); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.stack-row > em { flex: none; color: var(--text); font: 500 11.5px "IBM Plex Mono", monospace; font-style: normal; }
.stack-row > em.dim { color: var(--text-dim); font-weight: 400; }
.stack-list .empty-inline { padding: 10px 12px; background: var(--surface); }
.stack-note { padding: 8px 12px; background: var(--surface); color: var(--text-faint); font: 400 10.5px "IBM Plex Mono", monospace; }
.external-card-link { display: flex; align-items: center; justify-content: space-between; padding: 13px 14px; border: 1px solid #262c38; border-radius: var(--radius-row); background: var(--surface); color: var(--text); text-decoration: none; }
.external-card-link span { display: flex; flex-direction: column; gap: 2px; }
.external-card-link strong { font-size: 13px; font-weight: 500; }
.external-card-link small { color: var(--text-dim); font-size: 10.5px; }
.external-card-link > b { color: var(--accent); font: 400 14px "IBM Plex Mono", monospace; }

/* Settings */
.inline-header h1 { font-size: 17px; }
.settings-body { display: flex; flex-direction: column; gap: 20px; padding: 16px 18px 30px; }
.settings-panel { display: flex; flex-direction: column; gap: 11px; padding: 14px; border: 1px solid #212630; border-radius: var(--radius-panel); background: var(--surface); }
.settings-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.settings-title h2 { margin: 0; color: var(--text); font-size: 12.5px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.settings-title span { color: var(--accepted); font: 400 10.5px "IBM Plex Mono", monospace; }
.index-track { height: 5px; }
.index-track > i { background: var(--accepted-deep); }
.settings-panel > p { color: var(--text-dim); font-size: 10.5px; line-height: 1.6; }
.settings-section { display: flex; flex-direction: column; gap: 9px; }
.settings-section h2 { color: var(--text-faint); font: 500 9.5px "IBM Plex Mono", monospace; letter-spacing: .13em; text-transform: uppercase; }
.settings-hint { color: var(--text-dim); font-size: 11px; line-height: 1.55; }
.backend-picker button { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 11.5px; }
.backend-picker button:disabled { color: #3f4753; opacity: 1; }
.backend-picker.switching button { cursor: progress; }
.settings-list { display: flex; flex: none; flex-direction: column; gap: 1px; overflow: hidden; border: 1px solid #1a1e26; border-radius: var(--radius-row); background: #1a1e26; }
.settings-row { display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 13px 14px; background: var(--surface); cursor: pointer; }
.settings-row > span { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 3px; }
.settings-row strong { font-size: 12.5px; font-weight: 500; }
.settings-row small { color: var(--text-dim); font-size: 10.5px; line-height: 1.5; text-wrap: pretty; }
.settings-row input[type="checkbox"] {
  appearance: none;
  position: relative;
  width: 40px;
  height: 23px;
  flex: none;
  margin: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #1a1e26;
  transition: background-color 160ms ease, border-color 160ms ease;
}
.settings-row input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--text-faint);
  transition: transform 160ms ease, background-color 160ms ease;
}
.settings-row input[type="checkbox"]:checked { border-color: var(--accent); background: rgba(240, 169, 46, .22); }
.settings-row input[type="checkbox"]:checked::before { background: var(--accent); transform: translateX(17px); }
.advanced-settings { overflow: hidden; flex: none; border: 1px solid var(--line); border-radius: var(--radius-row); background: rgba(20, 23, 29, .96); }
.advanced-settings > summary { display: flex; align-items: center; gap: 12px; min-height: 66px; padding: 12px 14px; list-style: none; }
.advanced-settings > summary::-webkit-details-marker { display: none; }
.advanced-settings > summary > span { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 3px; }
.advanced-settings > summary strong { font-size: 12.5px; font-weight: 500; }
.advanced-settings > summary small { color: var(--text-dim); font-size: 10.5px; font-weight: 400; }
.advanced-settings > summary b { color: var(--text-dim); transition: transform 160ms ease; }
.advanced-settings:not([open]) > summary b { transform: rotate(-90deg); }
.advanced-grid, .camera-control-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.advanced-grid label, .camera-control-row { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.advanced-grid label:last-child, .camera-control-row:last-child { border-bottom: 0; }
.advanced-grid label > span, .camera-control-row > span { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 2px; color: var(--text-secondary); font-size: 12px; }
.advanced-grid small, .camera-control-row small { color: var(--text-dim); font-size: 9.5px; line-height: 1.4; }
.advanced-grid input, .camera-control-row input { width: 104px; min-height: 40px; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: var(--radius-control); background: #101319; color: var(--text); font: 11px "IBM Plex Mono", monospace; text-align: right; }
.camera-control-row.unsupported { opacity: .52; }
.camera-controls-status { padding: 10px 14px; border-top: 1px solid var(--line); color: var(--accepted); font-size: 9.5px; }
.settings-note { padding: 11px 14px 13px; border-top: 1px solid var(--line); color: var(--text-dim); font-size: 10.5px; line-height: 1.55; }
.account-panel { flex-direction: row; align-items: center; gap: 12px; }
.account-panel > span:last-child { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.account-panel strong { font-size: 12.5px; font-weight: 500; }
.account-panel small { color: var(--text-dim); font-size: 10.5px; }
.account-mark { width: 36px; height: 36px; border-radius: 10px; font-size: 15px; }
.technical-panel { gap: 7px; }
.technical-panel h2 { color: var(--text-faint); font: 500 9.5px "IBM Plex Mono", monospace; letter-spacing: .13em; text-transform: uppercase; }
.technical-panel p:last-child { font-family: "IBM Plex Sans", sans-serif; font-size: 11px; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@keyframes sweep { from { transform: translateY(-100%); } to { transform: translateY(1100%); } }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

@media (max-height: 700px) {
  .reticle-wrap { padding-bottom: 130px; }
  .reticle-stack { width: min(52vw, 210px); max-height: calc(100vh - 230px); }
  .latest-scan { margin-top: 10px; }
}

@media (max-height: 600px) and (orientation: portrait) {
  .reticle-stack { width: min(44vw, 180px); }
}

@media (min-width: 700px) {
  body { background: #090b0e; }
  #app-shell { max-width: 1180px; margin: 0 auto; border-inline: 1px solid var(--line); background: var(--background); }
  .scanner-view { padding-inline: 0; }
  .reticle-stack { width: min(32vw, 300px); }
  .camera-topbar { padding-inline: 24px; }
  .scan-rail { right: 24px; }
  .history-rail { left: 24px; }
  .collection-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .page-view { border-inline: 1px solid var(--line); }
}

@media (orientation: landscape) and (max-height: 600px) {
  .reticle-wrap { padding: 44px 120px 36px 20px; }
  .reticle-stack { width: auto; height: min(62vh, 330px); }
  .latest-scan { left: -10px; right: -10px; margin-top: 10px; }
  .history-rail { bottom: 16px; }
  .scan-rail { bottom: 16px; }
}

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