@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    overflow: hidden;
    font-family: 'Press Start 2P', cursive;
    line-height: 1.5;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

#score, #fps, #level-display {
    position: absolute;
    color: white;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    font-family: 'Press Start 2P', cursive;
}

#score.visible, #fps.visible, #level-display.visible {
    display: block;
}

#score {
    top: 20px;
    right: 20px;
    font-size: 20px;
    transition: transform 0.1s ease-out;
}

#fps {
    top: 20px;
    left: 20px;
    font-size: 20px;
}

#level-display {
    top: 50px;
    right: 20px;
    color: #ffd700;
    font-size: 14px;
    opacity: 0;
    animation: fade-in 0.5s ease-out forwards;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

#game-over {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.9);
    padding: 1.5em;
    border-radius: 15px;
    text-align: center;
    color: white;
    min-width: 280px;
    font-family: 'Press Start 2P', cursive;
}

#game-over h2 {
    color: #ff6b6b;
    text-shadow: 3px 3px 0px #4a4a4a;
    font-size: 1.5em;
    margin-bottom: 0.5em;
}

#game-over p {
    margin: 8px 0;
    font-size: 1.2em;
}

.score-submit {
    margin: 15px 0;
}

#player-name {
    width: 100%;
    padding: 8px 12px;
    margin: 8px 0;
    border: 2px solid #4CAF50;
    border-radius: 6px;
    font-size: 0.8em;
    font-family: 'Press Start 2P', cursive;
    box-sizing: border-box;
}

#submit-score-btn {
    background-color: #4CAF50;
    color: white;
    width: 100%;
    margin: 8px 0;
    padding: 8px 15px;
    font-size: 0.8em;
    border-radius: 6px;
}

#submit-score-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2);
}

#submit-score-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#leaderboard {
    margin: 15px 0;
    max-height: 250px;
    overflow-y: auto;
}

#leaderboard h3 {
    margin: 0 0 12px 0;
    color: #ffd700;
    font-size: 1em;
}

#leaderboard-entries {
    text-align: left;
}

#leaderboard-entries .leaderboard-entry {
    display: flex;
    justify-content: space-between;
    padding: 8px;
    margin: 4px 0;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    font-size: 0.9em;
}

#leaderboard-entries .leaderboard-entry .name {
    color: white;
    font-weight: bold;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#leaderboard-entries .leaderboard-entry .rank {
    color: #ffd700;
    font-weight: bold;
    min-width: 40px;
}

#leaderboard-entries .leaderboard-entry .score {
    color: #88ff88;
    font-weight: bold;
}

.leaderboard-entry.current-player {
    background-color: rgba(76, 175, 80, 0.3);
    border: 2px solid #4CAF50;
}

.rank {
    color: #ffd700;
    min-width: 50px;
}

.name {
    flex-grow: 1;
    text-align: left;
    margin: 0 10px;
}

.score {
    color: #4CAF50;
    min-width: 80px;
    text-align: right;
}

#restart-button {
    background-color: #4CAF50;
    color: white;
}

.hidden {
    display: none !important;
}

@keyframes pulse {
    0% { transform: translate(-50%, 0) scale(1); }
    50% { transform: translate(-50%, 0) scale(1.1); }
    100% { transform: translate(-50%, 0) scale(1); }
}

#powerup-status {
    position: absolute;
    top: 35%;
    left: 50%;
    transform: translate(-50%, 0);
    color: white;
    padding: 10px;
    text-align: center;
    font-size: 24px;
    line-height: 1.5;
    z-index: 10;
    pointer-events: none;
    font-family: 'Press Start 2P', monospace;
    min-width: 200px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9);
    opacity: 0;
    transition: opacity 0.3s ease;
}

#powerup-status.hidden {
    display: none;
}

#powerup-status.pulse {
    animation: pulse 0.5s infinite;
}

.menu-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 1000;
}

.menu-screen h1 {
    font-size: 3em;
    color: #ffffff;
    text-shadow: 4px 4px 0px #ff6b6b;
    margin-bottom: 1em;
    font-family: 'Press Start 2P', cursive;
    text-transform: uppercase;
    text-align: center;
}

.menu-screen h2 {
    font-size: 2em;
    color: #ffffff;
    text-shadow: 3px 3px 0px #4a90e2;
    margin-bottom: 1em;
    font-family: 'Press Start 2P', cursive;
}

.button-container {
    display: flex;
    flex-direction: column;
    gap: 0.8em;
    width: 300px;
    margin: 0.8em auto;
}

.game-over .button-container {
    width: 100%;
}

#game-over .button-container,
#game-over button,
#game-over .score-submit {
    width: 100%;
}

.menu-buttons,
.game-over-buttons,
.score-submit {
    width: 100%;
}

button {
    width: 100%;
    padding: 8px 15px;
    font-size: 0.8em;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Press Start 2P', cursive;
    text-transform: uppercase;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
    margin: 0;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2);
}

button:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

#start-game {
    background-color: #4CAF50;
    color: white;
}

#help {
    background-color: #2196F3;
    color: white;
}

#high-scores {
    background-color: #2196F3;
    color: white;
}

#options {
    background-color: #2196F3;
    color: white;
}

.secondary-button {
    background-color: #607D8B;
    color: white;
}

.game-over-buttons {
    display: flex;
    flex-direction: column;
    gap: 1em;
    margin-top: 1em;
    min-width: 200px;
}

.qualify-message {
    color: #FFD700;
    font-size: 1.2em;
    font-weight: bold;
    text-align: center;
    margin: 10px auto;
    width: 100%;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    animation: qualify-pulse 1s infinite;
}

@keyframes qualify-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.difficulty-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    left: auto;
    transform: none;
    background-color: rgba(255, 69, 0, 0.95);
    color: white;
    padding: 0.8em 1.2em;
    border-radius: 10px;
    font-family: 'Press Start 2P', cursive;
    text-align: center;
    z-index: 1000;
    animation: notification-slide-right 1.5s ease-in-out forwards;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    border: 3px solid #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 0.3em;
    max-width: 250px;
}

.difficulty-title {
    font-size: 1.2em;
    color: #ffd700;
    animation: pulse-text 0.5s infinite alternate;
}

.difficulty-stats {
    font-size: 0.8em;
    display: flex;
    flex-direction: column;
    gap: 0.3em;
}

.speed-increase {
    color: #ff4500;
    font-size: 1em;
    text-shadow: 0 0 10px rgba(255, 69, 0, 0.8);
    animation: pulse-text 0.5s infinite alternate;
}

@keyframes pulse-text {
    from {
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    }
    to {
        text-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
    }
}

@keyframes notification-slide-right {
    0% {
        opacity: 0;
        transform: translateX(100%);
    }
    15% {
        opacity: 1;
        transform: translateX(-10%);
    }
    25% {
        transform: translateX(0);
    }
    85% {
        opacity: 1;
        transform: translateX(0);
    }
    100% {
        opacity: 0;
        transform: translateX(100%);
    }
}

.floating-score {
    position: fixed;
    color: #FFD700;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    user-select: none;
    z-index: 1000;
    opacity: 0;
    transform: translateY(0);
    animation: floatUp 0.8s ease-out forwards;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    50% {
        opacity: 1;
        transform: translateY(-30px) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(1);
    }
}

.option-button {
    background-color: #4a4a4a;
    color: #ffffff;
    border: 2px solid #666666;
    padding: 10px 20px;
    margin: 5px;
    cursor: pointer;
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    transition: all 0.3s ease;
    width: 100%;
    text-align: center;
}

.option-button:hover {
    background-color: #666666;
    border-color: #888888;
}

.option-button:active {
    transform: scale(0.98);
}

#sound-state {
    color: #00ff00;
}

/* When sound is off */
.sound-off #sound-state {
    color: #ff0000;
}

/* When logging is off */
.logging-off #logging-state {
    color: #ff0000;
}

#logging-state {
    color: #00ff00;
}

/* Media query for landscape orientation on mobile devices */
@media (max-height: 600px) and (orientation: landscape) {
    #game-over {
        max-height: 90vh;
        overflow-y: auto;
        padding: 1em;
        display: flex;
        flex-direction: column;
    }

    #game-over h2 {
        font-size: 1.2em;
        margin-bottom: 0.3em;
    }

    #game-over p {
        font-size: 1em;
        margin: 4px 0;
    }

    #leaderboard {
        max-height: 120px;
        margin: 8px 0;
    }

    .leaderboard-entry {
        padding: 4px;
        margin: 2px 0;
        font-size: 0.6em;
    }

    #player-name {
        padding: 4px 8px;
        margin: 4px 0;
        font-size: 0.7em;
    }

    #submit-score-btn {
        padding: 4px 10px;
        margin: 4px 0;
        font-size: 0.7em;
    }

    .score-submit {
        margin: 8px 0;
    }

    .button-container {
        margin-top: 8px;
    }

    button {
        padding: 6px 12px;
        font-size: 0.7em;
    }
}

/* Mobile adjustments for powerup status */
@media (max-width: 768px) {
    #powerup-status {
        font-size: 16px;
        padding: 6px;
        min-width: 140px;
        top: 25%;
    }
}

@media (max-width: 480px) {
    #powerup-status {
        font-size: 14px;
        padding: 4px;
        min-width: 110px;
        top: 20%;
    }
}

/* Mobile adjustments for level up notification */
@media (max-width: 768px) {
    .difficulty-notification {
        top: 60px;
        right: 10px;
        padding: 0.6em 0.8em;
        max-width: 200px;
    }
    
    .difficulty-title {
        font-size: 1em;
    }
    
    .difficulty-stats {
        font-size: 0.7em;
    }
    
    .speed-increase {
        font-size: 0.9em;
    }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) {
    #powerup-status {
        top: 15%;
        left: 50%;
        transform: translate(-50%, 0);
    }
    
    @keyframes pulse {
        0% { transform: translate(-50%, 0) scale(1); }
        50% { transform: translate(-50%, 0) scale(1.1); }
        100% { transform: translate(-50%, 0) scale(1); }
    }
}

/* Specific adjustments for small height landscape (like mobile phones) */
@media (max-height: 500px) and (orientation: landscape) {
    #powerup-status {
        top: 30px;
        font-size: 14px;
        padding: 4px;
        min-width: 110px;
    }
}

/* Mobile portrait adjustments for menu screen */
@media (max-width: 768px) and (orientation: portrait) {
    .menu-screen h1 {
        font-size: 2em;
        text-align: center;
        padding: 0 20px;
        margin-bottom: 0.8em;
    }
    
    .menu-screen {
        padding: 0 15px;
    }
    
    .button-container {
        width: 90%;
        max-width: 300px;
    }
}

@media (max-width: 480px) and (orientation: portrait) {
    .menu-screen h1 {
        font-size: 1.5em;
        padding: 0 10px;
        margin-bottom: 0.6em;
    }
}

#high-scores-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    padding: 20px;
}

#high-scores-menu h2 {
    color: #ffd700;
    margin-bottom: 20px;
}

#high-scores-list {
    width: 100%;
    max-width: 600px;
    max-height: 60vh;
    overflow-y: auto;
    margin-bottom: 20px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    padding: 15px;
}

#high-scores-list .leaderboard-entry {
    display: flex;
    justify-content: space-between;
    padding: 8px;
    margin: 4px 0;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    font-size: 0.9em;
}

#high-scores-list .leaderboard-entry .name {
    color: white;
    font-weight: bold;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#high-scores-list .leaderboard-entry .rank {
    color: #ffd700;
    font-weight: bold;
    min-width: 40px;
}

#high-scores-list .leaderboard-entry .score {
    color: #88ff88;
    font-weight: bold;
}

/* Style for the high scores button */
#high-scores:hover {
    background-color: #2980b9;
}

/* Mobile adjustments for high scores */
@media (max-width: 768px) {
    #high-scores-list {
        max-height: 50vh;
    }
    
    #high-scores-list .leaderboard-entry {
        font-size: 0.8em;
    }
}

@media (max-height: 600px) and (orientation: landscape) {
    #high-scores-menu h2 {
        font-size: 1.2em;
        margin-bottom: 10px;
    }
    
    #high-scores-list {
        max-height: 45vh;
    }
}

@media (max-width: 768px) {
    .qualify-message {
        font-size: 1em;
        margin: 8px auto;
    }
}

/* Style for the help button to match options button */
#help:hover {
    background-color: #2980b9;
}

/* Help menu content styles */
#help-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    padding: 20px;
}

#help-menu h2 {
    color: #ffffff;
    margin-bottom: 20px;
    text-align: center;
}

.help-content {
    width: 100%;
    max-width: 600px;
    max-height: 60vh;
    overflow-y: auto;
    margin-bottom: 20px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    padding: 20px;
    color: white;
    text-align: center;
}

.help-section {
    margin-bottom: 25px;
    text-align: center;
}

.help-section h3 {
    color: #ffd700;
    margin-bottom: 15px;
    font-size: 1.2em;
    text-align: center;
}

.help-section p {
    margin: 10px 0;
    font-size: 1em;
    line-height: 1.5;
    text-align: center;
}

/* Mobile adjustments for help menu */
@media (max-width: 768px) {
    .help-content {
        max-height: 50vh;
        font-size: 0.9em;
    }
    
    .help-section h3 {
        font-size: 1.1em;
    }
    
    .help-section p {
        font-size: 0.8em;
    }
}

@media (max-height: 600px) and (orientation: landscape) {
    .help-content {
        max-height: 45vh;
    }
    
    .help-section {
        margin-bottom: 10px;
    }
} 