/* Moving all CSS from index.html here */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter Tight', sans-serif;
}

:root {
    --primary: #C0C0C0;
    --secondary: #E8E8E8;
    --background: #000000;
    --text: #C0C0C0;
    --card-shadow: 0 10px 20px rgba(192, 192, 192, 0.2);
    --neon-glow: 0 0 15px rgba(192, 192, 192, 0.7);
    --glow-color: rgba(192, 192, 192, 1);
    --glow-color-60: rgba(192, 192, 192, 0.6);
    --glow-color-40: rgba(192, 192, 192, 0.4);
}

body {
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
    background-image: 
        linear-gradient(45deg, rgba(0, 191, 255, 0.05) 1px, transparent 1px),
        linear-gradient(-45deg, rgba(0, 191, 255, 0.05) 1px, transparent 1px);
    background-size: 30px 30px;
    position: relative;
    overflow-x: hidden;
    min-width: 320px; /* Minimum supported width */
}

header {
    background: linear-gradient(135deg, rgba(0,0,0,0.9), rgba(0,0,0,0.7));
    border-bottom: 2px solid var(--primary);
    box-shadow: 0 0 20px rgba(192,192,192,0.3);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(192, 192, 192, 0.5);
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
    color: var(--secondary);
}

.filter-bar {
    background: rgba(0,0,0,0.9);
    border-bottom: 1px solid var(--primary);
    padding: 1.5rem;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
}

.filter-bar input {
    width: 100%;
    max-width: 600px;
    padding: 1rem 1.5rem;
    border: 2px solid var(--primary);
    border-radius: 1rem;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    display: block;
    margin: 0 auto;
    background: rgba(0,0,0,0.8);
    color: var(--primary);
}

.filter-bar input:focus {
    outline: none;
    box-shadow: 0 0 15px rgba(232,232,232,0.5);
}

.filter-bar select {
    display: none;
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropbtn {
    background-color: rgba(0,0,0,0.8);
    color: var(--primary);
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    border: 2px solid var(--primary);
    border-radius: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 160px;
    text-align: center;
    appearance: none;
}

.dropbtn:focus {
    outline: none;
    box-shadow: 0 0 15px rgba(232,232,232,0.5);
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: rgba(0,0,0,0.9);
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border: 1px solid var(--primary);
    border-radius: 0.5rem;
    right: 0;
}

.dropdown-content a {
    color: var(--primary);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    transition: all 0.3s ease;
}

.dropdown-content a:hover {
    background-color: var(--primary);
    color: var(--background);
}

.dropdown:hover .dropdown-content {
    display: block;
}

.games-grid {
    display: none;
}

.games-grid.visible {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); /* Reduced from 350px */
    grid-auto-rows: max-content;
    align-items: start;
    gap: 2.5rem;
    padding: 3rem;
    max-width: 1600px;
    margin: 0 auto;
}

.games-grid.loading {
    position: relative;
    min-height: 200px;
}

.games-grid.loading::after {
    content: "🎮";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    color: var(--primary);
    animation: spin 1s linear infinite;
    text-shadow: 0 0 20px rgba(192,192,192,0.8);
}

.games-grid.loading::before {
    content: "Loading games...";
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    background: var(--primary);
    color: var(--background);
    padding: 1rem 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 0 20px rgba(192,192,192,0.4);
    text-shadow: 0 0 5px rgba(0,0,0,0.5);
    animation: pulse 1.5s infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.game-card {
    background: rgba(0,0,0,0.8);
    border: 1px solid var(--primary);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--card-shadow);
    position: relative;
    backdrop-filter: blur(5px);
    will-change: transform;
    transform: translateZ(0);
    width: 100%; /* Ensure full width within grid cell */
    max-width: 100%; /* Prevent overflow */
}

.game-card:hover {
    border-color: var(--secondary);
    box-shadow: 0 0 80px var(--glow-color), 0 0 60px var(--glow-color), 0 0 40px var(--glow-color), 0 0 25px var(--glow-color), 0 0 15px var(--glow-color), 0 0 10px var(--glow-color);
    transform: translate3d(0, -8px, 0);
}

@media (max-width: 768px) {
    .game-card:hover {
        box-shadow: 0 0 25px var(--glow-color-60), 0 0 15px var(--glow-color-40);
        animation: none;
    }
}

.game-thumbnail {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-bottom: 2px solid var(--primary);
    display: block; /* Ensure proper display */
}

.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--primary);
    box-shadow: 0 0 15px rgba(192,192,192,0.5);
    color: var(--background);
    padding: 1rem 2.5rem;
    border-radius: 2rem;
    font-weight: 700;
    opacity: 0;
    transition: all 0.3s ease;
    cursor: pointer;
    font-size: 1.1rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    z-index: 2;
    text-shadow: 0 0 5px rgba(232,232,232,0.5);
    will-change: opacity, transform;
}

.game-card:hover .play-button {
    opacity: 1;
}

.game-card:hover .game-thumbnail {
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); 
    width: 90%;
    height: auto;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 90vh;
    background: rgba(0,0,0,0.95);
    border: 2px solid var(--primary);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(192,192,192,0.4);
    padding-bottom: 4rem;
    will-change: transform;
    margin: 0 auto;
}

#videoModal .modal-content {
    background: rgba(0,0,0,0.95);
    border: 2px solid var(--primary);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(192,192,192,0.4);
    padding: 1rem;
}

#videoModal .close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 1002;
}

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 85vh;
        aspect-ratio: 16 / 9;
        animation: none;
        box-shadow: 0 0 15px rgba(192,192,192,0.3);
        border-radius: 0.5rem;
        padding-bottom: 3rem;
    }
    
    .modal-game-frame {
        height: calc(100% - 3rem);
    }
}

@media (max-width: 480px) {
    .modal-content {
        width: 98%;
        max-height: 80vh;
        aspect-ratio: 16 / 9;
        border-radius: 0.5rem;
        padding-bottom: 3rem;
    }
    
    .modal-controls {
        padding: 0.5rem;
        gap: 1rem;
        flex-wrap: wrap;
    }
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--primary);
    border: none;
    color: var(--background);
    font-size: 1.5rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.close-modal:hover {
    background: var(--secondary);
}

.modal-game-frame {
    width: 100%;
    height: calc(100% - 4rem);
    border: none;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}

.modal-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.95);
    padding: 0.75rem;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    border-top: 1px solid var(--primary);
}

.control-button {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-button:hover {
    background: var(--primary);
    color: var(--background);
    box-shadow: 0 0 10px rgba(192,192,192,0.5);
}

.control-button i {
    width: 1.5rem;
    text-align: center;
}

.volume-slider {
    width: 100px;
    margin-left: 0.5rem;
    accent-color: var(--primary);
}

@media (max-width: 768px) {
    .games-grid {
        grid-template-columns: 1fr;
        padding: 1.5rem;
    }
    
    header {
        padding: 2rem 1rem;
    }
    
    header h1 {
        font-size: 2rem;
    }

    .filter-bar {
        position: relative;
        top: auto;
    }

    .filter-bar input {
        max-width: 80%; /* Shrink the search bar on mobile */
    }
}

@media (max-width: 768px) {
    .filter-bar {
        order: 2; /* Moves the search bar below the menu toggle on mobile */
        margin-top: 1rem; /* Adds some space between the menu toggle and the search bar */
    }

    .menu-toggle {
        position: relative; /* Adjust positioning context for the menu toggle */
        top: auto;
        left: auto;
        margin-left: auto;
        margin-right: auto;
        order: 1; /* Ensures the menu toggle is above the search bar */
    }
}

.game-info {
    padding: 1.5rem;
    color: var(--text);
}

.game-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--primary);
    text-shadow: 0 0 5px rgba(192, 192, 192, 0.3);
}

.game-description {
    font-size: 0.9rem;
    color: var(--text);
    opacity: 0.9;
    margin-bottom: 1rem;
}

.game-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.source-badge-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.source-badge {
    display: inline-block;
    background: var(--primary);
    color: var(--background);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.favorite-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1.1rem;
    color: var(--text);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.favorite-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.favorite-btn.active {
    color: #ff4444;
}

.favorite-btn i {
    transition: all 0.2s ease;
}

.favorite-btn:active i {
    transform: scale(0.9);
}

.rating-component {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    text-align: right;
}

.stars {
    color: #ffd700;
    font-size: 0.9rem;
    display: flex;
    gap: 0.1rem;
}

.stars i {
    text-shadow: 0 0 3px rgba(255, 215, 0, 0.5);
}

.review-count {
    font-size: 0.7rem;
    color: var(--text);
    opacity: 0.7;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .game-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .rating-component {
        align-items: flex-end;
        align-self: flex-end;
        text-align: right;
    }
}

.loading-message {
    position: absolute;
    top: -40px;
    left: 0;
    right: 0;
    text-align: center;
    color: var(--primary);
    text-shadow: 0 0 5px rgba(232,232,232,0.5);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.poker-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.poker-elements {
    position: fixed;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.controller {
    position: absolute;
    opacity: 0;
    animation: float 15s infinite ease-in-out;
    font-size: 80px;
    color: var(--primary);
    text-shadow: 0 0 20px rgba(192,192,192,0.5);
    filter: drop-shadow(0 0 10px rgba(192,192,192,0.3));
    will-change: transform, opacity;
    transform: translateZ(0);
    z-index: -1;
}

@media (max-width: 768px) {
    .controller {
        font-size: 40px;
        opacity: 0.3; /* Make visible on mobile but subtle */
    }
}

@keyframes float {
    0% { 
        transform: translateY(0) rotate(0deg) scale(0.8); 
        opacity: 0; 
    }
    15% { 
        opacity: 0.6; 
    }
    25% { 
        transform: translateY(-100px) rotate(90deg) scale(1);
        opacity: 0.8;
    }
    50% { 
        transform: translateY(-200px) rotate(180deg) scale(1.2);
        opacity: 0.4;
    }
    75% { 
        transform: translateY(-100px) rotate(270deg) scale(1);
        opacity: 0.8;
    }
    85% { 
        opacity: 0.6; 
    }
    100% { 
        transform: translateY(0) rotate(360deg) scale(0.8); 
        opacity: 0; 
    }
}

/* Title Screen Background Animation */
.title-poker-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.title-poker-elements {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.title-controller {
    position: absolute;
    opacity: 0;
    animation: titleFloat 15s infinite ease-in-out;
    font-size: 100px;
    color: var(--primary);
    text-shadow: 0 0 30px rgba(192,192,192,0.8);
    filter: drop-shadow(0 0 15px rgba(192,192,192,0.5));
    will-change: transform, opacity;
    transform: translateZ(0);
    z-index: -1;
}

@media (max-width: 768px) {
    .title-controller {
        font-size: 60px;
        opacity: 0.4;
    }
}

@keyframes titleFloat {
    0% { 
        transform: translateY(0) rotate(0deg) scale(0.6); 
        opacity: 0; 
    }
    10% { 
        opacity: 0.8; 
    }
    25% { 
        transform: translateY(-150px) rotate(90deg) scale(1.2);
        opacity: 1;
    }
    50% { 
        transform: translateY(-300px) rotate(180deg) scale(1.5);
        opacity: 0.6;
    }
    75% { 
        transform: translateY(-150px) rotate(270deg) scale(1.2);
        opacity: 1;
    }
    90% { 
        opacity: 0.8; 
    }
    100% { 
        transform: translateY(0) rotate(360deg) scale(0.6); 
        opacity: 0; 
    }
}

h1 img {
    display: none;
}

.site-logo {
    display: none;
}

/* Side menu */
.side-menu {
    position: fixed;
    top: 0;
    right: -250px;
    width: 250px;
    height: 100%;
    background: rgba(0,0,0,0.9);
    border-left: 1px solid var(--primary);
    z-index: 50;
    transition: right 0.3s ease;
    padding-top: 3rem;
}

.side-menu.open {
    right: 0;
}

.genre-list {
    padding: 1rem;
}

.genre-list a {
    display: block;
    color: var(--primary);
    padding: 0.75rem 1rem;
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 0.5rem;
}

.genre-list a:hover {
    background-color: var(--primary);
    color: var(--background);
}

.theme-toggle {
    position: fixed;
    top: 1rem;
    right: calc(1rem + 140px);
    background: var(--primary);
    border: none;
    color: var(--background);
    width: auto;
    padding: 0.5rem 1rem;
    height: auto;
    border-radius: 0.5rem;
    cursor: pointer;
    z-index: 52;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.theme-toggle:hover {
    background: var(--secondary);
    box-shadow: 0 0 15px var(--glow-color-60);
}

.menu-toggle {
    position: fixed; 
    top: 1rem;
    right: 1rem;
    background: var(--primary);
    border: none;
    color: var(--background);
    width: auto;
    padding: 0.5rem 1rem;
    height: auto;
    border-radius: 0.5rem;
    cursor: pointer;
    z-index: 51;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 600;
}

.menu-toggle:hover {
    background: var(--secondary);
}

.side-menu.open + .menu-toggle::before {
    content: '\00d7 Genres'; 
}

.menu-toggle::before {
    content: 'Genres'; 
}

/* App Menu Styles */
.app-menu-button {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 51;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    /* Theming for app menu */
    color: var(--text);
}

.app-menu-button-icon {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.app-menu-button-icon span {
    display: block;
    width: 30px;
    height: 3px;
    margin: 3px 0;
    background-color: var(--text);
    transition: 0.3s;
}

.app-menu-button.active .app-menu-button-icon span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.app-menu-button.active .app-menu-button-icon span:nth-child(2) {
    opacity: 0;
}

.app-menu-button.active .app-menu-button-icon span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

.app-menu-button-text {
    color: var(--text);
    font-size: 1rem;
    font-weight: bold;
    transition: 0.3s;
}

.app-menu-button.active .app-menu-button-text {
    opacity: 0;
}

.app-side-panel {
    position: fixed;
    left: -300px;
    top: 0;
    width: 300px;
    height: 100vh;
    background: var(--background);
    transition: 0.3s;
    z-index: 50;
    padding-top: 3rem;
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    /* Theming for side panel */
    border-right: 1px solid var(--primary);
}

.app-side-panel.open {
    left: 0;
}

.menu-clock {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text);
    font-family: 'Inter Tight', monospace;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    letter-spacing: 0.05em;
}

.app-side-panel.open .menu-clock {
    opacity: 0.8;
}

.app-menu-item {
    display: block;
    width: 100%;
    padding: 1rem;
    color: var(--text);
    text-decoration: none;
    font-size: 1rem;
    border: none;
    background: none;
    cursor: pointer;
    transition: 0.3s;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* Theming for app menu items */
}

.app-menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.settings-dropdown {
    position: relative;
    display: inline-block;
    width: 100%;
    text-align: left;
}

.settings-options {
    display: none;
    position: absolute;
    left: 0;
    width: 100%;
    background: rgba(20, 20, 20, 0.95);
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
}

.settings-dropdown:hover .settings-options {
    display: block;
}

.settings-options .app-menu-item {
    padding-left: 2rem;
}

.play-game {
    background: linear-gradient(45deg, #00a74a, #9f0f17, #cca707, #094a8f);
    background-size: 200% 200%;
    animation: gradient 5s ease infinite;
}

.new-game {
    background: linear-gradient(45deg, #094a8f, #00a74a);
    background-size: 200% 200%;
    animation: gradient 5s ease infinite;
}

@keyframes gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Splash Screen Styles */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1002;
    cursor: pointer;
    transition: opacity 0.5s ease;
}

.splash-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Title Screen Styles */
.title-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--background);
    color: var(--text);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1001;
    text-align: center;
}

.title-screen h1 {
    font-size: 5rem;
    margin-bottom: 2rem;
    text-shadow: 0 0 20px rgba(192, 192, 192, 0.8);
    animation: neonGlow 2s infinite alternate;
}

.title-logo {
    max-width: 600px;
    width: 80%;
    height: auto;
    margin-bottom: 2rem;
    filter: drop-shadow(0 0 20px rgba(192, 192, 192, 0.8));
    animation: neonGlow 2s infinite alternate;
}

@keyframes neonGlow {
    from {
        text-shadow: 0 0 10px rgba(192, 192, 192, 0.8);
    }
    to {
        text-shadow: 0 0 20px rgba(192, 192, 192, 1),
                     0 0 30px rgba(192, 192, 192, 0.8);
    }
}

.enter-button {
    background: var(--primary);
    color: var(--background);
    padding: 1.5rem 3rem;
    border: none;
    border-radius: 3rem;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(192, 192, 192, 0.5);
    font-weight: bold;
    margin-top: 2rem; /* Pushes the button down from the logo */
    transform: translateY(-100px); /* Moves the button up */
}

.enter-button:hover {
    background: var(--secondary);
    color: var(--background);
    box-shadow: 0 0 25px rgba(232, 232, 232, 0.7);
}

/* Fullscreen Button Styles */
.fullscreen-button {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    z-index: 999;
}

.fullscreen-button:hover {
    background: var(--primary);
    color: var(--background);
    box-shadow: 0 0 10px rgba(192, 192, 192, 0.5);
}

.theme-options {
    display: flex;
    flex-wrap: wrap; /* Allow buttons to wrap to the next line */
    justify-content: center; /* Center the buttons horizontally */
    gap: 1rem; /* Add some space between the buttons */
    width: 80%; /* Limit the width of the container */
    max-width: 600px; /* Set a maximum width */
    margin: 0 auto; /* Center the container */
}

.theme-button {
    padding: 1rem 1.5rem; /* Increase padding for bigger buttons */
    font-size: 1.2rem; /* Increase font size for bigger text */
    border-radius: 0.75rem; /* Round the corners a bit more */
    cursor: pointer;
    border: none;
    background: var(--primary);
    color: var(--background);
    box-shadow: 0 0 10px rgba(192, 192, 192, 0.5);
    transition: all 0.3s ease;
}

.theme-button:hover {
    background: var(--secondary);
    box-shadow: 0 0 15px rgba(232, 232, 232, 0.7);
}

/* Gamepad Focus Styles */
.gamepad-focused {
    outline: 3px solid var(--primary) !important;
    outline-offset: 3px;
    border-radius: 8px;
    box-shadow: 0 0 20px var(--glow-color), 0 0 40px var(--glow-color-60) !important;
    position: relative;
    z-index: 10;
}

.gamepad-focused::after {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    border: 2px solid var(--primary);
    border-radius: 12px;
    pointer-events: none;
    animation: focusPulse 1.5s infinite ease-in-out;
}

@keyframes focusPulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.02); }
}

/* Gamepad Prompts */
.gamepad-prompts {
    position: fixed;
    bottom: 20px;
    left: 20px;
    transform: none;
    display: flex;
    gap: 20px;
    background: rgba(0, 0, 0, 0.9);
    padding: 15px 25px;
    border-radius: 10px;
    border: 1px solid var(--primary);
    z-index: 1000;
    opacity: 0;
    animation: slideUpFade 0.5s ease-out forwards;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.prompt-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.button-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 14px;
    color: var(--background);
    background: var(--primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.button-icon.xbox {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.button-icon.playstation {
    font-family: 'PlayStation Icons', 'Segoe UI', sans-serif;
}

.prompt-text {
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
}

/* Hide prompts when gamepad is not active */
body:not(.gamepad-active) .gamepad-prompts {
    display: none;
}

/* Enhanced focus for game cards */
.game-card.gamepad-focused {
    transform: translate3d(0, -12px, 0) scale(1.02);
    box-shadow: 0 0 30px var(--glow-color), 0 0 60px var(--glow-color-60), 0 0 90px var(--glow-color-40);
}

/* Enhanced focus for buttons */
button.gamepad-focused,
.app-menu-item.gamepad-focused {
    background: var(--primary) !important;
    color: var(--background) !important;
    transform: scale(1.05);
}

/* Enhanced focus for theme buttons */
.theme-button.gamepad-focused {
    transform: scale(1.1);
    box-shadow: 0 0 25px var(--glow-color);
}

/* Enhanced focus for genre links */
.genre-list a.gamepad-focused {
    background: var(--primary) !important;
    color: var(--background) !important;
    transform: translateX(10px);
}

/* Modal gamepad focus adjustments */
.modal .gamepad-focused {
    z-index: 1002;
}

/* Smooth transitions for all focusable elements */
button, .app-menu-item, .theme-button, .genre-list a, .game-card {
    transition: all 0.2s ease;
}

/* Collapse the slot completely if nothing can render */
.ad-container[data-state="collapsed"] {
    display: none !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
}

/* Sponsored fallback card (CyberForge promo) */
.sponsored-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: stretch;
}

.sponsored-card {
    --accent: var(--primary);
    width: 100%;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, rgba(0,0,0,0.92), rgba(20,20,30,0.85));
    border: 1px solid var(--accent);
    border-radius: 4px;
    overflow: hidden;
    text-align: left;
    color: var(--text);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    min-height: 240px;
}

.sponsored-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 28px var(--glow-color-60), 0 0 14px var(--glow-color-40);
    border-color: var(--secondary);
}

.sponsored-card-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: rgba(255,255,255,0.04);
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.sponsored-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.sponsored-card:hover .sponsored-card-thumb img {
    transform: scale(1.06);
}

.sponsored-card.no-thumb .sponsored-card-thumb {
    display: none;
}

.sponsored-card-body {
    padding: 0.9rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.sponsored-card-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--accent);
    opacity: 0.85;
    font-weight: 600;
}

.sponsored-card-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.25;
}

.sponsored-card-desc {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--text);
    opacity: 0.8;
    flex: 1;
}

.sponsored-card-cta {
    align-self: flex-start;
    margin-top: 0.25rem;
    padding: 0.55rem 1rem;
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-decoration: none;
    border-radius: 2px;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
}

.sponsored-card-cta:hover,
.sponsored-card-cta:focus-visible {
    background: var(--accent);
    color: var(--background);
    transform: translateY(-1px);
    outline: none;
}

.sponsored-label {
    font-weight: 600;
    letter-spacing: 0.05em;
}

/* AdSense Integration Styles */
.ad-container {
    background: rgba(0,0,0,0.8);
    border: 1px solid var(--primary);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--card-shadow);
    position: relative;
    backdrop-filter: blur(5px);
    will-change: transform;
    transform: translateZ(0);
    width: 100%;
    max-width: 100%;
    align-self: start;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.ad-container:hover {
    border-color: var(--secondary);
    box-shadow: 0 0 40px var(--glow-color-60), 0 0 25px var(--glow-color-40);
    transform: translate3d(0, -4px, 0);
}

.ad-header {
    padding: 1rem;
    background: rgba(0,0,0,0.9);
    width: 100%;
    text-align: center;
    border-bottom: 1px solid var(--primary);
    color: var(--text);
    font-size: 0.9rem;
    opacity: 0.8;
    font-weight: 500;
}

.ad-content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    width: 100%;
    height: 260px;
}

.ad-content .adsbygoogle {
    width: 100% !important;
    height: auto !important;
    max-width: 300px;
    max-height: 250px;
    margin: 0 auto;
}

/* Responsive ad adjustments */
@media (max-width: 768px) {
    .ad-container {
        min-height: 280px;
    }
    
    .ad-content {
        min-height: 200px;
        padding: 0.5rem;
    }
    
    .ad-content .adsbygoogle {
        max-width: 280px;
        max-height: 200px;
    }
    
    .ad-container:hover {
        box-shadow: 0 0 20px var(--glow-color-60), 0 0 12px var(--glow-color-40);
        transform: translate3d(0, -2px, 0);
    }
}

@media (max-width: 480px) {
    .ad-container {
        min-height: 260px;
    }
    
    .ad-content {
        min-height: 180px;
    }
    
    .ad-content .adsbygoogle {
        max-width: 260px;
        max-height: 180px;
    }
}

/* Mobile adjustments for theme toggle */
@media (max-width: 768px) {
    .theme-toggle {
        top: 1rem;
        right: calc(1rem + 125px);
        padding: 0.5rem 0.8rem;
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .theme-toggle {
        right: calc(1rem + 110px);
        padding: 0.4rem 0.7rem;
        font-size: 1rem;
    }
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 480px) {
    .games-grid.visible {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1rem;
    }
    
    .game-card {
        margin: 0 auto;
        max-width: 100%;
    }
    
    .game-thumbnail {
        height: 200px;
    }
    
    .filter-bar {
        padding: 1rem;
        margin-top: 3rem;
    }
    
    .filter-bar input {
        width: 100%;
        max-width: 100%;
        font-size: 1rem;
        padding: 0.8rem 1rem;
    }
    
    .modal-content {
        width: 95%;
        height: 95%;
        border-radius: 0.5rem;
        padding-bottom: 3rem;
    }
    
    .modal-controls {
        padding: 0.5rem;
        gap: 1rem;
        flex-wrap: wrap;
    }
    
    .control-button {
        font-size: 1rem;
        padding: 0.4rem;
    }
    
    .volume-slider {
        width: 80px;
    }
    
    .title-screen h1 {
        font-size: 3rem;
        margin-bottom: 1.5rem;
    }
    
    .enter-button {
        padding: 1rem 2rem;
        font-size: 1.2rem;
    }
    
    .side-menu {
        width: 200px;
        right: -200px;
    }
    
    .app-side-panel {
        width: 250px;
        left: -250px;
    }
}

/* Tablet Responsiveness */
@media (min-width: 481px) and (max-width: 768px) {
    .games-grid.visible {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 2rem;
        padding: 2rem;
    }
    
    .game-thumbnail {
        height: 220px;
    }
    
    .filter-bar {
        padding: 1.2rem;
    }
    
    .filter-bar input {
        max-width: 90%;
    }
    
    .modal-content {
        width: 92%;
        height: 92%;
    }
    
    .title-screen h1 {
        font-size: 4rem;
    }
}

/* Large Tablet/Small Desktop */
@media (min-width: 769px) and (max-width: 1024px) {
    .games-grid.visible {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 2.2rem;
        padding: 2.5rem;
    }
    
    .filter-bar input {
        max-width: 70%;
    }
}

/* Ensure images never overflow their containers */
img {
    max-width: 100%;
    height: auto;
}

/* Fix potential text overflow issues */
.game-title, .game-description {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Enhanced focus handling for touch devices */
@media (hover: none) and (pointer: coarse) {
    .game-card:hover {
        transform: none;
        box-shadow: var(--card-shadow);
    }
    
    .play-button {
        opacity: 1;
        position: static;
        transform: none;
        margin-top: 1rem;
        width: 100%;
    }
    
    .game-card:hover .game-thumbnail {
        opacity: 1;
    }
}

/* Enhanced focus for the last control button in the game modal */
.control-button:nth-last-child(1).gamepad-focused {
    background: var(--primary) !important;
    color: var(--background) !important;
    box-shadow: 0 0 15px var(--glow-color);
}

/* Favorites Toast */
.favorites-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: rgba(0, 0, 0, 0.95);
    color: var(--text);
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 0 20px var(--glow-color-40);
    font-size: 0.95rem;
    z-index: 10000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.favorites-toast.show {
    opacity: 1;
    transform: translateY(0);
    animation: toastSlideIn 0.3s ease-out;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Favorites Badge */
.favorites-badge {
    display: inline-block;
    background: var(--primary);
    color: var(--background);
    padding: 0.15rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
    min-width: 20px;
    text-align: center;
}

/* Favorites Empty State */
.favorites-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    color: var(--text);
    gap: 1.5rem;
}

.favorites-empty-state i {
    font-size: 5rem;
    color: var(--primary);
    opacity: 0.5;
    animation: heartbeat 2s infinite;
}

@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.favorites-empty-state h2 {
    font-size: 2rem;
    margin: 0;
    text-shadow: 0 0 10px var(--glow-color-40);
}

.favorites-empty-state p {
    font-size: 1.1rem;
    opacity: 0.8;
    max-width: 400px;
}

@media (max-width: 768px) {
    .favorites-toast {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        text-align: center;
    }
    
    .favorites-empty-state i {
        font-size: 3.5rem;
    }
    
    .favorites-empty-state h2 {
        font-size: 1.5rem;
    }
    
    .favorites-empty-state p {
        font-size: 1rem;
    }
}