@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Performance optimizations */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    scroll-behavior: smooth;
    /* Prevent horizontal overflow on mobile */
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* Global performance optimizations */
* {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-perspective: 1000;
    perspective: 1000;
}

/* Hardware acceleration for animations */
.card, .card-content, .card-image, .refresh-btn, .nav-link {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform, opacity;
}

/* SVG Animation Enhancements */
.svg-image {
    transform-origin: center center;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.card-image-container {
    perspective: 1000px;
    -webkit-perspective: 1000px;
}

/* Enhanced SVG hover effects */
.svg-image:hover {
    filter: brightness(1.1) saturate(1.2);
    transition: filter 0.3s ease;
}

/* Smooth SVG loading */
.svg-image[src*=".svg"] {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Performance optimization for SVG animations */
@media (prefers-reduced-motion: reduce) {
    .svg-floating {
        animation: none !important;
    }
    
    .card-image {
        transition: none !important;
    }
}

/* Optimize transitions */
.card {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reduce paint operations */
.card-image {
    contain: layout style paint;
}

/* Optimize scrolling */
.cards-container {
    contain: layout style;
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(to right, #ece9e6, #ffffff);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeSpeed;
    /* Mobile viewport optimizations */
    width: 100%;
    max-width: 100vw;
    position: relative;
    /* Prevent unwanted touch behaviors */
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    text-align: left;
    margin-top: 30px;
    margin-left: -20px;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    position: relative;
    z-index: 100;
    padding: 10px 20px 0 20px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 20px;
    padding-top: 0;
}

.header-left {
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.header-nav {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Navigation Styles - Header Menu */
.main-nav {
    display: flex;
    gap: 40px;
    justify-content: center;
    align-items: center;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    text-decoration: none;
    color: #374151;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
    font-size: 1rem;
    border-bottom: 2px solid transparent;
}

.nav-link:hover {
    color: #1f2937;
    border-bottom-color: #d1d5db;
}

.nav-link.active {
    color: #6366f1;
    border-bottom-color: #6366f1;
    font-weight: 600;
}

.nav-link i {
    font-size: 0.9rem;
    transition: transform 0.2s ease;
}

.nav-link:hover i {
    transform: scale(1.05);
}

.header-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.app-header h1 {
    font-size: 4rem;
    font-weight: 800;
    color: #667eea;
    margin: 0;
    text-shadow: none;
    letter-spacing: -1px;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1;
    padding: 0;
}

.app-header h1:hover {
    color: #5a67d8;
    transform: scale(1.05);
}

.refresh-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.refresh-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.refresh-btn:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #667eea 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.refresh-btn:hover::before {
    left: 100%;
}

.refresh-btn:active {
    transform: translateY(0px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* Music Toggle Button */
.music-toggle {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.music-toggle:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.music-toggle i {
    margin-right: 5px;
}

/* Premium Toggle Button */
.premium-toggle {
    background: linear-gradient(135deg, #ffd700 0%, #ffb347 100%);
    border: none;
    color: #333;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(255, 215, 0, 0.3);
    margin-right: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.premium-toggle:hover {
    background: linear-gradient(135deg, #ffb347 0%, #ffd700 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 215, 0, 0.4);
}

.premium-toggle.active {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(255, 107, 107, 0.3);
}

.premium-toggle.active:hover {
    background: linear-gradient(135deg, #ee5a24 0%, #ff6b6b 100%);
    box-shadow: 0 4px 8px rgba(255, 107, 107, 0.4);
}

.premium-label {
    font-size: 12px;
    font-weight: 600;
}





/* Authentication styles removed */





.cards-container {
    position: relative;
    min-height: 650px;
    margin: 0 auto 40px auto; /* Add bottom margin to create space before footer */
    perspective: 1000px;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible; /* Ensure cards remain visible at all widths */
    max-width: 100vw; /* Prevent overflow beyond viewport */
    width: 100%;
    /* Ensure the container takes up the available space properly */
    height: 100%;
    max-height: calc(100vh - 200px); /* Account for header and footer */
}

.card {
    position: absolute;
    width: 320px;
    max-width: 90vw; /* Prevent cards from being wider than viewport */
    min-width: 320px; /* Fixed minimum width - cards never get slimmer */
    height: 620px; /* Further reduced to remove more excess space at bottom */
    background: #ffffff;
    border-radius: 25px; /* Slightly larger radius */
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
    cursor: grab;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease-out;
    transform-style: preserve-3d;
    transform: translate3d(0, 0, 0); /* Force hardware acceleration - clean positioning only */
    overflow: hidden; /* Let card-content handle scrolling */
    user-select: none;
    will-change: transform, opacity;
    backface-visibility: hidden;
    border: 1px solid rgba(0,0,0,0.05);
    /* Touch screen optimizations */
    -webkit-overflow-scrolling: touch;
    touch-action: auto; /* Allow both horizontal and vertical touch actions for swipe and scroll */
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    -webkit-touch-callout: none;
    /* Ensure clean stacking - prevent any unwanted rotations or tilts */
    rotate: none;
}

.card:active {
    cursor: grabbing;
}

/* Ensure all cards are properly centered and positioned */
.cards-container .card {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translate3d(0, 0, 0) !important; /* Responsive centering */
    /* Force proper centering */
    margin: 0 !important;
    position: absolute !important;
}

/* Reset any unwanted transforms on card initialization */
.card:not(.swiped):not([style*="transition"]) {
    transform: translate(-50%, -50%) translate3d(0, 0, 0) !important;
}

/* Show only the top card - hide background cards but ensure they can become visible when needed */
.card:nth-child(n+2):not(.swiped) {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    /* Allow cards to become visible when they move to top position */
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Ensure the top card is always visible and interactive */
.card:nth-child(1):not(.swiped),
.card:first-child:not(.swiped) {
    opacity: 1 !important;
    pointer-events: auto !important;
    visibility: visible !important;
    /* Ensure mobile cards are always visible */
    display: block !important;
}

.card:nth-child(1) {
    z-index: 100;
    transform: translate(-50%, -50%) translate3d(0px, 0px, 0);
    will-change: transform;
}

.card:nth-child(2) {
    z-index: 99;
    transform: translate(-50%, -50%) translate3d(0px, 0px, 0);
    will-change: transform;
}

.card:nth-child(3) {
    z-index: 98;
    transform: translate(-50%, -50%) translate3d(0px, 0px, 0);
    will-change: transform;
}

.card:nth-child(4) {
    z-index: 97;
    transform: translate(-50%, -50%) translate3d(0px, 0px, 0);
    will-change: transform;
}

.card:nth-child(5) {
    z-index: 96;
    transform: translate(-50%, -50%) translate3d(0px, 0px, 0);
    will-change: transform;
}

.card:hover:not(.swiped) {
    transform: translate(-50%, -50%) translate3d(0, -10px, 0);
    z-index: 10 !important;
    box-shadow: 0 25px 45px rgba(0,0,0,0.2);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease-out;
    will-change: transform, box-shadow;
}

.card.swiped {
    pointer-events: none;
    transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.3s ease-out !important;
    will-change: transform, opacity;
}

.card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box; /* Include padding in height calculation */
    height: 100%; /* Take full height of card */
    overflow-y: auto; /* Enable vertical scrolling */
    overflow-x: hidden; /* Prevent horizontal scrolling */
    /* Enhanced touch screen optimizations */
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y; /* Allow vertical scrolling within content area */
    /* Improved momentum scrolling */
    scroll-behavior: smooth;
    overscroll-behavior: contain;
    /* Better scroll performance */
    will-change: scroll-position;
    transform: translateZ(0); /* Hardware acceleration */
    /* Allow text selection in content area */
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Touch feedback removed - will be rebuilt with proper implementation */

/* Enhanced touch feedback for buttons */
button.touch-active,
.btn.touch-active,
.play-btn.touch-active {
    background-color: rgba(102, 126, 234, 0.8) !important;
    color: white !important;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.25), 0 0 0 2px rgba(102, 126, 234, 0.4) !important;
    opacity: 0.95 !important;
    transition: all 0.1s ease !important;
}

/* Touch feedback for cards */
.card.touch-active {
    background-color: rgba(255, 255, 255, 0.05) !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2), inset 0 1px 3px rgba(255, 255, 255, 0.1) !important;
    opacity: 0.95 !important;
    transition: all 0.1s ease !important;
}

/* Touch feedback for navigation links */
.nav-link.touch-active {
    background-color: rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    opacity: 0.9 !important;
}

/* Custom scrollbar for webkit browsers */
.card::-webkit-scrollbar {
    width: 12px; /* Make scrollbar wider and more visible */
}

.card::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1); /* Light background for track */
    border-radius: 6px;
}

.card::-webkit-scrollbar-thumb {
    background-color: #999; /* Darker thumb for visibility */
    border-radius: 6px;
    border: 2px solid rgba(255,255,255,0.2);
}

.card::-webkit-scrollbar-thumb:hover {
    background-color: #666; /* Even darker on hover */
}

.card-content::-webkit-scrollbar {
    width: 8px; /* Make scrollbar wider and more visible */
}

.card-content::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1); /* Light background for track */
    border-radius: 4px;
}

.card-content::-webkit-scrollbar-thumb {
    background-color: #999; /* Darker thumb for visibility */
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.2);
}

.card-content::-webkit-scrollbar-thumb:hover {
    background-color: #666; /* Even darker on hover */
}

/* Scroll indicator - only show when there's overflow */
.card-content.has-overflow::after {
    content: '';
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(transparent, rgba(255, 255, 255, 0.8));
    pointer-events: none;
    z-index: 10;
}

.card-header {
    text-align: center;
    margin-bottom: 15px;
    position: relative;
}

.sound-toggle {
    position: absolute;
    top: -5px;
    right: 10px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #ddd;
    border-radius: 50%;
    width: 52px; /* Increased for better touch target */
    height: 52px; /* Increased for better touch target */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 18px; /* Larger font for better visibility */
    color: #666;
    z-index: 10;
    /* Touch optimizations */
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    touch-action: manipulation;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    /* Ensure minimum touch target */
    min-width: 52px;
    min-height: 52px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

.sound-toggle:hover {
    background: rgba(255, 255, 255, 1);
    border-color: #4ecdc4;
    color: #4ecdc4;
    box-shadow: 0 6px 20px rgba(78, 205, 196, 0.3);
}

.sound-toggle:active {
    background: rgba(78, 205, 196, 0.1);
    border-color: #4ecdc4;
    box-shadow: 0 2px 8px rgba(78, 205, 196, 0.4);
    transition: all 0.1s ease;
}

/* Touch-specific feedback for sound toggle */
@media (hover: none) and (pointer: coarse) {
    .sound-toggle:hover {
        transform: none;
        background: rgba(255, 255, 255, 0.95);
        border-color: #ddd;
        color: #666;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    
    .sound-toggle:active {
        background: rgba(78, 205, 196, 0.1);
        border-color: #4ecdc4;
        color: #4ecdc4;
        box-shadow: 0 2px 8px rgba(78, 205, 196, 0.4);
    }
}

/* Ripple effect for sound toggle */
.sound-toggle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(78, 205, 196, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
    pointer-events: none;
}

.sound-toggle:active::before {
    width: 60px;
    height: 60px;
}

.sound-toggle.sound-on {
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    color: white;
    border-color: #4ecdc4;
}

.sound-toggle.sound-off {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    border-color: #ff6b6b;
}

.sound-toggle.speaking {
    animation: pulse 1.5s infinite;
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    color: white;
    border-color: #4ecdc4;
}

/* Voice Selector Styling */
.voice-selector {
    display: none; /* Hidden as requested */
    margin-left: 10px;
    padding: 8px 12px;
    border-radius: 20px;
    border: 2px solid #4ecdc4;
    background: white;
    color: #333;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    min-width: 200px;
}

.voice-selector:hover {
    border-color: #44a08d;
    box-shadow: 0 2px 8px rgba(68, 160, 141, 0.3);
}

.voice-selector:focus {
    border-color: #44a08d;
    box-shadow: 0 0 0 3px rgba(68, 160, 141, 0.2);
}

.voice-selector option {
    padding: 8px;
    background: white;
    color: #333;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.card-type {
    background: linear-gradient(45deg, #5a67d8, #886aea);
    color: white;
    padding: 8px 18px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2d3748;
    margin: 12px 0;
}

.card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    text-align: center;
    min-height: 0; /* Allow flex item to shrink */
}

.card-description {
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
}

.card-image {
    width: 100%;
    max-height: 150px; /* Limit image height to allow more space for text */
    object-fit: cover;
    border-radius: 10px;
    margin: 10px 0;
    flex-shrink: 0; /* Prevent image from shrinking */
}

.play-btn {
    background: linear-gradient(45deg, #4facfe, #00f2fe);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.4);
    /* Touch optimizations */
    min-height: 52px;
    min-width: 120px;
    font-size: 16px;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    touch-action: manipulation;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 172, 254, 0.5);
}

.play-btn:active {
    background: linear-gradient(45deg, #3d8bfe, #00d4fe);
    transform: translateY(-1px);
    box-shadow: 0 2px 10px rgba(79, 172, 254, 0.6);
    transition: all 0.1s ease;
}

/* Touch-specific feedback for play button */
@media (hover: none) and (pointer: coarse) {
    .play-btn:hover {
        transform: none;
    }
    
    .play-btn:active {
        background: linear-gradient(45deg, #3d8bfe, #00d4fe);
        box-shadow: 0 2px 10px rgba(79, 172, 254, 0.6);
        opacity: 0.9;
    }
}

/* Ripple effect for play button */
.play-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
    pointer-events: none;
}

.play-btn:active::before {
    width: 120px;
    height: 120px;
}

/* Game play button styles - enhanced for touch */
.game-play-btn {
    background: linear-gradient(45deg, #4facfe, #00f2fe);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.4);
    /* Enhanced touch optimizations */
    min-height: 56px;
    min-width: 140px;
    font-size: 16px;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    touch-action: manipulation;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    position: relative;
    overflow: hidden;
    /* Ensure proper z-index for touch events */
    z-index: 10;
    /* Better touch target */
    padding: 18px 36px;
    margin: 20px 0;
}

.game-play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 172, 254, 0.5);
}

.game-play-btn:active {
    background: linear-gradient(45deg, #3d8bfe, #00d4fe);
    transform: translateY(-1px);
    box-shadow: 0 2px 10px rgba(79, 172, 254, 0.6);
    transition: all 0.1s ease;
}

/* Enhanced touch-specific feedback for game play button */
@media (hover: none) and (pointer: coarse) {
    .game-play-btn {
        min-height: 60px;
        min-width: 160px;
        padding: 20px 40px;
        font-size: 18px;
        margin: 25px 0;
    }
    
    .game-play-btn:hover {
        transform: none;
    }
    
    .game-play-btn:active {
        background: linear-gradient(45deg, #3d8bfe, #00d4fe);
        box-shadow: 0 2px 10px rgba(79, 172, 254, 0.6);
        opacity: 0.9;
    }
}

/* Enhanced ripple effect for game play button */
.game-play-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
    pointer-events: none;
}

.game-play-btn:active::before {
    width: 140px;
    height: 140px;
}

/* Show answer button styles - enhanced for touch */
.show-answer-btn {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    /* Enhanced touch optimizations */
    min-height: 56px;
    min-width: 140px;
    font-size: 16px;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    touch-action: manipulation;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    position: relative;
    overflow: hidden;
    /* Ensure proper z-index for touch events */
    z-index: 10;
    /* Better touch target */
    padding: 18px 36px;
    margin: 20px 0;
}

.show-answer-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.5);
}

.show-answer-btn:active {
    background: linear-gradient(45deg, #ee5a24, #d63031);
    transform: translateY(-1px);
    box-shadow: 0 2px 10px rgba(255, 107, 107, 0.6);
    transition: all 0.1s ease;
}

/* Enhanced touch-specific feedback for show answer button */
@media (hover: none) and (pointer: coarse) {
    .show-answer-btn {
        min-height: 60px;
        min-width: 160px;
        padding: 20px 40px;
        font-size: 18px;
        margin: 25px 0;
    }
    
    .show-answer-btn:hover {
        transform: none;
    }
    
    .show-answer-btn:active {
        background: linear-gradient(45deg, #ee5a24, #d63031);
        box-shadow: 0 2px 10px rgba(255, 107, 107, 0.6);
        opacity: 0.9;
    }
}

/* Enhanced ripple effect for show answer button */
.show-answer-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
    pointer-events: none;
}

.show-answer-btn:active::before {
    width: 140px;
    height: 140px;
}

.swipe-indicator {
    position: absolute;
    bottom: 10px;
    right: 15px;
    color: #999;
    font-size: 0.8rem;
}



.instructions {
    text-align: center;
    color: #666;
    margin: 30px 0 40px 0; /* Add bottom margin to create space before footer */
    font-size: 1.1rem;
    opacity: 0.75;
    text-shadow: none;
    font-family: 'Fredoka', sans-serif;
    font-weight: bold;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 15px;
    /* Touch optimizations for close button */
    min-height: 48px;
    min-width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    touch-action: manipulation;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    z-index: 1001;
    transition: all 0.2s ease;
    border-radius: 50%;
    /* Better touch target area */
    padding: 10px;
    right: 10px;
    top: 5px;
}

.close:hover {
    color: #000;
    background: rgba(0, 0, 0, 0.1);
}

.close:active {
    transform: scale(0.9);
    background: rgba(0, 0, 0, 0.2);
}

/* Touch-specific feedback for close button */
@media (hover: none) and (pointer: coarse) {
    .close {
        min-height: 52px;
        min-width: 52px;
        font-size: 32px;
        right: 8px;
        top: 3px;
    }
    
    .close:hover {
        background: none;
    }
    
    .close:active {
        background: rgba(0, 0, 0, 0.15);
        transform: scale(0.85);
    }
}

/* Game Styles */
.game-board {
    display: grid;
    gap: 8px;
    margin: 20px auto;
    justify-content: center;
    max-width: 100%;
    padding: 10px;
}

.tic-tac-toe {
    grid-template-columns: repeat(3, 80px);
    grid-template-rows: repeat(3, 80px);
}

.connect4 {
    grid-template-columns: repeat(7, 60px);
    grid-template-rows: repeat(6, 60px);
}

.game-cell {
    background: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    transition: all 0.15s ease;
    /* Enhanced touch optimizations */
    min-height: 56px;
    min-width: 56px;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    /* Visual feedback */
    position: relative;
    overflow: hidden;
    /* Better mobile interaction */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.game-cell:hover {
    background: #e0e0e0;
    transform: scale(1.05);
}

/* Touch-specific feedback for game cells */
@media (hover: none) and (pointer: coarse) {
    .game-cell:active {
        transform: scale(0.95);
        background: rgba(255, 255, 255, 0.2);
    }
    
    .game-cell::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.3);
        transform: translate(-50%, -50%);
        transition: width 0.3s ease, height 0.3s ease;
        pointer-events: none;
    }
    
    .game-cell:active::before {
        width: 80px;
        height: 80px;
    }
}

.game-status {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 20px 0;
    color: #333;
}

.reset-game-btn {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    margin: 15px auto;
    display: block;
    /* Enhanced touch optimization */
    min-height: 48px;
    min-width: 120px;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    touch-action: manipulation;
    user-select: none;
    transition: all 0.15s ease;
    font-size: 1rem;
}

.reset-game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.reset-game-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Chess puzzle styles */
#chessBoard {
    margin: 20px auto;
    border: 2px solid #333;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.chess-status {
    text-align: center;
    margin: 10px 0;
    font-weight: bold;
    font-size: 16px;
}

/* Chess puzzle difficulty badges */
.difficulty-badge {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.difficulty-easy {
    background-color: #4CAF50;
    color: white;
}

.difficulty-medium {
    background-color: #FF9800;
    color: white;
}

.difficulty-hard {
    background-color: #f44336;
    color: white;
}

/* Chess puzzle header styling */
.chess-puzzle-header h3 {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 600;
}

/* Progress indicator */
.progress-indicator {
    background-color: #f0f0f0;
    border-radius: 10px;
    padding: 5px 10px;
    font-size: 11px;
    color: #555;
}

/* Stats modal styling */
.stats-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.stats-content {
    background-color: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.stats-content h3 {
    margin-top: 0;
    color: #333;
    font-size: 24px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 20px 0;
}

.stat-item {
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #007bff;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #007bff;
    display: block;
}

.stat-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Answer section styles */
.answer-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #e0e0e0;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    padding: 15px;
    margin: 15px -5px 0 -5px;
}

.answer-divider {
    width: 50px;
    height: 3px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    margin: 0 auto 15px auto;
    border-radius: 2px;
}

.answer-content {
    text-align: left;
}

.answer-title, .solution-title {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
}

.answer-title::before {
    content: "💡";
    margin-right: 8px;
    font-size: 1.1rem;
}

.solution-title::before {
    content: "🔍";
    margin-right: 8px;
    font-size: 1.1rem;
}

.answer-text {
    background: #fff;
    padding: 10px 12px;
    border-radius: 8px;
    border-left: 4px solid #4ecdc4;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 15px 0;
    font-size: 1.05rem;
}

.solution-text {
    background: #fff;
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    color: #555;
    line-height: 1.5;
    margin: 0;
    font-size: 0.95rem;
}

/* Disabled button styles */
.play-btn:disabled {
    background: linear-gradient(45deg, #95a5a6, #7f8c8d) !important;
    cursor: default !important;
    transform: none !important;
    box-shadow: none !important;
}

.play-btn:disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* Mobile floating action button */
@media (max-width: 768px) {
    .app-container {
        padding: 8px 15px; /* Reduced top/bottom padding */
        padding-bottom: 80px; /* Add space for floating button */
    }
    
    .app-header {
        flex-direction: column;
        text-align: left;
        margin-bottom: 20px; /* Reduced margin to bring cards closer */
        gap: 15px;
        position: relative;
        z-index: 100; /* Ensure header stays above cards */
        padding-bottom: 15px; /* Reduced padding at bottom of header */
        margin-top: 15px; /* Reduced top margin to lower logo */
        margin-left: -15px;
        padding: 10px 15px 15px 15px;
    }
    
    .app-header h1 {
        font-size: 4rem;
        margin-bottom: 8px; /* Reduced margin for tighter spacing */
    }
    
    /* Mobile header layout - new structure */
    .header-top {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 20px;
        padding-top: 0;
    }
    
    .header-nav {
        width: 100%;
        display: flex;
        justify-content: center;
        margin-bottom: 10px; /* Reduced margin to bring cards closer */
    }
    
    .main-nav {
        background: none !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        gap: 20px;
    }
    
    .nav-link {
        background: none !important;
        border: none !important;
        box-shadow: none !important;
        padding: 8px 0 !important;
        font-size: 16px !important;
        border-bottom: 2px solid transparent !important;
        transition: all 0.3s ease !important;
    }
    
    .nav-link:hover {
        background: none !important;
        border-bottom-color: #667eea !important;
        transform: none !important;
    }
    
    .nav-link.active {
        background: none !important;
        border-bottom-color: #667eea !important;
        color: #667eea !important;
    }
    
    /* Mobile header layout - legacy support */
    .header-left, .header-center, .header-right {
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .header-left {
        order: 1;
        justify-content: flex-start !important;
        width: auto !important;
        flex: 0 0 auto !important;
    }
    
    .header-center {
        order: 2;
        margin: 8px 0; /* Reduced margin for tighter spacing */
    }
    
    .header-right {
        order: 3;
        justify-content: flex-end !important;
        width: auto !important;
        flex: 0 0 auto !important;
    }
    
    /* Only the main refresh button becomes floating */
    .app-header #refreshBtn {
        position: fixed;
        bottom: 20px;
        right: 20px;
        padding: 12px 20px;
        font-size: 0.9rem;
        z-index: 1000;
        border-radius: 30px;
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border: none;
        color: white;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    .app-header #refreshBtn:hover {
        background: linear-gradient(135deg, #5a67d8 0%, #667eea 100%);
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    }
    
    /* Other buttons stay in header but get smaller */
    .app-header .refresh-btn:not(#refreshBtn) {
        padding: 8px 12px;
        font-size: 0.8rem;
        margin: 5px;
        border-radius: 20px;
    }
    
    /* Music toggle button - circular with music icon */
    .music-toggle {
        width: 32px !important;
        height: 32px !important;
        padding: 0 !important;
        font-size: 12px !important;
        border-radius: 50% !important;
        position: relative;
        margin-right: 10px;
        z-index: 1001;
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
        min-width: auto;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        border: none !important;
        color: white !important;
        cursor: pointer !important;
        transition: all 0.3s ease !important;
    }
    
    .music-toggle:hover {
        transform: scale(1.1) !important;
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4) !important;
        background: linear-gradient(135deg, #5a67d8 0%, #667eea 100%) !important;
    }
    
    /* Donation button - circular matching music toggle */
    .donation-button {
        width: 32px !important;
        height: 32px !important;
        padding: 0 !important;
        font-size: 12px !important;
        border-radius: 50% !important;
        position: relative;
        margin-right: 10px;
        z-index: 1001;
        box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
        min-width: auto;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%) !important;
        border: none !important;
        color: white !important;
        cursor: pointer !important;
        transition: all 0.3s ease !important;
        text-decoration: none !important;
    }
    
    .donation-button:hover {
        transform: scale(1.1) !important;
        box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4) !important;
        background: linear-gradient(135deg, #ee5a24 0%, #ff6b6b 100%) !important;
    }

    /* Floating New Cards Button for Desktop */
    .floating-refresh-btn {
        position: fixed;
        bottom: 30px;
        right: 15px;
        z-index: 1000;
        box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
        border-radius: 50px;
        padding: 8px 12px;
        font-size: 0.8rem;
        font-weight: 600;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border: none;
        color: white;
        cursor: pointer;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        gap: 3px;
        white-space: nowrap;
        min-width: auto;
        max-width: fit-content;
    }

    .floating-refresh-btn:hover {
        background: linear-gradient(135deg, #5a67d8 0%, #667eea 100%);
        transform: translateY(-3px);
        box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
    }

    .floating-refresh-btn i {
        font-size: 1rem;
    }


    
    /* Authentication mobile styles removed */
    
    /* Voice selector adjustments for mobile */
    .voice-selector {
        min-width: 160px;
        font-size: 12px;
        padding: 6px 10px;
        margin: 5px;
        border-radius: 15px;
    }
    
    .card {
        width: 280px;
        height: 480px; /* Increased height for better mobile experience while still compact */
    }
    
    .cards-container {
        height: 520px; /* Adjusted to match card height */
        margin-top: 45px; /* Adjusted for closer button positioning */
        clear: both; /* Ensure cards don't overlap with fixed elements */
    }
    
    .instructions {
        margin-top: 20px;
        font-size: 1rem;
        padding: 0 10px;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 20px;
    }
    
    /* Tablet game responsiveness */
    .tic-tac-toe {
        grid-template-columns: repeat(3, 70px);
        grid-template-rows: repeat(3, 70px);
    }
    
    .connect4 {
        grid-template-columns: repeat(7, 50px);
        grid-template-rows: repeat(6, 50px);
    }
    
    .game-cell {
        font-size: 1.8rem;
        border-radius: 8px;
    }
    
    /* Chess board tablet responsiveness */
    #chessBoard {
        max-width: 350px;
        margin: 20px auto;
    }
}

/* Large mobile devices (601px to 768px) */
/* Removed responsive card sizing - cards maintain desktop dimensions */

@media (max-width: 480px) {
    .app-container {
        padding: 10px;
        padding-bottom: 75px; /* Space for floating button */
    }
    
    .app-header {
        margin-top: 40px !important; /* Position lower */
        margin-left: -10px !important; /* Position at left */
        margin-bottom: 5px !important; /* Minimal margin */
        gap: 8px;
        padding: 5px 10px 5px 10px !important; /* Minimal padding with left/right spacing */
        text-align: left !important; /* Ensure left alignment */
    }

    .app-header h1 {
        font-size: 3.6rem;
        margin-bottom: 5px !important; /* Minimal margin */
    }
    
    /* Smaller floating button for mobile */
    .floating-refresh-btn {
        position: fixed !important;
        bottom: 15px !important;
        right: 15px !important;
        padding: 10px 16px !important;
        font-size: 0.85rem !important;
        border-radius: 25px !important;
        z-index: 1000 !important;
        box-shadow: 0 3px 15px rgba(102, 126, 234, 0.3) !important;
    }


    
    /* Other buttons get even smaller on small screens */
    .app-header .refresh-btn:not(#refreshBtn) {
        padding: 6px 10px;
        font-size: 0.75rem;
        margin: 3px;
    }
    
    /* Smaller circular music toggle for small screens */
    .music-toggle {
        width: 28px !important;
        height: 28px !important;
        font-size: 10px !important;
        margin-right: 8px !important;
    }
    
    /* Smaller circular donation button for small screens */
    .donation-button {
        width: 28px !important;
        height: 28px !important;
        font-size: 10px !important;
        margin-right: 8px !important;
    }
    
    /* Enhanced mobile game responsiveness */
    .game-board {
        gap: 6px !important;
        padding: 8px !important;
        margin: 15px auto !important;
    }
    
    .tic-tac-toe {
        grid-template-columns: repeat(3, 70px) !important;
        grid-template-rows: repeat(3, 70px) !important;
    }
    
    .connect4 {
        grid-template-columns: repeat(7, 42px) !important;
        grid-template-rows: repeat(6, 42px) !important;
    }
    
    .game-cell {
        font-size: 1.6rem !important;
        border-radius: 8px !important;
        min-height: 60px !important;
        min-width: 60px !important;
        border-width: 1px !important;
    }
    
    .game-status {
        font-size: 1.1rem !important;
        margin: 12px 0 !important;
        padding: 0 10px !important;
    }
    
    .reset-game-btn {
        padding: 14px 28px !important;
        font-size: 1.1rem !important;
        min-height: 52px !important;
        margin: 20px auto !important;
    }
    
    /* Chess board mobile responsiveness */
    #chessBoard {
        max-width: 280px !important;
        margin: 15px auto !important;
    }
    
    .chess-status {
        font-size: 14px !important;
        margin: 8px 0 !important;
    }
    
    /* Authentication tiny screen styles removed */
    
    .user-name {
        font-size: 10px !important;
        max-width: 60px !important;
    }
    
    .sign-out-btn {
        padding: 3px 5px !important;
        font-size: 9px !important;
    }
    
    /* Position header-right closer to edge on small screens */
    .header-right {
        top: 50px !important;
        right: 8px !important;
    }
    
    .voice-selector {
        min-width: 140px;
        font-size: 11px;
        padding: 5px 8px;
        margin: 3px;
    }
    
    /* Mobile-optimized card dimensions - compact for better mobile experience */
    .cards-container {
        margin-top: -10px !important; /* Negative margin to bring cards even closer to header */
        height: calc(100vh - 80px) !important; /* Increased height for taller cards */
        min-height: calc(100vh - 80px) !important;
        padding: 0 !important; /* Remove padding to ensure perfect centering */
        /* Ensure container is properly positioned for centering */
        position: relative !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }
    
    .card {
        width: min(320px, calc(100vw - 20px)) !important; /* Responsive width that fits in viewport */
        max-width: calc(100vw - 20px) !important; /* Never exceed viewport width minus padding */
        min-width: 280px !important; /* Minimum usable width */
        height: calc(100vh - 140px) !important; /* Increased height for better content display */
        min-height: calc(100vh - 140px) !important; /* Ensure cards fit in viewport */
        /* Ensure proper centering on small mobile screens */
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) translate3d(0, 0, 0) !important;
        position: absolute !important;
        margin: 0 !important; /* Remove margin to ensure perfect centering */
    }
    
    /* Ensure all small mobile cards maintain proper centering */
    .cards-container .card:nth-child(1),
    .cards-container .card:nth-child(2),
    .cards-container .card:nth-child(3),
    .cards-container .card:nth-child(4),
    .cards-container .card:nth-child(5) {
        transform: translate(-50%, -50%) translate3d(0px, 0px, 0) !important;
    }
    
    /* Ensure top card is always visible on small mobile screens */
    .card:nth-child(1):not(.swiped),
    .card:first-child:not(.swiped) {
        opacity: 1 !important;
        visibility: visible !important;
        display: block !important;
        pointer-events: auto !important;
    }
    
    .card-content {
        padding: 25px !important; /* More padding for mobile */
        height: calc(100% - 80px) !important; /* Fill the card height minus header */
        overflow-y: auto !important; /* Enable scrolling if needed */
    }
    
    /* Clean card stacking - cards directly behind each other with responsive centering */
    .cards-container .card:nth-child(1) {
        transform: translate(-50%, -50%) translate3d(0px, 0px, 0) !important;
        z-index: 100 !important;
    }
    
    .cards-container .card:nth-child(2) {
        transform: translate(-50%, -50%) translate3d(0px, 0px, 0) !important;
        z-index: 99 !important;
    }
    
    .cards-container .card:nth-child(3) {
        transform: translate(-50%, -50%) translate3d(0px, 0px, 0) !important;
        z-index: 98 !important;
    }
    
    .cards-container .card:nth-child(4) {
        transform: translate(-50%, -50%) translate3d(0px, 0px, 0) !important;
        z-index: 97 !important;
    }
    
    .cards-container .card:nth-child(5) {
        transform: translate(-50%, -50%) translate3d(0px, 0px, 0) !important;
        z-index: 96 !important;
    }
    
    .card-title {
        font-size: 1.4rem !important; /* Larger title for mobile */
        margin-bottom: 20px !important;
    }
    
    .card-description {
        font-size: 1rem !important; /* Larger description text */
        line-height: 1.6 !important;
        margin-bottom: 20px !important;
    }
    
    /* Adjust sound button for taller mobile cards */
    .sound-toggle {
        top: 10px !important; /* Move down from top */
        right: 15px !important; /* Move in from right */
        width: 56px !important; /* Larger touch target for mobile */
        height: 56px !important; /* Larger touch target for mobile */
        font-size: 20px !important; /* Larger icon for mobile */
        min-width: 56px !important;
        min-height: 56px !important;
    }
    
    /* Enhanced play button for mobile */
    .play-btn {
        padding: 18px 36px !important;
        min-height: 56px !important;
        min-width: 140px !important;
        font-size: 18px !important;
        margin-top: 20px !important;
    }
    
    /* Enhanced card back and save buttons for mobile */
    .card-back-btn, .card-save-btn {
        width: 56px !important;
        height: 56px !important;
        min-width: 56px !important;
        min-height: 56px !important;
        font-size: 20px !important;
        top: 12px !important;
    }
    
    .card-back-btn {
        left: 12px !important;
    }
    
    .card-save-btn {
        right: 12px !important;
    }
    
    .card-header {
        margin-bottom: 25px !important; /* More space below header */
        padding-top: 15px !important; /* More space above header */
    }
    
    .instructions {
        font-size: 1rem !important; /* Larger instructions text */
        margin-top: 25px !important;
        line-height: 1.5 !important;
    }
    

}

/* Touch screen optimizations for all interactive elements */
button, .btn, .control-btn, .refresh-btn, .play-btn, .voice-selector, select, input {
    /* Minimum touch target size - increased to 48px for better accessibility */
    min-height: 48px;
    min-width: 48px;
    /* Remove default touch highlights */
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    /* Optimize touch interactions */
    touch-action: manipulation;
    /* Prevent text selection on buttons */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    /* Improve touch responsiveness */
    cursor: pointer;
    /* Add padding for better touch area */
    padding: 8px 12px;
    /* Smooth transitions for touch feedback */
    transition: all 0.15s ease;
    /* Visual touch feedback */
    position: relative;
    overflow: hidden;
}

/* Touch feedback animation */
button:active, .btn:active, .control-btn:active, .refresh-btn:active, .play-btn:active {
    transform: scale(0.95);
    background-color: rgba(255, 255, 255, 0.1);
}

/* Enhanced touch feedback for JavaScript-controlled touch events */
.touch-active {
    background-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15) !important;
    transition: background-color 0.1s ease, box-shadow 0.1s ease !important;
}

/* Enhanced touch feedback for card buttons removed - will be rebuilt */

/* Ripple effect for touch feedback */
button::before, .btn::before, .control-btn::before, .refresh-btn::before, .play-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
    pointer-events: none;
}

button:active::before, .btn:active::before, .control-btn:active::before, .refresh-btn:active::before, .play-btn:active::before {
    width: 100px;
    height: 100px;
}

/* Chess board touch optimizations */
.chess-board, #chessBoard {
    /* Enable touch interactions for chess pieces */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    min-height: 44px;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    /* Allow all touch actions for chess interaction */
    touch-action: auto;
}

/* Chess piece touch optimization */
#chessBoard .piece-417db {
    cursor: grab;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    /* Allow touch manipulation for dragging pieces */
    touch-action: auto;
    user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
}

#chessBoard .piece-417db:active {
    cursor: grabbing;
}

/* Chess square touch optimization */
#chessBoard .square-55d63 {
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    /* Allow touch actions on squares for piece dropping */
    touch-action: auto;
    user-select: none;
    position: relative;
}

/* Touch drag highlights for chess */
#chessBoard .square-55d63.highlight-source {
    background-color: rgba(0, 150, 255, 0.4) !important;
    box-shadow: inset 0 0 0 3px rgba(0, 150, 255, 0.6);
}

#chessBoard .square-55d63.highlight-target {
    background-color: rgba(0, 255, 0, 0.3) !important;
    box-shadow: inset 0 0 0 2px rgba(0, 255, 0, 0.6);
}

/* Enhanced touch support for chess pieces on mobile */
@media (hover: none) and (pointer: coarse) {
    #chessBoard .piece-417db {
        /* Larger touch targets on mobile */
        min-width: 44px;
        min-height: 44px;
        /* Disable text selection */
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        /* Prevent callout on touch and hold */
        -webkit-touch-callout: none;
        /* Prevent tap highlight */
        -webkit-tap-highlight-color: transparent;
    }
    
    #chessBoard {
        /* Prevent scrolling when dragging */
        touch-action: none;
        /* Disable text selection */
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
}

/* Additional mobile touch optimizations */
@media (max-width: 768px) {
    /* Increase touch targets for mobile */
    .card {
        width: 320px !important; /* Fixed width - never gets slimmer */
        min-width: 320px !important; /* Minimum width enforced */
        height: calc(100vh - 200px) !important; /* Compact height to fit screen without scrolling */
        min-height: calc(100vh - 200px) !important; /* Ensure cards fit in viewport */
        margin: 0 !important; /* Remove margin to ensure perfect centering */
        /* Ensure proper centering on mobile */
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) translate3d(0, 0, 0) !important;
        position: absolute !important;
    }
    
    .card-content {
        padding: 20px;
        line-height: 1.6;
        height: calc(100% - 60px) !important; /* Adjust content height */
        overflow-y: auto !important; /* Enable scrolling within card if needed */
    }
    
    .cards-container {
        height: calc(100vh - 160px) !important; /* Container height to match cards */
        min-height: calc(100vh - 160px) !important;
        /* Ensure container is properly positioned for centering */
        position: relative !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }
    
    /* Ensure all mobile cards maintain proper centering */
    .cards-container .card:nth-child(1),
    .cards-container .card:nth-child(2),
    .cards-container .card:nth-child(3),
    .cards-container .card:nth-child(4),
    .cards-container .card:nth-child(5) {
        transform: translate(-50%, -50%) translate3d(0px, 0px, 0) !important;
    }
    
    /* Ensure top card is always visible on mobile */
    .card:nth-child(1):not(.swiped),
    .card:first-child:not(.swiped) {
        opacity: 1 !important;
        visibility: visible !important;
        display: block !important;
        pointer-events: auto !important;
    }
    
    /* Larger chess board for mobile */
    #chessBoard {
        width: 100% !important;
        max-width: 400px;
        margin: 0 auto;
    }
    
    /* Better button spacing for touch */
    button, .sound-toggle, .voice-selector {
        margin: 10px 6px;
        min-height: 52px;
        min-width: 52px;
        padding: 10px 14px;
        font-size: 16px;
    }
    
    /* Improve scroll indicators */
    .card::-webkit-scrollbar {
        width: 8px;
        background: rgba(0,0,0,0.1);
    }
    
    .card::-webkit-scrollbar-thumb {
        background: rgba(0,0,0,0.3);
        border-radius: 4px;
    }
}

/* Game canvas touch optimizations */
canvas {
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    /* Hardware acceleration for better performance */
    will-change: transform;
    transform: translateZ(0);
    /* Smooth interactions */
    transition: transform 0.1s ease;
}

/* Modal touch optimizations */
.modal-content {
    /* Enable scrolling in modals */
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

/* Improve scrollbar visibility on touch devices */
@media (pointer: coarse) {
    .card::-webkit-scrollbar {
        width: 16px; /* Wider scrollbar for touch */
    }
    
    .card::-webkit-scrollbar-thumb {
        background-color: #666;
        border-radius: 8px;
        border: 3px solid rgba(255,255,255,0.3);
    }
    
    .card-content::-webkit-scrollbar {
        width: 12px; /* Wider scrollbar for touch */
    }
    
    .card-content::-webkit-scrollbar-thumb {
        background-color: #666;
        border-radius: 6px;
        border: 2px solid rgba(255,255,255,0.3);
    }
}

/* Blog Styles */
.blog-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: calc(100vh - 80px);
}

.blog-header {
    text-align: center;
    margin-bottom: 50px;
    color: white;
}

.blog-header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.blog-header p {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

.blog-posts {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.blog-post {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.blog-post:hover {
    transform: translateY(-5px);
    box-shadow: 0 30px 60px rgba(0,0,0,0.15);
}

/* Post Preview Styles */
.post-preview {
    display: block;
}

.post-full-content {
    display: none;
}

.read-more-btn, .read-less-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    margin: 15px 0;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.read-more-btn:hover, .read-less-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
    color: white;
    text-decoration: none;
}

/* Individual Blog Post Styles */
.blog-post-single {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.breadcrumb {
    margin-bottom: 30px;
}

.breadcrumb a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 25px;
    background: rgba(102, 126, 234, 0.1);
    transition: all 0.3s ease;
}

.breadcrumb a:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: translateX(-5px);
}

.full-post {
    margin-bottom: 0;
}

.full-post .post-header h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    line-height: 1.2;
}

.full-post .post-content {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 40px;
}

.full-post .post-content h3 {
    color: #667eea;
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 1.4rem;
}

.full-post .post-content ul {
    margin: 15px 0;
    padding-left: 25px;
}

.full-post .post-content li {
    margin-bottom: 8px;
}

.social-share {
    display: flex;
    gap: 10px;
    align-items: center;
}

.share-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.comments-section h3 {
    color: white;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

/* Authentication modal styles removed */

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

.post-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 15px;
    line-height: 1.3;
}

.post-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    font-size: 0.9rem;
    color: #666;
}

.post-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.author {
    font-weight: 600;
    color: #667eea;
}

.post-content {
    line-height: 1.8;
    color: #444;
    margin-bottom: 30px;
}

.post-content h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
    margin: 25px 0 15px 0;
}

.post-content p {
    margin-bottom: 20px;
}

.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.post-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tag {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.show-comments-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.show-comments-btn:hover {
    background: #5a67d8;
    transform: translateY(-2px);
}

.comments-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #f0f0f0;
}

.add-comment {
    margin-bottom: 30px;
}

.add-comment textarea {
    width: 100%;
    min-height: 100px;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    margin-bottom: 15px;
    transition: border-color 0.3s ease;
}

.add-comment textarea:focus {
    outline: none;
    border-color: #667eea;
}

.add-comment-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.add-comment-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.comment {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 15px;
    position: relative;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.comment-author {
    font-weight: 600;
    color: #667eea;
}

.comment-date {
    font-size: 0.8rem;
    color: #666;
}

.comment-content {
    color: #444;
    line-height: 1.6;
}

.delete-comment-btn {
    background: #e53e3e;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.delete-comment-btn:hover {
    background: #c53030;
    transform: scale(1.05);
}

/* Extra small screens */
/* Extra small devices - ensure no overlap */
@media (max-width: 360px) {
    .app-container {
        padding: 8px;
        padding-top: 50px; /* Extra top padding to avoid fixed buttons */
    }
    
    .app-header {
        margin-bottom: 30px;
        padding-bottom: 15px;
    }
    
    .app-header h1 {
        font-size: 1.6rem;
    }
    
    /* Ultra-compact circular music toggle for tiny screens */
    .music-toggle {
        width: 24px !important;
        height: 24px !important;
        font-size: 8px !important;
        margin-right: 6px !important;
    }
    
    /* Ultra-compact circular donation button for tiny screens */
    .donation-button {
        width: 24px !important;
        height: 24px !important;
        font-size: 8px !important;
        margin-right: 6px !important;
    }
    
    /* Ultra-compact authentication styles removed */
    
    .header-right {
        top: 45px !important;
        right: 6px !important;
    }
    
    .cards-container {
        margin-top: 35px; /* Adjusted for ultra-compact button positioning */
        padding: 0 !important; /* Remove padding to ensure perfect centering */
    }
    
    .card {
        width: min(280px, calc(100vw - 10px)) !important; /* Even more compact for tiny screens */
        max-width: calc(100vw - 10px) !important;
        min-width: 260px !important;
    }
    
    /* Enhanced extra small mobile game responsiveness */
    .game-board {
        gap: 3px !important;
        padding: 5px !important;
        margin: 8px auto !important;
        max-width: 95% !important;
    }
    
    .tic-tac-toe {
        grid-template-columns: repeat(3, 55px) !important;
        grid-template-rows: repeat(3, 55px) !important;
    }
    
    .connect4 {
        grid-template-columns: repeat(7, 32px) !important;
        grid-template-rows: repeat(6, 32px) !important;
    }
    
    .game-cell {
        font-size: 1.1rem !important;
        border-radius: 5px !important;
        min-height: 48px !important;
        min-width: 48px !important;
        border-width: 1px !important;
        padding: 2px !important;
    }
    
    .game-status {
        font-size: 0.95rem !important;
        margin: 8px 0 !important;
        padding: 0 5px !important;
        line-height: 1.3 !important;
    }
    
    .reset-game-btn {
        padding: 10px 16px !important;
        font-size: 0.9rem !important;
        min-height: 44px !important;
        margin: 12px auto !important;
        min-width: 100px !important;
    }
    
    /* Chess board extra small mobile responsiveness */
    #chessBoard {
        max-width: 240px !important;
        margin: 10px auto !important;
    }
    
    .chess-status {
        font-size: 12px !important;
        margin: 6px 0 !important;
    }
    
    /* Flappy Bird canvas mobile responsiveness */
    #flappyCanvas {
        max-width: 95% !important;
        width: 280px !important;
        height: 224px !important;
        margin: 10px auto !important;
        display: block !important;
    }
    
    .play-btn {
        padding: 8px 16px !important;
        font-size: 0.9rem !important;
        min-height: 44px !important;
        min-width: 100px !important;
    }
    
    /* Cards maintain desktop dimensions - no responsive sizing */
    
    /* Clean card stacking for very small screens with responsive centering */
    .cards-container .card:nth-child(1) {
        transform: translate(-50%, -50%) translate3d(0px, 0px, 0) !important;
        z-index: 100 !important;
    }
    
    .cards-container .card:nth-child(2) {
        transform: translate(-50%, -50%) translate3d(0px, 0px, 0) !important;
        z-index: 99 !important;
    }
    
    .cards-container .card:nth-child(3) {
        transform: translate(-50%, -50%) translate3d(0px, 0px, 0) !important;
        z-index: 98 !important;
    }
    
    .cards-container .card:nth-child(4) {
        transform: translate(-50%, -50%) translate3d(0px, 0px, 0) !important;
        z-index: 97 !important;
    }
    
    .cards-container .card:nth-child(5) {
        transform: translate(-50%, -50%) translate3d(0px, 0px, 0) !important;
        z-index: 96 !important;
    }
}

/* Ultra-small screens (less than 300px) */
@media (max-width: 300px) {
    .cards-container {
        margin-top: 20px !important;
        padding: 0 5px !important;
    }
    
    .card {
        width: min(260px, calc(100vw - 10px)) !important; /* Ultra-compact for tiny screens */
        max-width: calc(100vw - 10px) !important;
        min-width: 240px !important;
    }
    
    /* Flappy Bird ultra-small screen optimization */
    #flappyCanvas {
        max-width: 90% !important;
        width: 240px !important;
        height: 192px !important;
        margin: 8px auto !important;
    }
    
    .play-btn {
        padding: 6px 12px !important;
        font-size: 0.8rem !important;
        min-height: 40px !important;
        min-width: 80px !important;
    }
    
    /* Clean card stacking for ultra-small screens with responsive centering */
    .cards-container .card:nth-child(1) {
        transform: translate(-50%, -50%) translate3d(0px, 0px, 0) !important;
        z-index: 100 !important;
    }
    
    .cards-container .card:nth-child(2) {
        transform: translate(-50%, -50%) translate3d(0px, 0px, 0) !important;
        z-index: 99 !important;
    }
    
    .cards-container .card:nth-child(3) {
        transform: translate(-50%, -50%) translate3d(0px, 0px, 0) !important;
        z-index: 98 !important;
    }
    
    .cards-container .card:nth-child(4) {
        transform: translate(-50%, -50%) translate3d(0px, 0px, 0) !important;
        z-index: 97 !important;
    }
    
    .card:nth-child(5) {
        transform: translate3d(0px, 0px, 0) !important;
        z-index: 96 !important;
    }
    
    .card-content {
        padding: 15px !important;
    }
    
    .card-title {
        font-size: 1rem !important;
    }
    
    .card-description {
        font-size: 0.8rem !important;
    }
    

}

    /* Additional styles for refresh button and voice selector */
    .floating-refresh-btn {
        bottom: 12px !important;
        right: 12px !important;
        padding: 8px 14px !important;
        font-size: 0.8rem !important;
        border-radius: 20px !important;
    }

/* Card Back Button - Circular button on the card */
.card-back-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #667eea;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #667eea;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10;
    backdrop-filter: blur(10px);
    /* Touch optimizations */
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    touch-action: manipulation;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    /* Ensure minimum touch target */
    min-width: 48px;
    min-height: 48px;
}

.card-back-btn:hover {
    background: #667eea;
    color: white;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.card-back-btn:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

/* Touch-specific feedback */
@media (hover: none) and (pointer: coarse) {
    .card-back-btn:hover {
        transform: none;
    }
    
    .card-back-btn:active {
        background: #667eea;
        color: white;
        transform: scale(0.95);
    }
}

/* Card Save Button - Circular button on the card */
.card-save-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #28a745;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #28a745;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10;
    backdrop-filter: blur(10px);
    /* Touch optimizations */
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    touch-action: manipulation;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    /* Ensure minimum touch target */
    min-width: 48px;
    min-height: 48px;
}

.card-save-btn:hover {
    background: #28a745;
    color: white;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.3);
}

.card-save-btn:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

/* Touch-specific feedback */
@media (hover: none) and (pointer: coarse) {
    .card-save-btn:hover {
        transform: none;
    }
    
    .card-save-btn:active {
        background: #28a745;
        color: white;
        transform: scale(0.95);
    }
}

.card-save-btn.saved {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

.card-save-btn.saved:hover {
    background: #dc3545;
    border-color: #dc3545;
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.3);
    transform: scale(1.05);
}

/* Touch-specific feedback for saved state */
@media (hover: none) and (pointer: coarse) {
    .card-save-btn.saved:hover {
        transform: none;
        background: #28a745;
        border-color: #28a745;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    
    .card-save-btn.saved:active {
        background: #dc3545;
        border-color: #dc3545;
        transform: scale(0.95);
    }
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .card-back-btn {
        width: 44px;
        height: 44px;
        font-size: 16px;
        top: 10px;
        left: 10px;
        /* Maintain touch target size */
        min-width: 44px;
        min-height: 44px;
    }
    
    .card-save-btn {
        width: 44px;
        height: 44px;
        font-size: 16px;
        top: 10px;
        right: 10px;
        /* Maintain touch target size */
        min-width: 44px;
        min-height: 44px;
    }
}
    
    /* Very small buttons for extra small screens */
    .app-header .refresh-btn:not(#refreshBtn) {
        padding: 5px 8px;
        font-size: 0.7rem;
        margin: 2px;
    }
    
    .voice-selector {
        min-width: 140px;
        font-size: 11px;
        margin: 2px;
        padding: 4px 6px;
    }
}

/* Contact Form Styles */
.contact-btn {
    background: none !important;
    border: none !important;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
}

.contact-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.contact-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.contact-modal-header h2 {
    color: #1a202c;
    margin: 0;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-contact-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
}

.close-contact-btn:hover {
    background: #f7fafc;
    color: #333;
}

.contact-btn:hover {
    background: none !important;
}

.contact-modal-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    position: relative;
}

.contact-form-container {
    padding: 30px;
}

.contact-form-container h2 {
    color: #1a202c;
    margin-bottom: 10px;
    font-size: 1.8rem;
    text-align: center;
}

.contact-form-container p {
    color: #666;
    text-align: center;
    margin-bottom: 30px;
    line-height: 1.6;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.form-group label i {
    color: #667eea;
    width: 16px;
}

.form-group input,
.form-group textarea {
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fff;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 20px;
}

.submit-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.cancel-btn {
    background: #f7fafc;
    color: #4a5568;
    border: 2px solid #e2e8f0;
    padding: 12px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cancel-btn:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
    transform: translateY(-1px);
}

/* Success message styles */
.success-message {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.success-message i {
    font-size: 1.2rem;
}

/* Responsive contact form */
@media (max-width: 768px) {
    .contact-modal-content {
        width: 95%;
        margin: 20px auto;
    }
    
    .contact-form-container {
        padding: 20px;
    }
    
    .contact-form-container h2 {
        font-size: 1.5rem;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .submit-btn,
    .cancel-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .contact-form-container {
        padding: 15px;
    }
    
    .contact-form-container h2 {
        font-size: 1.3rem;
    }
    
    .form-group input,
    .form-group textarea {
        padding: 10px 12px;
        font-size: 0.95rem;
    }
}

/* Cards maintain desktop dimensions across all screen sizes - no responsive card sizing */

/* Note: Mobile card styling is handled in the main mobile media query above */

/* Card Back Button Styles */
.card-back-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #667eea;
    border-radius: 50%;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
}

.card-back-btn:hover {
    background: #667eea;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.card-back-btn i {
    font-size: 16px;
    color: #667eea;
    transition: color 0.3s ease;
}

.card-back-btn:hover i {
    color: white;
}

/* Mobile adjustments for card back button */
@media (max-width: 768px) {
    .card-back-btn {
        width: 35px;
        height: 35px;
        top: 12px;
        left: 12px;
    }
    
    .card-back-btn i {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .card-back-btn {
        width: 32px;
        height: 32px;
        top: 10px;
        left: 10px;
    }
    
    .card-back-btn i {
        font-size: 12px;
    }
}

/* Saved Cards Modal Styles */
.saved-cards-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.saved-cards-content {
    background: white;
    border-radius: 15px;
    padding: 0;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.saved-cards-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid #e2e8f0;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 15px 15px 0 0;
}

.saved-cards-header h2 {
    margin: 0;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-saved-cards {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-saved-cards:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.saved-cards-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    max-height: calc(80vh - 80px);
}

.saved-card-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 15px;
    background: #f8fafc;
    transition: all 0.3s ease;
}

.saved-card-item:hover {
    border-color: #667eea;
    background: #f1f5f9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.saved-card-info {
    flex: 1;
    margin-right: 15px;
}

.saved-card-info h3 {
    margin: 0 0 8px 0;
    color: #1a202c;
    font-size: 1.1rem;
    font-weight: 600;
}

.saved-card-info p {
    margin: 0 0 10px 0;
    color: #4a5568;
    font-size: 0.9rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.saved-card-category {
    display: inline-block;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 10px;
}

.saved-card-date {
    color: #718096;
    font-size: 0.75rem;
    font-style: italic;
}

.saved-card-actions {
    display: flex;
    gap: 10px;
}

.view-saved-card,
.remove-saved-card {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 16px;
}

.view-saved-card {
    background: #667eea;
    color: white;
}

.view-saved-card:hover {
    background: #5a67d8;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.remove-saved-card {
    background: #fed7d7;
    color: #e53e3e;
}

.remove-saved-card:hover {
    background: #e53e3e;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.3);
}

/* No saved cards message */
.no-saved-cards-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.no-saved-cards-message .message-content {
    background: white;
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.no-saved-cards-message i {
    font-size: 3rem;
    color: #cbd5e0;
    margin-bottom: 20px;
}

.no-saved-cards-message h3 {
    color: #1a202c;
    margin: 0 0 15px 0;
    font-size: 1.5rem;
}

.no-saved-cards-message p {
    color: #4a5568;
    margin: 0;
    line-height: 1.6;
}

/* Mobile responsive adjustments for saved cards */
@media (max-width: 768px) {
    .saved-cards-content {
        width: 95%;
        max-height: 85vh;
    }
    
    .saved-cards-header {
        padding: 15px 20px;
    }
    
    .saved-cards-header h2 {
        font-size: 1.3rem;
    }
    
    .saved-cards-list {
        padding: 15px;
    }
    
    .saved-card-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .saved-card-info {
        margin-right: 0;
        width: 100%;
    }
    
    .saved-card-actions {
        align-self: flex-end;
    }
    
    .view-saved-card,
    .remove-saved-card {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .saved-cards-header {
        padding: 12px 15px;
    }
    
    .saved-cards-header h2 {
        font-size: 1.2rem;
    }
    
    .saved-cards-list {
        padding: 10px;
    }
    
    .saved-card-item {
        padding: 12px;
    }
    
    .no-saved-cards-message .message-content {
        padding: 30px 20px;
    }
    
    .no-saved-cards-message h3 {
        font-size: 1.3rem;
    }
}

/* Footer Styles */
.app-footer {
    margin-top: auto;
    padding: 2rem 0 1rem 0;
    border-top: 1px solid rgba(102, 126, 234, 0.1);
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    transition: all 0.3s ease;
    background: rgba(102, 126, 234, 0.05);
}

.footer-link:hover {
    color: #5a67d8;
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.footer-link i {
    font-size: 0.8rem;
}

.footer-separator {
    color: #cbd5e0;
    font-weight: 300;
    margin: 0 0.5rem;
}

.footer-copyright {
    text-align: center;
}

.footer-copyright p {
    color: #718096;
    font-size: 0.8rem;
    margin: 0;
    font-weight: 400;
}

/* Mobile responsive adjustments for footer */
@media (max-width: 768px) {
    .app-footer {
        padding: 1.5rem 0 1rem 0;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Enhanced Touch Screen Optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Mobile-specific touch optimizations */
    
    /* Ensure minimum touch target sizes (44px recommended) */
    button, .btn, .nav-link, .sound-toggle, .close, .play-btn {
        min-height: 44px !important;
        min-width: 44px !important;
        padding: 12px 16px !important;
    }
    
    /* Enhanced card touch interactions */
    .card {
        /* Allow both horizontal swipe and vertical scroll */
        touch-action: auto !important;
        /* Improve touch responsiveness */
        -webkit-user-select: none;
        user-select: none;
        /* Better touch feedback */
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Card content scrolling optimization */
    .card-content {
        /* Smooth scrolling on mobile */
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        /* Prevent overscroll bounce */
        overscroll-behavior: contain;
        /* Better scroll performance */
        will-change: scroll-position;
    }
    
    /* Improve button touch feedback */
    button:active, .btn:active, .play-btn:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
    
    /* Navigation touch improvements */
    .nav-link {
        padding: 16px 20px !important;
        margin: 4px 0 !important;
    }
    
    /* Game elements touch optimization */
    .game-cell, .premium-card {
        min-height: 48px !important;
        min-width: 48px !important;
        touch-action: manipulation;
    }
    
    /* Scrollbar improvements for mobile */
    .card::-webkit-scrollbar {
        width: 6px;
    }
    
    .card-content::-webkit-scrollbar {
        width: 4px;
    }
    
    /* Better visual feedback for touch */
    .touch-active {
        background-color: rgba(255, 255, 255, 0.08) !important;
        box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12) !important;
        opacity: 0.92 !important;
        transition: background-color 0.08s ease, box-shadow 0.08s ease, opacity 0.08s ease !important;
    }
    
    /* Prevent text selection during swipe */
    .card * {
        -webkit-user-select: none;
        user-select: none;
    }
    
    /* Allow text selection only in specific content areas */
    .card-content p, .card-content span, .card-content div:not(.game-container) {
        -webkit-user-select: text;
        user-select: text;
    }
}

/* Additional optimizations for all touch devices */
@media (pointer: coarse) {
    /* Larger touch targets for better accessibility */
    .sound-toggle, .close {
        padding: 12px !important;
        min-height: 44px !important;
        min-width: 44px !important;
    }
    
    /* Better spacing for touch interactions */
    .nav-links {
        gap: 8px;
    }
    
    /* Clean card stacking on touch devices */
    .card:nth-child(2) {
        transform: translate3d(0px, 0px, 0);
        z-index: 99;
    }
    
    .card:nth-child(3) {
        transform: translate3d(0px, 0px, 0);
        z-index: 98;
    }
    
    .card:nth-child(4) {
        transform: translate3d(0px, 0px, 0);
        z-index: 97;
    }
    
    .card:nth-child(5) {
        transform: translate3d(0px, 0px, 0);
        z-index: 96;
    }

    .footer-separator {
        display: none;
    }
    
    .footer-link {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }
    
    .footer-copyright p {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .app-footer {
        padding: 1rem 0 0.5rem 0;
    }
    
    .footer-content {
        gap: 0.75rem;
    }
    
    .footer-link {
        font-size: 0.8rem;
        padding: 0.3rem 0.6rem;
    }
}

/* Donation Button - Circular style matching music toggle */
.donation-button {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(255, 107, 107, 0.3);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
}

.donation-button:hover {
    background: linear-gradient(135deg, #ee5a24 0%, #ff6b6b 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 107, 107, 0.4);
}

.donation-button i {
    font-size: 14px;
    animation: heartbeat 2s ease-in-out infinite;
}

@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}