/* ── 구장 트래킹 (구 '구장 LIVE', 라이브 패널 최상위 탭 · live-stadium.js) ──────────
   live-board.css 의 패널(390~460px 폭)·모바일·PC 와이드 규격 반응형 지원 */

/* 최상위 탭 [구장 LIVE | 문자중계] */
.lv-top-tabs {
    display: flex;
    margin-bottom: 8px;
    border: 1px solid #e3e8ef;
    border-radius: 6px;
    overflow: hidden;
}
.lv-top-tabs button {
    flex: 1 1 0;
    font-size: 12px;
    font-weight: 700;
    color: #555;
    background: #f8f9fa;
    border: none;
    border-right: 1px solid #e3e8ef;
    padding: 7px 0;
    cursor: pointer;
}
.lv-top-tabs button:last-child { border-right: none; }
.lv-top-tabs button.active { background: #e04050; color: #fff; }
#lv-view-stadium { --team-color: #1D467D; --lv-accent: #1D467D; }

/* 헤더 행 (탭 + 다크/라이트 테마 토글 버튼) */
.lvs-head-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.lvs-head-row .lv-tabs {
    margin-bottom: 0;
    flex: 1 1 auto;
}
.lvs-theme-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 28px;
    font-size: 11px;
    font-weight: 700;
    padding: 0 10px;
    border-radius: 14px;
    cursor: pointer;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.lvs-theme-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

/* 상태줄 */
.lvs-status {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 8px;
}
.lvs-status:empty { display: none; margin: 0; }
.lvs-status .lvs-on { font-size: 12px; font-weight: 700; color: #1D467D; }
.lvs-status .lvs-on code {
    font-size: 10px;
    font-weight: 500;
    color: #888;
    background: #f4f6f9;
    border-radius: 3px;
    padding: 1px 4px;
}
.lvs-status .lvs-off { font-size: 12px; font-weight: 600; color: #85575e; }
.lvs-status .lvs-sub { font-size: 10px; color: #999; }
.lvs-status .lvs-warn { color: #d63344; font-style: normal; font-weight: 600; }

/* 셀렉트 줄 */
.lvs-selrow { display: flex; gap: 6px; margin-bottom: 6px; }
.lvs-sel {
    flex: 1 1 auto;
    min-width: 0;
    height: 30px;
    font-size: 11.5px;
    color: #333;
    background: #fff;
    border: 1px solid #cfd8e3;
    border-radius: 6px;
    padding: 0 8px;
    box-sizing: border-box;
    cursor: pointer;
}
.lvs-selrow .reg-cselect { flex: 1 1 auto; min-width: 0; }
.lvs-selrow-half .reg-cselect { flex: 1 1 50%; min-width: 0; }
.lvs-cselect .reg-trigger {
    width: 100%;
    height: 30px;
    box-sizing: border-box;
}
.lvs-cselect .reg-dd-panel { left: 0; right: 0; min-width: 0; width: auto; }

/* ── PC / 모바일 반응형 상세 레이아웃 ── */
.lvs-detail-layout {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* PC 와이드 뷰 (태블릿/데스크톱 가로 화면) */
@media (min-width: 860px) {
    .lvs-detail-layout {
        display: grid;
        grid-template-columns: 1fr 1.12fr;
        gap: 14px;
        align-items: start;
    }
}

.lvs-detail-left,
.lvs-detail-right {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* 투구 정보 헤더 */
.lvs-pitch-head {
    grid-column: 1 / -1;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12.5px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e2e8f0;
    line-height: 1.5;
}
.lvs-pitch-head .lvs-head-l {
    min-width: 0;
    color: inherit;
}
.lvs-pitch-head .lvs-sub {
    font-size: 11px;
    font-weight: 500;
    color: #64748b;
}
.lvs-pitch-head .lvs-head-off { color: #85575e; }
.lvs-pitch-head .lvs-head-upd {
    flex: 0 0 auto;
    font-size: 10px;
    font-weight: 500;
    color: #999;
    white-space: nowrap;
}

/* 12개 KPI 카드 (가독성 대폭 향상: 숫자 16~18px 볼드체) */
.lvs-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 4px;
}
.lvs-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    padding: 7px 8px;
    min-width: 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    transition: transform 0.1s, border-color 0.2s;
}
.lvs-card:hover {
    border-color: #cbd5e1;
}
.lvs-card-t {
    font-size: 10.5px;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lvs-card-v {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
    white-space: nowrap;
    letter-spacing: -0.3px;
}
.lvs-card-v small {
    font-size: 10px;
    font-weight: 600;
    color: #94a3b8;
    margin-left: 2px;
}
.lvs-empty { font-size: 12px; color: #888; padding: 16px 0; text-align: center; }

/* 3D 존 */
.lvs-3d-wrap { margin-top: 2px; }
.lvs-3d {
    position: relative;
    width: 100%;
    height: 260px;
    border-radius: 8px;
    background: #101a2e;
}
@media (min-width: 860px) {
    .lvs-3d { height: 280px; }
}
.lvs-3d canvas { display: block; border-radius: 8px; pointer-events: none; }
.lvs-3d-ov { position: absolute; z-index: 5; display: flex; gap: 4px; }
.lvs-3d-ov-tl { top: 6px; left: 6px; flex-direction: column; align-items: stretch; }
.lvs-3d-ov-tl .lvs-3d-vbtn { text-align: center; }
.lvs-3d-ov-br { right: 6px; bottom: 6px; flex-direction: column; }

.lvs-3d-vbtn {
    flex: 0 0 auto;
    height: 24px;
    font-size: 10px;
    font-weight: 600;
    color: #444;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid #cfd8e3;
    border-radius: 5px;
    padding: 0 8px;
    cursor: pointer;
}
.lvs-3d-vbtn:hover { background: #eef2f7; }
.lvs-3d-vbtn.active { background: #1D467D; border-color: #1D467D; color: #fff; }
.lvs-3d-btn {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    font-size: 11px;
    color: #555;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #cfd8e3;
    border-radius: 5px;
    padding: 0;
    cursor: pointer;
}
.lvs-3d-btn:hover { background: #eef2f7; }
.lvs-3d-btn.active { background: #1D467D; border-color: #1D467D; color: #fff; }
.lvs-3d-wrap.lvs-unlock .lvs-3d { touch-action: none; }
.lvs-3d-wrap.lvs-unlock .lvs-3d canvas { pointer-events: auto; }

.lvs-3d-wrap.lvs-fs {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    box-sizing: border-box;
    background: #101a2e;
}
.lvs-3d-wrap.lvs-fs .lvs-3d { flex: 1 1 auto; height: auto; min-height: 0; border-radius: 6px; }
.lvs-3d-wrap.lvs-fs .lvs-3d-foot { flex: 0 0 auto; }
.lvs-3d-wrap.lvs-fs .lvs-3d-foot .lvs-3d-hint { color: #8a94a6; }
.lvs-3d-wrap.lvs-fake-fs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    width: 100dvw;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    max-height: none;
    z-index: 100000;
}
html.lvs-fs-lock,
html.lvs-fs-lock body {
    overflow: hidden;
    overscroll-behavior: none;
    background: #101a2e;
}
html.lvs-fs-lock body::after { background: #101a2e; }

.lvs-3d-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
}
.lvs-3d-hint { font-size: 9.5px; color: #94a3b8; }
.lvs-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 800;
    border-radius: 5px;
    padding: 2px 10px;
}
.lvs-badge-in { color: #15803d; border: 1.5px solid #22c55e; background: #f0fdf4; }
.lvs-badge-out { color: #b91c1c; border: 1.5px solid #ef4444; background: #fef2f2; }

/* 2D 존 3분할 */
.lvs-2d-row {
    display: flex;
    gap: 5px;
    margin-top: 6px;
}
.lvs-2d-cell { flex: 1 1 0; min-width: 0; }
.lvs-2d-title { font-size: 10px; font-weight: 700; color: #64748b; text-align: center; margin-bottom: 2px; }
.lvs-2d-cell canvas {
    width: 100%;
    display: block;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

/* 구종 범례 */
.lvs-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 3px 8px;
    margin-top: 6px;
}
.lvs-chip { font-size: 9.5px; color: #64748b; white-space: nowrap; }
.lvs-chip i {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 3px;
    vertical-align: -1px;
}

/* 하위 탭 아래 여백 */
#lvs-pane-graph,
#lvs-pane-log { margin-top: 8px; }

/* 그래프 */
.lvs-graph {
    width: 100%;
    display: block;
    margin-top: 4px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

/* 로그 테이블 */
.lvs-csv-btn {
    flex: 0 0 auto;
    height: 30px;
    font-size: 11px;
    font-weight: 700;
    color: #1D467D;
    background: #fff;
    border: 1px solid #cfd8e3;
    border-radius: 6px;
    padding: 0 12px;
    cursor: pointer;
}
.lvs-csv-btn:hover { background: #eef2f7; }
.lvs-log-scroll {
    overflow: auto;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: auto;
    max-height: 440px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}
.lvs-log { width: auto; min-width: 100%; }
.lvs-log thead th { position: sticky; top: 0; background: #f8fafc; z-index: 1; font-weight: 700; color: #475569; }

/* 그래프 툴팁 */
.lvs-graph-tt {
    position: absolute;
    pointer-events: none;
    z-index: 10;
    background: rgba(15, 23, 42, 0.94);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    line-height: 1.4;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(4px);
    transition: opacity 0.1s ease;
}
.lvs-tt-head {
    font-weight: 700;
    font-size: 11.5px;
    margin-bottom: 2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 2px;
}
.lvs-tt-row { color: #e2e8f0; font-size: 10.5px; }
.lvs-tt-lbl { color: #94a3b8; font-weight: 600; }

/* ==============================================================================
   🌓 다크 모드 (Dark Mode) 테마 스타일
   ============================================================================== */
#lv-view-stadium.lvs-dark,
.lvs-dark {
    color: #f1f5f9;
}
.lvs-dark .lvs-card {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.lvs-dark .lvs-card:hover {
    border-color: #475569;
}
.lvs-dark .lvs-card-t { color: #94a3b8; }
.lvs-dark .lvs-card-v { color: #f8fafc; }
.lvs-dark .lvs-card-v small { color: #94a3b8; }

.lvs-dark .lvs-pitch-head,
.lvs-dark .lvs-pitch-head .lvs-head-l,
.lvs-dark .lvs-pitch-head span {
    color: #f8fafc !important;
    border-bottom-color: #334155;
}
.lvs-dark .lvs-pitch-head .lvs-sub {
    color: #94a3b8 !important;
}
.lvs-dark .lvs-pitch-head .lvs-head-off {
    color: #f87171 !important;
}
.lvs-dark .lvs-pitch-head .lvs-head-upd {
    color: #64748b !important;
}

.lvs-dark .lvs-sel {
    background: #1e293b;
    color: #f1f5f9;
    border-color: #475569;
}
.lvs-dark .lvs-theme-btn {
    background: #1e293b;
    color: #f8fafc;
    border-color: #475569;
}
.lvs-dark .lvs-theme-btn:hover {
    background: #334155;
}

.lvs-dark .lv-tabs button {
    background: #1e293b;
    color: #94a3b8;
    border-color: #334155;
}
.lvs-dark .lv-tabs button.active {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
}

.lvs-dark .lvs-badge-in {
    color: #4ade80;
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.15);
}
.lvs-dark .lvs-badge-out {
    color: #f87171;
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

.lvs-dark .lvs-2d-title { color: #94a3b8; }
.lvs-dark .lvs-2d-cell canvas { border-color: #334155; }
.lvs-dark .lvs-legend .lvs-chip { color: #cbd5e1; }

.lvs-dark .lvs-graph {
    border-color: #334155;
    background: #0f172a;
}
.lvs-dark .lvs-log-scroll {
    border-color: #334155;
    background: #0f172a;
}
.lvs-dark .lvs-log thead th {
    background: #1e293b;
    color: #cbd5e1;
    border-bottom: 1px solid #334155;
}
.lvs-dark .lvs-log tbody td {
    border-bottom: 1px solid #1e293b;
    color: #e2e8f0;
}
.lvs-dark .lvs-csv-btn {
    background: #1e293b;
    color: #38bdf8;
    border-color: #475569;
}
.lvs-dark .lvs-csv-btn:hover {
    background: #334155;
}

/* ==============================================================================
   🌓 다크 패널 및 텍스트 가독성 강화 (Dark Theme High-Contrast Enforcement)
   ============================================================================== */
.live-panel.lvs-dark-panel,
#live-panel.lvs-dark-panel,
.lvs-dark-panel {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}
.live-panel.lvs-dark-panel .live-panel-header,
#live-panel.lvs-dark-panel .live-panel-header {
    border-bottom-color: #334155 !important;
}
.live-panel.lvs-dark-panel .live-panel-title,
#live-panel.lvs-dark-panel .live-panel-title {
    color: #f8fafc !important;
}
.live-panel.lvs-dark-panel .lv-top-tabs,
#live-panel.lvs-dark-panel .lv-top-tabs {
    border-color: #334155 !important;
}
.live-panel.lvs-dark-panel .lv-top-tabs button,
#live-panel.lvs-dark-panel .lv-top-tabs button {
    background: #1e293b !important;
    color: #94a3b8 !important;
    border-right-color: #334155 !important;
}
.live-panel.lvs-dark-panel .lv-top-tabs button.active,
#live-panel.lvs-dark-panel .lv-top-tabs button.active {
    background: #e04050 !important;
    color: #ffffff !important;
}

/* 다크모드에서 투구 헤더 텍스트 100% 화이트/고대비 보장 */
#lv-view-stadium.lvs-dark .lvs-pitch-head,
.lvs-dark .lvs-pitch-head,
.lvs-dark-panel .lvs-pitch-head {
    color: #f8fafc !important;
    border-bottom-color: #334155 !important;
}

#lv-view-stadium.lvs-dark .lvs-pitch-head .lvs-head-l,
.lvs-dark .lvs-pitch-head .lvs-head-l,
.lvs-dark-panel .lvs-pitch-head .lvs-head-l {
    color: #f8fafc !important;
}

#lv-view-stadium.lvs-dark .lvs-pitch-head .lvs-sub,
.lvs-dark .lvs-pitch-head .lvs-sub,
.lvs-dark-panel .lvs-pitch-head .lvs-sub {
    color: #94a3b8 !important;
}

#lv-view-stadium.lvs-dark .lvs-pitch-head .lvs-head-off,
.lvs-dark .lvs-pitch-head .lvs-head-off,
.lvs-dark-panel .lvs-pitch-head .lvs-head-off {
    color: #f87171 !important;
}

#lv-view-stadium.lvs-dark .lvs-pitch-head .lvs-head-upd,
.lvs-dark .lvs-pitch-head .lvs-head-upd,
.lvs-dark-panel .lvs-pitch-head .lvs-head-upd {
    color: #64748b !important;
}
