/* --- Root Variables --- */
:root {
    --console-bg: #1a1a2e; /* Deep Navy */
    --console-darker-bg: #16213e;
    --screen-bg: #0f3460; /* Dark Blue Screen */
    --screen-bezel: #1a1a2e;
    --button-main-color: #e94560; /* Neon Red/Pink */
    --button-main-press-color: #c0273f;
    --button-dpad-color: #3b3b58; 
    --button-dpad-press-color: #2a2a40;
    --text-color: #e0e0e0;
    --accent-color: #4cc9f0; /* Cyan Accent */
    --pixel-font: 'Press Start 2P', cursive;
}

/* --- Body & Background --- */
html { box-sizing: border-box; } *, *:before, *:after { box-sizing: inherit; }
body {
    margin: 0; font-family: var(--pixel-font), sans-serif;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    background-size: 400% 400%; animation: cosmicShift 30s ease-in-out infinite alternate;
    display: flex; justify-content: center; align-items: center;
    min-height: 100vh;
    height: 100vh;
    overflow: hidden; color: var(--text-color); position: relative;
    user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
@keyframes cosmicShift { 0% { background-position: 0% 0%; } 100% { background-position: 100% 100%; } }
#particles-js-brick { position: absolute; width: 100%; height: 100%; top: 0; left: 0; z-index: 0; pointer-events: none; }

/* --- Game Console Base Styles --- */
.game-console {
    width: 700px;
    min-height: 850px;
    max-height: 95vh;
    padding: 25px; border-width: 3px; position: relative; z-index: 2;
    background-color: var(--console-bg); border-radius: 25px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4), inset 0 0 15px rgba(255,255,255,0.03), inset 0 5px 12px rgba(0,0,0,0.25);
    display: flex; flex-direction: column; align-items: center;
    border-style: solid; border-color: var(--console-darker-bg);
    font-family: var(--pixel-font), sans-serif;
    flex-shrink: 1; height: auto;
}

.console-top { width: 100%; margin-bottom: 20px; text-align: center; flex-shrink: 0; }
.brand { font-size: 2em; color: var(--accent-color); text-shadow: 0 0 5px var(--accent-color), 0 0 10px var(--accent-color); }

/* Screen Area */
.console-screen-area {
    display: flex; width: 100%; align-items: stretch; gap: 15px;
    flex-grow: 1; min-height: 0; flex-direction: row;
}

.game-screen-bezel {
    background-color: var(--screen-bezel); padding: 8px; border-radius: 6px;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.6);
    flex: 1; display: flex; min-width: 0;
}

.game-screen {
    background-color: var(--screen-bg); position: relative;
    border: 2px solid var(--console-darker-bg); overflow: hidden;
    display: flex; justify-content: center; align-items: center;
    flex: 1; border-radius: 4px; min-height: 400px;
}

#brickCanvas {
    display: block; image-rendering: pixelated;
    width: 100%; height: 100%;
}

/* Info Panel */
.info-panel {
    flex-grow: 0; flex-shrink: 0; width: 170px;
    display: flex; flex-direction: column; justify-content: space-around;
    padding: 15px 12px; background-color: var(--console-darker-bg);
    border-radius: 6px; box-shadow: inset 0 2px 5px rgba(0,0,0,0.5);
    text-align: center; border: 2px solid #0f3460;
}
.info-section h4 { margin: 0 0 6px 0; font-size: 0.8em; color: var(--accent-color); text-transform: uppercase; letter-spacing: 1px; }
.info-section p { margin: 0; font-size: 1.1em; color: var(--text-color); line-height: 1.2; background-color: var(--screen-bg); padding: 7px 8px; border-radius: 3px; display: block; border: 1px solid var(--screen-bezel); }

/* Game Overlays */
.game-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(15, 15, 24, 0.92); display: flex; flex-direction: column; justify-content: center; align-items: center; color: white; text-align: center; padding: 20px; z-index: 10; font-family: var(--pixel-font), sans-serif; touch-action: none; }
.message-content { background-color: var(--console-darker-bg); border: 2px solid var(--accent-color); padding: 25px 30px; border-radius: 4px; box-shadow: 0 0 15px var(--accent-color), inset 0 0 10px rgba(0, 0, 0, 0.2); }
.game-overlay h1 { color: var(--accent-color); margin-bottom: 20px; text-shadow: 2px 2px 0px #000; }
.game-overlay p { font-size: 1.2em; margin-top: 0; margin-bottom: 18px; line-height: 1.5; color: var(--text-color);}
.game-overlay button { padding: 12px 25px; font-family: var(--pixel-font); background-color: var(--button-main-color); color: #fff; border: none; border-radius: 3px; cursor: pointer; font-size: 1em; text-shadow: none; box-shadow: 0 3px 0px var(--button-main-press-color), 0 0 8px rgba(233, 69, 96, 0.5); transition: all 0.1s ease-out; font-weight: bold; }
.game-overlay button:hover { background-color: #ff5e78; box-shadow: 0 3px 0px var(--button-main-press-color), 0 0 12px rgba(233, 69, 96, 0.7); }
.game-overlay button:active { transform: translateY(2px); box-shadow: 0 1px 0px var(--button-main-press-color), 0 0 5px rgba(233, 69, 96, 0.4); }

/* --- Controls --- */
.console-controls {
    display: flex; justify-content: center; align-items: center;
    width: 100%; padding: 0 20px; margin-top: 20px; flex-shrink: 0; gap: 40px;
}

.d-pad-horizontal {
    display: flex; gap: 15px;
}

.control-button {
    width: 70px; height: 70px; border-radius: 10px;
    background-color: var(--button-dpad-color);
    border: 3px solid var(--console-darker-bg);
    box-shadow: 0 5px 0 var(--button-dpad-press-color), 0 8px 8px rgba(0,0,0,0.3);
    cursor: pointer; display: flex; justify-content: center; align-items: center;
    color: #fff; font-size: 24px; transition: all 0.1s;
}

.control-button:active, .control-button.active-touch {
    transform: translateY(4px); box-shadow: 0 1px 0 var(--button-dpad-press-color);
}

.action-buttons .main-action-button {
    background-color: var(--button-main-color);
    border-radius: 50%; width: 80px; height: 80px;
    box-shadow: 0 6px 0 var(--button-main-press-color), 0 10px 10px rgba(0,0,0,0.3);
}
.action-buttons .main-action-button:active {
    box-shadow: 0 2px 0 var(--button-main-press-color);
}

/* Console Bottom */
.console-bottom { width: 100%; margin-top: 20px; display: flex; justify-content: center; flex-shrink: 0; }
.speaker-grill { display: flex; gap: 6px; }
.speaker-grill span { width: 10px; height: 36px; background-color: var(--console-darker-bg); border-radius: 2px; box-shadow: inset 0 1px 3px rgba(0,0,0,0.6); }

/* --- Mobile Optimizations --- */
@media (max-width: 768px) and (orientation: portrait) {
    body { height: 100svh; overflow: hidden; }
    .game-console {
        width: 100%; height: 100svh; border-radius: 0; border: none;
        padding: 10px; min-height: 0;
        display: flex; flex-direction: column; justify-content: flex-start;
    }
    .console-top { margin-bottom: 10px; }
    .brand { font-size: 1.5em; }
    .console-screen-area {
        flex-direction: column; width: 100%; flex-grow: 1;
        margin-bottom: 10px; overflow: hidden; min-height: 0; order: 1; gap: 0;
    }
    .game-screen-bezel { width: 100%; flex: 1; padding: 5px; margin-right: 0; }
    .game-screen { width: 100%; height: 100%; min-height: 0; }

    .info-panel {
        width: 100%; flex-direction: row; flex-wrap: wrap;
        justify-content: space-around; padding: 8px; gap: 5px 10px;
        flex-grow: 0; flex-shrink: 0; order: 2;
        border-radius: 4px; border-width: 1px;
    }
    .info-section h4 { font-size: 0.7em; margin-bottom: 3px; }
    .info-section p { font-size: 0.9em; padding: 4px 6px; }

    .console-controls {
        width: 100%; padding: 10px 15px; margin-top: auto;
        order: 3; justify-content: center; gap: 20px;
    }
    .console-bottom { display: none; }
}
