/* Base Styles */
:root {
    --primary-color: #fbbf24;
    --secondary-color: #1f2937;
    --accent-color: #f59e0b;
    --text-color: #ffffff;
    --background-color: #111827;
    --card-background: #1f2937;
    --gradient-start: #fbbf24;
    --gradient-end: #f59e0b;
}

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

body {
    font-family: Arial, Helvetica, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: rgba(31, 41, 55, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(251, 191, 36, 0.3);
}

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

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.logo-icon {
    width: 2rem;
    height: 2rem;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary-color);
    flex-shrink: 0;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: bold;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
}

.nav-menu {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--primary-color);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Hero Section */
.hero {
    position: relative;
    padding-top: 7rem; /* 네비게이션 바 높이를 고려한 상단 패딩 */
    padding-bottom: 4rem; /* 섹션 하단 패딩 */
    overflow: hidden;
    /* padding은 body의 padding-top으로 대체되므로 여기서는 제거 */
    /* flex 및 align-items는 hero-content에서 제어 */
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--secondary-color), var(--background-color));
    z-index: -2;
}

.hero-pattern {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23fbbf24' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    z-index: -1;
}

.hero-content {
    display: flex;
    align-items: center;
    gap: 4rem;
    position: relative;
    z-index: 1;
    /* margin-top은 body의 padding-top으로 대체되므로 여기서는 제거 */
}

.hero-text {
    flex: 1;
}

.hero-title {
    font-size: 4rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
}

.hero-description {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    color: rgba(255, 255, 255, 0.9);
}

.hero-image {
    flex: 1;
    position: relative;
}

.hero-image img {
    width: 100%;
    height: auto;
    border-radius: 1rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.hero-badge {
    position: absolute;
    top: -1rem;
    right: -1rem;
    width: 4rem;
    height: 4rem;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary-color);
    font-size: 1.5rem;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* Hero Image */
.hero-image-carousel {
    flex-shrink: 0;
    position: relative;
    max-width: 600px;
    width: 100%;
    /* 성능 최적화 */
    contain: layout style paint;
    will-change: transform;
    height: 337px; /* 600 * 9/16 = 337.5 고정 높이 */
    margin: 0 auto;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    touch-action: pan-y pan-x pinch-zoom;
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    background-color: #000; /* Safari 렌더링 안정성을 위한 배경색 */
}

.carousel-inner {
    display: flex;
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.5s ease-in-out;
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.carousel-item {
    min-width: 100%;
    width: 100%;
    height: 100%;
    flex-shrink: 0;
    position: relative;
}

.carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
    border: none;
    padding: 0;
    margin: 0;
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    image-rendering: -webkit-optimize-contrast; /* Safari 이미지 렌더링 최적화 */
    image-rendering: optimize-contrast;
    /* 이미지 최적화 */
    will-change: transform;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.carousel-item picture {
    width: 100%;
    height: 100%;
    display: block;
    /* 최적화된 렌더링 */
    contain: layout style paint;
}

/* 이미지 로딩 상태 최적화 */
.carousel-item img {
    opacity: 1;
    transition: opacity 0.3s ease;
    background-color: #1a1a2e; /* 로딩 중 배경색 */
}

.carousel-item img[loading="lazy"]:not(.loaded) {
    opacity: 0.1;
    background: linear-gradient(45deg, #1a1a2e 25%, #16213e 25%, #16213e 50%, #1a1a2e 50%, #1a1a2e 75%, #16213e 75%);
    background-size: 20px 20px;
    animation: loading-shimmer 1.5s ease-in-out infinite;
}

.carousel-item img.loaded,
.carousel-item img[loading="eager"] {
    opacity: 1;
    background: none;
}

@keyframes loading-shimmer {
    0% { background-position: 0 0; }
    100% { background-position: 40px 40px; }
}

/* 저해상도 이미지 placeholder 효과 */
.carousel-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #1a1a2e 25%, transparent 25%), 
                linear-gradient(-45deg, #1a1a2e 25%, transparent 25%), 
                linear-gradient(45deg, transparent 75%, #1a1a2e 75%), 
                linear-gradient(-45deg, transparent 75%, #1a1a2e 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    opacity: 0.1;
    z-index: -1;
}

.carousel-control {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    cursor: pointer;
    z-index: 10;
    font-size: 1.5rem;
    border-radius: 0.5rem;
    transition: background-color 0.3s ease;
    touch-action: manipulation; /* 터치 최적화 */
    user-select: none; /* 텍스트 선택 방지 */
}

.carousel-control:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

.carousel-control.prev {
    left: 1rem;
}

.carousel-control.next {
    right: 1rem;
}

.carousel-dots {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    z-index: 10;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 2rem;
    backdrop-filter: blur(4px);
}

.dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation; /* 터치 최적화 */
    user-select: none; /* 텍스트 선택 방지 */
}

.dot.active {
    background-color: #fff;
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* 터치 피드백 개선 */
.dot:hover,
.dot:active {
    background-color: rgba(255, 255, 255, 0.8);
}

.carousel-control:active {
    background-color: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(0.95);
}

/* Buttons */
.cta-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: var(--secondary-color);
    border: none;
    border-radius: 0.5rem;
    font-size: 1.125rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(251, 191, 36, 0.3);
}

.cta-button-large {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem 2.5rem;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: var(--secondary-color);
    border: none;
    border-radius: 0.5rem;
    font-size: 1.25rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cta-button-large:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(251, 191, 36, 0.3);
}

/* Google Play Button Styles */
.google-play-btn {
    background: #000000 !important;
    border: 1px solid #333333;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    min-width: 180px;
}

.download-section .google-play-btn {
    margin: 0 auto;
}

.google-play-btn:hover {
    background: #1a1a1a !important;
    border-color: #555555;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.google-play-btn.cta-button-large {
    padding: 1rem 2rem;
    min-width: 220px;
}

.google-play-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    color: #ffffff;
}

.google-play-btn.cta-button-large .google-play-icon {
    width: 40px;
    height: 40px;
}

.google-play-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.1;
}

.download-section .google-play-text {
    align-items: center;
    text-align: center;
}

.get-it-on {
    font-size: 0.75rem;
    font-weight: 400;
    color: #ffffff;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.google-play {
    font-size: 1.1rem;
    font-weight: 500;
    color: #ffffff;
    margin-top: -2px;
}

.google-play-btn.cta-button-large .get-it-on {
    font-size: 0.85rem;
}

.google-play-btn.cta-button-large .google-play {
    font-size: 1.25rem;
}

/* Info Section */
.info-section {
    padding: 4rem 0;
    background-color: var(--secondary-color);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.info-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.info-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end));
    opacity: 0.8;
}

.info-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.2);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.1));
}

.card-icon {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--secondary-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.card-title {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.card-text {
    color: var(--text-color);
    line-height: 1.6;
    font-size: 1rem;
}

#how-to-play .card-text {
    text-align: left;
}

#how-to-play .card-text ul {
    list-style-type: none;
    padding: 0;
    margin: 1rem 0;
}

#how-to-play .card-text li {
    margin-bottom: 0.5rem;
    position: relative;
    padding-left: 1.5rem;
}

#how-to-play .card-text li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

.play-steps {
    list-style: none;
    counter-reset: step-counter;
}

.play-steps li {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    color: rgba(255, 255, 255, 0.9);
}

.step-number {
    width: 2rem;
    height: 2rem;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary-color);
    font-weight: bold;
}

.support-email {
    display: inline-block;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.3s ease;
    border-radius: 4px;
    padding: 2px 6px;
}

.support-email:hover {
    background-color: rgba(255, 255, 255, 0.05);
    transform: translateY(-1px);
}

/* Features Section */
.features-section {
    padding: 4rem 0;
    background-color: var(--background-color);
}

.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-title {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.section-description {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.9);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.feature-item {
    text-align: center;
    padding: 2rem;
    background-color: var(--card-background);
    border-radius: 1rem;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.feature-item:hover {
    transform: translateY(-5px);
}

.feature-icon {
    width: 4rem;
    height: 4rem;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary-color);
    font-size: 1.5rem;
    margin: 0 auto 1.5rem;
}

.feature-title {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.feature-text {
    color: rgba(255, 255, 255, 0.9);
}

/* Download Section */
.download-section {
    padding: 4rem 0;
    background: linear-gradient(135deg, var(--secondary-color), var(--background-color));
    text-align: center;
}

.download-title {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.download-description {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Privacy Policy Page Styles */
.privacy-policy {
    padding: 4rem 0;
    color: var(--text-color);
}

.privacy-policy h1 {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 2rem;
    margin-top: 3rem;
    color: var(--primary-color);
}

.privacy-policy h2 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin: 2rem 0 1rem;
}

.privacy-policy h3 {
    font-size: 1.4rem;
    color: var(--primary-color);
    margin: 1.5rem 0 1rem;
}

.privacy-policy p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.privacy-policy ul {
    margin: 1rem 0;
    padding-left: 2rem;
}

.privacy-policy li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

/* Footer Styles */
.footer {
    background-color: rgba(31, 41, 55, 0.95);
    padding: 1rem 0;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    text-align: center;
    width: 100%;
    padding: 0 2rem;
}

.footer-links {
    display: flex;
    gap: 3rem;
    justify-content: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    width: calc(100% - 4rem);
}

.footer-links a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

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

.footer-bottom {
    text-align: center;
    margin-top: 1rem;
    color: rgba(255, 255, 255, 0.5);
    width: 100%;
}

.footer-copyright {
    color: var(--text-color);
    font-size: 0.9rem;
}

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

.logo-icon {
    width: 2rem;
    height: 2rem;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary-color);
    flex-shrink: 0;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: bold;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .hero-title {
        font-size: 3rem;
    }

    .hero-content {
        flex-direction: column;
        text-align: center;
    }

    .hero-image {
        margin-top: 2rem;
    }

    .hero-image-carousel {
        max-width: 500px;
        height: 281px; /* 500 * 9/16 */
    }
}

@media (max-width: 768px) {
    .nav-menu {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }

    .nav-menu.active {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--secondary-color);
        padding: 1rem;
        gap: 1rem;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-image-carousel {
        max-width: 400px;
        height: 225px; /* 400 * 9/16 */
    }

    /* 이미지 품질 최적화 */
    .carousel-item img {
        image-rendering: auto;
        image-rendering: crisp-edges;
        image-rendering: -webkit-optimize-contrast;
    }

    .footer-links {
        flex-direction: column;
        gap: 1.5rem;
    }

    .google-play-btn {
        max-width: 300px;
        margin: 0 auto;
    }

    .google-play-btn.cta-button-large {
        max-width: 320px;
        margin: 0 auto;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-description {
        font-size: 1rem;
    }

    .hero-image-carousel {
        max-width: 320px;
        height: 180px; /* 320 * 9/16 */
    }

    /* 초소형 화면에서 이미지 최적화 */
    .carousel-item img {
        image-rendering: auto;
        image-rendering: -webkit-optimize-contrast;
        /* 메모리 최적화 */
        will-change: auto;
    }

    /* 캐러셀 컨트롤 크기 조정 */
    .carousel-control {
        padding: 0.5rem 0.75rem;
        font-size: 1.25rem;
    }

    .carousel-dots {
        bottom: 0.5rem;
        padding: 0.25rem 0.75rem;
    }

    .dot {
        width: 0.5rem;
        height: 0.5rem;
    }

    .cta-button {
        width: 100%;
        justify-content: center;
    }

    .google-play-btn {
        width: auto !important;
        max-width: 280px;
        margin: 0 auto;
    }

    .google-play-btn.cta-button-large {
        width: auto !important;
        max-width: 300px;
        margin: 0 auto;
    }
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 6rem;
}
