@font-face {
    font-family: 'Press Start 2P';
    src: url('PressStart2P-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* Top Buttons */
.top-btns {
    display: flex;
    gap: 5px;
}

/* Achievement Popup */
.achievement-popup {
    position: fixed;
    bottom: -80px;
    left: 50%;
    transform: translateX(-50%);
    background: #001100;
    border: 2px solid #00ff00;
    color: #00ff00;
    padding: 10px 16px;
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    text-align: center;
    z-index: 999;
    transition: bottom 0.4s ease;
    white-space: nowrap;
}

.achievement-popup span {
    font-size: 6px;
    color: #009900;
}

.achievement-popup.show {
    bottom: 20px;
}

/* Achievements List */
.ach-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
}

.ach-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border: 2px solid #004400;
    background: #001100;
    text-align: left;
}

.ach-item.unlocked {
    border-color: #00ff00;
    background: #002200;
}

.ach-icon { font-size: 12px; }

.ach-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ach-label {
    font-size: 7px;
    color: #00ff00;
}

.ach-desc {
    font-size: 6px;
    color: #006600;
}

.ach-item.unlocked .ach-desc { color: #009900; }

/* Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Press Start 2P', monospace;
    font-size: 6px;
}

body {
    background: #000;
    color: #00ff00;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    margin: 0 auto;
} 

.game-container {
    text-align: center;
    max-width: 520px;
    width: 100%;
    margin: 0 auto;
    padding: 10px;
    position: relative;
}

/* Tab Bar */
.tab-bar {
    display: flex;
    width: 100%;
    gap: 4px;
}

.tab-btn {
    flex: 1;
    padding: 8px 4px;
    font-size: 6px;
    background: #001100;
    border: 2px solid #004400;
    color: #007700;
    cursor: pointer;
    letter-spacing: 1px;
}

.tab-btn:hover {
    background: #002200;
    color: #00ff00;
}

.active-tab {
    background: #002800 !important;
    border-color: #00ff00 !important;
    color: #00ff00 !important;
}

.tab-panel {
    width: 100%;
}

/* Top Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

h1 {
    letter-spacing: 3px;
    font-size: 11px;
    color: #00ff00;
}

#homeBtn {
    font-size: 7px;
    padding: 5px 8px;
}

/* Overlay */
.overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.92);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.overlay.hidden { display: none; }

.overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 28px 24px;
    width: 300px;
    height: 300px;
    justify-content: center;
    background: #000;
    border: 3px solid #00ff00;
    clip-path: polygon(
        8px 0%, calc(100% - 8px) 0%,
        100% 8px, 100% calc(100% - 8px),
        calc(100% - 8px) 100%, 8px 100%,
        0% calc(100% - 8px), 0% 8px
    );
}

.overlay-content h2 {
    font-size: 10px;
    letter-spacing: 2px;
    color: #00ff00;
}

.subtitle {
    font-size: 7px;
    color: #007700;
    letter-spacing: 3px;
}

/* Mode Buttons */
.mode-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    background: #001100;
    border: 2px solid #004400;
    color: #00bb00;
    cursor: pointer;
    text-align: left;
    width: 100%;
}

.mode-btn:hover, .mode-btn:active {
    background: #002200;
    border-color: #00aa00;
    color: #00ff00;
}

.active-mode {
    background: #002800 !important;
    border-color: #00ff00 !important;
    color: #00ff00 !important;
}

.mode-icon { font-size: 10px; }
.mode-label { font-size: 7px; flex: 1; letter-spacing: 1px; }
.mode-desc { font-size: 6px; color: #006600; }
.active-mode .mode-desc { color: #009900; }

/* Canvas */
canvas {
    background: #000;
    border: 3px solid #00ff00;
    box-shadow: 0 0 16px #00cc00;
    display: block;
    margin: 10px auto;
    max-width: 100%;
    image-rendering: pixelated;
}

/* Bottom Bar */
.bottom-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-top: 6px;
    padding: 0 4px;
}

.score-panel {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    padding-top: 4px;
}

.right-panel {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

#score, #highScore { font-size: 7px; }
#levelDisplay { font-size: 7px; color: #ffff00; }

#gameOver {
    font-size: 8px;
    color: #ff3333;
    font-weight: bold;
    animation: blink 0.8s step-start infinite;
}

@keyframes blink { 50% { opacity: 0; } }

/* Buttons */
button {
    padding: 6px 10px;
    background: black;
    color: #00ff00;
    border: 2px solid #00ff00;
    cursor: pointer;
    font-size: 7px;
}

button:hover, button:active { background: #003300; }

/* D-Pad */
.dpad {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 10px;
    gap: 4px;
    user-select: none;
}

.dpad-row { display: flex; align-items: center; gap: 4px; }

.dpad-center {
    width: 44px;
    height: 44px;
    background: #001100;
    border: 2px solid #003300;
}

.dpad-btn {
    width: 54px;
    height: 54px;
    font-size: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    border: 2px solid #00ff00;
    background: #001a00;
    color: #00ff00;
    cursor: pointer;
    border-radius: 6px;
    box-shadow: 0 0 6px #00aa00;
    -webkit-tap-highlight-color: transparent;
}

.dpad-btn:active { background: #004400; transform: scale(0.93); }

.hidden { display: none !important; }