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

* {
    box-sizing: border-box;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: #111;
    overflow: hidden;
    font-family: 'VT323', monospace;
    font-size: 20px;
    image-rendering: pixelated;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -webkit-touch-callout: none;
    touch-action: none;
}

#game-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* CRT Scanline Overlay Effect for retro feel */
body::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 99999;
    background-size: 100% 4px, 6px 100%;
    pointer-events: none;
}

/* Welcome Screen */
#welcome-screen {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(rgba(12, 4, 20, 0.65), rgba(12, 4, 20, 0.85)), url('../landscape.jpg');
    background-size: cover;
    background-position: center;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

@media (orientation: portrait) {
    #welcome-screen {
        background: linear-gradient(rgba(12, 4, 20, 0.65), rgba(12, 4, 20, 0.85)), url('../portrait.jpg');
        background-size: cover;
        background-position: center;
    }
}

.pixel-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 32px;
    color: #ff00ff;
    text-shadow: 4px 4px 0 #00ffff, -4px -4px 0 #000;
    margin-bottom: 30px;
    text-align: center;
    animation: titleGlow 1.5s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from {
        text-shadow: 4px 4px 0 #00ffff, 0 0 10px #ff00ff, 0 0 20px #ff00ff;
    }
    to {
        text-shadow: 4px 4px 0 #00ffff, 0 0 15px #00ffff, 0 0 30px #00ffff;
    }
}

.form-group {
    margin-bottom: 25px;
    text-align: center;
    width: 100%;
    max-width: 500px;
}

.form-group label {
    display: block;
    font-size: 24px;
    color: #00ffff;
    margin-bottom: 10px;
    text-shadow: 2px 2px 0 #000;
}

input[type="text"] {
    width: 80%;
    padding: 10px 15px;
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    background-color: #0c0414;
    border: 4px solid #ff00ff;
    color: #ffffff;
    text-align: center;
    outline: none;
    box-shadow: 0 0 10px rgba(255, 0, 255, 0.4);
    margin-top: 5px;
}

input[type="text"]:focus {
    border-color: #00ffff;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.6);
}

.cat-selection, .accessory-selection {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 5px;
    flex-wrap: wrap;
}

.cat-btn, .acc-btn {
    padding: 12px 20px;
    font-family: 'VT323', monospace;
    font-size: 22px;
    font-weight: bold;
    border: 4px solid #444;
    cursor: pointer;
    background-color: #222;
    color: #aaa;
    box-shadow: 0 4px 0 #000;
    transition: all 0.1s ease;
}

/* Alley Cat Option Style */
.cat-btn[data-type="alley"]:hover,
.cat-btn[data-type="alley"].selected {
    background-color: #efefef;
    color: #111;
    border-color: #ffffff;
    box-shadow: 0 0 12px #ffffff;
}

/* Ninja Cat Option Style */
.cat-btn[data-type="ninja"]:hover,
.cat-btn[data-type="ninja"].selected {
    background-color: #660b3d;
    color: #ff0055;
    border-color: #ff0055;
    box-shadow: 0 0 12px #ff0055;
}

/* Chonky Cat Option Style */
.cat-btn[data-type="chonk"]:hover,
.cat-btn[data-type="chonk"].selected {
    background-color: #ff9f1c;
    color: #111;
    border-color: #ffe600;
    box-shadow: 0 0 12px #ffe600;
}

/* Accessories */
.acc-btn:hover, .acc-btn.selected {
    background-color: #00ffff;
    color: #111;
    border-color: #ffffff;
    box-shadow: 0 0 12px #00ffff;
}

/* Toggle Buttons "ON" State */
#voice-chat-btn{
    background: linear-gradient(#444, #222);
    color: #aaa;
    border-color: #444;
    text-shadow: 2px 2px 0 #000;
}
#voice-chat-btn.selected {
    background: linear-gradient(#00ff00, #008800);
    color: #fff;
    border-color: #000;
    text-shadow: 2px 2px 0 #000;
    box-shadow: 0 4px 0 #004400, 0 0 12px rgba(0, 255, 0, 0.6);
}

#join-btn {
    padding: 15px 40px;
    font-family: 'Press Start 2P', cursive;
    font-size: 16px;
    background: linear-gradient(#00ff00, #008800);
    border: 4px solid #000;
    color: #fff;
    cursor: pointer;
    text-shadow: 2px 2px 0 #000;
    box-shadow: 0 6px 0 #004400, 0 10px 15px rgba(0, 0, 0, 0.4);
    transition: all 0.1s ease;
    margin-top: 15px;
}

#join-btn:hover:not(:disabled) {
    background: linear-gradient(#33ff33, #00aa00);
    box-shadow: 0 6px 0 #004400, 0 0 15px rgba(0, 255, 0, 0.6);
}

#join-btn:active:not(:disabled) {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #004400, 0 4px 8px rgba(0, 0, 0, 0.4);
}

#join-btn:disabled {
    background: #444;
    color: #888;
    box-shadow: none;
    cursor: not-allowed;
    border-color: #222;
}

#view-leaderboard-btn {
    padding: 8px 16px;
    font-family: 'VT323', monospace;
    font-size: 20px;
    background-color: transparent;
    color: #888;
    border: 2px solid #444;
    cursor: pointer;
    transition: all 0.2s ease;
}

#view-leaderboard-btn:hover {
    color: #00ffff;
    border-color: #00ffff;
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.5);
}

/* Powerup Screen Overlay */
#powerup-screen {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(12, 4, 20, 0.95);
    color: #00ff00;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#powerup-screen h2 {
    font-family: 'Press Start 2P', cursive;
    font-size: 20px;
    color: #00ffff;
    text-shadow: 3px 3px 0 #000;
    margin-bottom: 30px;
    text-align: center;
}

.powerup-selection {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    width: 95%;
    max-width: 420px;
}

.powerup-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 5px;
    height: 72px;
    font-family: 'Press Start 2P', cursive;
    cursor: pointer;
    background: #222;
    color: #fff;
    border: 3px solid #ff00ff;
    box-shadow: 0 4px 0 #000, 0 0 10px rgba(255, 0, 255, 0.2);
    text-align: center;
    transition: all 0.1s ease;
}

.powerup-icon {
    font-size: 22px;
    margin-bottom: 6px;
}

.powerup-name {
    font-size: 8px;
    text-transform: uppercase;
    font-weight: bold;
}

.powerup-btn:hover {
    background: #ff00ff;
    color: #000;
    box-shadow: 0 4px 0 #000, 0 0 20px #ff00ff;
}

.powerup-btn:active {
    transform: translateY(4px);
    box-shadow: 0 0px 0 #000;
}

/* Volume Sliders */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    max-width: 150px;
    background: transparent;
    margin-top: 10px;
}

input[type="range"]:focus {
    outline: none;
}

input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    cursor: pointer;
    background: #444;
    border: 2px solid #ff00ff;
    border-radius: 4px;
}

input[type="range"]::-webkit-slider-thumb {
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: #00ffff;
    cursor: pointer;
    -webkit-appearance: none;
    margin-top: -7px;
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.8);
}

input[type="range"]:focus::-webkit-slider-runnable-track {
    background: #666;
}

input[type="range"]::-moz-range-track {
    width: 100%;
    height: 8px;
    cursor: pointer;
    background: #444;
    border: 2px solid #ff00ff;
    border-radius: 4px;
}

input[type="range"]::-moz-range-thumb {
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: #00ffff;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.8);
}

/* Scoreboard Overlay */
#scoreboard-screen {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at center, #1b0c36 0%, #05010a 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1010;
}

#scoreboard-screen h2 {
    font-family: 'Press Start 2P', cursive;
    font-size: 22px;
    color: #ffe600;
    text-shadow: 3px 3px 0 #000;
    margin-bottom: 25px;
    text-align: center;
}

#scoreboard-list {
    list-style: none;
    padding: 20px;
    background: rgba(0, 0, 0, 0.4);
    border: 4px solid #00ffff;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
    min-width: 320px;
    font-size: 26px;
    color: #00ff00;
}

#scoreboard-list li {
    margin-bottom: 10px;
    text-shadow: 2px 2px 0 #000;
}

/* Options Screen Overlay */
#options-screen {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at center, #1a0826 0%, #07010f 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1030;
}

#options-screen h2 {
    font-family: 'Press Start 2P', cursive;
    font-size: 22px;
    color: #00ffff;
    text-shadow: 3px 3px 0 #000;
    margin-bottom: 25px;
    text-align: center;
}

#close-options-btn:active {
    transform: translateY(4px);
    box-shadow: none;
}

#ingame-options-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 90;
    font-size: 28px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: none;
    transition: transform 0.2s ease;
}

#ingame-options-btn:hover {
    transform: scale(1.1) rotate(15deg);
}

/* All-Time Leaderboard Screen */
#all-time-leaderboard-screen {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at center, #1a0826 0%, #07010f 100%);
    color: #ffd700;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1020;
}

#all-time-leaderboard-screen h2 {
    font-family: 'Press Start 2P', cursive;
    font-size: 22px;
    text-shadow: 3px 3px 0 #000;
    margin-bottom: 25px;
    color: #ffd700;
}

#all-time-leaderboard-list {
    list-style: none;
    padding: 20px;
    background: rgba(0,0,0,0.5);
    border: 4px solid #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    min-width: 320px;
    font-size: 26px;
    color: #fff;
    margin-bottom: 20px;
}

#all-time-leaderboard-list li {
    margin-bottom: 8px;
    text-shadow: 2px 2px 0 #000;
}

#close-leaderboard-btn {
    padding: 10px 24px;
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    background: #ff00ff;
    color: black;
    border: 4px solid #000;
    box-shadow: 0 4px 0 #000;
    cursor: pointer;
    font-weight: bold;
}

#close-leaderboard-btn:active {
    transform: translateY(4px);
    box-shadow: none;
}

/* Mobile Controls - Nipple & Big Red Attack Button */
#joystick-zone {
    position: absolute;
    bottom: 30px;
    left: 30px;
    width: 140px;
    height: 140px;
    z-index: 50;
    display: none;
}

#action-buttons {
    position: absolute;
    bottom: 30px;
    right: 30px;
    z-index: 50;
    display: none;
    gap: 15px;
}

#btn-attack, #btn-dash {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 4px solid #000000;
    color: #ffffff;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    font-weight: bold;
    text-shadow: 2px 2px 0 #000;
    box-shadow: 0 8px 0 #5e0000, 0 15px 20px rgba(0, 0, 0, 0.6);
    cursor: pointer;
    outline: none;
    transition: transform 0.05s ease, box-shadow 0.05s ease, opacity 0.05s ease;
    user-select: none;
    -webkit-user-select: none;
    opacity: 0.3;
}
#btn-dash {
    margin-top: -60px;
}

#btn-attack {
    background: radial-gradient(circle at 30% 30%, #ff4b4b 0%, #b30000 80%);
    box-shadow: 0 8px 0 #5e0000, 0 15px 20px rgba(0, 0, 0, 0.6);
}

#btn-attack:active {
    transform: translateY(6px);
    box-shadow: 0 2px 0 #5e0000, 0 4px 8px rgba(0, 0, 0, 0.6);
    opacity: 0.9;
}

#btn-dash {
    background: radial-gradient(circle at 30% 30%, #4b9fff 0%, #004ab3 80%);
    box-shadow: 0 8px 0 #002e70, 0 15px 20px rgba(0, 0, 0, 0.6);
}

#btn-dash:active {
    transform: translateY(6px);
    box-shadow: 0 2px 0 #002e70, 0 4px 8px rgba(0, 0, 0, 0.6);
    opacity: 0.9;
}
