/* 전체 기본 설정 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 다크 모드 기본 변수 */
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-card: #2d2d2d;
    --bg-header: rgba(45, 45, 45, 0.8);
    --bg-container: rgba(45, 45, 45, 0.6);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.8);
    --text-card: #ffffff;
    --text-meta: rgba(255, 255, 255, 0.7);
    --gradient-primary: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    --gradient-secondary: linear-gradient(45deg, #4a90e2, #357abd);
    --border-light: rgba(255, 255, 255, 0.1);
    --shadow-primary: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.5);
}

[data-theme="light"] {
    /* 라이트 모드 변수 */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-card: #ffffff;
    --bg-header: rgba(255, 255, 255, 0.9);
    --bg-container: rgba(255, 255, 255, 0.8);
    --text-primary: #2c3e50;
    --text-secondary: #6c757d;
    --text-card: #2c3e50;
    --text-meta: #6c757d;
    --gradient-primary: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    --gradient-secondary: linear-gradient(45deg, #4a90e2, #357abd);
    --border-light: rgba(74, 144, 226, 0.2);
    --shadow-primary: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    color: var(--text-primary);
    transition: all 0.3s ease;
    padding-top: 80px; /* 헤더 높이만큼 여백 추가 */
}

.container {
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 20px !important;
    width: 100% !important;
}

/* 헤더 네비게이션 */
.header {
    background: var(--bg-header);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-primary);
    border-bottom: 1px solid var(--border-light);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.header.header-hidden {
    transform: translateY(-100%);
    opacity: 0;
}

.header.header-visible {
    transform: translateY(0);
    opacity: 1;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 30px;
    max-width: 1200px;
    margin: 0 auto;
    gap: 10px;
}

/* 로고 스타일 */
.logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* PC에서 모바일용 테마 토글 숨기기 */
.logo .theme-toggle {
    display: none;
}

.logo-link {
    display: flex;
    align-items: center;
    flex-direction: row;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
    flex-shrink: 0;
    gap: 10px;
}

.logo-link:hover {
    transform: scale(1.05);
}

.logo-image {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: contain;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    filter: contrast(1.1) brightness(1.05);
    background: transparent;
}

/* 로고 picture 태그 최적화 */
.logo picture {
    display: block;
    flex-shrink: 0;
    width: 50px;
    height: 50px;
}

       .logo picture img {
           width: 50px;
           height: 50px;
           border-radius: 8px;
           object-fit: cover;
           image-rendering: -webkit-optimize-contrast;
           image-rendering: -moz-crisp-edges;
           image-rendering: crisp-edges;
           filter: contrast(1.1) brightness(1.05);
           background: transparent;
       }

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    transition: color 0.3s ease;
    white-space: nowrap;
}

/* 네비게이션 메뉴 */
.nav-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1001; /* 헤더보다 위에 표시 */
}

.nav-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 30px;
}

.nav-item {
    position: relative;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    padding: 10px 16px;
    border-radius: 25px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-card);
    transform: translateY(-2px);
}

.nav-link.active {
    color: white;
    background: var(--gradient-secondary);
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-secondary);
    z-index: -1;
}

/* 히어로/광고 섹션 */
.hero {
    margin-bottom: 40px;
    margin-top: 10px;
}

.hero-content {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    height: 250px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-primary);
}

/* 광고 슬라이더 */
.ad-slider {
    position: relative;
    width: 100%;
    height: 100%;
}

.ad-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    pointer-events: none;
}

.ad-slide.active {
    pointer-events: all;
}

.ad-slide.active {
    opacity: 1;
}

/* 기본적으로 모든 광고 숨김 (JavaScript로 제어) */
.ad-slide {
    display: none;
}

/* 이미지 로딩 최적화 (WebP + GIF) */
.ad-image[src*=".gif"],
.ad-image:not(.loaded) {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ad-image[src*=".gif"].loaded,
.ad-image.loaded {
    opacity: 1;
}

/* 모바일 최적화: 첫 번째 광고 이미지 우선 로딩 */
.ad-slide.active .ad-image {
    will-change: opacity;
}

/* 모바일에서 이미지 로딩 최적화 */
@media (max-width: 768px) {
    .ad-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
    
    /* 모바일에서 첫 번째 광고만 즉시 표시 */
    .ad-slide:not(.active) .ad-image {
        opacity: 0;
    }
    
    .ad-slide.active .ad-image {
        opacity: 1;
    }
}

.ad-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 20px;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    filter: contrast(1.05) brightness(1.02);
    /* 모바일 GIF 최적화 */
    will-change: transform;
    backface-visibility: hidden;
    transform: translateZ(0);
    /* 성능 최적화 */
    contain: layout style paint;
}

/* picture 태그 최적화 */
picture {
    display: block;
    width: 100%;
    height: 100%;
}

picture img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ad-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    transition: transform 0.3s ease;
    cursor: pointer;
    z-index: 10;
    position: relative;
}

.ad-link:hover {
    transform: scale(1.02);
}

/* 테마 토글 스위치 */
.theme-toggle {
    background: var(--border-light);
    border: 2px solid var(--border-light);
    border-radius: 25px;
    width: 60px;
    height: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-card);
    padding: 3px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.theme-toggle:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-hover);
}

/* 슬라이딩 원형 버튼 */
.theme-toggle::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: #ffffff;
    border-radius: 50%;
    transition: all 0.3s ease;
    left: 3px;
    top: 3px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* 다크모드일 때 - 토글 왼쪽, 내부 흰색 */
[data-theme="dark"] .theme-toggle {
    background: #4a5568;
    border-color: #4a5568;
}

[data-theme="dark"] .theme-toggle::before {
    background: #ffffff;
    left: 3px;
    transform: translateX(0);
}

/* 라이트모드일 때 - 토글 오른쪽, 내부 검은색 */
[data-theme="light"] .theme-toggle {
    background: #e2e8f0;
    border-color: #e2e8f0;
}

[data-theme="light"] .theme-toggle::before {
    background: #2d3748;
    left: 3px;
    transform: translateX(27px);
}

/* 게임 섹션 */
.games-section {
    position: relative;
}

.games-container {
    position: relative;
    overflow: visible;
    border-radius: 20px;
    background: var(--bg-container);
    backdrop-filter: blur(10px);
    padding: 20px;
    box-shadow: var(--shadow-primary);
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
}

.games-slider {
    position: relative;
    width: 100%;
    height: 520px;
    min-height: 520px;
    overflow: hidden;
}

.game-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 520px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform, opacity;
}

.game-slide.active {
    opacity: 1;
    transform: translateX(0);
}

.game-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    height: 520px;
    align-items: stretch;
    justify-items: start;
    justify-content: center;
}

/* 카테고리 그리드 스타일 */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    height: auto;
    overflow: visible;
    justify-items: start;
    justify-content: center;
}

/* 카테고리 모드에서 games-section 스타일 */
body.category-mode-active .games-section {
    padding: 0;
    margin: 0;
    background: transparent;
    position: relative;
    overflow: visible;
    height: auto;
}

/* 카테고리 모드에서 container 스타일 */
body.category-mode-active .container {
    padding: 20px;
    margin: 0 auto;
    max-width: 1200px;
}

/* 카테고리 모드에서 hero 섹션 여백 유지 */
body.category-mode-active .hero {
    margin-bottom: 40px;
    margin-top: 10px;
}

body.category-mode-active .hero-content {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    height: 200px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-primary);
    padding: 0;
}

.category-grid::-webkit-scrollbar {
    width: 8px;
}

.category-grid::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 10px;
}

.category-grid::-webkit-scrollbar-thumb {
    background: var(--gradient-secondary);
    border-radius: 10px;
}

.category-grid::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, #357abd, #4a90e2);
}

.game-card {
    background: var(--bg-card);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: all 0.3s ease;
    cursor: pointer;
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-light);
    width: 100%;
    max-width: 350px;
    min-width: 280px;
    margin: 0; /* 왼쪽 정렬 */
}

.game-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover);
}

.game-image {
    position: relative;
    width: 100%; /* 게임 카드 너비에 맞춤 */
    height: 0;
    padding-bottom: 75%; /* 4:3 비율 유지 */
    overflow: hidden;
    background: var(--bg-card);
    border-radius: 15px 15px 0 0;
}

/* 모든게임 모드에서 이미지 비율 조정 (4:3 비율) */
.game-cards:not(.category-grid) .game-image {
    width: 100%; /* 게임 카드 너비에 맞춤 */
    height: 262.5px; /* 4:3 비율 (350px * 0.75 = 262.5px) */
}

/* 메인페이지 게임 카드 이미지 4:3 비율 강제 */
.game-cards:not(.category-grid) .game-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* 카테고리 모드 전용 게임 카드 디자인 */
.category-grid .game-card {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-light) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
    border-radius: 0 !important;
    overflow: hidden !important;
    height: auto !important;
    display: flex !important;
    flex-direction: column !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    width: 100% !important;
    max-width: 350px !important;
    margin: 0 !important;
}

.category-grid .game-card:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2) !important;
}

/* 카테고리 모드 이미지 (4:3 비율) */
.category-grid .game-image {
    width: 100% !important;
    height: 0 !important;
    padding-bottom: 75% !important; /* 4:3 비율 유지 */
    border-radius: 0 !important;
    overflow: hidden !important;
    background: var(--bg-card) !important;
    transition: all 0.3s ease !important;
    cursor: pointer !important;
    position: relative !important;
}

.category-grid .game-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.category-grid .game-image:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25) !important;
}

/* 카테고리 모드 게임 정보 */
.category-grid .game-info {
    padding: 20px !important;
    background: var(--bg-card) !important;
    text-align: center !important;
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
}

.category-grid .game-title {
    font-size: 1.3rem !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    margin-bottom: 12px !important;
    text-align: center !important;
    padding: 0 10px !important;
}

.category-grid .game-description {
    font-size: 0.9rem !important;
    color: var(--text-secondary) !important;
    line-height: 1.6 !important;
    margin-bottom: 15px !important;
    flex: 1 !important;
    text-align: left !important;
    padding: 0 5px !important;
}

.category-grid .game-meta {
    justify-content: flex-end !important;
    gap: 20px !important;
    margin-bottom: 15px !important;
    font-size: 0.85rem !important;
    text-align: right !important;
    padding: 0 10px !important;
}

.category-grid .play-btn {
    width: 100% !important;
    padding: 12px 20px !important;
    border-radius: 8px !important;
    font-size: 0.95rem !important;
    font-weight: 500 !important;
    background: var(--gradient-secondary) !important;
    transition: all 0.3s ease !important;
    border: none !important;
}

.category-grid .play-btn:hover {
    background: linear-gradient(45deg, #357abd, #4a90e2) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3) !important;
}

.game-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    filter: contrast(1.05) brightness(1.02) saturate(1.1);
    background: var(--bg-card);
    backface-visibility: hidden;
    transform: translateZ(0);
}

.game-card:hover .game-image img {
    transform: scale(1.1);
}

/* 게임 이미지 picture 태그 최적화 */
.game-image picture {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.game-image picture img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    filter: contrast(1.05) brightness(1.02) saturate(1.1);
    background: var(--bg-card);
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* 게임 오버레이 */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.3) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 15px;
}

.game-card:hover .game-overlay {
    opacity: 1;
}

.game-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.difficulty, .category {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 60px;
    text-align: center;
    white-space: nowrap;
}

.difficulty.easy {
    background: #2ecc71;
    color: white;
}

.difficulty.medium {
    background: #f39c12;
    color: white;
}

.difficulty.hard {
    background: #e74c3c;
    color: white;
}

.category.puzzle {
    background: #6c757d;
    color: white;
}

.category.card {
    background: #4a90e2;
    color: white;
}

.category.action {
    background: #f39c12;
    color: white;
}

.category.adventure {
    background: #27ae60;
    color: white;
}

.game-info {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 200px;
    justify-content: space-between;
}

.game-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-card);
    margin-bottom: 10px;
    transition: color 0.3s ease;
}

.game-description {
    color: var(--text-meta);
    line-height: 1.6;
    margin-bottom: 15px;
    flex: 1;
    transition: color 0.3s ease;
    min-height: 60px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.game-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.play-time, .players {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-meta);
    transition: color 0.3s ease;
}

.play-time i, .players i {
    color: #4a90e2;
}

.play-btn {
    background: var(--gradient-secondary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(74, 144, 226, 0.4);
}

/* 슬라이더 컨트롤 */
.slider-controls {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    transform: translateY(-50%);
    pointer-events: none;
    padding: 0 20px;
}

.slider-btn {
    background: var(--bg-card);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    pointer-events: all;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-light);
    z-index: 10;
}

.slider-btn:hover {
    background: var(--bg-card);
    transform: scale(1.1);
}

.slider-btn i {
    font-size: 1.2rem;
    color: var(--text-card);
    transition: color 0.3s ease;
}

.prev-btn {
    left: -25px;
}

.next-btn {
    right: -25px;
}

/* 슬라이드 인디케이터 */
.slide-indicators {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px; /* PC 기본값 */
}

.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border-light);
    cursor: pointer;
    transition: all 0.3s ease;
}

.indicator.active {
    background: #4a90e2;
    transform: scale(1.2);
}

/* 모바일에서 슬라이더 버튼 숨기기 */
@media (max-width: 768px), (max-height: 500px) {
    .slider-controls {
        display: none !important;
    }
}

/* 모바일에서 슬라이더 스와이프 가능하도록 설정 */
@media (max-width: 768px), (max-height: 500px) {
    .games-slider {
        overflow: hidden;
        touch-action: pan-y pinch-zoom;
    }
    
    .game-slide {
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
    }
}

/* 푸터 */
.footer {
    background: var(--bg-header);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-primary);
    border-top: 1px solid var(--border-light);
    width: 100%;
    margin-top: 60px;
    transition: all 0.3s ease;
}

.footer-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-left {
    flex: 1;
}

.footer-center {
    flex: 1;
    text-align: center;
}

.footer-center p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.75rem;
    transition: color 0.3s ease;
}

.footer-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    gap: 20px;
}

.footer-link {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.footer-link:hover {
    color: var(--text-primary);
    background: var(--bg-card);
    transform: translateY(-2px);
}

/* 모달 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 0;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-primary);
    border: 1px solid var(--border-light);
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-light);
}

.modal-title {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.3rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: 25px;
    text-align: center;
}

.modal-message {
    color: var(--text-secondary);
    margin: 0 0 20px 0;
    line-height: 1.6;
    white-space: pre-line;
}

.modal-email {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid var(--border-light);
}

.modal-email strong {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-family: 'Courier New', monospace;
}

/* 반응형 디자인 */
@media (max-width: 1100px) and (min-width: 890px) {
    /* 890~1100px 구간에서 3개 게임이 한 줄에 들어가도록 조정 */
    .games-slider .game-cards {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)) !important;
        gap: 20px !important;
    }

    .games-slider .game-cards:not(.category-grid) .game-card {
        width: 100% !important;
        max-width: 250px !important;
        margin: 0 !important;
        height: 100% !important;
        min-width: 0 !important;
        flex-shrink: 1 !important;
    }

    .games-slider .game-cards:not(.category-grid) .game-image {
        height: 0 !important;
        padding-bottom: 75% !important;
        width: 100% !important;
        overflow: hidden !important;
        position: relative !important;
    }

    .games-slider .game-cards:not(.category-grid) .game-image img {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
    }

    /* 게임 정보 텍스트 크기 조정 */
    .games-slider .game-cards:not(.category-grid) .game-info {
        padding: 14px !important;
        min-height: 130px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start !important;
        gap: 8px !important;
    }

    .games-slider .game-cards:not(.category-grid) .game-title {
        font-size: 1.2rem !important;
        margin-bottom: 8px !important;
        line-height: 1.3 !important;
        min-height: 26px !important;
        overflow: visible !important;
        display: block !important;
        color: var(--text-card) !important;
        font-weight: 600 !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        z-index: 1 !important;
    }

    .games-slider .game-cards:not(.category-grid) .game-description {
        font-size: 0.85rem !important;
        line-height: 1.3 !important;
        margin-bottom: 8px !important;
        min-height: 42px !important;
        overflow: hidden !important;
        flex: 1 !important;
    }

    .games-slider .game-cards:not(.category-grid) .game-meta {
        font-size: 0.75rem !important;
        margin-bottom: 8px !important;
        min-height: 18px !important;
        overflow: hidden !important;
    }

    .games-slider .game-cards:not(.category-grid) .play-btn {
        font-size: 0.85rem !important;
        padding: 8px 16px !important;
        height: 32px !important;
        margin-top: auto !important;
    }

    /* 슬라이더 높이 조정 */
    .games-slider {
        height: 450px !important;
        min-height: 450px !important;
    }

    .game-slide {
        height: 450px !important;
    }

    .games-slider .game-cards {
        height: 410px !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }

    /* 인디케이터 마진 조정 */
    .slide-indicators {
        margin-top: 20px !important;
    }

    /* 컨테이너 패딩 조정 */
    .games-container {
        padding: 25px !important;
        max-width: 100% !important;
    }
}

@media (max-width: 1024px) {
    .game-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .main-title {
        font-size: 2.5rem;
    }
}

/* 큰 화면에서 8개 카드 배치 최적화 */
@media (min-width: 1200px) {
    .games-slider .game-cards:not(.category-grid) {
        grid-template-columns: repeat(3, 350px);
        gap: 20px;
        max-width: 1200px;
        margin: 0 auto;
        justify-content: center;
        justify-items: start !important;
    }

    .games-slider .game-cards:not(.category-grid) .game-card {
        width: 350px;
        max-width: 350px;
    }

    /* 카테고리 그리드도 동일한 방식으로 처리 */
    .category-grid {
        grid-template-columns: repeat(3, 350px);
        gap: 20px;
        max-width: 1200px;
        margin: 0 auto;
        justify-content: center;
        justify-items: start !important;
    }

    .category-grid .game-card {
        width: 350px;
        max-width: 350px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .header-container {
        flex-direction: column;
        gap: 10px;
        padding: 15px 20px;
        align-items: center;
    }

    /* Hide theme toggle in original position on mobile */
    .theme-toggle {
        display: none;
    }

    /* 로고와 테마 토글을 가로로 배치 */
    .logo {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        max-width: 300px;
    }

    .logo-link {
        display: flex;
        align-items: center;
    }

    /* Show theme toggle inside logo container on mobile */
    .logo .theme-toggle {
        display: block;
        margin-left: 10px;
    }

    .nav-menu {
        display: flex; /* 모바일에서도 네비게이션 표시 */
        width: 100%;
        justify-content: center;
        margin-top: 10px;
        position: relative;
        z-index: 1001; /* 헤더보다 위에 표시 */
    }

    body {
        padding-top: 100px; /* 헤더 높이 증가 (카테고리 메뉴 추가) */
    }

    /* 모바일에서 카테고리 모드일 때 푸터 자동 바닥 배치 */
    body.category-mode-active {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
    }

    body.category-mode-active .container {
        flex: 1;
        display: flex;
        flex-direction: column;
        padding: 5px;
    }

    body.category-mode-active .games-section {
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    body.category-mode-active .category-grid {
        flex: 1;
        max-height: none !important;
        min-height: 0;
    }

    body.category-mode-active .footer {
        margin-top: auto;
        flex-shrink: 0;
    }

    /* 모바일에서 카테고리 링크 터치 영역 개선 */
    .nav-link {
        font-size: 0.8rem;
        padding: 8px 12px;
        min-height: 44px; /* 터치 영역 확대 */
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 6px;
        transition: all 0.3s ease;
        position: relative; /* z-index를 위한 position 설정 */
        z-index: 100; /* 다른 요소들보다 위에 표시 */
        cursor: pointer; /* 커서 포인터 추가 */
        user-select: none; /* 텍스트 선택 방지 */
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        pointer-events: auto; /* 클릭 이벤트 명시적 활성화 */
    }

    .nav-link:hover {
        background: rgba(255, 255, 255, 0.1);
        transform: translateY(-2px);
    }

    .nav-link:active {
        transform: translateY(0);
        background: rgba(255, 255, 255, 0.2);
    }

    .footer-container {
        flex-direction: column;
        gap: 8px;
        padding: 10px 20px;
        text-align: left;
    }

    .footer-right {
        justify-content: flex-start;
        gap: 15px;
    }

    /* 모바일 네비게이션 개선 */
    .nav-list {
        gap: 8px;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .hero-content {
        height: 200px;
    }

    /* 모바일 세로모드에서 카테고리 모드 hero 여백 줄이기 */
    body.category-mode-active .hero {
        margin-bottom: 10px !important;
    }

    /* 모바일 세로모드에서 카테고리 모드 hero-content 높이 줄이기 */
    body.category-mode-active .hero-content {
        height: 150px !important;
        margin-top: 10px !important;
    }

    /* 메인 페이지 슬라이더의 게임 카드들을 모바일에서 동적으로 배치 */
    /* 모바일 세로 모드에서 2개씩 배치하고 그룹 중앙 정렬 */
    @media (max-width: 768px) and (orientation: portrait) {
        .games-slider .game-cards {
            grid-template-columns: 280px !important;
            gap: 15px;
            justify-content: center !important;
            justify-items: center !important;
            max-width: 600px;
            margin: 0 auto;
        }
        
        /* 모바일 세로 모드에서 게임 카드 크기 조정 */
        .games-slider .game-cards .game-card {
            width: 280px !important;
            max-width: 280px !important;
            min-width: 280px !important;
            margin: 0 auto !important;
        }
    }
    
    /* 모바일 가로 모드에서 3개씩 배치하고 그룹 중앙 정렬 */
    @media (max-width: 768px) and (orientation: landscape) {
        .games-slider .game-cards {
            grid-template-columns: repeat(3, 1fr) !important;
            gap: 15px;
            justify-content: center;
            max-width: 900px;
            margin: 0 auto;
        }
        
        .games-slider .game-cards .game-card {
            width: 100% !important;
            max-width: 250px !important;
            min-width: 0 !important;
        }
    }

    /* 모바일 세로모드에서 메인 페이지 게임 카드 크기 조정 */
    .game-cards:not(.category-grid) .game-card {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }

    .game-cards:not(.category-grid) .game-image {
        height: 0 !important;
        padding-bottom: 75% !important; /* 4:3 비율 유지 */
        width: 100% !important;
        overflow: hidden !important;
        position: relative !important;
    }

    /* 모바일 세로모드에서 게임 정보 텍스트 크기 조정 */
    .game-cards:not(.category-grid) .game-title {
        font-size: 1.2rem !important;
        margin-bottom: 8px !important;
    }

    .game-cards:not(.category-grid) .game-description {
        font-size: 0.9rem !important;
        line-height: 1.4 !important;
        margin-bottom: 12px !important;
        min-height: 40px !important;
    }

    .game-cards:not(.category-grid) .game-meta {
        font-size: 0.8rem !important;
        margin-bottom: 15px !important;
    }

    .game-cards:not(.category-grid) .play-btn {
        font-size: 0.9rem !important;
        padding: 10px 20px !important;
        min-height: 40px !important;
    }

    .category-grid {
        max-height: 60vh;
        gap: 10px;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        padding: 5px;
    }

    /* 모바일 세로 모드에서 카테고리 그리드 1개씩 배치 */
    @media (max-width: 768px) and (orientation: portrait) {
        .games-container {
            max-width: 600px;
            margin: 0 auto;
        }
        
        .games-slider {
            max-width: 600px;
            margin: 0 auto;
        }
        
        .category-grid {
            grid-template-columns: 280px !important;
            gap: 15px;
            max-height: none;
            overflow-y: auto;
            justify-content: center !important;
            justify-items: center !important;
            max-width: 600px;
            margin: 0 auto;
        }
        
        .category-grid .game-card {
            width: 280px !important;
            max-width: 280px !important;
            min-width: 280px !important;
            margin: 0 auto !important;
        }
    }

    .category-grid .game-card {
        max-width: 280px !important;
    }

    .category-grid .game-image {
        height: 0 !important;
        padding-bottom: 75% !important; /* 4:3 비율 유지 */
        position: relative !important;
    }

    .category-grid .game-title {
        font-size: 1.2rem !important;
    }

    .category-grid .game-description {
        font-size: 0.85rem !important;
    }

    /* 모바일 세로모드에서 슬라이더 높이 조정 */
    .games-slider {
        height: 520px !important; /* 카드 높이(481px) + 인디케이터 마진(15px) + 인디케이터 높이(12px) + 여유공간(12px) */
        min-height: 520px !important;
    }
    
    .game-slide {
        height: 520px !important;
    }
    
    .games-slider .game-cards {
        height: 493px !important; /* 카드 높이(481px) + 여유공간(12px) */
    }

    /* 모바일 세로모드에서 인디케이터 마진 줄이기 */
    .slide-indicators {
        margin-top: 15px !important;
    }

    .games-container {
        padding: 10px;
        max-width: 500px;
        margin: 0 auto;
    }

    .game-image {
        height: 0;
        padding-bottom: 75%; /* 4:3 비율 유지 */
        position: relative;
    }

    /* 모든게임 모드 반응형 이미지 비율 */
    .game-cards:not(.category-grid) .game-image {
        height: 0 !important;
        padding-bottom: 75% !important; /* 4:3 비율 유지 */
        width: 100% !important;
        overflow: hidden !important;
        position: relative !important;
    }
    
    .game-cards:not(.category-grid) .game-image img {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
    }

    /* 슬라이더 버튼 터치 영역 확대 */
    .slider-btn {
        width: 50px;
        height: 50px;
        min-height: 44px;
        border-radius: 50%;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }

    .prev-btn {
        left: -25px;
    }

    .next-btn {
        right: -25px;
    }

    /* 게임 카드 터치 영역 개선 */
    .play-btn {
        min-height: 44px;
        font-size: 16px;
        padding: 12px 20px;
        border-radius: 8px;
    }

    /* 모바일 세로 모드에서 모바일 광고 표시 */
    .desktop-ad,
    .mobile-landscape-ad {
        display: none !important;
    }
    
    .mobile-portrait-ad {
        display: block !important;
    }
    
    /* 광고 슬라이더 모바일 최적화 */
    .ad-image {
        max-height: 200px;
        object-fit: cover;
        border-radius: 8px;
        /* 모바일 GIF 최적화 */
        will-change: transform;
        backface-visibility: hidden;
        transform: translateZ(0);
        /* 모바일에서 GIF 성능 향상 */
        image-rendering: -webkit-optimize-contrast;
        image-rendering: optimize-contrast;
    }

    /* 푸터 링크 터치 영역 확대 */
    .footer-link {
        min-height: 44px;
        padding: 10px 15px;
        font-size: 14px;
    }
}

/* 모바일 가로모드 (landscape) */
@media (max-width: 900px) and (orientation: landscape) {
    /* 모바일 가로 모드에서 모바일 가로 광고 표시 */
    .desktop-ad,
    .mobile-portrait-ad {
        display: none !important;
    }
    
    .mobile-landscape-ad {
        display: block !important;
    }
    
    /* 모바일 가로 모드 GIF 최적화 */
    .mobile-landscape-ad .ad-image {
        will-change: transform;
        backface-visibility: hidden;
        transform: translateZ(0);
        image-rendering: -webkit-optimize-contrast;
        image-rendering: optimize-contrast;
    }
    
    /* 모바일 가로모드에서 PC와 동일한 3개씩 배치하고 그룹 중앙 정렬 */
    .games-slider .game-cards {
        grid-template-columns: repeat(3, 250px) !important;
        gap: 15px !important;
        justify-content: center;
        justify-items: start !important;
        max-width: 900px;
        margin: 0 auto;
    }

    .games-slider .game-cards:not(.category-grid) .game-card {
        width: 250px !important;
        max-width: 250px !important;
        min-width: 250px !important;
        margin: 0 !important;
        height: 100% !important;
    }

    .games-slider .game-cards:not(.category-grid) .game-image {
        height: 0 !important;
        padding-bottom: 75% !important; /* 4:3 비율 유지 */
        width: 100% !important;
        overflow: hidden !important;
        position: relative !important;
    }

    .games-slider .game-cards:not(.category-grid) .game-image img {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
    }

    /* 모바일 가로모드에서 게임 정보 텍스트 크기 조정 */
    .games-slider .game-cards:not(.category-grid) .game-info {
        padding: 12px !important; /* 패딩 줄임 */
        min-height: 120px !important; /* 텍스트 영역 높이 조정 */
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start !important;
        gap: 6px !important;
    }

    .games-slider .game-cards:not(.category-grid) .game-title {
        font-size: 1.1rem !important;
        margin-bottom: 6px !important;
        line-height: 1.3 !important;
        min-height: 24px !important; /* 최소 높이 조정 */
        overflow: visible !important; /* overflow 제거하여 제목이 보이도록 */
        display: block !important;
        color: var(--text-card) !important; /* 텍스트 색상 명시적 설정 */
        font-weight: 600 !important; /* 제목 굵기 증가 */
        visibility: visible !important; /* 가시성 명시적 설정 */
        opacity: 1 !important; /* 투명도 명시적 설정 */
        position: relative !important; /* 위치 명시적 설정 */
        z-index: 1 !important; /* z-index 설정 */
    }

    .games-slider .game-cards:not(.category-grid) .game-description {
        font-size: 0.8rem !important;
        line-height: 1.2 !important;
        margin-bottom: 6px !important;
        min-height: 38px !important; /* 최소 높이 조정 */
        overflow: hidden !important;
        flex: 1 !important;
    }

    .games-slider .game-cards:not(.category-grid) .game-meta {
        font-size: 0.7rem !important;
        margin-bottom: 6px !important;
        min-height: 16px !important; /* 최소 높이 조정 */
        overflow: hidden !important;
    }

    .games-slider .game-cards:not(.category-grid) .play-btn {
        font-size: 0.8rem !important;
        padding: 6px 12px !important;
        height: 28px !important; /* 높이 조정 */
        margin-top: auto !important;
    }

    /* 가로모드에서 슬라이더 높이 조정 */
    .games-slider {
        height: 400px !important; /* 게임카드 높이 조정 */
        min-height: 400px !important;
    }

    .game-slide {
        height: 400px !important;
    }

    .games-slider .game-cards {
        height: 360px !important; /* 게임 카드만의 높이 조정 */
        display: grid !important;
        justify-content: center !important; /* 가운데 정렬 */
        align-items: center !important;
    }

    /* 모바일 가로모드에서 카테고리 그리드도 PC와 동일하게 적용 */
    .category-grid {
        grid-template-columns: repeat(3, 250px) !important;
        gap: 15px !important;
        justify-content: center;
        justify-items: start !important;
        max-width: 900px;
        margin: 0 auto;
    }

    .category-grid .game-card {
        width: 250px !important;
        max-width: 250px !important;
        min-width: 250px !important;
        margin: 0 !important;
    }

    /* 가로모드에서만 인디케이터 마진 줄이기 */
    .slide-indicators {
        margin-top: 0px !important;
    }

    /* 가로모드에서 컨테이너 패딩 조정 */
    .games-container {
        padding: 20px !important; /* 컨테이너 패딩 증가 */
        max-width: 100% !important;
    }
}

@media (max-width: 480px) {
    .header-container {
        padding: 10px 15px;
        align-items: center;
        gap: 8px;
        flex-direction: column; /* 세로 배치로 변경 */
    }

    body {
        padding-top: 120px; /* 헤더 높이 증가 (세로 배치로 인한 높이 증가) */
    }

    .logo-image {
        width: 35px;
        height: 35px;
    }

    .logo-text {
        font-size: 1.2rem;
    }

    /* 로고와 테마 토글을 가로로 배치 */
    .logo {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        max-width: 280px;
    }

    .logo-link {
        display: flex;
        align-items: center;
        flex-direction: row;
    }

    /* Show theme toggle inside logo container on mobile */
    .logo .theme-toggle {
        display: block;
        margin-left: 8px;
    }

    /* 작은 화면에서도 네비게이션 표시 */
    .nav-menu {
        display: flex;
        width: 100%;
        justify-content: center;
        margin-top: 8px;
        position: relative;
        z-index: 1001; /* 헤더보다 위에 표시 */
    }

    .nav-link {
        font-size: 0.7rem;
        padding: 6px 10px;
        min-height: 32px;
        border-radius: 5px;
    }

    .hero {
        padding: 0;
    }

    .hero-content {
        height: 180px;
    }

    .games-container {
        padding: 12px;
    }
    
    /* 작은 화면에서 게임 카드 1개씩 배치하고 그룹 중앙 정렬 */
    .games-slider {
        max-width: 500px;
        margin: 0 auto;
    }
    
    .games-slider .game-cards {
        grid-template-columns: 280px !important;
        gap: 10px;
        justify-content: center !important;
        justify-items: center !important;
        max-width: 500px;
        margin: 0 auto;
    }
    
    .games-slider .game-cards .game-card {
        width: 280px !important;
        max-width: 280px !important;
        min-width: 280px !important;
        margin: 0 auto !important;
    }

    .category-grid {
        grid-template-columns: 280px !important;
        gap: 10px;
        padding: 8px;
        justify-content: center !important;
        justify-items: center !important;
        max-width: 500px;
        margin: 0 auto;
    }

    .category-grid .game-card {
        width: 280px !important;
        max-width: 280px !important;
        min-width: 280px !important;
        margin: 0 auto !important;
    }

    .category-grid .game-image {
        height: 0 !important;
        padding-bottom: 75% !important; /* 4:3 비율 유지 */
        position: relative !important;
    }

    .category-grid .game-title {
        font-size: 1.1rem !important;
    }

    .category-grid .game-description {
        font-size: 0.8rem !important;
    }

    .category-grid .game-meta {
        gap: 15px !important;
        font-size: 0.8rem !important;
    }

    .game-info {
        padding: 15px;
    }

    /* 작은 화면에서 슬라이더 버튼 숨김 */
    .slider-controls {
        display: none;
    }

    /* 터치 제스처를 위한 스와이프 힌트 */
    .games-slider {
        position: relative;
    }

    .games-slider::after {
        content: '← 스와이프 →';
        position: absolute;
        bottom: -30px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 12px;
        color: var(--text-secondary);
        opacity: 0.7;
    }

    /* 게임 카드 터치 피드백 */
    .game-card {
        transition: transform 0.2s ease;
    }

    .game-card:active {
        transform: scale(0.98);
    }

    /* 버튼 터치 피드백 */
    .play-btn:active {
        transform: scale(0.95);
    }

    /* 터치 영역 확대 */
    .play-btn {
        min-height: 48px;
        font-size: 16px;
        padding: 14px 24px;
    }
} 