* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow: hidden;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

#gameContainer {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

#gameArea {
    flex: 3;
    position: relative;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    overflow: hidden;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

#gameInfo {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 10px;
    z-index: 10;
}

.info-item {
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 12px;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.info-item .label {
    color: #ffd700;
    font-weight: bold;
}

#lives {
    display: flex;
    gap: 3px;
}

.life {
    color: #ff4757;
    font-size: 16px;
}

.life.lost {
    color: #666;
    opacity: 0.3;
}

#bombProgress {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10;
}

#bombProgress .label {
    color: #ffd700;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
}

#progressBar {
    flex: 1;
    height: 20px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #ffd700;
}

#progressFill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ffd700, #ffaa00);
    transition: width 0.3s ease;
}

#controlArea {
    flex: 1;
    background: linear-gradient(180deg, #2c3e50 0%, #1a252f 100%);
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    border-top: 3px solid #3498db;
}

.control-row {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 10px;
}

.control-left,
.control-right {
    display: flex;
    gap: 15px;
}

.control-btn {
    width: 80px;
    height: 60px;
    font-size: 24px;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    color: #fff;
}

.control-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#leftBtn,
#rightBtn {
    background: linear-gradient(180deg, #3498db, #2980b9);
}

.shoot-btn {
    background: linear-gradient(180deg, #e74c3c, #c0392b);
    width: 100px;
}

.bomb-btn {
    background: linear-gradient(180deg, #f39c12, #d68910);
    width: 100px;
}

.bomb-btn:disabled {
    background: linear-gradient(180deg, #7f8c8d, #95a5a6);
}

.music-btn {
    background: linear-gradient(180deg, #27ae60, #229954);
    width: 120px;
    font-size: 16px;
}

.end-btn {
    background: linear-gradient(180deg, #c0392b, #a93226);
    width: 120px;
    font-size: 16px;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    color: #fff;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.start-content h1 {
    font-size: 36px;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.btn-start,
.btn-help,
.btn-restart,
.btn-next,
.btn-close {
    display: block;
    width: 200px;
    padding: 15px;
    margin: 15px auto;
    font-size: 18px;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.btn-start {
    background: linear-gradient(180deg, #2ecc71, #27ae60);
    color: #fff;
}

.btn-help,
.btn-close {
    background: linear-gradient(180deg, #3498db, #2980b9);
    color: #fff;
}

.btn-restart,
.btn-next {
    background: linear-gradient(180deg, #e74c3c, #c0392b);
    color: #fff;
}

.btn-start:hover,
.btn-help:hover,
.btn-restart:hover,
.btn-next:hover,
.btn-close:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.4);
}

.help-content h2,
.gameover-content h2,
.level-complete-content h2 {
    font-size: 28px;
    margin-bottom: 20px;
}

.help-text {
    text-align: left;
    line-height: 1.8;
    font-size: 14px;
    margin-bottom: 20px;
}

.help-text p {
    margin: 10px 0;
}

.help-text strong {
    color: #ffd700;
}

.gameover-content p,
.level-complete-content p {
    font-size: 18px;
    margin: 15px 0;
}

.gameover-content span,
.level-complete-content span {
    color: #ffd700;
    font-weight: bold;
    font-size: 22px;
}

#questionModal .modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 3px solid #ffd700;
}

#questionModal h3 {
    font-size: 24px;
    margin-bottom: 20px;
    color: #ffd700;
}

#questionText {
    font-size: 28px;
    margin-bottom: 20px;
    font-weight: bold;
}

#answerOptions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.answer-option {
    padding: 15px;
    font-size: 20px;
    font-weight: bold;
    border: 2px solid #3498db;
    border-radius: 10px;
    background: rgba(52, 152, 219, 0.2);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.answer-option:hover {
    background: rgba(52, 152, 219, 0.4);
    transform: scale(1.02);
}

.answer-option.correct {
    background: rgba(46, 204, 113, 0.5);
    border-color: #2ecc71;
}

.answer-option.wrong {
    background: rgba(231, 76, 60, 0.5);
    border-color: #e74c3c;
}

.btn-giveup {
    padding: 15px;
    font-size: 20px;
    font-weight: bold;
    border: 2px solid #3498db;
    border-radius: 10px;
    background: rgba(52, 152, 219, 0.2);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-giveup:hover {
    background: rgba(52, 152, 219, 0.4);
    transform: scale(1.02);
}

@media (max-width: 480px) {
    #gameInfo {
        font-size: 12px;
    }

    .info-item {
        padding: 5px 8px;
    }

    .control-btn {
        width: 60px;
        height: 50px;
        font-size: 20px;
    }

    .shoot-btn,
    .bomb-btn {
        width: 80px;
    }

    .music-btn,
    .end-btn {
        width: 90px;
        font-size: 14px;
    }

    .modal-content {
        padding: 20px;
    }

    .start-content h1 {
        font-size: 28px;
    }

    .help-text {
        font-size: 12px;
    }
}

@media (min-width: 768px) {
    #gameContainer {
        max-width: 500px;
        margin: 0 auto;
        height: 100vh;
        border-left: 2px solid #3498db;
        border-right: 2px solid #3498db;
    }

    .control-btn {
        width: 100px;
        height: 70px;
        font-size: 28px;
    }

    .shoot-btn,
    .bomb-btn {
        width: 120px;
    }

    .music-btn,
    .end-btn {
        width: 140px;
        font-size: 18px;
    }
}

@media (orientation: landscape) {
    #gameContainer {
        transform: rotate(90deg);
        transform-origin: center center;
    }

    body {
        background: #000;
    }
}