@font-face {
    font-family: "Play";
    src: url("Play-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

html {
    width: 100%;
    height: 100%;
    font-family: "Play", monospace, sans-serif;
}

body {
    width: 100%;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e272e, #2f3640);
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    overflow: hidden;
}

.game-container {
    text-align: center;
    max-width: 100%;
    width: 100%;
    height: 100vh;
    max-height: 900px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.game-header {
    margin-bottom: 10px;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 10px;
    border: 2px solid #00a8ff;
    backdrop-filter: blur(10px);
}

.game-header h1 {
    font-size: clamp(1.5rem, 6vw, 2.5rem);
    color: #00a8ff;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(0, 168, 255, 0.5);
}

.score-board {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 10px;
    font-size: clamp(0.9rem, 3vw, 1.2rem);
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-item .label {
    color: #dcdde1;
    font-size: 0.8em;
    margin-bottom: 2px;
}

.score-item .value {
    color: #fbc531;
    font-weight: bold;
    font-size: 1.1em;
}

.game-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 10px 0;
    min-height: 0;
}

.canvas-container {
    position: relative;
    width: 100%;
    max-width: 480px;
    height: 100%;
    max-height: 520px;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    background-color: #000;
    border: 3px solid #00a8ff;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 168, 255, 0.3);
    image-rendering: -webkit-optimize-contrast;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.mobile-controls {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: none;
    justify-content: center;
    padding: 0 20px;
}

.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 300px;
    gap: 20px;
}

.control-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid #4cd137;
    background: rgba(76, 209, 55, 0.2);
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    touch-action: manipulation;
}

.control-btn:active {
    background: rgba(76, 209, 55, 0.5);
    transform: scale(0.95);
}

.control-btn.fire {
    width: 80px;
    height: 80px;
    font-size: 1rem;
    background: rgba(231, 76, 60, 0.3);
    border-color: #e74c3c;
}

.control-btn.fire:active {
    background: rgba(231, 76, 60, 0.6);
}

.controls {
    margin: 10px 0;
    padding: 12px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 10px;
    border: 2px solid #4cd137;
    backdrop-filter: blur(10px);
}

.instructions {
    color: #dcdde1;
    margin-bottom: 12px;
    font-size: clamp(0.9rem, 3vw, 1.1rem);
}

.buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    background: linear-gradient(135deg, #00a8ff, #0097e6);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-family: "Play", monospace;
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    min-width: 120px;
    backdrop-filter: blur(10px);
}

.btn:hover {
    background: linear-gradient(135deg, #0097e6, #00a8ff);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 168, 255, 0.4);
}

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

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

.game-over, .pause-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.game-over-content, .pause-content {
    background: rgba(47, 54, 64, 0.95);
    padding: 30px;
    border-radius: 15px;
    border: 3px solid #e84118;
    text-align: center;
    max-width: 90%;
    width: 400px;
}

.pause-content {
    border-color: #fbc531;
}

.game-over h2, .pause-content h2 {
    font-size: clamp(1.8rem, 6vw, 2.5rem);
    color: #e84118;
    margin-bottom: 20px;
}

.pause-content h2 {
    color: #fbc531;
}

.game-over p {
    font-size: clamp(1.1rem, 4vw, 1.3rem);
    margin-bottom: 20px;
    color: #fbc531;
}

.hidden {
    display: none !important;
}

/* Responsividade */
@media (max-width: 768px) {
    body {
        padding: 5px;
    }
    
    .game-container {
        height: 100vh;
        max-height: none;
    }
    
    .game-header {
        padding: 8px 12px;
        margin-bottom: 5px;
    }
    
    .score-board {
        gap: 8px;
    }
    
    .game-area {
        margin: 5px 0;
    }
    
    .controls {
        margin: 5px 0;
        padding: 10px;
    }
    
    .buttons {
        gap: 8px;
    }
    
    .btn {
        padding: 10px 15px;
        min-width: 100px;
    }
    
    .mobile-controls {
        display: flex;
    }
    
    .control-btn {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }
    
    .control-btn.fire {
        width: 70px;
        height: 70px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .game-header {
        padding: 6px 10px;
    }
    
    .score-board {
        flex-direction: column;
        gap: 5px;
    }
    
    .score-item {
        flex-direction: row;
        justify-content: space-between;
        width: 100%;
    }
    
    .controls {
        padding: 8px;
    }
    
    .buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        margin: 2px 0;
    }
    
    .control-row {
        gap: 15px;
    }
    
    .control-btn {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
    
    .control-btn.fire {
        width: 65px;
        height: 65px;
        font-size: 0.8rem;
    }
    
    .game-over-content, .pause-content {
        padding: 20px;
        margin: 20px;
    }
}

@media (max-height: 700px) {
    .game-header h1 {
        margin-bottom: 5px;
    }
    
    .score-board {
        gap: 5px;
    }
    
    .instructions {
        margin-bottom: 8px;
    }
    
    .mobile-controls {
        bottom: 10px;
    }
}

/* Orientação paisagem em mobile */
@media (max-width: 900px) and (orientation: landscape) {
    .game-container {
        flex-direction: row;
        height: 100vh;
    }
    
    .game-header {
        width: 200px;
        margin-bottom: 0;
        margin-right: 10px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    .game-area {
        flex: 1;
        margin: 0;
    }
    
    .controls {
        display: none;
    }
    
    .mobile-controls {
        bottom: 10px;
    }
    
    .score-board {
        flex-direction: column;
        gap: 8px;
    }
}

/* Animações */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pulse {
    animation: pulse 0.5s ease-in-out;
}

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

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

/* Melhorias de acessibilidade */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Suporte para dispositivos com notch */
@supports(padding: max(0px)) {
    body {
        padding-left: max(10px, env(safe-area-inset-left));
        padding-right: max(10px, env(safe-area-inset-right));
        padding-top: max(10px, env(safe-area-inset-top));
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }
}