:root {
  --bg: #f6f5f2; --panel: #fff; --ink: #1b1d21; --mute: #6b6f78; --line: #e3e1dc;
  --accent: #1f6feb; --warn: #d93025; --ok: #188038; --chip: #eef1f6;
  --r: 12px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161a; --panel: #1d2026; --ink: #eceef2; --mute: #9aa0aa; --line: #2c3038;
    --accent: #5b9dff; --warn: #ff6b5e; --ok: #4cc27a; --chip: #262a32; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
button, .btn { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 10px;
  padding: 10px 14px; min-height: 44px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.btn.primary, button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.small { min-height: 34px; padding: 4px 10px; font-size: 14px; }
button:disabled { opacity: .5; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; min-height: 44px; width: 100%; }
.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
.top nav { display: flex; gap: 10px; align-items: center; }
.brand { font-weight: 800; font-size: 19px; color: var(--ink); } .brand span { color: var(--accent); }
.search { padding: 10px 16px 0; }
main { padding: 12px 16px 80px; max-width: 980px; margin: 0 auto; }
h1 { font-size: 22px; margin: 6px 0 12px; } h2 { font-size: 17px; margin: 22px 0 8px; }
.mute { color: var(--mute); font-size: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; margin: 10px 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; color: var(--ink); }
.tile img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--chip); }
.tile .t { padding: 8px 10px; }
.code { font-weight: 800; font-size: 20px; letter-spacing: .5px; }
.chip { display: inline-block; background: var(--chip); border-radius: 999px; padding: 2px 10px; font-size: 13px; }
.chip.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.chip.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }

/* photo with dots */
.stage { background: #000; border-radius: var(--r); display: flex; justify-content: center; }
.shot { position: relative; display: inline-block; max-width: 100%; }
.shot img { display: block; max-width: 100%; max-height: 70vh; width: auto; height: auto; }
.shot svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.dot circle { stroke: #fff; stroke-width: 4; }
.dot text { fill: #fff; font: 800 30px system-ui; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.dot.sure circle { fill: #1f6feb; } .dot.unsure circle { fill: #d93025; } .dot.hl circle { fill: #f5a623; }
.strip { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0; }
.strip img { height: 64px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.strip img.on { border-color: var(--accent); }

/* crop of one dot */
.crop { width: 120px; height: 120px; border-radius: 10px; flex: none; background-repeat: no-repeat; background-color: var(--chip);
  position: relative; }
.crop::after { content: ""; position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px;
  border: 3px solid #f5a623; border-radius: 50%; box-shadow: 0 0 0 2px #0006; }

.item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item .n { font-weight: 800; min-width: 30px; }
.item .name { font-weight: 600; }
.item .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.item.dropped .name, .item.in_use .name { text-decoration: line-through; color: var(--mute); }
.q { display: flex; gap: 12px; align-items: flex-start; }
.q form { flex: 1; display: grid; gap: 8px; }
.tape { font: 800 26px/1.2 system-ui; letter-spacing: 1px; padding: 14px; border: 2px dashed var(--line); border-radius: 10px; }
.tape small { font-size: 16px; color: var(--mute); letter-spacing: 0; }

/* camera */
.cam { position: relative; background: #000; border-radius: var(--r); overflow: hidden; }
.cam video { width: 100%; max-height: 62vh; object-fit: contain; display: block; }
.shutter { width: 76px; height: 76px; border-radius: 50%; border: 5px solid #fff; background: #ffffff33; padding: 0; }
.shutter:active { background: #fff; }
#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; }
#toast.on { opacity: 1; }
@media (min-width: 760px) { .split { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; align-items: start; }
  .split > :first-child { position: sticky; top: 70px; } }
