/* =============================================
   TETRIS GAME PLUGIN — CSS
   ============================================= */

/* ---- Floating Launch Button ---- */
#tetris-launch-btn {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 99998;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #e94560;
    border: 2px solid #e94560;
    border-radius: 8px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    box-shadow: 0 0 12px rgba(233,69,96,0.5), 0 4px 16px rgba(0,0,0,0.4);
    transition: all 0.2s ease;
    text-transform: uppercase;
}
#tetris-launch-btn:hover {
    background: linear-gradient(135deg, #e94560 0%, #c73652 100%);
    color: #fff;
    box-shadow: 0 0 20px rgba(233,69,96,0.8), 0 6px 20px rgba(0,0,0,0.5);
    transform: translateY(-1px);
}
#tetris-launch-btn:active {
    transform: translateY(0);
}
.tetris-btn-icon {
    font-size: 16px;
    line-height: 1;
}
.tetris-btn-label {
    line-height: 1;
}

/* ---- Overlay ---- */
#tetris-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.85);
    display: flex !important;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    animation: tetrisFadeIn 0.2s ease;
}
#tetris-overlay[style*="display:none"],
#tetris-overlay[style*="display: none"] {
    display: none !important;
}
@keyframes tetrisFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ---- Modal ---- */
#tetris-modal {
    position: relative;
    background: #0d0d1a;
    border: 2px solid #e94560;
    border-radius: 12px;
    box-shadow: 0 0 40px rgba(233,69,96,0.4), 0 20px 60px rgba(0,0,0,0.8);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 98vw;
    max-height: 98vh;
    overflow: hidden;
    animation: tetrisSlideIn 0.25s ease;
}
@keyframes tetrisSlideIn {
    from { transform: scale(0.9) translateY(-20px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
}

/* ---- Close Button ---- */
#tetris-close-btn {
    position: absolute;
    top: 10px;
    right: 14px;
    background: none;
    border: none;
    color: #e94560;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    transition: color 0.15s, transform 0.15s;
    padding: 0;
}
#tetris-close-btn:hover {
    color: #fff;
    transform: rotate(90deg);
}

/* ---- Header ---- */
#tetris-header h2 {
    margin: 0 0 4px 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 6px;
    color: #e94560;
    text-align: center;
    text-shadow: 0 0 10px rgba(233,69,96,0.7);
}

/* ---- Body Layout ---- */
#tetris-body {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

/* ---- Game Canvas ---- */
#tetris-board-wrap {
    flex-shrink: 0;
}
#tetris-canvas {
    display: block;
    border: 2px solid #e94560;
    border-radius: 4px;
    box-shadow: 0 0 16px rgba(233,69,96,0.3);
    background: #050510;
}

/* ---- Sidebar ---- */
#tetris-sidebar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 130px;
}

/* ---- Info Boxes ---- */
.tetris-info-box {
    background: #111128;
    border: 1px solid #e9456040;
    border-radius: 6px;
    padding: 8px 10px;
    text-align: center;
}
.tetris-info-label {
    font-family: 'Courier New', Courier, monospace;
    font-size: 10px;
    letter-spacing: 2px;
    color: #e9456099;
    margin-bottom: 4px;
    text-transform: uppercase;
}
.tetris-info-value {
    font-family: 'Courier New', Courier, monospace;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

/* ---- Next Piece Canvas ---- */
#tetris-next-canvas {
    display: block;
    margin: 0 auto;
    background: #050510;
    border-radius: 4px;
}

/* ---- Controls Hint ---- */
#tetris-controls-hint {
    font-family: 'Courier New', Courier, monospace;
    font-size: 11px;
    color: #888;
    line-height: 1.7;
}
.tetris-ctrl-row {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
#tetris-controls-hint kbd {
    background: #1a1a2e;
    border: 1px solid #444;
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 10px;
    color: #ccc;
    font-family: inherit;
}

/* ---- Mobile Controls ---- */
#tetris-mobile-controls {
    display: none;
    flex-direction: column;
    gap: 4px;
    align-items: center;
}
.tetris-mob-row {
    display: flex;
    gap: 4px;
}
.tetris-mob-btn {
    width: 44px;
    height: 44px;
    background: #1a1a2e;
    border: 2px solid #e9456060;
    border-radius: 8px;
    color: #e94560;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.1s;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}
.tetris-mob-btn.wide {
    width: 136px;
    font-size: 12px;
    letter-spacing: 2px;
}
.tetris-mob-btn:active {
    background: #e94560;
    color: #fff;
}

/* ---- Game Over Screen ---- */
#tetris-gameover {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    z-index: 20;
}
#tetris-gameover[style*="display:none"],
#tetris-gameover[style*="display: none"] {
    display: none !important;
}
#tetris-gameover-box {
    text-align: center;
    font-family: 'Courier New', Courier, monospace;
}
#tetris-gameover-title {
    font-size: 32px;
    font-weight: 900;
    color: #e94560;
    letter-spacing: 4px;
    text-shadow: 0 0 20px rgba(233,69,96,0.8);
    margin-bottom: 10px;
}
#tetris-gameover-score {
    font-size: 16px;
    color: #ccc;
    margin-bottom: 20px;
}
#tetris-restart-btn {
    background: linear-gradient(135deg, #e94560, #c73652);
    color: #fff;
    border: none;
    padding: 12px 28px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 3px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 16px rgba(233,69,96,0.5);
}
#tetris-restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(233,69,96,0.7);
}

/* ---- Pause Screen ---- */
#tetris-pause-screen {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    z-index: 15;
}
#tetris-pause-screen[style*="display:none"],
#tetris-pause-screen[style*="display: none"] {
    display: none !important;
}
#tetris-pause-box {
    font-family: 'Courier New', Courier, monospace;
    font-size: 36px;
    font-weight: 900;
    color: #fff;
    letter-spacing: 8px;
    text-shadow: 0 0 20px rgba(255,255,255,0.5);
}

/* ---- Responsive ---- */
@media (max-width: 540px) {
    #tetris-modal {
        padding: 12px;
        gap: 8px;
    }
    #tetris-canvas {
        width: 200px !important;
        height: 400px !important;
    }
    #tetris-next-canvas {
        width: 80px !important;
        height: 80px !important;
    }
    #tetris-sidebar {
        min-width: 90px;
    }
    .tetris-info-value {
        font-size: 16px;
    }
    #tetris-controls-hint {
        display: none;
    }
    #tetris-mobile-controls {
        display: flex;
    }
    #tetris-header h2 {
        font-size: 16px;
        letter-spacing: 4px;
    }
    #tetris-launch-btn {
        top: 8px;
        right: 8px;
        padding: 6px 10px;
        font-size: 11px;
    }
}
@media (max-width: 380px) {
    #tetris-body {
        flex-direction: column;
        align-items: center;
    }
    #tetris-sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
}
