/* 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;
}

/* v3 UI improvements */
.smallbtn{padding:8px 12px; font-size:12px}
.engineer-card{display:flex;justify-content:space-between;align-items:center;gap:10px;border:1px solid rgba(28,42,59,.9);border-radius:18px;padding:12px;background:rgba(17,24,36,.55);margin-bottom:10px}
.eng-left{display:flex;gap:10px;align-items:center}
.eng-avatar{width:44px;height:44px;border-radius:16px;display:flex;align-items:center;justify-content:center;font-weight:900;background:rgba(255,176,32,.14);border:1px solid rgba(255,176,32,.35)}
.eng-name-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.eng-name{font-weight:900}
.eng-sub{font-size:12px;color:var(--muted);margin-top:2px}
.tag{font-size:11px;padding:6px 10px;border-radius:999px;border:1px solid rgba(28,42,59,.9);background:rgba(11,15,20,.25);color:var(--text);font-family:var(--mono)}
.kpi-row{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:10px}
@media (max-width:760px){.kpi-row{grid-template-columns:1fr 1fr}}
.kpi{border:1px solid rgba(28,42,59,.9);border-radius:18px;padding:10px 12px;background:rgba(17,24,36,.45)}
.kpi .k{font-size:12px;color:var(--muted)}
.kpi .v{font-size:18px;font-weight:900;margin-top:4px}
.kpi .s{font-size:12px;color:var(--muted);margin-top:2px}
.plan-cards{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-top:12px}
@media (max-width:760px){.plan-cards{grid-template-columns:1fr}}
.plan{border:1px solid rgba(28,42,59,.9);border-radius:18px;padding:12px;background:rgba(17,24,36,.45)}
.plan .t{font-weight:900}
.plan .b{font-family:var(--mono);color:var(--muted);margin-top:6px;font-size:12px;white-space:pre-line}
.plan .big{font-size:22px;font-weight:900;margin-top:8px}
.plan .hint{font-size:12px;color:var(--muted);margin-top:8px}
.debrief-dash{display:grid;grid-template-columns:1.3fr 1fr;gap:12px}
@media (max-width:900px){.debrief-dash{grid-template-columns:1fr}}
.deb{border:1px solid rgba(28,42,59,.9);border-radius:18px;padding:12px;background:rgba(17,24,36,.45)}
.deb-kpis{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-top:10px}
@media (max-width:760px){.deb-kpis{grid-template-columns:1fr}}
.deb-kpi{border:1px solid rgba(28,42,59,.9);border-radius:16px;padding:10px;background:rgba(11,15,20,.25)}
.deb-kpi .k{font-size:12px;color:var(--muted)}
.deb-kpi .v{font-size:18px;font-weight:900;margin-top:4px}
.deb-kpi .s{font-size:12px;color:var(--muted);margin-top:2px}
.videoWrap{aspect-ratio:16/9;}
video.fit{object-fit:contain;background:#000;width:100%;height:100%}
video.cover{object-fit:cover;background:#000;width:100%;height:100%}
video.portrait{object-fit:contain;background:#000;width:100%;height:100%}


/* v4.1 show plan lines */
#planOut{white-space:pre-wrap;}


/* v4.1 setup cards */
.setup-cards{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap:10px;
  margin-top:10px;
}
@media (max-width:760px){ .setup-cards{grid-template-columns:1fr} }
.setup-card{
  border:1px solid rgba(28,42,59,.9);
  border-radius: 18px;
  padding:12px;
  background: rgba(17,24,36,.45);
}
.setup-card .t{font-weight:900}
.setup-card .b{font-family:var(--mono); color:var(--muted); margin-top:8px; font-size:12px; white-space:pre-line}
.setup-card .big{font-size:18px; font-weight:900; margin-top:6px}

/* v5 strategy UI */
.strategy-view{
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap:12px;
  margin-top:12px;
}
.str-card{
  grid-column: span 6;
  border:1px solid rgba(28,42,59,.9);
  border-radius: 20px;
  padding:14px;
  background: rgba(17,24,36,.50);
  position:relative;
  overflow:hidden;
}
@media (max-width:900px){ .str-card{grid-column: span 12;} }
.str-head{display:flex; align-items:center; justify-content:space-between; gap:10px}
.str-title{font-weight:900}
.str-badge{font-size:11px; padding:6px 10px; border-radius:999px; border:1px solid rgba(28,42,59,.9); background: rgba(11,15,20,.25); font-family: var(--mono);}
.str-big{font-size:28px; font-weight:900; margin-top:8px}
.str-sub{font-size:12px; color:var(--muted); margin-top:4px; white-space:pre-line}
.meter{
  margin-top:12px;
  border:1px solid rgba(28,42,59,.9);
  border-radius:999px;
  height:12px;
  background: rgba(11,15,20,.25);
  overflow:hidden;
}
.meter > div{height:100%; width:0%}
.meter-label{display:flex; justify-content:space-between; font-size:12px; color:var(--muted); margin-top:6px}
.hidden{display:none !important;}
.output.danger{border-color: rgba(255,80,80,.6); color: #ffb4b4;}

/* v5.3 build ribbon */
.ribbon{
  display:inline-block;
  margin-top:6px;
  padding:6px 10px;
  border-radius: 999px;
  border:1px solid rgba(255,176,32,.35);
  background: rgba(255,176,32,.14);
  font-family: var(--mono);
  font-size: 12px;
}

/* v1.1 diagnostics */
.diag{
  margin-top:12px;
  border:1px dashed rgba(255,176,32,.55);
  border-radius:18px;
  padding:12px;
  background: rgba(255,176,32,.08);
}
.diag-title{font-weight:900; margin-bottom:8px}
.diag-row{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)}
.diag-row:last-child{border-bottom:none}
.diag-row .k{color: var(--muted)}
.diag-row .v{color: var(--text); text-align:right; max-width:60%}
