/* Tetris Top Modal - Fixed Button */
.ttm-launcher {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4), 0 2px 5px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.ttm-launcher:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5), 0 4px 10px rgba(0,0,0,0.25);
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
}

.ttm-launcher:active {
    transform: translateY(0) scale(0.98);
}

.ttm-launcher[aria-expanded="true"] {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
    box-shadow: 0 4px 15px rgba(229, 62, 62, 0.4);
}

.ttm-icon {
    font-size: 18px;
    line-height: 1;
}

/* Modal Overlay */
.ttm-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s linear 0.3s, opacity 0.3s ease;
}

.ttm-modal[aria-hidden="false"] {
    visibility: visible;
    opacity: 1;
    transition: visibility 0s linear 0s, opacity 0.3s ease;
}

.ttm-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

.ttm-dialog {
    position: relative;
    background: #1a1a2e;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    padding: 24px;
}

.ttm-modal[aria-hidden="false"] .ttm-dialog {
    transform: scale(1) translateY(0);
}

/* Header */
.ttm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 2px solid #2d2d44;
}

#ttm-title {
    margin: 0;
    color: #fff;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 24px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Close Button */
.ttm-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #2d2d44;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 28px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ttm-close:hover {
    background: #e53e3e;
    transform: rotate(90deg);
}

.ttm-close:active {
    transform: rotate(90deg) scale(0.95);
}

/* Controls Hint */
.ttm-controls-hint {
    text-align: center;
    color: #888;
    font-size: 13px;
    margin-bottom: 16px;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

/* Game Container */
.ttm-game-container {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

#ttm-canvas {
    background: #0f0f1a;
    border: 3px solid #2d2d44;
    border-radius: 8px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

/* Side Panel */
.ttm-side-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 120px;
}

.ttm-side-panel h3 {
    margin: 0 0 8px 0;
    color: #667eea;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ttm-next-piece,
.ttm-score-board,
.ttm-level,
.ttm-lines {
    background: #0f0f1a;
    padding: 12px;
    border-radius: 8px;
    border: 2px solid #2d2d44;
}

#ttm-next {
    background: #0f0f1a;
    border-radius: 4px;
}

#ttm-score,
#ttm-level,
#ttm-lines {
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

/* Game Controls */
.ttm-game-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 2px solid #2d2d44;
}

.ttm-btn {
    padding: 12px 24px;
    background: #2d2d44;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ttm-btn:hover {
    background: #3d3d5c;
    transform: translateY(-1px);
}

.ttm-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.ttm-btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .ttm-launcher {
        top: 10px;
        right: 10px;
        padding: 10px 16px;
        font-size: 12px;
    }
    
    .ttm-text {
        display: none;
    }
    
    .ttm-dialog {
        padding: 16px;
        max-width: 95vw;
    }
    
    .ttm-game-container {
        flex-direction: column;
        align-items: center;
    }
    
    #ttm-canvas {
        width: 240px;
        height: 400px;
    }
    
    .ttm-side-panel {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .ttm-next-piece,
    .ttm-score-board,
    .ttm-level,
    .tm-lines {
        min-width: 80px;
    }
}