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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0a0a0a;
    color: white;
    overflow: hidden;
}

#app {
    width: 100vw;
    height: 100vh;
}

/* Screens */
.screen {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Top-aligned + scrollable so tall content (avatars, options, Start button)
       is always reachable on shorter screens. */
    justify-content: flex-start;
    align-items: center;
    flex-direction: column;
    overflow-y: auto;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    z-index: 100;
    padding: 2rem;
}

.screen.active {
    display: flex;
}

.screen h1 {
    font-size: 4.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
    background: linear-gradient(45deg, #ff0000, #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.instructions {
    background: rgba(255, 255, 255, 0.05);
    padding: 2rem;
    border-radius: 15px;
    margin: 2rem 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Avatar Selection */
.avatar-selection {
    margin: 2rem 0;
    width: 100%;
    max-width: 600px;
}

.avatar-selection h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: #ff6b6b;
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 1rem;
}

.avatar-option {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.avatar-option:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 107, 107, 0.5);
    transform: scale(1.05);
}

.avatar-option.active {
    background: rgba(255, 107, 107, 0.2);
    border-color: #ff6b6b;
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.3);
}

.avatar-preview {
    font-size: 3rem;
    margin-bottom: 10px;
    height: 80px;
    width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-preview.fox {
    background: linear-gradient(135deg, #f5912f, #ffbe6b);
}

.avatar-preview.panda {
    background: linear-gradient(135deg, #cfcfcf, #ffffff);
}

.avatar-preview.ninja {
    background: linear-gradient(135deg, #2d2d2d, #8b0000);
}

.avatar-preview.robot {
    background: linear-gradient(135deg, #4a4a4a, #00ff88);
}

.avatar-preview.alien {
    background: linear-gradient(135deg, #00ff00, #88ff00);
}

.avatar-preview.no-avatar {
    background: rgba(100, 100, 100, 0.3);
}

.avatar-option span {
    font-size: 0.9rem;
    display: block;
}

.instructions {
    background: rgba(255, 255, 255, 0.05);
    padding: 2rem;
    border-radius: 15px;
    margin: 2rem 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.instructions h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #ff6b6b;
}

.instructions ul {
    list-style: none;
    text-align: left;
}

.instructions li {
    font-size: 1.2rem;
    margin: 1rem 0;
    padding-left: 2rem;
}

.stats {
    margin: 2rem 0;
}

.stats p {
    font-size: 1.3rem;
    margin: 1rem 0;
}

.big-number {
    font-size: 3rem;
    color: #ff6b6b;
    font-weight: bold;
}

.tip {
    margin-top: 2rem;
    font-size: 0.9rem;
    opacity: 0.6;
}

.btn {
    padding: 1.2rem 4rem;
    font-size: 1.6rem;
    background: linear-gradient(45deg, #ff0000, #ff6b6b);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    margin-top: 2rem;
    transition: all 0.3s;
    font-weight: bold;
    text-transform: uppercase;
    box-shadow: 0 10px 30px rgba(255, 0, 0, 0.3);
}

.btn:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 15px 40px rgba(255, 0, 0, 0.5);
}

.btn:active {
    transform: scale(0.98);
}

/* Game Container */
#gameContainer {
    width: 100%;
    height: 100%;
    position: relative;
    background: #000;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
    background: #000;
}

/* Game UI */
#gameUI {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.ui-top {
    display: flex;
    justify-content: space-around;
    padding: 30px;
    gap: 20px;
}

.stat-box {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 107, 107, 0.5);
    border-radius: 15px;
    padding: 15px 30px;
    text-align: center;
    min-width: 150px;
    backdrop-filter: blur(10px);
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    margin-top: 5px;
    color: #ff6b6b;
}

.status-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 30px 60px;
    border-radius: 20px;
    font-size: 2.5rem;
    text-align: center;
    border: 3px solid #ff6b6b;
    box-shadow: 0 0 30px rgba(255, 107, 107, 0.5);
    animation: pulse 1s infinite;
}

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

.dodge-timer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 5rem;
    font-weight: bold;
    color: rgba(255, 107, 107, 0.8);
    text-shadow: 0 0 20px rgba(255, 0, 0, 0.8);
    pointer-events: none;
}

.warning-message {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 0, 0, 0.9);
    padding: 20px 40px;
    border-radius: 10px;
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    display: none;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(-50%) rotate(0deg); }
    25% { transform: translateX(-50%) rotate(-5deg); }
    75% { transform: translateX(-50%) rotate(5deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .screen h1 {
        font-size: 3rem;
    }
    
    .ui-top {
        flex-direction: column;
        padding: 15px;
        gap: 10px;
    }
    
    .stat-box {
        min-width: auto;
    }
    
    .status-message {
        font-size: 1.5rem;
        padding: 20px 40px;
    }
}
