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

body {
    background: #0a0a0a;
    color: #fff;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    user-select: none;
    -webkit-user-select: none;
}

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

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ===== PARTICLES BACKGROUND ===== */
#particles-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.particle {
    position: absolute;
    border-radius: 50%;
    animation: float-up linear infinite;
    opacity: 0;
}

@keyframes float-up {
    0% { transform: translateY(0) scale(0); opacity: 0; }
    10% { opacity: 0.8; }
    90% { opacity: 0.2; }
    100% { transform: translateY(-100vh) scale(1.5); opacity: 0; }
}

/* ===== GLITCH EFFECTS ===== */
.glitch {
    position: relative;
    text-shadow: 0.05em 0 0 #ff00ff, -0.05em -0.025em 0 #00ffff,
                 -0.025em 0.05em 0 #ffff00;
    animation: glitch-anim 2s infinite;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 #ff00ff;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -2px 0 #00ffff;
    clip: rect(24px, 450px, 85px, 0);
    animation: glitch-anim-3 2.5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0%, 90%, 100% { text-shadow: 0.05em 0 0 #ff00ff, -0.05em -0.025em 0 #00ffff, -0.025em 0.05em 0 #ffff00; }
    92% { text-shadow: -0.05em -0.025em 0 #ff00ff, 0.025em 0.025em 0 #00ffff, -0.05em -0.05em 0 #ffff00; }
    94% { text-shadow: 0.05em 0.05em 0 #ff00ff, 0.05em -0.05em 0 #00ffff, -0.05em -0.05em 0 #ffff00; }
}

@keyframes glitch-anim-2 {
    0% { clip: rect(65px, 9999px, 80px, 0); }
    20% { clip: rect(12px, 9999px, 45px, 0); }
    40% { clip: rect(90px, 9999px, 30px, 0); }
    60% { clip: rect(50px, 9999px, 70px, 0); }
    80% { clip: rect(20px, 9999px, 55px, 0); }
    100% { clip: rect(40px, 9999px, 95px, 0); }
}

@keyframes glitch-anim-3 {
    0% { clip: rect(30px, 9999px, 60px, 0); }
    25% { clip: rect(80px, 9999px, 20px, 0); }
    50% { clip: rect(10px, 9999px, 75px, 0); }
    75% { clip: rect(55px, 9999px, 40px, 0); }
    100% { clip: rect(70px, 9999px, 25px, 0); }
}

.glitch-text {
    text-shadow: 0.05em 0 0 #ff00ff, -0.05em -0.025em 0 #00ffff;
    animation: glitch-text-shake 0.3s infinite;
}

@keyframes glitch-text-shake {
    0%, 100% { transform: translate(0); }
    25% { transform: translate(-2px, 1px); }
    50% { transform: translate(2px, -1px); }
    75% { transform: translate(-1px, -2px); }
}

/* ===== NEON TEXT ===== */
.neon-text {
    color: #fff;
    text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 20px #00ffff,
                 0 0 30px #00ffff, 0 0 40px #00ffff, 0 0 55px #00ffff,
                 0 0 75px #00ffff;
}

/* ===== MENU ===== */
.menu-content {
    text-align: center;
    z-index: 1;
    position: relative;
}

#game-title {
    font-size: 2.2rem;
    color: #fff;
    margin-bottom: 3rem;
    line-height: 1.6;
    letter-spacing: 2px;
}

#menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    align-items: center;
}

.menu-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 1.2rem;
    padding: 1rem 2.5rem;
    border: 2px solid #00ffff;
    background: rgba(0, 255, 255, 0.05);
    color: #00ffff;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    letter-spacing: 3px;
    min-width: 280px;
}

.menu-btn:hover {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 15px #00ffff, 0 0 30px #00ffff, inset 0 0 15px rgba(0, 255, 255, 0.1);
    transform: scale(1.05);
}

.menu-btn:active {
    transform: scale(0.95);
}

.menu-btn.small {
    font-size: 0.7rem;
    padding: 0.7rem 1.5rem;
    min-width: 180px;
}

.menu-btn.danger {
    border-color: #ff00ff;
    color: #ff00ff;
    background: rgba(255, 0, 255, 0.05);
}

.menu-btn.danger:hover {
    background: rgba(255, 0, 255, 0.2);
    box-shadow: 0 0 15px #ff00ff, 0 0 30px #ff00ff;
}

.neon-btn {
    animation: neon-pulse 2s infinite;
}

@keyframes neon-pulse {
    0%, 100% { border-color: #00ffff; box-shadow: 0 0 10px #00ffff; }
    50% { border-color: #ff00ff; box-shadow: 0 0 20px #ff00ff; }
}

/* ===== SETTINGS ===== */
#settings-panel {
    margin-top: 2rem;
    padding: 2rem;
    border: 1px solid #00ffff;
    background: rgba(0, 0, 0, 0.8);
    max-width: 500px;
    text-align: left;
}

#settings-panel h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #00ffff;
    font-size: 1rem;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.2rem;
    gap: 1rem;
    font-size: 0.55rem;
}

.setting-row label {
    color: #00ffff;
    min-width: 120px;
}

.setting-row input[type="range"] {
    flex: 1;
    accent-color: #ff00ff;
}

.setting-row select {
    background: #111;
    color: #00ffff;
    border: 1px solid #00ffff;
    padding: 0.3rem 0.5rem;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.5rem;
    cursor: pointer;
}

.setting-row span {
    color: #aaa;
    font-size: 0.5rem;
}

#btn-settings-back {
    display: block;
    margin: 1.5rem auto 0;
}

/* ===== GAME UI ===== */
#game-screen {
    background: #0a0a0a;
}

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

#game-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    pointer-events: none;
    z-index: 10;
}

#score-display {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 1.5rem;
    color: #fff;
}

#combo-display {
    position: absolute;
    top: 60px;
    left: 20px;
    font-size: 1.2rem;
    color: #ffff00;
}

#accuracy-display {
    position: absolute;
    top: 90px;
    left: 20px;
    font-size: 0.7rem;
    color: #aaa;
}

#round-display {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 0.7rem;
    color: #00ffff;
}

#health-bar-container {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 12px;
    border: 2px solid #ff00ff;
    border-radius: 6px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.5);
}

#health-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #ff0000, #ffff00, #00ff00);
    transition: width 0.2s ease;
    border-radius: 4px;
}

#hit-feedback {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    font-family: 'Press Start 2P', monospace;
    font-size: 1.5rem;
    font-weight: bold;
    transition: opacity 0.1s ease, transform 0.1s ease;
}

/* ===== STAY UP! ===== */
#stayup-overlay {
    text-align: center;
    z-index: 100;
    pointer-events: all;
}

#stayup-text {
    font-size: 5rem;
    color: #ff0000;
    margin-bottom: 2rem;
    animation: stayup-pulse 0.3s infinite;
}

@keyframes stayup-pulse {
    0%, 100% { transform: scale(1); color: #ff0000; }
    50% { transform: scale(1.2); color: #ff4444; }
}

#stayup-progress {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    font-size: 1.5rem;
}

#stayup-sequence {
    color: #ff00ff;
    font-size: 2rem;
    letter-spacing: 10px;
}

#stayup-counter {
    color: #00ffff;
    font-size: 1rem;
}

.stayup-done {
    color: #00ff00 !important;
}

.stayup-current {
    color: #ffff00 !important;
    animation: stayup-pulse 0.3s infinite;
}

/* ===== PAUSE ===== */
.pause-content {
    text-align: center;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

.pause-content h2 {
    font-size: 2rem;
}

/* ===== RESULTS ===== */
.result-content {
    text-align: center;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    background: rgba(0, 0, 0, 0.9);
    padding: 3rem;
    border: 2px solid #00ffff;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.3);
}

.result-content h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

#result-rank {
    font-size: 2rem;
    color: #ffff00;
}

/* ===== TUTORIAL ===== */
#tutorial-content {
    text-align: center;
    z-index: 1;
    max-width: 800px;
    padding: 2rem;
}

#tutorial-title {
    font-size: 1.5rem;
    margin-bottom: 2rem;
}

#tutorial-text {
    font-size: 0.8rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    color: #ccc;
    font-family: 'Press Start 2P', monospace;
}

#tutorial-canvas {
    border: 1px solid #00ffff;
    background: rgba(0, 0, 0, 0.5);
    margin-bottom: 1.5rem;
    max-width: 100%;
}

#tutorial-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* ===== COMMUNITY ===== */
.community-content {
    z-index: 1;
    width: 90%;
    max-width: 700px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.community-content h2 {
    font-size: 1.2rem;
}

#chat-messages {
    width: 100%;
    height: 400px;
    overflow-y: auto;
    border: 1px solid #00ffff;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.8);
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    line-height: 1.6;
}

.chat-message {
    margin-bottom: 0.5rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid rgba(0, 255, 255, 0.1);
}

.chat-message .timestamp {
    color: #555;
    margin-right: 0.5rem;
    font-size: 0.55rem;
}

.chat-message .username {
    color: #ff00ff;
    margin-right: 0.5rem;
}

.chat-message .text {
    color: #00ffff;
    word-break: break-word;
}

#chat-input-area {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

#chat-input {
    flex: 1;
    padding: 0.5rem;
    background: #111;
    border: 1px solid #00ffff;
    color: #00ffff;
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    outline: none;
}

#chat-input::placeholder {
    color: #333;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    #game-title {
        font-size: 1.2rem;
    }
    
    .menu-btn {
        font-size: 0.8rem;
        padding: 0.8rem 1.5rem;
        min-width: 200px;
    }
    
    #stayup-text {
        font-size: 3rem;
    }
    
    #settings-panel {
        max-width: 90%;
        padding: 1rem;
    }
    
    .setting-row {
        font-size: 0.45rem;
        flex-wrap: wrap;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #111;
}

::-webkit-scrollbar-thumb {
    background: #00ffff;
    border-radius: 4px;
}
