html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    background: #0a0e1a;
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

#startMenu {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, rgba(20,30,60,0.95), rgba(0,0,0,0.98));
    backdrop-filter: blur(10px);
    z-index: 50;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#startMenu h1 {
    margin: 0 0 30px 0;
    font-size: clamp(24px, 5vw, 42px);
    letter-spacing: 2px;
    text-shadow: 0 0 20px rgba(100,200,255,0.6), 0 0 40px rgba(100,150,255,0.4);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 0 0 20px rgba(100,200,255,0.6), 0 0 40px rgba(100,150,255,0.4); }
    to { text-shadow: 0 0 30px rgba(150,220,255,0.8), 0 0 60px rgba(100,180,255,0.6); }
}

#startMenu p {
    font-size: clamp(14px, 2.5vw, 18px);
    margin: 10px 0;
}

#choices {
    margin-top: 20px;
    display: flex;
    gap: clamp(15px, 3vw, 25px);
}

.choiceBtn {
    font-size: clamp(40px, 8vw, 70px);
    padding: clamp(8px, 2vw, 15px) clamp(12px, 3vw, 25px);
    border-radius: 15px;
    border: 3px solid rgba(100,200,255,0.4);
    background: linear-gradient(135deg, rgba(30,60,120,0.3), rgba(10,30,80,0.5));
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 25px rgba(0,100,255,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}

.choiceBtn:hover { 
    transform: translateY(-8px) scale(1.1);
    background: linear-gradient(135deg, rgba(50,90,180,0.5), rgba(20,50,120,0.7));
    border-color: rgba(150,220,255,0.7);
    box-shadow: 0 10px 40px rgba(100,180,255,0.6), inset 0 1px 0 rgba(255,255,255,0.2);
}

.hint {
    margin-top: 20px;
    font-size: clamp(11px, 2vw, 14px);
    color: rgba(150,200,255,0.7);
    text-shadow: 0 0 10px rgba(100,180,255,0.5);
}

#gameCanvas {
    position: absolute;
    inset: 0;
    display: block;
    background: radial-gradient(ellipse at center, #1a1f35 0%, #0a0e1a 100%);
    touch-action: none;
    outline: none;
}

/* Mobile Controls */
#mobile-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: none;
    grid-template-columns: repeat(3, 60px);
    grid-template-rows: repeat(3, 60px);
    gap: 8px;
    z-index: 100;
}

.mobile-btn {
    appearance: none;
    border: 2px solid rgba(100,200,255,0.5);
    background: rgba(30,60,120,0.8);
    color: #fff;
    font-size: 24px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 150ms ease;
    box-shadow: 0 4px 12px rgba(0,100,255,0.5);
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.mobile-btn:active {
    background: rgba(50,90,180,0.9);
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(0,100,255,0.7);
}

.mobile-btn[data-direction="up"] {
    grid-column: 2;
    grid-row: 1;
}

.mobile-btn[data-direction="down"] {
    grid-column: 2;
    grid-row: 3;
}

.mobile-btn[data-direction="left"] {
    grid-column: 1;
    grid-row: 2;
}

.mobile-btn[data-direction="right"] {
    grid-column: 3;
    grid-row: 2;
}

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
    #mobile-controls {
        display: grid;
    }
}

#gameOverScreen {
    position: absolute;
    inset: 0;
    display: none;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle, rgba(40,10,10,0.95), rgba(0,0,0,0.98));
    backdrop-filter: blur(8px);
    z-index: 100;
    flex-direction: column;
    text-align: center;
    animation: fadeIn 0.4s ease;
}

#gameOverScreen h2 {
    font-size: clamp(28px, 6vw, 48px);
    margin-bottom: 15px;
    text-shadow: 0 0 20px rgba(255,50,50,0.8);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

#survivalTime {
    font-size: clamp(14px, 3vw, 20px);
    margin-bottom: 25px;
    color: rgba(255,200,200,0.9);
}

#gameOverScreen button {
    font-size: clamp(16px, 3vw, 24px);
    padding: clamp(10px, 2vw, 15px) clamp(20px, 4vw, 35px);
    border: 3px solid rgba(255,100,100,0.6);
    border-radius: 10px;
    cursor: pointer;
    background: linear-gradient(135deg, rgba(150,30,30,0.5), rgba(80,10,10,0.7));
    color: #fff;
    transition: all 0.3s ease;
    box-shadow: 0 5px 25px rgba(255,50,50,0.4);
    font-weight: bold;
}

#gameOverScreen button:hover {
    transform: translateY(-5px);
    background: linear-gradient(135deg, rgba(200,50,50,0.7), rgba(120,20,20,0.9));
    box-shadow: 0 10px 40px rgba(255,80,80,0.6);
}

#victoryScreen {
    position: absolute;
    inset: 0;
    display: none;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle, rgba(20,40,10,0.95), rgba(0,10,0,0.98));
    backdrop-filter: blur(8px);
    z-index: 100;
    flex-direction: column;
    text-align: center;
    animation: fadeIn 0.4s ease;
}

#victoryScreen h2 {
    font-size: clamp(32px, 7vw, 56px);
    margin-bottom: 20px;
    text-shadow: 0 0 30px rgba(255,215,0,0.9), 0 0 50px rgba(255,180,0,0.6);
    animation: victoryPulse 2s ease-in-out infinite;
}

@keyframes victoryPulse {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.08) rotate(2deg); }
    75% { transform: scale(1.08) rotate(-2deg); }
}

#victoryTime, #victoryStats {
    font-size: clamp(14px, 3vw, 20px);
    margin: 8px 0;
    color: rgba(255,230,150,0.95);
}

#victoryScreen button {
    font-size: clamp(16px, 3vw, 24px);
    padding: clamp(10px, 2vw, 15px) clamp(20px, 4vw, 35px);
    border: 3px solid rgba(100,255,100,0.6);
    border-radius: 10px;
    cursor: pointer;
    background: linear-gradient(135deg, rgba(30,150,30,0.5), rgba(10,80,10,0.7));
    color: #fff;
    transition: all 0.3s ease;
    box-shadow: 0 5px 25px rgba(50,255,50,0.4);
    font-weight: bold;
    margin-top: 15px;
}

#victoryScreen button:hover {
    transform: translateY(-5px);
    background: linear-gradient(135deg, rgba(50,200,50,0.7), rgba(20,120,20,0.9));
    box-shadow: 0 10px 40px rgba(80,255,80,0.6);
}