/*
 * 팀·선수 통계 페이지 공용 스타일입니다(team-stats.html 에서 옮김).
 * 앞부분은 팀 통계 화면 그대로입니다. 고치지 말고, 선수 통계용 규칙은 뒤에 붙입니다.
 */
[hidden] { display: none !important; }
.tabbtn { background: transparent; color: inherit; border: 1px solid #94a3b8; border-radius: 8px; padding: 0.4rem 0.9rem; cursor: pointer; font-size: 0.9rem; font-weight: 600; white-space: nowrap; flex-shrink: 0; font-family: inherit; }
.tabbtn.active { background: #3b82f6; color: #fff; border-color: #3b82f6; }
.tabbtn:hover { border-color: #3b82f6; }
.tabbtn:disabled { opacity: 0.45; cursor: not-allowed; }
a.tabbtn { text-decoration: none; display: inline-flex; align-items: center; }
/* factor-stats(.fs-tab)와 같은 밑줄형 탭 */
.fs-tabs { display: flex; justify-content: center; gap: 0.5rem; border-bottom: 2px solid var(--border-color); margin-bottom: 1rem; flex-wrap: wrap; }
.fs-tab { background: none; border: none; padding: 0.7rem 1.4rem; font-size: 1rem; font-weight: 600; font-family: inherit; color: var(--text-secondary); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.fs-tab:hover { color: var(--primary); }
.fs-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
/* 묶음 버튼(사각형, CSV 버튼과 같은 모양) */
.ts-groups { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0 0 0.9rem; }
/* 고르개 줄 */
.ctrl-bar { display: flex; align-items: center; gap: 0.7rem 1.5rem; flex-wrap: wrap; padding: 0.75rem 1rem !important; }
.ctrl-card { padding: 0 !important; margin-bottom: 1rem !important; }
.ctrl-card:hover, .ts-card:hover { transform: none; }
.ctrl-group { display: flex; align-items: center; gap: 0.6rem; flex-wrap: nowrap; flex-shrink: 0; }
.ctrl-group label { white-space: nowrap; flex-shrink: 0; margin: 0; }
.ctrl-group .tabbtn { height: 37px; box-sizing: border-box; }
/* CSV·링크 복사·기록실은 표 카드 제목 줄 오른쪽에 둡니다. */
.ts-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.ts-actions .tabbtn { height: 34px; box-sizing: border-box; }
@media (max-width: 640px) { .ts-card .card-header { flex-wrap: wrap; gap: 0.5rem; } }
.ts-table.ts-month { width: auto; min-width: 60%; }
.ctrl-divider { align-self: stretch; width: 1px; min-height: 1.8rem; background: var(--border-color); }
.ctrl-note { flex-basis: 100%; font-size: 0.85rem; }
.ctrl-note:empty { display: none; }
@media (max-width: 640px) {
    .ctrl-divider { display: none; }
    .ctrl-group { flex-wrap: wrap; flex-shrink: 1; max-width: 100%; }
    .ctrl-group input[type="date"] { flex: 1 1 130px; min-width: 0; max-width: 100% !important; }
}
/* 사용자 지정 칸 고르개 */
.col-panel { flex-basis: 100%; border-top: 1px solid var(--border-color); margin-top: 0.5rem; padding-top: 0.75rem; }
.col-panel.hidden { display: none; }
.col-panel-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.6rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.6rem; }
.col-panel-btns { margin-left: auto; display: flex; gap: 0.35rem; }
.col-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.35rem 0.9rem; }
.col-list label { display: flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; cursor: pointer; margin: 0; }
.col-list label.off { color: var(--text-muted); }
.col-list label.na { opacity: 0.45; cursor: not-allowed; }
/* 알림 */
.ts-alerts:empty { display: none; }
.ts-alerts { margin-bottom: 0.8rem; }
.ts-alert { border-left: 3px solid var(--warning); background: rgba(245, 158, 11, 0.08); padding: 0.45rem 0.7rem; font-size: 0.85rem; margin-bottom: 0.4rem; border-radius: 6px; color: var(--text-secondary); }
.ts-alert-info { border-left-color: var(--primary); background: rgba(59, 130, 246, 0.07); }
/* 표: 촘촘한 간격, 순위·팀 열 고정 */
.ts-wrap { max-height: none; }
.ts-table th, .ts-table td { padding: 0.42rem 0.55rem; font-size: 0.82rem; text-align: right; }
.ts-table th.ts-rank, .ts-table td.ts-rank { position: sticky; left: 0; z-index: 3; width: 2.6rem; min-width: 2.6rem; max-width: 2.6rem; text-align: left; background: var(--bg-secondary); border-right: none; }
.ts-table th.ts-team, .ts-table td.ts-team { position: sticky; left: 2.6rem; z-index: 3; text-align: left; background: var(--bg-secondary); border-right: 1px solid var(--border-color); font-weight: 600; }
.ts-table thead th { z-index: 4; }
.ts-table thead th.ts-rank, .ts-table thead th.ts-team { z-index: 6; background: var(--bg-tertiary); }
.ts-table.ts-h2h th.ts-team, .ts-table.ts-h2h td.ts-team, .ts-table.ts-month th.ts-team, .ts-table.ts-month td.ts-team { left: 0; }
.ts-table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.ts-table th.sortable:hover { color: #3b82f6; }
.ts-table th.sorted { color: #3b82f6; }
.sort-ind { font-size: 0.72em; margin-left: 3px; vertical-align: middle; }
.ts-term { text-decoration: underline dotted var(--text-muted); text-underline-offset: 3px; cursor: help; }
.ts-league td { background: var(--bg-tertiary); font-weight: 700; border-top: 2px solid var(--border-color); }
.ts-table tr.ts-league td.ts-rank, .ts-table tr.ts-league td.ts-team { background: var(--bg-tertiary); }
/* 강조는 배경 대신 위아래 테두리로 둡니다. 빨강·파랑 칸 색이 그대로 보입니다. */
.ts-hl td { box-shadow: inset 0 2px 0 rgba(245, 158, 11, 0.75), inset 0 -2px 0 rgba(245, 158, 11, 0.75); font-weight: 700; }
/* 지수 칸 색(리그 평균 100 대비) */
.ts-up1 { background: rgba(239, 68, 68, 0.13); }
.ts-up2 { background: rgba(239, 68, 68, 0.24); }
.ts-up3 { background: rgba(239, 68, 68, 0.38); }
.ts-down1 { background: rgba(59, 130, 246, 0.14); }
.ts-down2 { background: rgba(59, 130, 246, 0.26); }
.ts-down3 { background: rgba(59, 130, 246, 0.40); }
.ts-table td.ts-pos { color: #dc2626; }
.ts-table td.ts-neg { color: #2563eb; }
[data-theme="dark"] .ts-table td.ts-pos { color: #f87171; }
[data-theme="dark"] .ts-table td.ts-neg { color: #60a5fa; }
/* 상대 전적 */
.ts-h2h td, .ts-h2h th { text-align: center; }
.ts-win { background: rgba(239, 68, 68, 0.13); }
.ts-loss { background: rgba(59, 130, 246, 0.15); }
.ts-self { color: var(--text-muted); }
.ts-total { font-weight: 700; border-left: 2px solid var(--border-color); }
.ts-sub { font-size: 0.82rem; margin: 0 0 0.6rem; }
/* 머리글 설명 창 */
.tip-box { position: fixed; z-index: 9999; display: none; max-width: 300px; background: var(--bg-secondary); color: var(--text-primary); border: 1px solid var(--border-color); border-radius: 8px; padding: 0.5rem 0.7rem; font-size: 0.82rem; font-family: inherit; line-height: 1.45; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12); pointer-events: none; white-space: normal; }
.tip-box b { display: block; margin-bottom: 2px; }
.tip-box .f { display: block; margin-top: 4px; color: var(--text-muted); }

/* ===== 선수 통계 ===== */
/* 선수 표: # · 이름은 가로 스크롤해도 고정, 팀은 고정하지 않음 */
.ts-table th.ts-name, .ts-table td.ts-name { position: sticky; left: 2.6rem; z-index: 3; text-align: left; white-space: nowrap; background: var(--bg-secondary); border-right: 1px solid var(--border-color); font-weight: 600; }
.ts-table thead th.ts-name { z-index: 6; background: var(--bg-tertiary); }
.ts-table tr.ts-league td.ts-name { background: var(--bg-tertiary); }
.ts-table th.ts-pteam, .ts-table td.ts-pteam { text-align: left; white-space: nowrap; }
/* 선수 표 아래 쪽 넘기기 */
.ts-pager { display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.75rem; font-size: 0.85rem; }
.ts-pager:empty { display: none; }
.ts-pager .tabbtn { height: 32px; padding: 0.25rem 0.75rem; box-sizing: border-box; }
.ts-pager label { margin: 0; white-space: nowrap; }
.ts-pager select { width: auto; max-width: 110px; }
.ts-empty { margin: 0 0 0.6rem; font-size: 0.9rem; }
