/**
 * MC冒险RPG风格活动小游戏样式表
 * 像素风UI、游戏容器、控制按钮、HUD、弹窗
 */

/* ===== 游戏容器 ===== */
.game-container {
    background: #1a1a2e;
    border: 4px solid #8b5a2b;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.4), inset 0 0 30px rgba(0,0,0,0.3);
    padding: 0;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    image-rendering: pixelated;
}

.game-canvas-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #0f0f1a;
    min-height: 400px;
    position: relative;
    overflow: hidden;
}

.game-canvas-wrap canvas {
    display: block;
    max-width: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    cursor: pointer;
}

/* ===== 游戏信息栏 ===== */
.game-info-bar {
    background: linear-gradient(180deg, #3d2415, #2c1810);
    border-bottom: 3px solid #8b5a2b;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.game-info-bar .game-title {
    font-size: 18px;
    font-weight: 900;
    color: #ffd700;
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.5);
    letter-spacing: 1px;
}

.game-info-bar .game-stats {
    display: flex;
    gap: 16px;
    font-size: 13px;
    font-weight: 700;
    color: #f5e6d3;
}

.game-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0,0,0,0.3);
    padding: 4px 10px;
    border: 2px solid rgba(139,90,43,0.4);
}

.game-stat i {
    color: #ffd700;
    font-size: 15px;
}

.game-stat .val {
    color: #ffd700;
    font-weight: 900;
}

/* ===== 像素风按钮 ===== */
.btn-pixel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 800;
    font-family: inherit;
    color: #fff;
    background: #4caf50;
    border: 3px solid #2e7d32;
    border-bottom-width: 5px;
    cursor: pointer;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.4);
    transition: all 0.1s;
    image-rendering: pixelated;
    letter-spacing: 1px;
}

.btn-pixel:hover {
    background: #66bb6a;
    transform: translateY(-1px);
}

.btn-pixel:active {
    background: #388e3c;
    border-bottom-width: 3px;
    transform: translateY(2px);
}

.btn-pixel.btn-red {
    background: #f44336;
    border-color: #c62828;
}

.btn-pixel.btn-red:hover { background: #ef5350; }
.btn-pixel.btn-red:active { background: #d32f2f; }

.btn-pixel.btn-gold {
    background: #ff9800;
    border-color: #e65100;
    color: #3a2a1a;
    text-shadow: none;
}

.btn-pixel.btn-gold:hover { background: #ffa726; }

.btn-pixel.btn-blue {
    background: #2196f3;
    border-color: #1565c0;
}

.btn-pixel.btn-blue:hover { background: #42a5f5; }

/* ===== 游戏控制栏 ===== */
.game-controls {
    background: linear-gradient(180deg, #2c1810, #1a0f08);
    border-top: 3px solid #8b5a2b;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ===== 奖励弹窗 ===== */
.game-reward-popup {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: popupFadeIn 0.3s ease-out;
}

@keyframes popupFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.game-reward-popup .reward-title {
    font-size: 28px;
    font-weight: 900;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255,215,0,0.5), 2px 2px 0 rgba(0,0,0,0.5);
    margin-bottom: 12px;
    letter-spacing: 3px;
}

.game-reward-popup .reward-desc {
    font-size: 16px;
    color: #f5e6d3;
    margin-bottom: 20px;
    text-align: center;
}

.game-reward-popup .reward-icon {
    font-size: 48px;
    color: #ffd700;
    margin-bottom: 16px;
    animation: rewardBounce 0.6s ease-out;
}

@keyframes rewardBounce {
    0% { transform: scale(0) rotate(-10deg); }
    60% { transform: scale(1.2) rotate(5deg); }
    100% { transform: scale(1) rotate(0); }
}

/* ===== 游戏结束画面 ===== */
.game-over-screen {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.game-over-screen .go-title {
    font-size: 36px;
    font-weight: 900;
    color: #ffd700;
    text-shadow: 0 0 30px rgba(255,215,0,0.6), 3px 3px 0 rgba(0,0,0,0.5);
    margin-bottom: 16px;
    letter-spacing: 4px;
}

.game-over-screen .go-stats {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
}

.game-over-screen .go-stat-item {
    text-align: center;
    background: rgba(139,90,43,0.2);
    border: 2px solid rgba(139,90,43,0.4);
    padding: 12px 20px;
}

.game-over-screen .go-stat-item .label {
    font-size: 11px;
    color: #8b5a2b;
    font-weight: 700;
    text-transform: uppercase;
}

.game-over-screen .go-stat-item .value {
    font-size: 24px;
    font-weight: 900;
    color: #ffd700;
    margin-top: 4px;
}

/* ===== 移动端触控按钮 ===== */
.touch-controls {
    position: absolute;
    bottom: 10px;
    left: 10px;
    display: none;
    gap: 4px;
}

.touch-btn {
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.15);
    border: 2px solid rgba(255,255,255,0.3);
    color: #fff;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.touch-btn:active {
    background: rgba(255,255,255,0.35);
}

.touch-dpad {
    display: grid;
    grid-template-columns: 44px 44px 44px;
    grid-template-rows: 44px 44px 44px;
    gap: 2px;
}

.touch-dpad .up    { grid-column: 2; grid-row: 1; }
.touch-dpad .left  { grid-column: 1; grid-row: 2; }
.touch-dpad .right { grid-column: 3; grid-row: 2; }
.touch-dpad .down  { grid-column: 2; grid-row: 3; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .game-info-bar {
        padding: 8px 12px;
        gap: 8px;
    }
    .game-info-bar .game-title {
        font-size: 14px;
    }
    .game-info-bar .game-stats {
        gap: 8px;
        font-size: 11px;
    }
    .game-controls {
        padding: 10px 12px;
    }
    .touch-controls {
        display: grid;
    }
    .game-reward-popup .reward-title {
        font-size: 22px;
    }
    .game-over-screen .go-title {
        font-size: 24px;
    }
    .game-over-screen .go-stats {
        flex-direction: column;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .game-canvas-wrap {
        min-height: 280px;
    }
    .btn-pixel {
        padding: 8px 16px;
        font-size: 12px;
    }
}
