#tetris .game-container {
    padding: 20px;
    text-align: center;
    max-width: 90vw;
}

#tetris .game-main {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 30px;
    margin-bottom: 20px;
}

#tetris .score-display {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    min-width: 120px;
}

#tetris .next-piece {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 120px;
}

#tetris .next-piece div:first-child {
    font-weight: bold;
    font-size: 1.1rem;
}

#tetris #next-canvas {
    border: 2px solid #444;
    background: #111;
}

#tetris .game-board-container {
    position: relative;
    display: inline-block;
}

#tetris #game-canvas {
    border: 3px solid #3080d0;
    background: #000;
    box-shadow: 0 5px 15px rgba(48, 128, 208, 0.3);
}

#tetris .start-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

#tetris .start-overlay.hidden {
    display: none;
}

#tetris .start-overlay-btn {
    padding: 20px 40px;
    border: none;
    border-radius: 15px;
    background: linear-gradient(145deg, #3080d0, #2563eb);
    color: #fff;
    font-weight: bold;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(48, 128, 208, 0.4);
    text-transform: uppercase;
    letter-spacing: 2px;
}

#tetris .start-overlay-btn:hover {
    background: linear-gradient(145deg, #2563eb, #1d4ed8);
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(48, 128, 208, 0.5);
}

#tetris .start-overlay-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(48, 128, 208, 0.4);
}

#tetris .mobile-controls {
    display: none;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

@media (max-width: 768px) {
    #tetris .mobile-controls {
        display: flex;
    }
}

#tetris .control-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    align-items: center;
}

#tetris .control-btn {
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(145deg, #4a4a4a, #2d2d2d);
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.1s ease;
    user-select: none;
    touch-action: manipulation;
}

#tetris .control-btn:active {
    transform: scale(0.95);
    box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.5);
    background: linear-gradient(145deg, #2d2d2d, #4a4a4a);
}

#tetris .control-btn-small {
    width: 50px;
    height: 50px;
    font-size: 1rem;
}

#tetris .control-btn-large {
    width: 150px;
    height: 60px;
    font-size: 1rem;
}

#tetris .game-controls {
    margin: 20px 0;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

#tetris .game-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(145deg, #3080d0, #2563eb);
    color: #fff;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 8px rgba(48, 128, 208, 0.3);
}

#tetris .game-btn:hover {
    background: linear-gradient(145deg, #2563eb, #1d4ed8);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(48, 128, 208, 0.4);
}

#tetris .game-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(48, 128, 208, 0.3);
}

#tetris .game-btn:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#tetris .instructions {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 0.9rem;
}

#tetris .instructions h3 {
    margin-bottom: 10px;
    font-weight: bold;
    font-size: 1rem;
}

#tetris .instructions p {
    margin-bottom: 5px;
}

#tetris .game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#tetris .game-over.hidden {
    display: none;
}

#tetris .game-over-content {
    background: rgba(0, 0, 0, 0.9);
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    border: 3px solid #3080d0;
    box-shadow: 0 10px 30px rgba(48, 128, 208, 0.3);
    color: white;
    position: relative;
}

#tetris .game-over-content h2 {
    font-size: 2rem;
    color: #ff4444;
    margin-bottom: 20px;
}

#tetris .game-over-content p {
    font-size: 1.2rem;
    margin-bottom: 30px;
}

#tetris #final-score {
    color: #3080d0;
    font-weight: bold;
}

#tetris .new-top-score {
    color: #00ff00;
    font-weight: bold;
    font-size: 1.3rem;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
    animation: pulse 1.5s infinite;
}

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

#tetris .new-top-score.hidden {
    display: none;
}

#tetris .close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 68, 68, 0.8);
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 1001;
}

#tetris .close-btn:hover {
    background: rgba(255, 68, 68, 1);
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.4);
}

#tetris .close-btn:active {
    transform: scale(0.95);
}

@media (max-width: 768px) {
    #tetris .game-container {
        padding: 15px;
        margin: 5px;
    }
    
    #tetris .game-main {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
    
    #tetris .score-display {
        order: 1;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
        min-width: auto;
        margin-bottom: 10px;
    }
    
    #tetris .game-board-container {
        order: 2;
    }
    
    #tetris #game-canvas {
        width: 250px;
        height: 500px;
    }
    
    #tetris .mobile-controls {
        display: flex;
        order: 3;
        flex-direction: row;
        align-items: center;
        gap: 20px;
        margin-top: 15px;
        justify-content: center;
    }
    
    #tetris .control-buttons {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    #tetris .next-piece {
        display: none;
    }
    
    #tetris .next-piece-mobile {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        min-width: 120px;
    }
    
    #tetris .next-piece-mobile div:first-child {
        font-weight: bold;
        font-size: 1.1rem;
    }
    
    #tetris #next-canvas-mobile {
        border: 2px solid #444;
        background: #111;
    }
    
    #tetris .instructions {
        font-size: 0.8rem;
    }
    
    #tetris .control-btn {
        width: 50px;
        height: 50px;
        font-size: 1rem;
    }
    
    #tetris .control-btn-small {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }
    
    #tetris .control-btn-large {
        width: 120px;
        height: 50px;
        font-size: 0.9rem;
    }
}

@media (max-width: 600px) and (min-width: 320px) {
    #tetris .mobile-controls {
        flex-direction: row;
        align-items: center;
        gap: 15px;
        justify-content: center;
    }
    
    #tetris .next-piece-mobile {
        align-self: center;
    }
}

@media (max-width: 319px) {
    #tetris .mobile-controls {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    #tetris .next-piece-mobile {
        align-self: center;
    }
}

@media (max-width: 480px) {
    #tetris .game-container {
        padding: 10px;
    }
    
    #tetris #game-canvas {
        width: 200px;
        height: 400px;
    }
    
    #tetris .score-display {
        font-size: 1rem;
        gap: 10px;
    }
    
    #tetris .control-btn {
        width: 45px;
        height: 45px;
        font-size: 0.9rem;
    }
    
    #tetris .control-btn-small {
        width: 35px;
        height: 35px;
        font-size: 0.8rem;
    }
    
    #tetris .control-btn-large {
        width: 100px;
        height: 45px;
        font-size: 0.8rem;
    }
    
    #tetris .game-btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
}

@media (min-width: 769px) {
    #tetris .mobile-controls {
        display: none !important;
    }
    
    #tetris .next-piece-mobile {
        display: none !important;
    }
}
