/* ============================================================================
   GAME MENU UNIFICATION STYLES
   Shared hero, stats, preview, and CTA layout for MathsVault interactive games
   ============================================================================ */

:root {
    --game-primary: #C90C0F;
    --game-secondary: #FAB719;
    --game-surface: rgba(15, 23, 42, 0.9);
    --game-surface-alt: rgba(30, 41, 59, 0.78);
    --game-border: rgba(250, 183, 25, 0.22);
    --game-border-strong: rgba(250, 183, 25, 0.4);
    --game-text-primary: #F8FAFC;
    --game-text-muted: #94A3B8;
    --game-shadow-soft: 0 20px 50px rgba(15, 23, 42, 0.55);
    --game-shadow-card: 0 18px 40px rgba(15, 23, 42, 0.4);
    --game-shadow-hover: 0 25px 70px rgba(201, 12, 15, 0.22);

    --menu-gradient-start: #0B1220;
    --menu-gradient-end: #1A2332;
    /* Overlay tints derived from the game theme colours */
    --menu-overlay-1: color-mix(in srgb, var(--game-primary) 18%, transparent);
    --menu-overlay-2: color-mix(in srgb, var(--game-secondary, var(--game-primary)) 28%, transparent);
    /* Fallback overlay if color-mix unsupported will use initial value below (overridden later by actual usage) */
    --menu-gradient-overlay: linear-gradient(135deg, rgba(201, 12, 15, 0.14) 0%, rgba(250, 183, 25, 0.12) 100%);

    --menu-spacing-xxs: 0.3rem;
    --menu-spacing-xs: 0.5rem;
    --menu-spacing-sm: 0.85rem;
    --menu-spacing-md: 1.25rem;
    --menu-spacing-lg: 1.85rem;
    --menu-spacing-xl: 2.6rem;
    --menu-spacing-xxl: 3.75rem;

    --menu-radius-sm: 10px;
    --menu-radius-md: 14px;
    --menu-radius-lg: 16px;

    --menu-transition-fast: 0.16s ease;
    --menu-transition: 0.26s ease;
    --menu-transition-slow: 0.42s ease;
    
    /* Menu container max width standard (ensures 9-wide badges fit) */
    --menu-container-max: 1200px;
}

/* ============================================================================
   SHARED GAME BASE STYLES
   Layout shell, buttons, modals, utilities – used across multiple games
   ============================================================================ */

/* Generic game page wrapper (used by individual games via body class) */
.game-page {
    min-height: 100vh;
    margin: 0;
    padding: 0;
    color: #1E293B;
    background: #f8fafc;
}

.game-shell {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
    background: transparent;
}

body.with-game-header .game-shell {
    padding-top: 1.5rem;
}

/* Shared screen toggling */
.game-screen,
.screen {
    display: none;
}

.game-screen.active,
.screen.active {
    display: block;
}

/* Flex variant for games that want full-height flex screens */
.game-screen.flex,
.screen.flex {
    display: none;
}

.game-screen.flex.active,
.screen.flex.active {
    display: flex;
    flex-direction: column;
}

/* ============================================================================
   SHARED BUTTON SYSTEM
   ============================================================================ */

.game-btn,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid transparent;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
    text-decoration: none;
}

/* Ensure all buttons have high z-index on mobile */
@media (max-width: 768px) {
    .game-btn,
    .btn,
    .btn-primary,
    .btn-secondary,
    .btn-success,
    .btn-danger {
        position: relative;
        z-index: 10001;
    }
}

.game-btn:disabled,
.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.game-btn-primary,
.btn-primary {
    background: var(--primary-color, #C90C0F);
    border-color: var(--primary-color, #C90C0F);
    color: #ffffff;
    box-shadow: 0 10px 25px rgba(201, 12, 15, 0.35);
}

.game-btn-primary:hover:not(:disabled),
.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover, #a00a0c);
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(201, 12, 15, 0.45);
}

.game-btn-secondary,
.btn-secondary {
    background: #6b7280;
    border-color: #6b7280;
    color: #ffffff;
}

.game-btn-secondary:hover:not(:disabled),
.btn-secondary:hover:not(:disabled) {
    background: #4b5563;
    border-color: #4b5563;
    transform: translateY(-2px);
}

.game-btn-success,
.btn-success {
    background: var(--success-color, #22c55e);
    border-color: var(--success-color, #22c55e);
    color: #ffffff;
}

.game-btn-danger,
.btn-danger {
    background: var(--danger-color, #ef4444);
    border-color: var(--danger-color, #ef4444);
    color: #ffffff;
}

.game-btn-icon,
.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.game-btn-lg,
.btn-large {
    padding: 1rem 2rem;
    font-size: 1.15rem;
}

/* ============================================================================
   SHARED MODAL SHELL
   ============================================================================ */

.game-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.75);
    z-index: 1000;
}

.game-modal.active {
    display: flex;
}

.game-modal__dialog {
    background: #ffffff;
    border-radius: 1rem;
    max-width: 640px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.45);
    overflow: hidden;
}

.game-modal__header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.game-modal__title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.game-modal__body {
    padding: 1.5rem;
    overflow-y: auto;
}

.game-modal__footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.game-modal__close {
    border: none;
    background: transparent;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6b7280;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.game-modal__close:hover {
    background: #f3f4f6;
    color: #111827;
}

/* ============================================================================
   SHARED UTILITIES & ACCESSIBILITY
   ============================================================================ */

.hidden {
    display: none !important;
}

.text-centre,
.text-center {
    text-align: center;
}

.text-bold {
    font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

*:focus-visible {
    outline: 3px solid var(--primary-color, #C90C0F);
    outline-offset: 2px;
}

/* ============================================================================
   TYPOGRAPHY BASELINE
   Enforce Rockwell family for all non-Font Awesome text across shared game UIs
   ============================================================================ */
body,
body.game-menu-active,
.game-menu-screen,
.game-menu-container,
.game-menu-screen *:not(i[class*="fa-"]):not(.fa):not(.fas):not(.far):not(.fab):not(.fa-solid):not(.fa-regular):not(.fa-brands),
.game-screen,
.game-screen *:not(i[class*="fa-"]):not(.fa):not(.fas):not(.far):not(.fab):not(.fa-solid):not(.fa-regular):not(.fa-brands) {
    font-family: "Rockwell", "Rockwell Nova", "Roboto Slab", serif !important;
}

/* Brand icons use a separate webfont (kit is FA7) — never map them to Solid/Pro/Free */
.fab,
.fab::before,
.fab:before,
.fa-brands,
.fa-brands::before,
.fa-brands:before,
i[class*="fa-brands"],
i[class*="fa-brands"]::before,
i[class*="fa-brands"]:before {
    font-family: "Font Awesome 7 Brands", "Font Awesome 6 Brands" !important;
    font-weight: 400 !important;
    font-style: normal !important;
    line-height: 1 !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
}

/* Solid / regular — MathsVault Font Awesome kit (Pro) with Free fallback */
i[class*="fa-"]:not([class*="fa-brands"]):not(.fab):before,
i[class*="fa-"]:not([class*="fa-brands"]):not(.fab)::before,
i[class*="fa-solid"]:before,
i[class*="fa-solid"]::before,
i[class*="fa-regular"]:before,
i[class*="fa-regular"]::before,
i[class*="fa-"]:not([class*="fa-brands"]):not(.fab),
.fa:not(.fab):not(.fa-brands),
.fas,
.far,
.fa-solid,
.fa-regular {
    font-family: "Font Awesome 7 Pro", "Font Awesome 6 Pro", "Font Awesome 6 Free" !important;
    font-weight: 900 !important;
    font-style: normal !important;
    line-height: 1 !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
}

.far,
.fa-regular {
    font-weight: 400 !important;
}

/* ============================================================================
   BACKDROP & SCREEN WRAPPER
   Games Vault menu redesign — aligned with hub aesthetic
   ============================================================================ */

body.game-menu-active {
    background:
        radial-gradient(ellipse 70% 45% at 12% 0%, color-mix(in srgb, var(--game-primary) 22%, transparent), transparent 55%),
        radial-gradient(ellipse 55% 40% at 90% 8%, color-mix(in srgb, var(--game-secondary) 14%, transparent), transparent 50%),
        linear-gradient(165deg, var(--menu-gradient-start) 0%, var(--menu-gradient-end) 100%);
    min-height: 100vh;
    color: var(--game-text-primary);
    overflow-x: hidden;
    overflow-y: auto;
}

.game-menu-screen {
    position: relative;
    min-height: 100vh;
    padding: 0;
    display: none;
    overflow-x: hidden;
    overflow-y: visible;
    color: var(--game-text-primary);
    isolation: isolate;
}

.game-menu-screen::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: var(--menu-bg-image, none);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.22;
    filter: saturate(0.95) brightness(0.72);
    z-index: 0;
    pointer-events: none;
}

.game-menu-screen::after {
    content: "";
    position: fixed;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(11, 18, 32, 0.55) 0%, rgba(11, 18, 32, 0.78) 45%, rgba(11, 18, 32, 0.92) 100%),
        linear-gradient(135deg, var(--menu-overlay-1, rgba(201, 12, 15, 0.12)) 0%, var(--menu-overlay-2, rgba(250, 183, 25, 0.1)) 100%);
    z-index: 0;
    pointer-events: none;
}

.game-menu-screen.active {
    display: block;
}

/* Hide in-game top bar while a menu screen is the active view */
body:has(.game-menu-screen.active) .game-top-bar,
body:has(.game-menu-screen.active) #game-header {
    display: none !important;
}

.game-menu-container {
    position: relative;
    z-index: 1;
    max-width: var(--menu-container-max, 1080px);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: clamp(1rem, 2.5vw, 1.75rem);
    padding: clamp(1.25rem, 3vw, 2.5rem) clamp(1rem, 3.5vw, 2.5rem) clamp(2rem, 4vw, 3.5rem);
    min-height: 100vh;
}

/* Top navigation strip (PHP menus) */
.game-menu-topnav {
    order: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
}

.game-menu-topnav__back {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.95rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(15, 22, 36, 0.65);
    color: #f4f1ea;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.game-menu-topnav__back:hover {
    background: rgba(201, 12, 15, 0.22);
    border-color: rgba(201, 12, 15, 0.45);
    color: #fff;
}

.game-menu-topnav__icon {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    object-fit: contain;
    background: #0b1220;
    flex-shrink: 0;
}

.game-menu-topnav__mark {
    color: var(--game-secondary, #FAB719);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-right: auto;
}

.game-menu-topnav__auth,
.game-topbar-auth {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.game-menu-topnav__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    margin-left: 0.15rem;
    border-radius: 10px;
    border: 1px solid rgba(250, 183, 25, 0.45);
    background: rgba(250, 183, 25, 0.12);
    color: #FAB719;
    text-decoration: none;
    font-size: 1.75rem;
    font-weight: 500;
    line-height: 1;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.game-menu-topnav__close .fa-xmark {
    font-size: 1.2rem;
}

.game-menu-topnav__close .fa-xmark::before {
    display: none;
}

.game-menu-topnav__close:hover,
.game-menu-topnav__close:focus-visible {
    background: #C90C0F;
    border-color: #C90C0F;
    color: #fff;
    outline: none;
}

@media (max-width: 640px) {
    .game-menu-topnav__mark {
        display: none;
    }
}

.game-menu-topnav__auth .gv-login-btn,
.game-topbar-auth .gv-login-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.95rem;
    border-radius: 999px;
    border: 1px solid rgba(250, 183, 25, 0.45);
    background: rgba(250, 183, 25, 0.16);
    color: #fff8e7;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}

.game-menu-topnav__auth .gv-login-btn:hover,
.game-topbar-auth .gv-login-btn:hover {
    background: rgba(250, 183, 25, 0.28);
    border-color: rgba(250, 183, 25, 0.7);
}

.game-menu-topnav__auth .user-display--compact,
.game-topbar-auth .user-display--compact,
.game-topbar-user {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    max-width: 12rem;
    color: #f8fafc;
    font-weight: 700;
    font-size: 0.92rem;
}

.game-menu-topnav__auth .user-display-name,
.game-topbar-auth .user-display-name {
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Legacy HTML menu titles (Nim 21, 20Q, Go Fish, etc.) */
.game-menu-title {
    order: 10;
    margin: 0.25rem 0 0;
    text-align: center;
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
    line-height: 1.05;
}

.game-menu-title i {
    color: var(--game-secondary, #FAB719);
    margin-right: 0.35rem;
}

.game-menu-subtitle {
    order: 11;
    margin: 0 auto 0.5rem;
    text-align: center;
    max-width: 36rem;
    color: var(--game-text-muted);
    font-size: clamp(0.98rem, 2vw, 1.12rem);
    line-height: 1.55;
}

/* Badge dropdown elements - positioned relative to container but outside flex flow on mobile */
.badge-dropdown-toggle,
.badge-dropdown-content {
    position: relative;
}

/* ============================================================================
   HERO AREA
   ============================================================================ */

.game-menu-hero {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    text-align: center;
    order: 10;
    padding: clamp(0.75rem, 2vw, 1.25rem) 0 0.25rem;
}

.game-menu-hero__title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
}

.game-menu-hero__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--game-primary);
    box-shadow: 0 12px 28px color-mix(in srgb, var(--game-primary) 35%, transparent);
    border: 1px solid color-mix(in srgb, var(--game-primary) 70%, #fff 10%);
    color: #ffffff;
    font-size: 1.45rem;
}

.game-menu-hero h1 {
    font-size: clamp(2.4rem, 5.5vw, 3.6rem);
    letter-spacing: -0.02em;
    text-transform: none;
    margin: 0;
    color: #ffffff;
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    -webkit-text-stroke: 0;
    text-stroke: 0;
    font-weight: 700;
    line-height: 1.02;
}

/* Keep known exceptions free of outline stroke */
.game-menu-screen.rpsdplus-menu .game-menu-hero__icon,
.game-menu-screen.calculadle-menu .game-menu-hero__icon {
    background: var(--game-primary);
    box-shadow: 0 12px 28px color-mix(in srgb, var(--game-primary) 35%, transparent);
    border: 1px solid color-mix(in srgb, var(--game-primary) 70%, #fff 10%);
}
.game-menu-screen.rpsdplus-menu .game-menu-hero h1,
.game-menu-screen.calculadle-menu .game-menu-hero h1 {
    -webkit-text-stroke: 0;
    text-stroke: 0;
}

.game-menu-hero__subtitle {
    margin: 0;
    max-width: 40rem;
    font-size: clamp(1rem, 2vw, 1.15rem);
    line-height: 1.6;
    color: var(--game-text-muted);
}

.game-menu-hero__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    justify-content: center;
}

.game-menu-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.8rem;
    background: rgba(250, 183, 25, 0.12);
    border: 1px solid rgba(250, 183, 25, 0.28);
    color: var(--game-secondary, #FAB719);
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.game-menu-hero__meta {
    margin-top: 0.35rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.game-menu-hero__meta div {
    background: rgba(15, 22, 36, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 0.55rem 0.9rem;
    min-width: 120px;
}

.game-menu-hero__meta dt {
    margin: 0;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--game-text-muted);
}

.game-menu-hero__meta dd {
    margin: 0.25rem 0 0;
    font-size: 0.92rem;
    font-weight: 600;
    color: #F8FAFC;
}

/* ============================================================================
   STAT PREVIEW GRID
   ============================================================================ */

.game-menu-stats-wrap {
    position: relative;
    order: 20;
    min-height: 7.5rem;
}

.game-menu-stats-signin-overlay[hidden],
.game-menu-stats-wrap.is-logged-in .game-menu-stats-signin-overlay,
.game-menu-stats-wrap.is-dismissed .game-menu-stats-signin-overlay {
    display: none !important;
}

.game-menu-stats-signin-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    padding: clamp(1rem, 3vw, 1.5rem);
    text-align: center;
    background: rgba(11, 18, 32, 0.9);
    backdrop-filter: blur(8px);
    border-radius: 16px;
    border: 1px solid rgba(250, 183, 25, 0.25);
    overflow: auto;
}

.game-menu-stats-signin-close {
    position: absolute;
    top: 0.45rem;
    right: 0.45rem;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
    cursor: pointer;
    font-size: 1.15rem;
    line-height: 1;
}

.game-menu-stats-signin-close:hover {
    background: #C90C0F;
    color: #fff;
}

.game-menu-stats-signin-title {
    margin: 0;
    font-size: clamp(1.05rem, 2.5vw, 1.25rem);
    font-weight: 700;
    color: #f8fafc;
}

.game-menu-stats-signin-text {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.45;
    color: rgba(248, 250, 252, 0.88);
    max-width: 28rem;
}

.game-menu-stats-signin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.25rem;
}

.game-menu-stats-signin-actions .game-menu-button {
    min-width: 8.5rem;
    max-width: none;
}

.game-menu-stats-signin-note {
    margin: 0.35rem 0 0;
    font-size: 0.72rem;
    line-height: 1.35;
    color: rgba(248, 250, 252, 0.65);
    max-width: 26rem;
}

.game-menu-stats-wrap .game-menu-stats {
    order: initial;
}

.game-menu-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    order: 20;
}

.game-menu-screen .stat-card,
.game-menu-stats .stat-card {
    background: rgba(15, 22, 36, 0.72) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 14px;
    padding: 1rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    text-align: center;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
    transition: transform var(--menu-transition), border-color var(--menu-transition), box-shadow var(--menu-transition);
}

.game-menu-screen .stat-card:hover,
.game-menu-stats .stat-card:hover {
    transform: translateY(-3px);
    border-color: rgba(250, 183, 25, 0.28) !important;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
}

.game-menu-screen .stat-value,
.game-menu-stats .stat-value {
    font-size: clamp(1.55rem, 3vw, 2rem);
    font-weight: 700;
    color: var(--game-secondary, #FAB719) !important;
    line-height: 1.1;
}

.game-menu-screen .stat-label,
.game-menu-stats .stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--game-text-muted) !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ============================================================================
   DAILY / FEATURE PREVIEW
   ============================================================================ */

.game-menu-preview {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    align-items: center;
    background: rgba(15, 22, 36, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-left: 4px solid var(--game-primary);
    border-radius: 16px;
    padding: clamp(0.95rem, 2vw, 1.35rem) clamp(1rem, 2.2vw, 1.5rem);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
    order: 30;
}

.game-quick-start {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    align-items: center;
    background: rgba(15, 22, 36, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 16px;
    padding: clamp(0.95rem, 2vw, 1.35rem);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.24);
    order: 35;
}

/* Setup/settings blocks in the menu inherit no flex order (0) and would sit
   above the top nav and hero. Keep them with the preview/actions band. */
.game-menu-container [class$="-settings-panel"],
.game-menu-container [id$="SettingsPanel"] {
    order: 35;
}

.game-quick-start__title {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--game-secondary, #FAB719);
}

.game-quick-start__buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.5rem;
}

.game-quick-start__buttons .qs-btn,
.game-quick-start__buttons .difficulty-pill {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    padding: 0.6rem 0.9rem;
    background: rgba(255, 255, 255, 0.04);
    color: #F1F5F9;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: transform var(--menu-transition-fast), border-color var(--menu-transition-fast), background var(--menu-transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
}

.game-quick-start__buttons .qs-btn:hover,
.game-quick-start__buttons .difficulty-pill:hover {
    transform: translateY(-2px);
    border-color: rgba(201, 12, 15, 0.55);
    background: rgba(201, 12, 15, 0.18);
    color: #fff;
}

.game-menu-preview__badge {
    padding: 0.4rem 0.95rem;
    border-radius: 999px;
    background: rgba(201, 12, 15, 0.9);
    border: none;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #ffffff;
    font-size: 0.75rem;
}

.game-menu-preview__body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    color: #E2E8F0;
}

.game-menu-preview__date {
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
}

.game-menu-preview__countdown {
    font-size: 0.9rem;
    color: var(--game-text-muted);
    letter-spacing: 0.02em;
}

.game-menu-preview__extras {
    list-style: none;
    margin: 0.55rem 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.4rem;
}

.game-menu-preview__extras li {
    display: flex;
    justify-content: space-between;
    gap: 0.45rem;
    font-size: 0.88rem;
    color: rgba(226, 232, 240, 0.85);
}

.game-menu-preview__extras strong {
    font-weight: 600;
    color: #F8FAFC;
}

.game-menu-preview__status {
    padding: 0.4rem 0.95rem;
    background: rgba(16, 185, 129, 0.16);
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.75rem;
    color: #A7F3D0;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* ============================================================================
   CTA STACK
   ============================================================================ */

.game-menu-actions,
.game-menu-options {
    display: grid;
    grid-auto-flow: row;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.85rem;
    justify-items: stretch;
    align-items: stretch;
    justify-content: center;
    order: 40;
}

/* Short desktop windows: CTAs were below the fold with overflow locked */
@media (max-height: 960px) {
    .game-menu-container {
        padding-top: clamp(1rem, 2.5vh, 1.75rem);
        padding-bottom: clamp(1rem, 2.5vh, 1.75rem);
        gap: clamp(0.75rem, 2vh, 1.15rem);
        min-height: auto;
    }

    .game-menu-actions,
    .game-menu-options {
        order: 25;
    }

    .game-menu-preview {
        order: 35;
    }

    .game-menu-hero__subtitle {
        font-size: clamp(0.92rem, 1.6vh, 1.05rem);
    }
}

.game-menu-button {
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    background: rgba(15, 22, 36, 0.82);
    color: #ffffff;
    padding: 1rem 1.1rem;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 0.9rem;
    row-gap: 0.2rem;
    text-align: left;
    cursor: pointer;
    transition: transform var(--menu-transition), box-shadow var(--menu-transition), border-color var(--menu-transition), background var(--menu-transition);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
    width: 100%;
    max-width: none;
    align-items: center;
}

.game-menu-button:hover {
    transform: translateY(-3px);
    border-color: rgba(201, 12, 15, 0.45);
    background: rgba(26, 35, 50, 0.95);
    box-shadow: 0 16px 36px rgba(201, 12, 15, 0.18);
}

.game-menu-button:active {
    transform: translateY(-1px);
}

.game-menu-button.primary {
    background: var(--game-primary);
    color: #ffffff;
    border-color: var(--game-primary);
    box-shadow: 0 14px 34px color-mix(in srgb, var(--game-primary) 35%, transparent);
}

.game-menu-button.primary:hover {
    background: color-mix(in srgb, var(--game-primary) 86%, #000);
    color: #ffffff;
    border-color: color-mix(in srgb, var(--game-primary) 86%, #000);
    transform: translateY(-3px);
    box-shadow: 0 18px 40px color-mix(in srgb, var(--game-primary) 42%, transparent);
}

.game-menu-button.primary .game-menu-button-icon {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

.game-menu-button.primary .game-menu-button-subtext {
    color: rgba(255, 255, 255, 0.85);
}

.game-menu-button.secondary,
.game-menu-button.tertiary {
    background: rgba(15, 22, 36, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.game-menu-button.outline {
    background: transparent;
    border: 1px solid rgba(250, 183, 25, 0.35);
    color: var(--game-secondary, #FAB719);
}

.game-menu-button.outline:hover {
    background: rgba(250, 183, 25, 0.1);
    border-color: rgba(250, 183, 25, 0.55);
    color: #fff;
}

.game-menu-button.success {
    border-color: rgba(16, 185, 129, 0.45);
}

.game-menu-button-icon {
    grid-row: 1 / span 2;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(250, 183, 25, 0.12);
    border: 1px solid rgba(250, 183, 25, 0.22);
    font-size: 1.15rem;
    color: var(--game-secondary, #FAB719);
}

.game-menu-button-text {
    font-size: 1.05rem;
    font-weight: 700;
    align-self: end;
    line-height: 1.2;
}

.game-menu-button-subtext {
    position: static;
    left: auto;
    bottom: auto;
    transform: none;
    background: none;
    color: var(--game-text-muted);
    border: none;
    border-radius: 0;
    padding: 0;
    font-size: 0.82rem;
    line-height: 1.35;
    white-space: normal;
    box-shadow: none;
    pointer-events: none;
    display: block;
    z-index: auto;
    align-self: start;
}

.game-menu-button:hover .game-menu-button-subtext {
    display: block;
}

.game-menu-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Buttons without icons still align cleanly */
.game-menu-button:not(:has(.game-menu-button-icon)) {
    grid-template-columns: 1fr;
}

/* ============================================================================
   DAILY BUTTON AUTO-HIDE
   Auto-hide Daily Challenge button when today's challenge is completed.
   Convention:
     - Root menu element (.game-menu-screen) sets data-daily-state="completed"
     - Daily button carries data-role="play-daily"
   ============================================================================ */
.game-menu-screen[data-daily-state="completed"] .game-menu-actions [data-role="play-daily"] {
    display: none !important;
}

/* ============================================================================
   DAILY NUDGE MODAL (shared)
   Shown at most once per UK day, only when this game has a streak at risk.
   Portaled to document.body so it cannot disturb the menu flex/overflow layout.
   ============================================================================ */
.game-menu-nudge-overlay[hidden] { display: none !important; }
.game-menu-nudge-overlay,
.game-menu-nudge-modal,
.game-menu-nudge-modal * {
    box-sizing: border-box;
}
.game-menu-nudge-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(8px);
    z-index: 40000;
    display: grid;
    place-items: center;
    padding: max(1rem, env(safe-area-inset-top, 0px)) 1rem max(1rem, env(safe-area-inset-bottom, 0px));
    isolation: isolate;
    overscroll-behavior: contain;
}
.game-menu-nudge-modal {
    background: #121a28;
    border: 1px solid rgba(250, 183, 25, 0.28);
    border-radius: 16px;
    padding: 1.6rem 1.4rem 1.4rem;
    width: min(420px, calc(100vw - 2rem));
    max-width: calc(100vw - 2rem);
    max-height: min(85dvh, 32rem);
    overflow: auto;
    color: var(--game-text-primary, #E2E8F0);
    position: relative;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    text-align: center;
    z-index: 1;
}
.game-menu-nudge-modal .nudge-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    color: var(--game-text-primary, #E2E8F0);
    cursor: pointer;
    font-size: 1.25rem;
    z-index: 2;
}
.game-menu-nudge-modal .nudge-close:hover {
    background: #C90C0F;
    color: #fff;
}
.game-menu-nudge-modal .nudge-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--game-secondary, #FAB719);
}
.game-menu-nudge-modal .nudge-title {
    margin: 0 2rem 0.25rem;
    font-size: 1.5rem;
    letter-spacing: -0.01em;
}
.game-menu-nudge-modal .nudge-subtitle {
    margin: 0 0 1.1rem 0;
    color: var(--game-text-muted, #94A3B8);
}
.game-menu-nudge-modal .nudge-actions {
    display: grid;
    justify-items: center;
}
.game-menu-nudge-modal .nudge-play {
    padding: 0.85rem 1.25rem;
    max-width: 100%;
    width: 100%;
    position: relative;
    z-index: auto;
}

@media (max-width: 768px) {
    .game-menu-nudge-modal .nudge-close {
        position: absolute;
        top: 0.6rem;
        right: 0.6rem;
        z-index: 2;
    }
    .game-menu-nudge-modal .nudge-play {
        position: relative;
        z-index: 1;
        background: #C90C0F;
        color: #fff;
    }
}

/* ============================================================================
   CARD SLOT (QUICK START / CUSTOM BLOCKS)
   ============================================================================ */

.game-menu-card,
.play-card {
    background: rgba(15, 22, 36, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 16px;
    padding: var(--menu-spacing-md);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.24);
    display: flex;
    flex-direction: column;
    gap: var(--menu-spacing-sm);
    order: 45;
}

.play-card.quick-start .difficulty-buttons,
.game-menu-card.quick-start .difficulty-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--menu-spacing-xs);
}

/* Badges at bottom */
.badge-display-section {
    order: 50;
    margin-top: auto;
    position: relative;
    z-index: 1;
    background: rgba(15, 22, 36, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 16px;
    padding: clamp(1rem, 2.2vw, 1.5rem);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.24);
}

/* Hide badge section when game screen is active */
body:not(.game-menu-active) .badge-display-section {
    display: none;
}

/* Hide mobile dropdown elements on desktop */
.badge-dropdown-toggle,
.badge-dropdown-content {
    display: none;
}

.game-menu-card__header,
.play-card h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: none;
    color: #fff;
}

.game-menu-card__subtext,
.play-card .hint-text {
    margin: 0;
    font-size: 0.95rem;
    color: var(--game-text-muted);
    line-height: 1.55;
}

.difficulty-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--menu-spacing-xs);
}

.difficulty-pill {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    padding: 0.55rem 0.9rem;
    background: rgba(255, 255, 255, 0.04);
    color: #E2E8F0;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: transform var(--menu-transition-fast), border-color var(--menu-transition-fast), background var(--menu-transition-fast);
}

.difficulty-pill:hover {
    transform: translateY(-2px);
    border-color: rgba(201, 12, 15, 0.55);
    background: rgba(201, 12, 15, 0.18);
}

.difficulty-pill.easy { border-color: rgba(16, 185, 129, 0.45); }
.difficulty-pill.medium { border-color: rgba(59, 130, 246, 0.45); }
.difficulty-pill.hard { border-color: rgba(250, 204, 21, 0.45); }
.difficulty-pill.expert { border-color: rgba(248, 113, 113, 0.45); }
.difficulty-pill.mini { border-color: rgba(250, 183, 25, 0.45); }

/* ============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================ */

@media (max-width: 1024px) {
    .game-menu-container {
        padding: clamp(32px, 5vw, 64px) clamp(16px, 5vw, 48px);
    }

    .game-menu-actions,
    .game-menu-options {
        grid-auto-columns: minmax(200px, 1fr);
        grid-template-rows: repeat(2, auto);
        grid-auto-flow: column;
    }

    .game-menu-preview {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .game-menu-preview__status {
        justify-self: center;
    }
}

@media (max-width: 768px) {
    /* Compact mobile layout - fit everything in one view */
    .game-menu-container {
        padding: clamp(24px, 4vw, 32px) clamp(16px, 4vw, 24px);
        gap: var(--menu-spacing-md);
        min-height: auto;
        max-height: 100vh;
        overflow-y: auto;
    }

    /* Hide hero icon on mobile */
    .game-menu-hero__icon {
        display: none !important;
    }

    .game-menu-hero h1 {
        font-size: clamp(2rem, 5vw, 2.5rem) !important;
        margin: 0;
        -webkit-text-stroke: 0 !important;
        text-stroke: 0 !important;
    }

    /* Override ALL game-specific title overrides on mobile - must be more specific than game CSS */
    .game-menu-screen .mathdle-menu .game-menu-hero__title h1,
    .game-menu-screen .mathdle-menu .game-menu-hero h1,
    .game-menu-screen .calculadle-menu .game-menu-hero__title h1,
    .game-menu-screen .calculadle-menu .game-menu-hero h1,
    .game-menu-screen .solitaire-menu .game-menu-hero__title h1,
    .game-menu-screen .solitaire-menu .game-menu-hero h1,
    .game-menu-screen .yahtzee-menu .game-menu-hero__title h1,
    .game-menu-screen .yahtzee-menu .game-menu-hero h1,
    .game-menu-screen .guesswho-menu .game-menu-hero__title h1,
    .game-menu-screen .guesswho-menu .game-menu-hero h1,
    .game-menu-screen .numero-uno-menu .game-menu-hero__title h1,
    .game-menu-screen .numero-uno-menu .game-menu-hero h1,
    .game-menu-screen .countdown-menu .game-menu-hero__title h1,
    .game-menu-screen .countdown-menu .game-menu-hero h1,
    .game-menu-screen .triggle-menu .game-menu-hero__title h1,
    .game-menu-screen .triggle-menu .game-menu-hero h1,
    .game-menu-screen .battleships-menu .game-menu-hero__title h1,
    .game-menu-screen .battleships-menu .game-menu-hero h1,
    .game-menu-screen .pwordle-menu .game-menu-hero__title h1,
    .game-menu-screen .pwordle-menu .game-menu-hero h1,
    .game-menu-screen .connections-menu .game-menu-hero__title h1,
    .game-menu-screen .connections-menu .game-menu-hero h1,
    .game-menu-screen .sudoku-menu .game-menu-hero__title h1,
    .game-menu-screen .sudoku-menu .game-menu-hero h1,
    .game-menu-screen .rpsdplus-menu .game-menu-hero__title h1,
    .game-menu-screen .rpsdplus-menu .game-menu-hero h1 {
        font-size: clamp(2rem, 5vw, 2.5rem) !important;
        -webkit-text-stroke: 0 !important;
        text-stroke: 0 !important;
    }

    .game-menu-hero__subtitle {
        display: none;
    }

    .game-menu-hero__badges {
        display: none;
    }

    .game-menu-hero__meta {
        display: none;
    }

    /* Compact horizontal stats - one line */
    .game-menu-stats {
        display: flex;
        flex-direction: row;
        gap: var(--menu-spacing-xs);
        grid-template-columns: none;
        order: 20;
    }

    .stat-card {
        flex: 1;
        min-width: 0;
        padding: var(--menu-spacing-sm);
        gap: 0.25rem;
    }

    .stat-value {
        font-size: clamp(1.5rem, 4vw, 1.8rem);
        line-height: 1.2;
    }

    .stat-label {
        font-size: 0.75rem;
        gap: 0.25rem;
    }

    .stat-label i {
        font-size: 0.7rem;
    }

    .game-menu-stats-wrap {
        min-height: 0;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .game-menu-stats-signin-overlay {
        position: relative;
        inset: auto;
        z-index: 2;
        padding: 0.7rem 2.4rem 0.7rem 0.85rem;
        gap: 0.4rem;
        overflow: visible;
    }

    .game-menu-stats-signin-text,
    .game-menu-stats-signin-note {
        display: none;
    }

    .game-menu-stats-signin-title {
        font-size: 0.95rem;
    }

    .game-menu-stats-signin-actions .game-menu-button {
        min-width: 0;
        z-index: auto;
        padding: 0.55rem 0.8rem;
    }

    /* Hide preview block on mobile */
    .game-menu-preview {
        display: none !important;
    }

    /* Hide quick start block on mobile */
    .game-quick-start {
        display: none !important;
    }

    /* Full width buttons in single column */
    .game-menu-actions,
    .game-menu-options {
        display: flex;
        flex-direction: column;
        gap: var(--menu-spacing-xs);
        grid-template-columns: none;
        grid-auto-flow: none;
        order: 30;
    }

    .game-menu-button {
        width: 100%;
        max-width: 100%;
        grid-template-columns: auto 1fr;
        text-align: left;
        align-items: center;
        position: relative;
        z-index: 10001;
        padding: 0.85rem 1rem;
    }

    .game-menu-button-icon {
        margin: 0;
        flex-shrink: 0;
    }

    .game-menu-button-text {
        justify-self: flex-start;
        text-align: left;
    }

    /* Hide the desktop inline grid; mobile uses the accordion below */
    .badge-display-section {
        display: none !important;
    }

    /* Badge dropdown toggle and content - inside container but full width */
    .badge-dropdown-toggle,
    .badge-dropdown-content {
        order: 40;
        margin-top: var(--menu-spacing-xs);
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Badge dropdown toggle button - show on mobile */
    .badge-dropdown-toggle {
        display: grid;
        width: 100%;
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 14px;
        background: rgba(15, 22, 36, 0.85);
        color: #fff;
        padding: 0.85rem 1rem;
        grid-template-columns: auto 1fr auto;
        gap: 0.85rem;
        align-items: center;
        cursor: pointer;
        pointer-events: auto;
        min-height: 44px;
        transition: transform var(--menu-transition), box-shadow var(--menu-transition), border-color var(--menu-transition);
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
        position: relative;
        z-index: 10002;
    }

    .badge-dropdown-toggle:hover,
    .badge-dropdown-toggle:focus-visible {
        transform: translateY(-2px);
        border-color: rgba(201, 12, 15, 0.45);
        box-shadow: var(--game-shadow-hover);
        color: #fff;
        background: rgba(15, 22, 36, 0.92);
    }

    .badge-dropdown-toggle-icon {
        display: grid;
        place-items: center;
        width: 48px;
        height: 48px;
        border-radius: 16px;
        background: rgba(148, 163, 184, 0.12);
        border: 2px solid color-mix(in srgb, var(--game-primary) 40%, transparent);
        font-size: 1.25rem;
        color: var(--game-primary);
        flex-shrink: 0;
    }

    .badge-dropdown-toggle-text {
        font-size: 1.1rem;
        font-weight: 600;
        text-align: left;
    }

    .badge-dropdown-toggle-chevron {
        font-size: 0.9rem;
        color: var(--game-primary);
        transition: transform var(--menu-transition);
        flex-shrink: 0;
    }

    .badge-dropdown-toggle.open .badge-dropdown-toggle-chevron {
        transform: rotate(180deg);
    }

    /*
     * Desktop rule is display:none on this class. Without an explicit display here,
     * adding .open never reveals the badges on mobile.
     */
    .badge-dropdown-content {
        display: block;
        max-height: 0;
        overflow: hidden;
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
        transition: max-height var(--menu-transition-slow), padding var(--menu-transition-slow), opacity 0.2s ease;
        padding: 0;
        margin-top: 0;
        background: var(--game-surface, rgba(15, 22, 36, 0.92));
        border: 2px solid color-mix(in srgb, var(--game-primary) 35%, transparent);
        border-width: 0;
        border-radius: var(--menu-radius-md);
        box-shadow: var(--game-shadow-card);
        color: #E2E8F0;
    }

    .badge-dropdown-content.open {
        display: block;
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
        max-height: none;
        padding: var(--menu-spacing-md);
        margin-top: var(--menu-spacing-xs);
        overflow: visible;
        border-width: 2px;
        position: relative;
        z-index: 10002;
        min-width: 0;
        max-width: 100%;
    }

    .badge-dropdown-content .badge-display-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1rem;
    }

    .badge-dropdown-content .badge-display-image {
        width: 60px;
        height: 60px;
    }

    .badge-dropdown-content .badge-display-item {
        max-width: 100px;
    }

    .badge-dropdown-content .badge-display-name {
        font-size: 0.7rem;
    }

    /* Ensure all button types have high z-index on mobile */
    .qs-btn,
    .difficulty-pill {
        position: relative;
        z-index: 10001;
    }
}

@media (max-width: 480px) {
    /* Ensure consistent title size on very small mobile (480px breakpoint) */
    .game-menu-hero h1 {
        font-size: clamp(2rem, 5vw, 2.5rem) !important;
        -webkit-text-stroke: 0 !important;
        text-stroke: 0 !important;
    }

    /* Override ALL game-specific title overrides on very small mobile (480px breakpoint) */
    .game-menu-screen .mathdle-menu .game-menu-hero__title h1,
    .game-menu-screen .mathdle-menu .game-menu-hero h1,
    .game-menu-screen .calculadle-menu .game-menu-hero__title h1,
    .game-menu-screen .calculadle-menu .game-menu-hero h1,
    .game-menu-screen .solitaire-menu .game-menu-hero__title h1,
    .game-menu-screen .solitaire-menu .game-menu-hero h1,
    .game-menu-screen .yahtzee-menu .game-menu-hero__title h1,
    .game-menu-screen .yahtzee-menu .game-menu-hero h1,
    .game-menu-screen .guesswho-menu .game-menu-hero__title h1,
    .game-menu-screen .guesswho-menu .game-menu-hero h1,
    .game-menu-screen .numero-uno-menu .game-menu-hero__title h1,
    .game-menu-screen .numero-uno-menu .game-menu-hero h1,
    .game-menu-screen .countdown-menu .game-menu-hero__title h1,
    .game-menu-screen .countdown-menu .game-menu-hero h1,
    .game-menu-screen .triggle-menu .game-menu-hero__title h1,
    .game-menu-screen .triggle-menu .game-menu-hero h1,
    .game-menu-screen .battleships-menu .game-menu-hero__title h1,
    .game-menu-screen .battleships-menu .game-menu-hero h1,
    .game-menu-screen .pwordle-menu .game-menu-hero__title h1,
    .game-menu-screen .pwordle-menu .game-menu-hero h1,
    .game-menu-screen .connections-menu .game-menu-hero__title h1,
    .game-menu-screen .connections-menu .game-menu-hero h1,
    .game-menu-screen .sudoku-menu .game-menu-hero__title h1,
    .game-menu-screen .sudoku-menu .game-menu-hero h1,
    .game-menu-screen .rpsdplus-menu .game-menu-hero__title h1,
    .game-menu-screen .rpsdplus-menu .game-menu-hero h1 {
        font-size: clamp(2rem, 5vw, 2.5rem) !important;
        -webkit-text-stroke: 0 !important;
        text-stroke: 0 !important;
    }
}

@media (max-width: 540px) {
    .game-menu-container {
        padding: clamp(20px, 3vw, 24px) clamp(12px, 3vw, 16px);
        gap: var(--menu-spacing-sm);
    }

    .game-menu-hero h1 {
        font-size: clamp(2rem, 5vw, 2.5rem) !important;
        -webkit-text-stroke: 0 !important;
        text-stroke: 0 !important;
    }

    /* Override ALL game-specific title overrides on small mobile - must be more specific than game CSS */
    .game-menu-screen .mathdle-menu .game-menu-hero__title h1,
    .game-menu-screen .mathdle-menu .game-menu-hero h1,
    .game-menu-screen .calculadle-menu .game-menu-hero__title h1,
    .game-menu-screen .calculadle-menu .game-menu-hero h1,
    .game-menu-screen .solitaire-menu .game-menu-hero__title h1,
    .game-menu-screen .solitaire-menu .game-menu-hero h1,
    .game-menu-screen .yahtzee-menu .game-menu-hero__title h1,
    .game-menu-screen .yahtzee-menu .game-menu-hero h1,
    .game-menu-screen .guesswho-menu .game-menu-hero__title h1,
    .game-menu-screen .guesswho-menu .game-menu-hero h1,
    .game-menu-screen .numero-uno-menu .game-menu-hero__title h1,
    .game-menu-screen .numero-uno-menu .game-menu-hero h1,
    .game-menu-screen .countdown-menu .game-menu-hero__title h1,
    .game-menu-screen .countdown-menu .game-menu-hero h1,
    .game-menu-screen .triggle-menu .game-menu-hero__title h1,
    .game-menu-screen .triggle-menu .game-menu-hero h1,
    .game-menu-screen .battleships-menu .game-menu-hero__title h1,
    .game-menu-screen .battleships-menu .game-menu-hero h1,
    .game-menu-screen .pwordle-menu .game-menu-hero__title h1,
    .game-menu-screen .pwordle-menu .game-menu-hero h1,
    .game-menu-screen .connections-menu .game-menu-hero__title h1,
    .game-menu-screen .connections-menu .game-menu-hero h1,
    .game-menu-screen .sudoku-menu .game-menu-hero__title h1,
    .game-menu-screen .sudoku-menu .game-menu-hero h1,
    .game-menu-screen .rpsdplus-menu .game-menu-hero__title h1,
    .game-menu-screen .rpsdplus-menu .game-menu-hero h1 {
        font-size: clamp(2rem, 5vw, 2.5rem) !important;
        -webkit-text-stroke: 0 !important;
        text-stroke: 0 !important;
    }

    .stat-card {
        padding: var(--menu-spacing-xs);
    }

    .stat-value {
        font-size: clamp(1.25rem, 3vw, 1.5rem);
    }

    .stat-label {
        font-size: 0.7rem;
    }

    .game-menu-button {
        padding: 0.75rem 0.9rem;
    }

    .game-menu-button-text {
        font-size: 1rem;
    }

    .badge-dropdown-toggle {
        padding: 0.75rem 0.9rem;
    }

    .badge-dropdown-toggle-text {
        font-size: 1rem;
    }

    .badge-dropdown-content .badge-display-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }

    /* Ensure buttons remain on top on smaller mobile screens */
    .game-menu-button,
    .qs-btn,
    .difficulty-pill {
        position: relative;
        z-index: 10001;
    }

    .badge-dropdown-toggle,
    .badge-dropdown-content.open {
        position: relative;
        z-index: 10002;
    }
}


/* Force mobile view - applies mobile styles regardless of screen size */
body.force-mobile-view {
    /* Override all desktop media queries to use mobile styles */
}

body.force-mobile-view .game-menu-hero__icon {
    width: 56px;
    height: 56px;
    font-size: 1.5rem;
}

body.force-mobile-view .game-menu-hero h1 {
    font-size: clamp(2.4rem, 6vw, 3.2rem);
}

body.force-mobile-view .game-menu-stats {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

body.force-mobile-view .game-menu-button {
    grid-template-columns: 1fr;
    text-align: center;
    align-items: center;
    position: relative;
    z-index: 10001;
}

body.force-mobile-view .game-menu-button-icon {
    margin: 0 auto;
}

body.force-mobile-view .game-menu-button-text,
body.force-mobile-view .game-menu-button-subtext {
    justify-self: center;
    text-align: center;
}

body.force-mobile-view .game-menu-container {
    padding: clamp(32px, 5vw, 64px) clamp(16px, 5vw, 48px);
}

body.force-mobile-view .game-menu-actions,
body.force-mobile-view .game-menu-options {
    grid-auto-columns: minmax(200px, 1fr);
    grid-template-rows: repeat(2, auto);
    grid-auto-flow: column;
}

body.force-mobile-view .game-menu-preview {
    grid-template-columns: 1fr;
    text-align: center;
}

body.force-mobile-view .game-menu-preview__status {
    justify-self: center;
}

/* Force desktop view - prevents mobile styles from applying */
body.force-desktop-view {
    /* Override mobile media queries to use desktop styles */
}

body.force-desktop-view .game-menu-hero__icon {
    width: 64px;
    height: 64px;
    font-size: 1.75rem;
}

body.force-desktop-view .game-menu-hero h1 {
    font-size: clamp(2.8rem, 5vw, 3.9rem);
}

body.force-desktop-view .game-menu-stats {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

body.force-desktop-view .game-menu-button {
    grid-template-columns: auto 1fr;
    text-align: left;
}

body.force-desktop-view .game-menu-button-icon {
    margin: 0;
}

body.force-desktop-view .game-menu-container {
    padding: clamp(48px, 6vw, 96px) clamp(16px, 4vw, 72px);
}

body.force-desktop-view .game-menu-actions,
body.force-desktop-view .game-menu-options {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    grid-auto-flow: row;
}

body.force-desktop-view .game-menu-preview {
    grid-template-columns: auto 1fr auto;
    text-align: left;
}

@media (max-width: 768px) {
    .jonners-view-toggle {
        top: 0.75rem;
        right: 0.75rem;
    }
    
    .view-toggle-btn {
        padding: 0.55rem 0.85rem;
        font-size: 0.85rem;
    }
    
    .toggle-label {
        font-size: 0.8rem;
    }
    
    /* On actual mobile devices, respect the force classes */
    body.force-desktop-view .game-menu-hero__icon {
        width: 64px !important;
        height: 64px !important;
        font-size: 1.75rem !important;
    }
    
    body.force-desktop-view .game-menu-hero h1 {
        font-size: clamp(2.8rem, 5vw, 3.9rem) !important;
    }
    
    body.force-desktop-view .game-menu-stats {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
    }
    
    body.force-desktop-view .game-menu-button {
        grid-template-columns: auto 1fr !important;
        text-align: left !important;
    }
    
    body.force-desktop-view .game-menu-button-icon {
        margin: 0 !important;
    }
    
    body.force-desktop-view .game-menu-container {
        padding: clamp(48px, 6vw, 96px) clamp(16px, 4vw, 72px) !important;
    }
    
    body.force-desktop-view .game-menu-actions,
    body.force-desktop-view .game-menu-options {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
        grid-auto-flow: row !important;
    }
    
    body.force-desktop-view .game-menu-preview {
        grid-template-columns: auto 1fr auto !important;
        text-align: left !important;
    }
    
}

/* ============================================================================
   FULLSCREEN MODE (Jonners only)
   ============================================================================ */

body.fullscreen-mode {
    overflow: hidden;
}

/* Hide game header when in fullscreen */
body.fullscreen-mode .game-header,
body.fullscreen-mode .game-top-bar,
body.fullscreen-mode .game-header-mobile-nav,
body.fullscreen-mode .game-header-mobile-overlay {
    display: none !important;
}

/* Fullscreen mode for game menu screens */
body.fullscreen-mode .game-menu-screen {
    padding-top: 0;
}

body.fullscreen-mode .game-menu-container {
    padding-top: clamp(16px, 3vw, 48px);
}


/* Hide any other navigation/header elements in fullscreen */
body.fullscreen-mode header,
body.fullscreen-mode nav,
body.fullscreen-mode .mobile-nav,
body.fullscreen-mode .mobile-overlay,
body.fullscreen-mode .burger-menu {
    display: none !important;
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

.gv-poster-enter {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    background: #0b1220;
    pointer-events: none;
    opacity: 1;
}

.gv-poster-enter img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.gv-poster-enter.is-leaving {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.game-menu-hidden {
    display: none !important;
}

.game-menu-text-center {
    text-align: center;
}

.game-menu-mb-sm { margin-bottom: var(--menu-spacing-sm); }
.game-menu-mb-md { margin-bottom: var(--menu-spacing-md); }
.game-menu-mb-lg { margin-bottom: var(--menu-spacing-lg); }
.game-menu-mt-sm { margin-top: var(--menu-spacing-sm); }
.game-menu-mt-md { margin-top: var(--menu-spacing-md); }
.game-menu-mt-lg { margin-top: var(--menu-spacing-lg); }



