/* Global Styles */
:root {
    --primary-color: #0066ff;
    --secondary-color: #0052cc;
    --accent-color: #ff9900;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --border-radius: 6px;
    --card-shadow: 0 4px 8px rgba(0,0,0,0.1);
    
    /* Category colors */
    --action-color: #007bff;
    --puzzle-color: #28a745;
    --strategy-color: #ffc107;
    --sports-color: #17a2b8;
    --shooter-color: #dc3545;
    --arcade-color: #6610f2;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

/* Navigation */
.navbar {
    background-color: var(--primary-color);
    padding: 0.8rem 1rem;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
}

.navbar-dark .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.navbar-dark .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .nav-link.active {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
}

.btn-search {
    background-color: white;
    color: var(--primary-color);
    border: none;
    font-weight: 500;
}

.btn-search:hover {
    background-color: #f0f0f0;
}

/* Section Styles */
section {
    padding: 2rem 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0;
    color: var(--dark-color);
}

.view-all {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.view-all:hover {
    text-decoration: underline;
}

/* Game Cards */
.game-card {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    transition: box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    height: 420px; /* 固定卡片高度 */
    transform: translateZ(0); /* 启用硬件加速 */
    will-change: box-shadow; /* 优化阴影变化性能 */
    display: flex;
    flex-direction: column;
}

.game-card:hover {
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.card-img-top {
    height: 180px;
    object-fit: cover;
    width: 100%; /* 确保图片宽度一致 */
    flex-shrink: 0; /* 防止图片被压缩 */
}

.card-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0; /* 确保flex布局正常工作 */
}

.card-title {
    font-weight: bold;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    line-height: 1.2;
}

.card-text {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    height: auto;
    min-height: 40px;
}

/* Game Rating */
.game-rating {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    margin-top: auto;
}

.stars {
    color: var(--accent-color);
    margin-right: 0.5rem;
}

.stars i {
    font-size: 0.9rem;
}

.rating-score {
    font-weight: bold;
    color: #555;
}

/* Play Button */
.btn-play {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    width: 100%;
    font-weight: 500;
    transition: background-color 0.3s ease;
    margin-top: auto; /* 确保按钮在底部 */
}

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

/* New Tag */
.new-tag {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--accent-color);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    font-weight: bold;
    z-index: 2;
    pointer-events: none; /* 防止标签影响hover效果 */
}

/* Game Categories */
.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--light-color);
    border-radius: var(--border-radius);
    padding: 1.5rem 1rem;
    color: white;
    text-decoration: none;
    text-align: center;
    transition: transform 0.3s ease;
    height: 100%;
}

.category-card:hover {
    transform: translateY(-5px);
    text-decoration: none;
    color: white;
}

.category-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.category-name {
    font-weight: 500;
}

/* Category backgrounds */
.bg-action {
    background-color: var(--action-color);
}

.bg-puzzle {
    background-color: var(--puzzle-color);
}

.bg-strategy {
    background-color: var(--strategy-color);
}

.bg-sports {
    background-color: var(--sports-color);
}

.bg-shooter {
    background-color: var(--shooter-color);
}

.bg-arcade {
    background-color: var(--arcade-color);
}

/* Footer */
footer {
    background-color: var(--dark-color);
    color: white;
    padding: 2.5rem 0 0;
    margin-top: 2rem;
}

footer h5 {
    font-weight: bold;
    margin-bottom: 1rem;
}

footer ul li {
    margin-bottom: 0.5rem;
}

footer a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: white;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background-color: var(--primary-color);
    transform: scale(1.1);
}

.copyright {
    background-color: rgba(0, 0, 0, 0.2);
    text-align: center;
    padding: 1rem 0;
    margin-top: 2rem;
}

.copyright p {
    margin-bottom: 0;
    font-size: 0.9rem;
}

/* Game Page Styles */
.game-container {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
}

.game-iframe {
    width: 100%;
    height: 600px;
    border: none;
    border-radius: 4px;
}

.loading {
    text-align: center;
    padding: 20px;
    display: none;
}

.loading::after {
    content: "Loading...";
    display: inline-block;
    animation: dots 1s steps(5, end) infinite;
}

@keyframes dots {
    0%, 20% { content: "Loading"; }
    40% { content: "Loading."; }
    60% { content: "Loading.."; }
    80% { content: "Loading..."; }
}

/* Responsive Adjustments */
@media (max-width: 991.98px) {
    .category-card {
        padding: 1rem 0.5rem;
    }
    
    .category-icon {
        font-size: 1.5rem;
    }
    
    .card-text {
        height: auto;
    }
}

@media (max-width: 767.98px) {
    .card-img-top {
        height: 150px;
    }
}
