/* 撞球遊戲專屬樣式 */

/* 右上角排行榜按鈕 */
.leaderboard-top-button {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #333;
    text-decoration: none;
    font-weight: 600;
    border-radius: 50px;
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.leaderboard-top-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.5);
    background: linear-gradient(135deg, #FFA500 0%, #FFD700 100%);
}

.leaderboard-top-button:active {
    transform: translateY(-1px);
}

.leaderboard-top-button span:first-child {
    font-size: 1.2em;
}

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

/* 統計面板 */
.stats-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.stat-item.highlight {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 165, 0, 0.2) 100%);
    border: 1px solid rgba(255, 215, 0, 0.4);
}

.stat-label {
    font-size: 0.85em;
    opacity: 0.9;
    font-weight: 500;
}

.stat-value {
    font-size: 1.8em;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.stat-item.highlight .stat-value {
    color: #FFD700;
    animation: pulse 2s infinite;
}

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

/* 畫布容器 */
.canvas-container {
    position: relative;
    margin: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
    padding: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

#poolCanvas {
    border: 15px solid #8B4513;
    border-radius: 10px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
    display: block;
    max-width: 100%;
    height: auto;
    background: #008000;
}

/* 控制面板 */
.controls-panel {
    margin-top: 25px;
}

/* 主要控制區域 */
.main-controls {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* 狀態提示 */
.status-hint {
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 0.9em;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    min-width: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.3;
}

.status-hint.ready {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.9) 0%, rgba(56, 142, 60, 0.9) 100%);
    color: white;
    border: 2px solid rgba(76, 175, 80, 1);
    animation: pulse 2s infinite;
}

.status-hint.waiting {
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.9) 0%, rgba(255, 111, 0, 0.9) 100%);
    color: white;
    border: 2px solid rgba(255, 152, 0, 1);
}

.status-hint.success {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.9) 0%, rgba(56, 142, 60, 0.9) 100%);
    color: white;
    border: 2px solid rgba(76, 175, 80, 1);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(76, 175, 80, 0.6);
    }
}

/* 操作提示 */
.control-hints {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.control-hints p {
    margin: 0 0 10px 0;
    font-size: 1em;
    opacity: 0.95;
}

.control-hints ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
}

.control-hints li {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    font-size: 0.9em;
    opacity: 0.9;
}

/* 操作按鈕組 */
.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 15px;
}

.action-btn {
    padding: 10px 20px;
    font-size: 0.95em;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    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);
}

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

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

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

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

.action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 遊戲訊息提示 */
.game-message {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1em;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    animation: slideDown 0.3s ease;
    max-width: 90%;
    word-wrap: break-word;
}

.game-message.success {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.9) 0%, rgba(56, 142, 60, 0.9) 100%);
    color: white;
    border: 2px solid rgba(76, 175, 80, 1);
}

.game-message.error {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.9) 0%, rgba(198, 40, 40, 0.9) 100%);
    color: white;
    border: 2px solid rgba(244, 67, 54, 1);
}

.game-message.warning {
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.9) 0%, rgba(255, 111, 0, 0.9) 100%);
    color: white;
    border: 2px solid rgba(255, 152, 0, 1);
}

.game-message.info {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.9) 0%, rgba(25, 118, 210, 0.9) 100%);
    color: white;
    border: 2px solid rgba(33, 150, 243, 1);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* 響應式設計 */
@media (max-width: 768px) {
    .leaderboard-top-button {
        top: 10px;
        right: 10px;
        padding: 10px 16px;
        font-size: 0.9em;
    }
    
    .leaderboard-top-button span:last-child {
        display: none;
    }
    
    .stats-panel {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 12px;
    }
    
    .stat-value {
        font-size: 1.5em;
    }
    
    #poolCanvas {
        width: 100%;
        height: auto;
    }
    
    .main-controls {
        flex-direction: column;
        gap: 12px;
    }
    
    .status-hint {
        width: 100%;
        min-width: auto;
    }
    
    .main-controls .reset-btn {
        width: 100%;
        justify-content: center;
    }
    
    .control-hints ul {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    
    .action-buttons .action-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .leaderboard-top-button {
        top: 8px;
        right: 8px;
        padding: 8px 12px;
        font-size: 0.85em;
    }
    
    .stats-panel {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-value {
        font-size: 1.3em;
    }
}
