/**
 * Zelda Central Consolidated Mobile CSS
 * This file combines all mobile-specific styles from:
 * - mobile-optimizations.css
 * - mobile-nav.css
 * - game-breadcrumbs-mobile.css
 * - mobile media queries from custom.css
 *
 * All redundant rules have been removed and styles have been optimized
 * to improve mobile performance.
 * 
 * Last updated: June 17, 2025
 */

/* Import variables to ensure consistency */
@import url('./variables.css');

/* Mobile Performance Optimizations */
@media (max-width: 768px) {
    /* Use hardware acceleration for animations on mobile */
    .animated,
    .transition,
    .fadeIn,
    .fadeOut,
    [class*="anim-"],
    .mobile-menu-container,
    .menu-toggle span {
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        transform: translateZ(0);
        will-change: transform, opacity;
    }
    
    /* Optimize image loading with better aspect ratio handling */
    .has-aspect-ratio {
        position: relative;
        height: 0;
        overflow: hidden;
    }
    
    .has-aspect-ratio img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    /* Common aspect ratios */
    .aspect-16-9 {
        padding-bottom: 56.25%; /* 16:9 */
    }
    
    .aspect-4-3 {
        padding-bottom: 75%; /* 4:3 */
    }
    
    .aspect-1-1 {
        padding-bottom: 100%; /* 1:1 */
    }
    
    /* Apply passive event listeners to touch events - hint to browser */
    .swipe-container, .carousel, .slider {
        touch-action: pan-y;
    }
}

/* Mobile Global Styles - Apply to all mobile devices */
@media only screen and (max-width: 768px) {
    /* General content padding for all pages */
    .site-main,
    main#main,
    #primary .content-area,
    article.post .entry-content,
    article.page .entry-content,
    .site-content .content-area article,
    .container .content-area .site-main {
        padding-left: 5px !important;
        padding-right: 5px !important;
        box-sizing: border-box !important;
    }
    
    /* Make sure containers don't add double padding */
    .container {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    /* Specific fix for single post content */
    .single-post .entry-content,
    .single .entry-content {
        padding-left: 3px !important;
        padding-right: 3px !important;
    }
    
    /* Ensure images don't overflow their containers */
    .entry-content img,
    .entry-content .wp-block-image img {
        max-width: 100% !important;
        height: auto !important;
    }
    
    /* Site content inner padding */
    .site-content-inner {
        padding: 1rem 0.75rem;
    }
    
    .home .site-content-inner {
        padding: 0.5rem 0.35rem;
    }
    
    /* Button sizing for mobile */
    .zc-btn,
    .wp-block-button__link {
        font-size: 0.95rem;
        padding: 0.5em 1.1em;
    }
    
    /* Post Navigation */
    .post-navigation .nav-links {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .post-navigation .nav-previous,
    .post-navigation .nav-next {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .post-navigation .nav-previous {
        margin-bottom: 0.5rem;
    }
}

/* Mobile Menu Visibility Control */
.mobile-only,
.mobile-nav-controls {
    display: none;
}

@media (max-width: 768px) {
    /* Hide desktop elements and show mobile elements */
    .desktop-only {
        display: none !important;
    }
    
    .mobile-only {
        display: block;
    }
    
    /* Hide desktop navigation elements on mobile */
    .navigation-area,
    .primary-navigation,
    .search-container, 
    .social-icons-container,
    .user-panel,
    .top-nav-search,
    .user-account-area-top,
    .top-navigation-bar {
        display: none !important;
    }
    
    /* Show mobile navigation controls */
    .mobile-nav-controls {
        display: flex !important;
        align-items: center;
        justify-content: flex-end;
        margin-right: 5px;
    }
    
    /* Mobile header layout */
    #header-background,
    #header-container,
    #masthead {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        box-sizing: border-box !important;
    }
    
    #masthead {
        border-bottom: 1px solid rgba(166, 204, 139, 0.3);
    }
    
    /* Header row layout */
    .header-top-row {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 8px 15px;
        width: 100% !important;
        box-sizing: border-box !important;
        margin: 0 !important;
    }
    
    /* Mobile logo sizing */
    #logo img {
        max-height: 45px;
        width: auto;
    }
    
    /* Hide all desktop game menu elements on mobile */
    .game-submenu-wrapper,
    #game-icons-wrapper,
    .game-dropdown-container,
    .game-subpages-menu-container,
    .game-subpages-menu,
    .game-subpages-list,
    body.single .game-subpages-menu-container,
    body.page .game-subpages-menu-container {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        max-height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        pointer-events: none !important;
    }
}

/* Mobile Menu Toggle Button */
.menu-toggle {
    width: 36px;
    height: 36px;
    background: rgba(166, 204, 139, 0.1);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0;
    margin-right: 5px;
    position: relative;
}

.menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background-color: var(--menu-text, #a6cc8b);
    transition: all 0.3s ease;
    transform-origin: center;
    margin: 2px 0;
}

.menu-toggle:hover span {
    background-color: #ffffff;
}

.menu-toggle:active {
    background: rgba(166, 204, 139, 0.2);
}

/* Hamburger menu toggle animation */
.menu-toggle.active span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Mobile Menu Container */
.mobile-menu-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 85% !important;
    max-width: 320px !important;
    height: 100vh !important;
    background-color: var(--main-bg, #253124) !important;
    z-index: 999999 !important;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s, transform 0.3s cubic-bezier(0.4,0,0.2,1) !important;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5) !important;
    display: flex !important;
    flex-direction: column !important;
    padding-bottom: 60px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateX(-100%) !important;
}

.mobile-menu-container.active,
body.mobile-menu-open .mobile-menu-container {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(0) !important;
    transition: opacity 0.3s ease, visibility 0s linear 0s, transform 0.3s cubic-bezier(0.4,0,0.2,1) !important;
}

/* Hide mobile menu on larger screens */
@media (min-width: 769px) {
    .mobile-menu-container {
        display: none !important;
    }
}

/* Mobile Breadcrumbs */
.mobile-only-breadcrumbs {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only-breadcrumbs {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .mobile-only-breadcrumbs .breadcrumbs {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* Mobile Top Menu */
.mobile-menu-container .mobile-top-nav {
    display: block !important;
    visibility: visible !important;
    margin: 0 15px 15px !important;
    border: 1px solid rgba(230, 204, 128, 0.2) !important;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    opacity: 1 !important;
    pointer-events: auto !important;
    z-index: 999999 !important;
}

.mobile-menu-container .mobile-top-menu {
    display: flex !important;
    flex-wrap: wrap !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.mobile-menu-container .mobile-top-menu li {
    flex: 1 0 50% !important;
    border-right: 1px solid rgba(230, 204, 128, 0.1);
    border-bottom: 1px solid rgba(230, 204, 128, 0.1);
}

.mobile-menu-container .mobile-top-menu li:nth-child(even) {
    border-right: none;
}

.mobile-menu-container .mobile-top-menu a {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 12px 10px !important;
    color: rgba(230, 204, 128, 0.8) !important;
    text-decoration: none !important;
    font-size: 14px !important;
    text-align: center !important;
    transition: all 0.2s ease;
}

.mobile-menu-container .mobile-top-menu a:hover,
.mobile-menu-container .mobile-top-menu a:focus {
    background: rgba(230, 204, 128, 0.1) !important;
}

/* Mobile Menu Header */
.mobile-menu-header {
    padding: 10px 15px 5px;
    border-bottom: none;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    background-color: var(--main-bg, #253124);
    z-index: 2147483647;
}

/* Mobile user welcome */
.mobile-menu-container .mobile-welcome {
    font-family: 'Cinzel', serif, 'Hylia Serif', 'Times New Roman';
    color: #e6cc80 !important;
    font-size: 16px !important;
    margin-bottom: 12px !important;
}

/* Mobile Search */
.mobile-search-form {
    position: relative;
    margin: 10px 0;
    width: 100%;
}

.mobile-search-form input[type="search"] {
    width: 100%;
    padding: 8px 35px 8px 12px;
    border-radius: 5px;
    border: 1px solid rgba(166, 204, 139, 0.3);
    background-color: rgba(21, 30, 20, 0.6);
    color: var(--menu-text, #a6cc8b);
    font-size: 14px;
}

.mobile-search-form button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--menu-text, #a6cc8b);
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile Menu Navigation */
.mobile-main-nav,
.mobile-games-nav {
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-y: auto;
    flex-grow: 1;
}

.mobile-main-nav > li {
    border-bottom: 1px solid rgba(166, 204, 139, 0.1);
}

.mobile-main-nav > li > a {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: var(--menu-text, #a6cc8b);
    text-decoration: none;
    font-size: 16px;
    transition: all 0.2s ease;
}

.mobile-main-nav > li > a:hover,
.mobile-main-nav > li > a:focus,
.mobile-main-nav > li.current-menu-item > a {
    background-color: rgba(166, 204, 139, 0.1);
    color: var(--highlight-color, #d4af37);
}

.mobile-main-nav .menu-item-has-children > a::after {
    content: '⌵';
    margin-left: auto;
    font-size: 18px;
    transform: rotate(-90deg);
    transition: transform 0.2s ease;
}

.mobile-main-nav .menu-item-has-children.open > a::after {
    transform: rotate(0);
}

.mobile-main-nav .sub-menu {
    display: none;
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: rgba(0, 0, 0, 0.15);
}

.mobile-main-nav .menu-item-has-children.open > .sub-menu {
    display: block;
}

.mobile-main-nav .sub-menu li a {
    display: block;
    padding: 10px 15px 10px 30px;
    color: rgba(166, 204, 139, 0.85);
    text-decoration: none;
    font-size: 15px;
    transition: all 0.2s ease;
}

.mobile-main-nav .sub-menu li a:hover,
.mobile-main-nav .sub-menu li a:focus,
.mobile-main-nav .sub-menu li.current-menu-item > a {
    background-color: rgba(0, 0, 0, 0.1);
    color: var(--highlight-color, #d4af37);
}

/* Mobile Games Grid */
@media (max-width: 768px) {
    .games-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
        gap: 10px;
        padding: 5px;
    }
    
    .game-card {
        border-radius: 8px;
        overflow: hidden;
        transition: transform 0.2s ease;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        height: 100%;
    }
    
    .game-card:hover {
        transform: translateY(-3px);
    }
    
    .game-card-image {
        position: relative;
        height: 0;
        padding-bottom: 100%;
        overflow: hidden;
    }
    
    .game-card-image img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .game-card-content {
        padding: 8px;
        background: #fff;
    }
    
    .game-title {
        font-size: 0.9rem;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Mobile Cards Optimization */
@media (max-width: 768px) {
    .card {
        margin-bottom: 15px;
    }
    
    .card-title {
        font-size: 1.1rem;
    }
    
    .card-body {
        padding: 12px;
    }
    
    .news-item {
        flex-direction: column;
    }
    
    .news-item-image {
        width: 100%;
        height: 180px;
    }
    
    .news-item-content {
        padding: 12px;
    }
}

/* Mobile Tables */
@media (max-width: 768px) {
    table {
        width: 100% !important;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Responsive tables that can be scrolled horizontally */
    .wp-block-table,
    .entry-content table {
        margin-bottom: 1rem;
        display: block;
        width: 100%;
        overflow-x: auto;
    }
    
    /* Stackable tables - best for simple data */
    .stackable-table {
        border: 0;
    }
    
    .stackable-table thead {
        border: none;
        clip: rect(0 0 0 0);
        height: 1px;
        margin: -1px;
        overflow: hidden;
        padding: 0;
        position: absolute;
        width: 1px;
    }
    
    .stackable-table tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #ddd;
    }
    
    .stackable-table td {
        display: block;
        border-bottom: 1px solid #ddd;
        text-align: right;
        padding: 0.75rem;
        position: relative;
        padding-left: 40%;
    }
    
    .stackable-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0.75rem;
        top: 0.75rem;
        width: 35%;
        font-weight: bold;
        text-align: left;
    }
    
    .stackable-table td:last-child {
        border-bottom: 0;
    }
}

/* Mobile page overlay */
.mobile-menu-overlay,
.mobile-games-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 99999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

body.mobile-menu-open .mobile-menu-overlay,
body.mobile-games-open .mobile-games-overlay {
    display: block;
    opacity: 1;
}

/* Game Icons Section */
.mobile-game-icons {
    padding: 5px 0;
    margin: 5px 0;
    border-top: 1px solid rgba(166, 204, 139, 0.2);
    border-bottom: 1px solid rgba(166, 204, 139, 0.2);
}

.mobile-game-icons h3:not(.adventure-heading) {
    color: var(--menu-text, #a6cc8b);
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: normal;
    text-align: center;
}

.mobile-game-icons h3.adventure-heading {
    color: var(--menu-text, #a6cc8b);
    margin: 10px 0 15px;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
}

.mobile-game-grid {
    display: flex;
    flex-direction: column;
    padding: 0;
}

.game-item-container {
    margin-bottom: 10px;
}

.game-link-wrapper {
    display: flex;
    align-items: center;
    position: relative;
    border-radius: 6px;
    background-color: rgba(166, 204, 139, 0.05);
    transition: background-color 0.2s ease;
}

.game-link-wrapper.has-children {
    cursor: pointer;
}

.game-link-wrapper:hover,
.game-link-wrapper:focus-within {
    background-color: rgba(166, 204, 139, 0.1);
}

.game-icon-wrapper {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    overflow: hidden;
    margin: 8px;
    background-color: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-icon-wrapper img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.game-icon-title {
    color: #ffffff;
    margin-left: 8px;
    font-size: 14px;
    display: block;
    flex: 1;
}

.game-content {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 5px;
}

.game-toggle-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--menu-text, #a6cc8b);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 5px;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.game-toggle-btn:hover {
    background-color: rgba(166, 204, 139, 0.2);
}

.game-subpages {
    display: none;
    padding: 0 0 0 44px;
    margin: 0 8px 8px;
    border-left: 1px dashed rgba(166, 204, 139, 0.3);
}

.game-subpages a {
    display: block;
    padding: 8px 12px;
    color: #000000;
    text-decoration: none;
    font-size: 13px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.game-subpages a:hover,
.game-subpages a:focus {
    background-color: rgba(166, 204, 139, 0.1);
}

.game-subpages a.current {
    background-color: rgba(166, 204, 139, 0.2);
    font-weight: bold;
    color: var(--menu-text, #a6cc8b);
}

.game-item-container.active .game-link-wrapper {
    background-color: rgba(166, 204, 139, 0.15);
}

.game-item-container.active .game-toggle-btn {
    transform: rotate(180deg);
}

/* Mobile Game Submenu Dropdown Styles */
.mobile-game-submenu-dropdown {
    background-color: rgba(166, 204, 139, 0.1);
    border-radius: 8px;
    margin: 10px 15px 20px;
    padding: 15px;
    border: 1px solid rgba(166, 204, 139, 0.3);
}

.mobile-game-submenu-dropdown h3 {
    margin: 0 0 10px;
    color: var(--menu-text, #a6cc8b);
    font-size: 18px;
    font-weight: 600;
    text-align: center;
}

.current-game-display {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
}

.current-game-display span {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 5px;
}

.current-game-icon {
    display: flex;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.2);
    padding: 8px 12px;
    border-radius: 6px;
}

.current-game-icon img.game-nav-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    margin-right: 10px;
    border-radius: 4px;
}

.current-game-icon .game-icon-default {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--menu-text, #a6cc8b);
    color: var(--main-bg, #253124);
    font-weight: bold;
    font-size: 16px;
    border-radius: 4px;
    margin-right: 10px;
}

.current-game-icon strong {
    color: #ffffff;
    font-size: 16px;
}

.game-submenu-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.game-subpage-link {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    color: #ffffff !important;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s;
}

.game-subpage-link:hover,
.game-subpage-link:focus {
    background-color: rgba(255, 255, 255, 0.1);
}

.game-subpage-link.current {
    background-color: rgba(166, 204, 139, 0.2);
    font-weight: bold;
    color: var(--menu-text, #a6cc8b) !important;
}

.link-icon {
    margin-right: 8px;
    font-size: 16px;
}

/* Tiny screens optimization */
@media (max-width: 350px) {
    .mobile-game-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Mobile profile blocks */
@media (max-width: 767px) {
    .zc-profile-block {
        position: relative
    }
}

/* Final Mobile Optimizations */
@media (max-width: 768px) {
    /* Font size adjustments for better mobile readability */
    body {
        font-size: 16px !important;
        line-height: 1.5 !important;
    }
    
    h1 {
        font-size: 1.8rem !important;
        line-height: 1.2 !important;
    }
    
    h2 {
        font-size: 1.5rem !important;
        line-height: 1.3 !important;
    }
    
    h3 {
        font-size: 1.3rem !important;
    }
    
    h4, h5, h6 {
        font-size: 1.1rem !important;
    }
    
    /* Reduce padding/margins for tighter layout */
    .entry-content > *:not(.zc-profile-block):not(.wp-block-group.zc-profile-block) {
        margin-top: 1em !important;
        margin-bottom: 1em !important;
    }
    
    /* Match all paragraph text to profile description style on mobile */
    .entry-content p {
        margin-bottom: 0.25em !important;
        line-height: 1.4 !important;
        font-size: 0.95rem !important;
    }
    
    /* Better tap targets for mobile */
    button,
    input[type="button"],
    input[type="submit"],
    .zc-btn,
    .btn,
    a.button,
    .wp-block-button__link,
    nav a,
    .mobile-main-nav a,
    .card-link,
    .nav-links a {
        min-height: 44px !important;
        min-width: 44px !important;
    }
    
    /* Optimize scroll behavior */
    html {
        scroll-behavior: smooth;
    }
    
    /* Prevent content reflow by setting explicit height for common elements */
    .game-card-image img,
    .featured-image img,
    .news-item-image img {
        height: auto !important;
        aspect-ratio: 16/9;
    }
}

/* Fallback for browsers without aspect-ratio support */
@supports not (aspect-ratio: 16/9) {
    @media (max-width: 768px) {
        .game-card-image,
        .featured-image,
        .news-item-image {
            position: relative;
            height: 0;
            padding-bottom: 56.25%;
            overflow: hidden;
        }
        
        .game-card-image img,
        .featured-image img,
        .news-item-image img {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
    }
}

/* Mobile Top Navigation Styles */
@media (max-width: 768px) {
    .mobile-top-nav {
        padding: 0 15px 10px;
        margin: 10px 0 5px;
        border-bottom: 1px solid rgba(166, 204, 139, 0.2);
    }
    
    .mobile-top-menu {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        margin: 0;
        padding: 0;
        list-style: none;
        gap: 8px;
    }
    
    .mobile-top-menu li {
        width: calc(50% - 5px);
        margin: 0;
        padding: 0;
    }
    
    .mobile-top-menu a {
        display: block;
        padding: 6px 10px;
        color: #a6cc8b;
        text-decoration: none;
        font-size: 13px;
        font-weight: 500;
        transition: color 0.2s ease;
        border-radius: 4px;
        background-color: rgba(166, 204, 139, 0.05);
    }
    
    .mobile-top-menu a:hover,
    .mobile-top-menu a:focus,
    .mobile-top-menu .current-menu-item a {
        color: #ffffff;
        background-color: rgba(166, 204, 139, 0.1);
    }
}

/* Mobile Search Styling */
@media (max-width: 768px) {
    .mobile-search {
        padding: 0 15px 15px;
        margin-bottom: 5px;
    }
    
    .mobile-search form {
        display: flex;
        position: relative;
        width: 100%;
    }
    
    .mobile-search input[type="search"] {
        width: 100%;
        padding: 10px 40px 10px 15px;
        border-radius: 4px;
        border: 1px solid rgba(166, 204, 139, 0.3);
        background-color: rgba(0, 0, 0, 0.2);
        color: #ffffff;
        font-size: 14px;
    }
    
    .mobile-search input[type="search"]::placeholder {
        color: rgba(255, 255, 255, 0.5);
    }
    
    .mobile-search button {
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 40px;
        background: transparent;
        border: none;
        color: rgba(166, 204, 139, 0.6);
        font-size: 14px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .mobile-search button:hover {
        color: #a6cc8b;
    }
}

/* Mobile User Account Styles */
@media (max-width: 768px) {
    .mobile-user-account {
        padding: 5px 15px 0;
        border-bottom: none;
        margin-top: 0;
        margin-bottom: 0;
    }
    
    .mobile-welcome {
        display: block;
        color: #ffffff;
        font-size: 14px;
        margin-bottom: 10px;
        font-weight: 500;
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    }
    
    .mobile-user-links {
        display: flex;
        flex-direction: column;
    }
    
    .mobile-user-link {
        color: var(--menu-text, #a6cc8b);
        text-decoration: none;
        padding: 8px 0;
        display: flex;
        align-items: center;
        font-size: 14px;
        transition: color 0.2s ease;
    }
    
    .mobile-user-link i {
        margin-right: 8px;
        width: 16px;
        text-align: center;
    }
    
    .mobile-user-link:hover,
    .mobile-user-link:focus {
        color: #ffffff;
    }
    
    .mobile-login-register {
        display: flex;
        flex-wrap: wrap;
        gap: 12px;
        margin: 5px 0;
        justify-content: center;
    }
    
    .mobile-login-btn,
    .mobile-register-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: var(--menu-text, #a6cc8b);
        color: #253124;
        text-decoration: none;
        padding: 10px 18px;
        border-radius: 4px;
        font-size: 15px;
        font-weight: 600;
        transition: all 0.3s ease;
        min-width: 120px;
        text-align: center;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        border: 1px solid transparent;
    }
    
    .mobile-login-btn i,
    .mobile-register-btn i {
        margin-right: 8px;
        font-size: 16px;
    }
    
    .mobile-login-btn:hover,
    .mobile-register-btn:hover {
        background-color: #ffffff;
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    }
    
    .mobile-login-btn:active,
    .mobile-register-btn:active {
        transform: translateY(0);
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    }
}

/* YouTube Video Responsive Styling */
@media (max-width: 768px) {
    /* Direct YouTube iframe fixes */
    iframe[src*="youtube.com"],
    iframe[src*="youtu.be"] {
        width: 100% !important;
        max-width: 100% !important;
        height: 200px !important; /* Fixed height for mobile */
        margin: 1rem 0 !important;
        border: none !important;
    }
    
    /* YouTube embed containers - responsive wrapper method */
    .wp-block-embed-youtube,
    .embed-youtube,
    .video-container {
        position: relative !important;
        width: 100% !important;
        height: 0 !important;
        padding-bottom: 56.25% !important; /* 16:9 aspect ratio */
        overflow: hidden !important;
        margin: 1rem 0 !important;
    }
    
    .wp-block-embed-youtube iframe,
    .embed-youtube iframe,
    .video-container iframe {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        border: none !important;
    }
    
    /* Twitter/X cards should NOT be treated as 16:9 video containers */
    .wp-block-embed-twitter,
    .wp-block-embed.is-provider-twitter {
        position: static !important;
        height: auto !important;
        padding-bottom: 0 !important;
        overflow: visible !important;
    }
    
    /* Ensure wrapper and inner divs don't clip Twitter content */
    .wp-block-embed-twitter .wp-block-embed__wrapper,
    .wp-block-embed.is-provider-twitter .wp-block-embed__wrapper,
    .wp-block-embed-twitter .twitter-tweet,
    .wp-block-embed.is-provider-twitter .twitter-tweet {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }
    
    /* Allow Twitter iframe to use its natural inline height from Twitter's JS */
    .wp-block-embed-twitter iframe,
    .wp-block-embed.is-provider-twitter iframe {
        position: static !important;
        max-width: 100% !important;
    }
    
    /* Content area iframes - more specific targeting */
    .entry-content iframe[src*="youtube"],
    .post-content iframe[src*="youtube"],
    .page-content iframe[src*="youtube"] {
        width: 100% !important;
        max-width: 100% !important;
        height: 200px !important;
        margin: 1rem 0 !important;
        border: none !important;
    }
    
    /* WordPress video blocks */
    .wp-block-video {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .wp-block-video video {
        width: 100% !important;
        height: auto !important;
        max-width: 100% !important;
    }
}

/* Fallback for browsers without aspect-ratio support */
@supports not (aspect-ratio: 16/9) {
    @media (max-width: 768px) {
        iframe[src*="youtube.com"],
        iframe[src*="youtu.be"] {
            width: 100% !important;
            height: calc(100vw * 0.5625) !important; /* 16:9 ratio calculation */
            max-height: 315px !important;
        }
    }
}

/* Game Grid and Subpages Styles */
@media (max-width: 768px) {
    /* Adventure Heading Styling */
    .mobile-game-icons h3.adventure-heading {
        font-family: 'Cinzel', serif, 'Hylia Serif', 'Times New Roman' !important;
        text-align: center !important;
        color: #e6cc80 !important;
        background-color: transparent !important;
        background: none !important;
        font-size: 18px !important;
        margin: 20px 0 15px !important;
        padding: 0 0 8px 0 !important;
        text-transform: uppercase !important;
        letter-spacing: 1px !important;
        border-bottom: 1px solid rgba(230, 204, 128, 0.3) !important;
        position: relative !important;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6) !important;
        box-shadow: none !important;
        display: block !important;
    }
    
    .adventure-heading::after {
        content: '';
        position: absolute !important;
        bottom: -1px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 60px !important;
        height: 1px !important;
        background-color: rgba(230, 204, 128, 0.7) !important;
    }
    
    .mobile-game-icons h3:not(.adventure-heading) {
        font-size: 16px !important;
        margin: 15px 0 10px !important;
        color: rgba(230, 204, 128, 0.9) !important;
        border-bottom: none !important;
    }
    /* Mobile Game Grid */
    .mobile-game-grid {
        display: flex;
        flex-direction: column;
        padding: 0;
    }
    
    .game-item-container {
        margin-bottom: 10px;
    }
    
    .game-link-wrapper {
        display: flex;
        align-items: center;
        position: relative;
        border-radius: 6px;
        background-color: rgba(166, 204, 139, 0.05);
        transition: background-color 0.2s ease;
    }
    
    .game-link-wrapper.has-children {
        cursor: pointer;
    }
    
    .game-link-wrapper:hover,
    .game-link-wrapper:focus-within {
        background-color: rgba(166, 204, 139, 0.1);
    }
    
    .game-icon-link, .game-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        text-decoration: none;
        flex: 1;
        color: #ffffff;
        text-align: center;
        padding: 8px 5px;
        position: relative;
        transition: background-color 0.2s ease;
    }
    
    .game-toggle-btn {
        background: none;
        border: none;
        padding: 8px 12px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #ffffff;
    }
    
    .expand-toggle {
        width: 14px;
        height: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .expand-toggle::after {
        content: '\25bc';
        font-size: 10px;
        color: rgba(166, 204, 139, 0.7);
        transition: transform 0.3s ease;
    }
    
    .game-icon, .mobile-game-icon {
        width: 40px;
        height: 40px;
        margin-bottom: 6px;
        object-fit: cover;
    }
    
    .game-icon-title, .mobile-game-title {
        font-size: 12px;
        font-weight: 500;
        color: #e6cc80; /* Brownish/gold text color instead of white */
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Game Subpages Dropdown */
    .game-subpages {
        display: none;
        padding: 10px;
        margin-top: 8px;
        background-color: rgba(37, 49, 36, 0.95);
        border-radius: 5px;
        border: 1px solid rgba(166, 204, 139, 0.5);
        width: 100%;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    .game-item-container.active .game-subpages {
        display: block;
        background-color: #344533;
        border-radius: 4px;
        padding: 5px;
        margin-top: 0;
        margin-bottom: 5px;
        margin-left: 0;
        margin-right: 0;
    }
    
    .subpage-link {
        display: flex;
        align-items: center;
        padding: 10px 12px;
        margin-bottom: 6px;
        color: #111811; /* Darker text color for better readability */
        text-decoration: none;
        font-size: 14px;
        font-weight: 500;
        border-radius: 4px;
        transition: all 0.2s ease;
        background-color: #f5e6cb; /* Tan background */
        border-left: 3px solid rgba(37, 49, 36, 0.6);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    .subpage-link:hover {
        background-color: #f0dfc0; /* Slightly darker tan on hover */
        border-left: 3px solid rgba(37, 49, 36, 0.9);
        transform: translateX(2px);
    }
    
    .subpage-link.current {
        background-color: #ebd8b7; /* Even darker tan for current page */
        border-left: 3px solid #253124;
        font-weight: bold;
    }
    
    .subpage-link:last-child {
        margin-bottom: 0;
    }
    
    /* Style for subpage icons */
    .subpage-link .subpage-icon,
    .subpage-link .link-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-right: 8px;
        color: #253124;
        opacity: 0.8;
        font-size: 16px;
    }
    
    .subpage-icon {
        margin-right: 8px;
        font-size: 14px;
        opacity: 0.7;
        display: inline-flex;
        align-items: center;
    }
    
    .subpage-icon img {
        width: 16px;
        height: 16px;
    }
    
    /* ==========================================
       MOBILE GALLERY - SWIPEABLE CAROUSEL
       ========================================== */
    
    /* Gallery container with horizontal scroll */
    html body .wp-block-gallery,
    html body .blocks-gallery-grid,
    html body .entry-content .gallery,
    html body .gallery,
    html body .wp-block-gallery.has-nested-images {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        scroll-snap-type: x mandatory !important;
        scroll-behavior: smooth !important;
        -webkit-overflow-scrolling: touch !important;
        gap: 12px !important;
        padding: 12px 8px 20px !important;
        margin: 1.5em -8px !important;
        background: linear-gradient(135deg, rgba(166, 204, 139, 0.05) 0%, rgba(248, 232, 160, 0.08) 100%) !important;
        border-radius: 8px !important;
        box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05) !important;
        width: calc(100% + 16px) !important;
        position: relative !important;
        max-height: 50vh !important;
    }
    
    /* Swipe indicator added via JavaScript - see mobile-gallery-hint.js */
    
    /* Scrollbar styling - more prominent for mobile */
    html body .wp-block-gallery::-webkit-scrollbar,
    html body .blocks-gallery-grid::-webkit-scrollbar,
    html body .gallery::-webkit-scrollbar {
        height: 8px !important;
    }
    
    html body .wp-block-gallery::-webkit-scrollbar-track,
    html body .blocks-gallery-grid::-webkit-scrollbar-track,
    html body .gallery::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.1) !important;
        border-radius: 4px !important;
        margin: 0 8px !important;
    }
    
    html body .wp-block-gallery::-webkit-scrollbar-thumb,
    html body .blocks-gallery-grid::-webkit-scrollbar-thumb,
    html body .gallery::-webkit-scrollbar-thumb {
        background: rgba(143, 184, 120, 0.8) !important;
        border-radius: 4px !important;
        border: 2px solid rgba(255, 255, 255, 0.3) !important;
    }
    
    /* Gallery items - snap to position */
    .wp-block-gallery .blocks-gallery-item,
    .blocks-gallery-grid .blocks-gallery-item,
    .gallery-item,
    .wp-block-gallery figure.wp-block-image,
    .wp-block-gallery.has-nested-images figure.wp-block-image {
        flex: 0 0 85% !important;
        min-width: 85% !important;
        max-width: 85% !important;
        scroll-snap-align: center !important;
        margin: 0 !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: #fff !important;
        border-radius: 8px !important;
        overflow: hidden !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
        transition: transform 0.2s ease !important;
        position: relative !important;
    }
    
    /* Gallery images */
    .wp-block-gallery figure.wp-block-image img,
    .wp-block-gallery.has-nested-images figure.wp-block-image img {
        width: 100% !important;
        height: auto !important;
        max-height: 400px !important;
        object-fit: contain !important;
        display: block !important;
        margin: 0 !important;
        padding: 8px !important;
    }
    
    /* Author Bio Mobile Layout */
    .author-bio.card {
        flex-wrap: wrap !important;
    }
    
    .author-bio.card .author-avatar {
        margin-right: 1rem !important;
        flex: 0 0 64px !important;
    }
    
    .author-bio.card .author-avatar img {
        width: 64px !important;
        height: 64px !important;
    }
    
    /* Make wrapper transparent so children participate in parent flex */
    .author-bio.card .author-content {
        display: contents !important;
    }
    
    .author-bio.card .author-name {
        flex: 1 !important;
        font-size: 1.05rem !important;
        margin: 0 !important;
        align-self: center !important;
    }
    
    .author-bio.card .author-description {
        flex: 1 1 100% !important;
        font-size: 0.9rem !important;
        margin-top: 1rem !important;
    }
    
    .author-bio.card .author-posts-link {
        flex: 1 1 100% !important;
        margin-top: 0.75rem !important;
    }
    
    /* Fix ALL br tags on mobile - ensure they create line breaks */
    .entry-content br,
    .page-content br,
    .post-content br {
        display: block !important;
        content: "" !important;
        margin-bottom: 0.5em !important;
    }
    
    /* Improve spacing between stacked columns on mobile */
    .wp-block-columns {
        flex-direction: column !important;
        gap: 0 !important;
    }
    
    .wp-block-column {
        margin-bottom: 1rem !important;
        width: 100% !important;
        flex-basis: 100% !important;
    }
    
    .wp-block-column:last-child {
        margin-bottom: 0 !important;
    }
    
}