/* =========================================
   Biến CSS & Cấu hình chung
   ========================================= */
:root {
    /* Bảng màu chủ đạo (Pirate Theme) */
    --color-deep-blue: #0B1E3B;
    --color-ocean-blue: #1B3B6F;
    --color-gold: #D4AF37;
    --color-gold-hover: #F4CF57;
    --color-blood-red: #8B0000;
    --color-parchment: #F5EDCB;
    --color-parchment-dark: #E0D5A8;
    --color-text-main: #2C2C2C;
    --color-text-light: #F5EDCB;

    /* Font chữ */
    --font-heading: 'Pirata One', cursive;
    --font-subheading: 'Cinzel Decorative', cursive;
    --font-body: 'Lato', sans-serif;

    /* Kích thước */
    --container-width: 1200px;
    --header-height: 80px;
}

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

body {
    font-family: var(--font-body);
    background-color: var(--color-deep-blue);
    color: var(--color-text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Container chung */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

/* =========================================
   Header & Navigation
   ========================================= */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background: rgba(11, 30, 59, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    border-bottom: 2px solid var(--color-gold);
    display: flex;
    align-items: center;
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo img {
    height: 60px;
    width: auto;
}

.game-name {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    /* Reduced from 2rem */
    color: var(--color-gold);
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.main-nav ul {
    display: flex;
    gap: 30px;
    align-items: center;
}

.main-nav a {
    font-family: var(--font-subheading);
    color: var(--color-gold);
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--color-blood-red);
    transition: width 0.3s ease;
}

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

.nav-cta {
    background-color: var(--color-blood-red);
    color: var(--color-parchment) !important;
    padding: 10px 20px;
    border-radius: 4px;
    border: 1px solid var(--color-gold);
}

.nav-cta:hover {
    background-color: var(--color-gold);
    color: var(--color-deep-blue) !important;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
}

.mobile-menu-toggle span {
    width: 30px;
    height: 3px;
    background-color: var(--color-gold);
    border-radius: 2px;
}

/* =========================================
   Hero Section
   ========================================= */
.hero {
    position: relative;
    height: 100vh;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-top: var(--header-height);
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
}

.hero-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-container iframe,
.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Ensure video covers the area without distortion */
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(11, 30, 59, 0.3), rgba(11, 30, 59, 0.8));
    z-index: -1;
}

.hero-content h1 {
    font-family: var(--font-heading);
    font-size: 4.5rem;
    color: var(--color-gold);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    margin-bottom: 20px;
    line-height: 1.1;
}

.hero-content p {
    font-size: 1.5rem;
    color: var(--color-parchment);
    max-width: 700px;
    margin: 0 auto 40px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.custom-shape-divider-bottom-1674779811 {
    position: absolute;
    bottom: -2px;
    /* Aggressive overlap to fix persistent line */
    left: 0;
    width: 100%;
    overflow: hidden;
    line-height: 0;
    transform: rotate(180deg);
    z-index: 5;
    /* Ensure it sits above the next section's background */
}

.custom-shape-divider-bottom-1674779811 svg {
    position: relative;
    display: block;
    width: calc(100% + 1.3px);
    height: 60px;
    /* Default height */
}

.custom-shape-divider-bottom-1674779811 .shape-fill {
    fill: var(--color-parchment);
}

.cta-group {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.btn-download {
    display: flex;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--color-gold);
    border-radius: 10px;
    padding: 10px 20px;
    width: 220px;
    /* Fixed width for equal size */
    transition: all 0.3s ease;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.btn-download:hover {
    background-color: var(--color-deep-blue);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.3);
    border-color: var(--color-gold-hover);
}

.btn-download .icon-wrapper {
    margin-right: 15px;
    width: 30px;
    display: flex;
    justify-content: center;
}

.btn-download .icon-wrapper img {
    width: 30px !important;
    /* Fixed width for icons */
    height: auto;
    object-fit: contain;
}

.btn-download .text-wrapper {
    display: flex;
    flex-direction: column;
}

.btn-download .small-text {
    font-size: 0.7rem;
    color: var(--color-parchment);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-download .large-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    font-family: var(--font-body);
    line-height: 1.2;
}

/* Specific adjustments */
.btn-download.apple .icon-wrapper img {
    filter: invert(1);
    /* Invert black logo to white */
}

.btn-download.google .icon-wrapper img {
    width: 28px !important;
    /* Slight adjustment for visual balance */
}

/* =========================================
   Overview Section
   ========================================= */
.overview {
    padding: 80px 0;
    background-color: var(--color-parchment);
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0IiBoZWlnaHQ9IjQiPgo8cmVjdCB3aWR0aD0iNCIgaGVpZ2h0PSI0IiBmaWxsPSIjZjVlZNiIi8+CjxyZWN0IHdpZHRoPSIxIiBoZWlnaHQ9IjEiIGZpbGw9IiNlMGQ1YTgiLz4KPC9zdmc+');
    /* Subtle texture pattern */
    color: var(--color-deep-blue);
    position: relative;
    z-index: 20;
    /* Higher priority than wave */
    box-shadow: 0 5px 0 var(--color-parchment);
    /* Solid buffer to hide seam */
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-header h2 {
    font-family: var(--font-heading);
    font-size: 3rem;
    color: var(--color-blood-red);
    margin-bottom: 10px;
}

.divider img {
    height: 40px;
    margin: 0 auto;
    opacity: 0.8;
}

.overview-content {
    display: flex;
    align-items: center;
    gap: 50px;
}

.overview-text {
    flex: 1;
    font-size: 1.2rem;
}

.overview-text p {
    margin-bottom: 20px;
}

.overview-image {
    flex: 1;
    /* Remove boxy frame */
    border: none;
    box-shadow: none;
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    /* Add floating animation */
    animation: floatCharacter 4s ease-in-out infinite;
}

.overview-image img {
    max-width: 100%;
    margin-left: 100px;
    margin-bottom: 50px;
    height: auto;
    /* Glow effect hugging the character */
    filter: drop-shadow(0 0 20px rgba(212, 175, 55, 0.4));
    transition: filter 0.3s ease;
    transform: scale(1.7);
    /* Tăng kích thước thêm 15% */
}

.overview-image:hover img {
    filter: drop-shadow(0 0 30px rgba(212, 175, 55, 0.8));
}

@keyframes floatCharacter {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

/* Wave Divider: Overview to Features (Parchment to Deep Blue) */
.wave-divider.wave-overview-to-features {
    position: relative;
    width: 100%;
    overflow: hidden;
    line-height: 0;
    z-index: 10;
    /* Lower priority than overview */
    margin-top: -20px;
    /* Tuck well underneath the buffer */
}

.wave-divider.wave-overview-to-features svg {
    position: relative;
    display: block;
    width: calc(100% + 1.3px);
    height: 60px;
}

.wave-divider.wave-overview-to-features .shape-fill {
    fill: var(--color-parchment);
}

@media (min-width: 768px) {
    .wave-divider.wave-overview-to-features svg {
        height: 120px;
    }
}

/* Compensate for wave overlap */
.features {
    margin-top: -60px;
    /* Overlap mobile wave height */
    padding-top: calc(90px + 60px);
    /* Add wave height to padding */
    position: relative;
    z-index: 1;
}

@media (min-width: 768px) {
    .features {
        margin-top: -120px;
        /* Overlap desktop wave height */
        padding-top: calc(90px + 120px);
    }
}

/* =========================================
   Features Section
   ========================================= */
.features {
    padding: 90px 0;
    background: radial-gradient(120% 120% at 50% 10%, rgba(244, 207, 87, 0.08), transparent 55%), var(--color-deep-blue);
    color: var(--color-parchment);
}

.features .section-header h2 {
    color: var(--color-gold);
    letter-spacing: 1px;
}

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

.feature-card {
    position: relative;
    background: linear-gradient(135deg, rgba(27, 59, 111, 0.7), rgba(11, 30, 59, 0.8));
    padding: 44px 32px;
    border-radius: 14px;
    border: 1px solid rgba(212, 175, 55, 0.6);
    text-align: center;
    transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.feature-card:hover {
    transform: translateY(-10px);
    background: linear-gradient(135deg, rgba(27, 59, 111, 0.9), rgba(11, 30, 59, 0.95));
    border-color: var(--color-gold-hover);
    box-shadow: 0 16px 40px rgba(212, 175, 55, 0.2);
}

.feature-icon {
    width: 90px;
    height: 90px;
    margin: 0 auto 22px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(244, 207, 87, 0.4), rgba(212, 175, 55, 0.1));
    display: grid;
    place-items: center;
    border: 1px solid rgba(244, 207, 87, 0.4);
    box-shadow: inset 0 0 12px rgba(244, 207, 87, 0.25);
}

.feature-card h3 {
    font-family: var(--font-subheading);
    font-size: 1.7rem;
    color: var(--color-gold);
    margin-bottom: 15px;
}

.feature-card p {
    color: rgba(245, 237, 203, 0.9);
    font-size: 1.05rem;
    line-height: 1.7;
}

.feature-icon svg {
    width: 58px;
    height: 58px;
}

/* =========================================
   Gallery Section (Swiper Slider)
   ========================================= */
.gallery {
    padding: 40px 0;
    /* Reduced from 80px */
    background-color: #050f1e;
}

.gallery .section-header h2 {
    color: var(--color-parchment);
}

.gallery .section-header {
    margin-bottom: 30px;
    /* Reduced from 60px */
}

.gallery-slider {
    width: 100%;
    padding: 20px 0;
    /* Reduced from 50px */
    overflow: hidden;
}

/* Fix excessive height issue identified by user */
.gallery-slider .swiper-wrapper {
    height: auto !important;
}

.swiper-slide {
    background-position: center;
    background-size: cover;
    width: 300px;
    max-width: 80%;
    height: 540px;
    border-radius: 8px;
    border: 2px solid var(--color-gold);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    opacity: 0.6;
    transform: scale(0.9);
}

.swiper-slide-active {
    opacity: 1;
    transform: scale(1.05);
    /* Phóng to nhẹ */
    z-index: 2;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.8);
    /* Fix: Glow ôm sát hình hơn */
    /* Hiệu ứng phát sáng vàng */
    border-color: var(--color-gold-hover);
}

.swiper-slide img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (max-width: 768px) {
    .video-container {
        padding-bottom: 56.25%;
        /* Giữ tỉ lệ 16:9 trên mobile cho dễ xem */
        max-width: 100%;
    }
}

/* =========================================
   Footer
   ========================================= */
.main-footer {
    background-color: #020810;
    padding: 50px 0 20px;
    text-align: center;
    color: var(--color-parchment-dark);
    border-top: 3px solid var(--color-gold);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.footer-logo img {
    height: 60px;
    /* Fixed height to prevent logo from being too large */
    width: auto;
    margin: 0 auto 30px;
    display: block;
}

.copyright {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* =========================================
   Animations
   ========================================= */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-up {
    animation: fadeUp 1s ease forwards;
    opacity: 0;
    /* Start hidden */
}

.delay-1 {
    animation-delay: 0.3s;
}

.delay-2 {
    animation-delay: 0.6s;
}

/* =========================================
   Responsive Design (Mobile)
   ========================================= */
@media (max-width: 768px) {

    /* Container Padding */
    .container {
        padding: 0 20px;
        /* Increased padding to prevent cut-off */
    }

    /* Header */
    :root {
        --header-height: 70px;
        /* Reduced height for mobile */
    }

    .main-header {
        height: auto;
        /* Allow height to grow */
        min-height: var(--header-height);
        padding: 5px 0;
        /* Add padding for content */
    }

    .logo img {
        height: 50px;
        /* Increased from 40px */
        width: auto;
        /* Maintain aspect ratio */
    }

    .game-name {
        font-size: 1.3rem;
        /* Increased from 1.15rem */
        letter-spacing: 1px;
        margin-top: 5px;
    }

    /* Mobile Nav */
    .main-nav {
        position: fixed;
        top: var(--header-height);
        right: -100%;
        width: 100%;
        /* Full width for better UX */
        height: calc(100vh - var(--header-height));
        background-color: rgba(11, 30, 59, 0.98);
        /* Almost opaque */
        backdrop-filter: blur(10px);
        flex-direction: column;
        justify-content: center;
        /* Center items vertically */
        padding: 40px;
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border-left: none;
        /* Remove border */
    }

    .main-nav.active {
        right: 0;
    }

    .main-nav ul {
        flex-direction: column;
        gap: 30px;
        width: 100%;
        text-align: center;
    }

    .main-nav a {
        font-size: 1.5rem;
        /* Larger touch targets */
        display: block;
        padding: 10px;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    /* Hero Section */
    .hero {
        padding-top: calc(var(--header-height) + 60px);
        /* Increased padding for auto-height header */
        min-height: auto;
        /* Allow content to dictate height */
        height: auto;
        padding-bottom: 100px;
        /* Space for wave */
    }

    .hero-content h1 {
        font-size: 2.8rem;
        line-height: 1.1;
        margin-bottom: 15px;
        margin-top: 20px;
    }

    .hero-content p {
        font-size: 1.1rem;
        padding: 0 10px;
        margin-bottom: 30px;
    }

    .cta-group {
        flex-direction: column;
        align-items: center;
        gap: 15px;
        width: 100%;
    }

    .btn-download {
        width: 220px;
        /* Fixed width for equal size */
        /* Full width buttons */
        max-width: 100%;
        justify-content: flex-start;
        /* Align left like desktop */
        /* Center content */
        padding: 10px 20px;
        /* Adjust padding */
    }

    /* Overview Section */
    .overview {
        padding: 50px 0;
    }

    .overview-content {
        flex-direction: column-reverse;
        gap: 0;
        /* Remove gap to bring text closer */
    }

    .overview-text {
        text-align: center;
        padding: 0 10px;
        position: relative;
        z-index: 2;
        /* Ensure text is above image if overlap */
    }

    .overview-image {
        margin-top: -30px;
        margin-bottom: 20px;

    }

    .overview-image img {
        transform: scale(1.35);
        max-width: 280px;
        margin: 0 auto;
        display: block;
    }

    /* Wave Divider Spacing */
    .wave-divider svg {
        height: 60px;
        /* Consistent height */
    }

    /* Features Section */
    .features {
        margin-top: -60px;
        /* Match mobile wave height */
        padding-top: calc(50px + 60px);
        /* Reduced padding + wave height */
        padding-bottom: 50px;
    }

    .feature-grid {
        grid-template-columns: 1fr;
        /* Single column */
        gap: 20px;
        padding: 0 10px;
    }

    .feature-card {
        padding: 30px 20px;
        /* Reduced padding */
    }

    /* Gallery */
    .gallery {
        padding: 30px 0;
    }

    .swiper-slide {
        width: 75% !important;
        /* Slightly narrower to show next slide hint */
        /* Make slides wider on mobile */
        height: 520px;
        /* Increased height for 9:16 portrait images (900x1600) */
        border-width: 1px;
        /* Thinner border for elegance on small screens */
    }

    /* Footer */
    .main-footer {
        padding: 40px 0 20px;
    }
}

/* Wave Divider */
.custom-shape-divider-bottom-1674779811 {
    position: absolute;
    left: 0;
    width: 100%;
    overflow: hidden;
    line-height: 0;
    transform: rotate(180deg);
}

.custom-shape-divider-bottom-1674779811 svg {
    position: relative;
    display: block;
    width: calc(100% + 1.3px);
    height: 60px;
}

.custom-shape-divider-bottom-1674779811 .shape-fill {
    fill: var(--color-parchment);
}

@media (min-width: 768px) {
    .custom-shape-divider-bottom-1674779811 svg {
        height: 120px;
    }
}

@media (min-width: 768px) {
    .hero {
        height: calc(100vh + 120px);
    }
}

/* Wave Divider Reusable */
.wave-divider {
    position: relative;
    width: 100%;
    overflow: hidden;
    line-height: 0;
}

.wave-divider svg {
    display: block;
    width: calc(130% + 1px);
    height: 110px;
}

.wave-divider .shape-fill {
    fill: var(--color-deep-blue);
}

.wave-divider.wave-light-to-dark .shape-fill {
    fill: var(--color-deep-blue);
    /* Sóng chuyển từ nền parchment xuống deep blue */
}

.wave-divider.wave-dark .shape-fill {
    fill: #050f1e;
}

.wave-divider.wave-gallery .shape-fill {
    fill: #050b14;
}

.wave-divider.wave-gallery {
    background: #050b14;
}

.wave-divider.wave-video .shape-fill {
    fill: #020810;
}

/* =========================================
   Paper Divider Effect
   ========================================= */
.paper-divider-top {
    position: absolute;
    top: -20px;
    left: 0;
    width: 100%;
    height: 40px;
    background-color: var(--color-parchment);
    z-index: 10;
    /* Jagged edge using clip-path */
    clip-path: polygon(0% 0%, 5% 100%, 10% 0%, 15% 100%, 20% 0%, 25% 100%, 30% 0%, 35% 100%,
            40% 0%, 45% 100%, 50% 0%, 55% 100%, 60% 0%, 65% 100%, 70% 0%, 75% 100%,
            80% 0%, 85% 100%, 90% 0%, 95% 100%, 100% 0%);
}

/* =========================================
   Video Intro Section
   ========================================= */
.video-intro {
    padding: 60px 0 80px;
    background-color: #050b14;
    /* Very dark background */
    position: relative;
    text-align: center;
}

.video-intro .section-header h2 {
    color: var(--color-gold);
    margin-bottom: 40px;
}

.video-container {
    position: relative;
    padding-bottom: 45%;
    /* Tỉ lệ thấp hơn để video thấp hơn nhưng dài hơn */
    height: 500px;
    overflow: hidden;
    max-width: 1000px;
    margin: 0 auto;
    border: 3px solid var(--color-gold);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    background: #000;
}

.video-container iframe,
.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}