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

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(180deg, #0a0e27 0%, #1a1f3a 100%);
    color: #fff;
    overflow: hidden;
    height: 100vh;
}

.game-container {
    width: 100%;
    height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hud {
    position: absolute;
    top: 20px;
    width: 100%;
    display: flex;
    justify-content: space-around;
    padding: 0 40px;
    z-index: 10;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(77, 254, 210, 0.8);
}

.score, .combo, .lives, .streak {
    color: #4dfed2;
}

/* V3: Streak display */
.streak {
    color: #FFD700;
    font-size: 20px;
    animation: pulse-glow 1s infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
    }
    50% {
        text-shadow: 0 0 20px rgba(255, 215, 0, 1), 0 0 30px rgba(255, 215, 0, 0.5);
    }
}

#gameCanvas {
    display: block;
    background: rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(77, 254, 210, 0.3);
}

.input-display {
    position: absolute;
    bottom: 60px;
    font-size: 48px;
    font-weight: bold;
    color: #4dfed2;
    text-shadow: 0 0 20px rgba(77, 254, 210, 0.8);
    min-height: 60px;
    padding: 10px 20px;
    background: rgba(10, 14, 39, 0.8);
    border: 2px solid #4dfed2;
    border-radius: 10px;
    min-width: 200px;
    text-align: center;
}

.cursor {
    animation: blink 1s infinite;
    color: #4dfed2;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.game-over, .start-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(10, 14, 39, 0.95);
    padding: 60px;
    border-radius: 20px;
    text-align: center;
    border: 3px solid #4dfed2;
    box-shadow: 0 0 40px rgba(77, 254, 210, 0.5);
    z-index: 100;
    max-height: 90vh;
    overflow-y: auto;
}

.game-over h1, .start-screen h1 {
    font-size: 64px;
    color: #4dfed2;
    text-shadow: 0 0 20px rgba(77, 254, 210, 0.8);
    margin-bottom: 20px;
}

.game-over p, .start-screen p {
    font-size: 24px;
    margin: 15px 0;
}

.start-screen .controls {
    font-size: 18px;
    color: #8fadcc;
    margin: 10px 0;
}

.game-over button, .start-screen button {
    margin-top: 30px;
    padding: 15px 40px;
    font-size: 24px;
    font-family: 'Courier New', monospace;
    background: #4dfed2;
    color: #0a0e27;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    box-shadow: 0 0 20px rgba(77, 254, 210, 0.5);
}

.game-over button:hover, .start-screen button:hover {
    background: #6dffea;
    box-shadow: 0 0 30px rgba(77, 254, 210, 0.8);
    transform: scale(1.05);
}

.secondary-btn {
    background: rgba(77, 254, 210, 0.2) !important;
    color: #4dfed2 !important;
    border: 2px solid #4dfed2 !important;
}

.secondary-btn:hover {
    background: rgba(77, 254, 210, 0.4) !important;
}

.leaderboard-view {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(10, 14, 39, 0.95);
    padding: 60px;
    border-radius: 20px;
    text-align: center;
    border: 3px solid #4dfed2;
    box-shadow: 0 0 40px rgba(77, 254, 210, 0.5);
    z-index: 100;
    max-height: 90vh;
    overflow-y: auto;
    min-width: 600px;
}

.leaderboard-view h1 {
    font-size: 48px;
    color: #4dfed2;
    text-shadow: 0 0 20px rgba(77, 254, 210, 0.8);
    margin-bottom: 30px;
}

.leaderboard-view button {
    margin-top: 30px;
    padding: 15px 40px;
    font-size: 24px;
    font-family: 'Courier New', monospace;
    background: #4dfed2;
    color: #0a0e27;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    box-shadow: 0 0 20px rgba(77, 254, 210, 0.5);
}

.leaderboard-view button:hover {
    background: #6dffea;
    box-shadow: 0 0 30px rgba(77, 254, 210, 0.8);
    transform: scale(1.05);
}

.hidden {
    display: none !important;
}

#finalScore {
    color: #4dfed2;
    font-size: 36px;
    font-weight: bold;
}

/* Mobile numpad - hidden by default, shown on touch devices */
.numpad {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(10, 14, 39, 0.95);
    padding: 6px;
    z-index: 50;
    border-top: 2px solid rgba(77, 254, 210, 0.5);
}

.numpad-row {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}

.numpad-row:last-child {
    margin-bottom: 0;
}

.numpad-btn {
    flex: 1;
    height: 60px;
    font-size: 28px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    background: rgba(77, 254, 210, 0.2);
    color: #4dfed2;
    border: 2px solid #4dfed2;
    border-radius: 8px;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.1s, transform 0.1s;
}

.numpad-btn:active {
    background: #4dfed2;
    color: #0a0e27;
    transform: scale(0.97);
}

.numpad-enter {
    background: rgba(77, 254, 210, 0.4);
    font-size: 22px;
}

/* Show numpad on touch devices */
@media (pointer: coarse) {
    .numpad {
        display: block;
    }

    .input-display {
        bottom: auto;
        position: relative;
        margin-top: 10px;
        margin-bottom: 10px;
        font-size: 36px;
        min-height: 50px;
        padding: 8px 15px;
    }

    .game-container {
        justify-content: flex-start;
        padding-top: 50px;
    }

    #gameCanvas {
        max-width: 100%;
    }

    .hud {
        font-size: 16px;
        padding: 0 10px;
        top: 8px;
    }

    .start-screen, .game-over {
        padding: 25px;
        width: 90%;
        max-width: 400px;
    }

    .start-screen h1, .game-over h1 {
        font-size: 32px;
    }

    .start-screen p, .game-over p {
        font-size: 15px;
    }

    .start-screen .controls {
        font-size: 13px;
    }

    .start-screen button, .game-over button {
        padding: 12px 30px;
        font-size: 20px;
    }

    .music-toggle {
        top: 8px;
        right: 8px;
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* Music toggle button */
.music-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
    padding: 8px 14px;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    background: rgba(77, 254, 210, 0.2);
    color: #4dfed2;
    border: 2px solid #4dfed2;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.music-toggle:hover {
    background: rgba(77, 254, 210, 0.4);
}

.music-toggle.off {
    background: rgba(255, 77, 77, 0.2);
    color: #fe4d4d;
    border-color: #fe4d4d;
}

.music-toggle.off:hover {
    background: rgba(255, 77, 77, 0.4);
}

/* Leaderboard styles */
.score-submit-form {
    margin: 30px 0;
    padding: 20px;
    background: rgba(77, 254, 210, 0.1);
    border-radius: 10px;
}

.score-submit-form input {
    padding: 10px;
    font-size: 18px;
    font-family: 'Courier New', monospace;
    background: rgba(0, 0, 0, 0.5);
    color: #4dfed2;
    border: 2px solid #4dfed2;
    border-radius: 5px;
    margin: 10px 0;
    width: 250px;
    text-align: center;
}

.score-submit-form input:focus {
    outline: none;
    box-shadow: 0 0 10px rgba(77, 254, 210, 0.5);
}

.score-submit-form button {
    margin-top: 10px;
    padding: 12px 30px;
    font-size: 18px;
    font-family: 'Courier New', monospace;
    background: #4dfed2;
    color: #0a0e27;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.score-submit-form button:hover:not(:disabled) {
    background: #6dffea;
    box-shadow: 0 0 20px rgba(77, 254, 210, 0.8);
}

.score-submit-form button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.submit-message {
    margin-top: 10px;
    font-size: 16px;
    font-weight: bold;
}

.leaderboard-container {
    margin-top: 30px;
}

.leaderboard-container h2 {
    color: #4dfed2;
    margin-bottom: 15px;
    font-size: 28px;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 auto;
    background: rgba(0, 0, 0, 0.3);
}

.leaderboard-table th {
    background: rgba(77, 254, 210, 0.2);
    color: #4dfed2;
    padding: 12px;
    font-size: 16px;
    border-bottom: 2px solid #4dfed2;
}

.leaderboard-table td {
    padding: 10px;
    border-bottom: 1px solid rgba(77, 254, 210, 0.2);
    color: #fff;
}

.leaderboard-table tr:hover {
    background: rgba(77, 254, 210, 0.1);
}

.leaderboard-table tr.highlight {
    background: rgba(77, 254, 210, 0.3);
    font-weight: bold;
}

.leaderboard-list p {
    color: #8fadcc;
    font-size: 16px;
}

@media (pointer: coarse) {
    .game-over, .start-screen {
        padding: 25px;
        width: 90%;
        max-width: 400px;
    }

    .leaderboard-view {
        padding: 25px;
        width: 90%;
        max-width: 400px;
        min-width: unset;
    }

    .leaderboard-view h1 {
        font-size: 32px;
    }

    .leaderboard-table {
        font-size: 14px;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 8px 4px;
    }

    .score-submit-form input {
        width: 200px;
        font-size: 16px;
    }
}

/* V3: Level selector */
.level-selector {
    margin: 20px 0;
    padding: 15px;
    background: rgba(77, 254, 210, 0.1);
    border-radius: 10px;
}

.level-selector label {
    display: block;
    margin-bottom: 10px;
    font-size: 18px;
    color: #4dfed2;
}

.level-selector select {
    padding: 10px 15px;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    background: rgba(0, 0, 0, 0.5);
    color: #4dfed2;
    border: 2px solid #4dfed2;
    border-radius: 5px;
    cursor: pointer;
    min-width: 150px;
}

.level-selector select:focus {
    outline: none;
    box-shadow: 0 0 10px rgba(77, 254, 210, 0.5);
}

/* V3: Screen shake animation */
@keyframes shake {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-5px, -5px); }
    20% { transform: translate(5px, 5px); }
    30% { transform: translate(-5px, 5px); }
    40% { transform: translate(5px, -5px); }
    50% { transform: translate(-5px, -5px); }
    60% { transform: translate(5px, 5px); }
    70% { transform: translate(-5px, 5px); }
    80% { transform: translate(5px, -5px); }
    90% { transform: translate(-5px, 0); }
}

.shake {
    animation: shake 0.2s;
}

/* V3: Help view */
.help-view {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(10, 14, 39, 0.95);
    padding: 40px;
    border-radius: 20px;
    text-align: left;
    border: 3px solid #4dfed2;
    box-shadow: 0 0 40px rgba(77, 254, 210, 0.5);
    z-index: 100;
    max-height: 90vh;
    overflow-y: auto;
    min-width: 500px;
    max-width: 600px;
}

.help-view h1 {
    font-size: 36px;
    color: #4dfed2;
    text-shadow: 0 0 20px rgba(77, 254, 210, 0.8);
    margin-bottom: 20px;
    text-align: center;
}

.help-view h3 {
    color: #4dfed2;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 20px;
}

.help-content {
    color: #fff;
    font-size: 16px;
    line-height: 1.6;
}

.help-content ul {
    list-style: none;
    padding-left: 0;
    margin: 10px 0;
}

.help-content li {
    padding: 8px 0;
    padding-left: 20px;
    position: relative;
}

.help-content li:before {
    content: "▸";
    position: absolute;
    left: 0;
    color: #4dfed2;
}

.help-content strong {
    color: #4dfed2;
}

.help-view button {
    margin-top: 30px;
    padding: 15px 40px;
    font-size: 24px;
    font-family: 'Courier New', monospace;
    background: #4dfed2;
    color: #0a0e27;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    box-shadow: 0 0 20px rgba(77, 254, 210, 0.5);
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.help-view button:hover {
    background: #6dffea;
    box-shadow: 0 0 30px rgba(77, 254, 210, 0.8);
    transform: scale(1.05);
}

@media (pointer: coarse) {
    .help-view {
        padding: 25px;
        width: 90%;
        max-width: 400px;
        min-width: unset;
    }

    .help-view h1 {
        font-size: 28px;
    }

    .help-content {
        font-size: 14px;
    }
}

/* Feedback view */
.feedback-view {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(10, 14, 39, 0.95);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    border: 3px solid #4dfed2;
    box-shadow: 0 0 40px rgba(77, 254, 210, 0.5);
    z-index: 100;
    max-height: 90vh;
    overflow-y: auto;
    min-width: 500px;
    max-width: 600px;
}

.feedback-view h1 {
    font-size: 36px;
    color: #4dfed2;
    text-shadow: 0 0 20px rgba(77, 254, 210, 0.8);
    margin-bottom: 20px;
}

.feedback-content {
    color: #fff;
    font-size: 16px;
    line-height: 1.6;
}

.feedback-content p {
    margin-bottom: 20px;
}

.feedback-view button {
    margin-top: 30px;
    padding: 15px 40px;
    font-size: 24px;
    font-family: 'Courier New', monospace;
    background: #4dfed2;
    color: #0a0e27;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    box-shadow: 0 0 20px rgba(77, 254, 210, 0.5);
}

.feedback-view button:hover {
    background: #6dffea;
    box-shadow: 0 0 30px rgba(77, 254, 210, 0.8);
    transform: scale(1.05);
}

/* Style the embedded form to match our theme */
.feedback-content input,
.feedback-content textarea,
.feedback-content select {
    font-family: 'Courier New', monospace !important;
    background: rgba(0, 0, 0, 0.5) !important;
    color: #4dfed2 !important;
    border: 2px solid #4dfed2 !important;
    border-radius: 5px !important;
    width: 100% !important;
    max-width: 350px !important;
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Make text inputs (name and email) taller */
.feedback-content input[type="text"],
.feedback-content input[type="email"] {
    height: 45px !important;
    padding: 10px !important;
}

/* Textarea styling */
.feedback-content textarea {
    padding: 10px !important;
}

.feedback-content input:focus,
.feedback-content textarea:focus,
.feedback-content select:focus {
    outline: none !important;
    box-shadow: 0 0 10px rgba(77, 254, 210, 0.5) !important;
}

/* Smaller buttons with Send Message centered */
.feedback-content button {
    font-family: 'Courier New', monospace !important;
    padding: 10px 25px !important;
    font-size: 16px !important;
    border-radius: 8px !important;
    font-weight: bold !important;
    transition: all 0.3s !important;
    margin: 5px !important;
}

.feedback-content button[type="submit"] {
    background: #4dfed2 !important;
    color: #0a0e27 !important;
    border: none !important;
    box-shadow: 0 0 20px rgba(77, 254, 210, 0.5) !important;
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.feedback-content button[type="submit"]:hover {
    background: #6dffea !important;
    box-shadow: 0 0 30px rgba(77, 254, 210, 0.8) !important;
}

/* Style the "Powered by Formomatic" text */
.feedback-content a {
    color: #4dfed2 !important;
    text-decoration: none !important;
    transition: all 0.3s !important;
}

.feedback-content a:hover {
    color: #6dffea !important;
    text-shadow: 0 0 10px rgba(77, 254, 210, 0.5) !important;
}

/* Add spacing above powered by text */
.feedback-content > p:last-of-type,
.feedback-content > div:last-child {
    margin-top: 25px !important;
}

@media (pointer: coarse) {
    .feedback-view {
        padding: 25px;
        width: 90%;
        max-width: 400px;
        min-width: unset;
    }

    .feedback-view h1 {
        font-size: 28px;
    }

    .feedback-content {
        font-size: 14px;
    }
}
