
:root{
  --bg:#0b0f14;
  --card: rgba(17,24,36,.55);
  --border: rgba(28,42,59,.95);
  --text:#e9eef6;
  --muted:#9aa8ba;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background: radial-gradient(1200px 600px at 20% -10%, rgba(255,176,32,.12), transparent 55%),
              radial-gradient(900px 500px at 80% 0%, rgba(90,200,250,.10), transparent 55%),
              var(--bg);
  color:var(--text);
}
a{color:inherit}
.top{
  position:sticky; top:0; z-index:10;
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 14px;
  background: rgba(11,15,20,.80);
  backdrop-filter: blur(10px);
  border-bottom:1px solid rgba(28,42,59,.7);
}
.brand{display:flex; gap:10px; align-items:center}
.dot{width:14px;height:14px;border-radius:50%; background: rgba(255,176,32,.85); box-shadow:0 0 0 4px rgba(255,176,32,.12)}
.h1{font-weight:900}
.sub{color:var(--muted); font-size:12px}
.right{display:flex; gap:10px; align-items:center}
.wrap{max-width:1100px; margin:0 auto; padding:14px}
.card{
  background: var(--card);
  border:1px solid var(--border);
  border-radius: 22px;
  padding:14px;
  box-shadow: 0 12px 30px rgba(0,0,0,.22);
  margin: 12px 0;
}
.cardHead{display:flex; align-items:flex-start; justify-content:space-between; gap:12px; flex-wrap:wrap}
.title{font-weight:900; font-size:18px}
.muted{color:var(--muted)}
.small{font-size:12px}
.mono{font-family:var(--mono)}
.row{display:flex; gap:10px; align-items:center}
.tight{gap:8px}
.wrapRow{flex-wrap:wrap}
.btn{
  border:1px solid rgba(255,176,32,.45);
  background: rgba(255,176,32,.14);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight:800;
}
.btn:disabled{opacity:.45}
.btn.ghost{
  border-color: rgba(28,42,59,.95);
  background: rgba(11,15,20,.20);
  font-weight:800;
}
.btn.danger{
  border-color: rgba(255,80,80,.55);
  background: rgba(255,80,80,.12);
}
.pill{
  border:1px solid rgba(28,42,59,.95);
  background: rgba(11,15,20,.25);
  border-radius: 999px;
  padding: 8px 12px;
  font-family: var(--mono);
  font-size:12px;
}
.mini{display:flex; flex-direction:column; gap:6px; font-size:11px; color:var(--muted)}
input,select{
  background: rgba(11,15,20,.35);
  border:1px solid rgba(28,42,59,.95);
  color:var(--text);
  padding:10px 12px;
  border-radius: 14px;
  min-width: 120px;
}
.cameraGrid{
  display:grid;
  grid-template-columns: 1.1fr .9fr;
  gap:12px;
  margin-top:12px;
}
@media (max-width: 980px){
  .cameraGrid{grid-template-columns:1fr}
}
.camPane,.livePane{min-width:0}
.videoWrap{
  position:relative;
  border-radius: 18px;
  overflow:hidden;
  border:1px solid rgba(28,42,59,.95);
  background: rgba(11,15,20,.35);
  aspect-ratio: 16/9;
}
video{width:100%; height:100%; object-fit:cover; display:block}
.overlay{
  position:absolute; inset:0;
  width:100%; height:100%;
  pointer-events:none;
}
.camTop, .liveTop{display:flex; justify-content:space-between; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:10px}
.kpis{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap:10px;
  margin-top:10px;
}
.kpi{
  border:1px solid rgba(28,42,59,.95);
  border-radius: 18px;
  padding:12px;
  background: rgba(11,15,20,.22);
}
.kpi .k{color:var(--muted); font-size:12px}
.kpi .v{font-size:22px; font-weight:900; margin-top:6px}
.kpi .s{font-family:var(--mono); color:var(--muted); font-size:12px; margin-top:6px; white-space:pre-line}
.engineer{
  margin-top:12px;
  border:1px solid rgba(28,42,59,.95);
  border-radius: 22px;
  padding:12px;
  background: rgba(11,15,20,.22);
}
.engHead{display:flex; gap:10px; align-items:center}
.avatar{
  width:38px; height:38px; border-radius:14px;
  background: radial-gradient(circle at 30% 30%, rgba(255,176,32,.9), rgba(255,176,32,.2));
  border:1px solid rgba(255,176,32,.35);
}
.engName{font-weight:900}
.engLog{
  margin-top:10px;
  display:flex;
  flex-direction:column;
  gap:8px;
  max-height: 220px;
  overflow:auto;
  padding-right:6px;
}
.msg{
  border:1px solid rgba(28,42,59,.95);
  background: rgba(17,24,36,.45);
  border-radius: 16px;
  padding:10px;
}
.msg .t{font-weight:900}
.msg .b{color:var(--muted); font-size:12px; white-space:pre-line; margin-top:6px}
.list{margin:10px 0 0 18px; color:var(--muted)}
.steps{display:grid; grid-template-columns: repeat(3, 1fr); gap:10px; margin-top:10px}
@media (max-width: 820px){ .steps{grid-template-columns:1fr} }
.step{
  border:1px solid rgba(28,42,59,.95);
  border-radius: 18px;
  padding:12px;
  background: rgba(11,15,20,.22);
  display:flex; gap:10px;
}
.step .n{
  width:28px; height:28px; border-radius:999px;
  display:flex; align-items:center; justify-content:center;
  background: rgba(255,176,32,.14);
  border:1px solid rgba(255,176,32,.35);
  font-family: var(--mono);
}
.debug{margin-top:10px}
.diag{
  margin-top:10px;
  border:1px dashed rgba(255,176,32,.55);
  border-radius:18px;
  padding:12px;
  background: rgba(255,176,32,.08);
}
.diagRow{display:flex; justify-content:space-between; gap:12px; font-family: var(--mono); font-size:12px; padding:6px 0; border-bottom:1px solid rgba(255,176,32,.18)}
.diagRow:last-child{border-bottom:none}
.hidden{display:none !important}

/* Modal */
.backdrop{
  position:fixed; inset:0;
  background: rgba(0,0,0,.55);
  z-index:50;
}
.modal{
  position:fixed;
  left:50%; top:50%;
  transform: translate(-50%,-50%);
  width:min(1100px, calc(100% - 18px));
  max-height: calc(100% - 18px);
  overflow:auto;
  z-index:60;
  background: rgba(11,15,20,.92);
  border:1px solid rgba(28,42,59,.95);
  border-radius: 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.modalHead{
  display:flex; justify-content:space-between; gap:10px; align-items:flex-start;
  padding:12px 12px 0 12px;
}
.modalBody{padding:12px}
.calibGrid{display:grid; grid-template-columns: 1.2fr .8fr; gap:12px}
@media (max-width: 980px){ .calibGrid{grid-template-columns:1fr} }
.chip{
  border:1px solid rgba(255,176,32,.45);
  background: rgba(255,176,32,.14);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight:900;
  font-family: var(--mono);
}
.chip.ghost{
  border-color: rgba(28,42,59,.95);
  background: rgba(11,15,20,.20);
}
.calibCanvasWrap{
  border:1px solid rgba(28,42,59,.95);
  border-radius: 18px;
  overflow:hidden;
  background: rgba(0,0,0,.25);
}
#calibCanvas{width:100%; height:auto; display:block}
.boxesList{
  display:flex; flex-direction:column; gap:10px; margin:10px 0;
}
.boxRow{
  border:1px solid rgba(28,42,59,.95);
  border-radius: 16px;
  padding:10px;
  background: rgba(17,24,36,.45);
  font-family: var(--mono);
  font-size:12px;
}

/* v2.1 */
.mini select{min-width:120px}

/* v2.4 calibration touch */
#calibCanvas{touch-action:none;}
.calibCanvasWrap{touch-action:none;}

/* v2.5 */
