/* ============================================================
   TETRIS GAME PLUGIN — Styles
   ============================================================ */

/* ---------- Floating Button ---------- */
.tgame-float-btn {
    position: fixed;
    right: 20px;
    bottom: 80px;
    z-index: 99998;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #fff;
    border: 2px solid #e94560;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(233, 69, 96, 0.4), 0 0 0 0 rgba(233, 69, 96, 0.3);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: tgame-pulse 2.5s ease-in-out infinite;
    outline: none;
}
.tgame-float-btn:hover,
.tgame-float-btn:focus {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 8px 28px rgba(233, 69, 96, 0.6), 0 0 0 4px rgba(233, 69, 96, 0.2);
    animation: none;
}
.tgame-float-btn:active {
    transform: scale(0.96);
}
.tgame-btn-icon svg {
    display: block;
}
.tgame-btn-label {
    font-size: 10px;
    letter-spacing: 2px;
    color: #e94560;
}

@keyframes tgame-pulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(233, 69, 96, 0.4), 0 0 0 0 rgba(233, 69, 96, 0); }
    50%       { box-shadow: 0 4px 24px rgba(233, 69, 96, 0.5), 0 0 0 8px rgba(233, 69, 96, 0); }
}

/* ---------- Modal Backdrop ---------- */
.tgame-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tgame-modal[hidden] {
    display: none;
}
.tgame-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 5, 20, 0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: pointer;
}

/* ---------- Modal Window ---------- */
.tgame-modal-window {
    position: relative;
    z-index: 1;
    background: linear-gradient(160deg, #1a1a2e 0%, #12122a 100%);
    border: 2px solid #e94560;
    border-radius: 20px;
    padding: 0;
    box-shadow: 0 0 0 1px rgba(233, 69, 96, 0.3), 0 30px 80px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.07);
    overflow: hidden;
    animation: tgame-modal-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    max-width: 95vw;
    max-height: 95vh;
    width: auto;
}

@keyframes tgame-modal-in {
    from { opacity: 0; transform: scale(0.75) translateY(30px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ---------- Modal Header ---------- */
.tgame-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px 12px;
    border-bottom: 1px solid rgba(233, 69, 96, 0.3);
    background: rgba(0, 0, 0, 0.3);
}
.tgame-title {
    margin: 0;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 8px;
    font-family: 'Courier New', monospace;
    line-height: 1;
}
.tgame-title span {
    display: inline-block;
    animation: tgame-letter-bounce 2s ease-in-out infinite;
}
.tgame-title-t  { color: #FF6B6B; animation-delay: 0s;   }
.tgame-title-e  { color: #FFD93D; animation-delay: 0.1s; }
.tgame-title-t2 { color: #6BCB77; animation-delay: 0.2s; }
.tgame-title-r  { color: #4D96FF; animation-delay: 0.3s; }
.tgame-title-i  { color: #FF6B6B; animation-delay: 0.4s; }
.tgame-title-s  { color: #C77DFF; animation-delay: 0.5s; }

@keyframes tgame-letter-bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40%           { transform: translateY(-4px); }
}

.tgame-close-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(233, 69, 96, 0.15);
    border: 1px solid rgba(233, 69, 96, 0.4);
    border-radius: 8px;
    color: #e94560;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
    padding: 0;
    outline: none;
    font-family: inherit;
}
.tgame-close-btn:hover {
    background: rgba(233, 69, 96, 0.3);
    transform: rotate(90deg);
}

/* ---------- Modal Body ---------- */
.tgame-body {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
}

/* ---------- Sidebar ---------- */
.tgame-sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 90px;
    flex-shrink: 0;
}
.tgame-info-panel {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 10px 8px;
    text-align: center;
}
.tgame-info-label {
    font-size: 9px;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.5);
    font-family: 'Courier New', monospace;
    font-weight: 700;
    margin-bottom: 6px;
}
.tgame-info-value {
    font-size: 20px;
    font-weight: 900;
    color: #fff;
    font-family: 'Courier New', monospace;
    line-height: 1;
    text-shadow: 0 0 12px rgba(78, 205, 196, 0.7);
}
#tgame-next-canvas {
    display: block;
    margin: 0 auto;
    border-radius: 4px;
}
.tgame-best-panel .tgame-info-value {
    text-shadow: 0 0 12px rgba(255, 217, 61, 0.7);
    color: #FFD93D;
}

/* ---------- Controls Hint ---------- */
.tgame-controls-hint {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 10px 8px;
    font-family: 'Courier New', monospace;
    font-size: 9px;
}
.tgame-hint-title {
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 1.5px;
    font-size: 8px;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
}
.tgame-hint-row {
    display: flex;
    align-items: center;
    gap: 4px;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 4px;
    font-size: 9px;
    flex-wrap: wrap;
}
kbd {
    display: inline-block;
    padding: 1px 4px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    font-size: 8px;
    font-family: inherit;
    color: #fff;
    line-height: 1.5;
}

/* ---------- Canvas Wrapper ---------- */
.tgame-canvas-wrap {
    position: relative;
    flex-shrink: 0;
}
#tgame-canvas {
    display: block;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.08);
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* ---------- Game Overlay ---------- */
.tgame-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 25, 0.88);
    border-radius: 4px;
    transition: opacity 0.3s;
}
.tgame-overlay.tgame-hidden {
    opacity: 0;
    pointer-events: none;
}
.tgame-overlay-content {
    text-align: center;
    padding: 20px;
}
.tgame-overlay-title {
    font-family: 'Courier New', monospace;
    font-size: 32px;
    font-weight: 900;
    letter-spacing: 8px;
    background: linear-gradient(135deg, #FF6B6B, #FFD93D, #4ECDC4, #4D96FF);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    text-shadow: none;
}
.tgame-overlay-sub {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-family: 'Courier New', monospace;
    margin-bottom: 20px;
    letter-spacing: 1px;
}
.tgame-start-btn {
    display: inline-block;
    padding: 12px 28px;
    background: linear-gradient(135deg, #e94560, #c0392b);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 16px rgba(233, 69, 96, 0.4);
    outline: none;
}
.tgame-start-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 22px rgba(233, 69, 96, 0.6);
}
.tgame-start-btn:active {
    transform: scale(0.97);
}

/* ---------- Touch Controls ---------- */
.tgame-touch-controls {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 14px;
    gap: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.tgame-touch-center {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}
.tgame-touch-btn {
    width: 58px;
    height: 52px;
    background: rgba(255, 255, 255, 0.08);
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    outline: none;
}
.tgame-touch-btn:active {
    background: rgba(233, 69, 96, 0.35);
    transform: scale(0.92);
}
.tgame-touch-rotate {
    background: rgba(78, 205, 196, 0.12);
    border-color: rgba(78, 205, 196, 0.3);
    font-size: 22px;
}
.tgame-touch-drop {
    background: rgba(255, 107, 107, 0.12);
    border-color: rgba(255, 107, 107, 0.3);
    font-size: 14px;
}

/* ---------- Responsive ---------- */
@media (max-width: 520px) {
    .tgame-body {
        gap: 8px;
        padding: 10px 8px;
    }
    .tgame-sidebar {
        width: 70px;
        gap: 8px;
    }
    .tgame-info-value {
        font-size: 16px;
    }
    .tgame-controls-hint {
        display: none;
    }
    .tgame-touch-controls {
        display: flex;
    }
    .tgame-float-btn {
        right: 14px;
        bottom: 60px;
        padding: 8px 10px;
    }
}

@media (max-width: 380px) {
    .tgame-modal-window {
        border-radius: 14px;
    }
    .tgame-sidebar {
        width: 56px;
    }
    .tgame-info-panel {
        padding: 6px 4px;
    }
    .tgame-info-value {
        font-size: 13px;
    }
    .tgame-info-label {
        font-size: 7px;
        letter-spacing: 1px;
    }
    #tgame-next-canvas {
        width: 56px;
        height: 56px;
    }
}

/* ---------- Scrollbar (webkit) ---------- */
.tgame-modal-window ::-webkit-scrollbar {
    width: 4px;
}
.tgame-modal-window ::-webkit-scrollbar-track {
    background: transparent;
}
.tgame-modal-window ::-webkit-scrollbar-thumb {
    background: rgba(233, 69, 96, 0.5);
    border-radius: 2px;
}
