* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
    min-height: 100vh;
    color: #fff;
    padding: 20px;
    user-select: none;
}

.game-container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

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

.game-header h1 {
    font-size: 2.5em;
    margin-bottom: 15px;
    color: #00ff88;
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
    font-weight: bold;
}

.game-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 10px;
    border: 2px solid rgba(0, 255, 136, 0.3);
}

.stat {
    text-align: center;
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 80px;
}

.stat-label {
    font-size: 0.9em;
    color: #ccc;
    margin-bottom: 5px;
    font-weight: 600;
}

.stat-value {
    font-size: 1.3em;
    font-weight: bold;
    color: #00ff88;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

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

.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(45deg, #00ff88, #00cc6a);
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
    min-width: 100px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 255, 136, 0.4);
    background: linear-gradient(45deg, #00cc6a, #00aa55);
}

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

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

.btn.secondary {
    background: linear-gradient(45deg, #666, #555);
}

.btn.secondary:hover {
    background: linear-gradient(45deg, #777, #666);
    box-shadow: 0 5px 15px rgba(102, 102, 102, 0.4);
}

.pinball-machine {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

#gameCanvas {
    border: 3px solid #00ff88;
    border-radius: 15px;
    background: #000;
    box-shadow: 
        0 0 30px rgba(0, 255, 136, 0.3),
        inset 0 0 50px rgba(0, 255, 136, 0.1);
}

.flipper-controls {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 100px;
    align-items: center;
}

.flipper-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.key-indicator {
    background: #00ff88;
    color: #000;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9em;
}

.flipper-label {
    color: #ccc;
    font-size: 0.85em;
    font-weight: 600;
}

.power-meter {
    position: absolute;
    right: -120px;
    top: 50%;
    transform: translateY(-50%);
    width: 100px;
    text-align: center;
}

.power-label {
    color: #ccc;
    font-size: 0.8em;
    margin-bottom: 8px;
    font-weight: 600;
}

.power-bar {
    width: 20px;
    height: 200px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(0, 255, 136, 0.5);
    border-radius: 10px;
    margin: 0 auto 8px;
    position: relative;
    overflow: hidden;
}

.power-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: linear-gradient(to top, #ff4444, #ffaa00, #00ff88);
    border-radius: 8px;
    transition: height 0.1s ease;
}

.power-value {
    color: #00ff88;
    font-size: 0.8em;
    font-weight: bold;
}

.game-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.score-zones, .special-features {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid rgba(0, 255, 136, 0.3);
}

.score-zones h3, .special-features h3 {
    color: #00ff88;
    margin-bottom: 15px;
    font-size: 1.1em;
    text-align: center;
}

.zone-item, .feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.zone-item:last-child, .feature-item:last-child {
    border-bottom: none;
}

.zone-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
}

.zone-color.red { background: #ff4444; }
.zone-color.blue { background: #4488ff; }
.zone-color.yellow { background: #ffaa00; }
.zone-color.green { background: #00ff88; }
.zone-color.orange { background: #ff8800; }

.zone-name {
    flex: 1;
    color: #ccc;
    font-size: 0.9em;
}

.zone-points {
    color: #00ff88;
    font-weight: bold;
    font-size: 0.85em;
}

.feature-icon {
    font-size: 1.5em;
    flex-shrink: 0;
}

.feature-info {
    flex: 1;
}

.feature-name {
    color: #fff;
    font-weight: bold;
    font-size: 0.9em;
    margin-bottom: 2px;
}

.feature-desc {
    color: #aaa;
    font-size: 0.8em;
    line-height: 1.3;
}

/* 弹窗样式 */
.game-over-popup, .help-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.game-over-popup.show, .help-modal.show {
    display: flex;
}

.popup-content, .modal-content {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: white;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(0, 255, 136, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: popupSlideIn 0.5s ease-out;
}

@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.popup-content h2 {
    color: #00ff88;
    margin-bottom: 20px;
    font-size: 1.8em;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.final-stats {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: left;
}

.final-stats p {
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    color: #ccc;
}

.final-stats span {
    font-weight: bold;
    color: #00ff88;
}

.popup-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* 帮助模态框 */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(0, 255, 136, 0.3);
}

.modal-header h2 {
    color: #00ff88;
    font-size: 1.4em;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5em;
    color: #ccc;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #00ff88;
}

.modal-body {
    text-align: left;
}

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

.help-section h3 {
    color: #00ff88;
    margin-bottom: 12px;
    font-size: 1.1em;
    border-left: 4px solid #00ff88;
    padding-left: 12px;
}

.help-section p {
    color: #ccc;
    line-height: 1.6;
    margin-bottom: 10px;
}

.help-section ul {
    color: #ccc;
    line-height: 1.6;
    margin-left: 20px;
}

.help-section li {
    margin-bottom: 8px;
}

.help-section strong {
    color: #fff;
    font-weight: 600;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .power-meter {
        position: static;
        transform: none;
        margin-top: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 15px;
    }
    
    .power-bar {
        width: 200px;
        height: 20px;
        margin: 0;
    }
    
    .power-fill {
        width: 0%;
        height: 100%;
        background: linear-gradient(to right, #ff4444, #ffaa00, #00ff88);
    }
}

@media (max-width: 768px) {
    .game-container {
        padding: 15px;
        margin: 10px;
    }
    
    .game-header h1 {
        font-size: 2em;
    }
    
    .game-stats {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
    
    .stat {
        min-width: 120px;
    }
    
    .game-info {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    #gameCanvas {
        width: 100%;
        height: auto;
        max-width: 350px;
        max-height: 525px;
    }
    
    .flipper-controls {
        position: static;
        transform: none;
        margin-top: 15px;
        gap: 50px;
    }
    
    .game-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        min-width: 200px;
    }
    
    .popup-content, .modal-content {
        padding: 25px;
        margin: 20px;
    }
    
    .popup-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .flipper-controls {
        gap: 30px;
    }
    
    .flipper-hint {
        flex-direction: column;
        gap: 4px;
        text-align: center;
    }
    
    #gameCanvas {
        max-width: 280px;
        max-height: 420px;
    }
}

/* 特效动画 */
@keyframes scorePopup {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0.5);
    }
    50% {
        opacity: 1;
        transform: translateY(-20px) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateY(-40px) scale(1);
    }
}

.score-popup {
    position: absolute;
    color: #00ff88;
    font-weight: bold;
    font-size: 18px;
    pointer-events: none;
    animation: scorePopup 1s ease-out forwards;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.8);
}

@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 30px rgba(0, 255, 136, 0.3);
    }
    50% {
        box-shadow: 0 0 50px rgba(0, 255, 136, 0.6);
    }
}

.glow-effect {
    animation: glowPulse 1s ease-in-out infinite;
}