:root {
    --bg-color: #f4f7f9;
    --surface-color: #ffffff;
    --primary-color: #007aff;
    --primary-variant-color: #0056b3;
    --secondary-color: #34c759; /* Green for Get/Download */
    --android-color: #3DDC84; /* Android green */
    --ios-color: #007AFF; /* iOS blue (same as primary) */
    --text-color: #1d1d1f;
    --text-color-secondary: #6e6e73;
    --border-color: #e5e5e5;
    --btn-text-color: #ffffff;
}

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

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

header {
    background: var(--surface-color);
    padding: 1rem 0;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    position: sticky; /* Make header sticky */
    top: 0;
    z-index: 100; /* Ensure header is above other content */
}

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

.logo-link {
    text-decoration: none;
}

header h1 {
    color: var(--text-color);
    font-size: 2rem;
    margin-bottom: 0;
}

nav {
    display: flex;
    gap: 25px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-color-secondary);
    font-weight: 500;
    font-size: 1rem;
    padding: 5px 0;
    border-bottom: 2px solid transparent;
    transition: color 0.3s, border-color 0.3s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

main {
    padding: 0 0 2rem 0;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.game-card {
    background-color: var(--surface-color);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    padding: 15px;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.game-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    border-radius: 12px;
    transition: box-shadow 0.3s ease;
}

.game-card-link:hover .game-card {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.game-card img {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    margin-right: 15px;
    flex-shrink: 0;
    background-color: #eee;
}

.game-info {
    flex-grow: 1;
    overflow: hidden;
}

.game-info h3 {
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.game-info p {
    font-size: 0.9rem;
    color: var(--text-color-secondary);
}

.btn {
    background-color: var(--primary-color);
    color: var(--btn-text-color);
    font-weight: bold;
    border: none;
    border-radius: 20px;
    padding: 8px 20px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    flex-shrink: 0;
    font-size: 0.9rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover {
    background-color: var(--primary-variant-color);
}

.btn.btn-get {
    background-color: var(--secondary-color);
}

.btn.btn-get:hover {
    background-color: #2da44e;
}

footer {
    text-align: center;
    padding: 2rem 0;
    margin-top: 2rem;
    background-color: transparent;
    border-top: 1px solid var(--border-color);
    color: var(--text-color-secondary);
}

/* Hero Section */
.hero {
    position: relative;
    width: 100%;
    height: 55vh;
    min-height: 380px;
    max-height: 480px;
    overflow: hidden;
    margin-bottom: 2rem;
    background-color: #e0e0e0;
}

.hero-slides {
    width: 100%;
    height: 100%;
}

.hero-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    display: flex;
    align-items: center;
    text-decoration: none;
}

.hero-slide.active {
    opacity: 1;
    z-index: 1;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
}

.hero-slide::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.4) 50%, rgba(0,0,0,0.0) 100%);
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 1;
    color: #fff;
    max-width: 550px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
}

.hero-icon {
    width: 90px;
    height: 90px;
    border-radius: 20px;
    margin-right: 20px;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.5);
    background-color: #eee;
}

.hero-text h2 {
    font-size: 2.8rem;
    margin-bottom: 0.5rem;
    color: #fff;
    border: none;
    padding: 0;
}

.hero-text p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: #f0f0f0;
}

.hero-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    gap: 10px;
}

.hero-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
    padding: 0;
}

.hero-dot.active,
.hero-dot:hover {
    background-color: #fff;
}

/* Main Layout Styles */
.main-layout {
    display: flex;
    gap: 30px;
    margin-top: 2rem;
}

.main-content {
    flex: 3;
    min-width: 0;
}

.sidebar {
    flex: 1;
    min-width: 280px;
    max-width: 320px;
}

.game-section {
    margin-bottom: 3rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.section-header h2 {
    font-size: 1.8rem;
    color: var(--text-color);
}

.see-more {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.2s;
}
.see-more:hover {
    color: var(--primary-variant-color);
}

.sidebar-widget {
    background-color: var(--surface-color);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    position: sticky;
    top: calc(1rem + 70px); 
}

.sidebar-widget h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.ranking-list {
    list-style: none;
}

.ranking-list li {
    margin-bottom: 15px;
}

.ranking-list li:last-child {
    margin-bottom: 0;
}

.ranking-list a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    border-radius: 8px;
    padding: 5px;
    transition: background-color 0.2s;
}

.ranking-list a:hover {
    background-color: var(--bg-color);
}

.ranking-list .rank-number {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-color-secondary);
    width: 30px;
    text-align: center;
    flex-shrink: 0;
}

.ranking-list img {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    margin: 0 10px;
    flex-shrink: 0;
    background-color: #eee;
}

.ranking-info {
    overflow: hidden;
}

.ranking-info h4 {
    font-size: 1rem;
    margin-bottom: 2px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-info p {
    font-size: 0.85rem;
    color: var(--text-color-secondary);
}

/* Game Detail Page */
.game-banner {
    width: 100%;
    height: 35vh;
    min-height: 250px;
    max-height: 350px;
    background-size: cover;
    background-position: center;
    background-color: #ddd;
}

.game-intro {
    position: relative;
    margin-top: -80px;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.game-header {
    display: flex;
    align-items: flex-end;
    margin-bottom: 2rem;
    position: relative;
    z-index: 2;
}

.game-icon-large {
    width: 120px;
    height: 120px;
    border-radius: 24px;
    margin-right: 20px;
    border: 4px solid var(--bg-color);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    background-color: var(--surface-color);
    flex-shrink: 0;
}

.game-title-group {
    flex-grow: 1;
}

.game-title-group h1 {
    font-size: 2.5rem;
    margin-bottom: 5px;
}

.game-title-group p {
    color: var(--text-color-secondary);
    font-size: 1.1rem;
}

.download-buttons {
    display: flex;
    gap: 15px;
    flex-shrink: 0;
    align-items: center;
}

.download-buttons .btn {
     padding: 12px 25px;
     font-size: 1rem;
     margin-left: 0;
}

.btn-android {
    background-color: var(--android-color);
}
.btn-android:hover {
    background-color: #30ab6c;
}

.btn-ios {
     background-color: var(--ios-color);
}
.btn-ios:hover {
    background-color: var(--primary-variant-color);
}


.game-stats {
    display: flex;
    text-align: center;
    background-color: var(--surface-color);
    border-radius: 12px;
    padding: 20px 10px;
    border: 1px solid var(--border-color);
    justify-content: space-around;
    margin-bottom: 2rem;
}

.game-stats > div {
    flex: 1;
    min-width: 0;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-color-secondary);
}

.game-details, .screenshots {
    margin-bottom: 2rem;
    background: var(--surface-color);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.game-details h2, .screenshots h2 {
    font-size: 1.8rem;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.game-description p {
    line-height: 1.8;
    font-size: 1rem;
}

.screenshots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.screenshots-grid img {
    width: 100%;
    border-radius: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background-color: #eee;
}

.screenshots-grid a:hover img {
    transform: scale(1.03);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}


/* New Pages General Styles */
.page-header {
    background-color: var(--surface-color);
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2.5rem;
}

/* Ranking Page Styles */
.ranking-page-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ranking-card {
    display: flex;
    align-items: center;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ranking-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.ranking-card .rank {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color-secondary);
    width: 50px;
    text-align: center;
    flex-shrink: 0;
}

.ranking-card img {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    margin: 0 15px;
    background-color: #eee;
}

.ranking-card-info {
    flex-grow: 1;
    overflow: hidden;
}

.ranking-card-info h3 {
    font-size: 1.2rem;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-card-info p {
    color: var(--text-color-secondary);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.ranking-card .btn {
    margin-left: 20px;
}

/* Game Detail Page Layout */
.game-detail-layout {
    display: flex;
    gap: 30px;
    margin-top: 2rem;
}

.game-content-main {
    flex: 3;
    min-width: 0;
}

.game-sidebar {
    flex: 1;
    min-width: 280px;
    max-width: 320px;
}

.game-sidebar .recommendation-section {
    background-color: var(--surface-color);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}
.game-sidebar .recommendation-section + .recommendation-section {
     margin-top: 20px;
}
.game-sidebar .recommendation-section:last-child {
    margin-bottom: 0;
}

.game-sidebar .recommendation-section h2 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.reco-game-link {
    text-decoration: none;
    color: inherit;
    display: block;
    border-radius: 8px;
}

.reco-game-card {
    display: flex;
    align-items: center;
    padding: 10px;
    transition: background-color 0.2s;
    border: 1px solid transparent;
    border-radius: 12px;
}

.reco-game-link:hover .reco-game-card {
    background-color: var(--bg-color);
    border-color: var(--border-color);
}

.reco-game-card img {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    margin-right: 15px;
    flex-shrink: 0;
    background-color: #eee;
}

.reco-game-info h4 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reco-game-info p {
    font-size: 0.9rem;
    color: var(--text-color-secondary);
}

/* Category buttons */
.game-categories {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.category-btn {
    background-color: var(--surface-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 8px 18px;
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
    text-decoration: none;
    font-size: 0.9rem;
    display: inline-block;
    text-align: center;
}

.category-btn:hover {
    background-color: var(--bg-color);
    border-color: var(--text-color-secondary);
}

.category-btn.active {
    background-color: var(--primary-color);
    color: var(--btn-text-color);
    border-color: var(--primary-color);
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 992px) {
    .main-layout, .game-detail-layout {
        flex-direction: column;
    }
    .sidebar, .game-sidebar {
        max-width: 100%;
    }
     .sidebar-widget {
        position: static;
    }
}

@media (max-width: 768px) {
    header {
        padding: 0.8rem 0;
    }
    .header-content {
        flex-direction: column;
        gap: 0.8rem;
        align-items: flex-start;
    }
    header h1 {
        font-size: 1.8rem;
    }

    .hero-content {
        max-width: 95%;
        text-align: center;
        align-items: center;
        flex-direction: column;
    }
    .hero-text h2 {
        font-size: 2rem;
    }
    .hero-icon {
        margin-right: 0;
        margin-bottom: 1rem;
    }

    .game-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .game-icon-large {
        margin-right: 0;
        margin-bottom: 15px;
    }
    .download-buttons {
        flex-direction: column;
        width: 100%;
        margin-top: 15px;
    }
    .download-buttons .btn {
        width: 100%;
        max-width: 250px;
    }

    .game-stats {
        flex-wrap: wrap;
        gap: 15px 10px;
    }
    .game-stats > div {
        flex-basis: calc(50% - 10px);
    }
}
