/**
 * TechHub Theme - Game Runner & Interactive Web Player Styles
 * Phục vụ trải nghiệm chơi game lập trình, canvas/WebGL và web games giáo dục trực tiếp.
 */

.th-game-container {
    background: #0f172a;
    border-radius: var(--wp--preset--spacing--md);
    overflow: hidden;
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    margin-bottom: var(--wp--preset--spacing--xl);
}

/* Khung màn hình game (Đảm bảo chiều cao rộng rãi và không bị co iframe) */
.th-game-viewport {
    position: relative;
    width: 100%;
    height: 640px;
    min-height: 550px;
    background: #020617;
    overflow: hidden;
    display: block;
}

@media (max-width: 768px) {
    .th-game-viewport {
        height: 480px;
        min-height: 400px;
    }
}

.th-game-iframe {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 100% !important;
    min-height: 100% !important;
    border: none !important;
    display: block !important;
    background: #ffffff;
}

/* Màn hình chờ trước khi bắt đầu (Lazy Play Poster) */
.th-game-poster {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 27, 75, 0.95));
    backdrop-filter: blur(8px);
    z-index: 10;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    text-align: center;
    padding: 2rem;
}

.th-game-poster.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.th-game-play-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2.25rem;
    background: linear-gradient(135deg, var(--wp--preset--color--purple-ai), var(--wp--preset--color--blue-electric));
    color: #ffffff;
    font-size: 1.15rem;
    font-weight: 700;
    border-radius: 9999px;
    border: none;
    cursor: pointer;
    box-shadow: 0 0 25px rgba(124, 58, 237, 0.5);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
}

.th-game-play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 35px rgba(124, 58, 237, 0.7);
}

.th-game-poster-hint {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: #94a3b8;
}

/* Thanh điều khiển game bar dưới khung hình */
.th-game-controls-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    background: #1e293b;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.th-game-meta-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.th-game-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.th-game-status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.th-game-title-bar {
    font-size: 0.95rem;
    font-weight: 600;
    color: #f1f5f9;
}

.th-game-action-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.th-game-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, transform 0.15s;
}

.th-game-btn-icon:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    transform: translateY(-1px);
}

/* Bảng hướng dẫn phím bấm (Controls Guide) */
.th-game-guide-box {
    background: var(--wp--preset--color--card-bg);
    border: 1px solid var(--wp--preset--color--border-light);
    border-radius: var(--wp--preset--spacing--md);
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.th-game-guide-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.th-game-keys-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.th-game-key-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--wp--preset--color--text-muted);
}

.th-game-kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    padding: 0.25rem 0.5rem;
    font-family: var(--wp--preset--font-family--code);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--wp--preset--color--text-main);
    background: var(--wp--preset--color--background-alt);
    border: 1px solid var(--wp--preset--color--border-light);
    border-bottom: 2px solid var(--wp--preset--color--border-light);
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Trạng thái toàn màn hình */
:fullscreen,
:-webkit-full-screen {
    width: 100vw !important;
    height: 100vh !important;
}

:fullscreen .th-game-viewport,
.th-game-viewport:fullscreen,
:-webkit-full-screen .th-game-viewport,
.th-game-viewport:-webkit-full-screen {
    width: 100vw !important;
    height: 100vh !important;
    min-height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
}

:fullscreen .th-game-iframe,
.th-game-viewport:fullscreen .th-game-iframe,
:-webkit-full-screen .th-game-iframe,
.th-game-viewport:-webkit-full-screen .th-game-iframe {
    width: 100vw !important;
    height: 100vh !important;
    min-height: 100vh !important;
}
