@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&family=Noto+Serif+SC:wght@400;700&display=swap');

/* =========================================
   Reset & Base Styles - Dunhuang Theme (Silk Road)
   ========================================= */
:root {
    /* Colors - Dunhuang Palette */
    --bg-color: #ffb6c1; /* 土黄 (Earth Yellow) - Base Background */
    --surface-color: #f8f9fa; /* 米黄 (Rice Paper) - Card/Content Background */
    --stone-green: #ff69b4; /* 石青 (Stone Blue/Green) */
    --ochre-red: #98fb98; /* 赭红 (Ochre Red) */
    --treasure-blue: #ff69b4; /* 宝蓝 (Treasure Blue) */
    --gilt-gold: #98fb98; /* 鎏金 (Gilt Gold) */
    
    --text-primary: #8b4513; /* Dark Brown */
    --text-secondary: #8b4513; /* Light Brown */
    
    /* UI Elements */
    --border-color: #98fb98; /* Gold Border */
    --card-shadow: 0 10px 25px rgba(43, 94, 114, 0.2);
    --hover-shadow: 0 15px 35px rgba(163, 62, 54, 0.3);
    
    /* Fonts - More readable modern fonts */
    --font-main: 'Roboto', 'Noto Serif SC', sans-serif;
    --font-title: 'Noto Serif SC', serif; /* Cleaner serif for titles */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
    width: 100%;
    /* overscroll-behavior: none; REMOVED to allow standard scroll feel */
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    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='%2398fb98' fill-opacity='0.1'%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");
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* Ensure vertical scrolling is enabled */
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* =========================================
   Navbar - Dunhuang Pattern & Gilt
   ========================================= */
.navbar {
    background-color: var(--stone-green);
    border-bottom: 3px solid var(--gilt-gold);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 1rem 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(212, 175, 55, 0.05) 10px, rgba(212, 175, 55, 0.05) 20px);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    text-decoration: none;
    display: flex;
    align-items: center;
}

.logo h1 {
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 2rem;
    color: var(--gilt-gold);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    letter-spacing: 2px;
    position: relative;
    padding: 5px 15px;
    border: 2px solid var(--gilt-gold);
    border-radius: 4px;
    background: rgba(0,0,0,0.2);
}

/* Flying Apsara Effect on Hover */
.logo h1::before, .logo h1::after {
    content: '☁';
    position: absolute;
    opacity: 0;
    transition: all 0.5s ease;
    color: var(--surface-color);
}

.logo h1:hover::before {
    opacity: 1;
    transform: translate(-20px, -10px);
    left: 0;
    top: 0;
}

.logo h1:hover::after {
    opacity: 1;
    transform: translate(20px, 10px);
    right: 0;
    bottom: 0;
}

.logo h1:hover {
    text-shadow: 0 0 10px var(--gilt-gold), 0 0 20px var(--ochre-red);
    box-shadow: 0 0 15px var(--gilt-gold) inset;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--surface-color);
    font-family: var(--font-title);
    font-weight: 500;
    font-size: 1.2rem;
    letter-spacing: 1px;
    position: relative;
    transition: color 0.3s;
    padding: 5px 10px;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--gilt-gold);
    transition: width 0.3s ease;
    box-shadow: 0 0 5px var(--gilt-gold);
}

.nav-links a:hover {
    color: var(--gilt-gold);
    text-shadow: 0 0 8px var(--gilt-gold);
}

.nav-links a:hover::after {
    width: 100%;
}

/* Hamburger */
.hamburger {
    display: none;
    cursor: pointer;
    flex-direction: column;
    gap: 6px;
    padding: 5px;
    z-index: 1001;
}

.hamburger .bar {
    width: 25px;
    height: 3px;
    background-color: var(--gilt-gold);
    transition: 0.3s;
    border-radius: 2px;
}

/* Hamburger Animation */
.hamburger .bar.active:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}
.hamburger .bar.active:nth-child(2) {
    opacity: 0;
}
.hamburger .bar.active:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* =========================================
   Ads
   ========================================= */
#adv1, #adv2, #adv3 {
    margin: 2px auto;
    background: rgba(255,255,255,0.5);
    border: 2px solid var(--ochre-red);
    max-width: 100%;
    border-radius: 8px;
}

/* =========================================
   Main Content & Categories
   ========================================= */
.article-categories {
    padding: 0rem 0;
}

.category {
    margin-bottom: 4rem;
    position: relative;
}

.category h3 {
    font-family: var(--font-title);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--ochre-red);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    background-image: linear-gradient(to right, transparent, var(--gilt-gold), transparent);
    background-size: 100% 2px;
    background-repeat: no-repeat;
    background-position: bottom;
    padding-bottom: 10px;
}

.category-icon {
    font-size: 2rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

/* =========================================
   Accordion Card - Vertical List Layout
   ========================================= */
.accordion-container {
    width: 100%;
    max-width: 800px; /* Limit width for better readability */
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.accordion-card {
    background: var(--surface-color);
    border: 2px solid var(--gilt-gold);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    /* Dunhuang Texture Overlay */
    background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1h2v2H1V1zm4 4h2v2H5V5zm4 4h2v2H9V9zm4 4h2v2h-2v-2zm4 4h2v2h-2v-2z' fill='%2398fb98' fill-opacity='0.1' fill-rule='evenodd'/%3E%3C/svg%3E");
}

.accordion-card.active {
    border-color: var(--ochre-red);
    box-shadow: 0 10px 20px rgba(163, 62, 54, 0.2);
}

/* Header: Always visible */
.accordion-header {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
    background: rgba(255,255,255,0.3);
    transition: background 0.3s;
}

.accordion-card:hover .accordion-header {
    background: rgba(212, 175, 55, 0.1); /* Gold tint */
}

.accordion-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--gilt-gold);
    margin-right: 20px;
    flex-shrink: 0;
}

.accordion-title {
    flex-grow: 1;
    font-family: var(--font-title);
    font-size: 1.4rem;
    color: var(--text-primary);
    margin: 0;
}

.accordion-arrow {
    font-size: 1.2rem;
    color: var(--ochre-red);
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.accordion-card.active .accordion-arrow {
    transform: rotate(180deg);
}

/* Body: Hidden by default */
.accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
    background: rgba(255,255,255,0.5);
}

.accordion-card.active .accordion-body {
    max-height: 600px; /* Arbitrary large height */
    border-top: 1px solid var(--gilt-gold);
}

.accordion-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.accordion-image {
    width: 100%;
    max-width: 400px;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--gilt-gold);
    margin-bottom: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.accordion-desc {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    max-width: 600px;
    line-height: 1.6;
}

.accordion-btn {
    display: inline-block;
    padding: 10px 30px;
    background-color: var(--ochre-red);
    color: var(--surface-color);
    text-decoration: none;
    font-family: var(--font-title);
    font-size: 1.2rem;
    border-radius: 4px;
    border: 1px solid var(--ochre-red);
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

.accordion-btn:hover {
    background-color: var(--stone-green);
    border-color: var(--stone-green);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
}


/* =========================================
   Auxiliary Pages
   ========================================= */
.auxiliary-page {
    background: var(--surface-color);
    padding: 3rem;
    margin: 2rem 0;
    border: 2px solid var(--gilt-gold);
    box-shadow: var(--card-shadow);
    border-radius: 8px;
}

.auxiliary-page h2 {
    font-family: var(--font-title);
    color: var(--ochre-red);
    border-bottom-color: var(--gilt-gold);
}

.contact-info {
    background: rgba(212, 175, 55, 0.1);
    border-left-color: var(--ochre-red);
}

/* =========================================
   Detail Page
   ========================================= */
.game-detail-info {
    background: var(--surface-color);
    border: 2px solid var(--gilt-gold);
    padding: 2rem; /* Ensure padding is defined here for calculation */
    overflow: hidden; /* Contain the image */
}

.game-detail-image {
    width: calc(100% + 4rem); /* Full width + compensation for parent padding */
    margin: -2rem -2rem 2rem -2rem; /* Negative margin to pull to edges */
    border-bottom: 2px solid var(--gilt-gold);
}

.game-detail-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Related Games Grid & Cards */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.game-card {
    background: var(--surface-color);
    border: 2px solid var(--gilt-gold);
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s, box-shadow 0.3s;
    height: 100%;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--hover-shadow);
    border-color: var(--ochre-red);
}

.game-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-bottom: 1px solid var(--gilt-gold);
}

.game-card-content {
    padding: 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center; /* Center horizontally */
    text-align: center; /* Center text */
}

.game-card h4 {
    font-family: var(--font-title);
    font-size: 1.1rem;
    color: var(--text-primary);
    margin: 0;
}
.play-button {
    background-color: var(--ochre-red) !important;
    border: 2px solid var(--gilt-gold) !important;
    color: var(--gilt-gold) !important;
    font-family: var(--font-title) !important;
    box-shadow: 0 4px 10px rgba(163, 62, 54, 0.4) !important;
}

.play-button:hover {
    background-color: var(--stone-green) !important;
    color: #fff !important;
}

/* =========================================
   Footer
   ========================================= */
.footer {
    background: var(--stone-green);
    border-top: 3px solid var(--gilt-gold);
    padding: 3rem 0;
}

.footer-content p, .footer-links a {
    color: var(--surface-color);
    opacity: 0.9;
}

.footer-links a:hover {
    color: var(--gilt-gold);
    text-shadow: 0 0 5px var(--gilt-gold);
}

/* =========================================
   Responsive
   ========================================= */
@media (max-width: 768px) {
    .navbar {
        padding: 0.8rem 0;
    }

    .hamburger {
        display: flex;
    }

    .nav-links {
        display: flex;
        flex-direction: column;
        position: fixed;
        right: -100%;
        top: 0;
        width: 70%;
        height: 100vh;
        background: var(--stone-green);
        border-left: 2px solid var(--gilt-gold);
        padding: 80px 20px 20px;
        gap: 1.5rem;
        transition: 0.3s ease;
        z-index: 1000;
        box-shadow: -5px 0 15px rgba(0,0,0,0.5);
    }

    .nav-links.active {
        right: 0;
    }

    .nav-links a {
        font-size: 1.4rem;
        width: 100%;
        text-align: center;
        padding: 10px 0;
    }

    .category h3 {
        font-size: 1.5rem;
    }
}
