@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

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

body {
    font-family: 'Press Start 2P', monospace;
    background: #1a1a1a;
    color: #ffffff;
    font-size: 10px;
    line-height: 1.4;
    overflow-x: auto;
}

#game-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: linear-gradient(135deg, #2c2c2c 0%, #1a1a1a 100%);
}

/* Header */
#header {
    background: #333;
    padding: 10px 20px;
    border-bottom: 2px solid #555;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

#header h1 {
    color: #FFD700;
    text-shadow: 2px 2px 0px #000;
    font-size: 14px;
}

#frame-info {
    color: #00FF00;
    padding: 5px 10px;
    background: #000;
    border: 1px solid #555;
    border-radius: 3px;
}

/* Drawing Tools */
#drawing-tools {
    background: #444;
    padding: 10px;
    border-bottom: 2px solid #666;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: inset 0 -2px 5px rgba(0,0,0,0.3);
}

.tool-btn {
    padding: 8px 12px;
    background: #666;
    border: 2px outset #888;
    color: white;
    cursor: pointer;
    font-family: inherit;
    font-size: 8px;
    transition: all 0.1s;
}

.tool-btn:hover {
    background: #777;
    transform: translateY(-1px);
}

.tool-btn:active, .tool-btn.active {
    border: 2px inset #666;
    background: #555;
    transform: translateY(1px);
}

.color-picker, .line-width {
    display: flex;
    align-items: center;
    gap: 5px;
}

.color-picker input, .line-width select {
    padding: 4px;
    border: 1px solid #666;
    background: #555;
    color: white;
    font-family: inherit;
    font-size: 8px;
}

/* Main Content */
#main-content {
    display: flex;
    flex: 1;
    gap: 10px;
    padding: 10px;
}

/* Sprite Toolbar */
#sprite-toolbar {
    width: 200px;
    background: #333;
    border: 2px inset #555;
    padding: 10px;
    overflow-y: auto;
    max-height: 70vh;
}

#sprite-toolbar h3 {
    color: #FFD700;
    margin-bottom: 10px;
    font-size: 10px;
    text-align: center;
    text-shadow: 1px 1px 0px #000;
}

.sprite-section {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.sprite-counter {
    width: 100%;
    color: #00FF00;
    margin-bottom: 5px;
    font-size: 8px;
    text-align: center;
}

.sprite-btn {
    width: 30px;
    height: 30px;
    background: #666;
    border: 2px outset #888;
    color: white;
    cursor: pointer;
    font-family: inherit;
    font-size: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s;
}

.sprite-btn:hover {
    background: #777;
    transform: scale(1.1);
}

.sprite-btn:active {
    border: 2px inset #666;
    background: #555;
}

/* Canvas Container */
#canvas-container {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
    border: 3px inset #555;
    min-height: 600px;
}

#canvas, #overlay-canvas {
    border: 2px solid #FFD700;
    cursor: crosshair;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    position: absolute;
}

#overlay-canvas {
    pointer-events: none;
    z-index: 1;
}

/* Playbook Panel */
#playbook-panel {
    width: 200px;
    background: #333;
    border: 2px inset #555;
    padding: 10px;
    overflow-y: auto;
    max-height: 70vh;
}

#playbook-panel h3, #playbook-panel h4 {
    color: #FFD700;
    margin-bottom: 10px;
    font-size: 10px;
    text-align: center;
    text-shadow: 1px 1px 0px #000;
}

#playbook-panel h4 {
    font-size: 8px;
    margin-top: 15px;
    margin-bottom: 5px;
}

.formation-section, .save-section, .load-section, .export-section, .clear-section {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #555;
}

.formation-btn, #save-play, #load-play, #export-png, #export-gif, #clear-all, #mirror-play {
    width: 100%;
    padding: 6px;
    margin-bottom: 5px;
    background: #666;
    border: 2px outset #888;
    color: white;
    cursor: pointer;
    font-family: inherit;
    font-size: 7px;
    transition: all 0.1s;
}

.formation-btn:hover, #save-play:hover, #load-play:hover, #export-png:hover, #export-gif:hover, #clear-all:hover, #mirror-play:hover {
    background: #777;
}

.formation-btn:active, #save-play:active, #load-play:active, #export-png:active, #export-gif:active, #clear-all:active, #mirror-play:active {
    border: 2px inset #666;
    background: #555;
}

#play-name, #saved-plays {
    width: 100%;
    padding: 4px;
    margin-bottom: 5px;
    border: 1px solid #666;
    background: #555;
    color: white;
    font-family: inherit;
    font-size: 7px;
}

/* Animation Controls */
#animation-controls {
    background: #444;
    padding: 15px;
    border-top: 2px solid #666;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.3);
}

#prev-frame, #next-frame, #add-frame, #duplicate-frame, #delete-frame, #play-pause {
    padding: 8px 12px;
    background: #666;
    border: 2px outset #888;
    color: white;
    cursor: pointer;
    font-family: inherit;
    font-size: 8px;
    transition: all 0.1s;
}

#prev-frame:hover, #next-frame:hover, #add-frame:hover, #duplicate-frame:hover, #delete-frame:hover, #play-pause:hover {
    background: #777;
    transform: translateY(-1px);
}

#prev-frame:active, #next-frame:active, #add-frame:active, #duplicate-frame:active, #delete-frame:active, #play-pause:active {
    border: 2px inset #666;
    background: #555;
    transform: translateY(1px);
}

.play-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

#speed-slider {
    width: 100px;
}

#loop-toggle {
    margin-right: 5px;
}

/* Footer */
#footer {
    background: #333;
    padding: 10px;
    text-align: center;
    border-top: 2px solid #555;
    font-size: 8px;
}

#footer a {
    color: #FFD700;
    text-decoration: none;
}

#footer a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 1200px) {
    #main-content {
        flex-direction: column;
    }
    
    #sprite-toolbar, #playbook-panel {
        width: 100%;
        max-height: 200px;
        display: flex;
        gap: 20px;
    }
    
    #sprite-toolbar .sprite-section, #playbook-panel > div {
        flex: 1;
    }
}

@media (max-width: 800px) {
    #canvas {
        width: 100%;
        height: auto;
    }
    
    #drawing-tools {
        justify-content: center;
    }
    
    #animation-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .play-controls {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    body {
        font-size: 8px;
    }
    
    #header h1 {
        font-size: 10px;
    }
}

/* Pixel Art Effects */
.pixel-perfect {
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* Button Hover Effects */
button:focus {
    outline: 2px solid #FFD700;
    outline-offset: 2px;
}

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

::-webkit-scrollbar-track {
    background: #333;
}

::-webkit-scrollbar-thumb {
    background: #666;
    border: 2px outset #888;
}

::-webkit-scrollbar-thumb:hover {
    background: #777;
}