:root {
    --bg-base: #121212;
    --bg-surface: #1e1e1e;
    --bg-surface-hover: #2d2d2d;
    --accent: #00d2ff;
    --accent-glow: rgba(0, 210, 255, 0.4);
    --text-primary: #ffffff;
    --text-muted: #888888;
    --border-color: #333333;
}

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

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden; /* Avoid scrollbars if canvas scales up */
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    max-width: 1200px;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(90deg, #fff, #aaa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.file-input {
    display: none;
}

.file-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.file-label:hover {
    background: var(--bg-surface-hover);
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.file-label svg {
    color: var(--accent);
}

.game-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #1a1a1a 0%, #0d0d0d 100%);
    position: relative;
    padding: 2rem;
}

.canvas-wrapper {
    position: relative;
    border-radius: 4px;
    background: #000;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    /* Maintain 4:3 aspect ratio roughly by default or auto fit */
    max-width: 100%;
    max-height: 100%;
}

.canvas-wrapper.empty {
    width: 640px;
    height: 480px;
    border: 2px dashed var(--border-color);
    background: transparent;
    box-shadow: none;
}

.canvas-wrapper.empty canvas {
    display: none;
}

.empty-state {
    display: none;
    text-align: center;
    color: var(--text-muted);
}

.canvas-wrapper.empty .empty-state {
    display: block;
}

.empty-state p {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* 
    Crucial for retro games: keep pixels sharp.
    We'll let CSS scale the canvas up from its intrinsic 320x240 size.
*/
canvas {
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    outline: none; /* remove focus border */
}

/* Focus ring to show user inputs are active */
canvas:focus {
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.app-footer {
    padding: 1rem 2rem;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.controls-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.controls-hint strong {
    color: var(--text-primary);
}
