/* --- Root Variables --- */
:root {
    --console-bg: #2e1a1a; /* Darker earthy tone for console, or keep consistent? Let's keep consistent with Racer for the "Box" feel, but maybe slight tint */
    --console-darker-bg: #1f1212;
    --screen-bg: #3b2518; /* Dirt background */
    --screen-bezel: #4a3b32;
    --button-main-color: #ffd700; /* Gold */
    --button-main-press-color: #c5a600;
    --button-dpad-color: #3b3b58; 
    --button-dpad-press-color: #2a2a40;
    --text-color: #f0f0f0;
    --accent-color: #ffd700;
    --pixel-font: 'Press Start 2P', cursive;
    
    /* Game Specific Colors */
    --sky-color: #87CEEB; /* Not really used inside a mine, sticking to dirt */
    --dirt-light: #5d4037;
    --dirt-dark: #3e2723;
    --gold-color: #FFD700;
    --gold-shine: #FFF8DC;
    --stone-color: #808080;
    --stone-dark: #696969;
    --diamond-color: #b9f2ff;
    --rope-color: #333333;
    --hook-color: #C0C0C0;
}

/* --- 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(160deg, #1a0f0f 0%, #2e1a1a 30%, #4a2c2c 70%, #1a0f0f 100%);
    background-size: 400% 400%; animation: cosmicShift 45s 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-gold { position: absolute; width: 100%; height: 100%; top: 0; left: 0; z-index: 0; pointer-events: none; }

/* --- Background Decor --- */
.background-decor-gold { position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; z-index: 1; pointer-events: none; }
.decor-grid-pattern { position: absolute; top: 50%; left: 0; width: 100%; height: 50%; background-image: repeating-linear-gradient(var(--accent-color) 0 1px, transparent 1px 100%), repeating-linear-gradient(90deg, var(--accent-color) 0 1px, transparent 1px 100%); background-size: 50px 50px; opacity: 0.03; transform: perspective(300px) rotateX(45deg) scale(1.5); transform-origin: 50% 0; animation: scrollGrid 20s linear infinite; }
@keyframes scrollGrid { from { background-position-y: 0; } to { background-position-y: -50px; } }

/* --- 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), 2px 2px 2px #000; }

/* 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;
}

#goldMinerCanvas {
    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 #101018;
}
.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(255, 215, 0, 0.2); }
.game-overlay p { font-size: 1.2em; margin-top: 0; margin-bottom: 18px; line-height: 1.5; color: var(--text-color);}
.game-overlay p.controls-hint { font-size: 0.75em; color: #aaa; margin-bottom: 22px;}
.game-overlay button { padding: 12px 25px; font-family: var(--pixel-font); background-color: var(--button-main-color); color: #000; 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(255, 215, 0, 0.5); transition: all 0.1s ease-out; font-weight: bold; }
.game-overlay button:hover { background-color: #ffe066; box-shadow: 0 3px 0px var(--button-main-press-color), 0 0 12px rgba(255, 215, 0, 0.7); }
.game-overlay button:active { transform: translateY(2px); box-shadow: 0 1px 0px var(--button-main-press-color), 0 0 5px rgba(255, 215, 0, 0.4); }

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

.control-button.main-action-button {
    width: 80px; height: 80px; border-radius: 50%;
    background-color: var(--button-main-color);
    border: 4px solid var(--console-darker-bg);
    box-shadow: 0 6px 0 var(--button-main-press-color), 0 10px 10px rgba(0,0,0,0.3);
    cursor: pointer; position: relative; transition: all 0.1s;
    display: flex; justify-content: center; align-items: center;
}
.control-button.main-action-button:active, .control-button.main-action-button.active-touch {
    transform: translateY(4px);
    box-shadow: 0 2px 0 var(--button-main-press-color), 0 5px 5px rgba(0,0,0,0.3);
}
.control-button.main-action-button i { font-size: 24px; color: #333; }

/* 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 { text-align: center; flex-basis: auto; }
    .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;
    }
    .console-bottom { margin-top: 15px; order: 4; padding-bottom: 10px;}
}
@media (max-width: 900px) and (orientation: landscape) {
    .game-console { flex-direction: row; height: 100vh; padding: 10px; }
    .console-top { position: absolute; top: 5px; left: 10px; width: auto; margin-bottom: 0; z-index: 11; }
    .game-screen-bezel { max-height: calc(100vh - 100px); }
    .console-bottom { display: none; }
}
