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

body {
    font-family: 'Orbitron', monospace;
    background-color: #000;
    color: #fff;
    min-height: 100vh;
    overflow-x: hidden;
    padding-top: 11rem;
}

header {
    text-align: center;
    padding: 1rem 0 0.5rem 0;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #000;
    z-index: 201;
    border-bottom: 2px solid #fff;
}

header h1 {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 0.2em;
    text-shadow: 0 0 20px #fff;
    margin: 0;
}

.subtitle {
    font-size: 1.2rem;
    margin-top: 0.5rem;
    opacity: 0.8;
    font-weight: 400;
}

main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 0 2rem;
}

.game-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 600px;
}

#gameCanvas {
    border: 2px solid #fff;
    background-color: #000;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
    transition: transform 0.3s ease;
    position: relative;
}

/* Canvas stays centered when there's enough space (1240px = 800px canvas + 380px sidebar + 40px gaps + 20px margin) */
@media (min-width: 1241px) {
    .game-container.sidebar-open #gameCanvas {
        transform: translateX(0);
    }
}

/* Canvas slides left when space is limited but still fits both elements */
@media (max-width: 1240px) and (min-width: 1201px) {
    .game-container.sidebar-open #gameCanvas {
        transform: translateX(calc(-50vw + 620px));
    }
}

/* Fullscreen sidebar when canvas + sidebar can't both fit */
@media (max-width: 1200px) {
    .game-container.sidebar-open #gameCanvas {
        transform: translateX(-100vw);
    }
    
    .game-container.sidebar-open .sidebar.open {
        width: 100vw;
        right: 0;
    }
}

.sidebar {
    position: fixed;
    right: -400px;
    top: 50%;
    transform: translateY(-50%);
    width: 380px;
    height: 600px;
    background-color: #000;
    border: 2px solid #00ff00;
    box-shadow: -10px 0 30px rgba(0, 255, 0, 0.2);
    transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 100;
    font-family: 'Courier New', monospace;
}

.sidebar.open {
    right: 20px;
}

.sidebar-content {
    padding: 1rem;
    height: 100%;
    overflow-y: auto;
    position: relative;
    background-color: #000;
}

.close-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: 1px solid #00ff00;
    color: #00ff00;
    font-size: 1rem;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    transition: all 0.2s ease;
    z-index: 101;
}

.close-btn:hover {
    background-color: #00ff00;
    color: #000;
    box-shadow: 0 0 10px #00ff00;
}

#contentArea {
    margin-top: 2rem;
    font-family: 'Courier New', monospace;
    background-color: #000;
    padding: 0;
    position: relative;
    height: calc(100% - 2rem);
    overflow-y: auto;
}

#contentArea h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: #00ff00;
    font-family: 'Courier New', monospace;
}

#contentArea p, #contentArea ul {
    line-height: 1.4;
    margin-bottom: 1rem;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

#contentArea li {
    color: #00ff00;
    font-family: 'Courier New', monospace;
}

#contentArea a {
    color: #00ffff;
    text-decoration: underline;
    transition: all 0.2s ease;
}

#contentArea a:hover {
    text-shadow: 0 0 5px #00ffff;
}

.typewriter-cursor {
    display: inline-block;
    background-color: #00ff00;
    width: 8px;
    height: 1em;
    animation: blink 1s infinite;
    margin-left: 2px;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Custom scrollbar styling */
.sidebar-content::-webkit-scrollbar {
    width: 12px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: #000;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: #00ff00;
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: #00cc00;
}

.sidebar-content::-webkit-scrollbar-corner {
    background: #000;
}

#contentArea::-webkit-scrollbar {
    width: 12px;
}

#contentArea::-webkit-scrollbar-track {
    background: #000;
}

#contentArea::-webkit-scrollbar-thumb {
    background: #00ff00;
    border-radius: 3px;
}

#contentArea::-webkit-scrollbar-thumb:hover {
    background: #00cc00;
}

#contentArea::-webkit-scrollbar-corner {
    background: #000;
}

.instructions {
    width: 100%;
    text-align: center;
    padding: 1rem 2rem;
    border-bottom: 2px solid #fff;
    background-color: rgba(255, 255, 255, 0.05);
    position: fixed;
    top: 4rem;
    left: 0;
    z-index: 200;
    font-size: 1.8rem;
}

.controls-compact {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4rem;
    font-family: 'Orbitron', monospace;
}

.control-compact {
    color: #fff;
    font-weight: 400;
    opacity: 0.9;
}

.game-info-compact {
    color: #fff;
    font-weight: 300;
    opacity: 0.7;
    font-style: italic;
}

/* Responsive design */
@media (max-width: 1200px) {
    .instructions {
        font-size: 1.6rem;
        padding: 0.8rem 1.5rem;
    }
    
    .controls-compact {
        gap: 3rem;
    }
    
    body {
        padding-top: 10rem;
    }
}

@media (max-width: 1000px) {
    .instructions {
        font-size: 1.4rem;
        padding: 0.7rem 1.2rem;
    }
    
    .controls-compact {
        gap: 2.5rem;
    }
    
    body {
        padding-top: 9.5rem;
    }
}

@media (max-width: 800px) {
    .instructions {
        font-size: 1.2rem;
        padding: 0.6rem 1rem;
    }
    
    .controls-compact {
        gap: 2rem;
    }
    
    body {
        padding-top: 9rem;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.5rem;
    }
    
    #gameCanvas {
        width: 100%;
        max-width: 400px;
        height: 300px;
    }
    
    .controls-compact {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .instructions {
        font-size: 1rem;
        padding: 0.4rem 0.8rem;
        top: 3rem;
    }
    
    body {
        padding-top: 7.5rem;
    }
}

@media (max-width: 600px) {
    .instructions {
        font-size: 0.9rem;
        padding: 0.3rem 0.6rem;
    }
    
    body {
        padding-top: 7rem;
    }
}

@media (max-width: 480px) {
    .instructions {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }
    
    .controls-compact {
        gap: 0.3rem;
    }
    
    body {
        padding-top: 6.5rem;
    }
}