/* ============================================================================
   SHARED STYLES - Lat Inamommies Academic Institute
   ============================================================================
   Common CSS styles used across all pages.
   This file should be included in all HTML pages.
   Optimized for performance and low-CPU devices.
*/

/* ============================================================================
   CSS VARIABLES
   ============================================================================ */
:root {
    --bg-color: #f8fafc;
    --text-main: #0f172a;
    --accent: #2563eb;
    --transition-speed: 0.3s;
    --transition-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================================
   BASE STYLES
   ============================================================================ */
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow-x: hidden;
}

h1, h2, h3, h4, .display-font {
    font-family: 'Space Grotesk', sans-serif;
    letter-spacing: -0.02em;
}

/* ============================================================================
   PAGE TRANSITION OVERLAY
   ============================================================================ */
.page-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.page-transition-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* Page entrance animation */
.page-content {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.page-content.loaded {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================================
   3D BACKGROUND LAYER
   ============================================================================ */
#canvas-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5; /* Above background but below UI */
    pointer-events: auto;
    background: radial-gradient(circle at 50% 50%, #ffffff 0%, #f1f5f9 100%);
    touch-action: none; /* Enable touch for OrbitControls */
}

/* ============================================================================
   UI LAYOUT
   ============================================================================ */
main { 
    position: relative; 
    z-index: 10; 
    pointer-events: none; 
}

main > * { 
    pointer-events: auto; 
}

/* Allow clicks to pass through Home View to 3D background */
#home-view {
    pointer-events: none !important;
}

#home-view .home-anim,
#home-view a,
#home-view button {
    pointer-events: auto !important;
}

/* Page Sections (SPA-style views) */
.page-section {
    display: none;
    opacity: 0;
    min-height: 100vh;
    padding-top: 130px; /* Clears 100px header + 30px breathing room */
    padding-bottom: 100px; /* Clears fixed footer */
    width: 100%;
}

.page-section.active { 
    display: flex; 
    flex-direction: column;
    opacity: 1; 
}

@media (max-width: 768px) {
    .page-section {
        padding-top: 110px; /* Clears 100px header + 10px */
        padding-bottom: 140px; /* Clears fixed Trust Indicators */
    }
}

/* ============================================================================
   NAVIGATION
   ============================================================================ */
.nav-link {
    position: relative;
    font-weight: 500;
    color: #64748b;
    transition: color 0.2s;
    cursor: pointer;
}

.nav-link:hover, 
.nav-link.active { 
    color: var(--text-main); 
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -4px; 
    left: 0; 
    width: 100%; 
    height: 2px;
    background: var(--accent);
}

/* ============================================================================
   BUTTONS
   ============================================================================ */
.btn-primary {
    background-color: #0f172a;
    color: white;
    padding: 16px 32px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 6px;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.3);
    cursor: pointer;
}

.btn-primary:hover {
    background-color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 20px 35px -5px rgba(37, 99, 235, 0.4);
}

/* ============================================================================
   TEXT UTILITIES
   ============================================================================ */
.text-shadow-sm {
    text-shadow: 0 2px 4px rgba(255, 255, 255, 0.8), 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* ============================================================================
   APP CARD (Assessment Container)
   ============================================================================ */
.app-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid white;
    box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.1);
    border-radius: 16px;
}

/* ============================================================================
   ANSWER BUTTONS (Assessment)
   ============================================================================ */
.answer-card {
    transition: all 0.2s;
    border: 1px solid #e2e8f0;
    background: white;
    cursor: pointer;
}

.answer-card:hover {
    border-color: var(--accent);
    background-color: #f0f9ff;
    transform: translateX(4px);
}

.answer-card:active { 
    transform: scale(0.99); 
}

/* ============================================================================
   NEWS TICKER
   ============================================================================ */
.news-ticker-item { 
    display: none; 
}

.news-ticker-item.active { 
    display: flex; 
}

/* Mobile News Scrolling - GPU accelerated */
@media (max-width: 768px) {
    #news-container {
        overflow: hidden;
        position: relative;
        width: 100%;
    }
    
    .news-ticker-scroll-wrapper {
        display: flex;
        animation: scroll-news 30s linear infinite;
        will-change: transform;
    }
    
    .news-ticker-item {
        display: flex !important;
        align-items: center;
        gap: 8px;
        white-space: nowrap;
        padding-right: 3rem;
        flex-shrink: 0;
    }
    
    .news-ticker-item span {
        display: inline-block;
    }
    
    @keyframes scroll-news {
        0% { transform: translateX(0); }
        100% { transform: translateX(-50%); }
    }
}

/* ============================================================================
   HUD WIDGET
   ============================================================================ */
.hud-panel {
    position: fixed;
    top: 125px; 
    right: 20px;
    width: 300px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    z-index: 40;
    padding: 16px;
    transition: transform 0.3s ease;
}

/* ============================================================================
   TRUST INDICATORS
   ============================================================================ */
.trust-indicators {
    position: fixed;
    bottom: 20px; 
    right: 20px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    z-index: 40;
    padding: 20px 28px;
    pointer-events: auto;
    min-width: 380px;
}

.trust-indicators .grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.trust-indicators > div {
    text-align: center;
}

/* ============================================================================
   LANGUAGE TOGGLE BUTTON
   ============================================================================ */
#lang-toggle,
#lang-toggle-mobile {
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.75rem;
    transition: all 0.2s;
    border: 1px solid #e2e8f0;
    background: white;
    color: #64748b;
}

#lang-toggle:hover,
#lang-toggle-mobile:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #cbd5e1;
}

/* ============================================================================
   FLOATING LANGUAGE TOGGLE (Mobile)
   ============================================================================ */
.floating-lang-toggle {
    position: fixed;
    bottom: 20px; /* No tab bar anymore */
    right: 12px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.4), 0 0 0 2px rgba(255, 255, 255, 0.1);
    z-index: 55;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
}

.floating-lang-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 25px rgba(15, 23, 42, 0.5), 0 0 0 4px rgba(37, 99, 235, 0.3);
}

.floating-lang-toggle:active {
    transform: scale(0.95);
}

.floating-lang-toggle svg {
    width: 16px;
    height: 16px;
    opacity: 0.9;
}

.floating-lang-text {
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1;
}

/* RTL positioning for floating toggle */
[dir="rtl"] .floating-lang-toggle {
    right: auto;
    left: 16px;
}

/* Show floating toggle on all screen sizes */
@media (min-width: 1024px) {
    .floating-lang-toggle {
        /* Show on desktop too for consistency */
        display: flex;
        bottom: 24px;
        right: 24px;
    }
}

/* ============================================================================
   MOBILE BOTTOM TAB BAR
   ============================================================================ */
.mobile-tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(226, 232, 240, 0.8);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 60;
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.06);
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 16px;
    color: #64748b;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    background: none;
    cursor: pointer;
    min-width: 64px;
}

.tab-item.active {
    color: #2563eb;
}

.tab-item:active {
    transform: scale(0.95);
}

.tab-icon {
    width: 22px;
    height: 22px;
    stroke-width: 2;
}

.tab-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* RTL Tab Bar */
[dir="rtl"] .mobile-tab-bar {
    flex-direction: row-reverse;
}

/* ============================================================================
   MORE MENU (Slide-up)
   ============================================================================ */
.more-menu {
    position: fixed;
    inset: 0;
    z-index: 80;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.more-menu.open {
    pointer-events: auto;
    opacity: 1;
}

.more-menu-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.more-menu.open .more-menu-backdrop {
    opacity: 1;
}

.more-menu-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0));
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 70vh;
    overflow-y: auto;
}

.more-menu.open .more-menu-content {
    transform: translateY(0);
}

.more-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    margin-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.more-menu-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.more-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    color: #334155;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.2s ease;
}

.more-menu-item:hover,
.more-menu-item:active {
    background: #f8fafc;
}

.more-menu-item.text-slate-500 {
    color: #64748b;
    font-weight: 400;
}

/* RTL More Menu */
[dir="rtl"] .more-menu-item {
    flex-direction: row-reverse;
    text-align: right;
}

/* ============================================================================
   GAME CELLS (Tic Tac Toe, Memory Grid)
   ============================================================================ */
.game-cell {
    aspect-ratio: 1;
    background: #ffffff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1.5px solid #e2e8f0;
}

.game-cell:hover { 
    border-color: #cbd5e1;
    background: #f8fafc;
}

.game-cell.taken { 
    cursor: default;
}

.game-cell.taken:hover {
    border-color: #e2e8f0;
    background: #ffffff;
}

.ttt-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 700;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.ttt-cell:hover:not(.taken) { 
    background: #f8fafc; 
    border-color: #cbd5e1; 
    transform: scale(0.98); 
}

.ttt-cell.taken { 
    cursor: default; 
    background: #f1f5f9; 
    border-color: #e2e8f0; 
}

.ttt-cell.x { color: #2563eb; }
.ttt-cell.o { color: #ef4444; }

.memory-cell {
    aspect-ratio: 1;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.1s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.memory-cell.active {
    background: #2563eb;
    border-color: #1d4ed8;
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.5);
    transform: scale(1.05);
}

.memory-cell.success {
    background: #22c55e;
    border-color: #16a34a;
}

.memory-cell.error {
    background: #ef4444;
    border-color: #dc2626;
    animation: shake 0.4s cubic-bezier(.36, .07, .19, .97) both;
}

/* ============================================================================
   GAME CARDS (Games Page)
   ============================================================================ */
.game-card-pulse {
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
}

.game-card-pulse:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.1);
}

/* Premium Games (Grayed Out) */
.game-premium {
    filter: grayscale(30%);
    opacity: 0.8;
}

.game-premium:hover {
    opacity: 0.9;
}

/* ============================================================================
   INPUT GROUPS (Forms)
   ============================================================================ */
.input-group:focus-within label { 
    color: #2563eb; 
}

.input-group:focus-within input { 
    border-color: #2563eb; 
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2); 
}

/* Secure Badge (Payment) */
.secure-badge {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
}

/* ============================================================================
   RTL SUPPORT
   ============================================================================ */
[dir="rtl"] .nav-link.active::after {
    left: auto;
    right: 0;
}

[dir="rtl"] .hud-panel {
    right: auto;
    left: 20px;
}

[dir="rtl"] .trust-indicators {
    right: auto;
    left: 20px;
}

[dir="rtl"] .answer-card:hover {
    transform: translateX(-4px);
}

[dir="rtl"] .input-group input,
[dir="rtl"] .input-group textarea {
    text-align: right;
}

/* RTL Mobile Layout */
[dir="rtl"] .mobile-hero-content {
    text-align: right;
}

[dir="rtl"] .floating-lang-toggle {
    right: auto;
    left: 16px;
}

@media (max-width: 768px) {
    [dir="rtl"] .floating-lang-toggle {
        right: auto;
        left: 16px;
    }
}

/* ============================================================================
   MOBILE HOME PAGE LAYOUT
   ============================================================================ */

/* Mobile Hero Container - Stacked Layout */
.mobile-hero-container {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 90px); /* Fill viewport minus header */
    min-height: calc(100dvh - 90px);
    padding-top: 0;
}

/* Mobile Brain Container - Celebrate the brain with more space */
.mobile-brain-container {
    flex: 1; /* Take remaining space */
    min-height: 200px;
    margin-bottom: 0;
    position: relative;
    z-index: 1;
    overflow: visible; /* Allow particles to show */
    pointer-events: none; /* Allow touch through to canvas below */
}

/* But make cards interactive */
.mobile-brain-card-top,
.mobile-network-card {
    pointer-events: auto;
}

/* Card 1: The Human Brain - top left */
.mobile-brain-card-top {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 200px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    padding: 10px;
    border-radius: 12px;
    border: 1px solid rgba(226, 232, 240, 0.6);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    z-index: 15;
}

/* Card 2: Live Network - bottom right */
.mobile-network-card {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 145px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    padding: 10px;
    border-radius: 12px;
    border: 1px solid rgba(226, 232, 240, 0.6);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    z-index: 15;
}

/* Legacy classes for backwards compatibility */
.mobile-hud-panel {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(226, 232, 240, 0.6);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    z-index: 15;
}

.mobile-brain-card-right {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 110px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    padding: 10px;
    border-radius: 12px;
    border: 1px solid rgba(226, 232, 240, 0.6);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    z-index: 15;
    color: #475569;
    line-height: 1.3;
}

/* Legacy Brain Card Overlay - for backwards compatibility */
.mobile-brain-card-overlay {
    position: absolute;
    bottom: 8px;
    left: 10px;
    right: 10px;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid rgba(226, 232, 240, 0.5);
    font-size: 9px;
    color: #475569;
    line-height: 1.4;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

/* Mobile Hero Content */
.mobile-hero-content {
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 20;
    background: transparent;
    padding: 0 8px;
    margin-top: 0;
    border-radius: 0;
}

/* Frosted Glass Panel for Mobile */
.mobile-glass-panel {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(16px) saturate(150%);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    border-radius: 24px;
    padding: 20px 16px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.1), 
                0 4px 12px rgba(0, 0, 0, 0.05),
                inset 0 1px 0 rgba(255, 255, 255, 0.5);
    margin: 0 4px;
}

/* Footer outside glass panel */
.mobile-footer-outside {
    padding: 0 8px;
}

/* Desktop: No glass panel needed */
@media (min-width: 1024px) {
    .mobile-glass-panel {
        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border: none;
        box-shadow: none;
        padding: 0;
        margin: 0;
        border-radius: 0;
    }
}

/* Mobile HUD Badge */
.mobile-hud-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid rgba(226, 232, 240, 0.5);
    font-size: 11px;
    width: fit-content;
}


.mobile-subtitle {
    font-size: 11px;
    line-height: 1.5;
}

.mobile-hero-title {
    font-size: 1.4rem !important;
    line-height: 1.2 !important;
    letter-spacing: -0.025em;
}

@media (min-width: 375px) {
    .mobile-hero-title {
        font-size: 1.5rem !important;
    }
}

@media (min-width: 400px) {
    .mobile-hero-title {
        font-size: 1.6rem !important;
    }
}

@media (min-width: 480px) {
    .mobile-hero-title {
        font-size: 1.75rem !important;
    }
}

/* Mobile Subtitle */
.mobile-subtitle {
    font-size: 0.75rem !important;
    padding: 0.6rem 0.75rem !important;
    line-height: 1.5 !important;
}

/* Mobile typography refinements */
@media (max-width: 1023px) {
    /* Better line heights for mobile */
    .mobile-hero-content p {
        font-size: 0.9375rem;
        line-height: 1.6;
    }
    
    /* Navigation on mobile */
    nav .text-xs {
        font-size: 0.65rem;
    }
    
    /* Improve readability of subtitle */
    .mobile-hero-content .text-base {
        font-size: 0.9375rem;
        line-height: 1.55;
    }
}

/* Mobile CTA Container */
.mobile-cta-container {
    margin-top: 0.75rem;
    padding-bottom: 1.5rem;
}

.mobile-cta-container a {
    transition: all 0.2s ease;
}

.mobile-cta-container a:active {
    transform: scale(0.98);
    opacity: 0.9;
}

/* Ensure btn-primary is full width on mobile */
@media (max-width: 1023px) {
    .mobile-cta-container .btn-primary {
        width: 100%;
        padding: 12px 18px;
        font-size: 0.8125rem;
        border-radius: 10px;
    }
    
    .mobile-cta-container .flex.gap-2\.5 a {
        padding: 10px 12px;
        font-size: 0.6875rem;
    }
}

/* Mobile Home Section adjustments */
@media (max-width: 1023px) {
    .mobile-home-section {
        padding-top: 85px !important; /* Adjusted for thinner nav (36px news + 44px nav) */
        padding-bottom: 0 !important;
        align-items: flex-start !important;
    }
    
    .mobile-home-section > div {
        padding-top: 0;
        padding-bottom: 0;
    }
}

/* ============================================================================
   MOBILE OPTIMIZATIONS
   ============================================================================ */
@media (max-width: 768px) {
    .hud-panel { 
        display: none !important; /* Hide HUD on mobile home */
    }
    
    /* Trust indicators hidden on mobile - replaced by tab bar */
    .trust-indicators { 
        display: none !important;
    }
    
    [dir="rtl"] .hud-panel {
        display: none !important;
    }

    /* Answer Grid Responsive */
    #q-options {
        grid-template-columns: 1fr;
    }
    
    /* Floating toggle position */
    .floating-lang-toggle {
        bottom: 16px;
        right: 10px;
    }
}

/* ============================================================================
   ANIMATIONS - GPU Accelerated
   ============================================================================ */

/* IQ Games Button Pulse */
.iq-games-btn-home {
    animation: pulse-glow-subtle 3s ease-in-out infinite;
}

.iq-games-btn-home:hover {
    animation: pulse-glow-subtle 2s ease-in-out infinite;
}

@keyframes pulse-glow-subtle {
    0%, 100% {
        box-shadow: 0 0 5px rgba(168, 85, 247, 0.3), 0 0 10px rgba(236, 72, 153, 0.2);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 10px rgba(168, 85, 247, 0.5), 0 0 20px rgba(236, 72, 153, 0.3);
        transform: scale(1.02);
    }
}

/* Shimmer Animation */
@keyframes shimmer {
    0% { background-position: 200% center; }
    100% { background-position: -200% center; }
}

.animate-shimmer {
    animation: shimmer 4s ease-in-out infinite;
}

/* Shimmer text effect */
.shimmer-text {
    background: linear-gradient(90deg, #2563eb 0%, #22d3ee 50%, #2563eb 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 3s ease-in-out infinite;
}

/* Pulse Slow Animation */
@keyframes pulse-slow {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.9; }
}

.animate-pulse-slow {
    animation: pulse-slow 3s ease-in-out infinite;
}

/* Spin Slow Animation */
@keyframes spin-slow {
    to { transform: rotate(360deg); }
}

.animate-spin-slow {
    animation: spin-slow 2s linear infinite;
}

/* Loading Animation */
@keyframes loading {
    from { width: 0%; }
    to { width: 100%; }
}

/* Shake Animation */
@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* Reduced Motion - Respects user preference */
@media (prefers-reduced-motion: reduce) {
    .iq-games-btn-home,
    .animate-shimmer,
    .animate-pulse-slow,
    .animate-spin-slow,
    .news-ticker-scroll-wrapper,
    .game-card-pulse {
        animation: none !important;
    }
    
    .page-content,
    .page-transition-overlay {
        transition: none !important;
    }
    
    * {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* ============================================================================
   SCROLLBAR HIDING
   ============================================================================ */
.custom-scroll::-webkit-scrollbar { 
    display: none; 
}

.custom-scroll { 
    -ms-overflow-style: none; 
    scrollbar-width: none; 
}

/* Hide all scrollbars on page sections */
.page-section::-webkit-scrollbar { 
    display: none; 
}

.page-section { 
    -ms-overflow-style: none; 
    scrollbar-width: none; 
}

/* Custom scrollbars for games page */
::-webkit-scrollbar { 
    width: 6px; 
}

::-webkit-scrollbar-track { 
    background: transparent; 
}

::-webkit-scrollbar-thumb { 
    background: #cbd5e1; 
    border-radius: 3px; 
}

::-webkit-scrollbar-thumb:hover { 
    background: #94a3b8; 
}

/* ============================================================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================================================ */

/* Ensure minimum touch target size (44x44px per Apple HIG) */
@media (hover: none) and (pointer: coarse) {
    .nav-link,
    .btn-primary,
    .answer-card,
    .game-cell,
    .ttt-cell,
    .memory-cell,
    button {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Disable hover effects on touch devices */
    .nav-link:hover,
    .btn-primary:hover,
    .answer-card:hover,
    .game-card-pulse:hover {
        transform: none;
    }
    
    /* Add active states for touch feedback */
    .nav-link:active,
    .btn-primary:active,
    .answer-card:active,
    .game-card-pulse:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
    
    /* Faster transitions for touch responsiveness */
    .nav-link,
    .btn-primary,
    .answer-card,
    .game-card-pulse {
        transition-duration: 0.1s;
    }
}

/* ============================================================================
   SAFE AREA INSETS (Notched devices)
   ============================================================================ */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
    
    .trust-indicators {
        bottom: max(20px, calc(env(safe-area-inset-bottom) + 10px));
    }
    
    @media (max-width: 768px) {
        .trust-indicators {
            bottom: max(10px, calc(env(safe-area-inset-bottom) + 5px));
        }
    }
}

/* ============================================================================
   PERFORMANCE OPTIMIZATIONS
   ============================================================================ */

/* Enable hardware acceleration for animated elements */
.page-transition-overlay,
.page-content,
.news-ticker-scroll-wrapper,
.game-card-pulse,
.ttt-cell,
.memory-cell {
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Clean up will-change after animation completes */
.page-content.loaded {
    will-change: auto;
}

/* Optimize font rendering */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Prevent layout shifts */
img {
    max-width: 100%;
    height: auto;
}

/* ============================================================================
   FOCUS STYLES (Accessibility)
   ============================================================================ */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Remove default focus outline when not using keyboard */
:focus:not(:focus-visible) {
    outline: none;
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */
@media print {
    #canvas-layer,
    .hud-panel,
    .trust-indicators,
    nav,
    footer,
    .page-transition-overlay {
        display: none !important;
    }
    
    main {
        margin: 0;
        padding: 0;
    }
    
    * {
        background: white !important;
        color: black !important;
    }
}
