/* ═══════════════════════════════════════════════
   TETRIS GAME PLUGIN — tetris.css
   ═══════════════════════════════════════════════ */

/* ── Launch Button ───────────────────────────── */
#tetris-launch-btn {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 99998;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #00d4ff;
    border: 2px solid #00d4ff;
    border-radius: 8px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.4), 0 4px 16px rgba(0,0,0,0.5);
    transition: all 0.2s ease;
    text-transform: uppercase;
}
#tetris-launch-btn:hover {
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    color: #fff;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.7), 0 4px 20px rgba(0,0,0,0.6);
    transform: translateY(-1px);
}
#tetris-launch-btn:active {
    transform: translateY(0);
}
#tetris-launch-btn svg {
    flex-shrink: 0;
}

/* ── Modal Overlay ───────────────────────────── */
#tetris-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    animation: tetris-fade-in 0.18s ease;
}
#tetris-modal-overlay.tetris-open {
    display: flex;
}

@keyframes tetris-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Modal Box ───────────────────────────────── */
#tetris-modal {
    position: relative;
    background: #0d0d1a;
    border: 2px solid #00d4ff;
    border-radius: 12px;
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.3), 0 20px 60px rgba(0,0,0,0.8);
    width: 420px;
    max-width: 96vw;
    max-height: 95vh;
    overflow: hidden;
    animation: tetris-slide-up 0.22s cubic-bezier(0.34, 1.2, 0.64, 1);
    display: flex;
    flex-direction: column;
}

@keyframes tetris-slide-up {
    from { transform: translateY(30px) scale(0.96); opacity: 0; }
    to   { transform: translateY(0) scale(1);      opacity: 1; }
}

/* ── Modal Header ────────────────────────────── */
#tetris-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 10px;
    border-bottom: 1px solid rgba(0, 212, 255, 0.2);
    background: linear-gradient(90deg, #12122a 0%, #1a1a3e 100%);
}
#tetris-title {
    font-family: 'Courier New', Courier, monospace;
    font-size: 18px;
    font-weight: 700;
    color: #00d4ff;
    letter-spacing: 3px;
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.6);
}
#tetris-close-btn {
    background: transparent;
    border: 1px solid rgba(0, 212, 255, 0.4);
    color: #00d4ff;
    font-size: 22px;
    line-height: 1;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    padding: 0;
}
#tetris-close-btn:hover {
    background: #00d4ff;
    color: #0d0d1a;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

/* ── Modal Body ──────────────────────────────── */
#tetris-modal-body {
    display: flex;
    gap: 16px;
    padding: 16px;
    flex: 1;
    overflow: hidden;
}

/* ── Left Panel — Canvas ─────────────────────── */
#tetris-left-panel {
    flex-shrink: 0;
}
#tetris-canvas {
    display: block;
    border: 2px solid rgba(0, 212, 255, 0.5);
    border-radius: 4px;
    background: #050510;
    box-shadow: inset 0 0 20px rgba(0, 0, 30, 0.8), 0 0 10px rgba(0, 212, 255, 0.15);
    image-rendering: pixelated;
}

/* ── Right Panel — Info ──────────────────────── */
#tetris-right-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    min-width: 0;
}
.tetris-info-box {
    background: #12122a;
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 6px;
    padding: 8px 10px;
    text-align: center;
}
.tetris-label {
    font-family: 'Courier New', Courier, monospace;
    font-size: 10px;
    font-weight: 700;
    color: rgba(0, 212, 255, 0.6);
    letter-spacing: 2px;
    margin-bottom: 4px;
}
.tetris-value {
    font-family: 'Courier New', Courier, monospace;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 6px rgba(0, 212, 255, 0.4);
}
#tetris-next-canvas {
    display: block;
    margin: 0 auto;
    background: transparent;
}

/* ── Controls Info ───────────────────────────── */
#tetris-controls-info {
    background: #12122a;
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 6px;
    padding: 8px 10px;
    flex: 1;
}
#tetris-controls-info .tetris-label {
    margin-bottom: 6px;
}
.tetris-ctrl-row {
    font-family: 'Courier New', Courier, monospace;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.65);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
}
.tetris-ctrl-row kbd {
    background: rgba(0, 212, 255, 0.12);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 10px;
    color: #00d4ff;
    font-family: inherit;
    white-space: nowrap;
}

/* ── Start Button ────────────────────────────── */
#tetris-start-btn {
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    color: #0d0d1a;
    border: none;
    border-radius: 6px;
    padding: 10px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.4);
}
#tetris-start-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 18px rgba(0, 212, 255, 0.6);
}
#tetris-start-btn:active {
    transform: translateY(0);
}

/* ── In-game Message Overlay ─────────────────── */
#tetris-message-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(5, 5, 20, 0.88);
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 10px;
}
#tetris-message-overlay.tetris-msg-show {
    display: flex;
}
#tetris-message-box {
    text-align: center;
    padding: 28px 36px;
    background: #12122a;
    border: 2px solid #00d4ff;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.3);
}
#tetris-message-title {
    font-family: 'Courier New', Courier, monospace;
    font-size: 22px;
    font-weight: 700;
    color: #00d4ff;
    letter-spacing: 3px;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.7);
    margin-bottom: 8px;
}
#tetris-message-sub {
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 20px;
    letter-spacing: 1px;
}
#tetris-message-btn {
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    color: #0d0d1a;
    border: none;
    border-radius: 6px;
    padding: 10px 28px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.15s ease;
}
#tetris-message-btn:hover {
    box-shadow: 0 0 14px rgba(0, 212, 255, 0.5);
    transform: translateY(-1px);
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 500px) {
    #tetris-modal {
        width: 98vw;
    }
    #tetris-modal-body {
        flex-direction: column;
        align-items: center;
        overflow-y: auto;
    }
    #tetris-right-panel {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }
    .tetris-info-box {
        flex: 0 0 calc(50% - 8px);
    }
    #tetris-controls-info {
        flex: 1 0 100%;
    }
    #tetris-start-btn {
        flex: 1 0 100%;
    }
}
