:root{font:15px/1.5 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:#e9eef6;background:#0d131b;color-scheme:dark;--muted:#96a7bc;--line:#2a3747;--green:#99efc0}
*{box-sizing:border-box}body{margin:0}main{max-width:1460px;margin:auto;padding:36px 36px 22px}header{display:flex;align-items:center;justify-content:space-between;gap:24px;margin-bottom:30px}.eyebrow{font-size:11px;letter-spacing:.18em;color:var(--green);font-weight:700;margin:0 0 10px}.eyebrow span{margin-left:14px;color:#8395aa;font-weight:500}h1{font-size:36px;letter-spacing:-1.2px;line-height:1.15;margin:0 0 12px}p{margin:0}.intro{color:var(--muted)}.local{font-size:12px;color:#bbccdb;display:flex;align-items:center;gap:8px;white-space:nowrap}.local i{width:7px;height:7px;background:var(--green);border-radius:50%}.toolbar{display:flex;gap:10px;align-items:end;margin-bottom:20px;flex-wrap:wrap}label{color:#bac6d5;font-size:13px}.camera-label{display:flex;flex-direction:column;gap:5px;width:min(320px,100%)}select,button{font:inherit;color:inherit;border:1px solid var(--line);background:#192330;border-radius:7px;padding:10px 13px;min-height:43px}select{width:100%;max-width:360px;cursor:pointer}button{cursor:pointer;font-weight:600;font-size:13px;white-space:nowrap}button:hover:enabled{background:#26364b}button.primary{background:var(--green);border-color:var(--green);color:#103121}button.primary:hover:enabled{background:#c0f8d9}button:disabled{cursor:default;opacity:.38}button:focus-visible,select:focus-visible,input:focus-visible{outline:2px solid #93caff;outline-offset:3px}.toolbar-options{display:flex;flex-wrap:wrap;gap:22px;margin-left:auto;align-items:center;min-height:43px}input{accent-color:var(--green);vertical-align:middle;margin-right:6px}.workspace{display:grid;grid-template-columns:minmax(0,1fr) 350px;gap:20px;align-items:stretch}.panel{border:1px solid var(--line);border-radius:12px;overflow:hidden;background:#141d28;display:flex;flex-direction:column}.panel-heading{height:55px;padding:0 20px;display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid var(--line)}h2{font-size:13px;font-weight:600;margin:0}.badge,.ratio{font-size:10px;letter-spacing:.1em;color:var(--muted);background:#202d3c;padding:4px 9px;border-radius:4px}.badge.live{color:var(--green);background:#203a32}.feed-stage{flex:1;min-height:420px;position:relative;display:flex;align-items:center;justify-content:center;background:radial-gradient(ellipse at 50% 40%,#202d3a,#101821 70%);overflow:hidden}#frame{width:100%;max-height:580px;object-fit:contain}.placeholder{color:var(--muted);text-align:center;padding:22px}.placeholder h3{font-size:16px;color:#d4dfea;font-weight:500;margin:18px 0 6px}.placeholder p{font-size:13px;max-width:320px}.viewfinder{width:120px;height:88px;margin:auto;border:1px solid #536b80;border-radius:18px;position:relative}.viewfinder:before,.viewfinder:after{content:"";position:absolute;background:#1a2632}.viewfinder:before{top:-2px;bottom:-2px;left:30px;right:30px}.viewfinder:after{left:-2px;right:-2px;top:24px;bottom:24px}.feed-footer{padding:13px 18px;display:flex;justify-content:space-between;gap:10px;font-size:12px;color:var(--muted);border-top:1px solid var(--line);min-height:46px}#status{color:#d4e0ec}.crop-stage{display:flex;align-items:center;justify-content:center;background:#101720;min-height:420px;flex:1;padding:16px}#crop{width:100%;max-width:292px;height:auto;max-height:450px;object-fit:contain;box-shadow:0 8px 25px #0005}.card-icon{border:1px dashed #455a70;border-radius:8px;width:86px;height:120px;margin:0 auto 20px}.capture-actions{padding:14px;display:flex;gap:8px;border-top:1px solid var(--line)}#capture{flex:1}kbd{font:11px system-ui;border:1px solid #566d6555;border-radius:4px;padding:1px 5px;margin-left:4px;opacity:.8}.bottom-row{display:flex;gap:24px;align-items:center;justify-content:space-between;margin-top:22px;flex-wrap:wrap}.metrics{display:flex;gap:34px}.metrics strong{display:block;font-size:20px;letter-spacing:-.5px;font-weight:500}.metrics span{font-size:11px;color:var(--muted)}.samples{display:flex;align-items:end;gap:10px}.samples label{display:flex;flex-direction:column;gap:5px;font-size:11px}.samples select{font-size:12px;max-width:285px}.samples button{font-size:12px}footer{font-size:12px;color:#7f93a9;margin-top:26px;max-width:1100px}.error{background:#492a2b;color:#ffd4cf;padding:12px 16px;border:1px solid #815055;border-radius:8px;margin-bottom:18px;font-size:14px}[hidden]{display:none!important}
@media(max-width:1000px){main{padding:24px}.workspace{grid-template-columns:minmax(0,1fr) 300px}.toolbar-options{margin-left:0}.local{display:none}.crop-stage,.feed-stage{min-height:340px}.metrics{gap:24px}}@media(max-width:680px){main{padding:20px 14px}.workspace{grid-template-columns:1fr}.feed-stage{min-height:260px}.crop-stage{min-height:300px}.crop-stage img{max-height:370px}h1{font-size:29px}.toolbar-options{width:100%;gap:18px}.camera-label{width:100%}.samples{width:100%}.samples label{flex:1}.metrics{gap:26px}.metrics strong{font-size:18px}header{margin-bottom:22px}.bottom-row{gap:22px}}
/* Recognition results remain alongside the camera on wide screens. */
.workspace{grid-template-columns:minmax(0,1fr) 280px 330px}.matches-panel{min-width:0}.catalog-status{padding:12px 17px;color:var(--muted);font-size:11px;border-bottom:1px solid var(--line)}.matches{list-style:none;margin:0;padding:0;flex:1}.match-row{padding:14px 15px;border-bottom:1px solid #263243}.match-row:first-child{background:#1c302b}.match-row:last-child{border-bottom:0}.match-heading{display:flex;align-items:baseline;gap:8px}.match-rank{font-size:11px;color:#8a9caf;flex-shrink:0}.match-title{font-size:12px;line-height:1.4;font-weight:600;flex:1;overflow-wrap:anywhere}.match-score{font-size:15px;font-variant-numeric:tabular-nums;white-space:nowrap;color:var(--green)}.match-detail{font-size:10px;line-height:1.5;color:var(--muted);padding:6px 0 7px 15px}.match-footer{font-size:10px;display:flex;justify-content:space-between;gap:6px;color:#7f93a9;padding-left:15px}.match-footer a{color:#accbd9;text-decoration:none}.match-footer a:hover{text-decoration:underline}.similarity-note{font-size:11px;line-height:1.5;color:#91a6ba;padding:14px 17px;border-top:1px solid var(--line);margin-top:auto}.matches-empty{flex:1;display:flex;align-items:center;justify-content:center}.capture-actions{flex-wrap:wrap}#capture{min-width:130px}
@media(max-width:1150px){.workspace{grid-template-columns:minmax(0,1fr) 300px}.matches-panel{grid-column:1/-1}.matches{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.match-row{border-right:1px solid #263243}.matches-empty{min-height:100px}}@media(max-width:680px){.workspace{grid-template-columns:1fr}.matches{display:block}.matches-panel{grid-column:auto}}

/* Keep live updates inside fixed slots, independent of image dimensions,
   title wrapping, detection loss, and changing scores/timings. */
html { scrollbar-gutter: stable; }
.toolbar-options { gap: 12px 18px; }
.hold-count { display: flex; align-items: center; gap: 6px; }
#hold-frames { width: 58px; margin: 0; padding: 5px; border: 1px solid var(--line); border-radius: 5px; background: #192330; color: inherit; font: inherit; }
#hold-frames:disabled { opacity: .4; }
#match-mode, #crop-mode { min-width: 58px; text-align: center; }
.panel { height: 660px; min-width: 0; }
.panel-heading { flex: 0 0 55px; }
.badge { width: 94px; text-align: center; }
.feed-stage, .crop-stage { flex: 1; min-height: 0; position: relative; }
#frame { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; }
.feed-footer { flex: 0 0 64px; align-items: center; }
#status { min-width: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
#dimensions { flex: 0 0 90px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
#crop { position: absolute; width: calc(100% - 32px); height: calc(100% - 32px); max-width: 292px; max-height: none; box-shadow: none; filter: drop-shadow(0 8px 12px #0005); }
.capture-actions { flex: 0 0 106px; display: grid; grid-template-columns: 1fr; gap: 8px; padding: 12px; align-content: center; }
.catalog-status { flex: 0 0 42px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.matches-stage { position: relative; flex: 1; min-height: 0; }
.matches { height: 100%; display: grid; grid-template-columns: 1fr; grid-template-rows: repeat(5, minmax(0, 1fr)); }
.matches-empty { position: absolute; inset: 0; min-height: 0; }
.match-row { min-width: 0; min-height: 0; padding: 8px 15px; display: grid; grid-template-rows: 34px 30px 15px; align-content: center; overflow: hidden; }
.match-heading { display: grid; grid-template-columns: 1ch minmax(0, 1fr) 6ch; gap: 8px; align-items: start; }
.match-title, .match-detail { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.match-score { text-align: right; }
.match-detail { padding: 0 0 0 15px; }
.match-footer { white-space: nowrap; }
.similarity-note { flex: 0 0 78px; margin-top: 0; }
.metrics { display: grid; grid-template-columns: 96px 96px 120px; gap: 24px; font-variant-numeric: tabular-nums; }
.error { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); width: min(680px, calc(100% - 28px)); margin: 0; z-index: 5; box-shadow: 0 8px 25px #0006; }
.sample-feedback { bottom: auto; top: 20px; background: #203a32; color: #d6f9e5; border-color: #47715f; overflow-wrap: anywhere; }
.sample-feedback.failed { background: #492a2b; color: #ffd4cf; border-color: #815055; }
.frame-actions { flex: 0 0 64px; padding: 10px 14px; border-top: 1px solid var(--line); }
.frame-actions button { width: 100%; }
.samples label { width: 285px; min-width: 0; flex: 0 0 285px; }
@media (max-width: 1150px) {
  .panel { height: 600px; }
  .matches-panel { height: 480px; }
  .matches { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .feed-panel { height: 424px; }
  .crop-panel { height: 600px; }
  .matches-panel { height: 660px; }
  .matches { grid-template-columns: 1fr; grid-template-rows: repeat(5, minmax(0, 1fr)); }
  .metrics { grid-template-columns: 84px 90px 115px; gap: 14px; }
  .samples { flex-wrap: wrap; }
  .samples label { width: 100%; flex: 1 0 100%; }
  .samples select { max-width: none; }
}

.algorithm-label { display: flex; gap: 8px; align-items: center; }
.algorithm-label select { width: 175px; }
