/* 全域樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* 星空背景動畫 */
.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.stars::before,
.stars::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    box-shadow: 
        100px 200px white,
        300px 150px white,
        500px 300px white,
        700px 100px white,
        900px 250px white,
        200px 400px white,
        400px 450px white,
        600px 500px white,
        800px 350px white,
        1000px 200px white,
        150px 550px white,
        350px 600px white,
        550px 50px white,
        750px 400px white,
        950px 500px white;
    animation: twinkle 3s infinite ease-in-out;
}

.stars::after {
    animation-delay: 1.5s;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* 頂部導航 */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-left, .nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-logo {
    font-size: 1.3em;
    font-weight: bold;
    color: #fff;
    text-decoration: none;
    transition: opacity 0.3s;
}

.nav-logo:hover {
    opacity: 0.8;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* 使用者資料 */
.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.user-profile span {
    font-weight: 600;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 稱號 badge（header / profile 通用） */
.name-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9em;
    background: rgba(255,255,255,0.06);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.06);
}

.title-emoji { margin-right: 6px; font-size: 1.05em; }

.logout-btn {
    padding: 6px 12px;
    background: rgba(244, 67, 54, 0.3);
    border: 1px solid rgba(244, 67, 54, 0.5);
    border-radius: 15px;
    color: #fff;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: rgba(244, 67, 54, 0.5);
}

/* 容器 */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 100px 20px 40px 20px; /* 增加頂部間距以避開導航 */
    position: relative;
    z-index: 1;
}

/* 主標題區 */
.main-header {
    text-align: center;
    margin-bottom: 60px;
    animation: fadeInDown 0.8s ease;
}

.title {
    font-size: 3.5em;
    margin-bottom: 15px;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.3);
    line-height: 1.2;
}

.title .emoji {
    display: inline-block;
    animation: bounce 2s infinite;
}

.subtitle {
    font-size: 1.3em;
    opacity: 0.95;
    font-weight: 300;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
}

/* 章節標題 */
.section-title {
    text-align: center;
    font-size: 2.5em;
    margin-bottom: 40px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

/* 遊戲區域 */
.games-section {
    margin-bottom: 80px;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

/* 遊戲卡片 */
.game-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 35px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.1);
    animation: fadeInUp 0.6s ease;
}

.game-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255,255,255,0.05),
        transparent
    );
    transform: rotate(45deg);
    transition: all 0.6s ease;
}

.game-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.4);
    border-color: rgba(255,255,255,0.3);
}

.game-card:hover::before {
    left: 100%;
}

/* 特色遊戲 */
.game-card.featured {
    background: linear-gradient(135deg, rgba(255,215,0,0.15) 0%, rgba(255,165,0,0.15) 100%);
    border: 2px solid rgba(255,215,0,0.3);
}

.featured-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    animation: pulse 2s infinite;
}

/* 即將推出的遊戲卡片 */
.game-card.coming-soon {
    opacity: 0.7;
    background: rgba(255, 255, 255, 0.05);
}

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

/* 
 * 遊戲縮圖區域
 * 
 * 如何添加實際的遊戲縮圖：
 * 1. 將遊戲截圖放在 /thumbnails/ 資料夾中
 * 2. 建議圖片尺寸：400x225 (16:9) 或 400x240
 * 3. 在 HTML 中添加：<img src="/thumbnails/basketball.jpg" alt="籃球遊戲截圖" class="thumbnail-image">
 * 4. 圖片會自動覆蓋在 thumbnail-placeholder 上方
 */
.game-thumbnail {
    position: relative;
    width: 100%;
    height: 180px;
    margin-bottom: 20px;
    border-radius: 15px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

/* 實際縮圖圖片樣式 */
.thumbnail-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    transition: transform 0.3s ease;
}

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

.thumbnail-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%);
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    transition: all 0.3s ease;
}

.thumbnail-placeholder span {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9em;
    font-weight: 500;
}

.game-card:hover .thumbnail-placeholder {
    border-color: rgba(255, 255, 255, 0.5);
    background: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.04) 100%);
}

/* 遊戲圖標 */
.game-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4em;
    z-index: 1;
    animation: float 3s ease-in-out infinite;
    opacity: 0.3;
}

.game-card:nth-child(2) .game-icon {
    animation-delay: 0.5s;
}

.game-card:nth-child(3) .game-icon {
    animation-delay: 1s;
}

.game-card:nth-child(4) .game-icon {
    animation-delay: 1.5s;
}

.game-card:nth-child(5) .game-icon {
    animation-delay: 2s;
}

/* 遊戲內容區域 */
.game-content {
    display: flex;
    flex-direction: column;
}

/* 遊戲標題 */
.game-title {
    font-size: 1.8em;
    margin-bottom: 12px;
    text-align: center;
}

/* 遊戲描述 */
.game-description {
    text-align: center;
    opacity: 0.9;
    font-size: 1em;
    line-height: 1.5;
    margin-bottom: 20px;
    min-height: 48px;
}

/* 標籤 */
.game-tags {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.tag {
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 14px;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: 500;
    backdrop-filter: blur(5px);
}

.tag-hot {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 4px 10px rgba(245,87,108,0.4);
}

/* 開始按鈕 */
.play-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 50px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.play-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(0,0,0,0.3);
}

.play-button:hover .arrow {
    transform: translateX(5px);
}

.play-button:active {
    transform: scale(0.98);
}

.play-button-featured {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.play-button:disabled {
    background: rgba(255, 255, 255, 0.2);
    cursor: not-allowed;
    opacity: 0.6;
}

.play-button:disabled:hover {
    transform: none;
}

.arrow {
    transition: transform 0.3s ease;
    font-size: 1.3em;
}

/* 特色功能區 */
.features-section {
    margin-bottom: 60px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
}

.feature-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.3s ease;
    animation: fadeInUp 0.6s ease;
}

.feature-card:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-5px);
}

.feature-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

.feature-card h3 {
    font-size: 1.3em;
    margin-bottom: 10px;
}

.feature-card p {
    opacity: 0.9;
    line-height: 1.5;
}

/* 頁尾 */
.main-footer {
    text-align: center;
    padding: 40px 20px;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    margin-top: 60px;
}

.main-footer p {
    margin-bottom: 10px;
    opacity: 0.9;
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.footer-links a {
    color: #fff;
    text-decoration: none;
    transition: opacity 0.3s;
    font-weight: 500;
}

.footer-links a:hover {
    opacity: 0.7;
    text-decoration: underline;
}

.separator {
    opacity: 0.5;
}

.copyright {
    font-size: 0.9em;
    opacity: 0.7;
    margin-top: 15px;
}

/* 動畫效果 */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-15px);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* 響應式設計 */
@media (max-width: 768px) {
    .title {
        font-size: 2.2em;
    }

    .subtitle {
        font-size: 1em;
    }

    .section-title {
        font-size: 1.8em;
    }

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

    .game-card {
        padding: 25px;
    }

    .game-icon {
        font-size: 4em;
    }

    .game-title {
        font-size: 1.5em;
    }

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

    .container {
        padding: 30px 15px;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 1.8em;
    }

    .subtitle {
        font-size: 0.9em;
    }

    .game-icon {
        font-size: 3.5em;
    }
}

/* 載入動畫 */
@keyframes cardEnter {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.game-card {
    animation: cardEnter 0.5s ease forwards;
}

.game-card:nth-child(1) { animation-delay: 0.1s; }
.game-card:nth-child(2) { animation-delay: 0.2s; }
.game-card:nth-child(3) { animation-delay: 0.3s; }
.game-card:nth-child(4) { animation-delay: 0.4s; }
.game-card:nth-child(5) { animation-delay: 0.5s; }
.game-card:nth-child(6) { animation-delay: 0.6s; }

.feature-card:nth-child(1) { animation-delay: 0.1s; }
.feature-card:nth-child(2) { animation-delay: 0.2s; }
.feature-card:nth-child(3) { animation-delay: 0.3s; }
.feature-card:nth-child(4) { animation-delay: 0.4s; }

