* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* **네비게이션 바** */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 0 20px;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
    text-decoration: none;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-item a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

.nav-item a:hover {
    color: #667eea;
}

.nav-item a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: #667eea;
    transition: width 0.3s ease;
}

.nav-item a:hover::after {
    width: 100%;
}

/* **모바일 메뉴** */
.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 4px;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: #333;
    border-radius: 3px;
    transition: all 0.3s ease;
}

/* **메인 컨테이너** */
.main-container {
    margin-top: 60px;
    min-height: calc(100vh - 60px - 80px);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* **게임 목록 영역** */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    max-width: 1200px;
    width: 100%;
    margin: 20px 0;
}

.game-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.15);
}

.game-thumbnail {
    width: 100%;
    height: 150px;
    background: linear-gradient(45deg, #ff6b6b, #feca57);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    margin-bottom: 15px;
    position: relative;
}

.game-title {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
}

.game-description {
    color: #666;
    font-size: 14px;
    line-height: 1.4;
}

.play-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
    opacity: 0;
}

.game-card:hover .play-button {
    opacity: 1;
}

.play-button:hover {
    background: white;
    transform: scale(1.1);
}

/* **게임 플레이 영역** */
.game-container {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 80px;
    background: white;
    z-index: 900;
    overflow: hidden;
}

.game-header {
    background: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.back-button {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.back-button:hover {
    background: #5a6fd8;
    transform: translateX(-2px);
}

.game-frame {
    width: 100%;
    height: calc(100% - 60px);
    border: none;
}

/* **하단 광고 영역** */
.bottom-ad {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.ad-placeholder {
    background: #e9ecef;
    padding: 20px;
    border-radius: 8px;
    color: #666;
    font-size: 14px;
    text-align: center;
}

/* **전면 광고** */
.fullscreen-ad {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.ad-content {
    background: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    position: relative;
    animation: fadeInScale 0.3s ease;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.ad-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.ad-close:hover {
    color: #333;
}

.welcome-section {
    text-align: center;
    padding: 40px 20px;
    color: white;
}

.welcome-title {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.welcome-subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* **반응형 디자인** */
@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        top: 60px;
        left: -100%;
        flex-direction: column;
        background: white;
        width: 100%;
        padding: 20px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        transition: left 0.3s ease;
        gap: 15px;
    }

    .nav-menu.active {
        left: 0;
    }

    .hamburger {
        display: flex;
    }

    .hamburger.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }

    .game-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .welcome-title {
        font-size: 2rem;
    }

    .welcome-subtitle {
        font-size: 1rem;
    }

    .bottom-ad {
        height: 60px;
    }

    .main-container {
        min-height: calc(100vh - 60px - 60px);
    }

    .game-container {
        bottom: 60px;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 0 15px;
    }

    .main-container {
        padding: 15px;
    }

    .game-card {
        padding: 15px;
    }

    .welcome-section {
        padding: 30px 15px;
    }

    .ad-content {
        padding: 30px 20px;
    }
}
