:root {
    --neon-blue: #00f3ff;
    --neon-pink: #ff00ff;
    --neon-purple: #bc13fe;
    --neon-green: #39ff14;
    --neon-red: #ff073a;
}

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

body {
    margin: 0;
    padding: 0;
    background: #000;
    color: white;
    font-family: 'Courier New', Courier, monospace;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    position: fixed;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

#gameWrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

canvas {
    display: block;
    background: #000;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    outline: none;
    width: 100%;
    height: 100%;
}

/* HUD Elements */
#hud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    pointer-events: none;
}

.hud-score {
    font-size: clamp(18px, 4vw, 28px);
    font-weight: bold;
    color: white;
    text-shadow: 0 0 10px var(--neon-blue);
    background: rgba(0, 0, 0, 0.5);
    padding: clamp(5px, 1.5vw, 12px) clamp(10px, 2vw, 20px);
    border-radius: 10px;
}

.hud-best {
    font-size: clamp(14px, 3vw, 22px);
    color: var(--neon-green);
    text-shadow: 0 0 5px var(--neon-green);
}

#backButton {
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.7);
    color: var(--neon-purple);
    border: 2px solid var(--neon-purple);
    padding: clamp(6px, 1.5vw, 10px) clamp(12px, 2vw, 20px);
    font-size: clamp(14px, 3vw, 18px);
    cursor: pointer;
    border-radius: 8px;
    font-weight: bold;
    transition: 0.3s;
}

#backButton:hover {
    background: var(--neon-purple);
    color: black;
    box-shadow: 0 0 15px var(--neon-purple);
}

/* Home Screen */
#homeScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 5, 5, 0.95);
    z-index: 200;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.header {
    position: absolute;
    top: 20px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

#settingsButton {
    background: transparent;
    color: var(--neon-blue);
    border: 2px solid var(--neon-blue);
    width: clamp(35px, 8vw, 50px);
    height: clamp(35px, 8vw, 50px);
    border-radius: 50%;
    font-size: clamp(16px, 4vw, 24px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

#settingsButton:hover {
    background: var(--neon-blue);
    color: black;
    box-shadow: 0 0 15px var(--neon-blue);
}

.best-score-display {
    font-size: clamp(18px, 4vw, 28px);
    color: var(--neon-green);
    text-shadow: 0 0 10px var(--neon-green);
    font-weight: bold;
}

.home-content {
    max-width: 500px;
    width: 90%;
    text-align: center;
}

h1 {
    color: var(--neon-purple);
    font-size: clamp(2rem, 8vw, 4rem);
    margin-bottom: 10px;
    text-shadow: 0 0 20px var(--neon-purple);
}

.game-title {
    font-size: clamp(1.5rem, 6vw, 3rem);
    color: var(--neon-blue);
    margin-bottom: 30px;
    text-shadow: 0 0 15px var(--neon-blue);
}

.character-preview {
    display: flex;
    justify-content: space-around;
    margin: 30px 0;
}

.preview-character {
    width: clamp(60px, 15vw, 100px);
    height: clamp(60px, 15vw, 100px);
    position: relative;
}

.menu-button {
    background: transparent;
    color: var(--neon-green);
    border: 2px solid var(--neon-green);
    padding: clamp(10px, 2.5vw, 20px) clamp(20px, 5vw, 40px);
    font-size: clamp(16px, 4vw, 24px);
    cursor: pointer;
    margin: 10px;
    border-radius: 10px;
    font-weight: bold;
    transition: 0.3s;
    width: 80%;
    max-width: 300px;
}

.menu-button:hover {
    background: var(--neon-green);
    color: black;
    box-shadow: 0 0 20px var(--neon-green);
}

/* How to Play Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 300;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: rgba(20, 20, 20, 0.95);
    border: 3px solid var(--neon-purple);
    border-radius: 15px;
    padding: clamp(20px, 5vw, 40px);
    max-width: 500px;
    width: 90%;
    box-shadow: 0 0 30px var(--neon-purple);
}

.modal-title {
    color: var(--neon-blue);
    font-size: clamp(20px, 5vw, 32px);
    margin-bottom: 20px;
    text-align: center;
}

.instructions {
    color: white;
    font-size: clamp(14px, 3vw, 18px);
    line-height: 1.6;
    margin-bottom: 25px;
}

.instruction-item {
    margin: 15px 0;
    padding-left: 10px;
    border-left: 3px solid var(--neon-green);
}

.close-button {
    background: transparent;
    color: var(--neon-red);
    border: 2px solid var(--neon-red);
    padding: clamp(8px, 2vw, 12px) clamp(15px, 3vw, 25px);
    font-size: clamp(14px, 3vw, 20px);
    cursor: pointer;
    border-radius: 8px;
    font-weight: bold;
    transition: 0.3s;
    display: block;
    margin: 20px auto 0;
}

.close-button:hover {
    background: var(--neon-red);
    color: black;
    box-shadow: 0 0 15px var(--neon-red);
}

/* Settings Modal */
.settings-content {
    background: rgba(20, 20, 20, 0.95);
    border: 3px solid var(--neon-blue);
    border-radius: 15px;
    padding: clamp(20px, 5vw, 40px);
    max-width: 400px;
    width: 90%;
    box-shadow: 0 0 30px var(--neon-blue);
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.toggle-switch {
    position: relative;
    width: clamp(50px, 12vw, 70px);
    height: clamp(25px, 6vw, 35px);
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333;
    transition: .4s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: clamp(18px, 4.5vw, 25px);
    width: clamp(18px, 4.5vw, 25px);
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--neon-green);
}

input:checked + .toggle-slider:before {
    transform: translateX(clamp(25px, 6vw, 35px));
}

/* Game Over Screen */
#gameOver {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 200;
    padding: 20px;
}

.game-over-content {
    background: rgba(20, 20, 20, 0.95);
    border: 3px solid var(--neon-red);
    border-radius: 15px;
    padding: clamp(25px, 6vw, 50px);
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 40px var(--neon-red);
}

.game-over-title {
    color: var(--neon-red);
    font-size: clamp(2rem, 8vw, 4rem);
    margin-bottom: 20px;
    text-shadow: 0 0 20px var(--neon-red);
}

.score-display {
    font-size: clamp(20px, 5vw, 32px);
    color: white;
    margin: 15px 0;
}

.best-display {
    font-size: clamp(18px, 4vw, 28px);
    color: var(--neon-green);
    margin-bottom: 30px;
    text-shadow: 0 0 10px var(--neon-green);
}

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

@media (orientation: landscape) and (max-height: 500px) {
    .home-content {
        flex-direction: row;
        align-items: center;
        gap: 30px;
    }
    
    .character-preview {
        flex-direction: column;
        margin: 0 20px;
    }
    
    .menu-button {
        margin: 5px;
        padding: 8px 16px;
        font-size: 14px;
    }
}
