/* 乒乓球遊戲專屬樣式 */

/* 遊戲容器 */
.game-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.game-container h1 {
    text-align: center;
    font-size: 2.5em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

/* 使用者資訊 */
.user-info {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.1em;
}

/* 排行榜按鈕（右上角） */
.leaderboard-top-button {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 50px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    z-index: 1000;
}

.leaderboard-top-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

.leaderboard-top-button span:last-child {
    display: inline;
}

@media (max-width: 768px) {
    .leaderboard-top-button span:last-child {
        display: none;
    }
    .leaderboard-top-button {
        padding: 12px;
        border-radius: 50%;
    }
}

/* 遊戲包裝器 */
.game-wrapper {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    margin-bottom: 20px;
    animation: fadeIn 0.5s ease;
}

/* 連線狀態面板 */
.status-panel {
    text-align: center;
    padding: 60px 20px;
}

.status-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#statusText {
    font-size: 1.3em;
    font-weight: 500;
}

/* 遊戲區域 */
.game-area {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-board {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.player-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.player-label {
    font-size: 0.7em;
    opacity: 0.8;
}

.score {
    font-size: 2em;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.score-divider {
    font-size: 2em;
    opacity: 0.5;
}

/* 訊息提示 */
.game-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 1.2em;
    font-weight: 600;
    z-index: 100;
    pointer-events: none;
    animation: fadeIn 0.3s ease;
}

.game-message.success {
    background: rgba(76, 175, 80, 0.9);
}

.game-message.error {
    background: rgba(244, 67, 54, 0.9);
}

.game-message.warning {
    background: rgba(255, 152, 0, 0.9);
}

.game-message.info {
    background: rgba(33, 150, 243, 0.9);
}

/* 畫布容器 */
.canvas-container {
    position: relative;
    margin-bottom: 20px;
}

#gameCanvas {
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 10px;
    background: #1a1a2e;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    display: block;
    max-width: 100%;
    height: auto;
}

.game-info {
    text-align: center;
    margin-top: 20px;
}

#gameMessage {
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 10px;
}

.controls-hint {
    font-size: 0.9em;
    opacity: 0.8;
}

/* 遊戲結束面板 */
.game-over-panel {
    text-align: center;
    padding: 40px;
}

.game-over-panel h2 {
    font-size: 2.5em;
    margin-bottom: 20px;
}

.final-score {
    font-size: 3em;
    font-weight: bold;
    margin: 30px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

/* 控制面板 */
.controls-panel {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
}

.main-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.action-btn {
    padding: 12px 24px;
    font-size: 1.1em;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

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

.action-btn.submit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.action-btn.reset-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

/* 操作提示 */
.control-hints {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
}

.control-hints p {
    font-size: 1.1em;
    margin-bottom: 10px;
    font-weight: 600;
}

.control-hints ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.control-hints li {
    padding: 8px 0;
    font-size: 1em;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.control-hints li:last-child {
    border-bottom: none;
}

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

    .game-wrapper {
        padding: 20px;
    }

    .score-board {
        font-size: 1.2em;
        gap: 20px;
    }

    #gameCanvas {
        width: 100%;
        height: auto;
    }

    .action-btn {
        padding: 10px 20px;
        font-size: 1em;
    }

    .control-hints li {
        font-size: 0.9em;
    }
}

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