/* ============================================
   NC Strategy Lab — 진중한 분석 도구
   진한 마린 블루 + 골드 액센트
============================================ */

:root {
  /* 메인 — 진한 마린 블루 */
  --navy-deep:    #0a1f4e;
  --navy:         #1a3066;
  --navy-mid:     #2c4882;
  --navy-soft:    #4a6aa5;

  /* 액센트 — NC 골드 */
  --gold:         #c8a558;
  --gold-light:   #e0c887;
  --gold-dark:    #9a7d3e;

  /* 데이터 시각화 */
  --pos:          #1f7a3b;
  --pos-light:    #5fb37a;
  --neg:          #b81e2c;
  --neg-light:    #d96666;
  --warn:         #b88300;

  /* 배경 */
  --bg:           #f5f3ee;
  --bg-page:      #f5f3ee;
  --bg-card:      #ffffff;
  --bg-card-alt:  #faf8f3;
  --bg-hover:     #f0ece2;
  --bg-active:    #1a3066;

  /* 텍스트 */
  --text:         #1a1a1a;
  --text-primary: #0a1f4e;
  --text-mute:    #6b7280;
  --text-faint:   #9ca3af;

  /* 보더 */
  --border:       #d6d3c8;
  --border-soft:  #ebe7da;

  /* 호환 (기존 코드 참조용 별칭) */
  --red:          var(--neg);
  --link:         var(--navy-mid);
  --navy-light:   var(--navy-mid);

  /* ── 리디자인: 타이포 스케일 ── */
  --fs-display: 80px;   /* 결과 대표 숫자 */
  --fs-h1:      30px;   /* 페이지 타이틀 */
  --fs-h2:      17px;   /* 카드 헤딩 */
  --fs-lead:    15.5px; /* 리드 문단 */
  --fs-body:    15px;   /* 본문 */
  --fs-sm:      13.5px; /* 보조 */
  --fs-label:   12px;   /* 라벨·캡션 */

  /* ── 여백 스케일 (8px 그리드) ── */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 22px; --sp-6: 32px; --sp-7: 44px;

  /* ── 형태 ── */
  --radius:    9px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(10,31,78,0.05);
  --shadow:    0 1px 3px rgba(10,31,78,0.05), 0 10px 28px -12px rgba(10,31,78,0.14);

  /* 본문 텍스트 (가독성 보강) */
  --text-body: #39414f;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg-page);
  color: var(--text);
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', Roboto, sans-serif;
  font-size: var(--fs-body);
  line-height: 1.62;
  letter-spacing: -0.003em;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'tnum' 1, 'ss01' 1;
}

button, input, select { font-family: inherit; }
button { cursor: pointer; }
a { color: var(--navy-mid); text-decoration: none; }
a:hover { text-decoration: underline; }
table { border-collapse: collapse; width: 100%; }

/* 숫자는 모두 탭형(고정폭) */
.num, td, th { font-variant-numeric: tabular-nums; }

/* ============ TOPBAR ============ */
.topbar {
  background: var(--navy-deep);
  color: #fff;
  border-bottom: 2px solid var(--gold);
  position: relative;
}
.topbar::after {
  /* 골드 위에 미세한 그라데이션 라인 */
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold), var(--gold-light), var(--gold), var(--gold-dark));
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.logo:hover { text-decoration: none; }
.logo-mark {
  background: var(--gold);
  color: var(--navy-deep);
  padding: 5px 9px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  border-radius: 2px;
  line-height: 1;
}
.logo-text {
  font-size: 19px;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.logo-sub {
  font-size: 11px;
  color: var(--gold-light);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 500;
  margin-left: 2px;
}
.topnav {
  display: flex;
  gap: 0;
  height: 100%;
  align-items: stretch;
  margin-left: auto;
}
.topnav-link {
  display: flex;
  align-items: center;
  padding: 0 16px;
  color: rgba(255,255,255,0.78);
  font-size: 13.5px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
  letter-spacing: 0.01em;
}
.topnav-link:hover {
  color: var(--gold-light);
  text-decoration: none;
}
.topnav-link.active {
  color: #fff;
  border-bottom-color: var(--gold);
}
.badge-new {
  display: inline-block;
  background: var(--gold);
  color: var(--navy-deep);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 2px 5px;
  border-radius: 2px;
  margin-left: 5px;
  vertical-align: middle;
}

/* ============ CONTAINER ============ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 34px 28px 60px;
}

.page-title {
  font-size: var(--fs-h1);
  font-weight: 800;
  color: var(--navy-deep);
  margin-bottom: 7px;
  letter-spacing: -0.025em;
  line-height: 1.16;
}
.page-eyebrow {
  font-size: 11.5px;
  color: var(--gold-dark);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 9px;
}

.mode-select {
  margin-bottom: 22px;
  margin-top: 18px;
}
.mode-select select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 36px 11px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy-deep);
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M1 1l4 4 4-4' stroke='%231a3066' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  min-width: 200px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.mode-select select:hover {
  border-color: var(--navy-mid);
}
.mode-select select:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(26, 48, 102, 0.1);
}

.page-desc {
  font-size: var(--fs-lead);
  color: var(--text-body);
  line-height: 1.78;
  margin-bottom: 28px;
  max-width: 720px;
}
.page-desc strong { color: var(--navy-deep); font-weight: 700; }

/* ============ EXPLORER CARD ============ */
.explorer-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.explorer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 0;
}

/* ============ 입력 영역 ============ */
.input-area {
  padding: 26px 26px;
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* 이닝 + 초/말 */
.input-block { width: 100%; }
.inning-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.inning-buttons {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex: 1;
}
.ibtn {
  flex: 1;
  background: var(--bg-card);
  border: none;
  border-right: 1px solid var(--border-soft);
  padding: 9px 0;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  transition: background 0.12s, color 0.12s;
}
.ibtn:last-child { border-right: none; }
.ibtn:hover:not(.active) { background: var(--bg-hover); }
.ibtn.active {
  background: var(--navy-deep);
  color: #fff;
  font-weight: 700;
}

.half-buttons {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.hbtn {
  background: var(--bg-card);
  border: none;
  border-right: 1px solid var(--border-soft);
  padding: 9px 17px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  transition: background 0.12s, color 0.12s;
}
.hbtn:last-child { border-right: none; }
.hbtn:hover:not(.active) { background: var(--bg-hover); }
.hbtn.active {
  background: var(--navy-deep);
  color: #fff;
  font-weight: 700;
}

/* 중단: 다이아몬드 + 컨트롤 */
.middle-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
  align-items: flex-start;
}

.diamond-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.block-label {
  font-size: var(--fs-label);
  font-weight: 700;
  color: var(--text-mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.diamond {
  width: 160px;
  height: auto;
}
.diamond .base rect {
  fill: var(--bg-card);
  stroke: #999;
  stroke-width: 1.5;
  cursor: pointer;
  transition: all 0.15s;
}
.diamond .base:hover rect { stroke: var(--navy); }
.diamond .base.occupied rect {
  fill: var(--red);
  stroke: #a30025;
}

/* 컨트롤 행들 */
.controls-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.control-row {
  display: grid;
  grid-template-columns: 76px 1fr;
  align-items: center;
  gap: 12px;
}
.ctrl-label {
  font-size: var(--fs-label);
  font-weight: 700;
  color: var(--text-mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ctrl-buttons {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.cbtn {
  flex: 1;
  background: var(--bg-card);
  border: none;
  border-right: 1px solid var(--border-soft);
  padding: 8px 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.cbtn:last-child { border-right: none; }
.cbtn:hover:not(.active) { background: var(--bg-hover); }
.cbtn.active {
  background: var(--navy-deep);
  color: #fff;
  font-weight: 700;
}
.ctrl-buttons.situation .cbtn { padding: 8px 8px; font-size: 12px; }

/* 점수차 슬라이더 */
.rundiff-block {
  width: 100%;
}
.rundiff-labels {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-label);
  font-weight: 700;
  color: var(--text-mute);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 7px;
}
.rundiff-slider {
  position: relative;
}
.rundiff-slider input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  background: transparent;
  height: 24px;
  cursor: pointer;
}
.rundiff-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
}
.rundiff-slider input[type="range"]::-moz-range-track {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
}
.rundiff-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: var(--navy-deep);
  border: 2px solid #fff;
  border-radius: 50%;
  margin-top: -7px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.rundiff-slider input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--navy-deep);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.rundiff-marks {
  display: flex;
  justify-content: space-between;
  margin-top: 3px;
  padding: 0 2px;
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 500;
}
.rundiff-marks span {
  flex: 1;
  text-align: center;
  transition: color 0.15s, font-weight 0.15s;
}
.rundiff-marks span.active {
  color: var(--navy);
  font-weight: 700;
}

/* 하단: 초기화 + 관점 */
.bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}
.clear-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-mute);
  transition: all 0.15s;
}
.clear-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--text-mute);
}

.perspective {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pers-label {
  font-size: var(--fs-label);
  font-weight: 700;
  color: var(--text-mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.pers-buttons {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.pbtn {
  background: var(--bg-card);
  border: none;
  border-right: 1px solid var(--border-soft);
  padding: 8px 15px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  transition: background 0.12s, color 0.12s;
}
.pbtn:last-child { border-right: none; }
.pbtn:hover:not(.active) { background: var(--bg-hover); }
.pbtn.active {
  background: var(--navy-deep);
  color: #fff;
  font-weight: 700;
}

/* ============ 신뢰도 배지 ============ */
.rel-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: 0.02em;
  vertical-align: middle;
  margin-left: 6px;
  white-space: nowrap;
}
.rel-badge.rel-high {
  background: rgba(31, 122, 59, 0.12);
  color: #0d5a26;
}
.rel-badge.rel-medium {
  background: rgba(200, 165, 88, 0.18);
  color: var(--gold-dark);
}
.rel-badge.rel-low {
  background: rgba(184, 131, 0, 0.15);
  color: #8a5a00;
}
.rel-badge.rel-very-low {
  background: rgba(184, 30, 44, 0.12);
  color: var(--neg);
}
.rel-n {
  font-size: 11px;
  color: var(--text-mute);
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}

/* ============ 결과 영역 ============ */
.result-area {
  padding: 34px 30px;
  background: var(--bg-card-alt);
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-left: 1px solid var(--border-soft);
}
.result-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--gold-dark);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.result-value {
  display: flex;
  align-items: baseline;
  line-height: 1;
  margin-bottom: 14px;
}
.result-num {
  font-size: var(--fs-display);
  font-weight: 800;
  color: var(--navy-deep);
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}
.result-unit {
  font-size: 34px;
  font-weight: 700;
  color: var(--navy-soft);
  margin-left: 4px;
}
.result-meta {
  font-size: var(--fs-sm);
  color: var(--text-mute);
  margin-bottom: 18px;
  line-height: 1.65;
}
.result-bar {
  display: flex;
  height: 26px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--border-soft);
}
.bar-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
  transition: width 0.4s;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.bar-segment.win { background: var(--navy-deep); }
.bar-segment.tie { background: var(--gold-dark); }
.bar-segment.loss { background: var(--neg); }
.bar-label {
  padding: 0 4px;
}
.result-footnote {
  font-size: var(--fs-label);
  color: var(--text-faint);
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}

/* ============ 카운트별 표 ============ */
.byco-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.byco-head {
  background: var(--bg-card-alt);
  border-bottom: 1px solid var(--border);
  padding: 15px 20px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--navy-deep);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.byco-sub {
  font-size: var(--fs-label);
  font-weight: 400;
  color: var(--text-mute);
  text-transform: none;
  letter-spacing: 0;
}
.byco-table {
  font-size: 14px;
}
.byco-table th, .byco-table td {
  padding: 12px 18px;
  text-align: center;
}
.byco-table thead th {
  background: var(--bg-card-alt);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--navy-mid);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.byco-table tbody th {
  background: var(--bg-card-alt);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--navy-mid);
  text-align: left;
  padding-left: 20px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-right: 1px solid var(--border-soft);
}
.byco-table tbody tr + tr th,
.byco-table tbody tr + tr td {
  border-top: 1px solid var(--border-soft);
}
.byco-table tbody td {
  color: var(--text);
  font-weight: 500;
}
.byco-table tbody tr:hover td { background: var(--bg-card-alt); }
.byco-table tbody td.cell-now {
  background: rgba(200, 165, 88, 0.18);
  color: var(--navy-deep);
  font-weight: 700;
  position: relative;
}
.byco-table tbody td.cell-now::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid var(--gold);
  pointer-events: none;
}

/* ============ FOOT ============ */
.page-foot {
  font-size: var(--fs-label);
  color: var(--text-faint);
  line-height: 1.7;
  margin-top: 40px;
  padding-top: 22px;
  border-top: 1px solid var(--border-soft);
  text-align: center;
}
.page-foot a { color: var(--navy-mid); }

/* ============ 반응형 ============ */
@media (max-width: 900px) {
  .topnav { display: none; }
  .container { padding: 20px 16px 40px; }
  .explorer-grid { grid-template-columns: 1fr; }
  .input-area { border-right: none; border-bottom: 1px solid var(--border-soft); }
  .middle-row { grid-template-columns: 1fr; gap: 18px; }
  .controls-area { gap: 10px; }
  .control-row { grid-template-columns: 76px 1fr; }
  .inning-buttons { flex-wrap: wrap; }
  .ibtn { min-width: 32px; flex: 0 0 auto; }
  .ctrl-buttons.situation .cbtn { font-size: 11px; padding: 7px 4px; }
  .bottom-row { flex-direction: column; gap: 10px; align-items: stretch; }
  .result-num { font-size: 56px; }
}

/* ============================================
   경기 흐름 (WPA) 모드
============================================ */
.gameflow-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 18px;
  margin-bottom: 16px;
}

.gameflow-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: flex-start;
}

.gf-search-wrap {
  position: relative;
  flex: 1;
}

#gf-search {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}

#gf-search:focus {
  outline: none;
  border-color: var(--navy);
}

.gf-search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  z-index: 10;
  display: none;
}

.gf-search-results.open { display: block; }

.gf-result-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gf-result-item:hover {
  background: var(--bg-hover);
}

.gf-result-item:last-child {
  border-bottom: none;
}

.gf-result-date {
  color: var(--text-mute);
  font-size: 12px;
  min-width: 80px;
}

.gf-result-teams {
  flex: 1;
  padding: 0 12px;
  font-weight: 500;
}

.gf-result-score {
  color: var(--text-mute);
  font-size: 12px;
  min-width: 70px;
  text-align: right;
}

#gf-year-filter {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  background: white;
  cursor: pointer;
}

.gameflow-content {
  min-height: 200px;
}

.gf-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-mute);
  font-size: 15px;
  line-height: 1.8;
}

.gf-loading {
  text-align: center;
  padding: 40px;
  color: var(--text-mute);
}

/* 경기 정보 헤더 */
.gf-game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-soft);
}

.gf-game-title {
  font-weight: 700;
  font-size: 18px;
}

.gf-game-meta {
  color: var(--text-mute);
  font-size: 13px;
}

.gf-game-score {
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.gf-game-score .away,
.gf-game-score .home {
  display: inline-block;
}
.gf-game-score .winner { color: var(--pos); }
.gf-game-score .loser { color: var(--text-mute); }
.gf-game-score .vs { color: var(--text-faint); margin: 0 8px; }

/* WPA 그래프 SVG */
.wpa-chart {
  width: 100%;
  background: var(--bg-card);
  user-select: none;
}

.wpa-chart .axis-line {
  stroke: var(--border);
  stroke-width: 1;
}

.wpa-chart .axis-mid {
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

.wpa-chart .inning-line {
  stroke: var(--border-soft);
  stroke-width: 1;
}

.wpa-chart .axis-label {
  fill: var(--text-mute);
  font-size: 11px;
  font-family: inherit;
}

.wpa-chart .we-line {
  fill: none;
  stroke: var(--navy-deep);
  stroke-width: 2.2;
}

.wpa-chart .we-area-home {
  fill: rgba(10, 31, 78, 0.10);
}

.wpa-chart .we-area-away {
  fill: rgba(184, 30, 44, 0.08);
}

.wpa-chart .pa-dot {
  fill: var(--navy-deep);
  stroke: white;
  stroke-width: 1.5;
  cursor: pointer;
}

.wpa-chart .pa-dot.big {
  fill: var(--gold);
}

.wpa-chart .pa-dot:hover {
  stroke: var(--navy);
  stroke-width: 2;
}

.wpa-chart .hover-line {
  stroke: var(--text-mute);
  stroke-width: 1;
  stroke-dasharray: 2 2;
  pointer-events: none;
}

/* 호버 상세 박스 */
.wpa-tooltip {
  position: absolute;
  background: white;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 12px;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  white-space: nowrap;
  z-index: 5;
}

.wpa-tooltip-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.wpa-tooltip-line {
  color: var(--text-mute);
}

/* 큰 플레이 리스트 */
.gf-bigplays {
  margin-top: 24px;
}

.gf-bigplays-head {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 10px;
  color: var(--text);
}

.gf-bigplays-sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-mute);
  margin-left: 8px;
}

.gf-bigplay-row {
  display: flex;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
  gap: 12px;
}

.gf-bigplay-row:last-child { border-bottom: none; }

.gf-bigplay-rank {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-hover);
  color: var(--navy);
  border-radius: 50%;
  font-weight: 800;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.gf-bigplay-inning {
  font-weight: 600;
  color: var(--navy);
  min-width: 40px;
}

.gf-bigplay-batter {
  flex: 1;
}

.gf-bigplay-result {
  color: var(--text-mute);
}

.gf-bigplay-wpa {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 60px;
  text-align: right;
}

.gf-bigplay-wpa.positive { color: var(--pos); }
.gf-bigplay-wpa.negative { color: var(--neg); }

/* ============================================
   컨텍스트 바 — 헤더 아래 슬림 정보 바
============================================ */
.contextbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.contextbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.ctx-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ctx-eyebrow {
  font-size: 10px;
  font-weight: 800;
  color: var(--gold-dark);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.ctx-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--navy-deep);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.ctx-right {
  display: flex;
  gap: 32px;
}
.ctx-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.ctx-stat-num {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy-deep);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.ctx-stat-lbl {
  font-size: 10px;
  color: var(--text-mute);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
}

/* ============================================
   모드 탭 — 드롭다운 대신 가로 탭
============================================ */
.mode-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-top: 24px;
  margin-bottom: 24px;
}
.mode-tab {
  background: transparent;
  border: none;
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-mute);
  cursor: pointer;
  position: relative;
  letter-spacing: -0.005em;
  transition: color 0.15s;
  margin-bottom: -2px;
  border-bottom: 2px solid transparent;
}
.mode-tab:hover {
  color: var(--navy-deep);
}
.mode-tab.active {
  color: var(--navy-deep);
  font-weight: 700;
  border-bottom-color: var(--navy-deep);
}
.mode-tab.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gold);
  transform: translateY(2px);
}


/* ============================================
   카드 그림자 강화
============================================ */
.explorer-card,
.byco-card,
.gameflow-card {
  box-shadow: 0 2px 8px rgba(10, 31, 78, 0.06), 0 1px 2px rgba(10, 31, 78, 0.04);
  border-radius: 6px;
}

/* ============================================
   결과 영역 — 라이트 + 좌측 골드 액센트
============================================ */
.result-area {
  position: relative;
  padding: 28px 28px 28px 32px;
  background: var(--bg-card-alt);
  border-left: 1px solid var(--border-soft);
}
.result-area::before {
  /* 좌측 골드 라인 액센트 */
  content: '';
  position: absolute;
  top: 28px;
  bottom: 28px;
  left: 18px;
  width: 3px;
  background: var(--gold);
  border-radius: 2px;
}
.result-area .result-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--gold-dark);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.result-area .result-num {
  font-size: 80px;
  font-weight: 800;
  color: var(--navy-deep);
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.result-area .result-unit {
  font-size: 34px;
  font-weight: 700;
  color: var(--navy-mid);
  margin-left: 3px;
}
.result-area .result-meta {
  font-size: 13px;
  color: var(--text-mute);
  margin-top: 10px;
  margin-bottom: 16px;
  line-height: 1.65;
}
.result-area .result-meta strong {
  color: var(--navy-deep);
  font-weight: 700;
}
.result-area .result-bar {
  height: 24px;
  border-radius: 4px;
  overflow: hidden;
  border: none;
  display: flex;
  box-shadow: 0 1px 3px rgba(10, 31, 78, 0.08);
}

/* ============================================
   모드별 설명 영역
============================================ */
.mode-desc {
  margin-bottom: 24px;
}
.desc-block {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--gold);
  border-radius: 4px;
  padding: 18px 22px;
}
.desc-lead {
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.65;
  margin-bottom: 12px;
}
.desc-lead strong {
  color: var(--navy-deep);
  font-weight: 700;
}
.desc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.desc-list li {
  font-size: 12.5px;
  color: var(--text-mute);
  line-height: 1.6;
  padding: 6px 0;
  padding-left: 16px;
  position: relative;
}
.desc-list li::before {
  content: '·';
  position: absolute;
  left: 4px;
  color: var(--gold);
  font-weight: 800;
}
.desc-list li strong {
  color: var(--navy-deep);
  font-weight: 700;
}
.desc-list li em {
  color: var(--navy-mid);
  font-style: normal;
  font-weight: 600;
}
.desc-footnote {
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--text-faint);
  line-height: 1.55;
  padding: 0 6px;
}

/* 기존 page-desc 제거 (혹시 남아있다면) */
.page-desc { display: none; }

/* 작전 비교 - 분기별 표본 표시 */
.branch-n {
  color: var(--text-faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  min-width: 60px;
  text-align: right;
  font-weight: 500;
}
.branch-rel {
  vertical-align: middle;
}

/* 작전 비교 - 추정 기반 배지 */
.estimated-badge {
  display: inline-block;
  background: rgba(154, 125, 62, 0.15);
  color: var(--gold-dark);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  margin-left: 6px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: help;
}

/* ============================================
   작전 비교 - 분기 펼치기 / 서브브랜치
============================================ */
.branch-row {
  display: flex;
  flex-direction: column;
}
.branch-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 0;
}
.branch-expandable .branch-main {
  cursor: pointer;
  transition: background 0.1s;
  margin: -2px -8px;
  padding: 4px 8px;
  border-radius: 3px;
}
.branch-expandable .branch-main:hover {
  background: var(--bg-hover);
}
.branch-expander {
  display: inline-block;
  width: 12px;
  font-size: 11px;
  color: var(--text-mute);
  transition: transform 0.15s;
  user-select: none;
}
.branch-expandable.expanded .branch-expander {
  transform: rotate(90deg);
  color: var(--gold-dark);
}
.branch-expander-spacer {
  display: inline-block;
  width: 12px;
}
.sub-branches {
  margin: 6px 0 4px 26px;
  padding: 10px 14px 8px;
  background: var(--bg-card-alt);
  border-left: 2px solid var(--gold);
  border-radius: 0 3px 3px 0;
  display: none;
}
.branch-expandable.expanded .sub-branches {
  display: block;
}
.sub-header {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--gold-dark);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.sub-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  padding: 4px 0;
  border-top: 1px solid var(--border-soft);
}
.sub-row:first-of-type {
  border-top: none;
}
.sub-state {
  color: var(--text);
}
.sub-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-variant-numeric: tabular-nums;
}
.sub-n {
  color: var(--text-faint);
  font-size: 11px;
  min-width: 60px;
  text-align: right;
}
.sub-prob {
  color: var(--text-mute);
  min-width: 50px;
  text-align: right;
  font-weight: 500;
}
.sub-we {
  color: var(--navy-deep);
  font-weight: 600;
  min-width: 55px;
  text-align: right;
}
.sub-row-trivial {
  color: var(--text-faint);
  font-style: italic;
}

/* ============================================
   신뢰도 4단계 - 분기/서브브랜치 음영 처리
============================================ */
/* 분기 행 — 표본 30-99: 살짝 흐림 */
.branch-row.branch-low .branch-main {
  opacity: 0.78;
}

/* 분기 행 — 표본 < 30: 진하게 흐림 + 점선 배경 */
.branch-row.branch-very-low .branch-main {
  opacity: 0.62;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 6px,
    rgba(184, 30, 44, 0.04) 6px,
    rgba(184, 30, 44, 0.04) 12px
  );
}
.branch-row.branch-very-low .branch-main::after {
  content: '표본 매우 적음';
  font-size: 10px;
  color: var(--neg);
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-left: 8px;
}

/* 서브브랜치 — 표본 30-99 */
.sub-row.sub-low {
  opacity: 0.7;
}
.sub-row.sub-low .sub-state {
  font-style: italic;
}

/* 서브브랜치 — 표본 < 30 */
.sub-row.sub-very-low {
  opacity: 0.55;
  background: rgba(184, 30, 44, 0.04);
}
.sub-row.sub-very-low .sub-state {
  font-style: italic;
}

.sub-warn {
  font-size: 10px;
  vertical-align: middle;
  margin-left: 4px;
}

/* ============================================
   실시간 경기 흐름 (live 모드)
============================================ */
/* 빨간 LIVE 점 - 탭 + 카드 헤더 공용 */
.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e23b3b;
  margin-right: 5px;
  vertical-align: middle;
  animation: live-pulse 1.6s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(226, 59, 59, 0.5); }
  50%      { opacity: 0.5; box-shadow: 0 0 0 4px rgba(226, 59, 59, 0); }
}

/* 실시간 카드 */
.live-card {
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-soft, #e1e5eb);
  border-radius: 10px;
  margin-top: 16px;
  overflow: hidden;
}
.live-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-card-alt, #f7f8fa);
  border-bottom: 1px solid var(--border-soft, #e1e5eb);
}
.live-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
}
.live-subtitle {
  color: var(--text-mute, #888);
  font-size: 12px;
  font-weight: 400;
  margin-left: 4px;
}
.live-status {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mute, #888);
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-soft, #e1e5eb);
  padding: 3px 10px;
  border-radius: 12px;
}

/* 준비 중 placeholder */
.live-content {
  padding: 20px;
}
.live-placeholder {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-mute, #888);
}
.live-placeholder-icon {
  font-size: 40px;
  margin-bottom: 12px;
}
.live-placeholder-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text, #333);
  margin-bottom: 10px;
}
.live-placeholder-desc {
  font-size: 13px;
  line-height: 1.7;
}

/* 실시간 - 경기 선택 바 */
.live-game-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.live-game-btn {
  background: var(--bg-card-alt, #f7f8fa);
  border: 1px solid var(--border-soft, #e1e5eb);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.live-game-btn.active {
  border-color: var(--navy-deep, #0a1f4e);
  background: var(--navy-deep, #0a1f4e);
  color: #fff;
}
.live-game-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(0,0,0,0.1);
}
.live-game-badge.s2 { background: #e23b3b; color: #fff; }

/* 실시간 - 경기 상태 뱃지 (LIVE / 종료) */
.live-now-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #e23b3b;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 11px;
  margin-left: 8px;
  vertical-align: middle;
}
.live-now-badge .live-dot {
  background: #fff;
}
.live-done-badge {
  display: inline-block;
  background: var(--bg-card-alt, #eee);
  color: var(--text-mute, #888);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 11px;
  margin-left: 8px;
  vertical-align: middle;
}

/* ============================================================
   홈 화면
============================================================ */
.home-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 22px;
}

/* --- 히어로 --- */
.home-hero {
  position: relative;
  background: var(--navy-deep);
  border-bottom: 2px solid var(--gold);
  padding: 40px 36px;
  min-height: 210px;
  display: flex;
  align-items: center;
  overflow: hidden;
}
.home-hero-text {
  position: relative;
  z-index: 2;
}
.home-eyebrow {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--gold);
  margin-bottom: 12px;
}
.home-title {
  font-size: 40px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 0 0 10px;
}
.home-tagline {
  font-size: 15.5px;
  color: rgba(255, 255, 255, 0.72);
  margin: 0;
  line-height: 1.6;
}
.home-hero-mascots {
  position: absolute;
  right: 32px;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  z-index: 1;
}
.home-mascot {
  height: 168px;
  width: auto;
  display: block;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.3));
}

/* --- 본문 --- */
.home-body {
  padding: 26px 28px 30px;
}
.home-section-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-dark);
  margin-bottom: 12px;
}
.home-section-label:not(:first-child) {
  margin-top: 30px;
}

/* --- 오늘의 NC --- */
.home-today-band {
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  font-size: 14.5px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
}
.home-today-none {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-soft);
  color: var(--text-mute);
}
.home-today-game {
  background: var(--navy-deep);
  color: #fff;
}
.home-today-date {
  font-weight: 700;
  color: var(--gold);
}
.home-today-game .home-today-vs {
  font-weight: 700;
}
.home-today-meta {
  color: rgba(255, 255, 255, 0.65);
  font-size: 13px;
}
.home-today-none .home-today-next {
  color: var(--navy-mid);
  font-weight: 600;
}
.home-today-live {
  margin-left: auto;
  background: var(--gold);
  color: var(--navy-deep);
  font-weight: 700;
  font-size: 13px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  cursor: pointer;
  transition: filter 0.15s;
}
.home-today-live:hover { filter: brightness(1.08); }

/* --- 모드 카드 --- */
.home-modes {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.home-mode {
  position: relative;
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 16px 16px;
  cursor: pointer;
  transition: transform 0.14s, box-shadow 0.14s, background 0.14s;
}
.home-mode:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  background: var(--bg-card-alt);
}
.home-mode-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy-deep);
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.home-mode-desc {
  font-size: 13px;
  color: var(--text-mute);
  line-height: 1.6;
}
.home-mode-arrow {
  position: absolute;
  top: 16px;
  right: 16px;
  color: var(--gold-dark);
  font-size: 15px;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.14s, transform 0.14s;
}
.home-mode:hover .home-mode-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* --- 푸터 라인 --- */
.home-foot {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border-soft);
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
  letter-spacing: 0.02em;
}

@media (max-width: 980px) {
  .home-modes { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
  .home-hero { padding: 28px 22px; min-height: 0; }
  .home-title { font-size: 30px; }
  .home-hero-mascots { display: none; }
  .home-body { padding: 22px 18px 26px; }
  .home-modes { grid-template-columns: repeat(2, 1fr); }
}

/* 홈 진입 애니메이션 (홈 화면 한정 — 부드러운 첫인상) */
@keyframes homeRise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.home-hero-text    { animation: homeRise 0.5s ease-out both; }
.home-hero-mascots { animation: homeRise 0.6s ease-out 0.1s both; }
.home-mode         { animation: homeRise 0.45s ease-out both; }
.home-mode:nth-child(1) { animation-delay: 0.08s; }
.home-mode:nth-child(2) { animation-delay: 0.13s; }
.home-mode:nth-child(3) { animation-delay: 0.18s; }
.home-mode:nth-child(4) { animation-delay: 0.23s; }
.home-mode:nth-child(5) { animation-delay: 0.28s; }

@media (prefers-reduced-motion: reduce) {
  .home-hero-text, .home-hero-mascots, .home-mode { animation: none; }
}
