/* ==========================================================================
   멀티보드 관리자 — board.css (화면 전용)
   ========================================================================== */

/* --------------------------------------------------------------------------
   로딩 오버레이
   -------------------------------------------------------------------------- */
   .loading-overlay { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; background: rgba(7, 11, 16, 0.80); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
   body.loading .loading-overlay { opacity: 0.7; pointer-events: all; }
   
   @keyframes mb-spin { to { transform: rotate(360deg); } }
   .loading-spinner { width: 50px; height: 50px; border: 5px solid #1E2833; border-top-color: #3B6CF5; border-radius: 50%; animation: mb-spin 0.75s linear infinite; }
   
   /* --------------------------------------------------------------------------

/* --------------------------------------------------------------------------
   전체 래퍼
   -------------------------------------------------------------------------- */
.mb-wrap { display: flex; flex-direction: column; height: 100vh; min-height: 0; overflow: hidden; background: #070B10; }

/* --------------------------------------------------------------------------
   상단 헤더
   -------------------------------------------------------------------------- */
.mb-header { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; gap: 24px; height: 60px; padding: 0 20px; background: #05080C; border-bottom: 1px solid #1A222C;}

/* 좌측 경기 정보 */
.game-info { display: flex; align-items: center; flex-wrap: nowrap;}
.game-info p { font-size: 2rem; font-weight: 700; line-height: 1.2; color: #fff; white-space: nowrap;}
.game-info p:not(:last-of-type)::after { content: '|'; margin: 0 10px; color: #5F6872;}

/* 우측 헤더 액션 */
.mb-header-actions { display: flex; align-items: center; flex-shrink: 0; gap: 8px; }

/* 헤더 상태 토글 — 공통 */
.mb-state-group { display: inline-flex; align-items: center; height: 32px; padding: 3px; background: #111820; border: 1px solid #404b57; border-radius: 6px; }
.mb-state-label { flex-shrink: 0; padding: 0 10px 0 7px; font-size: 1.4rem; font-weight: 600; line-height: 1; color: #FFFFFF; white-space: nowrap; }
.mb-segment { display: inline-flex; align-items: center; gap: 2px; padding-right: 2px; }
.mb-header .mb-segment button { height: 26px; min-width: 0; padding: 0 12px; background: transparent; border: 0; border-radius: 4px; font-size: 1.4rem; font-weight: 600; color: #6B7580; transition: background 0.15s ease, color 0.15s ease; }
.mb-header .mb-segment button:hover { color: #BFC7CE; background: #151920; }
.mb-header .mb-segment button:active { color: #BFC7CE; transform: none; }
.mb-header .mb-segment button:focus-visible { border: 1px solid rgba(255,255,255,0.85); box-shadow: 0 0 0 2px rgba(255,255,255,0.08); }

/* 헤더 상태 토글 — game / control 전용 */
.mb-state-group.game .mb-segment button.active { background: #3B6CF5; color: #FFFFFF; }
.mb-state-group.game .mb-segment button.active:hover { background: #4A78F6; color: #FFFFFF; }
.mb-state-group.control .mb-segment button.active { background: #0D9B7A; color: #FFFFFF; }
.mb-state-group.control .mb-segment button.active:hover { background: #10AD88; color: #FFFFFF; }
.mb-state-group.shortcut .mb-segment button.active { background: #7C4DFF; color: #FFFFFF; }
.mb-state-group.shortcut .mb-segment button.active:hover { background: #8F5FFF; color: #FFFFFF; }
.mb-header .mb-segment button.active,
.mb-header .mb-segment button.active:active { border: 0; color: #FFFFFF; }

/* 헤더 기능 버튼 */
.mb-tool-group { display: flex; align-items: center; gap: 4px; margin-left: 4px; }
.btn.mb-tool-btn { height: 32px; padding: 0 10px; gap: 6px; background: #151D26; font-size: 1.4rem; }
.btn.mb-tool-btn:hover { background: #1A2430; }
.btn.icon-btn.mb-icon-btn { width: 38px; height: 32px; background: #151D26; }
.btn.icon-btn.mb-icon-btn:hover { background: #1A2430; }
.mb-header .mb-tool-group .mb-icon-btn img { width: 18px; height: 18px; }
.mb-header .mb-tool-group .mb-tool-btn img { display: block; width: 14px; height: 14px; }

/* --------------------------------------------------------------------------
   본문 레이아웃 (영역 구분)
   -------------------------------------------------------------------------- */
.mb-zone-label { font-size: 1.6rem; font-weight: 600; color: #8B949E; text-align: center; white-space: nowrap; }
.mb-board { display: flex; flex: 1; flex-direction: column; min-height: 0; padding: 12px; overflow: hidden; box-sizing: border-box; }
.mb-layout { display: grid; flex: 1; grid-template-columns: 560px minmax(0, 1fr); gap: 8px; min-height: 0; height: 100%; box-sizing: border-box; }
.mb-layout-left { display: flex; flex-direction: column; gap: 8px; width: 560px; min-width: 560px; min-height: 0; height: 100%; box-sizing: border-box; }
.mb-layout-main { display: grid; grid-template-rows: minmax(0, calc(55% + 100px)) minmax(340px, calc(45% - 100px)); gap: 8px; min-height: 0; box-sizing: border-box; }
.mb-layout-top { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; min-height: 0; box-sizing: border-box; }
.mb-zone { display: flex; align-items: center; justify-content: center; min-height: 0; padding: 12px; border: 1px solid #2b3740; border-radius: 4px; background: #121A23; box-sizing: border-box; overflow: hidden; }

/* --------------------------------------------------------------------------
   영역 포커스 표시 — active-zone
   outline 사용: overflow·자식 배경에 가려지지 않고 항상 최상위 렌더링.
   outline-offset: -1px → 기존 border 안쪽에 겹쳐 레이아웃 변화 없음.
   동시에 하나의 mb-zone에만 적용 (JS로 관리)
   -------------------------------------------------------------------------- */
.active-zone { outline: 2px solid rgba(255, 255, 255, 0.72); outline-offset: -1px; z-index: 2; }
.zone-score { flex: 0 0 auto; min-height: 180px; flex-direction: column; align-items: stretch; justify-content: flex-start; height: auto; padding: 8px; gap: 8px; overflow: visible; }
.zone-score-ctrl { flex: 0 0 auto; flex-direction: column; align-items: stretch; justify-content: flex-start; height: auto; padding: 6px; overflow: visible; }
.zone-event { flex: 1 1 auto; flex-direction: column; align-items: stretch; justify-content: flex-start; min-height: 140px; padding: 6px; overflow: hidden; }

/* --------------------------------------------------------------------------
   패널 공통 헤더 (필드뷰, 라인업 등)
   -------------------------------------------------------------------------- */
.panel-head { display: flex; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 8px; min-height: 0; padding: 10px 12px; border-bottom: 1px solid #2b3740; box-sizing: border-box; }
.panel-titwrap { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.panel-tit { font-size: 1.6rem; font-weight: 700; line-height: 1.2; color: #8B949E; white-space: nowrap; }
.panel-sub { font-size: 1.5rem; font-weight: 700; line-height: 1.2; color: #FFFFFF; white-space: nowrap; }
.panel-notice { display: inline-flex; flex-shrink: 0; align-items: center; gap: 4px; height: 28px; padding: 0 8px; color: #BFC7CE; font-size: 1.3rem; font-weight: 500; line-height: 1; white-space: nowrap; }
.panel-notice .panel-ico { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; border: 1px solid #5F6872; border-radius: 50%; font-size: 1.0rem; font-weight: 700; line-height: 1; color: #BFC7CE; }

/* --------------------------------------------------------------------------
   공통 팝오버 팝업 (pitcher-modal 패턴 — 라인업, 경기 설정 등에서 재사용)
   -------------------------------------------------------------------------- */

/* 오버레이 없음 — 포인터 이벤트만 투명 통과, 팝업 자체는 받음 */
.pitcher-modal-overlay { position: fixed; inset: 0; z-index: 300; pointer-events: none; }
.pitcher-modal-overlay[hidden] { display: none; }

/* 팝업 카드 — top/left는 JS에서 클릭 위치 기반으로 설정 */
.pitcher-modal { position: fixed; pointer-events: all; width: 220px; background: #141C26; border: 1px solid #3A4654; border-radius: 8px; padding: 14px 14px 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.3); }

.pitcher-modal-title { margin: 0 0 3px; font-size: 1.5rem; font-weight: 800; line-height: 1.2; color: #FFFFFF; }
.pitcher-modal-desc { margin: 0 0 10px; font-size: 1.2rem; font-weight: 500; line-height: 1.4; color: #8B949E; }

/* max-height = 항목 38px × 4개 + 상하 패딩 8px → 5번째부터 스크롤 */
.pitcher-modal-list { margin: 0 0 10px; padding: 4px 0; list-style: none; display: flex; flex-direction: column; gap: 1px; border-top: 1px solid #1E2833; border-bottom: 1px solid #1E2833; max-height: 160px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #3C4652 transparent; }
.pitcher-modal-list::-webkit-scrollbar { width: 3px; }
.pitcher-modal-list::-webkit-scrollbar-thumb { background: #3C4652; border-radius: 999px; }
.pitcher-modal-list::-webkit-scrollbar-track { background: transparent; }

.pitcher-modal-item { display: grid; grid-template-columns: 12px 1fr 16px; align-items: center; gap: 10px; min-height: 38px; padding: 0 8px; border: 0; border-radius: 4px; background: transparent; cursor: pointer; text-align: left; transition: background 0.12s ease; width: 100%; }
.pitcher-modal-item:hover { background: rgba(255, 255, 255, 0.05); }
.pitcher-modal-item.selected { background: rgba(255, 255, 255, 0.06); }
.pitcher-modal-item:focus-visible { outline: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.3); }

.pitcher-modal-chip { flex-shrink: 0; width: 10px; height: 10px; border-radius: 2px; }

.pitcher-modal-name { font-size: 1.3rem; font-weight: 600; line-height: 1.3; color: #FFFFFF; }
.pitcher-modal-sub { font-size: 1.2rem; font-weight: 500; color: #8B949E; }

.pitcher-modal-check { display: flex; align-items: center; justify-content: center; width: 16px; height: 16px; opacity: 0; flex-shrink: 0; }
.pitcher-modal-check::after { content: ''; display: block; width: 5px; height: 9px; border-right: 2px solid #0D9B7A; border-bottom: 2px solid #0D9B7A; transform: rotate(45deg) translateY(-1px); }
.pitcher-modal-item.selected .pitcher-modal-check { opacity: 1; }

.pitcher-modal-actions { display: flex; gap: 6px; }
.btn.pitcher-modal-apply { flex: 1; height: 34px; border-radius: 5px; background: #0D9B7A; border-color: #0D9B7A; color: #FFFFFF; font-size: 1.3rem; font-weight: 700; }
.btn.pitcher-modal-apply:hover { background: #10AD88; border-color: #10AD88; }
.btn.pitcher-modal-cancel { flex: 1; height: 34px; border-radius: 5px; background: #0B1118; border: 1px solid #3D4854; color: #FFFFFF; font-size: 1.3rem; font-weight: 600; }
.btn.pitcher-modal-cancel:hover { background: #151D26; border-color: #5F6872; }
