:root{
  --bg:#0b0c10;
  --panel:#121318;
  --text:#e5e7eb;
  --muted:#9aa0a6;
  --accent:#3b82f6;
  --card:#1b1f2a;
  --border:#2a2f3a;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font:14px/1.5 system-ui, -apple-system, "Noto Sans KR", Segoe UI, Roboto, sans-serif;
}

.topbar{
  height:56px; display:flex; align-items:center; justify-content:space-between;
  padding:0 16px; border-bottom:1px solid var(--border); background:var(--panel);
}
.topbar h1{font-size:16px; margin:0}
.topnav{ display:flex; gap:8px; }
.nav-btn{
  background:#1c1f29; color:var(--text);
  border:1px solid var(--border);
  border-radius:6px; padding:6px 10px;
  cursor:pointer; font-size:13px; transition:all .2s ease;
}
.nav-btn:hover{ background:#2a2f3a; }

.sidebar{
  position:fixed; top:56px; left:0; bottom:0; width:300px;
  border-right:1px solid var(--border); background:var(--panel); overflow:auto;
}
.sidebar-header{padding:12px 14px; border-bottom:1px solid var(--border);}
.report-list{padding:8px}
.report-item{
  padding:10px 12px; border:1px solid transparent; border-radius:8px; margin-bottom:8px;
  background:transparent; cursor:pointer;
}
.report-item:hover{border-color:var(--border); background:#141720}

.content{ margin-left:300px; padding:16px; min-height:calc(100% - 56px); }

/* 뷰 스위칭 */
.view{ display:none; }
.view.active{ display:block; }

.cards{
  display:grid; gap:12px; grid-template-columns: repeat(7, minmax(0, 1fr));
  margin-bottom:16px;
}
.card{ background:var(--card); border:1px solid var(--border); border-radius:12px; padding:12px; }
.card .label{color:var(--muted); font-size:12px}
.card .value{font-size:18px; margin-top:4px}

.player-box{
  background:var(--panel); border:1px solid var(--border);
  border-radius:12px; padding:12px; margin-bottom:16px;
}

/* 비디오 컨테이너 */
.video-wrap{
  position:relative; width:100%; max-width:100%;
  background:#000; border-radius:8px; overflow:hidden;
  aspect-ratio: var(--video-aspect, 16/9);
}
#player,#overlayVid,#overlay{
  position:absolute; left:0; top:0; width:100%; height:100%;
}
#player{
  position:relative; display:block; object-fit:contain; background:#000;
}
#overlayVid{ pointer-events:none; object-fit:contain; mix-blend-mode:screen; opacity:.7; display:none; }
#overlay{ pointer-events:none; }

.controls{ display:flex; align-items:center; gap:12px; margin-top:8px; flex-wrap:wrap; }
.toggles label{ margin-right:12px; user-select:none; }
.overlay-select select{ margin-left:4px; }

/* 재생 속도 */
.playback{ display:flex; align-items:center; gap:4px; }
.speed-label{ color:var(--muted); margin-right:4px; font-size:13px; }
.rate-btn{
  background:#1c1f29; color:var(--text);
  border:1px solid var(--border);
  border-radius:6px; padding:4px 8px;
  cursor:pointer; font-size:13px; transition:all .2s ease;
}
.rate-btn:hover{ background:#2a2f3a; }
.rate-btn.active{ background:var(--accent); color:#fff; border-color:var(--accent); }

#seek{ width:100%; }

/* 차트 공통 */
.charts{
  background:var(--panel); border:1px solid var(--border); border-radius:12px;
  padding:12px; margin-bottom:16px;
}
.charts canvas{ width:100%; height:320px; }

/* 원본 JSON */
.raw details{ margin:8px 0; }
.raw pre{
  background:#0f1117; color:#d1d5db; border:1px solid var(--border);
  padding:12px; border-radius:8px; overflow:auto;
}

/* 그룹 스타일 */
.team-group,.player-group{ margin:6px 8px; border:1px solid var(--border); border-radius:8px; background:#141720; }
.team-group>summary,.player-group>summary{
  cursor:pointer; padding:8px 10px; list-style:none; display:flex; align-items:center; justify-content:space-between;
}
.team-group>summary::-webkit-details-marker,.player-group>summary::-webkit-details-marker{ display:none; }
.group-title{ font-weight:600; }
.group-count{
  font-size:12px; color:var(--muted); background:#11151f; border:1px solid var(--border);
  padding:2px 8px; border-radius:999px; margin-left:8px;
}
.player-group .report-items{ padding:6px 8px 10px 8px; }
.player-group .report-item{
  background:transparent; border:1px solid transparent; border-radius:8px; margin:6px 0; padding:8px 10px; cursor:pointer;
}
.player-group .report-item:hover{ border-color:var(--border); background:#0f131c; }

/* 서브헤드 */
.subhead{
  display:flex; align-items:center; gap:12px; margin-bottom:12px;
}
.btn{
  background:#1c1f29; color:var(--text);
  border:1px solid var(--border); border-radius:6px; padding:6px 10px;
  cursor:pointer; font-size:13px;
}
.btn:hover{ background:#2a2f3a; }

/* 프레임 프리뷰(공통) - 잘림 방지 */
.frame-preview{
  margin-top:12px; background:#0f1117; border:1px solid var(--border);
  border-radius:10px; padding:10px;
}
.frame-preview-head{
  display:flex; align-items:center; justify-content:space-between; margin-bottom:8px;
}
.frame-preview img{
  width:100%;
  height:auto;           /* 세로 잘림 방지 */
  object-fit:contain;    /* 종횡비 유지 */
  background:#000; border-radius:8px; display:block;
}
.offscreen{ display:none; }

/* 무게 중심 이동 전용 */
.center-controls{
  display:flex;
  flex-direction:column; /* 라벨 위, 슬라이더 아래 */
  gap:8px;
  margin:12px 0;
}
#centerFrame{
  width:100%;            /* 전폭 슬라이더 */
}

.center-bar{
  position:relative;
  width:100%;
  height:36px;                 /* 조금 더 높게 */
  border:1px solid var(--border);
  border-radius:999px;
  overflow:hidden;
  background:#0f131c;
  display:flex;
  flex-direction:row-reverse;  /* 위치 스왑: Left(파랑)=오른쪽, Right(빨강)=왼쪽 */
}
.center-bar-left{
  height:100%;
  background-color:#3b82f6; /* 파란색 */
  width:50%;
}
.center-bar-right{
  height:100%;
  background-color:#ef4444; /* 빨간색 */
  width:50%;
}

.center-bar-legend{
  margin-top:8px; display:flex; align-items:center; gap:16px; color:var(--muted);
}
.chip{ display:inline-block; width:10px; height:10px; border-radius:2px; margin-right:4px; }
.chip-blue{ background:#3b82f6; }
.chip-red{ background:#ef4444; }

/* 하단 중앙 크게: Right : Left */
.center-ratio-big{
  margin-top:12px;
  text-align:center;
  font-size:22px;
  font-weight:700;
  letter-spacing:0.2px;
}
