:root {
    --primary-color: #0ea5e9;    /* Sky Blue */
    --secondary-color: #0369a1;  /* Darker Sky Blue */
    --accent-color: #f59e0b;     /* Amber Accent */
    --background-color: #0f172a; /* Slate 900 Background */
    --text-color: #f1f5f9;      /* Slate 100 Text */
    --white: #1e293b;           /* Slate 800 for card backgrounds */
    --light-gray: #334155;
    --border-color: rgba(148, 163, 184, 0.15);
    --color-text-muted: #94a3b8;
    --footer-bg: #020617;
    --footer-border: rgba(148, 163, 184, 0.1);
    --footer-heading: #f8fafc;
    --footer-link: #94a3b8;
    --footer-link-hover: #38bdf8;
    --footer-note: #475569;
    --radius-lg: 1.25rem;
    --radius-md: 0.75rem;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
}

body {
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .container {
        padding: 0 1.25rem;
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 0 1.5rem;
    }
}

header {
    background-color: var(--white);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(165, 180, 252, 0.1);
}

nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.logo-icon {
    stroke: var(--primary-color);
    transition: transform 0.3s ease;
}

.logo:hover .logo-icon {
    transform: rotate(15deg);
}

.gamepad-icon {
    color: var(--primary-color);
}

nav ul {
    display: flex;
    gap: 2rem;
    list-style-type: none;
    margin: 0;
    padding: 0;
}

nav a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 1rem;
    transition: color 0.3s ease;
}

nav a:hover {
    color: var(--primary-color);
}

.hero {
    text-align: center;
    padding: 4rem 0;
}

h1 {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 1rem;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color), var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero p {
    font-size: 1.25rem;
    color: var(--color-text-muted);
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 4rem;
}

.game-card {
    background-color: rgba(30, 27, 75, 0.5);
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-decoration: none;
    color: var(--text-color);
    transition: background-color 0.3s ease;
    position: relative;
    overflow: hidden;
}

.game-card:hover {
    background-color: rgba(30, 27, 75, 0.8);
}

.game-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid transparent;
    border-radius: 0.75rem;
    transition: border-color 0.3s ease;
}

.game-card:hover::after {
    border-color: rgba(139, 92, 246, 0.5);
}

.game-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.game-card h3 {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.game-card p {
    color: var(--color-text-muted);
}

footer {
    background-color: var(--footer-bg);
    border-top: 1px solid var(--footer-border);
    padding: 3rem 0;
    margin-top: 4rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.footer-section h3, .footer-section h4 {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--footer-heading);
}

.footer-section p {
    color: var(--footer-link);
}

.footer-section ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.footer-section li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: var(--footer-link);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: var(--footer-link-hover);
}

.footer-bottom {
    margin-top: 2rem;
    text-align: center;
    color: var(--footer-note);
    font-size: 0.875rem;
}

@media (max-width: 768px) {
    nav {
        flex-wrap: wrap;
        gap: 0.65rem;
        padding: 0.75rem;
    }

    nav ul {
        gap: 1rem;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .logo {
        font-size: 1.25rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }
}

/* Navigation Links */
.nav-right ul {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-right a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-right a:hover {
    color: var(--primary-color);
}

/* Dropdown Styles */
.dropdown-content {
    background-color: var(--white);
    border: 1px solid var(--border-color);
}

/* Button Styles */
.button {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.button:hover {
    background-color: var(--secondary-color);
}

/* ——— Home page: HTML Games games ——— */
body.page-home {
    --primary-color: #38bdf8;
    --secondary-color: #0284c7;
    --accent-color: #fbbf24;
    --background-color: #020617;
    --text-color: #f1f5f9;
    --white: #0f172a;
    --light-gray: #1e293b;
    --border-color: rgba(148, 163, 184, 0.15);
    --color-text-muted: #94a3b8;
    font-family: "DM Sans", system-ui, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    min-height: 100vh;
    position: relative;
}

body.page-home .home-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(circle at 0% 0%, rgba(56, 189, 248, 0.12), transparent 40%),
        radial-gradient(circle at 100% 0%, rgba(251, 191, 36, 0.08), transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(56, 189, 248, 0.05), transparent 50%),
        var(--background-color);
    pointer-events: none;
}

body.page-home .site-header--home {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

body.page-home .nav-home {
    padding: 1rem 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

body.page-home .logo--home {
    color: #f8fafc;
    gap: 0.75rem;
}

body.page-home .logo-mark {
    flex-shrink: 0;
    filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.4));
}

body.page-home .logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    align-items: flex-start;
}

body.page-home .logo-text__small {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #38bdf8;
    opacity: 0.9;
}

body.page-home .logo-text__big {
    font-family: "Outfit", "DM Sans", sans-serif;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    background: linear-gradient(135deg, #38bdf8, #fbbf24);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

body.page-home .logo-text__tag {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #64748b;
    margin-top: 0.1rem;
}

body.page-home .nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
    margin-left: auto;
}

body.page-home .nav-links a {
    color: #94a3b8;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.2s ease, transform 0.2s ease;
}

body.page-home .nav-links a:hover {
    color: #38bdf8;
    transform: translateY(-1px);
}

body.page-home .btn-nav-random {
    margin-left: 0;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.6rem 1.25rem;
    border-radius: 999px;
    border: 1px solid rgba(56, 189, 248, 0.4);
    background: rgba(56, 189, 248, 0.1);
    color: #38bdf8;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 0 rgba(56, 189, 248, 0);
}

body.page-home .btn-nav-random:hover {
    background: rgba(56, 189, 248, 0.2);
    border-color: #38bdf8;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.2);
    transform: translateY(-2px);
}

body.page-home .btn-nav-random:active {
    transform: scale(0.96);
}

body.page-home .hero--home {
    text-align: left;
    padding: 4rem 0 3rem;
    max-width: 42rem;
}

body.page-home .hero-eyebrow {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #fbbf24;
    margin: 0 0 1.25rem;
    padding: 0.4rem 1rem;
    border-radius: 999px;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.2);
}

body.page-home .hero--home h1 {
    font-family: "Outfit", "DM Sans", sans-serif;
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 800;
    line-height: 1.05;
    margin: 0 0 1.5rem;
    letter-spacing: -0.02em;
}

body.page-home .hero-line {
    display: block;
}

body.page-home .hero-line--muted {
    color: #94a3b8;
}

body.page-home .hero-line--pop {
    background: linear-gradient(135deg, #38bdf8, #fbbf24);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

body.page-home .hero-lead {
    font-size: 1.125rem;
    color: #94a3b8;
    line-height: 1.7;
    margin: 0 0 2rem;
    max-width: 38rem;
}

body.page-home .hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

body.page-home .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.875rem 1.75rem;
    border-radius: 0.75rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.page-home .btn-primary {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: #ffffff;
    box-shadow: 0 10px 25px -5px rgba(14, 165, 233, 0.4);
}

body.page-home .btn-primary:hover {
    box-shadow: 0 20px 35px -5px rgba(14, 165, 233, 0.5);
    transform: translateY(-3px);
}

body.page-home .btn-secondary {
    background: rgba(30, 41, 59, 0.5);
    color: #f1f5f9;
    border: 1px solid rgba(148, 163, 184, 0.2);
    backdrop-filter: blur(8px);
}

body.page-home .btn-secondary:hover {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(56, 189, 248, 0.4);
    color: #38bdf8;
    transform: translateY(-3px);
}

body.page-home .hero-trust {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.875rem;
    color: #64748b;
}

body.page-home .hero-trust strong {
    color: #38bdf8;
    font-weight: 700;
    margin-right: 0.25rem;
}

body.page-home .engage-panel {
    margin: 0 0 4rem;
    padding: 2rem;
    border-radius: 1.25rem;
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.4), rgba(15, 23, 42, 0.6));
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

body.page-home .engage-title {
    font-family: "Outfit", sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    color: #f8fafc;
}

body.page-home .engage-desc {
    font-size: 0.95rem;
    color: #94a3b8;
}

body.page-home .engage-meter {
    height: 12px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
    margin-bottom: 0.75rem;
}

body.page-home .engage-meter__fill {
    background: linear-gradient(90deg, #0ea5e9, #fbbf24);
}

body.page-home .library-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2.5rem;
    gap: 2rem;
    flex-wrap: wrap;
}

body.page-home .library-head__text {
    flex: 1;
    min-width: 300px;
}

body.page-home .library-title {
    font-size: 1.75rem;
    font-family: "Outfit", sans-serif;
    font-weight: 700;
    margin: 0 0 0.5rem;
    color: #f8fafc;
}

body.page-home .library-sub {
    font-size: 1rem;
    color: #94a3b8;
    margin: 0;
}

body.page-home .filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

body.page-home .chip {
    padding: 0.5rem 1.15rem;
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: #94a3b8;
}

body.page-home .chip--active {
    background: rgba(14, 165, 233, 0.15);
    border-color: #0ea5e9;
    color: #38bdf8;
}

body.page-home .game-card {
    background: rgba(30, 41, 59, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(8px);
    padding: 1.75rem;
    border-radius: 1.25rem;
}

body.page-home .game-card:hover {
    background: rgba(30, 41, 59, 0.5);
    border-color: rgba(56, 189, 248, 0.3);
    transform: translateY(-6px);
}

body.page-home .game-card__badge {
    background: rgba(56, 189, 248, 0.1);
    color: #38bdf8;
    font-size: 0.7rem;
    padding: 0.25rem 0.6rem;
}

body.page-home .game-card[data-category="classic"] .game-card__badge {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

body.page-home .game-card[data-category="action"] .game-card__badge {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

body.page-home .game-card[data-category="puzzle"] .game-card__badge {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

body.page-home .game-card h3 {
    font-size: 1.35rem;
    color: #f1f5f9;
}

body.page-home .game-card__cta {
    color: #38bdf8;
    font-weight: 800;
}

body.page-home .game-card__cta::after {
    content: "→";
    transition: transform 0.2s ease;
}

body.page-home .game-card:hover .game-card__cta::after {
    transform: translateX(4px);
}

body.page-home .game-card.is-filtered-out {
    display: none;
}

body.page-home .grid-empty {
    text-align: center;
    color: var(--color-text-muted);
    padding: 2rem;
    font-size: 0.95rem;
}

body.page-home .footer--home {
    background-color: var(--footer-bg);
    border-top: 1px solid var(--footer-border);
    margin-top: 3rem;
}

@media (max-width: 640px) {
    body.page-home .nav-home {
        flex-direction: column;
        align-items: stretch;
    }

    body.page-home .nav-links {
        justify-content: center;
    }

    body.page-home .btn-nav-random {
        margin-left: 0;
        width: 100%;
    }

    body.page-home .hero--home {
        padding-top: 1.5rem;
    }
}

@media (max-width: 1024px) {
    body.page-home .hero--home {
        max-width: 100%;
        padding-top: 2rem;
    }

    body.page-home .hero-lead {
        max-width: 100%;
    }
}

@media (max-width: 900px) {
    body.page-home .nav-home {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 0.75rem;
        align-items: center;
    }

    body.page-home .nav-links {
        margin-left: 0;
        justify-self: end;
    }

    body.page-home .btn-nav-random {
        grid-column: 1 / -1;
        width: 100%;
    }
}

@media (max-width: 768px) {
    body.page-home .hero--home {
        text-align: center;
    }

    body.page-home .hero-actions {
        justify-content: center;
    }

    body.page-home .hero-trust {
        justify-content: center;
        gap: 0.75rem 1.25rem;
    }

    body.page-home .library-head__text {
        text-align: center;
    }

    body.page-home .filter-chips {
        justify-content: center;
    }
}

@media (max-width: 520px) {
    body.page-home .logo--home {
        justify-content: center;
    }

    body.page-home .logo-text__big {
        font-size: 1rem;
    }

    body.page-home .logo-text__tag {
        letter-spacing: 0.18em;
    }

    body.page-home .hero--home h1 {
        font-size: clamp(1.75rem, 8vw, 2.15rem);
    }

    body.page-home .btn {
        width: 100%;
    }

    body.page-home .games-grid--home {
        grid-template-columns: 1fr;
    }

    body.page-home .game-card {
        padding: 1.1rem 1rem 1rem;
    }
}

@media (min-width: 1280px) {
    body.page-home .hero--home {
        max-width: 44rem;
        padding-top: 3.2rem;
    }

    body.page-home .games-grid--home {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* ——— Games listing (games.html) ——— */
body.page-games .games-page-intro {
    text-align: center;
    padding: 2.5rem 0 1.5rem;
    max-width: 36rem;
    margin: 0 auto;
}

body.page-games .games-page-intro h1 {
    font-size: clamp(1.85rem, 4vw, 2.5rem);
    margin: 0 0 0.75rem;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color), var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

body.page-games .games-page-intro p {
    margin: 0;
    font-size: 1.05rem;
    color: var(--color-text-muted);
    line-height: 1.6;
}

body.page-games nav a[aria-current="page"] {
    color: var(--primary-color);
    font-weight: 600;
}

body.page-games .games-board {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
    margin-bottom: 3rem;
}

@media (max-width: 560px) {
    body.page-games .games-board {
        grid-template-columns: 1fr;
    }
}

body.page-games .games-board__card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 1.35rem 1.25rem 1.25rem;
    border-radius: 0.85rem;
    text-decoration: none;
    color: var(--text-color);
    background-color: var(--white);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

body.page-games .games-board__card::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 4px;
    background: var(--card-accent, linear-gradient(90deg, var(--primary-color), var(--accent-color)));
}

body.page-games .games-board__card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.12);
    border-color: rgba(37, 99, 235, 0.25);
}

body.page-games .games-board__card--memory {
    --card-accent: linear-gradient(90deg, #ec4899, #a855f7);
}

body.page-games .games-board__card--snake {
    --card-accent: linear-gradient(90deg, #22c55e, #3b82f6);
}

body.page-games .games-board__card--tetris {
    --card-accent: linear-gradient(90deg, #06b6d4, #2563eb);
}

body.page-games .games-board__card--puzzle {
    --card-accent: linear-gradient(90deg, #eab308, #f97316);
}

body.page-games .games-board__card--whack {
    --card-accent: linear-gradient(90deg, #ef4444, #eab308);
}

body.page-games .games-board__card--tictactoe {
    --card-accent: linear-gradient(90deg, #3b82f6, #6366f1);
}

body.page-games .games-board__card--rps {
    --card-accent: linear-gradient(90deg, #22c55e, #14b8a6);
}

body.page-games .games-board__card--simon {
    --card-accent: linear-gradient(90deg, #a855f7, #ec4899);
}

body.page-games .games-board__card--hangman {
    --card-accent: linear-gradient(90deg, #6366f1, #a855f7);
}

body.page-games .games-board__card--mines {
    --card-accent: linear-gradient(90deg, #64748b, #334155);
}

body.page-games .games-board__card--math {
    --card-accent: linear-gradient(90deg, #22c55e, #3b82f6);
}

body.page-games .games-board__card--word {
    --card-accent: linear-gradient(90deg, #eab308, #ef4444);
}

body.page-games .games-board__card--pattern {
    --card-accent: linear-gradient(90deg, #9333ea, #4f46e5);
}

body.page-games .games-board__icon {
    font-size: 2.5rem;
    line-height: 1;
    margin-bottom: 0.65rem;
}

body.page-games .games-board__card h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 0.4rem;
    color: var(--text-color);
}

body.page-games .games-board__card p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    line-height: 1.5;
    flex: 1;
}

body.page-games .games-board__card::after {
    content: "Play →";
    margin-top: 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-color);
}

@media (max-width: 768px) {
    body.page-games .games-page-intro {
        padding-top: 1.5rem;
    }
}

/* ——— Game pages: shared layout (same shell as puzzle.html) ——— */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body.page-game {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    --game-primary: #ec4899;
    --game-secondary: #8b5cf6;
    --game-surface: #1e1b4b;
    --game-surface-end: #312e81;
    --game-text-on-play: #ffffff;
    --game-muted-on-play: #a5b4fc;
}

body.page-game.page-game--ttt {
    --game-primary: #60a5fa;
    --game-secondary: #818cf8;
}

body.page-game.page-game--snake {
    --game-primary: #22c55e;
    --game-secondary: #06b6d4;
}

body.page-game.page-game--tetris {
    --game-primary: #06b6d4;
    --game-secondary: #a78bfa;
}

body.page-game.page-game--whack {
    --game-primary: #ef4444;
    --game-secondary: #eab308;
}

body.page-game.page-game--puzzle {
    --game-primary: #eab308;
    --game-secondary: #f97316;
}

body.page-game .game-page-main {
    flex: 1;
}

body.page-game .game-page-hero {
    text-align: center;
    padding: 1.5rem 0 1rem;
    max-width: 40rem;
    margin: 0 auto;
}

body.page-game .game-page-title {
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    margin: 0 0 0.5rem;
    background: linear-gradient(to right, var(--game-primary), var(--game-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

body.page-game .game-page-lead {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 1.05rem;
    line-height: 1.55;
}

body.page-game .game-play {
    background: linear-gradient(165deg, var(--game-surface) 0%, var(--game-surface-end) 100%);
    border-radius: 1rem;
    padding: 2rem 1.5rem;
    margin-bottom: 2rem;
    color: var(--game-text-on-play);
    text-align: center;
    border: 1px solid rgba(165, 180, 252, 0.2);
    box-shadow: 0 12px 40px rgba(30, 27, 75, 0.25);
}

@media (min-width: 900px) {
    body.page-game .game-play {
        padding: 2.1rem 2rem;
    }
}

body.page-game .game-play-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 100%;
}

body.page-game .game-play-info {
    width: 100%;
}

body.page-game .game-play-info--row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    max-width: 420px;
    margin: 0 auto;
}

body.page-game .game-play-info p {
    margin: 0 0 1rem;
    color: var(--game-muted-on-play);
    min-height: 1.4em;
}

body.page-game .game-play-info p:last-child {
    margin-bottom: 0;
}

body.page-game .game-play-info p.win,
body.page-game .game-play-info p.is-win {
    color: var(--game-primary);
    font-weight: bold;
}

body.page-game .game-control {
    background-color: var(--game-secondary);
    color: var(--game-text-on-play);
    border: none;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    transition: background-color 0.2s ease, transform 0.1s ease, color 0.2s ease;
}

body.page-game .game-control:hover {
    background-color: var(--game-primary);
    color: var(--game-surface);
}

body.page-game .game-control:active {
    transform: scale(0.98);
}

body.page-game .touch-controls {
    display: none;
    width: min(100%, 320px);
    margin: 0.75rem auto 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
}

body.page-game .touch-controls .game-control {
    min-height: 46px;
    padding: 0.65rem 0.5rem;
    font-size: 1rem;
}

body.page-game .touch-controls [data-action="left"] {
    grid-column: 1;
}

body.page-game .touch-controls [data-action="rotate"],
body.page-game .touch-controls [data-action="up"] {
    grid-column: 2;
}

body.page-game .touch-controls [data-action="right"] {
    grid-column: 3;
}

body.page-game .touch-controls [data-action="down"] {
    grid-column: 2;
}

body.page-game .game-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
    margin-top: 0.5rem;
}

body.page-game .game-panel {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

body.page-game .game-section-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0 0 0.75rem;
}

body.page-game .game-panel p,
body.page-game .game-panel li {
    color: var(--color-text-muted);
    line-height: 1.6;
}

body.page-game .game-panel ul {
    margin: 0;
    padding-left: 1.25rem;
}

body.page-game .game-panel li + li {
    margin-top: 0.35rem;
}

body.page-game .game-more-intro {
    margin-top: 0;
    margin-bottom: 0.75rem;
    color: var(--color-text-muted);
}

body.page-game .game-more-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

body.page-game .game-more-grid a {
    display: inline-block;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    background: var(--light-gray);
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    transition: background 0.2s ease, border-color 0.2s ease;
}

body.page-game .game-more-grid a:hover {
    background: rgba(37, 99, 235, 0.08);
    border-color: var(--primary-color);
}

@media (max-width: 768px) {
    body.page-game .game-play {
        padding: 1.25rem 0.85rem;
    }

    body.page-game .game-play-info--row {
        justify-content: center;
    }

    body.page-game .touch-controls {
        display: grid;
    }
}

body.page-game .game-play input[type="text"],
body.page-game .game-play input[type="number"] {
    font-size: 1.1rem;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    border: 1px solid rgba(165, 180, 252, 0.45);
    background: rgba(255, 255, 255, 0.95);
    color: #1e1b4b;
    margin: 0.25rem 0.35rem 0.75rem;
}

body.page-game .game-play-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    max-width: 22rem;
    margin: 0 auto;
}

body.page-game .game-play-stack .game-control {
    margin-top: 0.25rem;
}

/* Sliding puzzle tiles (puzzle.html) */
body.page-game--puzzle .puzzle-board {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: min(90vw, 300px);
    aspect-ratio: 1;
    margin-bottom: 1.25rem;
    padding: 8px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 12px;
    border: 2px solid rgba(165, 180, 252, 0.2);
}

body.page-game--puzzle .tile {
    border: none;
    border-radius: 8px;
    font-size: clamp(1.25rem, 6vw, 1.75rem);
    font-weight: bold;
    cursor: pointer;
    background: linear-gradient(145deg, #4c1d95, #5b21b6);
    color: #fff;
    transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
    min-height: 44px;
}

body.page-game--puzzle .tile:hover:not(:disabled) {
    background: linear-gradient(145deg, #6d28d9, #4c1d95);
    box-shadow: 0 4px 12px rgba(234, 179, 8, 0.25);
}

body.page-game--puzzle .tile:active:not(:disabled) {
    transform: scale(0.96);
}

body.page-game--puzzle .tile--empty {
    cursor: default;
    background: transparent;
    box-shadow: none;
    pointer-events: none;
}

/* ============================================================
   PUNJAB BHARTI GAMES — COLORFUL UI ENHANCEMENT LAYER
   (appended; overrides base rules for a richer home look)
   ============================================================ */

:root {
    --pb-violet: #a855f7;
    --pb-amber:  #f59e0b;
    --pb-rose:   #fb7185;
    --pb-emerald:#34d399;
    --pb-cyan:   #22d3ee;
    --pb-blue:   #3b82f6;
}

/* --- Animated multi-color aurora background --- */
body.page-home .home-bg {
    background:
        radial-gradient(closest-side at 12% 8%, rgba(168, 85, 247, 0.28), transparent 60%),
        radial-gradient(closest-side at 88% 4%, rgba(34, 211, 238, 0.22), transparent 60%),
        radial-gradient(closest-side at 78% 70%, rgba(251, 113, 133, 0.20), transparent 60%),
        radial-gradient(closest-side at 20% 85%, rgba(52, 211, 153, 0.18), transparent 60%),
        radial-gradient(closest-side at 50% 40%, rgba(59, 130, 246, 0.16), transparent 65%),
        #0b1020;
    background-size: 200% 200%;
    animation: pbAurora 22s ease-in-out infinite alternate;
}
@keyframes pbAurora {
    0%   { background-position: 0% 0%, 100% 0%, 100% 100%, 0% 100%, 50% 50%, 0 0; }
    100% { background-position: 30% 20%, 70% 20%, 70% 80%, 30% 80%, 50% 60%, 0 0; }
}

/* --- Hero: animated tri-color gradient headline + glow --- */
body.page-home .hero-line--pop {
    background: linear-gradient(90deg, #22d3ee, #a855f7, #fb7185, #f59e0b, #22d3ee);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: pbHueSlide 8s linear infinite;
    filter: drop-shadow(0 6px 30px rgba(168, 85, 247, 0.25));
}
@keyframes pbHueSlide { to { background-position: 300% 0; } }

body.page-home .hero-eyebrow {
    color: #fde68a;
    background: linear-gradient(90deg, rgba(168,85,247,0.18), rgba(34,211,238,0.18));
    border: 1px solid rgba(168, 85, 247, 0.35);
    box-shadow: 0 0 24px rgba(168, 85, 247, 0.15);
}

body.page-home .hero-trust strong { color: var(--pb-cyan); }

/* --- Buttons: vivid gradient --- */
body.page-home .btn-primary {
    background: linear-gradient(135deg, #7c3aed, #d946ef 45%, #22d3ee);
    background-size: 200% 200%;
    box-shadow: 0 12px 30px -6px rgba(168, 85, 247, 0.5);
    animation: pbHueSlide 6s linear infinite;
}
body.page-home .btn-primary:hover {
    box-shadow: 0 20px 40px -6px rgba(217, 70, 239, 0.55);
    transform: translateY(-3px) scale(1.02);
}
body.page-home .btn-secondary:hover {
    border-color: rgba(168, 132, 255, 0.6);
    color: #e9d5ff;
    box-shadow: 0 0 22px rgba(168, 85, 247, 0.25);
}
body.page-home .btn-nav-random {
    background: linear-gradient(135deg, #f59e0b, #fb7185);
    color: #1a1030;
    border: none;
    font-weight: 800;
    box-shadow: 0 8px 22px -6px rgba(251, 113, 133, 0.55);
    transition: transform .25s ease, box-shadow .25s ease;
}
body.page-home .btn-nav-random:hover { transform: translateY(-2px) scale(1.04); }

/* --- Logo tag colored --- */
body.page-home .logo-text__tag,
body.page-home .logo-text__small { color: var(--pb-cyan); }

/* --- Filter chips: colorful --- */
body.page-home .chip {
    transition: all .25s ease;
}
body.page-home .chip:hover {
    color: #e9d5ff;
    border-color: rgba(168, 85, 247, 0.5);
    background: rgba(168, 85, 247, 0.12);
}
body.page-home .chip--active {
    background: linear-gradient(135deg, rgba(124,58,237,0.35), rgba(34,211,238,0.30));
    border-color: #a855f7;
    color: #ffffff;
    box-shadow: 0 0 18px rgba(168, 85, 247, 0.3);
}

/* --- Section titles get a gradient --- */
body.page-home .library-title,
body.page-home .engage-title {
    background: linear-gradient(90deg, #a855f7, #22d3ee);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* --- Progress meter: rainbow --- */
body.page-home .engage-meter__fill {
    background: linear-gradient(90deg, #22d3ee, #a855f7, #fb7185, #f59e0b);
    box-shadow: 0 0 16px rgba(168, 85, 247, 0.4);
}
body.page-home .engage-panel {
    border: 1px solid rgba(168, 85, 247, 0.18);
    box-shadow: 0 0 40px rgba(124, 58, 237, 0.08) inset;
}

/* ============================================================
   GAME CARDS — each card colored by its category
   ============================================================ */
body.page-home .game-card {
    --cA: #38bdf8; --cB: #6366f1;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0)) ,
        rgba(23, 20, 45, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: 0 10px 30px -18px rgba(0,0,0,0.9);
    transition: transform .3s cubic-bezier(.4,0,.2,1), box-shadow .3s ease, border-color .3s ease, background .3s ease;
    animation: pbCardIn .5s both;
}
/* top accent bar */
body.page-home .game-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--cA), var(--cB));
    opacity: .9;
    border-radius: 1.25rem 1.25rem 0 0;
}
/* colored glow ring on hover */
body.page-home .game-card:hover {
    transform: translateY(-8px) scale(1.015);
    border-color: color-mix(in srgb, var(--cA) 55%, transparent);
    box-shadow: 0 22px 45px -18px var(--cA), 0 0 0 1px color-mix(in srgb, var(--cA) 35%, transparent) inset;
    background:
        radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--cA) 16%, transparent), transparent 60%),
        rgba(23, 20, 45, 0.75);
}
body.page-home .game-card:hover::after { border-color: transparent; }

/* per-category colors */
body.page-home .game-card[data-category="brain"]   { --cA: #a855f7; --cB: #6366f1; }
body.page-home .game-card[data-category="classic"] { --cA: #f59e0b; --cB: #fb923c; }
body.page-home .game-card[data-category="action"]  { --cA: #fb7185; --cB: #f43f5e; }
body.page-home .game-card[data-category="puzzle"]  { --cA: #34d399; --cB: #10b981; }

/* icon in a colored tile */
body.page-home .game-card .game-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 62px; height: 62px;
    border-radius: 16px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--cA) 26%, transparent), color-mix(in srgb, var(--cB) 20%, transparent));
    border: 1px solid color-mix(in srgb, var(--cA) 35%, transparent);
    box-shadow: 0 8px 20px -8px var(--cA);
    font-size: 2rem;
    margin-bottom: 1rem;
}

/* card title stays crisp white for readability */
body.page-home .game-card h3 {
    background: none;
    -webkit-background-clip: border-box;
    background-clip: border-box;
    color: #f8fafc;
}

/* vivid category badge */
body.page-home .game-card__badge {
    display: inline-block;
    background: linear-gradient(135deg, color-mix(in srgb, var(--cA) 90%, #000 0%), var(--cB));
    color: #0b1020 !important;
    font-weight: 800;
    letter-spacing: .03em;
    border-radius: 999px;
    box-shadow: 0 4px 12px -4px var(--cA);
}

/* colored CTA */
body.page-home .game-card__cta { color: var(--cA); }

/* staggered entrance */
@keyframes pbCardIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
body.page-home .games-grid--home .game-card:nth-child(1){animation-delay:.02s}
body.page-home .games-grid--home .game-card:nth-child(2){animation-delay:.06s}
body.page-home .games-grid--home .game-card:nth-child(3){animation-delay:.10s}
body.page-home .games-grid--home .game-card:nth-child(4){animation-delay:.14s}
body.page-home .games-grid--home .game-card:nth-child(5){animation-delay:.18s}
body.page-home .games-grid--home .game-card:nth-child(6){animation-delay:.22s}
body.page-home .games-grid--home .game-card:nth-child(n+7){animation-delay:.26s}

/* footer brand pop */
body.page-home .footer--home .footer-section h3 {
    color: #f8fafc;
}
body.page-home .footer--home a:hover { color: var(--pb-cyan); }

@media (prefers-reduced-motion: reduce) {
    body.page-home .home-bg,
    body.page-home .hero-line--pop,
    body.page-home .btn-primary,
    body.page-home .game-card { animation: none !important; }
}
