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

body {
    font-family: 'Microsoft YaHei', 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    min-height: 100vh;
    color: #333;
    display: flex;
    flex-direction: column;
}

/* ============================================
   Header
   ============================================ */
.header {
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    font-size: 2.2rem;
    line-height: 1;
}

.header-brand h1 {
    color: #2a5298;
    font-size: 1.6rem;
    line-height: 1.2;
}

.header-subtitle {
    color: #888;
    font-size: 0.9rem;
    margin-top: 2px;
}

/* ============================================
   Language Toggle
   ============================================ */
.lang-toggle {
    background: transparent;
    border: 2px solid #2a5298;
    color: #2a5298;
    padding: 6px 18px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.lang-toggle:hover {
    background: #2a5298;
    color: white;
}

/* ============================================
   Main Content
   ============================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    flex: 1;
    width: 100%;
}

/* ============================================
   Search
   ============================================ */
.search-bar {
    text-align: center;
    margin-bottom: 30px;
}

.search-input {
    padding: 15px 25px;
    border: none;
    border-radius: 30px;
    font-size: 1.1rem;
    width: 300px;
    max-width: 90%;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    outline: none;
    transition: box-shadow 0.3s ease;
}

.search-input:focus {
    box-shadow: 0 5px 20px rgba(42, 82, 152, 0.3);
}

/* ============================================
   Loading
   ============================================ */
.loading {
    text-align: center;
    padding: 50px;
    color: white;
    font-size: 1.2rem;
}

/* ============================================
   Game Grid
   ============================================ */
.games-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-top: 20px;
}

/* ============================================
   Game Card
   ============================================ */
.game-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

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

.game-image {
    width: 100%;
    height: 250px;
    background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: all 0.3s ease;
}

.game-card:hover .game-image {
    transform: scale(1.05);
}

.game-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.1) 0%,
        rgba(0, 0, 0, 0.3) 50%,
        rgba(0, 0, 0, 0.6) 100%
    );
    transition: all 0.3s ease;
}

.game-card:hover .game-image-overlay {
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.2) 0%,
        rgba(0, 0, 0, 0.4) 50%,
        rgba(0, 0, 0, 0.7) 100%
    );
}

.game-title-overlay {
    position: absolute;
    bottom: 15px;
    left: 20px;
    right: 20px;
    color: white;
    font-size: 1.8rem;
    font-weight: bold;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
    z-index: 2;
    transform: translateY(10px);
    opacity: 0;
    transition: all 0.3s ease;
}

.game-card:hover .game-title-overlay {
    transform: translateY(0);
    opacity: 1;
}

.game-image.image-loaded::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.game-image.image-error::after {
    content: '🎮';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4rem;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 2;
}

.game-content {
    padding: 25px;
    padding-bottom: 65px;
}

.game-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2a5298;
    margin-bottom: 15px;
}

.game-description {
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
}

.game-type {
    position: absolute;
    bottom: 20px;
    left: 25px;
    display: inline-block;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
}

.play-button {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: #2a5298;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    z-index: 10;
}

.play-button:hover {
    background: #1e3c72;
    transform: scale(1.05);
}

.download-button {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}

.download-button:hover {
    background: linear-gradient(135deg, #1e8449, #27ae60);
}

/* ============================================
   No Results
   ============================================ */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px;
    color: white;
}

.no-results h3 {
    font-size: 1.4rem;
    margin-bottom: 10px;
}

.no-results p {
    font-size: 1rem;
    opacity: 0.8;
}

/* ============================================
   Footer
   ============================================ */
.footer {
    background: rgba(0, 0, 0, 0.3);
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    padding: 24px 20px;
    margin-top: auto;
    font-size: 0.9rem;
}


/* ============================================
   Modal
   ============================================ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
    animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 0;
}

.modal-title {
    font-size: 1.25rem;
    color: #2a5298;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 24px;
    text-align: center;
}

.modal-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.modal-message {
    font-size: 1.05rem;
    color: #555;
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 0 24px 24px;
}

.modal-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-btn-cancel {
    background: #f0f0f0;
    color: #666;
}

.modal-btn-cancel:hover {
    background: #e0e0e0;
}

.modal-btn-confirm {
    background: linear-gradient(135deg, #2a5298, #1e3c72);
    color: white;
}

.modal-btn-confirm:hover {
    box-shadow: 0 4px 15px rgba(42, 82, 152, 0.4);
    transform: translateY(-1px);
}

/* ============================================
   Animations
   ============================================ */
.game-card {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.game-card.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .header-brand {
        flex-direction: column;
        gap: 8px;
    }

    .header-brand h1 {
        font-size: 1.4rem;
    }

    .games-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .container {
        padding: 20px 15px;
    }

    .search-input {
        width: 100%;
        margin: 0 10px;
    }

    .game-image {
        height: 200px;
    }

    .game-title-overlay {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .header-brand h1 {
        font-size: 1.3rem;
    }

    .header-subtitle {
        font-size: 0.8rem;
    }

    .games-grid {
        grid-template-columns: 1fr;
    }

    .game-content {
        padding: 20px;
    }

    .play-button {
        position: static;
        width: 100%;
        margin-top: 15px;
        text-align: center;
    }

    .game-image {
        height: 180px;
    }

    .game-title-overlay {
        font-size: 1.3rem;
        bottom: 10px;
        left: 15px;
        right: 15px;
    }

    .modal {
        width: 95%;
        margin: 0 10px;
    }

    .modal-footer {
        flex-direction: column;
    }
}
