@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');

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

body {
    font-family: 'Orbitron', monospace;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: #e94560;
    min-height: 100vh;
    overflow-x: auto;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(233, 69, 96, 0.1);
    border-radius: 15px;
    border: 2px solid #e94560;
    box-shadow: 0 0 20px rgba(233, 69, 96, 0.3);
}

.title {
    font-size: 2.5rem;
    font-weight: 900;
    text-shadow: 0 0 10px #e94560;
    margin-bottom: 20px;
}

.mode-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.mode-btn {
    padding: 8px 16px;
    background: #0f3460;
    color: #e94560;
    border: 2px solid #e94560;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    transition: all 0.3s ease;
}

.mode-btn:hover {
    background: #e94560;
    color: #0f3460;
    box-shadow: 0 0 10px rgba(233, 69, 96, 0.5);
}

.mode-btn.active {
    background: #e94560;
    color: #0f3460;
    box-shadow: 0 0 15px rgba(233, 69, 96, 0.7);
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.controls button {
    padding: 8px 16px;
    background: #0f3460;
    color: #e94560;
    border: 2px solid #e94560;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s ease;
}

.controls button:hover {
    background: #e94560;
    color: #0f3460;
    box-shadow: 0 0 10px rgba(233, 69, 96, 0.5);
}

#speedSlider {
    width: 120px;
    accent-color: #e94560;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
    margin-bottom: 30px;
}

.display-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.screen-container, .memory-container {
    background: rgba(15, 52, 96, 0.3);
    padding: 20px;
    border-radius: 15px;
    border: 2px solid #0f3460;
}

.screen-container h3, .memory-container h3 {
    color: #e94560;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.2rem;
}

#gbaScreen {
    display: block;
    margin: 0 auto;
    border: 3px solid #e94560;
    border-radius: 8px;
    background: #000;
    box-shadow: 0 0 20px rgba(233, 69, 96, 0.3);
}

.memory-info {
    display: flex;
    justify-content: space-around;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: #f39c12;
}

#memoryViewer {
    border: 2px solid #e94560;
    border-radius: 8px;
    background: #1a1a2e;
    cursor: crosshair;
}

.editor-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.palette-editor, .sprite-editor, .info-panel {
    background: rgba(15, 52, 96, 0.3);
    padding: 20px;
    border-radius: 15px;
    border: 2px solid #0f3460;
}

.palette-editor h3, .sprite-editor h3, .info-panel h3 {
    color: #e94560;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.palette-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    margin-bottom: 15px;
}

.palette-color {
    width: 30px;
    height: 30px;
    border: 2px solid #333;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.palette-color:hover {
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.palette-color.selected {
    border-color: #e94560;
    box-shadow: 0 0 10px rgba(233, 69, 96, 0.7);
}

#colorPicker {
    width: 100%;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

#spriteCanvas {
    display: block;
    margin: 0 auto 15px;
    border: 2px solid #e94560;
    border-radius: 8px;
    background: #000;
    cursor: crosshair;
}

.sprite-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.sprite-controls button {
    padding: 8px 16px;
    background: #0f3460;
    color: #e94560;
    border: 2px solid #e94560;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s ease;
}

.sprite-controls button:hover {
    background: #e94560;
    color: #0f3460;
    box-shadow: 0 0 10px rgba(233, 69, 96, 0.5);
}

.memory-regions {
    margin-bottom: 15px;
}

.region {
    padding: 8px;
    margin: 5px 0;
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: bold;
}

.bg-palette {
    background: rgba(74, 170, 153, 0.3);
    border-left: 4px solid #4aa;
}

.sprite-palette {
    background: rgba(68, 153, 170, 0.3);
    border-left: 4px solid #49a;
}

.tile-data {
    background: rgba(255, 170, 68, 0.3);
    border-left: 4px solid #fa4;
}

.oam-data {
    background: rgba(170, 68, 255, 0.3);
    border-left: 4px solid #a4f;
}

.stats {
    font-size: 0.9rem;
}

.stats div {
    margin: 5px 0;
    color: #f39c12;
}

.footer {
    text-align: center;
    padding: 20px;
    color: #888;
    font-size: 0.9rem;
}

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

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

/* Mobile Responsiveness */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .editor-section {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        display: grid;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .mode-selector {
        flex-wrap: wrap;
    }
    
    .controls {
        flex-direction: column;
        gap: 10px;
    }
    
    #gbaScreen {
        max-width: 100%;
        height: auto;
    }
    
    .palette-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .editor-section {
        grid-template-columns: 1fr;
    }
}

/* Glowing animations */
@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(233, 69, 96, 0.5); }
    50% { box-shadow: 0 0 20px rgba(233, 69, 96, 0.8); }
}

.header {
    animation: glow 3s ease-in-out infinite;
}

/* Retro scanlines effect */
#gbaScreen::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 2px,
        rgba(0, 0, 0, 0.1) 2px,
        rgba(0, 0, 0, 0.1) 4px
    );
    pointer-events: none;
}