/* ===== 전역 설정: 다크 모드 테마 ===== */
:root {
    --bg-base: #0f172a;       /* 가장 바깥 배경 */
    --bg-side: #0b0f1a;       /* 사이드바 배경 */
    --bg-panel: #1e293b;      /* 컨트롤 패널/카드 배경 */
    --bg-active: #2d3a4f;     /* 활성화된 요소 배경 */
    
    --accent: #38bdf8;        /* 스카이 블루 (타자/포커스) */
    --hit: #10b981;           /* 초록 (안타) */
    --out: #ef4444;           /* 빨강 (타자 아웃) */
    --k-pitcher: #f472b6;     /* 핑크 (투수 탈삼진 K) */
    --run: #f59e0b;           /* 주황 (실점) */
    --inning: #8b5cf6;        /* 보라 (이닝) */
    
    --text-main: #f3f4f6;     /* 메인 텍스트 */
    --text-dim: #94a3b8;      /* 보조 텍스트 */
    --border: #334155;        /* 경계선 색상 */
}

* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100vh;
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: 'Pretendard', -apple-system, sans-serif;
    overflow: hidden; /* 전체 화면 스크롤 방지 */
}

/* ===== 메인 레이아웃 (3단 분할) ===== */
.main-layout {
    display: grid;
    grid-template-columns: 320px 1fr 300px;
    height: 100vh;
}

/* ===== 사이드바 공통 ===== */
.lineup-aside, .status-aside {
    background: var(--bg-side);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px;
    height: 100vh;
}

/* 사이드바 헤더 및 타자 추가 버튼 */
.side-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.side-header h3 {
    font-size: 14px;
    color: var(--accent);
    margin: 0;
    letter-spacing: 1px;
}

.btn-add-hitter {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
}

.btn-add-hitter:hover {
    background: var(--accent);
    color: white;
}

/* 스크롤 영역 */
.scroll-area {
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
}

.scroll-area-small {
    flex: 0.6;
    overflow-y: auto;
    margin-bottom: 15px;
}

/* ===== 타자/투수 카드 스타일 ===== */
.hitter-card {
    background: var(--bg-panel);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 12px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: 0.2s;
}

.hitter-card.active {
    border-color: var(--accent);
    background: var(--bg-active);
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.15);
}

.num {
    font-size: 20px;
    font-weight: 900;
    color: var(--accent);
    margin-bottom: 8px;
}

.name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.arrow {
    color: var(--accent);
    font-weight: bold;
}

.p-name {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    color: white;
    font-weight: 700;
    width: 90px;
    outline: none;
}

.p-log-text {
    font-size: 12px;
    color: var(--text-dim);
    background: rgba(0,0,0,0.2);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ===== 중앙 컨트롤 영역 ===== */
.control-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
}

.field-view {
    width: 180px;
    height: 180px;
    margin-bottom: 25px;
}

.diamond {
    width: 140px;
    height: 140px;
    border: 2px solid var(--border);
    transform: rotate(45deg);
    margin: 20px auto;
    position: relative;
}

.base {
    position: absolute;
    width: 30px;
    height: 30px;
    background: #475569;
    border: 3px solid var(--bg-base);
    cursor: pointer;
}

.base.active {
    background: var(--out);
    box-shadow: 0 0 15px var(--out);
}

.b1 { top: -15px; right: -15px; }
.b2 { top: -15px; left: -15px; }
.b3 { bottom: -15px; left: -15px; }

/* ===== 버튼 조작 패널 ===== */
.action-buttons {
    background: var(--bg-panel);
    padding: 25px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 580px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.group p {
    font-size: 11px;
    font-weight: 900;
    color: var(--text-dim);
    margin: 0;
    letter-spacing: 1px;
}

.btn-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

button {
    padding: 14px 5px;
    border: none;
    border-radius: 10px;
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
    color: white;
    transition: 0.1s;
}

button:active { transform: scale(0.95); filter: brightness(1.2); }

/* 버튼 색상군 */
.btn-hit { background: var(--hit); }
.btn-out { background: var(--out); }
.btn-k { background: var(--k-pitcher); } /* 투수 탈삼진 전용 */
.btn-run { background: var(--run); }
.btn-inning { background: var(--inning); }
.btn-etc, .btn-undo { background: #475569; }

/* 복사 버튼 */
.btn-copy {
    background: var(--accent);
    padding: 18px;
    font-size: 16px;
    margin-top: 10px;
    box-shadow: 0 4px 0 #0369a1;
}

/* ===== 우측 사이드바 보조 요소 ===== */
.current-focus {
    background: var(--bg-panel);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 20px;
    border-top: 4px solid var(--accent);
}

#focus-name {
    font-size: 26px;
    margin: 10px 0;
    font-weight: 900;
}

.pitcher-row {
    background: var(--bg-base);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 10px;
    border-left: 4px solid var(--accent);
}

.p-stats-display {
    margin-top: 8px;
    color: #fbbf24; /* 골드 색상으로 스탯 강조 */
    font-size: 14px;
    font-weight: 900;
}

/* 스크롤바 커스텀 */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }