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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0a0a1a;
    color: #fff;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated starfield background */
.stars-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(2px 2px at 20px 30px, #fff, transparent),
        radial-gradient(2px 2px at 40px 70px, #a0d8ff, transparent),
        radial-gradient(1px 1px at 90px 40px, #fff, transparent),
        radial-gradient(2px 2px at 160px 120px, #a0d8ff, transparent),
        radial-gradient(1px 1px at 230px 80px, #fff, transparent),
        radial-gradient(2px 2px at 300px 150px, #a0d8ff, transparent),
        radial-gradient(1px 1px at 350px 200px, #fff, transparent),
        radial-gradient(2px 2px at 400px 50px, #a0d8ff, transparent),
        radial-gradient(1px 1px at 450px 250px, #fff, transparent),
        radial-gradient(2px 2px at 500px 100px, #a0d8ff, transparent);
    background-size: 550px 300px;
    animation: twinkle 5s ease-in-out infinite;
    z-index: -1;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.4; }
}

.game-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

header h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, #667eea, #764ba2, #f093fb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(102, 126, 234, 0.5);
    margin-bottom: 15px;
    letter-spacing: 3px;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.stat {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 10px;
    padding: 10px 25px;
    text-align: center;
    backdrop-filter: blur(10px);
}

.stat .label {
    display: block;
    font-size: 0.7rem;
    color: #a0a0c0;
    letter-spacing: 2px;
    margin-bottom: 5px;
}

.stat span:last-child {
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 10px rgba(102, 126, 234, 0.8);
}

.game-area {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex: 1;
    align-items: flex-start;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.next-piece {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    backdrop-filter: blur(10px);
}

.next-piece h3 {
    font-size: 0.8rem;
    color: #a0a0c0;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

#next-piece-display {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

#next-piece-display canvas {
    image-rendering: pixelated;
}

.controls-info {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 10px;
    padding: 15px;
    backdrop-filter: blur(10px);
}

.controls-info h3 {
    font-size: 0.8rem;
    color: #a0a0c0;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.controls-info p {
    font-size: 0.85rem;
    color: #c0c0d0;
    margin: 5px 0;
}

.board-container {
    position: relative;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(102, 126, 234, 0.5);
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.3);
}

#game-board {
    display: block;
    background: #0a0a1a;
    border-radius: 5px;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    z-index: 10;
}

.overlay.hidden {
    display: none;
}

.overlay h2 {
    font-size: 2rem;
    background: linear-gradient(135deg, #667eea, #f093fb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 15px;
}

.overlay p {
    font-size: 1.2rem;
    color: #c0c0d0;
    margin-bottom: 25px;
}

#restart-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    color: #fff;
    padding: 15px 40px;
    font-size: 1.1rem;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

#restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.6);
}

.mobile-controls {
    display: none;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    padding: 15px;
}

.mobile-controls button {
    width: 60px;
    height: 60px;
    background: rgba(102, 126, 234, 0.3);
    border: 2px solid rgba(102, 126, 234, 0.5);
    border-radius: 50%;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.mobile-controls button:active {
    background: rgba(102, 126, 234, 0.6);
    transform: scale(0.95);
}

/* Responsive */
@media (max-width: 600px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .stats {
        gap: 15px;
    }
    
    .stat {
        padding: 8px 15px;
    }
    
    .sidebar {
        display: none;
    }
    
    .mobile-controls {
        display: flex;
    }
    
    #game-board {
        width: 250px;
        height: 500px;
    }
}