@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #0a0a0a;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    position: relative;
}

/* Animated Background Canvas */
#backgroundCanvas {
    position: fixed;
    opacity: 0.1;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    display: none;
}

#backgroundCanvas.active {
    display: block;
}

canvas#canvas {
    background: rgba(0, 0, 0, 0.85);
    border: 6px solid #00ff00;
    box-shadow: 
        0 0 20px #00ff00,
        inset 0 0 20px rgba(0, 255, 0, 0.2);
    position: relative;
    z-index: 2;
    image-rendering: pixelated;
    display: none;
}

canvas#canvas.active {
    display: block;
}

/* Screens */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: none;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10;
    flex-direction: column;
}

#startScreen {
    background: transparent;
}

#pauseScreen {
    z-index: 1000;
}

.screen.active {
    display: flex;
}

/* Title Box */
.title-box {
    background: #000;
    padding: 30px 60px;
    border: 6px solid #00ff00;
    box-shadow: 
        0 0 20px #00ff00,
        inset 0 0 10px rgba(0, 255, 0, 0.3);
    margin-bottom: 40px;
}

.title-box h1 {
    color: #00ff00;
    font-size: 48px;
    font-weight: normal;
    text-shadow: 
        4px 4px 0px #006600,
        0 0 20px #00ff00;
    letter-spacing: 4px;
}

/* Instructions */
.instructions {
    text-align: center;
    margin-bottom: 30px;
}

.main-instruction {
    color: #00ff00;
    font-size: 16px;
    margin-bottom: 20px;
    text-shadow: 0 0 10px #00ff00;
}

.mode-option {
    color: #ffff00;
    font-size: 12px;
    margin: 10px 0;
    text-shadow: 0 0 8px #ffff00;
    animation: blink 1.5s infinite;
}

.controls {
    color: #0099ff;
    font-size: 10px;
    line-height: 1.8;
    margin-top: 20px;
}

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0.3; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* High Score */
.high-score {
    color: #ff00ff;
    font-size: 14px;
    margin-bottom: 30px;
    font-weight: normal;
    text-shadow: 0 0 10px #ff00ff;
}

/* Stats Panel */
.stats-panel {
    background: #000;
    padding: 25px 40px;
    border: 4px solid #00ff00;
    box-shadow: 
        0 0 15px #00ff00,
        inset 0 0 10px rgba(0, 255, 0, 0.2);
    min-width: 500px;
}

.stats-panel h3 {
    color: #00ff00;
    font-size: 14px;
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 4px solid #00ff00;
    padding-bottom: 10px;
    text-shadow: 0 0 10px #00ff00;
}

#scoresList, #gameStatsList {
    color: white;
}

.score-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 2px solid #003300;
    font-size: 10px;
}

.score-entry:last-child {
    border-bottom: none;
}

.score-name {
    color: #0099ff;
    text-shadow: 0 0 5px #0099ff;
    flex: 1;
    min-width: 120px;
}

.score-value {
    color: #ff00ff;
    font-weight: normal;
    text-shadow: 0 0 5px #ff00ff;
    min-width: 50px;
    text-align: right;
}

.score-date {
    color: #00ff00;
    font-weight: normal;
    text-shadow: 0 0 5px #00ff00;
    font-size: 7px;
    min-width: 70px;
    text-align: right;
}

/* Result Boxes */
.result-box {
    background: #000;
    padding: 50px 80px;
    text-align: center;
    border: 6px solid #00ff00;
    box-shadow: 
        0 0 30px #00ff00,
        inset 0 0 20px rgba(0, 255, 0, 0.2);
}

.result-box.game-over {
    border-color: #ff0000;
    box-shadow: 
        0 0 30px #ff0000,
        inset 0 0 20px rgba(255, 0, 0, 0.2);
}

.result-box.win {
    border-color: #ffff00;
    box-shadow: 
        0 0 30px #ffff00,
        inset 0 0 20px rgba(255, 255, 0, 0.2);
}

.result-box h2 {
    font-size: 32px;
    margin-bottom: 25px;
    text-shadow: 4px 4px 0px #000;
    font-weight: normal;
}

.result-box.game-over h2 {
    color: #ff0000;
    text-shadow: 
        4px 4px 0px #660000,
        0 0 20px #ff0000;
}

.result-box.win h2 {
    color: #ffff00;
    text-shadow: 
        4px 4px 0px #666600,
        0 0 20px #ffff00;
}

.final-score {
    color: #00ff00;
    font-size: 16px;
    margin-bottom: 25px;
    text-shadow: 0 0 10px #00ff00;
}

.final-score span {
    color: #ff00ff;
    font-weight: normal;
    text-shadow: 0 0 10px #ff00ff;
}

.instruction {
    color: #0099ff;
    font-size: 10px;
    margin: 20px 0;
    line-height: 1.8;
}

.continue {
    color: #00ff00;
    font-size: 12px;
    margin-top: 25px;
    animation: blink 1s infinite;
}

/* Name Input Wrapper */
.name-input-wrapper {
    margin: 30px 0;
}

.name-input-box {
    background: #000;
    border: 6px solid #00ff00;
    padding: 20px;
    margin: 20px auto;
    min-width: 500px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 
        0 0 20px #00ff00,
        inset 0 0 15px rgba(0, 255, 0, 0.3);
}

.name-input-box .prompt {
    color: #00ff00;
    font-size: 20px;
    text-shadow: 0 0 15px #00ff00;
    animation: blink 1s infinite;
    flex-shrink: 0;
}

#nameInputGameOver,
#nameInputWin {
    all: unset;
    display: block;
    background: transparent;
    color: #00ff00;
    font-size: 20px;
    font-family: 'Press Start 2P', monospace;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: 0 0 15px #00ff00;
    flex: 1;
    caret-color: #00ff00;
    caret-shape: block;
    width: 100%;
    box-sizing: border-box;
}

#nameInputGameOver::-webkit-input-placeholder,
#nameInputWin::-webkit-input-placeholder {
    color: transparent;
}

#nameInputGameOver::placeholder,
#nameInputWin::placeholder {
    color: transparent;
}

#nameInputGameOver::-moz-selection,
#nameInputWin::-moz-selection {
    background: #00ff00;
    color: #000;
    text-shadow: none;
}

#nameInputGameOver::selection,
#nameInputWin::selection {
    background: #00ff00;
    color: #000;
    text-shadow: none;
}

#nameInputGameOver:focus,
#nameInputWin:focus {
    outline: none;
    border: none;
}

#nameInputGameOver::-webkit-outer-spin-button,
#nameInputGameOver::-webkit-inner-spin-button,
#nameInputWin::-webkit-outer-spin-button,
#nameInputWin::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#nameInputGameOver[type="text"]::-webkit-contacts-auto-fill-button,
#nameInputWin[type="text"]::-webkit-contacts-auto-fill-button {
    display: none !important;
}

#nameInputGameOver::-webkit-credentials-auto-fill-button,
#nameInputWin::-webkit-credentials-auto-fill-button {
    display: none !important;
}

.score-heading {
    color: #00ff00 !important;
    text-shadow: 
        4px 4px 0px #006600,
        0 0 20px #00ff00 !important;
}

.skip-hint {
    color: #666;
    font-size: 8px;
    margin-top: 10px;
    font-style: italic;
}

/* Game HUD */
.game-hud {
    position: fixed;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    width: 1000px;
    display: none;
    justify-content: space-between;
    z-index: 5;
    padding: 0 20px;
}

.game-hud.active {
    display: flex;
}

.hud-left, .hud-right, .hud-center {
    background: #000;
    padding: 10px 20px;
    border: 4px solid #00ff00;
    box-shadow: 
        0 0 15px #00ff00,
        inset 0 0 8px rgba(0, 255, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
}

.hud-center {
    display: none;
}

.hud-center.active {
    display: flex;
}

.heart-icon {
    width: 24px;
    height: 24px;
    image-rendering: pixelated;
    filter: drop-shadow(0 0 5px #ff0000);
}

.hud-left .label, .hud-right .label {
    color: #0099ff;
    font-size: 10px;
    margin-right: 10px;
    text-shadow: 0 0 5px #0099ff;
}

#scoreDisplay, #livesDisplay, #timerDisplay {
    color: #00ff00;
    font-size: 14px;
    font-weight: normal;
    text-shadow: 0 0 10px #00ff00;
}

.timer-display {
    font-size: 16px;
    min-width: 80px;
    text-align: center;
}

/* Game Stats Widget */
.game-stats-widget {
    position: fixed;
    top: 75px;
    right: 20px;
    background: #000;
    padding: 15px 20px;
    border: 4px solid #00ff00;
    box-shadow: 
        0 0 15px #00ff00,
        inset 0 0 8px rgba(0, 255, 0, 0.2);
    display: none;
    z-index: 5;
    min-width: 250px;
}

.game-stats-widget.active {
    display: block;
}

.game-stats-widget h4 {
    color: #00ff00;
    font-size: 10px;
    text-align: center;
    margin-bottom: 10px;
    border-bottom: 3px solid #00ff00;
    padding-bottom: 8px;
    text-shadow: 0 0 10px #00ff00;
}

.game-stats-widget .score-entry {
    font-size: 8px;
    padding: 5px 0;
}

/* Power-Up Counter Widget */
.powerup-counter {
    position: fixed;
    top: 75px;
    left: 20px;
    background: #000;
    padding: 15px 20px;
    border: 4px solid #ff00ff;
    box-shadow: 
        0 0 15px #ff00ff,
        inset 0 0 8px rgba(255, 0, 255, 0.2);
    display: none;
    z-index: 5;
    min-width: 200px;
}

.powerup-counter.active {
    display: block;
}

.powerup-counter h4 {
    color: #ff00ff;
    font-size: 10px;
    text-align: center;
    margin-bottom: 12px;
    border-bottom: 3px solid #ff00ff;
    padding-bottom: 8px;
    text-shadow: 0 0 10px #ff00ff;
}

.powerup-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 2px solid #330033;
    font-size: 9px;
}

.powerup-item:last-child {
    border-bottom: none;
}

.powerup-name {
    color: #0099ff;
    text-shadow: 0 0 5px #0099ff;
}

.powerup-count {
    color: #00ff00;
    font-weight: normal;
    text-shadow: 0 0 5px #00ff00;
}

/* Combo Display */
.combo-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #000;
    padding: 20px 40px;
    border: 6px solid #ffff00;
    box-shadow: 
        0 0 30px #ffff00,
        inset 0 0 15px rgba(255, 255, 0, 0.3);
    display: none;
    z-index: 100;
    animation: comboPopup 0.3s ease-out;
}

.combo-display.active {
    display: block;
}

.combo-display .combo-text {
    color: #ffff00;
    font-size: 32px;
    text-shadow: 
        4px 4px 0px #666600,
        0 0 30px #ffff00;
    text-align: center;
    animation: pulse 0.5s infinite;
}

@keyframes comboPopup {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Pause Screen */
.result-box.pause {
    border-color: #0099ff;
    box-shadow: 
        0 0 30px #0099ff,
        inset 0 0 20px rgba(0, 153, 255, 0.2);
}

.result-box.pause h2 {
    color: #0099ff;
    text-shadow: 
        4px 4px 0px #003366,
        0 0 20px #0099ff;
}

.pause-menu {
    margin-top: 30px; 
}

.menu-item {
    color: #00ff00;
    font-size: 12px;
    margin: 15px 0;
    text-shadow: 0 0 10px #00ff00;
    animation: blink 1s infinite;
}

.menu-item.secondary {
    color: #ff00ff;
    font-size: 10px;
    margin-top: 25px;
    text-shadow: 0 0 10px #ff00ff;
    animation: pulse 2s infinite;
}
