/* Global Styles */
:root {
    --primary-color: #1a73e8;
    --secondary-color: #0c4da2;
    --accent-color: #ffcc00;
    --text-color: #333;
    --light-gray: #f5f5f5;
    --medium-gray: #e0e0e0;
    --dark-gray: #757575;
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --error-color: #f44336;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-color);
    background-color: #f9f9f9;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: var(--transition);
}

a:hover {
    color: var(--secondary-color);
}

img {
    max-width: 100%;
    height: auto;
}

ul {
    list-style: none;
}

button {
    cursor: pointer;
    border: none;
    background-color: var(--primary-color);
    color: white;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

button:hover {
    background-color: var(--secondary-color);
}

input, select, textarea {
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    padding: 8px 12px;
    width: 100%;
    font-family: inherit;
    transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

/* Header */
header {
    background-color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 15px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo-container {
    display: flex;
    align-items: center;
    padding: 0 10px;
}

.logo-container a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-mascot {
    height: 40px;
    margin-right: 10px;
}

.logo-text {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    letter-spacing: 0.5px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.main-nav-container {
    display: flex;
    justify-content: center;
}

.main-nav {
    display: flex;
    gap: 20px;
}

.main-nav a {
    color: var(--text-color);
    font-weight: 500;
    padding: 5px 10px;
    border-radius: var(--border-radius);
}

.main-nav a:hover {
    background-color: var(--light-gray);
}

.main-nav a.active {
    color: var(--primary-color);
    background-color: rgba(26, 115, 232, 0.1);
}

.search-container {
    display: flex;
    align-items: center;
    width: 300px;
}

.search-container input {
    border-radius: var(--border-radius) 0 0 var(--border-radius);
    border-right: none;
}

.search-container button {
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-container svg {
    width: 20px;
    height: 20px;
}

/* Mobile menu toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    cursor: pointer;
}

.mobile-menu-toggle span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: var(--primary-color);
    border-radius: 3px;
}

/* Mobile menu */
.mobile-menu {
    display: none;
}

/* Banner */
.banner {
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    color: white;
    text-align: center;
    padding: 40px 20px;
}

.banner h1 {
    font-size: 2.2rem;
    margin-bottom: 10px;
}

/* Main Content */
main {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

section {
    margin-bottom: 40px;
}

section h2 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: var(--text-color);
    border-bottom: 2px solid var(--light-gray);
    padding-bottom: 10px;
}

/* Game Grid */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

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

.game-card {
    background-color: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

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

.game-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.game-info {
    padding: 15px;
}

.game-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-color);
}

.game-category {
    display: inline-block;
    background-color: var(--light-gray);
    color: var(--dark-gray);
    font-size: 0.8rem;
    padding: 3px 8px;
    border-radius: 20px;
    margin-bottom: 10px;
}

/* Categories */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
}

.category-card {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

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

.category-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 15px;
    background-color: rgba(26, 115, 232, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-card h3 {
    font-size: 1.1rem;
    color: var(--text-color);
}

/* Load More */
.load-more {
    text-align: center;
    margin-top: 30px;
}

.load-more button {
    background-color: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 10px 30px;
}

.load-more button:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Footer */
footer {
    background-color: #222;
    color: white;
    padding: 40px 20px 20px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.footer-section h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--accent-color);
}

.footer-section p {
    margin-bottom: 15px;
    color: #ccc;
}

.footer-section ul li {
    margin-bottom: 8px;
}

.footer-section ul li a {
    color: #ccc;
}

.footer-section ul li a:hover {
    color: white;
}

.footer-bottom {
    max-width: 1200px;
    margin: 30px auto 0;
    padding-top: 20px;
    border-top: 1px solid #444;
    text-align: center;
    color: #999;
    font-size: 0.9rem;
}

/* Game Detail Page */
.game-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
    margin-bottom: 40px;
}

.game-sidebar {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
}

.game-info-card {
    padding: 20px;
}

.game-info-card h1 {
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.game-detail-image {
    width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
}

.game-metadata {
    margin-bottom: 20px;
}

.metadata-item {
    margin-bottom: 10px;
}

.metadata-label {
    font-weight: 600;
    margin-right: 5px;
}

.game-description h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.game-content {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
}

/* Game Frame Styles - PC Version */
.game-frame-container {
    padding: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
    background-color: #fff;
}

.game-frame-container iframe {
    flex: 1;
    width: 100%;
    min-height: 500px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    border: 0;
    background-color: #fff;
}

.game-controls {
    display: flex;
    justify-content: flex-end;
}

.fullscreen-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

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

/* Category Page */
.category-header {
    margin-bottom: 30px;
    text-align: center;
}

.category-header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

/* Tags Page */
.tags-header {
    margin-bottom: 30px;
    text-align: center;
}

.tags-header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 40px;
}

.tag-item {
    background-color: white;
    color: var(--text-color);
    padding: 8px 16px;
    border-radius: 30px;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    cursor: pointer;
}

.tag-item:hover, .tag-item.active {
    background-color: var(--primary-color);
    color: white;
}

#selected-tag-title {
    margin-bottom: 20px;
}

/* About Page */
.about-header {
    margin-bottom: 30px;
    text-align: center;
}

.about-header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.about-section {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--box-shadow);
}

.about-section h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    border-bottom: none;
    padding-bottom: 0;
}

.about-section p {
    margin-bottom: 15px;
}

.about-section ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.about-section ul li {
    list-style-type: disc;
    margin-bottom: 8px;
}

/* Contact Page */
.contact-header {
    margin-bottom: 30px;
    text-align: center;
}

.contact-header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.contact-form-container {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--box-shadow);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.submit-btn {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    font-weight: 500;
    margin-top: 10px;
}

.contact-info {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--box-shadow);
}

.contact-info h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    border-bottom: none;
    padding-bottom: 0;
}

.info-item {
    margin-bottom: 25px;
}

.info-item h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-link {
    display: inline-block;
    padding: 8px 15px;
    background-color: var(--light-gray);
    border-radius: 30px;
    transition: var(--transition);
}

.social-link:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Privacy & Terms Pages */
.privacy-header, .terms-header {
    margin-bottom: 30px;
    text-align: center;
}

.privacy-header h1, .terms-header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.policy-section, .terms-section {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: var(--box-shadow);
}

.policy-section h2, .terms-section h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    border-bottom: none;
    padding-bottom: 0;
}

.policy-section h3 {
    font-size: 1.2rem;
    margin: 20px 0 10px;
}

.policy-section p, .terms-section p {
    margin-bottom: 15px;
}

.policy-section ul, .terms-section ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.policy-section ul li, .terms-section ul li {
    list-style-type: disc;
    margin-bottom: 8px;
}

/* Category Icon Styles */
.action-icon {
    background-image: url('../imgs/icons/action.png');
    background-size: cover;
    background-position: center;
}

.puzzle-icon {
    background-image: url('../imgs/icons/puzzle.png');
    background-size: cover;
    background-position: center;
}

.racing-icon {
    background-image: url('../imgs/icons/racing.png');
    background-size: cover;
    background-position: center;
}

.simulation-icon {
    background-image: url('../imgs/icons/simulation.png');
    background-size: cover;
    background-position: center;
}

.adventure-icon {
    background-image: url('../imgs/icons/adventure.png');
    background-size: cover;
    background-position: center;
}

.strategy-icon {
    background-image: url('../imgs/icons/strategy.png');
    background-size: cover;
    background-position: center;
}

.sports-icon {
    background-image: url('../imgs/icons/sports.png');
    background-size: cover;
    background-position: center;
}

.arcade-icon {
    background-image: url('../imgs/icons/arcade.png');
    background-size: cover;
    background-position: center;
}

.matching-icon {
    background-image: url('../imgs/icons/matching.png');
    background-size: cover;
    background-position: center;
}

.dressup-icon {
    background-image: url('../imgs/icons/dressup.png');
    background-size: cover;
    background-position: center;
}

/* Mobile Styles - For responsive design similar to Yad.com */
@media (max-width: 767px) {
    body {
        background-color: #f5f5f5;
    }

    header {
        padding: 8px 15px;
        flex-direction: row;
        align-items: center;
        position: fixed;
        width: 100%;
        background: white;
        height: 60px;
        box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
    }

    .mobile-menu-toggle {
        display: flex;
        margin-right: 15px;
        z-index: 1001;
    }

    .logo-container {
        display: flex;
        justify-content: center;
        align-items: center;
        flex-grow: 1;
        padding: 0;
    }

    .logo-mascot {
        height: 32px;
        margin-right: 6px;
    }

    .logo-text {
        font-size: 1.5rem;
        color: #FF9800;
        font-weight: bold;
        text-shadow: none;
    }

    .main-nav-container {
        display: none; /* Hide on mobile */
    }

    .search-container {
        display: none; /* Hide desktop search on mobile */
    }

    .search-container-mobile {
        display: block;
        margin-left: 15px;
    }

    .banner {
        display: none; /* Hide banner on mobile */
    }

    main {
        padding: 0 10px;
        margin: 70px auto 15px; /* Adjust top margin to account for header */
    }

    .game-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .featured-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .game-card {
        border-radius: 10px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    }

    .game-card:hover {
        transform: none;
    }

    .game-image {
        height: 90px;
        object-fit: cover;
    }

    .game-info {
        padding: 6px;
    }

    .game-title {
        font-size: 0.8rem;
        margin-bottom: 2px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-weight: 500;
    }

    .game-category {
        font-size: 0.65rem;
        padding: 1px 4px;
        margin-bottom: 3px;
    }

    section {
        margin-bottom: 25px;    
    }

    section h2 {
        font-size: 1.2rem;
        margin-bottom: 10px;
        padding-bottom: 8px;
        border-bottom-width: 1px;
    }

    .category-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 8px;
    }

    .category-card {
        padding: 8px;
    }

    .category-icon {
        height: 40px;
        width: 40px;
        margin-bottom: 6px;
    }

    .category-card h3 {
        font-size: 0.7rem;
    }

    .load-more button {
        padding: 8px 14px;
        font-size: 0.9rem;
    }

    /* Game detail page mobile styles */
    .game-container {
        display: flex;
        flex-direction: column;
        gap: 15px;
        margin-top: 10px;
    }
    
    .game-sidebar {
        order: 2;
    }
    
    .game-content {
        order: 1;
    }
    
    .game-frame-container {
        padding: 10px;
        height: auto;
    }
    
    .game-frame-container iframe {
        min-height: 300px;
        width: 100%;
    }
    
    .game-info-card {
        padding: 15px;
    }
    
    .game-info-card h1 {
        font-size: 1.3rem;
        margin-bottom: 10px;
    }

    /* Footer adjustments */
    footer {
        padding: 20px 15px 10px;
    }

    .footer-content {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .footer-section {
        margin-bottom: 15px;
    }

    .footer-section h3 {
        font-size: 1rem;
        margin-bottom: 8px;
    }

    .footer-section p, .footer-section ul li a {
        font-size: 0.85rem;
    }

    .footer-section ul li {
        margin-bottom: 5px;
    }

    .footer-bottom {
        margin-top: 15px;
        padding-top: 10px;
        font-size: 0.8rem;
    }
    
    /* Mobile menu */
    .mobile-menu {
        display: block;
        position: fixed;
        top: 60px;
        left: 0;
        width: 100%;
        height: 0;
        background-color: white;
        overflow: hidden;
        transition: height 0.3s ease-in-out;
        z-index: 1000;
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    }

    .mobile-menu.open {
        height: calc(100vh - 60px);
        overflow-y: auto;
    }

    .mobile-menu ul {
        padding: 15px;
    }

    .mobile-menu ul li {
        margin-bottom: 8px;
    }

    .mobile-menu ul li a {
        display: block;
        padding: 12px 15px;
        color: var(--text-color);
        font-weight: 500;
        border-bottom: 1px solid var(--light-gray);
        font-size: 1rem;
    }

    .mobile-menu ul li a.active {
        color: #FF9800;
        background-color: rgba(255, 152, 0, 0.1);
        border-radius: 8px;
    }

    /* Prevent scrolling when menu is open */
    body.menu-open {
        overflow: hidden;
    }
    
    /* Mobile search specific to game page */
    .game-page .search-container-mobile {
        display: none;
    }
}

/* Mobile search toggle */
.search-container-mobile {
    display: none;
}

.search-toggle-btn {
    background-color: #FFCA28;
    color: #333;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* Mobile search overlay */
.mobile-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 0;
    background-color: rgba(0, 0, 0, 0.85);
    overflow: hidden;
    transition: height 0.3s ease;
    z-index: 2000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.mobile-search-overlay.active {
    height: 100%;
}

.mobile-search-container {
    width: 90%;
    margin-top: 80px;
    background: white;
    border-radius: 10px;
    display: flex;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.mobile-search-container input {
    flex: 1;
    border: none;
    border-radius: 0;
    padding: 15px;
    font-size: 16px;
}

.mobile-search-container button {
    border-radius: 0;
    padding: 0 15px;
    margin: 0;
}

#mobile-search-btn {
    background-color: #FFCA28;
    color: #333;
}

#mobile-search-close {
    background-color: #f5f5f5;
    color: #666;
}

/* Prevent scrolling when search is open */
body.search-open {
    overflow: hidden;
}

/* Mobile Styles for Game Page */
@media (max-width: 767px) {
    .game-page main {
        margin-top: 60px;
        padding: 0;
    }
    
    .game-container {
        display: flex;
        flex-direction: column;
        gap: 15px;
        margin-top: 0;
        margin-bottom: 15px;
    }
    
    .game-sidebar {
        order: 2;
        margin: 0 10px;
    }
    
    .game-content {
        order: 1;
        border-radius: 0;
        width: 100%;
        overflow: hidden;
    }
    
    .game-frame-container {
        padding: 0;
        height: auto;
        border-radius: 0;
        min-height: 300px;
        position: relative;
        background: #f1f1f1;
    }
    
    .game-frame-container iframe {
        min-height: 300px;
        height: 50vh; /* 使用视口高度 */
        width: 100%;
        border-radius: 0;
        margin-bottom: 10px;
        position: relative;
        z-index: 1;
    }
    
    #loading-indicator {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 0;
        width: 100%;
        text-align: center;
        font-weight: bold;
        color: #666;
    }
    
    /* 显示加载失败信息时的样式 */
    #loading-indicator.error {
        color: #f44336;
        padding: 20px;
    }
    
    .game-controls {
        padding: 0 10px 10px;
        display: flex;
        justify-content: center;
    }
    
    .fullscreen-btn {
        width: 100%;
        max-width: 200px;
        padding: 10px 0;
        font-size: 1rem;
        background-color: #ff9800;
    }
    
    .game-info-card {
        padding: 15px;
    }
    
    .game-info-card h1 {
        font-size: 1.3rem;
        margin-bottom: 10px;
    }
    
    /* Hide search icon on game page */
    .game-page .search-container-mobile {
        display: none;
    }
}

/* 重试按钮样式 */
.retry-btn {
    display: block;
    margin: 15px auto;
    padding: 10px 20px;
    background-color: #ff9800;
    color: white;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.retry-btn:hover {
    background-color: #f57c00;
} 