/* Tetris Top-Right Unified - Fixed Button */
.tetris-tru-button {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9998;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tetris-tru-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
    background: linear-gradient(135deg, #7b8fe8 0%, #8a5eb8 100%);
}

.tetris-tru-button:active {
    transform: translateY(0);
}

.tetris-tru-icon {
    font-size: 18px;
}

.tetris-tru-text {
    letter-spacing: 1px;
}

/* Modal Base */
.tetris-tru-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Backdrop for click-to-close */
.tetris-tru-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

/* Modal Content */
.tetris-tru-modal-content {
    position: relative;
    background: linear-gradient(145deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    z-index: 10000;
}

/* Modal Header */
.tetris-tru-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.3);
}

.tetris-tru-modal-header h2 {
    margin: 0;
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 20px;
    letter-spacing: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Close Button */
.tetris-tru-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.tetris-tru-close:hover {
    background: rgba(255, 100, 100, 0.5);
    transform: scale(1.1);
}

/* Modal Body */
.tetris-tru-modal-body {
    padding: 20px;
}

/* Game Container */
.tetris-tru-game-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

/* Canvas */
#tetris-tru-canvas {
    background: #000;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

/* Info Panel */
.tetris-tru-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.tetris-tru-info > div {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 16px;
    border-radius: 8px;
    min-width: 100px;
}

.tetris-tru-label {
    display: block;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.tetris-tru-value {
    display: block;
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
}

.tetris-tru-next-box canvas {
    display: block;
    margin-top: 8px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
}

/* Controls Hint */
.tetris-tru-controls-hint {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.8;
}

.tetris-tru-controls-hint p {
    margin: 2px 0;
}

/* Game Over Overlay */
.tetris-tru-game-over {
    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;
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    z-index: 10001;
}

.tetris-tru-game-over h3 {
    font-size: 32px;
    margin: 0 0 16px 0;
    color: #ff6b6b;
    letter-spacing: 4px;
}

.tetris-tru-game-over p {
    font-size: 18px;
    margin: 0 0 24px 0;
}

.tetris-tru-restart-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tetris-tru-restart-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
}

/* Animations */
@keyframes tetris-tru-fade-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.tetris-tru-modal[style*="flex"] .tetris-tru-modal-content {
    animation: tetris-tru-fade-in 0.3s ease-out;
}

/* Responsive */
@media (max-width: 600px) {
    .tetris-tru-button {
        top: 10px;
        right: 10px;
        padding: 10px 14px;
        font-size: 12px;
    }
    
    .tetris-tru-modal-content {
        max-width: 95vw;
    }
    
    .tetris-tru-game-container {
        flex-direction: column;
        align-items: center;
    }
    
    .tetris-tru-info {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .tetris-tru-info > div {
        min-width: auto;
    }
    
    #tetris-tru-canvas {
        width: 100%;
        max-width: 300px;
        height: auto;
    }
}
