/* 토너먼트 (/Tournament) — site.css에서 분리(기능별). 뷰의 @section Styles로 로드. 공통은 site.css */
/* ===== 토너먼트 (/Tournament) — 사이트 라이트 테마 카드 + 인디고 액센트 ===== */

/* ===================== 진행상태 탭 (2026-09-07) =====================
   전체 / 진행중 / 예정 / 마감. 필터는 `js/tournament/list.js`(클라).

   ⚠⚠ **색·치수는 결장정보(`/Post/Absence`)의 종목칩 `.ab-sport` 와 같게 맞춘 것이다**(2026-09-07 지시).
     값을 바꿀 땐 `absence.css` 의 그 규칙과 **함께** 바꾼다 — 두 화면이 같은 칩으로 읽혀야 한다.
   ⚠⚠ 값을 `var(--ab-*)` 로 참조할 수 없다 — 그 토큰은 `absence.css` 에서 **`.ab` 에 스코프**돼 있어
     이 페이지에는 없다. 그래서 리터럴로 적고 출처를 주석에 남긴다(활성 `#1A56DB` = `--ab-blue`,
     보더 `#E8EBF0` = `--ab-border`, 텍스트 `#5B6473` = `--ab-text-dim`).
   ⚠ 카드 팔레트(인디고 `#1a2a80`)를 쓰지 않는다 — 지시가 결장정보 기준이다.
   ⚠ 공용 `.site-tabs` 도 쓰지 않는다 — 사이드바 카드용 치수(높이 32px·`flex:1`)라 본문 폭에서 눌린다.
   ⚠ 치수는 rem 이다 — 모바일에서 루트 폰트가 줄면 함께 스케일된다. */
.tn-tabs {
    display: flex;
    /* ⚠ 결장정보는 종목이 8개라 `overflow-x:auto` 로 옆으로 넘기지만, 여기는 4개라 **줄바꿈**이 낫다
         (넘길 것이 없는 스크롤 컨테이너는 모바일에서 스와이프를 유도해 오히려 헷갈린다). */
    flex-wrap: wrap;
    gap: 0.571rem;                   /* = .ab-sports */
    margin: 0 0 1rem;
}
.tn-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.357rem;                   /* = .ab-sport */
    box-sizing: border-box;
    height: 2.429rem;                /* 34px — = .ab-sport */
    padding: 0 1.071rem;             /* = .ab-sport */
    border: 1px solid #E8EBF0;       /* = --ab-border */
    border-radius: 999px;
    background: #fff;
    color: #5B6473;                  /* = --ab-text-dim */
    font-size: 0.929rem;             /* 13px — = .ab-sport */
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
/* ⚠ hover 는 결장정보에 없다 — 클릭 가능함을 알리는 최소 피드백만 활성색으로 준다. */
.tn-tab:hover { border-color: #1A56DB; color: #1A56DB; }
.tn-tab.is-active {
    background: #1A56DB;             /* = --ab-blue */
    border-color: #1A56DB;
    color: #fff;
}
/* 건수 알약 — 결장정보 칩에는 없는 요소라 활성색을 옅게 깔아 같은 계열로 맞춘다. */
.tn-tab-count {
    padding: 0.0625rem 0.375rem;
    border-radius: 999px;
    background: rgba(26, 86, 219, 0.10);
    color: #1A56DB;
    font-size: 0.8125rem;
    font-weight: 800;
}
.tn-tab.is-active .tn-tab-count { background: rgba(255, 255, 255, 0.22); color: #fff; }

@media (max-width: 767.98px) {
    /* ⚠⚠ **모바일도 4열 한 줄이다**(2026-09-07 지시 — 2×2 로 접지 말 것).
       ⚠ `flex-wrap: nowrap` + `flex: 1 1 0` + `min-width: 0` 세 개가 한 벌이다:
         `nowrap` 만 두면 내용 폭 때문에 넘치고, `min-width: 0` 이 없으면 flex 항목의 기본
         `min-width: auto` 가 내용 폭을 하한으로 잡아 **줄바꿈 대신 가로 오버플로**가 된다.
       ⚠ 좁은 폭에서는 좌우 패딩을 줄여 글자 자리를 먼저 확보한다(칩 높이·색은 그대로). */
    .tn-tabs { flex-wrap: nowrap; }
    .tn-tab {
        flex: 1 1 0;
        min-width: 0;
        padding: 0 0.5rem;
        gap: 0.25rem;
    }
    /* 건수 알약도 함께 좁힌다 — 가장 긴 `진행중` 탭이 잘리는 것을 막는다. */
    .tn-tab-count { padding: 0.0625rem 0.25rem; }
}

/* ⚠⚠ **필수 — 지우면 탭 필터가 통째로 동작하지 않는다.**
   `.tn-card` 는 `display:flex`, 공용 `.empty-state`(site.css)는 `display:flex` 인데, 그 **작성자
   스타일이 브라우저 기본 `[hidden]{display:none}`(UA 스타일)을 이긴다.** 그래서 JS 가
   `el.hidden = true` 로 감춰도 그대로 보인다 — 실제로 겪었다(2026-09-07: `전체` 탭인데도
   '해당 상태의 토너먼트가 없습니다' 가 카드와 함께 떴다).
   ⚠ 이 저장소가 같은 함정을 이미 7곳에서 막고 있다(absence·account·broadcast·mypage·pickster·sitefind).
     `hidden` 속성으로 숨기는 요소에 `display` 를 주면 **항상 이 짝이 필요하다.** */
.tn-card[hidden], .empty-state[hidden] { display: none !important; }

/* 탭을 한 번 누른 뒤에는 카드 진입 애니메이션을 끈다(JS 가 `.is-filtered` 를 붙인다).
   ⚠ 이유는 `js/tournament/list.js` 주석 — `hidden` 해제가 애니메이션을 다시 실행시켜, 카드가 많으면
     인라인 `animation-delay` 누적만큼 뒤쪽 카드가 한동안 안 보인다. 최초 로드에서는 그대로 동작한다. */
.tn-grid.is-filtered .tn-card { animation: none; }

.tn-grid {
    display: grid;
    grid-template-columns: 1fr;          /* 모바일 1열 */
    gap: 1rem;
}
@media (min-width: 768px) {
    .tn-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; } /* PC 2열 */
}

.tn-card {
    --tn-orange: #1a2a80;                /* 변수명은 레거시(orange)지만 값은 인디고 팔레트 메인 */
    --tn-accent: var(--tn-orange);       /* 좌측 상태바 색(상태별 override) */

    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-subtle);
    border-left: 0.1875rem solid var(--tn-accent);   /* 상태 액센트 바 */
    border-radius: var(--radius-md);
    background: #fff;
    overflow: hidden;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    animation: tnIn 0.5s ease both;
}
.tn-card.is-live   { --tn-accent: #1faf5c; }
.tn-card.is-soon   { --tn-accent: #1a2a80; }
.tn-card.is-closed { --tn-accent: #cbd2da; }
.tn-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-default);
    border-left-color: var(--tn-accent);
    box-shadow: 0 0.5rem 1.5rem rgba(15, 23, 42, 0.10);
}

@keyframes tnIn {
    from { opacity: 0; transform: translateY(0.75rem); }
    to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .tn-card { animation: none; }
}

/* 헤더: 좌측(배지+타이틀) / 우측(게임사 로고) */
.tn-head {
    position: relative;
    display: flex;
    flex-direction: column;          /* 1행(진행여부·게임사) → 2행(제목) 세로 배치 */
    gap: 0.65rem;
    padding: 1.1rem 1.25rem 1rem;
    /* 정보밴드와 동일한 따뜻한 대각선 그라데이션 → 상·하단 색 일치 */
    background: linear-gradient(105deg, transparent 30%, rgba(26, 42, 128, 0.04) 100%);
}
.tn-head-top, .tn-title, .tn-logo { position: relative; z-index: 1; }

/* 1행: 진행여부(좌) ↔ 게임사(우) 둘로 영역 분할 */
.tn-head-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-width: 0;
}

.tn-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.26rem 0.65rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
}
.tn-badge-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; flex-shrink: 0; }
/* 한글 글리프가 line-box 안에서 살짝 위로 앉는 현상 보정(점은 중앙, 글자만 미세 하강) */
.tn-badge-label { position: relative; top: 0.06em; line-height: 1; }
.tn-badge.is-closed { background: #eef0f3; color: #6b7480; }
.tn-badge.is-closed .tn-badge-dot { background: #98a1ac; }
.tn-badge.is-live { background: rgba(31, 175, 92, 0.12); color: #178f4b; }
.tn-badge.is-live .tn-badge-dot { background: #1faf5c; animation: tnPulse 1.6s ease-out infinite; }
.tn-badge.is-soon { background: rgba(26, 42, 128, 0.12); color: #1a2a80; }
.tn-badge.is-soon .tn-badge-dot { background: var(--tn-orange); }

@keyframes tnPulse {
    0%   { box-shadow: 0 0 0 0 rgba(31, 175, 92, 0.5); }
    70%  { box-shadow: 0 0 0 0.4rem rgba(31, 175, 92, 0); }
    100% { box-shadow: 0 0 0 0 rgba(31, 175, 92, 0); }
}

.tn-title {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.0625rem;
    font-weight: 700;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;            /* 2줄 클램프로 카드 정렬 */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tn-logo {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 8rem;
    max-width: 11rem;
}
.tn-logo img { max-width: 100%; max-height: 2.75rem; object-fit: contain; }
.tn-logo-text {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* 정보 밴드: 옅은 따뜻한 톤 / 좌측 통계 flex / 우측 순위보기 */
.tn-info {
    position: relative;
    display: flex;
    align-items: stretch;            /* 순위보기 버튼이 통계 내용 높이에 맞춰지도록 */
    gap: 1rem;
    padding: 0.9rem 1.25rem;
    border-top: 1px solid var(--border-subtle);
    /* 헤더와 동일한 따뜻한 대각선 그라데이션 → 상·하단 색 일치 */
    background: linear-gradient(105deg, transparent 30%, rgba(26, 42, 128, 0.04) 100%);
}
.tn-stats {
    flex: 1 1 auto;                  /* 남은 폭 모두 차지 → 버튼은 우측 */
    display: flex;
    flex-wrap: wrap;
    align-content: center;
    align-items: center;
    gap: 0.55rem 1.25rem;
    min-width: 0;
}
.tn-stat-wide { flex-basis: 100%; }      /* 대회일정은 항상 한 줄 차지 */

.tn-stat { display: inline-flex; align-items: center; gap: 0.5rem; min-width: 0; }
.tn-stat-label {
    flex-shrink: 0;
    padding: 0.22rem 0.6rem;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);   /* 옅은 인디고 틴트 — 반복 라벨은 낮은 강조 */
    color: var(--accent);             /* 진한 인디고 글씨 */
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
}
/* 값: 다크 텍스트(라이트 카드). JetBrains Mono는 400·500만 로드 → 500로 또렷하게(faux-bold 회피). */
.tn-stat-val { color: var(--text-primary); font-size: var(--text-sm); font-weight: 500; }

.tn-rank-btn {
    flex-shrink: 0;
    align-self: stretch;             /* 정보 밴드(통계) 높이에 맞춤 */
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    min-width: 4.5rem;
    padding: 0.4rem 0.95rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: #fff;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;             /* "순위보기" 줄바꿈 방지 */
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.tn-rank-btn i { font-size: 1.2rem; }
.tn-rank-btn:hover { background: var(--tn-orange); border-color: var(--tn-orange); color: #fff; }

@media (max-width: 767.98px) {
    .tn-info { flex-direction: column; align-items: stretch; }
    .tn-rank-btn { flex-direction: row; padding: 0.55rem 0.95rem; }
    .tn-logo { min-width: 5.5rem; }
    .tn-logo-text { font-size: 1.05rem; }
}

