:root {
    --dark-blue: #0a192f;
    --neon-blue: #00d1ff;
    --neon-red: #ff2a6d;
    --neon-purple: #bd00ff;
    --neon-green: #39ff14;
    --light-gray: #ccd6f6;
    --dark-gray: #1e2a47;
    --metal-gradient: linear-gradient(145deg, #2a3a5c, #0e1a2f);
}

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

body {
    font-family: 'Noto Sans', 'Orbitron', sans-serif;
    background-color: var(--dark-blue);
    color: var(--light-gray);
    min-height: 100vh;
    padding: 2rem;
    overflow: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    height: calc(100vh - 4rem);
    display: flex;
    flex-direction: column;
}

.game-title {
    font-family: 'Orbitron', sans-serif;
    color: var(--light-gray);
    text-align: center;
    margin-bottom: 1rem;
    font-size: 2.5rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(0, 209, 255, 0.5);
}

.game-title span {
    color: var(--neon-red);
    margin: 0 0.5rem;
}

.game-title .version {
    color: var(--neon-blue);
    font-size: 1.5rem;
    vertical-align: baseline;
    margin-left: 1rem;
}

.cpu-mode {
    color: var(--neon-green);
    font-size: 1.5rem;
    margin-left: 1rem;
}

/* Layout structure */
.game-layout {
    display: flex;
    gap: 1rem;
    flex: 1;
    min-height: 0;
}

.main-column {
    flex: 2; /* Adjust width ratio to 2/3 */
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 0;
}

.side-column {
    width: 380px; /* Slightly reduce side menu width */
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

/* Game Area */
.game-area {
    background: #0a192f; /* Changed to dark blue background */
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5),
                inset 0 0 15px rgba(0, 209, 255, 0.2);
    padding: 1rem;
    border: 1px solid rgba(0, 209, 255, 0.1);
    position: relative;
    flex: 1;
    min-height: 300px;
    overflow: hidden;
}

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

/* Player Robot Selection Panel */
.robot-select-panel {
    background: var(--metal-gradient);
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4),
                inset 0 0 15px rgba(0, 209, 255, 0.2);
    border: 1px solid rgba(0, 209, 255, 0.3);
    padding: 0.7rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 0.7rem;
}

/* Stage Information Panel */
.stage-info-panel {
    background: var(--metal-gradient);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4),
                inset 0 0 15px rgba(189, 0, 255, 0.1);
    border: 1px solid rgba(189, 0, 255, 0.1);
    margin-bottom: 1rem;
}

.stage-title {
    font-family: 'Orbitron', sans-serif;
    color: var(--neon-purple);
    font-size: 1.5rem;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 8px rgba(189, 0, 255, 0.5);
}

.stage-description {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.difficulty-meter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.difficulty-label {
    font-size: 0.9rem;
    min-width: 80px;
}

.difficulty-stars {
    display: flex;
    gap: 0.3rem;
}

.star {
    width: 15px;
    height: 15px;
    background: rgba(189, 0, 255, 0.2);
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.star.active {
    background: var(--neon-purple);
    box-shadow: 0 0 5px var(--neon-purple);
}

.panel-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    margin-bottom: 0.3rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.blue-text {
    color: var(--neon-blue);
    text-shadow: 0 0 8px rgba(0, 209, 255, 0.5);
}

.red-text {
    color: var(--neon-red);
    text-shadow: 0 0 8px rgba(255, 42, 109, 0.5);
}

.purple-text {
    color: var(--neon-purple);
    text-shadow: 0 0 8px rgba(189, 0, 255, 0.5);
}

/* Buttons */
.neon-button {
    background: var(--metal-gradient);
    color: var(--light-gray);
    border: none;
    padding: 0.7rem;
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    z-index: 1;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4),
                inset 0 0 10px rgba(0, 209, 255, 0.2);
    border: 1px solid rgba(0, 209, 255, 0.3);
    transition: all 0.3s ease;
    flex-shrink: 0;
    margin: 0.3rem 0;
}

.neon-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5),
                inset 0 0 15px rgba(0, 209, 255, 0.3);
    color: var(--neon-blue);
}

.neon-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.file-input-container {
    position: relative;
    margin: 0.5rem 0;
}

.file-input {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}

.file-input-label {
    background: var(--dark-gray);
    color: var(--light-gray);
    border: 1px solid rgba(0, 209, 255, 0.3);
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-block;
    text-align: center;
    width: 100%;
    transition: all 0.2s ease;
}

.file-input-label:hover {
    background: rgba(0, 209, 255, 0.2);
    color: var(--neon-blue);
}

/* Turn Indicator */
.turn-indicator {
    font-family: 'Orbitron', sans-serif;
    text-align: center;
    padding: 0.5rem;
    border-radius: 8px;
    background: rgba(30, 42, 71, 0.7);
    border: 1px solid rgba(0, 209, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 1rem;
    transition: all 0.3s ease;
    flex-shrink: 0;
    margin-top: 0.3rem;
}

.turn-indicator.blue-turn {
    color: var(--neon-blue);
    text-shadow: 0 0 8px rgba(0, 209, 255, 0.5);
    box-shadow: 0 0 15px rgba(0, 209, 255, 0.2);
}

.turn-indicator.red-turn {
    color: var(--neon-red);
    text-shadow: 0 0 8px rgba(255, 42, 109, 0.5);
    box-shadow: 0 0 15px rgba(255, 42, 109, 0.2);
}

.turn-indicator.p1-turn {
    color: var(--neon-blue);
    text-shadow: 0 0 8px rgba(0, 209, 255, 0.5);
    box-shadow: 0 0 15px rgba(0, 209, 255, 0.2);
}

.turn-indicator.p2-turn {
    color: var(--neon-red);
    text-shadow: 0 0 8px rgba(255, 42, 109, 0.5);
    box-shadow: 0 0 15px rgba(255, 42, 109, 0.2);
}

/* Effects */
.effect {
    position: absolute;
    width: 20px;
    height: 20px;
    background: var(--neon-blue);
    border-radius: 50%;
    animation: explode 0.5s forwards;
    box-shadow: 0 0 10px var(--neon-blue);
    z-index: 100;
}

@keyframes explode {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(3); opacity: 0; }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 209, 255, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-track {
    background: rgba(30, 42, 71, 0.3);
}

/* Victory Modal */
.victory-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.victory-content {
    background: var(--metal-gradient);
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 0 30px rgba(0, 209, 255, 0.5),
                inset 0 0 15px rgba(0, 209, 255, 0.3);
    border: 1px solid rgba(0, 209, 255, 0.5);
    max-width: 80%;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.victory-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 3rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.victory-message {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: var(--light-gray);
}

.button-container {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.winner-blue {
    color: var(--neon-blue);
    text-shadow: 0 0 10px rgba(0, 209, 255, 0.8);
}

.winner-red {
    color: var(--neon-red);
    text-shadow: 0 0 10px rgba(255, 42, 109, 0.8);
}

.winner-p1 {
    color: var(--neon-blue);
    text-shadow: 0 0 10px rgba(0, 209, 255, 0.8);
}

.winner-p2 {
    color: var(--neon-red);
    text-shadow: 0 0 10px rgba(255, 42, 109, 0.8);
}

.winner-draw {
    color: var(--light-gray);
    text-shadow: 0 0 10px rgba(204, 214, 246, 0.8);
}

.close-button {
    background: var(--metal-gradient);
    color: var(--light-gray);
    border: none;
    padding: 0.8rem 2rem;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    border-radius: 8px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4),
                inset 0 0 10px rgba(0, 209, 255, 0.2);
    border: 1px solid rgba(0, 209, 255, 0.3);
    transition: all 0.3s ease;
}

.close-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5),
                inset 0 0 15px rgba(0, 209, 255, 0.3);
    color: var(--neon-blue);
}

.retry-button {
    background: var(--metal-gradient);
    color: var(--neon-green);
    border: none;
    padding: 0.8rem 2rem;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    border-radius: 8px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4),
                inset 0 0 10px rgba(58, 255, 20, 0.2);
    border: 1px solid rgba(58, 255, 20, 0.3);
    transition: all 0.3s ease;
}

.retry-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5),
                inset 0 0 15px rgba(58, 255, 20, 0.3);
    color: var(--neon-green);
}

.show-modal {
    opacity: 1;
}

.show-modal .victory-content {
    transform: scale(1);
}

/* Missile Effect */
.missile {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--neon-blue);
    border-radius: 50%;
    z-index: 999;
}

/* Sound Control Styles */
.sound-controls {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    background: var(--metal-gradient);
    border-radius: 8px;
    padding: 0.5rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    margin: 0.3rem 0;
    border: 1px solid rgba(189, 0, 255, 0.2);
}

.sound-button {
    background: var(--dark-gray);
    color: var(--light-gray);
    border: 1px solid rgba(0, 209, 255, 0.3);
    padding: 0.4rem;
    border-radius: 4px;
    font-family: 'Orbitron', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

.sound-button:hover {
    background: rgba(0, 209, 255, 0.2);
}

.sound-button.disabled {
    opacity: 0.5;
    color: rgba(204, 214, 246, 0.5);
    border-color: rgba(0, 209, 255, 0.1);
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.3rem;
}

.volume-control span {
    font-size: 0.75rem;
}

input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    height: 6px;
    background: rgba(0, 209, 255, 0.2);
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 15px;
    height: 15px;
    background: var(--neon-blue);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 5px var(--neon-blue);
}

input[type="range"]::-moz-range-thumb {
    width: 15px;
    height: 15px;
    background: var(--neon-blue);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 5px var(--neon-blue);
    border: none;
}

.robot-type-selector {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.robot-type-button {
    flex: 1;
    padding: 0.6rem;
    background: var(--dark-gray);
    border: 1px solid rgba(0, 209, 255, 0.3);
    color: var(--light-gray);
    font-family: 'Orbitron', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
}

.robot-type-button:first-child {
    border-radius: 6px 0 0 6px;
    border-right: none;
}

.robot-type-button:last-child {
    border-radius: 0 6px 6px 0;
    border-left: none;
}

.robot-type-button.active {
    background: rgba(0, 209, 255, 0.2);
    color: var(--neon-blue);
    box-shadow: inset 0 0 10px rgba(0, 209, 255, 0.2);
}

.robot-type-button.blue.active {
    color: var(--neon-blue);
}

.robot-type-button.red.active {
    color: var(--neon-red);
}

.program-status {
    background: rgba(30, 42, 71, 0.7);
    border-radius: 6px;
    padding: 0.5rem;
    margin: 0.5rem 0;
    border: 1px solid rgba(0, 209, 255, 0.2);
    font-size: 0.85rem;
}

.program-status.loaded {
    border-color: var(--neon-green);
    color: var(--neon-green);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .game-layout {
        flex-direction: column;
    }
    
    .side-column {
        width: 100%;
        min-height: auto;
    }
    
    .game-area {
        max-height: 400px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }
    
    .game-title {
        font-size: 2rem;
    }
}

/* Skill Effect Animation */
@keyframes skillPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(2); opacity: 0.8; }
    100% { transform: scale(4); opacity: 0; }
}

.skill-effect {
    animation: skillPulse 0.7s forwards !important;
}