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

body {
    background: #0a0a0a;
    font-family: 'Press Start 2P', cursive;
    overflow: hidden;
    color: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#game-container {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 0;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#scanlines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.1) 0px,
        rgba(0, 0, 0, 0.1) 1px,
        transparent 1px,
        transparent 3px
    );
    pointer-events: none;
    z-index: 100;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

#ui-overlay.active {
    opacity: 1;
}

#header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: linear-gradient(180deg, rgba(0,0,0,0.8) 0%, transparent 100%);
}

#title {
    font-size: clamp(12px, 3vw, 24px);
    color: #ffcc00;
    text-shadow: 3px 3px 0 #ff6600, -1px -1px 0 #ff0000;
    letter-spacing: 2px;
}

#round-display, #wind-display {
    font-size: clamp(8px, 2vw, 12px);
    color: #aaa;
}

#wind-arrow {
    color: #66ccff;
    font-size: 1.2em;
}

.player-info {
    position: absolute;
    top: 60px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.7);
    border: 3px solid;
    image-rendering: pixelated;
}

#player-info-left {
    left: 10px;
    border-color: #cc3333;
}

#player-info-right {
    right: 10px;
    border-color: #3333cc;
    text-align: right;
}

.player-name {
    font-size: clamp(8px, 2vw, 12px);
    margin-bottom: 8px;
}

#player-info-left .player-name { color: #ff6666; }
#player-info-right .player-name { color: #6666ff; }

.health-bar {
    margin-bottom: 5px;
}

.heart {
    color: #ff4444;
    font-size: clamp(10px, 2.5vw, 16px);
    margin: 0 2px;
    transition: all 0.3s;
}

.score {
    font-size: clamp(6px, 1.5vw, 10px);
    color: #888;
}

#controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(0deg, rgba(20, 10, 5, 0.95) 0%, rgba(40, 30, 20, 0.9) 100%);
    border-top: 4px solid #654321;
    padding: 15px;
    pointer-events: all;
}

#turn-indicator {
    text-align: center;
    font-size: clamp(10px, 2.5vw, 14px);
    margin-bottom: 10px;
    color: #ff6666;
}

#control-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    align-items: center;
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.control-group label {
    font-size: clamp(6px, 1.5vw, 10px);
    color: #aa8855;
}

#angle-slider {
    width: 120px;
    height: 20px;
    -webkit-appearance: none;
    background: #332211;
    border: 2px solid #554433;
    cursor: pointer;
}

#angle-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 24px;
    background: #ffcc00;
    border: 2px solid #aa8800;
    cursor: grab;
}

#angle-slider::-moz-range-thumb {
    width: 20px;
    height: 24px;
    background: #ffcc00;
    border: 2px solid #aa8800;
    cursor: grab;
}

#angle-value, #power-value {
    font-size: clamp(8px, 2vw, 12px);
    color: #ffcc00;
}

#power-bar-container {
    width: 120px;
    height: 20px;
    background: #332211;
    border: 2px solid #554433;
    cursor: pointer;
    position: relative;
}

#power-bar-fill {
    height: 100%;
    width: 50%;
    background: linear-gradient(90deg, #44ff44, #ffff44, #ff4444);
    transition: width 0.05s;
}

#weapon-selector {
    display: flex;
    gap: 5px;
}

.weapon-btn {
    width: 40px;
    height: 40px;
    background: #443322;
    border: 3px solid #665544;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.1s;
}

.weapon-btn:hover {
    background: #554433;
}

.weapon-btn.active {
    background: #665544;
    border-color: #ffcc00;
    box-shadow: 0 0 10px #ffcc0066;
}

#fire-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(12px, 3vw, 18px);
    padding: 15px 30px;
    background: linear-gradient(180deg, #ff4444 0%, #cc0000 100%);
    border: 4px solid #aa0000;
    color: #fff;
    cursor: pointer;
    text-shadow: 2px 2px 0 #660000;
    transition: all 0.1s;
}

#fire-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, #ff6666 0%, #ee2222 100%);
    transform: scale(1.05);
}

#fire-btn:active:not(:disabled) {
    transform: scale(0.95);
}

#fire-btn:disabled {
    background: #555;
    border-color: #333;
    color: #888;
    cursor: not-allowed;
}

/* Title Screen */
#title-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, #1a0a00 0%, #331100 50%, #1a0a00 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

#title-screen.hidden {
    display: none;
}

#title-logo {
    font-size: clamp(24px, 8vw, 64px);
    color: #ffcc00;
    text-shadow: 
        4px 4px 0 #ff6600,
        8px 8px 0 #cc3300,
        -2px -2px 0 #ff8800;
    text-align: center;
    line-height: 1.3;
    animation: titlePulse 2s ease-in-out infinite;
}

@keyframes titlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

#title-subtitle {
    font-size: clamp(8px, 2vw, 14px);
    color: #aa8855;
    margin-top: 20px;
    margin-bottom: 40px;
}

#start-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(12px, 3vw, 20px);
    padding: 20px 40px;
    background: linear-gradient(180deg, #44aa44 0%, #228822 100%);
    border: 4px solid #116611;
    color: #fff;
    cursor: pointer;
    animation: startBlink 1s ease-in-out infinite;
}

@keyframes startBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

#start-btn:hover {
    background: linear-gradient(180deg, #55cc55 0%, #33aa33 100%);
}

/* Victory Screen */
#victory-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

#victory-screen.hidden {
    display: none;
}

#victory-text {
    font-size: clamp(20px, 6vw, 48px);
    color: #ffcc00;
    text-shadow: 3px 3px 0 #ff6600;
    animation: victoryBounce 0.5s ease-out infinite alternate;
}

@keyframes victoryBounce {
    from { transform: translateY(0); }
    to { transform: translateY(-10px); }
}

#restart-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(10px, 2.5vw, 16px);
    padding: 15px 30px;
    background: linear-gradient(180deg, #4444ff 0%, #2222cc 100%);
    border: 4px solid #1111aa;
    color: #fff;
    cursor: pointer;
    margin-top: 40px;
}

#restart-btn:hover {
    background: linear-gradient(180deg, #6666ff 0%, #4444ee 100%);
}

#confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -20px;
    animation: confettiFall 3s linear infinite;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Shake effect */
.shake {
    animation: shake 0.2s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px) translateY(2px); }
    50% { transform: translateX(5px) translateY(-2px); }
    75% { transform: translateX(-3px) translateY(1px); }
}

/* Footer */
footer {
    background: #1a0a00;
    padding: 10px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    border-top: 3px solid #332211;
    font-size: 10px;
}

footer span {
    color: #665544;
}

.remix-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: 8px;
    padding: 8px 16px;
    background: #332211;
    border: 2px solid #554433;
    color: #aa8855;
    text-decoration: none;
    cursor: pointer;
}

.remix-btn:hover {
    background: #443322;
    color: #ffcc00;
}

/* Mobile adjustments */
@media (max-width: 600px) {
    .player-info {
        padding: 8px;
        top: 50px;
    }
    
    #controls {
        padding: 10px;
    }
    
    #control-panel {
        gap: 10px;
    }
    
    #angle-slider, #power-bar-container {
        width: 80px;
    }
    
    .weapon-btn {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    #fire-btn {
        padding: 12px 20px;
    }
}