/* Dark, motorsport-ish UI (no external deps) */
:root{
  --bg:#0b0f14;
  --panel:#111824;
  --card:#0f1520;
  --text:#e8eef6;
  --muted:#9fb0c3;
  --line:#1c2a3b;
  --accent:#ffb020;
  --danger:#ff4d4d;
  --ok:#37d67a;
  --warn:#ffd166;
  --shadow: 0 8px 24px rgba(0,0,0,.35);
  --radius:16px;
  --radius2:22px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--sans);
  background: radial-gradient(1200px 800px at 20% 0%, rgba(255,176,32,.10), transparent 60%),
              radial-gradient(900px 700px at 80% 10%, rgba(55,214,122,.08), transparent 55%),
              var(--bg);
  color:var(--text);
}
.topbar{
  position:sticky; top:0; z-index:10;
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 14px;
  background: rgba(11,15,20,.82);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--line);
}
.brand{display:flex; gap:12px; align-items:center}
.dot{width:12px;height:12px;border-radius:50%; background:var(--accent); box-shadow:0 0 0 6px rgba(255,176,32,.15)}
.title{font-weight:800; letter-spacing:.2px}
.subtitle{font-size:12px; color:var(--muted)}
.tabs{
  display:flex; gap:8px; padding:10px 12px;
  border-bottom:1px solid var(--line);
}
.tab{
  flex:1;
  background:transparent;
  color:var(--muted);
  border:1px solid var(--line);
  border-radius:999px;
  padding:10px 12px;
  cursor:pointer;
}
.tab.active{
  color:var(--text);
  border-color: rgba(255,176,32,.45);
  box-shadow: inset 0 0 0 1px rgba(255,176,32,.35);
}
.container{max-width:980px; margin:0 auto; padding:14px}
.panel{display:block}
.hidden{display:none}
.card{
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent 18%),
              rgba(15,21,32,.86);
  border:1px solid rgba(28,42,59,.9);
  border-radius: var(--radius2);
  padding:14px;
  box-shadow: var(--shadow);
  margin:12px 0;
}
h2{margin:10px 0 12px}
h3{margin:10px 0 8px}
label{display:flex; flex-direction:column; gap:6px; font-size:13px; color:var(--muted)}
input,select{
  background: rgba(17,24,36,.9);
  border:1px solid var(--line);
  border-radius: 12px;
  padding:10px 12px;
  color:var(--text);
  outline:none;
}
input:focus,select:focus{border-color: rgba(255,176,32,.55)}
.grid2{display:grid; grid-template-columns:1fr 1fr; gap:10px}
@media (max-width:760px){ .grid2{grid-template-columns:1fr} }
.row{display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-top:12px}
.btn{
  border:1px solid rgba(255,176,32,.55);
  background: rgba(255,176,32,.12);
  color:var(--text);
  border-radius: 999px;
  padding:10px 14px;
  cursor:pointer;
  font-weight:700;
}
.btn:disabled{opacity:.45; cursor:not-allowed}
.btn.ghost{
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}
.btn.danger{
  border-color: rgba(255,77,77,.55);
  background: rgba(255,77,77,.12);
}
.small{font-size:12px}
.muted{color:var(--muted)}
.output{
  margin-top:12px;
  border:1px dashed rgba(28,42,59,.9);
  border-radius: 14px;
  padding:12px;
  font-family: var(--mono);
  white-space: pre-wrap;
}
.videoWrap{
  position:relative;
  border-radius: 18px;
  overflow:hidden;
  border:1px solid rgba(28,42,59,.9);
  background:#000;
}
video{width:100%; height:auto; display:block}
.badge{
  position:absolute; left:10px; top:10px;
  background: rgba(17,24,36,.78);
  border:1px solid rgba(28,42,59,.9);
  border-radius: 999px;
  padding:8px 10px;
  font-size:12px;
}
.calls{
  display:flex; flex-direction:column; gap:10px;
  max-height: 320px;
  overflow:auto;
  padding-right:6px;
}
.call{
  border:1px solid rgba(28,42,59,.9);
  border-radius: 16px;
  padding:10px 12px;
  background: rgba(17,24,36,.62);
}
.call .meta{display:flex; justify-content:space-between; gap:8px; font-size:12px; color:var(--muted)}
.call .text{margin-top:6px; font-weight:650}
.pill{
  border:1px solid rgba(28,42,59,.9);
  background: rgba(17,24,36,.55);
  border-radius:999px;
  padding:8px 10px;
  font-size:12px;
}
.thumbs{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap:10px;
  margin-top:12px;
}
.thumb{
  border:1px solid rgba(28,42,59,.9);
  border-radius: 14px;
  overflow:hidden;
  background: rgba(17,24,36,.55);
}
.thumb img{width:100%; height:80px; object-fit:cover; display:block}
.thumb .cap{padding:8px 10px; font-size:11px; color:var(--muted); font-family:var(--mono)}
.list{display:flex; flex-direction:column; gap:10px; margin-top:10px}
.item{
  border:1px solid rgba(28,42,59,.9);
  border-radius: 16px;
  padding:12px;
  background: rgba(17,24,36,.62);
}
.item .top{display:flex; justify-content:space-between; gap:10px; align-items:flex-start}
.item .name{font-weight:800}
.item .sub{font-size:12px; color:var(--muted); margin-top:4px}
.item .actions{margin-top:10px; display:flex; gap:10px; flex-wrap:wrap}
.footer{
  padding:18px 14px;
  border-top:1px solid var(--line);
  text-align:center;
}


/* Modal + HUD calibration */
.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(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow:auto;
  background: rgba(11,15,20,.92);
  border:1px solid rgba(28,42,59,.95);
  border-radius: 22px;
  box-shadow: 0 18px 60px rgba(0,0,0,.55);
  z-index: 60;
}
.modal-head{
  display:flex; justify-content:space-between; align-items:flex-start; gap:12px;
  padding:14px 14px 10px;
  border-bottom:1px solid var(--line);
}
.modal-title{font-weight:900; font-size:18px}
.modal-sub{color:var(--muted); font-size:12px; margin-top:4px}
.modal-body{padding:12px 14px 16px}
.cal-grid{display:grid; grid-template-columns: 1.7fr 1fr; gap:12px}
@media (max-width:980px){ .cal-grid{grid-template-columns:1fr} }
.cal-stage{
  position:relative;
  border:1px solid rgba(28,42,59,.9);
  border-radius: 18px;
  overflow:hidden;
  background:#000;
}
#calCanvas{width:100%; height:auto; display:block}
.roi-overlay{
  position:absolute; inset:0; pointer-events:none;
}
.roi{
  position:absolute;
  border:2px solid rgba(255,176,32,.9);
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(255,176,32,.35);
  background: rgba(255,176,32,.08);
}
.roi.active{
  border-color: rgba(55,214,122,.95);
  background: rgba(55,214,122,.10);
  box-shadow: inset 0 0 0 1px rgba(55,214,122,.30);
}
.roi .label{
  position:absolute; left:8px; top:8px;
  font-size:12px; font-family:var(--mono);
  padding:6px 8px;
  border-radius:999px;
  background: rgba(17,24,36,.78);
  border:1px solid rgba(28,42,59,.9);
  color: var(--text);
}
.roi .handle{
  position:absolute; width:18px; height:18px;
  right:-9px; bottom:-9px;
  border-radius: 999px;
  background: rgba(255,176,32,.95);
  border:2px solid rgba(0,0,0,.35);
}
.roi.active .handle{ background: rgba(55,214,122,.95); }

.card.mini{padding:12px}
.roi-list{display:flex; flex-direction:column; gap:8px; margin-top:10px}
.roi-btn{
  display:flex; justify-content:space-between; align-items:center; gap:8px;
  border:1px solid rgba(28,42,59,.9);
  background: rgba(17,24,36,.62);
  border-radius: 14px;
  padding:10px 12px;
  cursor:pointer;
}
.roi-btn .k{font-weight:800}
.roi-btn .v{font-family:var(--mono); color:var(--muted); font-size:12px}
.mono{font-family:var(--mono)}
