/* --- THE GAME BOY PALETTE --- */
:root {
    --gb-darkest: #0f380f;
    --gb-dark: #306230;
    --gb-light: #8bac0f;
    --gb-lightest: #9bbc0f;
    --gb-plastic: #c4cfa1;
}

body {
    background: #eee;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    font-family: 'Courier New', Courier, monospace;
}

/* Device Shell */
#gb-device {
    background-color: var(--gb-plastic);
    padding: 20px 20px 40px 20px;
    border-radius: 10px 10px 30px 10px;
    box-shadow: inset -5px -5px 10px rgba(0,0,0,0.2), 5px 5px 20px rgba(0,0,0,0.3);
    position: relative;
    margin-bottom: 30px;
}

#screen-bezel {
    background-color: #555;
    padding: 15px 20px;
    border-radius: 5px 5px 20px 5px;
}

/* LCD Screen */
#game-container {
    display: flex;
    background-color: var(--gb-light);
    border: 3px solid var(--gb-darkest);
    padding: 5px;
    position: relative;
    image-rendering: pixelated; 
    color: var(--gb-darkest);
}

#main-view {
    border: 2px solid var(--gb-darkest);
    background-color: var(--gb-light); 
}

/* Sidebar */
#side-panel {
    display: flex;
    flex-direction: column;
    margin-left: 10px;
    width: 90px;
}

.label {
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 2px;
    margin-top: 10px;
}

.stat-display {
    font-size: 18px;
    font-weight: bold;
    text-align: right;
    margin-bottom: 5px;
    letter-spacing: 1px;
}

#next-view {
    background-color: var(--gb-light);
    border: 2px solid var(--gb-darkest);
    margin-top: 5px;
}

/* --- NEW HIGH SCORE LIST STYLES (SIDEBAR) --- */
#score-list {
    list-style: none; /* Remove bullets */
    padding: 0;
    margin: 0;
    font-size: 11px;
    font-weight: bold;
    text-align: left;
}

#score-list li {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px dotted var(--gb-dark);
    padding: 2px 0;
}

/* --- OVERLAY & MODAL STYLES --- */
#overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--gb-light);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    cursor: pointer;
    text-align: center;
}

#overlay h1 {
    font-size: 32px;
    margin: 0 0 20px 0;
    text-shadow: 2px 2px var(--gb-dark);
}

#overlay p {
    font-size: 14px;
    font-weight: bold;
    animation: blink 1s steps(2, start) infinite;
}

/* Name Entry Modal */
#name-modal {
    position: absolute;
    top: 100px; left: 20px; right: 20px;
    background: var(--gb-lightest);
    border: 4px double var(--gb-darkest);
    padding: 20px;
    z-index: 20;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 5px 5px 0px rgba(0,0,0,0.2);
}

#name-modal h2 { margin: 0 0 10px 0; font-size: 18px; }
#name-modal p { margin: 0 0 10px 0; font-size: 12px; }

#name-modal input {
    background: var(--gb-light);
    border: 2px solid var(--gb-darkest);
    padding: 5px;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    text-align: center;
    font-size: 20px;
    width: 60px;
    text-transform: uppercase;
    color: var(--gb-darkest);
    margin-bottom: 10px;
}

#name-modal input:focus { outline: none; background: #fff; }

#name-modal button {
    background: var(--gb-darkest);
    color: var(--gb-light);
    border: none;
    padding: 5px 15px;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    font-size: 14px;
}
#name-modal button:hover { opacity: 0.8; }

@keyframes blink { 50% { visibility: hidden; } }

/* Instructions */
#instructions {
    background-color: #fff;
    padding: 15px 25px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border: 1px solid #ccc;
    text-align: center;
    max-width: 300px;
}
#instructions h3 {
    margin: 0 0 10px 0; font-size: 16px; color: #333; border-bottom: 2px solid #ddd; padding-bottom: 5px;
}
.control-row {
    display: flex; justify-content: space-between; margin: 8px 0; font-size: 13px; color: #555; align-items: center;
}
.key {
    background: #eee; border: 1px solid #bbb; border-bottom: 2px solid #999; border-radius: 3px; padding: 2px 6px; font-weight: bold; font-size: 11px; color: #333;
}

/* --- MOBILE CONTROLS --- */
#controls-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 30px;
    padding: 0 10px;
    box-sizing: border-box;
}

/* D-PAD STYLING */
#d-pad {
    width: 90px;
    height: 90px;
    display: grid;
    grid-template-columns: 30px 30px 30px;
    grid-template-rows: 30px 30px 30px;
}

.d-btn {
    background-color: #333;
    cursor: pointer;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
}
.d-btn:active { background-color: #111; box-shadow: inset 1px 1px 3px rgba(0,0,0,0.5); }

#d-up { grid-column: 2; grid-row: 1; border-radius: 5px 5px 0 0; }
#d-left { grid-column: 1; grid-row: 2; border-radius: 5px 0 0 5px; }
#d-center { grid-column: 2; grid-row: 2; background-color: #333; } /* Center fill */
#d-right { grid-column: 3; grid-row: 2; border-radius: 0 5px 5px 0; }
#d-down { grid-column: 2; grid-row: 3; border-radius: 0 0 5px 5px; }

/* ACTION BUTTONS STYLING */
#actions {
    display: flex;
    gap: 15px;
    transform: rotate(-15deg); /* Classic slanted buttons */
    margin-top: 10px;
}

.action-group {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.round-btn {
    width: 35px;
    height: 35px;
    background-color: #8f004f; /* Nintendo Magenta */
    border-radius: 50%;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
    cursor: pointer;
}
.round-btn:active {
    box-shadow: inset 2px 2px 5px rgba(0,0,0,0.5);
    background-color: #6d003c;
}

.btn-label {
    font-weight: bold;
    color: #0f380f;
    font-size: 12px;
    margin-top: 5px;
    font-family: sans-serif;
}

/* Prevent double-tap zoom on mobile */
button, .d-btn, .round-btn {
    touch-action: manipulation; 
    -webkit-tap-highlight-color: transparent;
}