/* Tetris Game Styles */
#tetrisGame {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    max-height: 95vh;
    max-width: 95vw;
    overflow-y: auto;
}

#tetrisGame.active {
    opacity: 1;
    pointer-events: all;
    transform: translate(-50%, -50%) scale(1);
}

.tetris-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.tetris-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.tetris-container {
    background: rgba(17, 24, 39, 0.95);
    border: 2px solid rgba(139, 92, 246, 0.5);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 20px 60px rgba(139, 92, 246, 0.4);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.light-mode .tetris-container {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(139, 92, 246, 0.4);
}

.tetris-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.tetris-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tetris-close {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    width: 36px;
    height: 36px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.5rem;
    line-height: 1;
}

.tetris-close:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    transform: scale(1.1);
}

.tetris-content {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.tetris-board-container {
    position: relative;
}

#tetrisCanvas {
    border: 2px solid rgba(139, 92, 246, 0.3);
    border-radius: 0.5rem;
    background: rgba(10, 10, 10, 0.8);
    box-shadow: inset 0 0 20px rgba(139, 92, 246, 0.1);
    max-width: 100%;
    height: auto;
}

.light-mode #tetrisCanvas {
    background: rgba(249, 250, 251, 0.95);
    border-color: rgba(139, 92, 246, 0.4);
}

.tetris-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 180px;
}

.tetris-info-box {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 0.75rem;
    padding: 1rem;
}

.light-mode .tetris-info-box {
    background: rgba(139, 92, 246, 0.08);
}

.tetris-info-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    margin-bottom: 0.5rem;
    font-family: 'JetBrains Mono', monospace;
}

.light-mode .tetris-info-label {
    color: #6b7280;
}

.tetris-info-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #8b5cf6;
    font-family: 'JetBrains Mono', monospace;
}

#nextPieceCanvas {
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 0.5rem;
    background: rgba(10, 10, 10, 0.5);
    margin-top: 0.5rem;
}

.light-mode #nextPieceCanvas {
    background: rgba(249, 250, 251, 0.8);
}

.tetris-controls {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 0.75rem;
    padding: 1rem;
}

.light-mode .tetris-controls {
    background: rgba(59, 130, 246, 0.08);
}

.tetris-control-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-family: 'JetBrains Mono', monospace;
}

.tetris-control-item:last-child {
    margin-bottom: 0;
}

.tetris-control-key {
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.4);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    color: #a78bfa;
    font-weight: 600;
}

.light-mode .tetris-control-key {
    color: #7c3aed;
}

.tetris-control-label {
    color: #9ca3af;
}

.light-mode .tetris-control-label {
    color: #6b7280;
}

.tetris-button {
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
    border: none;
    border-radius: 0.5rem;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tetris-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.4);
}

.tetris-button:active {
    transform: translateY(0);
}

.tetris-game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(17, 24, 39, 0.98);
    border: 2px solid rgba(139, 92, 246, 0.5);
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    z-index: 10;
    display: none;
}

.light-mode .tetris-game-over {
    background: rgba(255, 255, 255, 0.98);
}

.tetris-game-over.active {
    display: block;
}

.tetris-game-over h3 {
    font-size: 1.5rem;
    color: #ef4444;
    margin-bottom: 1rem;
    font-family: 'JetBrains Mono', monospace;
}

.tetris-game-over p {
    color: #9ca3af;
    margin-bottom: 1.5rem;
}

.light-mode .tetris-game-over p {
    color: #6b7280;
}

.tetris-trigger {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.4);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tetris-trigger:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 12px 32px rgba(139, 92, 246, 0.6);
}

.tetris-trigger:active {
    transform: scale(1);
}

/* Responsive */
@media (max-width: 768px) {
    #tetrisGame {
        transform: translate(-50%, -50%) scale(0.6);
        max-height: 98vh;
        max-width: 98vw;
    }
    
    #tetrisGame.active {
        transform: translate(-50%, -50%) scale(0.75);
    }
    
    .tetris-container {
        padding: 1rem;
    }
    
    .tetris-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .tetris-sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        width: 100%;
        gap: 0.75rem;
    }
    
    .tetris-info-box,
    .tetris-controls {
        flex: 1;
        min-width: 140px;
    }
    
    .tetris-trigger {
        bottom: 1rem;
        right: 1rem;
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }
}

@media (max-height: 700px) {
    #tetrisGame {
        max-height: 98vh;
    }
    
    .tetris-container {
        padding: 1rem;
    }
    
    .tetris-header {
        margin-bottom: 1rem;
    }
    
    .tetris-content {
        gap: 1rem;
    }
    
    .tetris-info-box,
    .tetris-controls {
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    #tetrisGame {
        transform: translate(-50%, -50%) scale(0.5);
    }
    
    #tetrisGame.active {
        transform: translate(-50%, -50%) scale(0.65);
    }
    
    .tetris-title {
        font-size: 1.25rem;
    }
    
    .tetris-close {
        width: 32px;
        height: 32px;
        font-size: 1.25rem;
    }
}
