/* Completely disable all animations and transitions to prevent flashing */
*, *::before, *::after {
    -webkit-animation-duration: 0s !important;
    animation-duration: 0s !important;
    -webkit-animation-delay: 0s !important;
    animation-delay: 0s !important;
    -webkit-transition-duration: 0s !important;
    transition-duration: 0s !important;
    -webkit-transition-delay: 0s !important;
    transition-delay: 0s !important;
}

/* Key CSS to prevent page flashing */
html {
    visibility: visible !important;
    opacity: 1 !important;
}

/* Basic style reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #007AFF;
    --secondary-color: #5AC8FA;
    --accent-color: #34C759;
    --error-color: #FF3B30;
    --warning-color: #FF9500;
    --text-color: #1D1D1F;
    --text-light: #86868B;
    --bg-color: #F2F2F7;
    --card-bg: #FFFFFF;
    --shadow: 0 4px 16px rgba(0,0,0,0.12);
    --shadow-hover: 0 8px 25px rgba(0,0,0,0.15);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    background: var(--bg-color);
    min-height: 100vh;
    color: var(--text-color);
    line-height: 1.47;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: white;
    transition: opacity 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Header styles */
.main-header {
    text-align: center;
    padding: 3rem 2rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    position: relative;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.main-header h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.8;
    margin-bottom: 2rem;
    font-weight: 400;
}

.global-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
}

.control-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 12px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Main content area */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem 4rem;
}

/* Search container */
.search-container {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.search-input {
    width: 100%;
    max-width: 400px;
    padding: 12px 16px;
    font-size: 16px;
    border: 1px solid #D1D1D6;
    border-radius: 10px 0 0 10px;
    outline: none;
    background: var(--card-bg);
    color: var(--text-color);
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.search-btn {
    padding: 12px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0 10px 10px 0;
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
}

.search-btn:hover {
    background: #0056CC;
}

/* Filter container */
.filter-container {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    background: #F2F2F7;
    color: var(--text-color);
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.filter-btn:hover {
    background: #E5E5EA;
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
}

/* 游戏网格 */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* 游戏卡片 */
.game-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 0;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    overflow: hidden;
    cursor: pointer;
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.game-image-container {
    position: relative;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.game-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    transition: var(--transition);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: block;
    border-radius: 8px 8px 0 0;
    filter: brightness(1.1) contrast(1.05) saturate(1.1);
}

.game-card:hover .game-image {
    transform: scale(1.05);
    filter: brightness(1.2) contrast(1.1) saturate(1.2);
}

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.game-card:hover .game-overlay {
    opacity: 1;
}

.game-controls {
    text-align: center;
    color: white;
}

.control-hint {
    font-size: 14px;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.game-info {
    padding: 1.5rem;
}

.game-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.game-description {
    color: var(--text-light);
    margin-bottom: 1rem;
    font-size: 14px;
    line-height: 1.4;
}

.game-rating {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.stars {
    font-size: 14px;
}

.rating-text {
    font-size: 13px;
    color: var(--text-light);
}

.play-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    width: 100%;
}

.play-btn:hover {
    background: #0056CC;
    transform: translateY(-1px);
}

.play-btn:active {
    transform: translateY(0);
}

.play-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading {
    display: none;
}

.play-btn.loading .btn-text {
    display: none;
}

.play-btn.loading .btn-loading {
    display: inline;
}

/* 空状态 */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: white;
}

.no-results-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.no-results h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.no-results p {
    opacity: 0.8;
}

/* 页脚 */
.main-footer {
    background: rgba(0, 0, 0, 0.1);
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: 4rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-links {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.footer-link {
    color: white;
    text-decoration: none;
    opacity: 0.8;
    transition: var(--transition);
}

.footer-link:hover {
    opacity: 1;
    text-decoration: underline;
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    margin: 0;
    color: var(--error-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.modal-close:hover {
    background: #f0f0f0;
}

.modal-body {
    padding: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.retry-btn, .cancel-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
}

.retry-btn {
    background: var(--accent-color);
    color: white;
}

.retry-btn:hover {
    background: #45a049;
}

.cancel-btn {
    background: #f0f0f0;
    color: var(--text-color);
}

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

/* 动画 */
@keyframes fadeInUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-header {
        padding: 2rem 1rem;
    }
    
    .main-header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .global-controls {
        position: static;
        justify-content: center;
        margin-top: 1rem;
    }
    
    .main-content {
        padding: 0 1rem 2rem;
    }
    
    .game-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1.5rem;
    }
    
    .game-card {
        border-radius: 12px;
    }
    
    .game-image {
        height: 180px;
    }
    
    .game-info {
        padding: 1rem;
    }
    
    .game-title {
        font-size: 1.3rem;
    }
    
    .filter-container {
        gap: 0.5rem;
        margin-bottom: 2rem;
    }
    
    .filter-btn {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .search-input {
        font-size: 16px; /* 防止iOS缩放 */
    }
    
    .footer-links {
        flex-direction: column;
        gap: 1rem;
    }
    
    .modal-content {
        margin: 1rem;
        width: calc(100% - 2rem);
    }
    
    .modal-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .main-header h1 {
        font-size: 1.8rem;
    }
    
    .game-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .search-input {
        padding: 12px 16px;
    }
    
    .play-btn {
        padding: 12px 24px;
        font-size: 15px;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --card-bg: #2a2a2a;
        --text-color: #ffffff;
        --text-light: #cccccc;
        --bg-color: #1a1a1a;
    }
    
    .search-input {
        background: var(--card-bg);
        color: var(--text-color);
    }
    
    .modal-content {
        background: var(--card-bg);
        color: var(--text-color);
    }
    
    .modal-header {
        border-bottom-color: #444;
    }
    
    .cancel-btn {
        background: #444;
        color: var(--text-color);
    }
    
    .cancel-btn:hover {
        background: #555;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    :root {
        --shadow: 0 4px 12px rgba(0,0,0,0.3);
        --shadow-hover: 0 8px 20px rgba(0,0,0,0.4);
    }
    
    .play-btn,
    .search-btn,
    .filter-btn.active {
        box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .loading-spinner {
        animation: none;
    }
} 