/* ===== CSS 변수 ===== */
:root {
    --red: #C8102E;
    --blue: #003F87;
    --gold: #FFD700;
    --dark: #1a1a2e;
    --dark-2: #16213e;
    --gray: #6c757d;
    --gray-light: #f8f9fa;
    --border: #dee2e6;
    --white: #ffffff;
    --korea-bg: #fff8e1;
    --korea-border: #FFD700;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
}

/* ===== 리셋 & 기본 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Noto Sans KR', sans-serif;
    color: #333;
    background: #f0f2f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* ===== 헤더 ===== */
header {
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark-2) 100%);
    border-bottom: 3px solid var(--red);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.header-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    flex-shrink: 0;
}

.logo-icon { font-size: 1.8rem; }

.logo-text {
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--white);
    letter-spacing: -0.5px;
}

.logo-sub {
    font-size: 0.7rem;
    color: var(--gold);
    font-weight: 500;
    display: none;
}

@media (min-width: 768px) { .logo-sub { display: block; } }

nav { flex: 1; }

nav ul {
    display: flex;
    list-style: none;
    gap: 0.25rem;
    flex-wrap: wrap;
}

nav ul li a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.4rem 0.7rem;
    border-radius: 6px;
    transition: all 0.2s;
    white-space: nowrap;
}

nav ul li a:hover, nav ul li a.active {
    background: rgba(255,255,255,0.15);
    color: var(--white);
}

nav ul li a.nav-highlight {
    background: var(--red);
    color: var(--white);
}

nav ul li a.nav-highlight:hover {
    background: #a50d26;
}

.nav-toggle {
    display: none;
    background: none;
    border: 1px solid rgba(255,255,255,0.3);
    color: var(--white);
    font-size: 1.3rem;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    margin-left: auto;
}

@media (max-width: 768px) {
    .nav-toggle { display: block; }
    nav {
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--dark-2);
        border-bottom: 3px solid var(--red);
        display: none;
        padding: 0.5rem;
    }
    nav.open { display: block; }
    nav ul { flex-direction: column; gap: 0.1rem; }
    nav ul li a { display: block; padding: 0.6rem 1rem; }
}

/* ===== 메인 컨텐츠 ===== */
main {
    flex: 1;
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    width: 100%;
}

/* ===== 페이지 히어로 ===== */
.page-hero {
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark-2) 100%);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    color: var(--white);
    border-left: 5px solid var(--red);
}

.page-hero h1 {
    font-size: clamp(1.3rem, 3vw, 2rem);
    font-weight: 900;
    margin-bottom: 0.5rem;
}

.page-hero p {
    color: rgba(255,255,255,0.8);
    font-size: 0.95rem;
    line-height: 1.6;
}


/* ===== 섹션 카드 ===== */
.card {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid var(--border);
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--red);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===== 테이블 ===== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th {
    background: var(--dark);
    color: var(--white);
    padding: 0.7rem 0.8rem;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

td {
    padding: 0.65rem 0.8rem;
    border-bottom: 1px solid var(--border);
}

tr:hover td { background: #f8f9ff; }
tr:last-child td { border-bottom: none; }

.row-korea td { background: var(--korea-bg) !important; font-weight: 600; }
.row-korea td:first-child { border-left: 3px solid var(--korea-border); }

/* ===== 경기 카드 ===== */
.match-cards { display: grid; gap: 1rem; }

.match-card {
    background: var(--white);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.match-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.match-card.korea-match {
    border-left: 4px solid var(--red);
    background: linear-gradient(to right, #fff5f5, var(--white));
}

.match-meta {
    font-size: 0.78rem;
    color: var(--gray);
    margin-bottom: 0.75rem;
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.match-teams {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 1.1rem;
    font-weight: 700;
}

.team-name { flex: 1; }
.team-name.home { text-align: right; }
.team-name.away { text-align: left; }

.match-vs {
    background: var(--red);
    color: var(--white);
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 900;
    flex-shrink: 0;
}

.match-time {
    font-size: 0.85rem;
    color: var(--blue);
    font-weight: 600;
    margin-top: 0.5rem;
}

/* ===== 배지/태그 ===== */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-red { background: var(--red); color: var(--white); }
.badge-blue { background: var(--blue); color: var(--white); }
.badge-gold { background: var(--gold); color: var(--dark); }
.badge-gray { background: var(--gray-light); color: var(--gray); border: 1px solid var(--border); }
.badge-success { background: #d4edda; color: #155724; }
.badge-danger { background: #f8d7da; color: #721c24; }

/* ===== 경고 박스 ===== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    line-height: 1.6;
}

.alert-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-left: 4px solid #ffc107;
    color: #856404;
}

.alert-danger {
    background: #f8d7da;
    border: 1px solid var(--red);
    border-left: 4px solid var(--red);
    color: #721c24;
}

.alert-success {
    background: #d4edda;
    border: 1px solid #28a745;
    border-left: 4px solid #28a745;
    color: #155724;
}

.alert-info {
    background: #cce5ff;
    border: 1px solid #004085;
    border-left: 4px solid var(--blue);
    color: #004085;
}

/* ===== 필터 바 ===== */
.filter-bar {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--white);
    border-radius: 10px;
    border: 1px solid var(--border);
}

.filter-btn {
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--white);
    cursor: pointer;
    font-size: 0.83rem;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.2s;
}

.filter-btn:hover, .filter-btn.active {
    background: var(--red);
    color: var(--white);
    border-color: var(--red);
}

.filter-btn.toggle-korea.active {
    background: var(--gold);
    color: var(--dark);
    border-color: var(--gold);
}

/* ===== 시뮬레이터 ===== */
.simulator-form {
    display: grid;
    gap: 1rem;
}

.match-input-group {
    background: var(--white);
    border-radius: 10px;
    padding: 1.25rem;
    border: 1px solid var(--border);
}

.match-input-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    color: var(--dark);
}

.result-selector {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.result-btn {
    padding: 0.45rem 1.1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--white);
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.result-btn:hover { border-color: var(--blue); color: var(--blue); }
.result-btn.selected-win { background: var(--success); border-color: var(--success); color: var(--white); }
.result-btn.selected-draw { background: var(--warning); border-color: var(--warning); color: var(--dark); }
.result-btn.selected-loss { background: var(--danger); border-color: var(--danger); color: var(--white); }

.score-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.score-inputs label { font-size: 0.85rem; color: var(--gray); font-weight: 500; }

.score-inputs input {
    width: 60px;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    text-align: center;
}

.score-sep { font-size: 1.2rem; font-weight: 700; color: var(--gray); }

/* ===== 결과 표시 ===== */
.result-box {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    border: 2px solid var(--border);
    margin-top: 1.5rem;
}

.result-status {
    font-size: 1.4rem;
    font-weight: 900;
    text-align: center;
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
}

.result-advance { background: #d4edda; color: #155724; }
.result-eliminated { background: #f8d7da; color: #721c24; }
.result-possible { background: #fff3cd; color: #856404; }
.result-pending { background: var(--gray-light); color: var(--gray); }

/* ===== 대진표 브래킷 ===== */
.bracket-container {
    overflow-x: auto;
    padding: 1rem 0;
}

.bracket {
    display: flex;
    gap: 0;
    min-width: 900px;
}

.bracket-round {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    padding: 0 0.5rem;
}

.bracket-round-title {
    text-align: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--white);
    background: var(--dark);
    padding: 0.4rem;
    border-radius: 6px 6px 0 0;
    margin-bottom: 0.5rem;
}

.bracket-match {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 0.5rem;
    background: var(--white);
}

.bracket-team {
    padding: 0.5rem 0.75rem;
    font-size: 0.82rem;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.bracket-team:last-child { border-bottom: none; }
.bracket-team.tbd { color: var(--gray); font-style: italic; }
.bracket-team.winner { background: #fffde7; font-weight: 700; }

/* ===== 경기장 그리드 ===== */
.venues-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.venue-card {
    background: var(--white);
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid var(--border);
    transition: transform 0.2s;
}

.venue-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.1); }
.venue-card.highlight { border: 2px solid var(--red); }

.venue-city {
    font-size: 0.8rem;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.25rem;
}

.venue-stadium {
    font-size: 1rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.venue-country {
    font-size: 0.85rem;
    color: var(--red);
    font-weight: 600;
}

/* ===== 역사 타임라인 ===== */
.timeline-table th { text-align: center; }
.timeline-table td { text-align: center; }
.timeline-table .winner-col { font-weight: 700; color: var(--blue); }
.timeline-table .korea-year { background: var(--korea-bg); }

/* ===== 홈 그리드 ===== */
.home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.home-card {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    display: block;
}

.home-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    text-decoration: none;
    border-color: var(--red);
}

.home-card-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.home-card-title { font-size: 1rem; font-weight: 700; color: var(--dark); margin-bottom: 0.3rem; }
.home-card-desc { font-size: 0.83rem; color: var(--gray); line-height: 1.5; }
.home-card.featured { border-top: 4px solid var(--red); }

/* ===== 채널 비교표 ===== */
.channel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.channel-card {
    border-radius: 10px;
    padding: 1.25rem;
    border: 1px solid var(--border);
}

.channel-card.tv-channel { background: #f0f4ff; border-color: var(--blue); }
.channel-card.online-channel { background: #f0fff4; border-color: #28a745; }
.channel-card.unavailable { background: #fff5f5; border-color: var(--red); opacity: 0.8; }

.channel-name {
    font-size: 1.1rem;
    font-weight: 900;
    margin-bottom: 0.3rem;
}

.channel-desc { font-size: 0.85rem; color: #555; line-height: 1.5; }

/* ===== 관련 링크 ===== */
.related-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.related-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--dark);
    text-decoration: none;
    transition: all 0.2s;
}

.related-link:hover {
    background: var(--blue);
    color: var(--white);
    border-color: var(--blue);
    text-decoration: none;
}

/* ===== FAQ 섹션 ===== */
.faq-list { list-style: none; }

.faq-item {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.faq-question {
    padding: 1rem 1.25rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
}

.faq-question::after { content: '▼'; font-size: 0.75rem; color: var(--gray); }
.faq-item.open .faq-question::after { content: '▲'; }

.faq-answer {
    padding: 0 1.25rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s;
    font-size: 0.9rem;
    line-height: 1.7;
    color: #555;
}

.faq-item.open .faq-answer {
    padding: 0 1.25rem 1rem;
    max-height: 500px;
}

/* ===== 조별 순위표 ===== */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.group-card {
    background: var(--white);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.group-header {
    background: var(--dark);
    color: var(--white);
    padding: 0.6rem 1rem;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.group-header.korea-group { background: var(--red); }

.group-table { width: 100%; font-size: 0.82rem; }
.group-table th { background: #2d3748; padding: 0.4rem 0.5rem; font-size: 0.75rem; }
.group-table td { padding: 0.45rem 0.5rem; }
.group-table tr.korea-row td { background: var(--korea-bg); font-weight: 600; }

/* ===== 섹션 제목 ===== */
.section-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 1rem;
    padding-left: 0.75rem;
    border-left: 4px solid var(--red);
}

/* ===== 유틸 ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-red { color: var(--red); }
.text-blue { color: var(--blue); }
.text-gold { color: var(--gold); }
.text-gray { color: var(--gray); }
.font-bold { font-weight: 700; }
.font-black { font-weight: 900; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.d-flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }

/* ===== 버튼 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary { background: var(--red); color: var(--white); }
.btn-primary:hover { background: #a50d26; }
.btn-secondary { background: var(--blue); color: var(--white); }
.btn-secondary:hover { background: #002d63; }
.btn-outline { background: transparent; border: 2px solid var(--red); color: var(--red); }
.btn-outline:hover { background: var(--red); color: var(--white); }

/* ===== 풋터 ===== */
footer {
    background: var(--dark);
    color: rgba(255,255,255,0.7);
    padding: 2rem 1rem;
    margin-top: 2rem;
}

.footer-inner {
    max-width: 1280px;
    margin: 0 auto;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-bottom: 1rem;
}

.footer-links a {
    color: rgba(255,255,255,0.6);
    font-size: 0.85rem;
    text-decoration: none;
}

.footer-links a:hover { color: var(--white); }

.footer-info {
    font-size: 0.8rem;
    line-height: 1.8;
    color: rgba(255,255,255,0.5);
}

.footer-info a { color: rgba(255,255,255,0.6); }
.footer-info a:hover { color: var(--gold); }

/* ===== 반응형 ===== */
@media (max-width: 768px) {
    main { padding: 1rem 0.75rem; }
    .page-hero { padding: 1.25rem; }
    .match-teams { font-size: 0.95rem; }
    .groups-grid { grid-template-columns: 1fr; }
    .venues-grid { grid-template-columns: 1fr; }
    .channel-grid { grid-template-columns: 1fr; }
    .home-grid { grid-template-columns: repeat(2, 1fr); }
    table { font-size: 0.8rem; }
    th, td { padding: 0.5rem 0.5rem; }
}

@media (max-width: 480px) {
    .home-grid { grid-template-columns: 1fr; }
    .filter-bar { gap: 0.35rem; }
    .filter-btn { font-size: 0.78rem; padding: 0.35rem 0.7rem; }
}
