* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background: #000000;
    font-family: 'Courier New', monospace;
    color: #00ff41;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    position: relative;
}

@keyframes glitch {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-2px); }
    40% { transform: translateX(2px); }
    60% { transform: translateX(-1px); }
    80% { transform: translateX(1px); }
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 255, 65, 0.02) 2px,
        rgba(0, 255, 65, 0.02) 4px
    );
    pointer-events: none;
    z-index: 1;
}

/* HUD System */
#hud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.hud-top {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.hud-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.hud-bottom {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
}

/* Game Title */
#gameTitle {
    font-size: 32px;
    color: #00ff41;
    text-shadow: 0 0 15px #00ff41;
    letter-spacing: 3px;
    font-weight: bold;
    opacity: 0.9;
}

@keyframes titleGlow {
    from { 
        text-shadow: 0 0 10px #00ff41, 0 0 20px #00ff41, 0 0 30px #00ff41;
        filter: brightness(1);
    }
    to { 
        text-shadow: 0 0 15px #00ff41, 0 0 25px #00ff41, 0 0 35px #00ff41;
        filter: brightness(1.2);
    }
}

/* Stat Cards */
.stat-card {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(0, 255, 65, 0.6);
    border-radius: 4px;
    padding: 12px 24px;
    min-width: 120px;
    text-align: center;
    backdrop-filter: blur(5px);
    transition: all 0.2s ease;
}

.stat-card:hover {
    border-color: #00ff41;
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.3);
}

.stat-label {
    font-size: 12px;
    color: #00ff41;
    opacity: 0.7;
    margin-bottom: 6px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.stat-value {
    font-size: 36px !important;
    color: #00ff41;
    font-weight: bold;
    text-shadow: 0 0 8px #00ff41;
    font-family: 'Courier New', monospace !important;
    letter-spacing: 1px;
    line-height: 1;
}

@keyframes statPulse {
    from { transform: scale(1); }
    to { transform: scale(1.05); }
}

/* Boost Indicator */
#boostIndicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    opacity: 0;
    transition: all 0.3s ease;
    margin-top: 10px;
}

#boostIndicator.active {
    opacity: 1;
    transform: translateY(0);
    animation: glitch 0.5s infinite;
}

.boost-bar {
    width: 150px;
    height: 8px;
    background: rgba(0, 255, 65, 0.2);
    border: 1px solid rgba(0, 255, 65, 0.5);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.boost-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ff41, #00cc33);
    width: 100%;
    animation: boostPulse 0.5s ease-in-out infinite alternate;
    box-shadow: 0 0 8px #00ff41;
}

.boost-text {
    font-size: 12px;
    color: #00ff41;
    font-weight: bold;
    text-shadow: 0 0 8px #00ff41;
    letter-spacing: 1px;
    animation: boostTextGlow 0.3s ease-in-out infinite alternate;
}

@keyframes boostPulse {
    from { opacity: 0.8; }
    to { opacity: 1; }
}

@keyframes boostTextGlow {
    from { text-shadow: 0 0 10px #ff0040; }
    to { text-shadow: 0 0 15px #ff0040, 0 0 25px #ff0040; }
}

/* Controls */
.controls-hint {
    display: flex;
    gap: 30px;
    align-items: center;
    background: rgba(0, 0, 0, 0.7);
    padding: 15px 30px;
    border-radius: 25px;
    border: 1px solid rgba(0, 255, 65, 0.4);
    backdrop-filter: blur(5px);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

kbd {
    background: rgba(0, 255, 65, 0.1);
    color: #00ff41;
    padding: 10px 16px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: bold;
    border: 1px solid rgba(0, 255, 65, 0.6);
    min-width: 40px;
    text-align: center;
    box-shadow: 0 0 5px rgba(0, 255, 65, 0.3);
}

.control-group span {
    font-size: 14px;
    color: #00ff41;
    opacity: 0.8;
    letter-spacing: 0.5px;
}

/* Game Canvas */
#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
}

#gameCanvas canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* Game Over Modal */
#gameOver {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#gameOver.show {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
}

.modal-content {
    position: relative;
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid #ff0040;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    max-width: 350px;
    box-shadow: 0 0 30px rgba(255, 0, 64, 0.3);
    backdrop-filter: blur(10px);
    animation: modalSlideIn 0.4s ease-out;
}

/* Victory Modal Styles */
.modal-content.victory {
    background: linear-gradient(135deg, rgba(0, 20, 0, 0.95), rgba(0, 40, 0, 0.95));
    border: 3px solid #00ff41;
    box-shadow: 
        0 0 50px rgba(0, 255, 65, 0.6),
        inset 0 0 30px rgba(0, 255, 65, 0.2);
    animation: victoryPulse 0.5s ease-out, modalSlideIn 0.5s ease-out;
}

@keyframes victoryPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.modal-title.victory {
    color: #00ff41;
    text-shadow: 0 0 20px #00ff41, 0 0 40px #00ff41;
    animation: victoryGlow 1s ease-in-out infinite alternate;
}

@keyframes victoryGlow {
    from { 
        text-shadow: 0 0 20px #00ff41, 0 0 40px #00ff41;
        filter: brightness(1);
    }
    to { 
        text-shadow: 0 0 25px #00ff41, 0 0 50px #00ff41, 0 0 75px #00ff41;
        filter: brightness(1.3);
    }
}

.modal-icon.victory {
    animation: victoryBounce 0.8s ease-in-out infinite;
}

@keyframes victoryBounce {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(-5deg); }
    75% { transform: scale(1.1) rotate(5deg); }
}

@keyframes modalSlideIn {
    from { 
        transform: scale(0.8) translateY(-50px);
        opacity: 0;
    }
    to { 
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-icon {
    font-size: 48px;
    margin-bottom: 20px;
    animation: iconPulse 1s ease-in-out infinite alternate;
}

@keyframes iconPulse {
    from { transform: scale(1); }
    to { transform: scale(1.1); }
}

.modal-title {
    font-size: 20px;
    color: #ff0040;
    text-shadow: 0 0 10px #ff0040;
    margin-bottom: 20px;
    letter-spacing: 2px;
    font-weight: bold;
    line-height: 1.2;
}

.modal-stats {
    margin-bottom: 30px;
}

.final-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.5);
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid #00ff41;
}

.final-stat .stat-label {
    color: #00ff41;
    font-size: 12px;
    opacity: 0.9;
}

.final-stat .stat-value {
    color: #00ff41;
    font-size: 28px;
    font-weight: bold;
    text-shadow: 0 0 10px #00ff41;
}

/* Primary Button */
.btn-primary {
    background: rgba(0, 255, 65, 0.1);
    border: 2px solid #00ff41;
    color: #00ff41;
    padding: 16px 32px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.2);
}

.btn-primary:hover {
    background: rgba(0, 255, 65, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.4);
    border-color: #00ff41;
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 0 8px rgba(0, 255, 65, 0.3);
}

.btn-icon {
    font-size: 16px;
}

.btn-text {
    letter-spacing: 2px;
}

/* Start Screen */
#startScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(10px);
}

#startScreen.hidden {
    display: none;
}

.start-content {
    text-align: center;
    animation: startPulse 2s ease-in-out infinite alternate;
}

.start-game-title {
    font-size: 48px;
    color: #00ff41;
    text-shadow: 
        0 0 20px #00ff41,
        0 0 40px #00ff41;
    margin-bottom: 30px;
    letter-spacing: 4px;
    font-weight: bold;
    animation: titleGlow 2s ease-in-out infinite alternate;
    line-height: 1.1;
}

.start-title {
    font-size: 36px;
    color: #00ff41;
    text-shadow: 
        0 0 20px #00ff41,
        0 0 40px #00ff41,
        0 0 60px #00ff41;
    margin-bottom: 30px;
    letter-spacing: 4px;
    font-weight: bold;
}

.start-subtitle {
    font-size: 14px;
    color: #00ff41;
    opacity: 0.7;
    letter-spacing: 1px;
    animation: startBlink 1.5s ease-in-out infinite;
    margin-top: 10px;
}

@keyframes startPulse {
    from { transform: scale(1); }
    to { transform: scale(1.02); }
}

@keyframes startBlink {
    0%, 50% { opacity: 0.8; }
    51%, 100% { opacity: 0.4; }
}

/* Progress Bar */
.progress-container {
    margin: 15px 0;
    text-align: center;
}

.progress-label {
    font-size: 14px;
    color: #00ff41;
    opacity: 0.8;
    margin-bottom: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.progress-bar {
    width: 300px;
    height: 10px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(0, 255, 65, 0.4);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
    margin: 0 auto;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ff41, #00cc33);
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 8px rgba(0, 255, 65, 0.5);
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    color: #00ff41;
    font-weight: bold;
    text-shadow: 0 0 5px #000;
    pointer-events: none;
}