.hero-section {
    width: 100%;
    min-height: 340px;
    padding: 24px 16px 0 16px;
    margin-bottom: 24px;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

.hero-inner {
    width: 100%;
    position: relative;
    z-index: 1;
}

.hero-effect-wrap {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
}

#heroEffectCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Hero glass card: row  -  left content, right Three.js */
.hero-card-content {
    flex: 0 0 50%;
    min-width: 0;
    max-width: 50%;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
}
.hero-3d-wrap {
    flex: 0 0 50%;
    min-width: 260px;
    min-height: 260px;
    position: relative;
    overflow: visible;
    /* Allow hover events so 3D auto-explosion trigger works */
    pointer-events: auto;
    opacity: 0;
}
.hero-3d-wrap canvas {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
    background: transparent !important;
}
#hero3dCanvas {
    background: transparent !important;
}
@media (max-width: 768px) {
    .hero-card-content,
    .hero-3d-wrap {
        flex: 0 0 100%;
        max-width: 100%;
    }
    .hero-3d-wrap {
        min-height: 220px;
    }
    .hero-actions {
        justify-content: center;
    }
    .hero-meta {
        text-align: center;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Disable body scroll when popup is open */
html.popup-open {
    overflow: hidden;
    height: 100%;
}

:root {
    /* Default theme: pastel (playful but polished) */
    --page-bg: radial-gradient(1200px 800px at 20% 10%, rgba(255, 255, 255, 0.55), transparent 60%),
        linear-gradient(135deg, #ffdee9 0%, #eef2ff 45%, #b5fffc 100%);
    --page-bg-size: auto;
    --page-bg-animation: none;

    --page-overlay-image: radial-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px);
    --page-overlay-size: 22px 22px;
    --page-overlay-position: 0 0;
    --page-overlay-opacity: 0.10;
    --page-overlay-opacity-mobile: 0.06;

    /* Theme texture layer (background image tiles) */
    --page-texture-image: url("../patterns/pastel-dots.svg");
    --page-texture-size: 120px 120px;
    --page-texture-opacity: 0.80;
    --page-texture-blend: multiply;

    --text-primary: #0b102a;
    --text-secondary: rgba(11, 16, 42, 0.82);
    --text-muted: rgba(11, 16, 42, 0.68);
    --text-shadow-strong: none;
    --text-shadow-soft: none;

    /* Panels/sections: slightly translucent but readable */
    --card-bg: rgba(255, 255, 255, 0.90);
    --card-blur: 14px;
    --card-border-width: 3px;
    --card-border-color: rgba(11, 16, 42, 0.18);
    --card-shadow: 0 12px 36px rgba(11, 16, 42, 0.14);

    --accent-1: #ff4d6d;
    --accent-2: #3b82f6;
    --accent-3: #22c55e;

    /* Small UI surfaces (chips, counters, inner panels) */
    --chip-bg: rgba(255, 255, 255, 0.55);
    --chip-border: rgba(11, 16, 42, 0.16);
    --panel-bg: rgba(255, 255, 255, 0.50);
    --link-color: var(--accent-2);
    --link-hover: var(--accent-1);

    --scrollbar-thumb: linear-gradient(135deg, rgba(255, 77, 109, 0.95), rgba(59, 130, 246, 0.95));
    --scrollbar-track: rgba(255, 255, 255, 0.22);
    --scrollbar-color: rgba(255, 77, 109, 0.9);

    --theme-switcher-bg: rgba(255, 255, 255, 0.55);
    --theme-switcher-border: rgba(11, 16, 42, 0.12);
    --theme-switcher-shadow: 0 10px 24px rgba(11, 16, 42, 0.12);
    --theme-dot-border: rgba(11, 16, 42, 0.22);
    --theme-dot-active-ring: rgba(11, 16, 42, 0.45);

    /* Modal (game result popup) */
    --modal-overlay-bg: rgba(11, 16, 42, 0.32);
    --modal-overlay-bg-mobile: rgba(11, 16, 42, 0.48);
    --modal-bg: rgba(255, 255, 255, 0.92);
    --modal-bg-mobile: rgba(255, 255, 255, 0.96);
    --modal-border-color: var(--card-border-color);
    --modal-shadow: 0 18px 60px rgba(11, 16, 42, 0.22);
    --modal-title-shadow: none;
    --modal-title-color: var(--accent-1);
    --modal-message-color: var(--text-secondary);
    --modal-btn-border: rgba(11, 16, 42, 0.14);
    --modal-btn-shadow: 0 10px 22px rgba(11, 16, 42, 0.18);
    --modal-btn-text-shadow: none;

}

html[data-theme="neon"] {
    /* Cyberpunk dark */
    --page-bg: radial-gradient(900px 700px at 18% 18%, rgba(34, 211, 238, 0.25), transparent 55%),
        radial-gradient(900px 700px at 85% 22%, rgba(255, 61, 127, 0.20), transparent 55%),
        radial-gradient(1200px 900px at 50% 110%, rgba(124, 58, 237, 0.18), transparent 60%),
        linear-gradient(180deg, #050714 0%, #090c22 55%, #070a1a 100%);
    --page-bg-size: auto;
    --page-bg-animation: none;

    /* Subtle neon grid + dots (noisy but controlled) */
    --page-overlay-image:
        linear-gradient(rgba(34, 211, 238, 0.10) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 61, 127, 0.08) 1px, transparent 1px),
        radial-gradient(rgba(255, 255, 255, 0.10) 1px, transparent 1px);
    --page-overlay-size: 38px 38px, 38px 38px, 28px 28px;
    --page-overlay-position: 0 0, 0 0, 0 0;
    --page-overlay-opacity: 0.10;
    --page-overlay-opacity-mobile: 0.06;

    --page-texture-image: url("../patterns/cyber-grid.svg");
    --page-texture-size: 64px 64px;
    --page-texture-opacity: 0.55;
    --page-texture-blend: screen;

    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.88);
    --text-muted: rgba(255, 255, 255, 0.72);
    --text-shadow-strong: 3px 3px 0px rgba(0, 0, 0, 0.35), 6px 6px 10px rgba(0, 0, 0, 0.25);
    --text-shadow-soft: 1px 1px 2px rgba(0, 0, 0, 0.35);

    /* Panels/sections: dark glass (like before), just less transparent */
    --card-bg: linear-gradient(135deg, rgba(12, 16, 34, 0.92), rgba(20, 28, 52, 0.92));
    --card-blur: 18px;
    --card-border-width: 3px;
    --card-border-color: rgba(34, 211, 238, 0.35);
    --card-shadow: 0 18px 60px rgba(0, 0, 0, 0.40),
        0 0 60px rgba(34, 211, 238, 0.14),
        0 0 80px rgba(255, 61, 127, 0.10);

    --accent-1: #22d3ee;
    --accent-2: #ff3d7f;
    --accent-3: #7c3aed;
    /* Hero gradient for neon theme */
    --hero-gradient: linear-gradient(135deg, var(--accent-1), var(--accent-2));

    --chip-bg: rgba(7, 10, 26, 0.65);
    --chip-border: rgba(34, 211, 238, 0.30);
    --panel-bg: rgba(7, 10, 26, 0.55);
    --link-color: var(--accent-1);
    --link-hover: var(--accent-2);

    --scrollbar-thumb: linear-gradient(135deg, rgba(34, 211, 238, 0.95), rgba(124, 58, 237, 0.95));
    --scrollbar-track: rgba(255, 255, 255, 0.10);
    --scrollbar-color: rgba(34, 211, 238, 0.9);

    --theme-switcher-bg: rgba(11, 16, 42, 0.55);
    --theme-switcher-border: rgba(255, 255, 255, 0.16);
    --theme-switcher-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
    --theme-dot-border: rgba(255, 255, 255, 0.35);
    --theme-dot-active-ring: rgba(255, 255, 255, 0.70);

    /* Modal (game result popup) - cyberpunk glass */
    --modal-overlay-bg: rgba(0, 0, 0, 0.48);
    --modal-overlay-bg-mobile: rgba(0, 0, 0, 0.68);
    --modal-bg: linear-gradient(135deg, rgba(12, 16, 34, 0.94), rgba(20, 28, 52, 0.94));
    --modal-bg-mobile: linear-gradient(135deg, rgba(12, 16, 34, 0.96), rgba(20, 28, 52, 0.96));
    --modal-border-color: rgba(34, 211, 238, 0.55);
    --modal-shadow: 0 22px 80px rgba(0, 0, 0, 0.55),
        0 0 80px rgba(34, 211, 238, 0.14),
        0 0 110px rgba(255, 61, 127, 0.10);
    --modal-title-shadow: var(--text-shadow-strong);
    --modal-title-color: var(--accent-1);
    --modal-message-color: var(--text-secondary);
    --modal-btn-border: rgba(255, 255, 255, 0.22);
    --modal-btn-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
    --modal-btn-text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.35);

}

html[data-theme="dark"] {
    /* Cyberpunk (industrial) - different from Neon */
    --page-bg: radial-gradient(900px 700px at 18% 18%, rgba(245, 158, 11, 0.20), transparent 55%),
        radial-gradient(900px 700px at 85% 22%, rgba(34, 211, 238, 0.14), transparent 55%),
        radial-gradient(1200px 900px at 50% 115%, rgba(16, 185, 129, 0.10), transparent 60%),
        linear-gradient(180deg, #05070f 0%, #0a0f1d 60%, #070a14 100%);
    --page-bg-size: auto;
    --page-bg-animation: none;

    /* Subtle scanlines */
    --page-overlay-image: linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    --page-overlay-size: 3px 3px;
    --page-overlay-position: 0 0;
    --page-overlay-opacity: 0.10;
    --page-overlay-opacity-mobile: 0.05;

    --page-texture-image: url("../patterns/cyber-circuit.svg");
    --page-texture-size: 96px 96px;
    --page-texture-opacity: 0.60;
    --page-texture-blend: normal;

    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.86);
    --text-muted: rgba(255, 255, 255, 0.70);
    --text-shadow-strong: 2px 2px 0px rgba(0, 0, 0, 0.35);
    --text-shadow-soft: 1px 1px 2px rgba(0, 0, 0, 0.35);

    /* Panels/sections: darker, less transparent */
    --card-bg: rgba(7, 10, 26, 0.90);
    --card-blur: 16px;
    --card-border-width: 2px;
    --card-border-color: rgba(255, 255, 255, 0.28);
    --card-shadow: 0 16px 55px rgba(0, 0, 0, 0.40);

    --accent-1: #f59e0b; /* amber */
    --accent-2: #22d3ee; /* cyan */
    --accent-3: #10b981; /* green */
    /* Hero gradient for dark theme */
    --hero-gradient: linear-gradient(135deg, var(--accent-1), var(--accent-2));

    --chip-bg: rgba(7, 10, 26, 0.65);
    --chip-border: rgba(245, 158, 11, 0.25);
    --panel-bg: rgba(7, 10, 26, 0.55);
    --link-color: var(--accent-2);
    --link-hover: var(--accent-1);

    /* Scrollbar: amber/yellow to match dark theme accent-1 */
    --scrollbar-thumb: linear-gradient(135deg, rgba(245, 158, 11, 0.95), rgba(251, 191, 36, 0.95));
    --scrollbar-track: rgba(255, 255, 255, 0.10);
    --scrollbar-color: rgba(245, 158, 11, 0.9);

    --theme-switcher-bg: rgba(11, 16, 42, 0.55);
    --theme-switcher-border: rgba(255, 255, 255, 0.16);
    --theme-switcher-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
    --theme-dot-border: rgba(255, 255, 255, 0.35);
    --theme-dot-active-ring: rgba(255, 255, 255, 0.70);

    /* Modal (game result popup) */
    --modal-overlay-bg: rgba(0, 0, 0, 0.70);
    --modal-overlay-bg-mobile: rgba(0, 0, 0, 0.85);
    --modal-bg: rgba(7, 10, 26, 0.92);
    --modal-bg-mobile: rgba(7, 10, 26, 0.95);
    --modal-border-color: rgba(255, 255, 255, 0.28);
    --modal-shadow: 0 22px 80px rgba(0, 0, 0, 0.55);
    --modal-title-shadow: var(--text-shadow-strong);
    --modal-title-color: var(--accent-2);
    --modal-message-color: var(--text-secondary);
    --modal-btn-border: rgba(255, 255, 255, 0.22);
    --modal-btn-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
    --modal-btn-text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.35);

}

html[data-theme="clean"] {
    /* Matrix */
    --page-bg: radial-gradient(900px 700px at 20% 15%, rgba(34, 197, 94, 0.18), transparent 55%),
        radial-gradient(900px 700px at 85% 18%, rgba(16, 185, 129, 0.12), transparent 55%),
        linear-gradient(180deg, #020b05 0%, #071a0d 60%, #020b05 100%);
    --page-bg-size: auto;
    --page-bg-animation: none;

    /* Subtle scanlines */
    --page-overlay-image: linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    --page-overlay-size: 3px 3px;
    --page-overlay-position: 0 0;
    --page-overlay-opacity: 0.10;
    --page-overlay-opacity-mobile: 0.06;

    --page-texture-image: url("../patterns/matrix-rain.svg");
    --page-texture-size: 120px 120px;
    --page-texture-opacity: 0.55;
    --page-texture-blend: screen;

    --text-primary: #eafff0;
    --text-secondary: rgba(234, 255, 240, 0.86);
    --text-muted: rgba(234, 255, 240, 0.70);
    --text-shadow-strong: 2px 2px 0px rgba(0, 0, 0, 0.35);
    --text-shadow-soft: 1px 1px 2px rgba(0, 0, 0, 0.35);

    --card-bg: rgba(2, 11, 5, 0.90);
    --card-blur: 16px;
    --card-border-width: 2px;
    --card-border-color: rgba(34, 197, 94, 0.28);
    --card-shadow: 0 18px 60px rgba(0, 0, 0, 0.45), 0 0 70px rgba(34, 197, 94, 0.10);

    --accent-1: #22c55e; /* matrix green */
    --accent-2: #34d399; /* mint */
    --accent-3: #a7f3d0; /* pale mint */
    /* Hero gradient for clean theme */
    --hero-gradient: linear-gradient(135deg, var(--accent-1), var(--accent-2));

    --chip-bg: rgba(2, 11, 5, 0.70);
    --chip-border: rgba(34, 197, 94, 0.24);
    --panel-bg: rgba(2, 11, 5, 0.55);
    --link-color: var(--accent-1);
    --link-hover: var(--accent-2);

    --scrollbar-thumb: linear-gradient(135deg, rgba(34, 197, 94, 0.95), rgba(52, 211, 153, 0.95));
    --scrollbar-track: rgba(255, 255, 255, 0.10);
    --scrollbar-color: rgba(34, 197, 94, 0.9);

    --theme-switcher-bg: rgba(2, 11, 5, 0.55);
    --theme-switcher-border: rgba(34, 197, 94, 0.20);
    --theme-switcher-shadow: 0 14px 34px rgba(0, 0, 0, 0.40);
    --theme-dot-border: rgba(34, 197, 94, 0.30);
    --theme-dot-active-ring: rgba(34, 197, 94, 0.65);

    /* Modal (game result popup) */
    --modal-overlay-bg: rgba(0, 0, 0, 0.50);
    --modal-overlay-bg-mobile: rgba(0, 0, 0, 0.70);
    --modal-bg: rgba(2, 11, 5, 0.92);
    --modal-bg-mobile: rgba(2, 11, 5, 0.95);
    --modal-border-color: rgba(34, 197, 94, 0.30);
    --modal-shadow: 0 22px 80px rgba(0, 0, 0, 0.55), 0 0 90px rgba(34, 197, 94, 0.10);
    --modal-title-shadow: var(--text-shadow-strong);
    --modal-title-color: var(--accent-1);
    --modal-message-color: var(--text-secondary);
    --modal-btn-border: rgba(34, 197, 94, 0.22);
    --modal-btn-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
    --modal-btn-text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.35);

}

body {
    font-family: 'Shantell Sans', 'Comic Sans MS', 'Comic Sans', cursive, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans', 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    min-height: 100vh;
    display: block;
    padding-bottom: 32px;
    background: var(--page-bg);
    background-size: var(--page-bg-size);
    animation: var(--page-bg-animation);
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: "kern" 1;
    font-kerning: normal;
}

/* Global Scrollbar Styling */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Firefox scrollbar */
html {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-color) var(--scrollbar-track);
}

/* Better font rendering for Android/Samsung devices */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Specific improvements for Android devices */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    body, .message, .leave-button, .about-title, .collection-title, .instruction-text, .about-content {
        -webkit-font-smoothing: antialiased;
        text-rendering: optimizeLegibility;
    }
}

/* Background overlay layers (pattern + texture) */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: var(--page-overlay-image);
    background-size: var(--page-overlay-size);
    background-position: var(--page-overlay-position);
    opacity: var(--page-overlay-opacity);
    pointer-events: none;
    z-index: 0;
}

/* Reduce tile pattern opacity on mobile for better performance */
.is-mobile body::before {
    opacity: var(--page-overlay-opacity-mobile);
}

/* Theme texture layer (tiny tiled image) */
body::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: var(--page-texture-image);
    background-size: var(--page-texture-size);
    background-repeat: repeat;
    opacity: var(--page-texture-opacity);
    mix-blend-mode: var(--page-texture-blend);
    pointer-events: none;
    z-index: 0;
}

/* Controls group (top-left): Difficulty and Stats stacked */
.controls-group {
    position: fixed;
    top: 55px;
    left: 14px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.is-mobile .controls-group {
    top: 55px;
    left: 4px;
}

/* Generic back control button (used on game/pages headers) */
.back-control {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 999px;
    background: var(--theme-switcher-bg);
    border: 1px solid var(--theme-switcher-border);
    box-shadow: var(--theme-switcher-shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: opacity 220ms ease, transform 220ms ease, background 180ms ease, border-color 180ms ease;
    box-sizing: border-box;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.back-control:hover {
    background: color-mix(in srgb, var(--accent-1) 20%, transparent);
    border-color: var(--accent-1);
}

.back-control-btn {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--text-primary);
    transition: color 180ms ease, transform 180ms ease;
}

.back-control-icon {
    width: 20px;
    height: 20px;
    transition: transform 180ms ease;
}

.back-control:hover .back-control-icon {
    transform: translateX(-2px);
}

/* Back-to-home button (content pages: privacy, terms, contact, etc.) */
.back-to-home-wrap {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 500;
}

.is-mobile .back-to-home-wrap {
    top: 4px;
    left: 4px;
}

.back-to-home-wrap .back-control {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 999px;
    background: var(--theme-switcher-bg);
    border: 1px solid var(--theme-switcher-border);
    box-shadow: var(--theme-switcher-shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: opacity 220ms ease, transform 220ms ease, background 180ms ease, border-color 180ms ease;
    box-sizing: border-box;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.back-to-home-wrap .back-control:hover {
    background: color-mix(in srgb, var(--accent-1) 20%, transparent);
    border-color: var(--accent-1);
}

.back-to-home-wrap .back-control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--text-primary);
}

.back-to-home-wrap .back-control-icon {
    width: 20px;
    height: 20px;
    transition: transform 180ms ease;
}

.back-to-home-wrap .back-control:hover .back-control-icon {
    transform: translateX(-2px);
}

/* Difficulty control: same circle size as theme switcher (38px), no expand */
.difficulty-control {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 999px;
    background: var(--theme-switcher-bg);
    border: 1px solid var(--theme-switcher-border);
    box-shadow: var(--theme-switcher-shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: opacity 220ms ease, transform 220ms ease, background 180ms ease, border-color 180ms ease;
    box-sizing: border-box;
    cursor: pointer;
}

.difficulty-control.is-disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Stats control: same style as difficulty control */
.stats-control {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 999px;
    background: var(--theme-switcher-bg);
    border: 1px solid var(--theme-switcher-border);
    box-shadow: var(--theme-switcher-shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: opacity 220ms ease, transform 220ms ease, background 180ms ease, border-color 180ms ease;
    box-sizing: border-box;
    cursor: pointer;
}

.stats-control.is-disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Games control: same style as difficulty/stats control */
.games-control {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 999px;
    background: var(--theme-switcher-bg);
    border: 1px solid var(--theme-switcher-border);
    box-shadow: var(--theme-switcher-shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: opacity 220ms ease, transform 220ms ease, background 180ms ease, border-color 180ms ease;
    box-sizing: border-box;
    cursor: pointer;
}

.games-control.is-disabled,
.site-nav-link.is-disabled,
.header-mobile-link.is-disabled {
    opacity: 0.5;
    pointer-events: none;
}

.games-control-btn {
    width: 100%;
    height: 100%;
    padding: 10px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    transition: color 180ms ease, transform 180ms ease;
    box-sizing: border-box;
    font-family: inherit;
}

.games-control:hover {
    background: color-mix(in srgb, var(--accent-1) 20%, transparent);
    border-color: var(--accent-1);
}

.games-control-btn:hover,
.games-control-btn:focus-visible {
    transform: scale(1.08);
}

.games-control-icon {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
    display: block;
    transform: translateY(-2px);
}

.difficulty-control-btn {
    width: 100%;
    height: 100%;
    padding: 10px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    transition: color 180ms ease, transform 180ms ease;
    box-sizing: border-box;
}

.difficulty-control:hover {
    background: color-mix(in srgb, var(--accent-1) 20%, transparent);
    border-color: var(--accent-1);
}

.difficulty-control-btn:hover,
.difficulty-control-btn:focus-visible {
    transform: scale(1.08);
}

.difficulty-control-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.stats-control-btn {
    width: 100%;
    height: 100%;
    padding: 10px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    transition: color 180ms ease, transform 180ms ease;
    box-sizing: border-box;
}

.stats-control:hover {
    background: color-mix(in srgb, var(--accent-1) 20%, transparent);
    border-color: var(--accent-1);
}

.stats-control-btn:hover,
.stats-control-btn:focus-visible {
    transform: scale(1.08);
}

.stats-control-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Difficulty label in game UI */
.difficulty-label-compact {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-left: 6px;
}

/* Difficulty popup (small, win/lose style) */
.difficulty-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--modal-overlay-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: fadeIn 0.25s ease-out;
}

.difficulty-popup {
    background: var(--modal-bg);
    border-radius: 20px;
    border: 3px dashed var(--modal-border-color);
    box-shadow: var(--modal-shadow);
    padding: 24px 28px;
    text-align: center;
    max-width: 280px;
    width: 100%;
    animation: popIn 0.3s ease-out;
    font-family: inherit;
}

.difficulty-popup-title {
    font-family: inherit;
    font-size: 16px;
    font-weight: 800;
    color: var(--modal-title-color);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.difficulty-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.difficulty-option {
    display: block;
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    border-radius: 14px;
    border: 2px solid var(--modal-btn-border);
    background: var(--chip-bg);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.difficulty-option:hover {
    border-color: var(--accent-1);
    background: var(--card-bg);
}

.difficulty-option.is-selected {
    border-color: var(--accent-1);
    background: linear-gradient(135deg, var(--accent-3), var(--accent-1));
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

/* Stats popup - fun game-like UI with tabs */
.stats-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--modal-overlay-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: fadeIn 0.25s ease-out;
    overflow-y: auto;
}

.stats-popup-overlay[style*="display: none"] {
    display: none !important;
}

.stats-popup {
    background: var(--modal-bg);
    border-radius: 24px;
    border: 4px dashed var(--modal-border-color);
    box-shadow: var(--modal-shadow);
    padding: 0;
    text-align: left;
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    animation: popIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

.stats-popup-header {
    padding: 20px 24px;
    border-bottom: 2px dashed var(--card-border-color);
    background: linear-gradient(135deg, rgba(var(--accent-1-rgb, 77, 150, 255), 0.1), rgba(var(--accent-3-rgb, 107, 207, 127), 0.1));
}

.stats-popup-title {
    font-size: 22px;
    font-weight: 900;
    color: var(--modal-title-color);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stats-popup-title-emoji {
    font-size: 28px;
    animation: bounce 2s ease-in-out infinite;
}

/* Mobile: smaller title */
.is-mobile .stats-popup-title {
    font-size: 16px;
    gap: 6px;
}

.is-mobile .stats-popup-title-emoji {
    font-size: 20px;
}

.is-mobile .stats-popup-header {
    padding: 16px 20px;
}

.stats-tabs {
    display: flex;
    gap: 4px;
    padding: 12px;
    background: var(--chip-bg);
    border-bottom: 2px dashed var(--card-border-color);
    overflow-x: auto;
    scrollbar-width: none;
}

.stats-tabs::-webkit-scrollbar {
    display: none;
}

.stats-tab {
    flex: 1;
    min-width: 100px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    border-radius: 12px;
    border: 2px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.stats-tab:hover {
    background: var(--card-bg);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.stats-tab.is-active {
    background: linear-gradient(135deg, var(--accent-3), var(--accent-1));
    color: #fff;
    border-color: var(--accent-1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.stats-tab-emoji {
    font-size: 18px;
    line-height: 1;
}

/* Mobile: show only icons, hide text */
.is-mobile .stats-tab {
    min-width: auto;
    padding: 10px;
    flex: 0 0 auto;
}

.is-mobile .stats-tab span:not(.stats-tab-emoji) {
    display: none;
}

.is-mobile .stats-tab-emoji {
    font-size: 22px;
}

.stats-tab-content {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 200px;
    max-height: 400px;
}

.stats-tab-panel {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.stats-tab-panel.is-active {
    display: block;
}

.stats-card {
    background: var(--chip-bg);
    border-radius: 16px;
    border: 2px solid var(--chip-border);
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
    border-color: var(--accent-1);
}

.stats-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-card-icon {
    font-size: 20px;
}

.stats-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    font-size: 14px;
    border-bottom: 1px dashed var(--card-border-color);
}

.stats-row:last-child {
    border-bottom: none;
}

.stats-row-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-secondary);
}

.stats-row-label-emoji {
    font-size: 18px;
}

.stats-row-value {
    font-weight: 800;
    color: var(--accent-1);
    font-size: 16px;
    text-shadow: var(--text-shadow-soft);
}

.stats-emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
    margin-top: 8px;
    min-height: 100px;
}

.stats-emoji-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 6px;
    background: var(--chip-bg);
    border-radius: 10px;
    border: 2px solid var(--chip-border);
    transition: all 0.2s ease;
    cursor: default;
}

.stats-emoji-item:hover {
    transform: scale(1.1) rotate(2deg);
    border-color: var(--accent-1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stats-emoji-item-emoji {
    font-size: 24px;
    margin-bottom: 4px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.stats-emoji-item-count {
    font-size: 11px;
    font-weight: 800;
    color: var(--text-primary);
    background: var(--card-bg);
    padding: 2px 6px;
    border-radius: 8px;
    border: 1px solid var(--chip-border);
}

.stats-popup-footer {
    padding: 16px 24px;
    border-top: 2px dashed var(--card-border-color);
    background: var(--chip-bg);
}

.stats-popup-close {
    display: block;
    width: 100%;
    padding: 14px;
    font-size: 15px;
    font-weight: 800;
    font-family: inherit;
    border-radius: 16px;
    border: 2px solid var(--modal-btn-border);
    background: linear-gradient(135deg, var(--accent-3), var(--accent-1));
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stats-popup-close:hover {
    transform: scale(1.05) rotate(1deg);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.stats-popup-close:active {
    transform: scale(0.98);
}

/* Games list cards (used on home + /games/) */

.games-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.game-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    background: var(--chip-bg);
    border-radius: 18px;
    border: 2px solid var(--chip-border);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s ease;
    cursor: pointer;
    overflow: hidden;
}

.game-item:hover {
    transform: translateY(-3px);
    border-color: var(--accent-1);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
    background: var(--card-bg);
}

.game-item-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-bottom: 2px solid var(--chip-border);
    background: var(--panel-bg);
}

.game-item-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scale(1.02);
    transition: transform 0.25s ease;
}

.game-item:hover .game-item-image {
    transform: scale(1.06);
}

.game-item-content {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.game-item-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.game-item-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-primary);
}

.game-item-icon {
    font-size: 20px;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.game-item-description {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* On games listing page, keep descriptions left-aligned for readability */
.games-page .game-item-description {
    text-align: left;
}

.games-list--mobile {
    display: flex;
    justify-content: center;
    align-items: center;
}

.games-empty-state {
    text-align: center;
    padding: 24px 18px;
    background: var(--chip-bg);
    border-radius: 18px;
    border: 2px dashed var(--chip-border);
    max-width: 420px;
    margin: 0 auto;
}

.games-empty-image-wrapper {
    margin: 0 auto 12px;
    max-width: 360px;
    border-radius: 16px;
    overflow: hidden;
}

.games-empty-emoji {
    font-size: 32px;
    margin-bottom: 8px;
}

.games-empty-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.games-empty-text {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Reusable gallery grid / lightbox */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.gallery-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4 / 3;
    padding: 8px;
    border-radius: 14px;
    overflow: hidden;
    background: var(--panel-bg);
    border: 2px solid var(--chip-border);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.gallery-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

.gallery-item:hover {
    transform: translateY(-3px);
    border-color: var(--accent-1);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.lightbox-overlay.is-visible .lightbox-inner {
    transform: scale(1);
    opacity: 1;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.lightbox-inner {
    position: relative;
    z-index: 1;
    max-width: 960px;
    width: 100%;
    max-height: 100%;
    background: var(--modal-bg);
    border-radius: 20px;
    border: 3px dashed var(--modal-border-color);
    box-shadow: var(--modal-shadow);
    padding: 20px 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transform: scale(0.9) rotate(-2deg);
    opacity: 0;
    transition: transform 0.18s ease-out, opacity 0.18s ease-out;
}

.lightbox-image-wrap {
    position: relative;
    flex: 1;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 14px;
    background: var(--panel-bg);
}

.lightbox-image {
    max-width: 100%;
    max-height: 70vh;
    display: block;
}

.lightbox-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    font-size: 13px;
    color: var(--text-secondary);
}

.lightbox-caption {
    flex: 1;
}

.lightbox-counter {
    flex: 0 0 auto;
    font-weight: 700;
}

.lightbox-close {
    position: absolute;
    top: 10px;
    right: 12px;
    border-radius: 999px;
    border: 2px solid var(--modal-btn-border);
    background: var(--chip-bg);
    color: var(--text-primary);
    font-weight: 800;
    font-size: 14px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    z-index: 2;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 999px;
    border: 2px solid var(--modal-btn-border);
    background: var(--chip-bg);
    color: var(--text-primary);
    font-size: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    z-index: 2;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.lightbox-prev {
    left: 18px;
}

.lightbox-next {
    right: 18px;
}

.lightbox-overlay.is-visible .lightbox-inner {
    transform: scale(1) rotate(0deg);
    opacity: 1;
    animation: popIn 0.3s ease-out;
}

.lightbox-close:hover {
    transform: scale(1.08);
    background: linear-gradient(135deg, var(--accent-3), var(--accent-1));
    color: #fff;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

.lightbox-close:active {
    transform: scale(0.94);
}

.lightbox-arrow:hover {
    transform: translateY(-50%) scale(1.08);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
    background: linear-gradient(135deg, var(--accent-3), var(--accent-1));
    color: #fff;
}

.lightbox-arrow:active {
    transform: translateY(-50%) scale(0.96);
}

@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .lightbox-inner {
        padding: 16px 16px 14px;
    }
}

/* Home page game gallery: 4 items per row on larger screens */
.home-games-gallery {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 900px) {
    .home-games-gallery {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .home-games-gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* --- Global site header --- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(14px);
    background: color-mix(in srgb, var(--page-bg) 80%, transparent 20%);
    border-bottom: 1px solid color-mix(in srgb, var(--border-subtle) 80%, transparent 20%);
}
.site-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: relative;
    z-index: 101; /* above mobile menu overlay so hamburger/logo/theme stay clickable */
}
.site-logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 18px;
    text-decoration: none;
    color: var(--text-primary);
}
.site-logo-image {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.site-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}
.site-nav-link {
    border-radius: 999px;
    padding: 6px 12px;
    text-decoration: none;
    color: var(--text-primary);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}
.site-nav-link:hover {
    color: var(--text-primary);
    background: color-mix(in srgb, var(--panel-bg) 85%, transparent 15%);
    border-color: color-mix(in srgb, var(--border-subtle) 60%, transparent 40%);
    transform: translateY(-1px);
}
.site-nav-link-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.site-nav-link-button .games-control-icon {
    font-size: 16px;
}

/* Pulse animation for Games button (desktop nav only) */
.site-nav .games-btn-pulse {
    animation: games-btn-pulse 2.2s ease-in-out infinite;
}
.site-nav .games-btn-pulse:hover {
    animation: none;
}
@keyframes games-btn-pulse {
    0%, 100% {
        box-shadow: 0 0 8px 1px color-mix(in srgb, var(--accent-1) 25%, transparent);
    }
    50% {
        box-shadow: 0 0 18px 4px color-mix(in srgb, var(--accent-1) 50%, transparent);
    }
}
/* Hamburger: hidden on desktop */
.header-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
	align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 10px;
    transition: background 0.2s ease;
}
.header-hamburger:hover {
    background: color-mix(in srgb, var(--panel-bg) 60%, transparent 40%);
}
.header-hamburger-bar {
    display: block;
    width: 22px;
    height: 2px;
    border-radius: 1px;
    background: var(--text-primary);
    transition: transform 0.25s ease, opacity 0.25s ease;
}
.site-header.is-menu-open .header-hamburger-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.site-header.is-menu-open .header-hamburger-bar:nth-child(2) {
    opacity: 0;
}
.site-header.is-menu-open .header-hamburger-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Mobile menu panel: outside header, absolute so it sits above hero and main content */
.header-mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: color-mix(in srgb, var(--page-bg) 95%, transparent 5%);
    backdrop-filter: blur(12px);
    padding: 60px 20px 24px;
    overflow-y: auto;
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity 0.25s ease-out, transform 0.25s ease-out;
}
.header-mobile-menu.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.header-mobile-menu[hidden] {
    display: none !important;
}
.header-mobile-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 12px;
    background: color-mix(in srgb, var(--card-bg) 90%, transparent 10%);
    color: var(--text-primary);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.12s ease;
}
.header-mobile-close:hover {
    background: color-mix(in srgb, var(--panel-bg) 85%, transparent 15%);
    transform: scale(1.05);
}
.header-mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 320px;
    margin: 0 auto;
}
.header-mobile-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    font-size: 17px;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-primary);
    background: color-mix(in srgb, var(--card-bg) 90%, transparent 10%);
    border: 1px solid color-mix(in srgb, var(--border-subtle) 80%, transparent 20%);
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.12s ease;
    width: 100%;
    text-align: left;
}
.header-mobile-link:hover {
    background: color-mix(in srgb, var(--panel-bg) 85%, transparent 15%);
    transform: translateX(4px);
}
.header-mobile-link-button {
    font-family: inherit;
}
.header-mobile-link .games-control-icon {
    font-size: 20px;
}

@media (max-width: 1200px) {
    .site-header-inner {
        padding: 10px 60px 10px 20px;
    }
}

@media (max-width: 768px) {
    .site-header-inner {
        flex-wrap: nowrap;
        justify-content: space-between;
    }
    .site-nav {
        display: none;
    }
    .header-hamburger {
        display: flex;
    }
    .header-mobile-menu:not([hidden]) {
        display: block;
    }
}

/* --- Home hero --- */
/* Hide hero content until GSAP has set initial state (prevents flash of static text) */
.hero-section .hero-card-content {
    opacity: 0;
}
.hero-section.hero-ready .hero-card-content {
    opacity: 1;
}

.hero-glass-card {
    padding: 28px 24px;
    text-align: left;
}
.hero-title {
    font-size: clamp(26px, 3.4vw, 34px);
    line-height: 1.25;
    margin-bottom: 20px;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
    gap: 18px;
    text-transform: uppercase;
}
.hero-title-line {
    display: block;
    overflow: visible; /* allow falling characters to be fully visible */
    line-height: 1.2;
}
.hero-title-line-inner {
    display: inline-block;
    text-align: center;
    color: var(--text-primary);
    text-shadow: var(--text-shadow-strong);
}
.hero-char {
    display: inline-block;
}
.hero-title-line--do-not .hero-title-line-inner {
    color: var(--accent-1);
}
.hero-title-line--disturb-me .hero-title-line-inner {
    color: var(--accent-2);
}
.hero-title-line--just-play .hero-title-line-inner {
    color: var(--accent-3);
}
.hero-title-line--ignore-everything .hero-title-line-inner {
    color: var(--text-primary);
}

/* Make last hero line white on dark themes */
html[data-theme="neon"] .hero-title-line--ignore-everything .hero-title-line-inner,
html[data-theme="dark"] .hero-title-line--ignore-everything .hero-title-line-inner,
html[data-theme="clean"] .hero-title-line--ignore-everything .hero-title-line-inner {
    color: #ffffff;
}
.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}
.hero-cta {
    border-radius: 999px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.18s ease, color 0.18s ease;
}
.hero-cta-primary {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: #fff;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}
.hero-cta-secondary {
    background: color-mix(in srgb, var(--panel-bg) 85%, transparent 15%);
    color: var(--text-primary);
    border: 1px solid color-mix(in srgb, var(--border-subtle) 70%, transparent 30%);
}
.hero-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4);
}
.hero-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.is-mobile .games-list {
    padding: 10px 14px;
    grid-template-columns: 1fr;
}

.is-mobile .game-item {
    flex-direction: row;
    align-items: stretch;
}

.is-mobile .game-item-image-wrapper {
    flex: 0 0 96px;
    max-width: 96px;
    aspect-ratio: 4 / 3;
}

.is-mobile .game-item-content {
    padding: 8px 10px 8px;
    gap: 2px;
}

.is-mobile .game-item-title {
    font-size: 14px;
}

.is-mobile .game-item-description {
    font-size: 12px;
}

/* On games listing page, keep cards vertical (image on top, text below) even on mobile */
body.games-page.is-mobile .game-item {
    flex-direction: column;
    align-items: stretch;
}

body.games-page.is-mobile .game-item-image-wrapper {
    flex: 0 0 auto;
    max-width: 100%;
    aspect-ratio: 16 / 9;
}

body.games-page.is-mobile .game-item-content {
    padding: 10px 12px 12px;
    gap: 4px;
}

/* Smooth scrolling for games list */
.games-list {
    scrollbar-width: thin;
    scrollbar-color: var(--accent-1) transparent;
}

.games-list::-webkit-scrollbar {
    width: 6px;
}

.games-list::-webkit-scrollbar-track {
    background: transparent;
}

.games-list::-webkit-scrollbar-thumb {
    background: var(--accent-1);
    border-radius: 3px;
}

.games-list::-webkit-scrollbar-thumb:hover {
    background: var(--accent-3);
}

/* Theme switcher (top-right) */
.theme-switcher {
    position: fixed;
    top: 8px;
    right: 14px;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0; /* collapsed: only one dot visible */
    padding: 10px;
    border-radius: 999px;
    background: var(--theme-switcher-bg);
    border: 1px solid var(--theme-switcher-border);
    box-shadow: var(--theme-switcher-shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    overflow: hidden;
    max-width: 38px; /* collapsed: just one dot + padding */
    transition: max-width 220ms ease, padding 220ms ease;
}

.theme-switcher.is-open {
    justify-content: flex-start;
    gap: 10px;
    max-width: 240px;
    padding: 10px 12px;
}

.is-mobile .theme-switcher {
    top: 15px;
    right: 15px;
}

.theme-dot {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 2px solid var(--theme-dot-border);
    cursor: pointer;
    padding: 0;
    outline: none;
    background: transparent;
    transition: opacity 180ms ease, transform 180ms ease, width 180ms ease, height 180ms ease, border-width 180ms ease;
    position: relative;
}

.theme-dot[data-theme="pastel"] {
    /* Pink + aqua (soft) */
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.55), transparent 55%),
        linear-gradient(135deg, #ff4d6d, #22c5c9);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.theme-dot[data-theme="neon"] {
    /* Cyan + purple (cyber neon) */
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.35), transparent 55%),
        linear-gradient(135deg, #22d3ee, #7c3aed);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.theme-dot[data-theme="dark"] {
    /* Clearly dark */
    background: radial-gradient(circle at 30% 30%, rgba(34, 211, 238, 0.45), transparent 55%),
        linear-gradient(135deg, #050714, #111827);
    box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.25);
}

.theme-dot[data-theme="clean"] {
    /* Teal + terracotta (warm clean) */
    /* Matrix */
    background: radial-gradient(circle at 30% 30%, rgba(167, 243, 208, 0.35), transparent 55%),
        linear-gradient(135deg, #020b05, #22c55e);
    box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.25);
}

.theme-dot.is-active,
.theme-dot:focus-visible {
    box-shadow: 0 0 0 3px var(--theme-dot-active-ring);
}

/* Small label on hover/focus so dots are unambiguous */
.theme-dot::after {
    content: attr(title);
    position: absolute;
    top: 22px;
    right: 50%;
    transform: translateX(50%);
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--card-bg);
    border: 1px solid var(--card-border-color);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
    box-shadow: var(--card-shadow);
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease, transform 120ms ease;
    z-index: 999;
}

.theme-dot:hover::after,
.theme-dot:focus-visible::after {
    opacity: 1;
    transform: translateX(50%) translateY(2px);
}

/* Collapsed menu: hide other dots but keep layout animatable */
.theme-switcher:not(.is-open) .theme-dot:not(.is-active) {
    width: 0;
    height: 0;
    border-width: 0;
    opacity: 0;
    transform: translateX(-8px) scale(0.85);
    pointer-events: none;
}

/* Open menu: staggered fade-in */
.theme-switcher.is-open .theme-dot {
    opacity: 1;
    transform: translateX(0) scale(1);
    pointer-events: auto;
}

.theme-switcher.is-open .theme-dot:nth-child(2) { transition-delay: 35ms; }
.theme-switcher.is-open .theme-dot:nth-child(3) { transition-delay: 70ms; }
.theme-switcher.is-open .theme-dot:nth-child(4) { transition-delay: 105ms; }

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Floating emojis */
.floating-emoji {
    position: absolute;
    font-size: 30px;
    pointer-events: auto;
    cursor: pointer;
    animation: float 5s ease-in-out forwards;
    opacity: 0;
    transition: transform 0.3s ease, font-size 0.3s ease;
    z-index: 1 !important; /* Very low z-index - must be below all ads (z-index: 100) - Google Ads policy compliance */
    will-change: transform, opacity;
    transform: translateZ(0); /* GPU acceleration */
}

.floating-emoji:hover {
    transform: scale(1.2);
}

.floating-emoji.emoji-clicked {
    animation: emojiPop 0.4s ease-out forwards !important;
    animation-play-state: running !important;
}

@keyframes float {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 0;
    }
    15% {
        opacity: 0.8;
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
        opacity: 1;
    }
    85% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(-40px) rotate(360deg);
        opacity: 0;
    }
}

@keyframes emojiPop {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(2);
        opacity: 0.8;
    }
    100% {
        transform: scale(2.5);
        opacity: 0;
    }
}

/* Click animation elements */
.click-animation {
    position: fixed;
    pointer-events: none;
    font-size: 40px;
    z-index: 50; /* Lower than ads (z-index: 100) - Google Ads policy compliance */
    animation: popAndFloat 1.5s ease-out forwards;
    user-select: none;
    will-change: transform, opacity;
    transform: translateZ(0); /* GPU acceleration */
}

@keyframes popAndFloat {
    0% {
        transform: scale(0) translateY(0) rotate(0deg);
        opacity: 1;
    }
    20% {
        transform: scale(1.5) translateY(-10px) rotate(90deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.2) translateY(-40px) rotate(180deg);
        opacity: 1;
    }
    100% {
        transform: scale(0.8) translateY(-120px) rotate(360deg);
        opacity: 0;
    }
}

.salute-animation {
    animation: salute 1.2s ease-out forwards !important;
}

@keyframes salute {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 1;
    }
    25% {
        transform: translateY(-15px) rotate(-20deg) scale(1.3);
        opacity: 1;
    }
    50% {
        transform: translateY(-25px) rotate(20deg) scale(1.3);
        opacity: 1;
    }
    75% {
        transform: translateY(-40px) rotate(0deg) scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: translateY(-100px) rotate(0deg) scale(0.5);
        opacity: 0;
    }
}

.confetti-piece {
    position: fixed;
    width: 12px;
    height: 12px;
    pointer-events: none;
    z-index: 50; /* Lower than ads (z-index: 100) - Google Ads policy compliance */
    animation: confettiFall 2.5s ease-out forwards;
    border-radius: 50%;
}

.confetti-piece:nth-child(2n) {
    background: #e6d73a;
    animation-delay: 0.1s;
}

.confetti-piece:nth-child(3n) {
    background: #6bcf7f;
    animation-delay: 0.2s;
}

.confetti-piece:nth-child(4n) {
    background: #4d96ff;
    animation-delay: 0.3s;
}

.confetti-piece:nth-child(5n) {
    background: #ff6b9d;
    animation-delay: 0.15s;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(300px) translateX(var(--random-x)) rotate(720deg);
        opacity: 0;
    }
}

.bounce-animation {
    animation: bouncePop 0.6s ease-out forwards;
}

@keyframes bouncePop {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.4) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

.container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 30px;
    box-sizing: border-box;
}

.blocks-row {
    display: flex;
    flex-direction: row;
    gap: 30px;
    width: 100%;
    align-items: stretch;
}

.blocks-row > * {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(var(--card-blur));
    -webkit-backdrop-filter: blur(var(--card-blur));
    border-radius: 30px;
    border: var(--card-border-width) dashed var(--card-border-color);
    box-shadow: var(--card-shadow);
    padding: 45px 40px 35px;
    text-align: center;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
    animation: fadeInUp 0.8s ease-out, pulse 4s ease-in-out infinite;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 500px;
    flex: 1;
}

.glass-card.hero-glass-card {
    flex-direction: row;
    align-items: stretch;
    flex-wrap: wrap;
    min-height: 500px;
    justify-content: flex-start;
    padding: 28px 24px;
    text-align: left;
	overflow: hidden;
}

/* Disable expensive backdrop-filter and reduce animations on mobile */
.is-mobile .glass-card {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--card-bg);
    box-shadow: var(--card-shadow);
    animation: fadeInUp 0.8s ease-out; /* Remove pulse animation on mobile */
    transition: box-shadow 0.3s ease, border-color 0.3s ease; /* Keep only non-transform transitions */
}

/* Disable hover effects on mobile */
.is-mobile .glass-card:hover {
    transform: none !important;
    box-shadow: var(--card-shadow) !important;
    border-color: var(--card-border-color) !important;
}

.glass-card.emoji-glass-card::before {
    content: '🚫';
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 60px;
    animation: spin 3s linear infinite;
}

/* Back to games button: same row as game title inside glass-card, absolute left; mobile: icon only */
.game-title-row {
    position: relative;
    min-height: 44px;
}
.game-back-btn {
    position: absolute;
    left: 0;
    top: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    color: #fff;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    border: none;
    border-radius: 999px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    white-space: nowrap;
    z-index: 2;
}
.game-back-btn:hover {
    color: #fff;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4);
}
.game-back-btn-icon {
    font-size: 1.2em;
    line-height: 1;
}
@media (max-width: 768px) {
    .game-back-btn-text {
        display: none;
    }
    .game-back-btn {
        padding: 10px 14px;
        min-width: 44px;
    }
}

/* Dynamic iframe game (games/play/) - game-wrapper first (full width), main-wrapper second */
.game-play-page .game-wrapper {
    width: 100%;
    z-index: 1;
    position: relative;
    padding: 40px 220px 0;
}
@media (max-width: 1359px) {
    .game-play-page .game-wrapper {
        padding-left: 20px;
        padding-right: 20px;
    }
}
.game-play-page .main-wrapper .container {
    max-width: 100%;
}
.game-embed-card {
    margin: 0 auto;
    width: 100%;
    max-width: 100%;
}
/* When width & height are 0 in DB: use 100% width, 70vh height */
.game-embed-fullsize .game-embed-container {
    width: 100%;
    height: 70vh;
    min-height: 70vh;
}
.game-embed-fullsize .game-embed-iframe {
    width: 100%;
    height: 100%;
    min-height: 100%;
}
.game-embed-description {
    margin: 0 0 1rem;
    color: var(--text-secondary);
}
.game-embed-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 1rem 0;
    border-radius: 12px;
    overflow: hidden;
    background: var(--card-bg);
    min-height: 70vh;
    height: 70vh;
}
.game-embed-iframe {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 400px;
    border: none;
}
.game-embed-hint {
    margin: 0.75rem 0 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Play page embed: better on mobile */
@media (max-width: 768px) {
    .game-embed-card {
        padding: 16px 12px 12px;
    }
    .game-embed-card .about-title {
        font-size: 1.25rem;
        margin-bottom: 0.5rem;
        padding: 0 50px;
        word-break: break-word;
    }
    .game-embed-description {
        margin-bottom: 0.75rem;
        font-size: 0.95rem;
    }
    .game-embed-container {
        min-height: 45vh;
        height: 45vh;
        margin: 0.5rem 0;
        border-radius: 8px;
    }
    .game-embed-fullsize .game-embed-container {
        min-height: 45vh;
        height: 45vh;
    }
    .game-embed-iframe {
        min-height: 240px;
        max-width: 100%;
        width: 100% !important;
        height: 100% !important;
    }
    .game-embed-hint {
        font-size: 0.85rem;
        margin-top: 0.5rem;
    }
}

/* Hide top icon on mobile */
.is-mobile .glass-card.emoji-glass-card::before {
    display: none; /* Hide the 🚫 emoji on mobile */
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 8px 28px 0 rgba(31, 38, 135, 0.35),
                     0 0 32px rgba(255, 255, 255, 0.22);
    }
    50% {
        box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.5),
                     0 0 44px rgba(255, 255, 255, 0.3);
    }
}

@keyframes spin {
    from { transform: translateX(-50%) rotate(0deg); }
    to { transform: translateX(-50%) rotate(360deg); }
}

@keyframes gentleSwayRight {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(8px);
    }
}


.glass-card:hover {
    box-shadow: var(--card-shadow);
    border-color: var(--card-border-color);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message {
    color: var(--text-primary);
    font-size: 28px;
    font-weight: 900;
    line-height: 1.4;
    margin-bottom: 50px;
    text-shadow: var(--text-shadow-strong);
    letter-spacing: 1px;
    animation: bounce 2s ease-in-out infinite, wiggle 3s ease-in-out infinite;
    transform-origin: center;
    will-change: transform;
    transform: translateZ(0); /* GPU acceleration */
}

/* Reduce animation complexity and font size on mobile */
.is-mobile .message {
    animation: bounce 3s ease-in-out infinite; /* Only bounce, no wiggle */
    font-size: 20px; /* Reduced from 28px for better mobile visibility */
    margin-bottom: 0px; /* Further reduced from 30px to save space */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-weight: 900;
}

/* Make message one line on mobile - hide br tags */
.is-mobile .message br {
    display: none;
}

/* Add spacing between 😤 and "Emojis" on mobile */
.is-mobile .message .mobile-spacer {
    display: inline-block;
    width: 5px;
}

h1.message {
    margin: 0 0 15px 0;
}

.instruction-text {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    margin: 0 0 30px 0;
    text-shadow: var(--text-shadow-soft);
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Reduce instruction text margin on mobile */
.is-mobile .instruction-text {
    margin-bottom: 5px; /* Further reduced to minimize gap */
}

@keyframes bounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.05); }
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-2deg); }
    75% { transform: rotate(2deg); }
}

.leave-button {
    background: linear-gradient(135deg, #ff6b6b, #ff4757);
    border: 2px solid #ffffff;
    border-radius: 30px;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: 900;
    font-family: inherit;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.4), 0 0 20px rgba(255, 107, 107, 0.3);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    animation: buttonPulse 1.5s ease-in-out infinite;
    line-height: 1.3;
    white-space: nowrap;
    will-change: transform;
    transform: translateZ(0); /* GPU acceleration */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    display: inline-block;
    width: auto;
    max-width: 100%;
    opacity: 0.5;
}

/* Reduce button animation on mobile */
.is-mobile .leave-button {
    animation: buttonPulse 2.5s ease-in-out infinite; /* Slower pulse */
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.3), 0 0 20px rgba(255, 107, 107, 0.2); /* Simplified shadow */
    opacity: 0.5; /* Maintain opacity on mobile */
}

.is-mobile .leave-button:hover {
    opacity: 1; /* Full opacity on hover for mobile */
}

.leave-button span {
    display: block;
    margin-top: 4px;
}

.leave-button::before {
    content: '👋';
    position: absolute;
    left: -35px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    transition: left 0.3s ease;
}

.leave-button::after {
    content: '👋';
    position: absolute;
    right: -35px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    transition: right 0.3s ease;
}

@keyframes buttonPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.leave-button:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 12px 30px rgba(255, 71, 87, 0.6), 0 0 50px rgba(255, 107, 107, 0.5);
    border-color: #e6d73a;
    background: linear-gradient(135deg, #ff4757, #ff6b6b);
    animation: none;
    opacity: 1;
}

.leave-button:hover::before {
    left: 10px;
    animation: wave 0.5s ease-in-out infinite;
}

.leave-button:hover::after {
    right: 10px;
    animation: wave 0.5s ease-in-out infinite 0.25s;
}

@keyframes wave {
    0%, 100% { transform: translateY(-50%) rotate(0deg); }
    50% { transform: translateY(-50%) rotate(20deg); }
}

.leave-button:active {
    transform: scale(0.95) rotate(-5deg);
    box-shadow: 0 4px 10px rgba(255, 71, 87, 0.3);
    opacity: 1;
}

.leave-button.clicked {
    animation: explode 0.5s ease-out;
    opacity: 1;
}

@keyframes explode {
    0% { transform: scale(1); }
    50% { transform: scale(1.3) rotate(180deg); }
    100% { transform: scale(1) rotate(360deg); }
}

@media (max-width: 768px) {
    body {
        padding-bottom: 30px 20px 30px 20px;
    }
    
    .glass-card {
        padding: 45px 30px 35px;
    }
    
    .glass-card::before {
        font-size: 50px;
        top: -25px;
    }
    
    .message {
        font-size: 28px;
        margin-bottom: 40px;
    }
    
    .leave-button {
        padding: 10px 18px;
        font-size: 14px;
        letter-spacing: 1px;
    }
}

@media (max-width: 480px) {
    .main-wrapper {
        padding: 0 10px;
    }
    
    body {
        padding-bottom: 20px;
    }
    
    .message {
        font-size: 18px; /* Further reduced for very small screens */
    }
    
    .instruction-text {
        font-size: 12px;
        margin-bottom: 20px;
    }
    
    .leave-button {
        padding: 9px 16px;
        font-size: 13px;
        letter-spacing: 1px;
    }
    
    .glass-card::before {
        font-size: 40px;
        top: -20px;
    }
}

/* Game Section - Compact */
.game-section-compact {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

/* Reduce game section margin on mobile */
.is-mobile .game-section-compact {
    margin-top: 0; /* Remove top margin */
    margin-bottom: 10px; /* Reduced from 25px */
    gap: 10px; /* Reduced gap */
}

/* Timer Styles - Compact */
.timer-container-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--chip-bg);
    padding: 6px 12px;
    border-radius: 18px;
    border: 2px solid var(--chip-border);
}

.timer-display-compact {
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 900;
    text-shadow: var(--text-shadow-soft);
    letter-spacing: 0.5px;
    font-variant-numeric: tabular-nums;
    min-width: 45px;
    text-align: center;
    line-height: 1;
    padding: 0;
    margin: 0;
}

.timer-display-compact.warning {
    color: #e6d73a;
}

.timer-display-compact.danger {
    color: #ff6b6b;
    animation: timerPulse 0.5s ease-in-out infinite;
}

@keyframes timerPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

.timer-start-btn-compact {
    background: linear-gradient(135deg, #6bcf7f, #4d96ff);
    border: 2px solid #ffffff;
    border-radius: 15px;
    padding: 6px 18px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 10px rgba(107, 207, 127, 0.4);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

.timer-start-btn-compact:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(107, 207, 127, 0.6);
    border-color: #e6d73a;
}

.timer-start-btn-compact:active {
    transform: scale(0.95);
}

/* System Collection Counter - Compact */
.system-collection-counter-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--chip-bg);
    padding: 8px 15px;
    border-radius: 20px;
    border: 2px solid var(--chip-border);
}

.system-label-compact {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: bold;
}

.system-value-compact {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 900;
    text-shadow: var(--text-shadow-soft);
}

/* Progress Bar Styles */
.progress-container {
    margin-top: 30px;
    width: 100%;
}

/* Reduce progress container margin on mobile */
.is-mobile .progress-container {
    margin-top: 5px; /* Reduced from 30px */
}

.progress-bar-wrapper {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
    margin-bottom: 12px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #ff6b6b, #e6d73a, #6bcf7f, #4d96ff, #ff6b9d);
    background-size: 200% 100%;
    border-radius: 10px;
    width: 0%;
    transition: width 0.5s ease-out;
    animation: progressShine 2s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    will-change: width, background-position;
    transform: translateZ(0); /* GPU acceleration */
}

/* Reduce progress bar animation on mobile */
.is-mobile .progress-bar {
    animation: progressShine 3s ease-in-out infinite; /* Slower animation */
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.4); /* Simplified shadow */
}

@keyframes progressShine {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.progress-text {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: bold;
    text-shadow: var(--text-shadow-soft);
    margin: 0;
    text-align: center;
    transition: all 0.3s ease;
}

/* Mouse Trail Effect */
.mouse-trail {
    position: fixed;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 50; /* Lower than ads (z-index: 100) - Google Ads policy compliance - trails already excluded from ad areas in JS */
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8), rgba(255, 107, 107, 0.4));
    box-shadow: 0 0 10px rgba(255, 107, 107, 0.6);
    animation: trailFade 0.8s ease-out forwards;
}

@keyframes trailFade {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.3);
    }
}

/* Click Ripple Effect */
.click-ripple {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 50; /* Lower than ads (z-index: 100) - Google Ads policy compliance - ripples already excluded from ad areas in JS */
    border: 3px solid rgba(255, 255, 255, 0.8);
    animation: rippleExpand 0.8s ease-out forwards;
    transform: translate(-50%, -50%);
    margin-left: 0;
    margin-top: 0;
}

@keyframes rippleExpand {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
    100% {
        width: 200px;
        height: 200px;
        opacity: 0;
    }
}

/* Emoji Collection Block */
.emoji-collection-container {
    position: relative;
    width: 100%;
    z-index: 1;
    animation: fadeInUp 0.8s ease-out 0.5s both;
    display: flex;
    flex-direction: column;
    min-height: 500px;
}

.emoji-collection-card {
    background: var(--card-bg);
    backdrop-filter: blur(var(--card-blur));
    -webkit-backdrop-filter: blur(var(--card-blur));
    border-radius: 30px;
    border: var(--card-border-width) dashed var(--card-border-color);
    box-shadow: var(--card-shadow);
    padding: 15px 30px;
    text-align: center;
    position: relative;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
    animation: fadeInUp 0.8s ease-out 0.5s both, pulse 4s ease-in-out infinite;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: 500px;
    flex: 1;
    will-change: transform;
    transform: translateZ(0); /* GPU acceleration */
}

/* Disable expensive backdrop-filter and reduce animations on mobile */
.is-mobile .emoji-collection-card {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--card-bg);
    box-shadow: var(--card-shadow);
    animation: fadeInUp 0.8s ease-out 0.5s both; /* Remove pulse animation on mobile */
}

.emoji-collection-card:hover {
    box-shadow: var(--card-shadow);
    border-color: var(--card-border-color);
}

.collection-title {
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 900;
    margin: 0 0 8px 0;
    text-shadow: var(--text-shadow-soft);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.collection-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0 0 15px 0;
    text-shadow: var(--text-shadow-soft);
}

.collection-tip {
    color: var(--text-secondary);
    font-size: 0.75em;
    margin: 6px 0 10px 0;
    text-shadow: var(--text-shadow-soft);
}

.collection-stats {
    margin-bottom: 15px;
}

.total-count {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 20px;
    border-radius: 20px;
    border: 2px solid var(--card-border-color);
}

.is-mobile .total-count {
    padding: 4px 10px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: bold;
    margin-right: 8px;
}

.stat-value {
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 900;
    text-shadow: var(--text-shadow-soft);
}

.is-mobile .stat-value {
    font-size: 14px;
}

.emoji-collection-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-start;
    align-items: flex-start;
    align-content: flex-start;
    height: 240px;
    max-height: 240px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
    background: var(--panel-bg);
    border-radius: 15px;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-color) var(--scrollbar-track);
}

/* Custom Scrollbar Styling for Emoji Collection Grid */
.emoji-collection-grid::-webkit-scrollbar {
    width: 10px;
}

.emoji-collection-grid::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #ff6b6b, #ff4757);
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.emoji-collection-grid::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #ff4757, #ff6b6b);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.emoji-collection-grid .empty-message {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0;
    width: 100%;
    text-align: center;
}

.emoji-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 8px;
    border-radius: 10px;
    border: 2px solid var(--card-border-color);
    transition: all 0.3s ease;
    animation: emojiCollect 0.5s ease-out;
    flex: 0 0 calc(20% - 8px);
    max-width: calc(20% - 8px);
    box-sizing: border-box;
}

.emoji-item:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.3);
    border-color: var(--card-border-color);
}

.emoji-item-emoji {
    font-size: 22px;
    margin-bottom: 2px;
}

.emoji-item-count {
    color: var(--text-primary);
    font-size: 11px;
    font-weight: bold;
    text-shadow: var(--text-shadow-soft);
}

@keyframes emojiCollect {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(180deg);
    }
    100% {
        transform: scale(1) rotate(360deg);
        opacity: 1;
    }
}

/* About/Content Block */
.about-block {
    background: var(--card-bg);
    backdrop-filter: blur(var(--card-blur));
    -webkit-backdrop-filter: blur(var(--card-blur));
    border-radius: 30px;
    border: var(--card-border-width) dashed var(--card-border-color);
    box-shadow: var(--card-shadow);
    padding: 30px 40px;
    text-align: center;
    position: relative;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
    animation: fadeInUp 0.8s ease-out 0.8s both, pulse 4s ease-in-out infinite;
    width: 100%;
    will-change: transform;
    transform: translateZ(0); /* GPU acceleration */
}

/* Disable expensive backdrop-filter and reduce animations on mobile */
.is-mobile .about-block {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--card-bg);
    box-shadow: var(--card-shadow);
    animation: fadeInUp 0.8s ease-out 0.8s both; /* Remove pulse animation on mobile */
}

.about-block:hover {
    box-shadow: var(--card-shadow);
    border-color: var(--card-border-color);
}

/* Related games section (above footer on game pages) */
.related-games-block {
    margin-top: 1.5rem;
}
.related-games-block .about-title {
    margin-bottom: 1.5rem;
}
.related-games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    text-align: left;
}
.related-games-grid .game-item-description {
    text-align: left;
}

.about-title {
    color: var(--text-primary);
    font-size: 28px;
    font-weight: 900;
    margin: 0 0 20px 0;
    text-shadow: var(--text-shadow-soft);
    text-align: center;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.about-content {
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1.6;
    text-shadow: var(--text-shadow-soft);
    text-align: left;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.about-content p {
    margin-bottom: 15px;
}

.about-content p:last-child {
    margin-bottom: 0;
}

.game-about-category {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.game-about-category-label {
    font-weight: 600;
    color: var(--text-muted);
}

.game-about-category .hero-cta {
    text-decoration: none;
    color: #fff;
}
.game-about-category .hero-cta:hover {
    color: #fff;
}

.about-subtitle {
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 900;
    margin: 22px 0 10px 0;
    text-shadow: var(--text-shadow-soft);
}

.about-content .about-subtitle:first-child {
    margin-top: 0;
}

.about-content a {
    color: var(--link-color);
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.home-featured-games .about-content a {
    text-decoration: none;
    font-weight: 400;
    color: inherit;
}

.about-content a:hover {
    color: var(--link-hover);
}

/* Ad Container Styles - glass-card look to match site UI */
.ad-container {
    margin: 30px 0;
    padding: 24px 28px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    /* Match glass-card styling */
    background: var(--card-bg);
    backdrop-filter: blur(var(--card-blur));
    -webkit-backdrop-filter: blur(var(--card-blur));
    border-radius: 24px;
    border: var(--card-border-width) dashed var(--card-border-color);
    box-shadow: var(--card-shadow);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.ad-container:hover {
    box-shadow: var(--card-shadow);
    border-color: var(--card-border-color);
}

.ad-container-1 {
    margin-top: 0;
    margin-bottom: 0;
    min-height: 144px;
}

/* Approved AdSense responsive sizing (exact size per screen width)
   Ref: https://support.google.com/adsense/answer/9183363 */
.dnd_adslot_1 { width: 320px; height: 100px; }
@media (min-width: 500px) { .dnd_adslot_1 { width: 468px; height: 60px; } }
@media (min-width: 800px) { .dnd_adslot_1 { width: 728px; height: 90px; } }

.ad-container-2 {
    margin: 20px 0;
    padding: 15px;
}

/* Ad-2 inside content area - adjust spacing for better text flow */
.about-content .ad-container-2 {
    margin: 25px auto;
    max-width: 100%;
}

/* Ensure ads are visible */
.ad-container ins {
    display: block !important;
    width: 100%;
    pointer-events: auto; /* Allow interactions */
    position: relative;
    z-index: 1;
}

/* Main Wrapper for Layout with Sidebars */
.main-wrapper {
    display: block;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    padding: 40px 20px 0;
    box-sizing: border-box;
}

.main-wrapper .container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}

/* Hide Ad-2 on desktop when vertical ads are showing (screen >= 1360px) */
@media (min-width: 1360px) {
    .ad-container-2 {
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
        position: absolute;
        left: -9999px;
        /* Keep dimensions for AdSense */
        width: 100%;
        min-height: 100px;
    }
    
    .main-wrapper {
        /*
         * Keep the content visually centered on large screens.
         * (We removed the right sidebar ad, but we keep symmetric padding
         * so the main content stays centered instead of shifting right.)
         */
        padding: 40px 200px 0;
    }
    
    .main-wrapper .container {
        max-width: 1000px;
    }
}

/* Ad-2 is now inside content, visible on all screens */

/* Vertical Ad Sidebars (Left and Right) - Fixed Position */
/* POLICY COMPLIANCE: Only ONE fixed ad visible at a time (Google AdSense requirement) */
/* Responsiveness: vertical ad is hidden below 1360px (see media query "max-width: 1359px" below). */
.vertical-ad-sidebar {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    position: fixed;
    top: 50%; /* Center vertically */
    transform: translateY(-50%); /* Center vertically */
    width: 180px; /* 160px ad + 20px padding */
    z-index: 100;
    /* Always maintain dimensions for AdSense */
    min-width: 180px;
    min-height: 600px;
    transition: top 0.25s ease-out;
}

/* Show both left and right ads (Google AdSense: only one sticky ad at a time) */
.vertical-ad-sidebar.vertical-ad-left {
    /* Keep dimensions for AdSense */
    width: 180px;
    height: 638px;
}

/* Right sidebar ad removed from markup; keep class in case it returns later */

.vertical-ad-sidebar .vertical-ad-wrapper {
    pointer-events: auto;
    position: relative;
    min-width: 180px;
    min-height: 638px;
}

/* Ensure vertical ad ins elements allow pointer events */
.vertical-ad-wrapper ins {
    pointer-events: auto;
    position: relative;
    z-index: 1;
}

/* Homepage: 160x300 vertical ad fixed at bottom (bottom: 10px), no scroll behavior */
.vertical-ad-sidebar.vertical-ad--home {
    top: auto;
    bottom: 10px;
    height: auto;
    min-height: auto;
    transform: none;
}

.vertical-ad-sidebar.vertical-ad--home .vertical-ad-wrapper {
    min-height: 338px;
    min-width: 180px;
}

.vertical-ad-left {
    left: 10px; /* 10px from left edge */
}

.vertical-ad-right {
    right: 10px; /* 10px from right edge */
}

.vertical-ad-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 16px 12px;
    transition: box-shadow 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
    position: relative;
    z-index: 1;
    /* Match glass-card styling */
    background: var(--card-bg);
    backdrop-filter: blur(var(--card-blur));
    -webkit-backdrop-filter: blur(var(--card-blur));
    border-radius: 20px;
    border: var(--card-border-width) dashed var(--card-border-color);
    box-shadow: var(--card-shadow);
}

.vertical-ad-wrapper:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow);
    border-color: var(--card-border-color);
}


/*
 * Vertical ad responsiveness (AdSense allows hiding by screen size).
 * Breakpoint: VERTICAL_AD_DESKTOP_BREAKPOINT = 1360px
 * - Desktop (>= 1360px): vertical ad visible (fixed sidebar).
 * - Mobile/tablet (< 1360px): vertical ad hidden via CSS only (no display:none on the unit itself).
 */
@media (max-width: 1359px) {
    .vertical-ad-sidebar {
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
        position: absolute;
        left: -9999px;
        width: 180px;
        height: 600px;
    }
    .vertical-ad-sidebar.vertical-ad-left {
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
        position: absolute;
        left: -9999px;
    }
}

/* Footer */
.site-footer {
    margin: 10px 0 0;
    padding: 22px 24px;
    border-radius: 24px;
    background: var(--card-bg);
    border: 3px dashed var(--card-border-color);
    box-shadow: var(--card-shadow);
    text-align: center;
    backdrop-filter: blur(var(--card-blur));
    -webkit-backdrop-filter: blur(var(--card-blur));
    animation: fadeInUp 0.8s ease-out 0.9s both, pulse 4s ease-in-out infinite;
    position: relative;
    z-index: 1;
}

.site-footer .footer-line {
    color: var(--text-secondary);
    font-weight: 800;
    font-size: 17px;
    text-shadow: var(--text-shadow-soft);
    margin: 0 0 26px 0;
}

.site-footer .footer-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 32px 52px;
    max-width: 680px;
    margin: 0 auto;
}

.site-footer .footer-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.site-footer .footer-col-title {
    color: var(--text-muted);
    font-weight: 900;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
    text-shadow: var(--text-shadow-soft);
}

.site-footer .footer-col-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.site-footer .footer-col-links a {
    color: var(--text-secondary);
    font-weight: 800;
    font-size: 16px;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.site-footer .footer-col-links a:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.site-footer .footer-copyright {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
    margin: 28px 0 0 0;
    text-shadow: var(--text-shadow-soft);
}

@media (max-width: 768px) {
    .main-wrapper {
        padding: 20px 15px 15px;
    }
    
    .container {
        gap: 10px; /* Reduced from 20px to make ads more visible */
    }
    
    .blocks-row {
        flex-direction: column;
        gap: 15px; /* Reduced from 20px */
        margin-bottom: 0; /* Remove any bottom margin */
    }
    
    .glass-card {
        padding: 25px 20px 15px; /* Reduced padding, especially bottom (was 35px 25px 25px) */
        min-height: 300px;
        margin-bottom: 0; /* Remove bottom margin */
    }
    
    .emoji-collection-card {
        padding: 12px 15px 10px; /* Reduced padding, especially bottom (was 15px 20px) */
        min-height: 280px; /* Reduced from 400px so ads are more visible */
        margin-bottom: 0; /* Remove bottom margin */
    }
    
    .emoji-collection-container {
        min-height: 280px; /* Reduced from 400px so ads are more visible */
    }

    /* Reduce footer animation complexity on mobile */
    .site-footer {
        animation: fadeInUp 0.8s ease-out 0.9s both;
    }
    
    .about-block {
        padding: 25px 25px;
    }
    
    .about-title {
        font-size: 24px;
        margin-bottom: 15px;
    }
    
    .about-content {
        font-size: 14px;
    }
    
    .collection-title {
        font-size: 20px;
    }
    
    .emoji-collection-grid {
        height: 150px;
        max-height: 150px;
        gap: 8px;
    }
    
    .ad-container {
        margin: 10px 0;
        padding: 16px 20px;
        /* Softer glass on mobile (no backdrop-filter for performance) */
    }
    .is-mobile .ad-container {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: var(--card-bg);
    }
    
    .ad-container-1 {
        margin-top: 20px; /* Adequate spacing from game content on mobile */
        margin-bottom: 20px; /* Adequate spacing to content below */
    }
    
    .ad-container-2 {
        margin: 20px 0;
        padding: 12px;
        /* Reset desktop hiding styles on mobile */
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        position: relative !important;
        left: auto !important;
        width: 100% !important;
    }
    
    .about-content .ad-container-2 {
        margin: 20px 0;
    }
    
    .emoji-item {
        padding: 5px 6px;
        flex: 0 0 calc(20% - 8px);
        max-width: calc(20% - 8px);
    }
    
    .emoji-item-emoji {
        font-size: 20px;
    }
    
    .emoji-item-count {
        font-size: 10px;
    }
    
    .game-section-compact {
        gap: 10px;
        margin-bottom: 20px;
    }
    
    .timer-container-compact {
        padding: 5px 10px;
        gap: 6px;
    }
    
    .timer-display-compact {
        font-size: 20px;
        min-width: 40px;
        letter-spacing: 0.3px;
    }
    
    .timer-start-btn-compact {
        padding: 5px 15px;
        font-size: 12px;
    }
    
    .system-collection-counter-compact {
        padding: 4px 10px;
        gap: 6px;
    }
    
    .system-label-compact {
        font-size: 11px;
    }
    
    .system-value-compact {
        font-size: 16px;
    }
    
    .game-modal {
        padding: 30px 30px;
        max-width: 90%;
    }
    
    .game-modal-title {
        font-size: 36px;
    }
    
    .game-modal-message {
        font-size: 18px;
    }
    
    .game-modal-emoji {
        font-size: 60px;
    }
    
    .game-modal-btn {
        padding: 12px 25px;
        font-size: 16px;
    }
}

/* Game Result Popup Modal */
.game-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--modal-overlay-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 20px;
    animation: fadeIn 0.3s ease-out;
}

/* Disable backdrop-filter on mobile modal */
.is-mobile .game-modal-overlay {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--modal-overlay-bg-mobile);
}

.game-modal {
    background: var(--modal-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 30px;
    border: 5px dashed var(--modal-border-color);
    box-shadow: var(--modal-shadow);
    padding: 40px 50px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    animation: popIn 0.4s ease-out;
    position: relative;
    will-change: transform;
    transform: translateZ(0); /* GPU acceleration */
}

/* Disable backdrop-filter on mobile modal */
.is-mobile .game-modal {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--modal-bg-mobile);
    box-shadow: var(--modal-shadow);
}

.game-modal-title {
    font-size: 48px;
    font-weight: 900;
    margin-bottom: 20px;
    text-shadow: var(--modal-title-shadow);
    color: var(--modal-title-color);
}

.game-modal-message {
    font-size: 24px;
    font-weight: 700;
    color: var(--modal-message-color);
    margin-bottom: 30px;
    line-height: 1.4;
}

.game-modal-score {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-muted);
    margin: -12px 0 22px 0;
    text-shadow: var(--text-shadow-soft);
}

.game-modal-emoji {
    font-size: 80px;
    margin-bottom: 20px;
    animation: bounce 1s ease-in-out infinite;
}

.game-modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.game-modal-btn {
    padding: 15px 35px;
    font-size: 18px;
    font-weight: 700;
    font-family: inherit;
    border-radius: 25px;
    border: 2px solid var(--modal-btn-border);
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: var(--modal-btn-text-shadow);
    box-shadow: var(--modal-btn-shadow);
    display: inline-block;
    text-decoration: none;
}

.game-modal-btn.restart {
    background: linear-gradient(135deg, var(--accent-3), var(--accent-1));
    color: #ffffff;
}

.game-modal-btn.close {
    background: linear-gradient(135deg, var(--accent-2), var(--accent-1));
    color: #ffffff;
}

.game-modal-btn.support {
    background: linear-gradient(135deg, #ffd93d, #ff6b9d);
    color: #ffffff;
    padding: 10px 20px;
    font-size: 14px;
    letter-spacing: 1px;
    animation: supportPulse 2s ease-in-out infinite;
    margin-top: 10px;
}

@keyframes supportPulse {
    0%, 100% {
        box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
    }
    50% {
        box-shadow: 0 6px 20px rgba(255, 217, 61, 0.5);
    }
}

.game-modal-btn.support:hover {
    animation: none;
}

.game-modal-btn:hover {
    transform: scale(1.1) rotate(2deg);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.game-modal-btn:active {
    transform: scale(0.95);
}

.min-h-0 {
    min-height: 0 !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes popIn {
    0% {
        transform: scale(0.5) rotate(-10deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.1) rotate(5deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* ========== Games listing page ========== */
.games-page .page-effect-wrap {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
    opacity: 1;
}

.games-page #heroEffectCanvas {
    display: block;
    width: 100%;
    height: 100%;
    filter: brightness(1.15) contrast(1.1);
}

.is-mobile .games-page .page-effect-wrap {
    opacity: 0.9;
}

/* Games list: categories and list live in game-wrapper; ad + how-to + footer in main-wrapper */
.games-page .game-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    padding: 40px 20px 0;
    box-sizing: border-box;
}

@media (min-width: 1360px) {
    .games-page .game-wrapper {
        padding-left: 220px;
        padding-right: 220px;
    }
}

@media (max-width: 1359px) {
    .games-page .game-wrapper {
        padding-left: 20px;
        padding-right: 20px;
    }
}

.games-page .game-wrapper .container {
    max-width: 1500px;
    margin: 0 auto;
    width: 100%;
}

.games-page .games-list-how-to {
    margin-top: 1.5rem;
}

.games-page-row {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 22px;
    width: 100%;
    align-items: stretch;
}

.games-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    position: relative;
    margin-bottom: 20px;
    flex-wrap: nowrap;
}

.games-list-title {
    margin: 0;
    flex: 0 0 auto;
    text-align: left;
}

.games-selected-category {
    position: absolute;
    left: 50px;
    top: -10px;
    display: block;
    max-width: 220px;
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
    color: var(--accent-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

/* Inline search in header: keep on the right, same row as Games text */
.games-search-form-inline {
    width: auto;
    margin-left: auto;
    min-width: 0;
}

.games-search-form-inline .games-search-row {
    flex-wrap: nowrap;
}

.games-search-form-inline .games-search-input {
    max-width: 300px;
}

.games-header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 0 0 auto;
}

.games-filter-open-btn {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 800;
    font-family: inherit;
    color: var(--text-primary);
    background: color-mix(in srgb, var(--panel-bg) 85%, transparent 15%);
    border: 2px dashed var(--card-border-color);
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease;
    white-space: nowrap;
}

.games-filter-open-btn:hover {
    border-color: var(--accent-2);
}

.games-filter-open-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.games-search-open-btn {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 10px;
    font-size: 14px;
    font-weight: 800;
    font-family: inherit;
    color: var(--text-primary);
    background: color-mix(in srgb, var(--panel-bg) 85%, transparent 15%);
    border: 2px dashed var(--card-border-color);
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease;
    white-space: nowrap;
}

.games-search-open-btn:hover {
    border-color: var(--accent-2);
}

.games-search-open-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Filters popup (mobile/tablet) */
.games-filters-popup,
.games-search-popup {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: color-mix(in srgb, var(--page-bg) 96%, transparent 4%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 60px 16px 18px;
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity 0.25s ease-out, transform 0.25s ease-out;
    overflow-y: auto;
}

.games-filters-popup.is-visible,
.games-search-popup.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.games-filters-popup[hidden],
.games-search-popup[hidden] {
    display: none !important;
}

.games-filters-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 12px;
    background: color-mix(in srgb, var(--card-bg) 92%, transparent 8%);
    color: var(--text-primary);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.12s ease;
}

.games-filters-close:hover {
    background: color-mix(in srgb, var(--panel-bg) 85%, transparent 15%);
    transform: scale(1.05);
}

.games-filters-panel,
.games-search-panel {
    max-width: 520px;
    margin: 0 auto;
    background: var(--card-bg);
    border: 3px dashed var(--card-border-color);
    border-radius: 22px;
    box-shadow: var(--card-shadow);
    padding: 18px 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: calc(100vh - 96px);
}

.games-filters-title,
.games-search-title {
    font-size: 18px;
    font-weight: 900;
    color: var(--text-primary);
    text-align: center;
}

/* When filters popup is open, hide header (match mobile menu behavior) */
.games-filters-open .site-header {
    visibility: hidden;
}

.games-filters-panel .games-filter-content {
    min-height: 0;
}

.games-filters-panel .games-category-list {
    max-height: 44vh;
}

/* Small screens: single-column game cards */
@media (max-width: 768px) {
    .games-page .games-list {
        grid-template-columns: 1fr;
    }
}

.games-filter-card,
.games-list-card {
    padding: 28px 30px;
    justify-content: flex-start;
}

.games-filter-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
    min-height: 0;
}

.games-filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.games-filter-group--categories {
    flex: 1;
    min-height: 0;
}

.games-filter-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
}

.games-select {
    width: 100%;
    padding: 10px 14px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--chip-bg);
    border: 2px dashed var(--card-border-color);
    border-radius: 12px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.games-select:hover,
.games-select:focus {
    border-color: var(--accent-1);
    outline: none;
}

.games-select-sm {
    width: auto;
    min-width: 70px;
    padding: 6px 28px 6px 10px;
    font-size: 14px;
}

.games-category-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: auto;
    padding-right: 6px;
}

.games-category-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    background: var(--chip-bg);
    border: 2px dashed var(--card-border-color);
    border-radius: 14px;
    text-decoration: none;
    transition: border-color 0.2s, background 0.2s, transform 0.12s;
}

.games-category-item:hover {
    border-color: var(--accent-2);
    background: color-mix(in srgb, var(--accent-2) 10%, transparent);
    transform: translateX(2px);
}

.games-category-item.is-active {
    border-color: var(--accent-1);
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--accent-1) 16%, transparent),
        color-mix(in srgb, var(--accent-2) 10%, transparent)
    );
}

.games-list-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Scroll wrapper: clips height and scrolls; grid inside keeps natural item heights */
.games-page .games-list-scroll {
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-1) transparent;
	padding-top: 5px;
}
.games-page .games-list-scroll::-webkit-scrollbar { width: 6px; }
.games-page .games-list-scroll::-webkit-scrollbar-track { background: transparent; }
.games-page .games-list-scroll::-webkit-scrollbar-thumb {
    background: var(--accent-1);
    border-radius: 3px;
}
.games-page .games-list-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--accent-3);
}

.games-page .games-list {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px;
}

.games-page .game-item-content {
    padding: 10px 12px 12px;
}

.games-page .game-item-title {
    font-size: 14px;
}

.games-page .game-item-description {
    font-size: 12px;
}

.games-search-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.games-search-input {
    flex: 0 0 calc(100% - 140px);
    width: calc(100% - 140px);
    max-width: calc(100% - 140px);
    padding: 10px 16px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--chip-bg);
    border: 2px dashed var(--card-border-color);
    border-radius: 12px;
}

.games-search-input::placeholder {
    color: var(--text-muted);
}

.games-search-input:hover,
.games-search-input:focus {
    border-color: var(--accent-2);
    outline: none;
}

.games-search-btn {
    flex: 0 0 130px;
    font-family: inherit;
}

.games-empty {
    color: var(--text-muted);
    font-size: 16px;
    text-align: center;
    padding: 40px 20px;
}

.games-list .games-empty {
    grid-column: 1 / -1;
    width: 100%;
    background: color-mix(in srgb, var(--panel-bg) 80%, transparent 20%);
    border: 2px dashed var(--card-border-color);
    border-radius: 18px;
}

.games-empty-illustration {
    width: 160px;
    max-width: 60%;
    margin: 0 auto 14px;
}

.games-empty-illustration svg {
    display: block;
    width: 100%;
    height: auto;
}

.games-empty-title {
    font-size: 18px;
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.games-empty-subtitle {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
}

.games-list-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 16px;
    border-top: 2px dashed var(--card-border-color);
}

.games-pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.games-pagination-btn {
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--chip-bg);
    border: 2px dashed var(--card-border-color);
    border-radius: 10px;
    text-decoration: none;
    transition: border-color 0.2s, transform 0.2s;
}

.games-pagination-btn:hover {
    border-color: var(--accent-1);
}

.games-pagination-pages {
    display: flex;
    align-items: center;
    gap: 4px;
}

.games-pagination-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--chip-bg);
    border: 2px dashed var(--card-border-color);
    border-radius: 10px;
    text-decoration: none;
    transition: border-color 0.2s;
}

a.games-pagination-page:hover {
    border-color: var(--accent-2);
}

.games-pagination-page.is-current {
    border-color: var(--accent-1);
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent-1) 18%, transparent), color-mix(in srgb, var(--accent-2) 12%, transparent));
}

.games-pagination-ellipsis {
    padding: 0 6px;
    font-size: 14px;
    color: var(--text-muted);
}

.games-display-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.games-display-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
}

.games-display-form {
    display: inline-flex;
    align-items: center;
}

.games-display-suffix {
    font-size: 14px;
    color: var(--text-muted);
    margin-left:10px;
}

.games-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
}

@media (max-width: 900px) {
    .games-page-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1050px) {
    .games-page .game-wrapper .container {
        max-width: 100%;
    }

    .games-page-row {
        grid-template-columns: 1fr;
    }

    .games-filter-card {
        display: none;
    }

    .games-filter-open-btn,
    .games-search-open-btn {
        display: inline-flex;
    }

    /* Move Games text to left when filter + search buttons are visible */
    .games-list-header {
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .games-list-title {
        text-align: left;
        flex: 0 0 auto;
    }

    .games-selected-category {
        position: static;
        transform: none;
        order: 3;
        max-width: 100%;
        margin-top: 6px;
        pointer-events: auto;
    }

    /* Hide inline search bar when search icon is shown; use popup only */
    .games-search-form:not(.games-search-form-popup) {
        display: none;
    }
}

@media (max-width: 640px) {
    .games-list-header {
        justify-content: space-between;
    }

    .games-list-title {
        text-align: left;
        flex: 0 0 auto;
    }

    .games-filter-open-btn,
    .games-search-open-btn {
        position: static;
        transform: none;
        margin-left: 0;
    }

    .games-filter-open-label,
    .games-search-open-label {
        display: none;
    }

    .games-search-form-popup .games-search-row {
        flex-direction: column;
        align-items: stretch;
    }

    .games-search-form-popup .games-search-input {
        flex: 0 0 auto;
        width: 100%;
        max-width: 100%;
    }

    .games-search-form-popup .games-search-btn {
        flex: 0 0 auto;
        width: 100%;
    }
}

/* Maintenance page (standalone; no header/footer) */
body.maintenance-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
    overflow-x: hidden;
}
body.maintenance-page .main-wrapper {
    width: 100%;
    max-width: 100%;
    padding: 0;
    box-sizing: border-box;
}
body.maintenance-page .main-wrapper .container {
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}
body.maintenance-page .maintenance-card {
    text-align: center;
    min-height: 0;
    flex: none;
    justify-content: flex-start;
    padding: 32px 24px;
    animation: fadeInUp 0.8s ease-out;
}
body.maintenance-page .maintenance-card::before {
    display: none;
}
body.maintenance-page .maintenance-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 24px;
    color: var(--text-primary);
}
body.maintenance-page .maintenance-brand-icon {
    width: 40px;
    height: 40px;
    display: block;
}
body.maintenance-page .maintenance-brand-text {
    font-size: 1.25rem;
    font-weight: 800;
}
body.maintenance-page .maintenance-icon {
    margin: 0 auto 16px;
}
body.maintenance-page .maintenance-icon img {
    display: block;
    width: 150px;
    height: 150px;
    margin: 0 auto;
    object-fit: contain;
}
body.maintenance-page .about-title {
    margin-bottom: 12px;
}
body.maintenance-page .about-content {
    text-align: center;
}
body.maintenance-page .about-content p {
    margin-bottom: 12px;
}
body.maintenance-page .about-content p:last-child {
    margin-bottom: 0;
}
