/* Estilo para o jogo Juliette Psicose 2D */
body {
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
    font-family: 'Courier New', monospace;
    overflow: hidden;
    position: relative;
}

#gameContainer {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.1);
    background: #000;
    padding: 2px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

/* UI: ajustes do mostrador de ângulos */
.aim-settings {
    position: fixed;
    top: 70px;
    right: 14px;
    width: 220px;
    padding: 10px 10px 8px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(4px);
    color: rgba(255, 255, 255, 0.9);
    font-family: 'Courier New', monospace;
    z-index: 1002;
}

.aim-settings-title {
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 6px;
    color: rgba(255, 215, 0, 0.95);
}

.aim-settings-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    margin: 6px 0;
}

.aim-settings-row span {
    width: 70px;
    opacity: 0.9;
}

.aim-settings-row input[type="range"] {
    flex: 1;
}

.aim-settings-hint {
    margin-top: 6px;
    font-size: 9px;
    opacity: 0.75;
}

@media (max-width: 768px) {
    .aim-settings { display: none; }
}

canvas {
    background: #222;
    border: 2px solid #555;
    border-radius: 5px;
    image-rendering: pixelated;
    display: block;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
    width: 100%;
    height: 100%;
    object-fit: fill;
    position: relative;
}

/* Informações do jogo */
.game-info {
    position: absolute;
    top: -40px;
    left: 0;
    right: 0;
    text-align: center;
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

/* Controles */
.controls {
    position: absolute;
    bottom: -60px;
    left: 0;
    right: 0;
    text-align: center;
    color: #ccc;
    font-size: 12px;
}

/* Botão de tela cheia - Posicionado no topo do HUD */
.fullscreen-btn {
    position: fixed;
    top: 25px; /* Bem no topo, acima de tudo */
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: #fff;
    border: 2px solid #555;
    border-radius: 6px;
    padding: 4px 8px;
    font-family: 'Courier New', monospace;
    font-size: 9px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    line-height: 1;
}

.fullscreen-btn:hover {
    background: linear-gradient(135deg, #2a2a4e, #26315e);
    border-color: #777;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    transform: translateY(-1px);
}

.fullscreen-btn:active {
    transform: translateY(0px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.fullscreen-btn.fullscreen-active {
    background: linear-gradient(135deg, #4a4a6e, #46517e);
    border-color: #999;
}

/* Efeito de scan lines */
canvas::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.1) 2px,
        rgba(0, 0, 0, 0.1) 4px
    );
}

/* Responsividade */
@media (max-width: 850px) {
    body {
        padding: 5px;
    }
    #gameContainer {
        padding: 2px;
        width: 100%;
        height: 100%;
    }
    canvas {
        border: 1px solid #555;
    }
    .game-info {
        font-size: 14px;
        top: -30px;
    }
    .controls {
        font-size: 10px;
        bottom: -40px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 2px;
    }
    #gameContainer {
        padding: 1px;
        border-radius: 3px;
    }
    canvas {
        border: 1px solid #333;
        border-radius: 3px;
    }
    .fullscreen-btn {
        font-size: 8px;
        padding: 3px 6px;
        top: 10px; /* Bem no topo, acima das barras de energia/escudo */
    }
    .game-info {
        font-size: 12px;
        top: -25px;
    }
    .controls {
        font-size: 9px;
        bottom: -35px;
    }
}

/* Controles Touch */
.mobile-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: transparent;
    display: none;
    z-index: 1000;
    pointer-events: none;
}

.mobile-controls.active {
    display: block;
    pointer-events: all;
}

.controls-left {
    position: absolute;
    left: 20px;
    bottom: 20px;
    width: 160px;
    height: 160px;
}

.controls-right {
    position: absolute;
    right: 10px;
    bottom: 20px;
    width: 175px;
    height: 160px;
}

.controls-center {
    position: absolute;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    width: 220px;
    display: flex;
    justify-content: center;
}

.weapon-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 8px;
    justify-items: center;
    align-items: center;
    max-width: 180px;
}

.weapon-button {
    background: rgba(0, 255, 255, 0.3);
    border: 2px solid rgba(0, 255, 255, 0.7);
    border-radius: 8px;
    color: white;
    font-weight: bold;
    font-size: 14px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    touch-action: manipulation;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.weapon-button:active {
    background: rgba(0, 255, 255, 0.5);
    transform: scale(0.95);
}


.dpad {
    position: relative;
    width: 160px;
    height: 160px;
}

.dpad-button {
    position: absolute;
    background: rgba(255, 255, 255, 0.25);
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    color: white;
    font-weight: bold;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    touch-action: manipulation;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.dpad-button:active {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0.95);
}

.dpad-up {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 50px;
}

.dpad-down {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 50px;
}

.dpad-left {
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
}

.dpad-right {
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 6px;
    width: 100%;
    height: 100%;
}

.action-button {
    background: rgba(255, 255, 0, 0.4);
    border: 2px solid rgba(255, 255, 0, 0.8);
    border-radius: 50%;
    color: white;
    font-weight: bold;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    touch-action: manipulation;
    min-width: 45px;
    min-height: 45px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.action-button:active {
    background: rgba(255, 255, 0, 0.6);
    transform: scale(0.95);
}

.action-button.primary {
    width: 48px;
    height: 48px;
    font-size: 20px;
    grid-column: 2;
    grid-row: 1;
}

/* Botão de corrente dupla com visual diferenciado */
.action-button#doubleChainBtn {
    background: rgba(255, 100, 0, 0.4);
    border: 2px solid rgba(255, 100, 0, 0.8);
    font-size: 14px;
    grid-column: 3;
    grid-row: 1;
    width: 48px;
    height: 48px;
}

.action-button#doubleChainBtn:active {
    background: rgba(255, 100, 0, 0.6);
}

.action-button#doubleChainBtn.pressed {
    background: rgba(255, 100, 0, 0.8) !important;
    border-color: rgba(255, 120, 20, 1) !important;
    box-shadow: 0 0 15px rgba(255, 100, 0, 0.5);
}

.action-button.secondary {
    width: 38px;
    height: 38px;
    font-size: 16px;
}


/* Responsividade extra */
@media (max-width: 768px) {
    .mobile-controls {
        height: 180px;
    }
    .controls-left {
        width: 140px;
        height: 140px;
    }
    .dpad {
        width: 140px;
        height: 140px;
    }
    .dpad-button {
        font-size: 16px;
    }
    .dpad-up, .dpad-down, .dpad-left, .dpad-right {
        width: 45px;
        height: 45px;
    }
    .action-button.primary {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    .action-button.secondary {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .action-button#doubleChainBtn {
        font-size: 12px;
    }
    .controls-center {
        width: 200px;
    }
    .weapon-button {
        width: 36px;
        height: 36px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .mobile-controls {
        height: 160px;
    }
    .controls-left {
        left: 10px;
        bottom: 10px;
        width: 120px;
        height: 120px;
    }
    .controls-right {
        right: 5px;
        bottom: 10px;
        width: 170px;
    }
    .dpad {
        width: 120px;
        height: 120px;
    }
    .dpad-up, .dpad-down, .dpad-left, .dpad-right {
        width: 40px;
        height: 40px;
    }
    .action-button.primary {
        width: 42px;
        height: 42px;
        font-size: 16px;
        grid-column: 2;
        grid-row: 1;
    }
    
    .action-button#doubleChainBtn {
        width: 42px;
        height: 42px;
        font-size: 11px;
        grid-column: 3;
        grid-row: 1;
    }
    .action-button.secondary {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }
    
    .controls-center {
        width: 180px;
        bottom: 10px;
    }
    .weapon-button {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
}

/* Adicionais para controles móveis */
.dpad-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    pointer-events: none;
}

.dpad-button.pressed,
.action-button.pressed {
    background: rgba(255, 255, 255, 0.5) !important;
    border-color: rgba(255, 255, 255, 0.8) !important;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

.action-button.primary.pressed {
    background: rgba(255, 255, 0, 0.8) !important;
    box-shadow: 0 0 20px rgba(255, 255, 0, 0.5);
}

.weapon-button.pressed {
    background: rgba(0, 255, 255, 0.7) !important;
    border-color: rgba(0, 255, 255, 1) !important;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
    transform: scale(0.95);
}

/* Vibração visual para feedback */
@keyframes vibrate {
    0% { transform: translate(0); }
    10% { transform: translate(-1px, -1px); }
    20% { transform: translate(1px, -1px); }
    30% { transform: translate(-1px, 1px); }
    40% { transform: translate(1px, 1px); }
    50% { transform: translate(0); }
}

.action-button.vibrate {
    animation: vibrate 0.1s linear;
}

/* Efeitos especiais para botões */
.action-button::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.action-button:active::before {
    opacity: 1;
}

/* Melhor visibilidade em diferentes orientações */
@media screen and (orientation: landscape) and (max-height: 500px) {
    .mobile-controls {
        height: 140px;
    }
    .controls-left {
        width: 120px;
        height: 120px;
        bottom: 10px;
    }
    .controls-right {
        width: 165px;
        height: 120px;
        bottom: 10px;
        right: 5px;
    }
    .dpad {
        width: 120px;
        height: 120px;
    }
    .dpad-up, .dpad-down, .dpad-left, .dpad-right {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    .action-button.primary {
        width: 38px;
        height: 38px;
        font-size: 15px;
        grid-column: 2;
        grid-row: 1;
    }
    
    .action-button#doubleChainBtn {
        width: 38px;
        height: 38px;
        font-size: 10px;
        grid-column: 3;
        grid-row: 1;
    }
    .action-button.secondary {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .dpad-center {
        width: 25px;
        height: 25px;
    }
    .controls-center {
        width: 170px;
        bottom: 10px;
    }
    .weapon-button {
        width: 30px;
        height: 30px;
        font-size: 11px;
    }
}

/* Ajustes para telas grandes */
@media (min-width: 1200px) {
    #gameContainer {
        padding: 3px;
    }
    canvas {
        border: 3px solid #666;
    }
}

@media (min-aspect-ratio: 21/9) {
    .game-info {
        font-size: 20px;
        top: -45px;
    }
    .controls {
        font-size: 14px;
    }
}
