/* ===== 基础重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #1a1a2e;
    font-family: 'Arial', sans-serif;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    color: white;
    overflow: hidden;
}

.game-wrapper {
    text-align: center;
    width: 100%;
    max-width: 600px;
}

/* ===== 标题 ===== */
.game-title {
    font-size: 48px;
    margin-bottom: 8px;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* ===== 菜单界面 ===== */
.menu-screen {
    background: rgba(0, 0, 0, 0.8);
    padding: 40px;
    border-radius: 15px;
    display: inline-block;
    max-width: 90vw;
}

.menu-screen h2 {
    font-size: 32px;
    color: #FFD700;
    margin-bottom: 30px;
}

.nickname-section {
    margin-bottom: 25px;
}

.nickname-section label {
    display: block;
    margin-bottom: 10px;
    font-size: 16px;
    color: #FFD700;
}

#playerNickname {
    padding: 12px 20px;
    font-size: 16px;
    border: 2px solid #FFD700;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-align: center;
    width: 250px;
    outline: none;
}

#playerNickname::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.menu-buttons {
    margin-bottom: 20px;
}

.start-section {
    margin-bottom: 25px;
}

.start-btn {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border: none;
    color: white;
    padding: 15px 50px;
    font-size: 20px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.6);
}

.controls-info {
    margin-top: 20px;
    font-size: 14px;
    color: #aaa;
    line-height: 1.8;
}

.controls-info p {
    margin: 5px 0;
}

/* ===== 按钮通用 ===== */
.leaderboard-btn {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    border: none;
    color: white;
    padding: 10px 25px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
    transition: all 0.3s;
}

.leaderboard-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.5);
}

.back-btn {
    background: #ff4444;
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.back-btn:hover {
    background: #ff6666;
    transform: translateY(-2px);
}

/* ===== 游戏容器 ===== */
.game-container {
    display: none;
    position: relative;
}

/* ===== 分数板 ===== */
.score-board {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
    font-size: 18px;
    padding: 0 10px;
}

.player-info {
    color: #FFD700;
    font-weight: bold;
}

.game-buttons {
    display: flex;
    gap: 10px;
}

/* ===== Canvas ===== */
#gameCanvas {
    background: #0a0a1a;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
    display: block;
    margin: -6px auto 0;
    width: 570px;
    height: 665px;
    max-width: 100%;
    touch-action: none;
}

/* ===== 倍率显示区 ===== */
.multiplier-area {
    background: rgba(0, 0, 0, 0.6);
    padding: 6px 20px;
    border-radius: 10px;
    margin-bottom: 4px;
    display: none;
}

.multiplier-text {
    font-size: 20px;
    color: #FFD700;
    font-weight: bold;
}

.lit-holes-info {
    font-size: 14px;
    color: #aaa;
    margin-top: 5px;
}

.draw-multiplier-btn {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    border: none;
    color: white;
    padding: 10px 30px;
    font-size: 16px;
    border-radius: 20px;
    cursor: pointer;
    margin-top: 12px;
    transition: all 0.3s;
    touch-action: manipulation;
}

.draw-multiplier-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(155, 89, 182, 0.4);
}

.draw-multiplier-btn:disabled {
    background: #555;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== 下注控制区 ===== */
.bet-area {
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 20px;
    border-radius: 10px;
    margin-bottom: 4px;
    display: none;
}

.bet-label {
    font-size: 16px;
    color: #FFD700;
    margin-bottom: 6px;
}

.bet-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 6px;
}

.bet-btn {
    background: #3498db;
    border: none;
    color: white;
    width: 50px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.2s;
    touch-action: manipulation;
}

.bet-btn:hover {
    background: #2980b9;
    transform: scale(1.1);
}

.bet-btn:disabled {
    background: #555;
    cursor: not-allowed;
    transform: none;
}

.bet-amount {
    font-size: 32px;
    color: #FFD700;
    font-weight: bold;
    min-width: 80px;
}

.bet-range {
    font-size: 12px;
    color: #888;
    margin-bottom: 6px;
}

.confirm-btn {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    border: none;
    color: white;
    padding: 12px 40px;
    font-size: 18px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    touch-action: manipulation;
}

.confirm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.4);
}

.confirm-btn:disabled {
    background: #555;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== 发射控制区 ===== */
.launch-controls {
    display: none;
    margin-top: 2px;
    padding: 0 20px;
    touch-action: none;
}

.launch-btn {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border: none;
    color: white;
    padding: 15px 40px;
    font-size: 18px;
    border-radius: 25px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    transition: all 0.1s;
    margin-bottom: 10px;
    -webkit-touch-callout: none;
    width: 100%;
}

.launch-btn:active, .launch-btn.pressed {
    transform: scale(0.95);
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
}

.power-bar {
    width: 100%;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #FFD700;
}

.power-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #27ae60 0%, #f1c40f 50%, #e74c3c 100%);
    border-radius: 8px;
    transition: width 0.05s linear;
}

/* ===== 游戏结果 ===== */
.game-result {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 30px 40px;
    border-radius: 15px;
    border: 3px solid #FFD700;
    text-align: center;
    z-index: 100;
}

.result-text {
    font-size: 24px;
    color: #FFD700;
    margin-bottom: 20px;
    line-height: 1.5;
}

.next-btn {
    background: #3498db;
    border: none;
    color: white;
    padding: 12px 30px;
    font-size: 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    touch-action: manipulation;
}

.next-btn:hover {
    background: #2980b9;
}

/* ===== 排行榜模态框 ===== */
.leaderboard-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.leaderboard-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 30px;
    border-radius: 15px;
    border: 3px solid #FFD700;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
}

.leaderboard-header {
    text-align: center;
    margin-bottom: 20px;
}

.leaderboard-header h2 {
    color: #FFD700;
    font-size: 28px;
    margin-bottom: 5px;
}

.leaderboard-header p {
    color: #aaa;
    font-size: 14px;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 12px 10px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-table th {
    color: #FFD700;
    font-size: 16px;
    background: rgba(255, 215, 0, 0.1);
}

.leaderboard-table td {
    color: white;
    font-size: 14px;
}

.leaderboard-table tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.rank-1 { color: #FFD700 !important; font-weight: bold; }
.rank-2 { color: #C0C0C0 !important; font-weight: bold; }
.rank-3 { color: #CD7F32 !important; font-weight: bold; }

.close-leaderboard {
    display: block;
    margin: 20px auto 0;
    padding: 12px 30px;
    background: #ff4444;
    border: none;
    color: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    touch-action: manipulation;
}

.close-leaderboard:hover {
    background: #ff6666;
    transform: translateY(-2px);
}

.loading-text,
.empty-leaderboard {
    text-align: center;
    color: #aaa;
    padding: 30px;
    font-size: 16px;
}

/* ===== 大奖动画层 ===== */
.jackpot-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 3000;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

.jackpot-text {
    font-size: 60px;
    color: #FFD700;
    font-weight: bold;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
    animation: jackpotPulse 1s ease-in-out infinite;
}

@keyframes jackpotPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

/* ===== 移动端适配（重点适配短屏幕） ===== */
@media (max-width: 768px) {
    body {
        align-items: flex-start;
        padding-top: 2px;
    }

    .game-title {
        font-size: 24px;
        margin-bottom: 4px;
    }

    .menu-screen {
        padding: 20px;
    }

    .menu-screen h2 {
        font-size: 22px;
    }

    #playerNickname {
        width: 180px;
        padding: 8px 12px;
        font-size: 16px;
    }

    .score-board {
        font-size: 12px;
        flex-wrap: wrap;
        gap: 4px;
        margin-bottom: 2px;
    }

    .game-buttons {
        width: 100%;
        justify-content: center;
        order: -1;
    }

    .leaderboard-btn,
    .back-btn {
        padding: 5px 10px;
        font-size: 11px;
    }

    /* Canvas 在短屏幕上按比例缩放，避免超出视口 */
    #gameCanvas {
        width: 95%;
        height: auto;
        aspect-ratio: 600 / 700;
        max-height: 66vh;
        margin: -4px auto 0;
    }

    .multiplier-area {
        padding: 4px 10px;
        margin-bottom: 2px;
    }

    .multiplier-text {
        font-size: 16px;
    }

    .lit-holes-info {
        font-size: 12px;
        margin-top: 2px;
    }

    .draw-multiplier-btn {
        padding: 6px 20px;
        font-size: 14px;
        margin-top: 6px;
    }

    .bet-area {
        padding: 4px 10px;
        margin-bottom: 2px;
    }

    .bet-label {
        font-size: 14px;
        margin-bottom: 4px;
    }

    .bet-controls {
        margin-bottom: 4px;
        gap: 10px;
    }

    .bet-btn {
        width: 40px;
        height: 32px;
        font-size: 14px;
    }

    .bet-amount {
        font-size: 20px;
        min-width: 60px;
    }

    .bet-range {
        margin-bottom: 4px;
    }

    .confirm-btn {
        padding: 8px 24px;
        font-size: 14px;
    }

    .launch-controls {
        margin-top: 2px;
        padding: 0 10px;
    }

    .launch-btn {
        padding: 8px 20px;
        font-size: 14px;
    }

    .power-bar {
        height: 14px;
    }

    .jackpot-text {
        font-size: 28px;
    }

    .game-result {
        padding: 20px 24px;
    }

    .result-text {
        font-size: 18px;
    }

    .next-btn {
        padding: 8px 20px;
        font-size: 14px;
    }
}


