﻿/* ==============================
   CSS 변수 & 리셋
============================== */
:root {
    --primary:        #00d4ff;
    --primary-dark:   #0099bb;
    --accent:         #ff4757;
    --bg:             #0a0a0f;
    --bg-card:        #13131a;
    --bg-panel:       #1a1a28;
    --text:           #f0f0f0;
    --text-muted:     #888;
    --border:         #2a2a3a;
    --radius:         12px;
    --font:           'Noto Sans KR', sans-serif;
    --header-h:       60px;
    --bottom-nav-h:   65px;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding-bottom: var(--bottom-nav-h);
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    cursor: pointer;
    font-family: var(--font);
}

/* ==============================
   헤더
============================== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.logo span {
    color: var(--primary);
}

.header-nav {
    display: none;
    gap: 4px;
    margin-left: auto;
}

.nav-link {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
    background: var(--bg-panel);
    color: var(--primary);
}

.hamburger {
    margin-left: auto;
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 4px;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
}

/* ==============================
   드로어
============================== */
.drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 200;
}

.drawer-overlay.open {
    display: block;
}

.drawer {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    background: var(--bg-card);
    z-index: 300;
    transition: left 0.3s ease;
    border-right: 1px solid var(--border);
    overflow-y: auto;
}

.drawer.open {
    left: 0;
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.logo-text {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
}

.drawer-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}

.drawer-menu {
    list-style: none;
    padding: 12px 0;
}

.drawer-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: var(--text);
    font-size: 0.95rem;
    transition: background 0.2s;
}

.drawer-menu li a:hover,
.drawer-menu li a.active {
    background: var(--bg-panel);
    color: var(--primary);
}

/* ==============================
   메인
============================== */
.main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px 40px;
}

.live-banner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 71, 87, 0.15);
    border: 1px solid rgba(255, 71, 87, 0.4);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 16px;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    animation: pulse 1.2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.4;
        transform: scale(0.7);
    }
}

.live-label {
    color: var(--text-muted);
    font-weight: 400;
}

.page-title-wrap {
    margin-bottom: 20px;
}

.page-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ==============================
   스포츠 탭
============================== */
.sport-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    margin-bottom: 20px;
    padding-bottom: 4px;
}

.sport-tabs::-webkit-scrollbar {
    display: none;
}

.sport-tab {
    flex-shrink: 0;
    padding: 8px 18px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.sport-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.sport-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #000;
    font-weight: 700;
}

/* ==============================
   iframe 공통
============================== */
.iframe-wrapper {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-height: 400px;
    overflow: hidden;
}

.iframe-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: var(--bg-card);
    z-index: 10;
    color: var(--text-muted);
    font-size: 0.9rem;
    min-height: 400px;
}

.iframe-loading.hidden {
    display: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.iframe-error {
    display: none;
}

/* ==============================
   데스크톱 iframe
============================== */
.iframe-desktop {
    display: none;
    position: relative;
}

.desktop-vscroll {
    width: 100%;
    height: calc(100vh - 220px);
    min-height: 650px;
    max-height: 920px;
    overflow: hidden;
}

.iframe-scroll-outer {
    width: 100%;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #3a3a4a transparent;
}

.iframe-scroll-outer::-webkit-scrollbar {
    height: 4px;
}

.iframe-scroll-outer::-webkit-scrollbar-track {
    background: transparent;
}

.iframe-scroll-outer::-webkit-scrollbar-thumb {
    background: #3a3a4a;
    border-radius: 4px;
}

.iframe-scroll-outer::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.iframe-scroll-inner {
    width: 920px;
    min-width: 920px;
    height: 100%;
}

#liveScoreFrameDesktop {
    width: 920px;
    height: 100%;
    min-height: 650px;
    border: none;
    display: block;
}

/* ==============================
   모바일 iframe
   스케일 유지 + 외부 세로 스크롤
============================== */
.iframe-mobile {
    display: block;
    position: relative;
}

.mobile-scale-outer {
    width: 100%;
    height: 1200px;
    min-height: 1200px;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #3a3a4a transparent;
}

.mobile-scale-outer::-webkit-scrollbar {
    width: 4px;
}

.mobile-scale-outer::-webkit-scrollbar-track {
    background: transparent;
}

.mobile-scale-outer::-webkit-scrollbar-thumb {
    background: #3a3a4a;
    border-radius: 4px;
}

.mobile-scale-outer::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.mobile-scale-inner {
    width: 100%;
    position: relative;
    transform: none !important;
    transform-origin: top left;
}

#liveScoreFrameMobile {
    width: 920px;
    border: none;
    display: block;
    transform-origin: top left;
}

.iframe-fade-bottom {
    display: none;
}

/* ==============================
   안내 텍스트
============================== */
.iframe-notice {
    margin-top: 12px;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
}

/* ==============================
   모바일 하단 내비
============================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-h);
    background: rgba(13, 13, 20, 0.97);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 0.7rem;
    padding: 8px 12px;
    transition: color 0.2s;
}

.bottom-nav-item.active,
.bottom-nav-item:hover {
    color: var(--primary);
}

/* ==============================
   푸터
============================== */
.footer {
    text-align: center;
    padding: 24px 20px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.8;
}

.footer-sub {
    font-size: 0.72rem;
    opacity: 0.6;
}

/* ==============================
   반응형
============================== */
@media (min-width: 1024px) {
    body {
        padding-bottom: 0;
    }

    .bottom-nav {
        display: none;
    }

    .header-nav {
        display: flex;
    }

    .hamburger {
        display: none;
    }

    .page-title {
        font-size: 2rem;
    }

    .iframe-desktop {
        display: block;
    }

    .iframe-mobile {
        display: none;
    }
}
/* ==============================
   모바일 iframe 핀치 크래시 방지 + 줌 버튼
============================== */
.mobile-scale-outer,
.mobile-scale-inner,
#liveScoreFrameMobile {
    touch-action: pan-x pan-y;
    -webkit-user-select: none;
    user-select: none;
}

.mobile-zoom-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    padding: 8px 8px 6px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.mobile-zoom-btn {
    min-width: 34px;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-panel);
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 700;
}

.mobile-zoom-btn:active {
    background: var(--primary);
    color: #000;
}

.mobile-zoom-label {
    min-width: 52px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* 모바일 줌 버튼 툴바 */
.mobile-zoom-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    padding: 8px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.mobile-zoom-btn {
    min-width: 38px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-panel);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 700;
}

.mobile-zoom-btn:active {
    background: var(--primary);
    color: #000;
}

.mobile-zoom-label {
    min-width: 52px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}
/* 모바일 핀치 줌 전체 허용 */
@media (max-width: 1023px) {
    html,
    body,
    .header,
    .main,
    .sport-tabs,
    .page-title-wrap,
    .live-banner,
    .iframe-wrapper,
    .iframe-mobile {
        touch-action: auto;
    }
}