/* Poki & CrazyGames Live Feed Arcade UI */
:root {
    --bg-dark: #080c16;
    --bg-header: #0f172a;
    --bg-card: #131c31;
    --bg-card-hover: #1e2945;
    --primary: #38bdf8;
    --primary-glow: rgba(56, 189, 248, 0.35);
    --accent-red: #ff3b30;
    --accent-purple: #a855f7;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.08);
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-heading: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Header */
header {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.brand-icon {
    font-size: 26px;
}

.brand-title {
    font-family: var(--font-heading);
    font-size: 19px;
    font-weight: 900;
    background: linear-gradient(135deg, #38bdf8, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.search-wrapper {
    flex: 1;
    max-width: 480px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-wrapper svg {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-wrapper input {
    width: 100%;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    padding: 9px 14px 9px 40px;
    border-radius: 30px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

.search-wrapper input:focus {
    border-color: var(--primary);
    background: #0f172a;
    box-shadow: 0 0 15px var(--primary-glow);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-pill {
    background: linear-gradient(135deg, #a855f7, #6366f1);
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.15s ease;
}

.action-pill:hover {
    transform: scale(1.04);
}

.badge-count {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

/* Main */
main {
    flex: 1;
    max-width: 1360px;
    width: 100%;
    margin: 0 auto;
    padding: 20px 24px;
}

/* Category Navigation */
.category-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 12px;
    margin-bottom: 20px;
    scrollbar-width: none;
}
.category-bar::-webkit-scrollbar { display: none; }

.cat-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.cat-btn:hover {
    background: var(--bg-card-hover);
    color: #ffffff;
}

.cat-btn.active {
    background: #38bdf8;
    color: #080c16;
    font-weight: 900;
    border-color: #38bdf8;
    box-shadow: 0 0 16px var(--primary-glow);
}

/* Games Grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 16px;
}

.game-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    position: relative;
}

.game-card:hover {
    transform: translateY(-5px);
    border-color: rgba(56, 189, 248, 0.5);
    box-shadow: 0 12px 24px -4px rgba(0, 0, 0, 0.6), 0 0 16px rgba(56, 189, 248, 0.25);
    background: var(--bg-card-hover);
}

.game-poster {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    background: #0f172a;
    display: block;
}

.card-cat-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #38bdf8;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
}

.game-info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.game-title {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-desc {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.play-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.play-action-text {
    font-size: 11px;
    font-weight: 800;
    color: #38bdf8;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Load More Trigger */
.load-more-box {
    display: flex;
    justify-content: center;
    padding: 30px 0;
}

.loading-dot {
    width: 8px;
    height: 8px;
    background: #38bdf8;
    border-radius: 50%;
    box-shadow: 0 0 10px #38bdf8;
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    0% { transform: scale(0.8); opacity: 0.4; }
    100% { transform: scale(1.6); opacity: 1; }
}

/* Theater Mode Game Stage Modal */
.game-modal {
    position: fixed;
    inset: 0;
    background: rgba(6, 9, 19, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 100;
    display: flex;
    flex-direction: column;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.game-modal.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.modal-header {
    height: 58px;
    background: #0f172a;
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-game-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-game-thumb {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--border);
}

.modal-game-title {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 800;
    color: #ffffff;
}

.modal-game-cat {
    font-size: 11px;
    color: #38bdf8;
    font-weight: 700;
}

.modal-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
    color: #ffffff;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s ease;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}

.control-btn.close {
    background: rgba(255, 59, 48, 0.2);
    color: #ff3b30;
    border-color: rgba(255, 59, 48, 0.4);
}

.control-btn.close:hover {
    background: rgba(255, 59, 48, 0.4);
}

.modal-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.iframe-container {
    width: 100%;
    max-width: 1020px;
    height: 100%;
    max-height: 640px;
    background: #000000;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.game-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Mobile */
@media (max-width: 768px) {
    header {
        padding: 10px 14px;
        flex-wrap: wrap;
    }
    .brand-title { font-size: 16px; }
    .search-wrapper { order: 3; max-width: 100%; min-width: 100%; }
    main { padding: 14px; }
    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
    .modal-body { padding: 0; }
    .iframe-container { max-height: 100%; border-radius: 0; border: none; }
}
