/* ── Floating Action Button ── */
#tetris-fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 99990;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6c3fc4 0%, #3a1f8a 100%);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(108, 63, 196, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}
#tetris-fab:hover {
    transform: scale(1.12);
    box-shadow: 0 6px 24px rgba(108, 63, 196, 0.75);
}
#tetris-fab:active {
    transform: scale(0.96);
}

/* ── Modal Overlay ── */
#tetris-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.72);
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(3px);
}
#tetris-modal.tetris-open {
    display: flex;
}

/* ── Modal Box ── */
#tetris-modal-box {
    background: #1a0d3c;
    border-radius: 16px;
    box-shadow: 0 8px 48px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(108,63,196,0.4);
    overflow: hidden;
    max-width: 560px;
    width: 100%;
    font-family: 'Courier New', monospace;
    animation: tetris-fadein 0.22s ease;
}
@keyframes tetris-fadein {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

/* ── Header ── */
#tetris-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #6c3fc4, #3a1f8a);
    padding: 14px 20px;
}
#tetris-title {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
}
#tetris-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
#tetris-close:hover { background: rgba(255,255,255,0.3); }

/* ── Body Layout ── */
#tetris-modal-body {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 16px;
    padding: 20px;
}

/* ── Panels ── */
#tetris-left-panel,
#tetris-right-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 90px;
}
.tetris-panel-block {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(108,63,196,0.35);
    border-radius: 10px;
    padding: 10px 12px;
    text-align: center;
}
.tetris-label {
    color: #9b7fe8;
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 5px;
}
#tetris-score,
#tetris-level,
#tetris-lines {
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1px;
}

/* ── Canvas ── */
#tetris-canvas {
    border: 2px solid rgba(108,63,196,0.6);
    border-radius: 6px;
    background: #0d0624;
    display: block;
    flex-shrink: 0;
}
#tetris-next-canvas {
    border: 1px solid rgba(108,63,196,0.35);
    border-radius: 6px;
    background: #0d0624;
    display: block;
    margin: 8px auto 0;
}

/* ── Controls Info ── */
.tetris-controls-info {
    text-align: left;
}
.tetris-key-row {
    color: #c4b0f5;
    font-size: 11px;
    margin: 3px 0;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
kbd {
    background: rgba(108,63,196,0.35);
    color: #e0d5ff;
    border: 1px solid rgba(108,63,196,0.6);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 10px;
    font-family: inherit;
}

/* ── Start Button ── */
#tetris-start-btn {
    background: linear-gradient(135deg, #6c3fc4, #3a1f8a);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 13px;
    font-family: 'Courier New', monospace;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: opacity 0.15s;
    width: 100%;
}
#tetris-start-btn:hover { opacity: 0.85; }

/* ── Responsive ── */
@media (max-width: 560px) {
    #tetris-modal-body {
        flex-direction: column;
        align-items: center;
        gap: 12px;
        padding: 14px;
    }
    #tetris-left-panel,
    #tetris-right-panel {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        min-width: unset;
        width: 100%;
    }
    #tetris-canvas {
        width: 200px !important;
        height: 400px !important;
    }
}
