/* ==========================================================================
   ourgames.org Design System & Stylesheet (Poki Neo-Brutalist Style)
   ========================================================================== */

/* --- CSS Variables & Design Tokens --- */
:root {
    --bg-primary: #f8f6fc; /* Warm soft lavender-cream for children's comfort */
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #fafcff;
    
    --primary-color: #ff4b91; /* Playful Candy Pink */
    --primary-glow: rgba(255, 75, 145, 0.2);
    --secondary-color: #38bdf8; /* Playful Sky Blue */
    --accent-orange: #ff8400; /* Playful Orange */
    --accent-yellow: #facc15; /* Playful Yellow */
    --accent-green: #4ade80; /* Playful Green */
    
    --text-primary: #2d1a47; /* Deep grape/navy for warm readability */
    --text-secondary: #4a3b68;
    --text-muted: #8b7fa4;
    
    --border-color: #2d1a47; /* Friendly deep grape borders instead of harsh black */
    --border-width: 3px;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --shadow-flat-sm: 3px 3px 0px #2d1a47;
    --shadow-flat-md: 5px 5px 0px #2d1a47;
    --shadow-flat-lg: 8px 8px 0px #2d1a47;
    
    --font-primary: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-secondary: 'Montserrat', sans-serif;
    
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Base Resets & Global Styles --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    min-height: 100vh;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-primary);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body {
    display: flex;
    flex-direction: column;
}

a {
    color: inherit;
    text-decoration: none;
}

button, input {
    font-family: inherit;
    color: inherit;
    border: none;
    outline: none;
    background: none;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* --- Application Layout --- */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: radial-gradient(circle at top right, rgba(56, 189, 248, 0.15), transparent 50%),
                radial-gradient(circle at 10% 80%, rgba(255, 75, 145, 0.1), transparent 40%);
}

.app-layout {
    display: flex;
    flex: 1;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px;
    gap: 24px;
}

.app-main {
    flex: 1;
    min-width: 0;
}

/* --- Header Component --- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background-color: #ffffff;
    border-bottom: var(--border-width) solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-center {
    flex: 0 1 500px;
    margin: 0 16px;
}

/* Logo */
.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}
.logo-icon {
    color: var(--primary-color);
    filter: drop-shadow(2px 2px 0px var(--border-color));
    transition: transform var(--transition-normal);
}
.logo-area:hover .logo-icon {
    transform: rotate(-10deg) scale(1.1);
}
.logo-text {
    font-size: 24px;
    font-weight: 800;
    font-family: var(--font-secondary);
    letter-spacing: -0.5px;
    color: var(--text-primary);
}
.logo-dot {
    color: var(--primary-color);
}

/* Search Box */
.search-box {
    display: flex;
    align-items: center;
    width: 100%;
    background-color: #ffffff;
    border: var(--border-width) solid var(--border-color);
    padding: 10px 16px;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-flat-sm);
    transition: all var(--transition-fast);
}
.search-box:focus-within {
    transform: translate(-2px, -2px);
    box-shadow: var(--shadow-flat-md);
}
.search-icon {
    color: var(--text-primary);
    margin-right: 10px;
    flex-shrink: 0;
}
.search-box input {
    width: 100%;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}
.search-box input::placeholder {
    color: var(--text-muted);
}
.search-clear-btn {
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    border-radius: var(--radius-full);
    transition: color var(--transition-fast);
}

/* Favorites Button */
.favorites-link {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: var(--border-width) solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-flat-sm);
    transition: all var(--transition-fast);
    position: relative;
}
.favorites-link:hover {
    transform: translate(-2px, -2px);
    box-shadow: var(--shadow-flat-md);
}
.fav-icon {
    color: var(--primary-color);
}
.favorites-link .badge {
    background-color: var(--primary-color);
    color: white;
    font-size: 11px;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    border: 2px solid var(--border-color);
    padding: 0 4px;
}
.favorites-link .badge.bump {
    animation: badge-bump 0.3s ease-out;
}

/* --- Sidebar Component --- */
.app-sidebar {
    width: 260px;
    flex-shrink: 0;
    background-color: #ffffff;
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-flat-md);
    height: calc(100vh - 120px);
    position: sticky;
    top: 94px;
}

.sidebar-scroll {
    height: 100%;
    overflow-y: auto;
    padding: 20px;
}

.sidebar-section {
    margin-bottom: 24px;
}

.sidebar-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    font-weight: 800;
    margin-bottom: 12px;
    padding-left: 8px;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
    border: 2px solid transparent;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.menu-item svg {
    color: var(--text-primary);
    transition: color var(--transition-fast);
}

.menu-item:hover {
    background-color: var(--bg-primary);
    border-color: var(--border-color);
    transform: translate(-2px, -2px);
    box-shadow: 2px 2px 0px var(--border-color);
}

.menu-item.active {
    color: #ffffff;
    background-color: var(--primary-color);
    border-color: var(--border-color);
    box-shadow: var(--shadow-flat-sm);
    transform: translate(-3px, -3px);
}

.menu-item.active svg {
    color: #ffffff;
}

/* --- Mobile Category Slider --- */
.mobile-categories-slider {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 12px 20px;
    background-color: var(--bg-primary);
    border-bottom: var(--border-width) solid var(--border-color);
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}
.mobile-categories-slider::-webkit-scrollbar {
    display: none;
}
.mobile-category-pill {
    flex-shrink: 0;
    background-color: #ffffff;
    border: var(--border-width) solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 700;
    scroll-snap-align: start;
    cursor: pointer;
    box-shadow: 2px 2px 0px var(--border-color);
    transition: all var(--transition-fast);
}
.mobile-category-pill.active {
    background-color: var(--primary-color);
    color: #ffffff;
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0px var(--border-color);
}

/* --- View Panels --- */
.view-panel {
    display: none;
    animation: fade-in 0.4s ease-out forwards;
}

.view-panel.active {
    display: block;
}

.view-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 20px;
}

.view-main-title {
    font-size: 28px;
    font-weight: 800;
    font-family: var(--font-secondary);
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.results-count {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 700;
}

/* --- Games Grid Layout --- */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    grid-auto-rows: 155px; /* Sized for the card artwork + bottom title bar */
    grid-auto-flow: dense;
    gap: 20px;
    margin-bottom: 40px;
}

/* --- Game Card Component --- */
.game-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    border: var(--border-width) solid var(--border-color);
    box-shadow: var(--shadow-flat-md);
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform var(--transition-fast), 
                box-shadow var(--transition-fast);
}

.game-card.card-standard {
    grid-column: span 1;
    grid-row: span 1;
}

.game-card.card-wide {
    grid-column: span 2;
    grid-row: span 1;
}

.game-card.card-tall {
    grid-column: span 1;
    grid-row: span 2;
}

.game-card.card-large {
    grid-column: span 2;
    grid-row: span 2;
}

/* Candy-colored card details (Child psychology-based palette) */
.card-color-0 .card-details {
    background-color: #ffe6f0; /* Soft Cotton Candy Pink - Warmth and safety */
}
.card-color-0.game-card:hover .card-hover-overlay {
    background-color: rgba(255, 75, 145, 0.15);
}

.card-color-1 .card-details {
    background-color: #e0f2fe; /* Soft Sky Blue - Calm and focus */
}
.card-color-1.game-card:hover .card-hover-overlay {
    background-color: rgba(56, 189, 248, 0.15);
}

.card-color-2 .card-details {
    background-color: #fef9c3; /* Soft Banana Yellow - Happiness and curiosity */
}
.card-color-2.game-card:hover .card-hover-overlay {
    background-color: rgba(250, 204, 21, 0.15);
}

.card-color-3 .card-details {
    background-color: #ffe9d6; /* Soft Sweet Melon Orange - Energy and friendliness */
}
.card-color-3.game-card:hover .card-hover-overlay {
    background-color: rgba(255, 132, 0, 0.15);
}

.card-color-4 .card-details {
    background-color: #e6fcf5; /* Soft Mint Green - Playfulness and relaxation */
}
.card-color-4.game-card:hover .card-hover-overlay {
    background-color: rgba(74, 222, 128, 0.15);
}

/* Card image container */
.card-image-wrapper {
    width: 100%;
    flex: 1;
    position: relative;
    overflow: hidden;
    background-color: #f1f5f9;
}

.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-normal);
}

/* Card Details Bottom Bar */
.card-details {
    background-color: #ffffff;
    border-top: var(--border-width) solid var(--border-color);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 48px;
    flex-shrink: 0;
}

.card-title {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--font-secondary);
}

.card-meta {
    display: none; /* Hide tags in grid cards for clean alignment */
}

/* Play Hover Overlay */
.card-hover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 75, 145, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.play-circle-btn {
    width: 48px;
    height: 48px;
    background: var(--accent-yellow);
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    box-shadow: var(--shadow-flat-sm);
    transform: scale(0.8);
    transition: transform var(--transition-fast);
}

/* Interactive Card Hover States */
.game-card:hover {
    transform: translate(-4px, -4px);
    box-shadow: var(--shadow-flat-lg);
}

.game-card:hover .card-image-wrapper img {
    transform: scale(1.05);
}

.game-card:hover .card-hover-overlay {
    opacity: 1;
}

.game-card:hover .play-circle-btn {
    transform: scale(1.1);
}

.card-large .card-title, .card-wide .card-title {
    font-size: 15px;
}

/* --- Play Game Panel & Console --- */
.play-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 15px;
    background-color: #ffffff;
    border: var(--border-width) solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-flat-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.back-link:hover {
    transform: translate(-3px, -3px);
    box-shadow: var(--shadow-flat-md);
    color: var(--primary-color);
}

.breadcrumbs {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 700;
}

.breadcrumbs a {
    color: var(--primary-color);
}

.breadcrumbs .active {
    color: var(--text-muted);
}

/* Game Console Layout */
.play-console {
    background-color: #ffffff;
    border-radius: var(--radius-lg);
    border: var(--border-width) solid var(--border-color);
    box-shadow: var(--shadow-flat-lg);
    overflow: hidden;
    margin-bottom: 24px;
}

.game-player-section {
    width: 100%;
    background-color: #f1f5f9;
    position: relative;
}

/* Game Iframe Wrapper */
.iframe-aspect-container {
    width: 100%;
    position: relative;
    background-color: #f1f5f9;
    transition: all var(--transition-normal);
}

.iframe-aspect-container.landscape-ratio {
    aspect-ratio: 16 / 9;
    max-height: 80vh;
}

.iframe-aspect-container.portrait-ratio {
    aspect-ratio: 3 / 4;
    max-width: 480px;
    margin: 0 auto;
    max-height: 75vh;
}

#game-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Controls bar directly under game */
.player-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background-color: #ffffff;
    border-top: var(--border-width) solid var(--border-color);
}

.playing-game-title {
    font-size: 20px;
    font-weight: 800;
    font-family: var(--font-secondary);
}

.game-author {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 700;
}

.controls-right {
    display: flex;
    gap: 12px;
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #ffffff;
    border: var(--border-width) solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 700;
    box-shadow: var(--shadow-flat-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.control-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: var(--shadow-flat-md);
}

.control-btn.active {
    background-color: var(--primary-color);
    color: #ffffff;
}

.control-btn.active svg {
    fill: #ffffff;
}

/* Game Info Card */
.game-info-card {
    background-color: #ffffff;
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-flat-md);
    padding: 24px;
    margin-bottom: 40px;
}

.info-tabs {
    display: flex;
    gap: 16px;
    border-bottom: var(--border-width) solid var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.tab-btn {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    padding-bottom: 12px;
    transition: color var(--transition-fast);
}

.tab-btn.active {
    color: var(--text-primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 100%;
    height: 5px;
    background-color: var(--primary-color);
    border-radius: var(--radius-full);
}

.info-pane {
    display: none;
    line-height: 1.6;
    color: var(--text-secondary);
    font-size: 15px;
}

.info-pane.active {
    display: block;
}

.controls-guide {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.control-badge {
    background-color: #f1f5f9;
    border: 2px solid var(--border-color);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 13px;
    color: var(--text-primary);
}

/* Related Games Section */
.related-games-section {
    margin-top: 40px;
}

.related-section-title {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 16px;
    font-family: var(--font-secondary);
}

.games-grid.related {
    grid-auto-rows: 140px;
}

.pagination-area {
    display: flex;
    justify-content: center;
    margin: 32px 0 48px;
}

.load-more-btn {
    background-color: #ffffff;
    border: var(--border-width) solid var(--border-color);
    padding: 14px 32px;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 15px;
    box-shadow: var(--shadow-flat-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.load-more-btn:hover {
    transform: translate(-3px, -3px);
    box-shadow: var(--shadow-flat-md);
    background-color: var(--bg-primary);
}

/* --- Footer Component --- */
.app-footer {
    background-color: #ffffff;
    border-top: var(--border-width) solid var(--border-color);
    padding: 40px 24px 30px;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
}

.footer-logo .logo-icon {
    color: var(--primary-color);
    filter: drop-shadow(1px 1px 0px var(--border-color));
}

.footer-about {
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 600px;
    line-height: 1.5;
    font-weight: 600;
}

.footer-links {
    display: flex;
    gap: 24px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.footer-links a:hover {
    color: var(--primary-color);
}

.copyright {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 10px;
}

/* --- Menu & Grid Skeleton Loaders --- */
.menu-skeleton-loader {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 8px;
}

.sk-menu-item {
    height: 32px;
    width: 100%;
    border-radius: var(--radius-sm);
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.loader-container {
    display: none;
    width: 100%;
    animation: fade-in var(--transition-fast) forwards;
}

.loader-container.active {
    display: block;
}

.loader-header-sk {
    height: 35px;
    width: 250px;
    border-radius: var(--radius-md);
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    margin-bottom: 24px;
}

.games-grid-skeleton {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    grid-auto-rows: 155px;
    grid-auto-flow: dense;
    gap: 20px;
}

.game-card-sk {
    border-radius: var(--radius-lg);
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border: var(--border-width) solid var(--border-color);
}

.game-card-sk.sk-standard { grid-column: span 1; grid-row: span 1; }
.game-card-sk.sk-wide { grid-column: span 2; grid-row: span 1; }
.game-card-sk.sk-large { grid-column: span 2; grid-row: span 2; }

/* --- Mobile Specific Styles (Responsive Design) --- */
.mobile-only {
    display: none !important;
}

/* Transition Animations */
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes badge-bump {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@media (max-width: 1024px) {
    .app-layout {
        padding: 16px;
        gap: 16px;
    }
    
    .app-sidebar {
        width: 220px;
    }
}

@media (max-width: 768px) {
    .mobile-only {
        display: flex !important;
    }
    
    .desktop-only {
        display: none !important;
    }
    
    .app-header {
        flex-wrap: wrap;
        padding: 12px 16px;
        gap: 12px;
    }
    
    .header-left {
        order: 1;
    }
    
    .header-right {
        order: 2;
    }
    
    .header-center {
        order: 3;
        flex: 1 0 100%;
        margin: 0;
    }
    
    .search-box {
        padding: 8px 14px;
    }

    .logo-text {
        font-size: 20px;
    }
    
    .app-layout {
        flex-direction: column;
        padding: 12px;
        gap: 12px;
    }
    
    /* Collapsible/Hidden Sidebar on Mobile */
    .app-sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        z-index: 1000;
        border-radius: 0;
        border: none;
        border-right: var(--border-width) solid var(--border-color);
        background-color: var(--bg-secondary);
        transition: left var(--transition-normal);
    }
    
    .app-sidebar.open {
        left: 0;
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background-color: rgba(15, 23, 42, 0.4);
        backdrop-filter: blur(4px);
        z-index: 999;
        display: none;
        animation: fade-in var(--transition-fast) forwards;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    /* Play container adjustments for small screens */
    .iframe-aspect-container.landscape-ratio {
        aspect-ratio: auto !important;
        height: 260px !important;
    }
    
    .iframe-aspect-container.portrait-ratio {
        aspect-ratio: auto !important;
        height: 420px !important;
        max-width: 100% !important;
    }

    .player-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 14px 18px;
    }
    
    .controls-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .control-btn {
        flex: 1;
        justify-content: center;
        padding: 8px 12px;
        font-size: 13px;
    }

    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        grid-auto-rows: 125px;
        gap: 10px;
    }
    
    .games-grid.related {
        grid-auto-rows: 110px;
    }

    .view-main-title {
        font-size: 22px;
    }

    .info-tabs {
        gap: 8px;
    }

    .tab-btn {
        font-size: 13px;
    }

    /* Splash Screen Mobile Optimizations */
    .splash-thumbnail {
        width: 80px !important;
        height: 80px !important;
        margin-bottom: 12px !important;
    }
    
    .splash-game-title {
        font-size: 20px !important;
        margin-bottom: 16px !important;
    }
    
    .splash-play-btn {
        padding: 12px 28px !important;
        font-size: 16px !important;
    }
}

@media (max-width: 480px) {
    .breadcrumbs {
        display: none;
    }
}

/* --- Game Splash Screen (Poki Style User-Gesture Play Button Overlay) --- */
.game-splash-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 10;
    background-color: var(--text-primary);
}

.splash-background {
    position: absolute;
    top: -20px;
    left: -20px;
    width: calc(100% + 40px);
    height: calc(100% + 40px);
    object-fit: cover;
    filter: blur(20px) brightness(0.35);
    opacity: 0.85;
}

.splash-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 35%, rgba(45, 26, 71, 0.7) 100%);
    z-index: 1;
}

.splash-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    color: #ffffff;
    max-width: 90%;
}

.splash-thumbnail {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-lg);
    border: var(--border-width) solid #ffffff;
    box-shadow: 0px 8px 24px rgba(0,0,0,0.5);
    margin-bottom: 20px;
    animation: splashFloat 3s ease-in-out infinite;
}

.splash-game-title {
    font-size: 26px;
    font-weight: 900;
    font-family: var(--font-secondary);
    margin-bottom: 24px;
    text-shadow: 2px 2px 0px var(--border-color), 0px 4px 10px rgba(0,0,0,0.6);
    color: #ffffff;
}

.splash-play-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: var(--accent-yellow);
    color: var(--text-primary);
    border: var(--border-width) solid var(--border-color);
    padding: 16px 36px;
    border-radius: var(--radius-full);
    font-size: 20px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0px 6px 0px var(--border-color);
    transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.15s ease;
    animation: splashPulse 1.8s infinite;
}

.splash-play-btn:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0px 8px 0px var(--border-color);
    background-color: #fde047;
}

.splash-play-btn:active {
    transform: translateY(4px) scale(0.98);
    box-shadow: 0px 2px 0px var(--border-color);
}

@keyframes splashFloat {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-8px) rotate(2deg); }
}

@keyframes splashPulse {
    0% {
        box-shadow: 0px 6px 0px var(--border-color), 0 0 0 0 rgba(250, 204, 21, 0.5);
    }
    70% {
        box-shadow: 0px 6px 0px var(--border-color), 0 0 0 15px rgba(250, 204, 21, 0);
    }
    100% {
        box-shadow: 0px 6px 0px var(--border-color), 0 0 0 0 rgba(250, 204, 21, 0);
    }
}

/* Optimize grid rendering and UI speed */
.games-grid {
    content-visibility: auto;
    contain-intrinsic-size: 800px;
}

/* Card Favorite Floating Button */
.card-fav-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background-color: #ffffff;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    cursor: pointer;
    z-index: 5;
    box-shadow: 2px 2px 0px var(--border-color);
    transition: transform var(--transition-fast), 
                background-color var(--transition-fast),
                color var(--transition-fast),
                box-shadow var(--transition-fast);
}

.card-fav-btn:hover {
    transform: scale(1.1) translate(-1px, -1px);
    box-shadow: 3px 3px 0px var(--border-color);
    color: var(--primary-color);
}

.card-fav-btn:active {
    transform: scale(0.95) translate(1px, 1px);
    box-shadow: 1px 1px 0px var(--border-color);
}

/* ==========================================================================
   Fullscreen & Simulated iOS Fullscreen Styles
   ========================================================================== */

/* Exit Fullscreen Button Style */
.exit-fullscreen-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    background-color: var(--accent-yellow);
    color: var(--text-primary);
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--radius-full);
    display: none; /* Controlled by JS / active classes */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10001; /* Higher than iframe and anything else */
    box-shadow: var(--shadow-flat-sm);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.exit-fullscreen-btn:hover {
    transform: scale(1.1) translate(-1px, -1px);
    box-shadow: var(--shadow-flat-md);
}

.exit-fullscreen-btn:active {
    transform: scale(0.95) translate(1px, 1px);
    box-shadow: 1px 1px 0px var(--border-color);
}

/* Fullscreen Helper Styles */
body.fullscreen-active {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

/* Prevent parent elements' transformations from creating a local stacking context */
body.fullscreen-active .view-panel,
body.fullscreen-active .app-main,
body.fullscreen-active .app-layout,
body.fullscreen-active .app-container {
    transform: none !important;
    animation: none !important;
    perspective: none !important;
    filter: none !important;
    contain: none !important;
}

/* Simulated Fullscreen for iOS/Safari/Chrome */
body.simulated-fullscreen .iframe-aspect-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    z-index: 10000 !important;
    aspect-ratio: auto !important;
    margin: 0 !important;
    background-color: #000000 !important;
    border: none !important;
    border-radius: 0 !important;
}

/* Stretching elements to cover entire screen */
body.fullscreen-active #game-iframe,
body.fullscreen-active .game-splash-screen {
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
}

/* Native Fullscreen API Styling Override */
.iframe-aspect-container:fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    aspect-ratio: auto !important;
    background-color: #000000 !important;
    border: none !important;
    border-radius: 0 !important;
}

.iframe-aspect-container:-webkit-full-screen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    aspect-ratio: auto !important;
    background-color: #000000 !important;
    border: none !important;
    border-radius: 0 !important;
}

.iframe-aspect-container:fullscreen #game-iframe,
.iframe-aspect-container:-webkit-full-screen #game-iframe {
    width: 100% !important;
    height: 100% !important;
}

.card-fav-btn.active {
    background-color: var(--primary-color);
    color: #ffffff;
}
