/* Lobby Module */

/* Hero Card base styles moved to core.css */

/* Specific adjustments for Hero Card Content */
.hero-card img[alt*="Logo"],
.hero-logo {
    max-width: 270px; /* Larger logo */
    width: 85%;
    height: auto;
    margin: 0 auto 1.5rem auto;
}

.hero-card .leaderboard-link {
    margin-top: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    font-family: var(--font-head);
    font-size: 1.05rem; /* Text link size */
    color: #FFD700;
    text-decoration: none;
    letter-spacing: 1.5px;
    font-weight: 600;
    font-style: italic;

    min-height: 44px;
    padding: 0.5rem 0.75rem;
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1), opacity 160ms ease, color 160ms ease;
    opacity: 0.85;
}

.hero-card .leaderboard-link svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: #FFD700;
    stroke-width: 2px;
}

.hero-card .leaderboard-link:hover {
    background: none;
    border: none;
    box-shadow: none;
    transform: translateY(-2px);
    opacity: 1;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
}

/* Lobby View — standalone container (outside hero-card) */
.lobby-view {
    max-width: 1400px;
    width: 90vw;
    height: 80vh;
    max-height: 80vh;
    margin: 0 auto;
    padding-top: 0 !important;
    overflow: visible !important;
    display: flex;
    flex-direction: column;
}

#view-mode {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

/* ... */

.mode-select-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    gap: 0.5rem;
    height: auto;
    flex: 0 0 auto;
    min-height: 0;
    /* allow flex shrink/scroll */
    padding-top: 0;
}

/* Lobby Header Controls */
.lobby-header-row {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 600px;
    margin: 0 auto 1rem auto;
    padding: 0 1rem;
    gap: 0.8rem;
}

.search-container {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    min-height: 44px;
    /* Ensure search bar always has space */
}

.lobby-search-input {
    width: 100%;
    /* Glassmorphism for input */
    background: rgba(10, 15, 25, 0.4) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;

    border-radius: 50px;
    padding: 0 1rem 0 2.5rem;
    /* Adjusted since icon is larger */
    color: #fff;
    font-family: var(--font-tech);
    font-size: 1rem;
    outline: none;
    transition: background-color 160ms var(--product-ease-out), border-color 160ms var(--product-ease-out), box-shadow 160ms var(--product-ease-out);
    height: 44px !important;
    min-height: 44px !important;
    box-sizing: border-box !important;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5), 0 2px 5px rgba(0, 0, 0, 0.2);
}

.lobby-search-input:focus {
    background: rgba(20, 30, 45, 0.6) !important;
    border-color: var(--primary-accent) !important;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5), 0 0 15px rgba(35, 139, 78, 0.3);
}

.lobby-search-input::placeholder {
    color: rgba(255, 255, 255, 0.8);
}

.search-icon {
    position: absolute;
    left: 12px;
    width: 20px;
    height: 20px;
    fill: #fff !important;
    pointer-events: none;
    z-index: 2;
}

.lobby-control-btn:hover {
    background: rgba(255, 255, 255, 0.6) !important;
    border-color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    color: #000 !important;
}

.lobby-control-btn svg {
    width: 28px !important;
    height: 28px !important;
    fill: currentColor !important;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.lobby-feed {
    padding: 10px 1rem 1rem 1rem;
    width: 100%;
    margin: 0 auto;
    /* Desktop: Grid Layout */
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    align-content: start;

    /* Scroll Fixes */
    overflow-y: auto;
    flex: 1 1 auto;
    /* Allow to grow and shrink */
    min-height: 200px;
    /* Provide a minimum height for the list */
    scrollbar-width: thin;
    scrollbar-color: var(--primary-accent) rgba(255, 255, 255, 0.05);
    padding-bottom: 80px;
    /* Space for dock */
}

.lobby-feed::-webkit-scrollbar {
    width: 6px;
}

.lobby-feed::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.lobby-feed::-webkit-scrollbar-thumb {
    background: var(--primary-accent);
    border-radius: 6px;
}

.ticket-card {
    position: relative;
    /* Frosted Glass */
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-left: 4px solid var(--primary-accent);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    overflow: clip;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
    /* Fix for WebKit backdrop-filter shadow rendering bug */
    transform: translateZ(0);
    isolation: isolate;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
    flex-shrink: 0;
}

.ticket-card:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: rgba(255, 255, 255, 0.2);
}

.ticket-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.ticket-card.status-live {
    border-left-color: #ff3333;
}

.ticket-card.status-live:hover {
    border-left-color: #ff4d4d;
}

.ticket-card.status-wait {
    border-left-color: var(--primary-accent);
}

.ticket-card.status-wait:hover {
    border-left-color: var(--primary-accent);
}

.ticket-card.ticket-private {
    border-left-color: #ffd700;
    border-style: dashed;
}

.ticket-card.ticket-private:hover {
    border-left-color: #ffea00;
}

.ticket-title {
    font-family: var(--font-head);
    font-size: 1.25rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.5px;
}

.ticket-avatar {
    width: 28px;
    height: 28px;
    object-fit: cover;
}

.ticket-meta {
    font-family: var(--font-tech);
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    gap: 10px;
    align-items: center;
}

.ticket-code {
    color: rgba(255, 255, 255, 0.4);
}

.badge-tech {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    letter-spacing: 1px;
}

.ticket-stats {
    text-align: right;
    min-width: 70px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    padding-left: 15px;
    border-left: 1px solid rgba(255, 255, 255, 0.15);
}

.player-count-badge {
    font-family: var(--font-head);
    font-size: 1.5rem;
    color: var(--primary-accent);
    line-height: 1;
}

.player-count-max {
    font-size: 0.8rem;
    opacity: 0.5;
    color: #fff;
}

.player-count-label {
    font-family: var(--font-tech);
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 1px;
    margin-top: 4px;
}

/* --- Refactored Lobby Styles (Restored) --- */

.nav-login-btn {
    padding: 0.5rem 2rem;
    font-size: 0.9rem;
}

.hero-subtitle {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.85rem; /* Extremely small */
    font-family: var(--font-tech); /* Exo 2 is cleaner for tech subtitle */
    letter-spacing: 4px; /* Tech spacious letter spacing */
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 0;
    margin-bottom: 2rem;
    text-shadow: none;
}

.mode-select-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 1rem;
    height: auto;
    flex: 0 0 auto;
    /* Fit within parent */
    padding-top: 0;
    min-height: 0;
    /* CRITICAL for nested scrolling */
}

.btn-create-subtext {
    display: block;
    font-size: 0.8rem;
    opacity: 0.7;
    font-family: var(--font-body);
}

.divider-or {
    color: #555;
    margin: 0.2rem 0;
}

.lobby-list-container {
    width: 100%;
    margin-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1rem;
}

.lobby-list-title {
    font-size: 0.9rem;
    color: #aaa;
    margin-bottom: 0.5rem;
}

.lobby-scroll-area {
    max-height: 150px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.lobby-empty-text {
    font-size: 0.8rem;
    color: #666;
    text-align: center;
}

.btn-text-back {
    background: none;
    border: none;
    color: #777;
    cursor: pointer;
    margin-top: 1rem;
    transition: color 0.2s;
}

.btn-text-back:hover {
    color: #fff;
}

/* JS-Generated Lobby Item Classes */
.lobby-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background-color 160ms var(--product-ease-out), border-color 160ms var(--product-ease-out);
}

.lobby-item:hover {
    border-color: var(--primary-accent);
    background: rgba(255, 255, 255, 0.1);
}

.lobby-item-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lobby-avatar-small {
    width: 24px;
    height: 24px;
    background-size: cover;
    border-radius: 50%;
}

.lobby-name {
    font-family: var(--font-tech);
    font-size: 0.8rem;
    color: #fff;
}

.lobby-nav-coin {
    font-size: 1.1em;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

/* Navigation Shop Widget Updates */

.buy-coins-plus {
    margin-left: 0.5rem;
    background: var(--primary-accent);
    color: #fff;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.lobby-count {
    font-size: 0.7rem;
    color: var(--neon-green, var(--primary-accent));
}

/* Bottom Dock */
.lobby-dock {
    position: fixed;
    bottom: max(24px, env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    padding: 0.6rem;
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 0.2rem;
    z-index: 1000;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(0, 0, 0, 0.5);
    animation: dockSlideUp 0.5s ease-out backwards 0.2s;
}

.dock-divider {
    width: 1px;
    background: rgba(255, 255, 255, 0.15);
    margin: 0.5rem 0.2rem;
}

.dock-btn {
    background: transparent;
    border: 2px solid transparent;
    /* invisible border for exact sizing */
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    /* Space between icon and text */
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 160ms var(--product-ease-out), border-color 160ms var(--product-ease-out), color 160ms ease, transform 140ms var(--product-ease-out);
    position: relative;
    padding: 0.6rem 1.4rem;
    border-radius: 40px;
    /* Pill shape for individual buttons */
    white-space: nowrap;
}

.dock-btn svg {
    width: 20px;
    height: 20px;
    transition: color 160ms ease, stroke 160ms ease;
}

/* Hover States for specific buttons */

/* Create Room: Neon Green */
.dock-btn.btn-create:hover {
    border-color: var(--primary-accent);
    color: var(--primary-accent);
    transform: translateY(-2px);
}

.dock-btn.btn-create:hover svg {
    stroke: var(--primary-accent);
}

/* Join Room: White Glow */
.dock-btn.btn-join:hover {
    border-color: #ffffff;
    color: #ffffff;
    transform: translateY(-2px);
}

.dock-btn.btn-join:hover svg {
    stroke: #ffffff;
}

/* Join by Code: Electric Yellow/Gold */
.dock-btn.btn-code:hover {
    border-color: #ffd700;
    color: #ffd700;
    transform: translateY(-2px);
}

.dock-btn.btn-code:hover svg {
    stroke: #ffd700;
}

/* Search Row */
.lobby-header-row {
    margin-top: 0;
    margin-bottom: -10px;
    /* Offset the added top padding in lobby-feed */
}

@keyframes dockSlideUp {
    from {
        opacity: 0;
        transform: translate(-50%, 50px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes dockSlideUpMobile {
    from {
        opacity: 0;
        transform: translateY(50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* User Nav (Top Right) - Header styles moved to core.css */

/* Filter Dropdown Base */
.filter-dropdown {
    right: 0;
    min-width: 220px;
    z-index: 2200;
    top: calc(100% + 10px);
    padding: 1rem;
}

/* Compact, functional room filter. Private rooms are intentionally code-only. */
.lobby-filter-popover {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 2200;
    width: 360px;
    padding: 0;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-5px) scale(0.985);
    transform-origin: top right;
    border: 1px solid rgba(98, 227, 154, 0.22);
    border-radius: 10px;
    background: rgba(5, 12, 8, 0.98);
    box-shadow: 0 8px 8px rgba(0, 0, 0, 0.46);
    transition: opacity 150ms var(--product-ease-out), transform 150ms var(--product-ease-out), visibility 0s linear 150ms;
}

.lobby-filter-popover.show {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: none;
    transition-delay: 0s;
}

.lobby-filter-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 48px;
    padding: 0 14px;
    border-bottom: 1px solid rgba(235, 255, 243, 0.1);
    color: #f4f7f5;
    font-family: var(--font-tech);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.lobby-filter-reset {
    min-height: 30px;
    padding: 0 7px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #8da097;
    font-family: var(--font-tech);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    cursor: pointer;
}

.lobby-filter-reset:hover {
    color: #fff;
    background: rgba(235, 255, 243, 0.06);
}

.lobby-filter-options {
    display: grid;
    gap: 5px;
    margin-top: 6px;
}

.lobby-filter-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    gap: 6px;
    margin: 0 14px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(235, 255, 243, 0.08);
}

.lobby-filter-section .lobby-filter-options {
    margin-top: 0;
}

.lobby-filter-label {
    color: #8da097;
    font-family: var(--font-tech);
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-align: left;
}

.lobby-filter-options--modes {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
}

.lobby-filter-options--decades {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
}

.lobby-filter-option {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 14px;
    align-items: center;
    gap: 5px;
    min-height: 40px;
    padding: 0 7px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #b7c3bc;
    font-family: var(--font-tech);
    font-size: 0.64rem;
    font-weight: 750;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: color 140ms var(--product-ease-out), border-color 140ms var(--product-ease-out), background-color 140ms var(--product-ease-out);
}

.lobby-filter-option:has(input:checked) {
    background: rgba(43, 217, 120, 0.12);
    color: #f5f8f6;
}

.lobby-filter-option + .lobby-filter-option {
    border-left: 1px solid rgba(235, 255, 243, 0.1);
}

.lobby-filter-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.lobby-filter-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #2bd978;
    box-shadow: 0 0 0 3px rgba(43, 217, 120, 0.1);
}

.lobby-filter-status-dot.is-live {
    background: #eb5b5b;
    box-shadow: 0 0 0 3px rgba(235, 91, 91, 0.1);
}

.lobby-filter-check {
    opacity: 0;
    color: #62e39a;
    transform: scale(0.8);
    transition: opacity 120ms ease, transform 120ms var(--product-ease-out);
}

.lobby-filter-option:has(input:checked) .lobby-filter-check {
    opacity: 1;
    transform: none;
}

.lobby-filter-option:has(input:focus-visible) {
    outline: 3px solid rgba(98, 227, 154, 0.25);
    outline-offset: 2px;
}

.lobby-filter-apply {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: calc(100% - 28px);
    min-height: 44px;
    margin: 10px 14px 14px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-style: normal !important;
}

.lobby-filter-count {
    min-width: 20px;
    padding: 3px 5px;
    border-radius: 4px;
    background: rgba(3, 9, 5, 0.28);
    font-size: 0.62rem;
    line-height: 1;
}

@media (max-width: 768px) {
    .lobby-filter-popover {
        position: fixed;
        top: auto;
        right: 8px;
        bottom: calc(max(8px, env(safe-area-inset-bottom)) + 68px);
        left: 8px;
        width: auto;
        max-width: 420px;
        margin-inline: auto;
        transform: translateY(8px) scale(0.985);
        transform-origin: bottom center;
        z-index: 3200;
    }

    .lobby-filter-section {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 420px) {
    .lobby-filter-section {
        grid-template-columns: minmax(0, 1fr);
        gap: 6px;
    }
}

/* Mobile Lobby Overrides */
@media (max-width: 768px) {

    /* Mobile Filter Bottom Sheet */
    .filter-dropdown {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        min-height: 45vh !important;
        max-height: 80vh !important;
        max-width: 100% !important;
        border-radius: 24px 24px 0 0 !important;
        padding: 2rem 1.5rem 100px 1.5rem !important;
        /* Extra padding at bottom for the fixed button */
        background: rgba(15, 20, 30, 0.98) !important;
        box-shadow: 0 -10px 50px rgba(0, 0, 0, 0.8) !important;
        border: none !important;
        transform: translateY(100%) !important;
        z-index: 3000 !important;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        overflow-y: auto;
    }

    .filter-dropdown.show {
        transform: translateY(0) !important;
    }

    /* Sticky Bottom Button Container for Filter */
    .filter-actions {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 1rem 1.5rem calc(2rem + env(safe-area-inset-bottom)) 1.5rem;
        /* Safe area padding at bottom */
        background: linear-gradient(to top, rgba(15, 20, 30, 1) 50%, rgba(15, 20, 30, 0) 100%);
        z-index: 3010;
        pointer-events: none;
        /* Let clicks pass through gradient */
    }

    .filter-actions button {
        pointer-events: auto;
        /* Re-enable clicks on the button itself */
        box-shadow: 0 10px 30px rgba(35, 139, 78, 0.3) !important;
        margin-top: 0 !important;
    }

    .hero-card {
        margin: 0 auto;
        position: relative;
        left: auto;
        right: auto;
        top: auto;
        bottom: auto;
        width: calc(100% - 2.5rem);
        /* Increased left/right margins for breathing room */
        max-width: 500px;
        min-height: 45vh;
        justify-content: center;
        border-radius: 20px;
        padding: 2rem 1rem;
    }

    .content-split {
        flex-direction: column !important;
        gap: 1rem !important;
    }



    .lobby-view {
        position: fixed;
        top: 65px;
        bottom: 100px;
        left: 0;
        right: 0;
        width: 100%;
        height: auto;
        margin: 0;
        padding: 0 0.5rem !important;
        box-sizing: border-box;
        border-radius: 0 !important;
        justify-content: flex-start !important;
    }

    .lobby-feed {
        display: flex;
        /* Back to column for mobile */
        flex-direction: column;
        gap: 0.5rem;
        width: 100% !important;
        padding: 10px 0.5rem !important;
        margin: 0 !important;
    }

    .lobby-dock {
        bottom: max(1.5rem, env(safe-area-inset-bottom));
        /* Lifted higher */
        left: 50%;
        transform: translateX(-50%);
        width: 95%;
        max-width: 95%;
        padding: 0.6rem;
        /* Slightly thicker dock */
        backdrop-filter: var(--glass-blur) !important;
        -webkit-backdrop-filter: var(--glass-blur) !important;
        gap: 0;
        justify-content: space-between;
    }

    .dock-btn {
        padding: 0.8rem 0.5rem;
        /* Made buttons taller and wider */
        font-size: 0.95rem;
        /* Increased text size */
        gap: 6px;
        /* Increased gap between icon and text */
        border-radius: 20px;
        flex: 1;
    }

    .dock-divider {
        display: block;
        width: 1px;
        min-height: 20px;
        background-color: rgba(255, 255, 255, 0.4);
        /* Made it slightly brighter to ensure visibility */
        margin: auto 4px;
        flex-shrink: 0;
    }

    .dock-btn svg {
        width: 22px;
        /* Increased icon size */
        height: 22px;
    }

    .main-nav,
    nav {
        padding: 0.2rem 0.5rem !important;
        /* Reduced vertically */
        justify-content: center;
        background: rgba(10, 12, 18, 0.98);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-container {
        padding: 0.1rem 0.5rem;
        /* Tighter padding for smaller height */
        justify-content: space-between;
        gap: 0.5rem;
        width: 100%;
    }

    .user-name {
        display: none;
    }

    .ticket-card {
        padding: 1rem;
        width: 100%;
        margin-bottom: 0;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        background: linear-gradient(135deg, rgba(20, 25, 35, 0.95) 0%, rgba(10, 12, 18, 0.98) 100%);
    }
}

/* --- Skeleton Loading States --- */
@keyframes skeleton-pulse {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-card {
    height: 80px;
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.03) 25%,
            rgba(255, 255, 255, 0.08) 37%,
            rgba(255, 255, 255, 0.03) 63%);
    background-size: 400% 100%;
    animation: skeleton-pulse 1.8s ease-in-out infinite;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-left: 4px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    cursor: default;
    pointer-events: none;
    margin-bottom: 0.8rem;
}

.skeleton-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 60%;
}

.skeleton-title {
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    width: 80%;
}

.skeleton-meta {
    height: 14px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    width: 40%;
}

.skeleton-stats {
    width: 50px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

@keyframes slideUpChat {
    from {
        transform: translateY(150%);
    }

    to {
        transform: translateY(0);
    }
}

.has-unread {
    animation: blinkUnread 1.5s infinite;
}

@keyframes blinkUnread {
    0% {
        box-shadow: none !important;
    }

    50% {
        border-color: rgba(35, 139, 78, 1) !important;
    }

    100% {
        box-shadow: none !important;
    }
}

/* --- Empty State --- */
.lobby-empty-card {
    grid-column: 1 / -1;
    /* Stretch across all columns */
    width: 100%;
    max-width: 400px;
    /* Shorter and smaller */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.5rem;
    background: var(--glass-bg);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    margin: var(--space-md) auto 0 auto;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.radar-scanning-animation {
    position: relative;
    width: 60px;
    height: 60px;
    margin-bottom: var(--space-md);
}

.radar-ring {
    position: absolute;
    inset: 0;
    border: 2px solid var(--primary-accent);
    border-radius: 50%;
    opacity: 0.5;
    animation: radar-ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.radar-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    background: var(--primary-accent);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

@keyframes radar-ping {

    75%,
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.empty-state-content h3 {
    font-size: 1.2rem;
    margin-bottom: var(--space-xs);
    letter-spacing: 1px;
}

.empty-state-subtitle {
    color: rgba(255, 255, 255, 0.6);
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

/* --- Inline Style Refactors --- */
.index-profile-dropdown {
    margin-left: 0.5rem;
}

.index-play-flow-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    align-items: stretch;
    justify-content: center;
    width: 100%;
    max-width: 20rem;
    margin: 0 auto 1.25rem auto;
}

/* Removed btn-multiplayer override here */

/* Removed btn-singleplayer override here */

/* Premium Rules Button */
.btn-rules-premium {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.5rem 1.2rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.9);
    font-family: var(--font-tech);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    min-height: 44px;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    outline: none;
}

.btn-rules-premium:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.btn-rules-premium:active {
    transform: scale(0.97);
}

.btn-rules-premium svg {
    width: 16px;
    height: 16px;
}

@media (max-width: 480px) {
    .btn-rules-premium {
        padding: 0.5rem 0.8rem;
    }
    .btn-rules-premium span {
        font-size: 0.75rem;
    }
}

@media (max-width: 768px) {
    .hero-card img[alt*="Logo"],
    .hero-logo {
        max-width: 190px;
        margin: 0 auto 0.5rem auto;
    }

    .hero-subtitle {
        font-size: 0.7rem;
        margin-bottom: 0.75rem;
        letter-spacing: 3px;
    }

    .hero-card .leaderboard-link {
        margin-top: 0.5rem;
        font-size: 0.8rem;
    }
}

/* ===== HOME / ARENA LAUNCH ===== */
.home-container {
    width: 100%;
    max-width: none;
    padding: 0;
}

.home-scene {
    min-height: 100dvh;
    padding: max(82px, calc(68px + env(safe-area-inset-top))) 24px max(24px, env(safe-area-inset-bottom));
}

.home-launch-panel.hero-card {
    width: min(900px, calc(100vw - 48px));
    max-width: 900px;
    max-height: none;
    margin: auto;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: none;
    transform: none;
    transition: none;
}

.home-launch-panel.hero-card::before,
.home-launch-panel.hero-card::after {
    display: none;
}

.home-launch-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.home-launch-panel.hero-card .home-launch-logo {
    width: min(390px, 62vw);
    max-width: 390px;
    margin: 0 auto 1.1rem;
    filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.42));
}

.home-launch-panel .hero-subtitle {
    margin: 0;
    color: rgba(245, 248, 246, 0.76);
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    line-height: 1.25;
    text-wrap: balance;
}

.index-play-flow-wrapper.home-launch-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    width: min(680px, 100%);
    max-width: 680px;
    margin: 2rem auto 0;
}

.home-launch-actions .app-primary-action,
.home-launch-actions .app-secondary-action {
    width: 100%;
    min-width: 0;
    min-height: var(--product-control-large) !important;
    font-family: var(--font-head);
    font-size: 1.05rem !important;
    font-style: italic;
    font-weight: 700;
    letter-spacing: 0.055em;
    line-height: 1;
}

.home-launch-actions .app-primary-action svg,
.home-launch-actions .app-secondary-action svg {
    width: 21px;
    height: 21px;
    flex: 0 0 21px;
}

.home-launch-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    min-height: 44px;
    margin-top: 1rem;
}

.home-launch-meta .live-ticker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    margin: 0;
    padding: 0 0.4rem;
    color: rgba(245, 248, 246, 0.72);
    font-family: var(--font-tech);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.045em;
}

.home-launch-panel.hero-card .leaderboard-link.app-secondary-action {
    min-height: 40px;
    margin: 0;
    padding-inline: 12px !important;
    color: #e4ca52 !important;
    font-family: var(--font-tech);
    font-size: 0.72rem;
    font-style: normal;
    letter-spacing: 0.05em;
    opacity: 1;
    transition: background-color 160ms var(--product-ease-out), border-color 160ms var(--product-ease-out), color 160ms var(--product-ease-out), opacity 160ms ease, transform 120ms var(--product-ease-out);
}

.home-launch-panel.hero-card .leaderboard-link.app-secondary-action svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
}

@media (hover: hover) and (pointer: fine) {
    .home-launch-panel.hero-card .leaderboard-link.app-secondary-action:hover {
        transform: translate3d(0, 0, 0);
    }
}

.home-launch-panel.hero-card .leaderboard-link.app-secondary-action:active {
    transform: scale(0.98);
}

@media (max-width: 700px) {
    .container .home-scene {
        padding-inline: max(14px, env(safe-area-inset-left)) max(14px, env(safe-area-inset-right)) !important;
        perspective: none;
    }

    .home-launch-panel.hero-card {
        width: min(100%, 430px);
        padding: 0 !important;
        overflow: visible;
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
        transform: none !important;
        transform-style: flat;
    }

    .home-launch-panel.hero-card .home-launch-logo {
        width: min(280px, 72vw);
        max-width: 280px;
        margin-bottom: 0.8rem;
    }

    .home-launch-panel .hero-subtitle {
        max-width: 32ch;
        font-size: 0.76rem;
        letter-spacing: 0.11em;
    }

    .index-play-flow-wrapper.home-launch-actions {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.6rem !important;
        margin-top: 1.4rem;
    }

    .home-launch-meta {
        flex-wrap: wrap;
        gap: 0.35rem;
        margin-top: 0.75rem;
    }
}

/* ===== MATCH CENTRE / LOBBY ===== */
.lobby-view .app-page-header {
    min-height: 64px;
    padding-block: 5px 3px;
    overflow: visible;
}

.lobby-view .app-page-title {
    line-height: 1.08;
    padding: 0.1em 0.22em 0.08em 0.06em;
    overflow: visible;
}

.lobby-feed {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: minmax(112px, auto);
    align-items: start;
    gap: 12px;
    padding: 10px 12px 92px;
}

.ticket-card {
    --ticket-status-color: 43, 217, 120;
    appearance: none;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 84px;
    grid-template-rows: auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 96px;
    height: auto;
    padding: 12px 13px 12px 18px;
    overflow: hidden;
    border: 1px solid var(--product-line);
    border-radius: 10px;
    background: rgba(7, 13, 9, 0.92);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.3);
    color: #fff;
    font: inherit;
    text-align: left;
    transform: translate3d(0, 0, 0);
    transition: background-color 160ms var(--product-ease-out), border-color 160ms var(--product-ease-out), transform 140ms var(--product-ease-out), box-shadow 160ms var(--product-ease-out);
}

.ticket-card::before {
    content: '';
    position: absolute;
    top: 12px;
    bottom: 12px;
    left: 0;
    width: 5px;
    border-radius: 0 4px 4px 0;
    background: rgb(var(--ticket-status-color));
    opacity: 0.9;
}

.ticket-card.status-live {
    --ticket-status-color: 235, 91, 91;
    border-color: rgba(235, 91, 91, 0.34);
    border-left-width: 1px;
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.3);
}

.ticket-card.status-wait {
    border-left-width: 1px;
}

.ticket-card.ticket-private {
    --ticket-status-color: 228, 202, 82;
    border: 1px solid rgba(228, 202, 82, 0.34);
    border-style: solid;
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.3);
}

.ticket-card:focus-visible {
    outline: 3px solid rgba(98, 227, 154, 0.3);
    outline-offset: 3px;
}

.ticket-card:active {
    transform: translate3d(0, 1px, 0);
}

/* Keep a single room from stretching across the whole desktop canvas.  A room
   is a compact ticket, not a page-wide banner; two tickets can still sit next
   to each other when the lobby contains more than one room. */
@media (min-width: 769px) {
    .lobby-feed {
        width: min(100%, 980px);
        max-width: 980px;
        margin-inline: auto;
        grid-template-columns: repeat(auto-fit, minmax(320px, 420px));
        justify-content: center;
    }

    .ticket-card {
        width: 100%;
        max-width: 420px;
    }
}

/* Status is already communicated by the waiting/live label.  Do not add a
   second, heavy green/red rail to the ticket itself. */
.ticket-card::before {
    display: none !important;
}

.ticket-card,
.ticket-card.status-live,
.ticket-card.status-wait,
.ticket-card.ticket-private {
    border-left: 1px solid var(--product-line) !important;
}

.ticket-info {
    display: grid;
    align-content: start;
    gap: 6px;
    min-width: 0;
}

.ticket-title-row,
.ticket-host,
.ticket-rounds,
.ticket-decades {
    display: flex;
    align-items: center;
}

.ticket-title-row {
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
}

.ticket-host {
    flex: 1 1 auto;
    align-items: flex-start;
    gap: 9px;
    min-width: 0;
}

.ticket-title {
    display: -webkit-box;
    min-width: 0;
    overflow: hidden;
    overflow-wrap: anywhere;
    padding: 0.04em 0.18em 0.08em 0;
    color: #f5f8f6;
    font-family: var(--font-head);
    font-size: 0.98rem;
    font-style: italic;
    font-weight: 700;
    letter-spacing: 0.025em;
    line-height: 1.12;
    text-transform: uppercase;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
}

.ticket-avatar {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border: 1px solid rgba(98, 227, 154, 0.46);
}

.icon-lock {
    flex: 0 0 15px;
    width: 15px;
    height: 15px;
    color: #e4ca52;
}

.ticket-decades {
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px;
    max-width: 42%;
}

.ticket-decade {
    padding: 3px 5px;
    border: 1px solid rgba(235, 255, 243, 0.12);
    border-radius: 4px;
    background: rgba(235, 255, 243, 0.045);
    color: #91a098;
    font-family: var(--font-tech);
    font-size: 0.57rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1;
}

.ticket-meta {
    margin: 0;
    min-width: 0;
}

.ticket-rounds {
    flex-wrap: nowrap;
    gap: 4px;
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

.ticket-round {
    display: grid;
    grid-template-columns: 15px minmax(0, 1fr) auto;
    align-items: center;
    gap: 3px;
    flex: 1 1 0;
    min-width: 0;
    min-height: 25px;
    padding: 3px 4px;
    border: 1px solid color-mix(in srgb, currentColor 24%, transparent);
    border-radius: 5px;
    background: color-mix(in srgb, currentColor 7%, transparent);
    color: #78d9a0;
    font-family: var(--font-tech);
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.035em;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
}

.ticket-round-index {
    display: inline-grid;
    place-items: center;
    width: 15px;
    height: 15px;
    border-radius: 3px;
    background: color-mix(in srgb, currentColor 16%, transparent);
    color: currentColor;
    font-size: 0.54rem;
}

.ticket-round-mode {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ticket-round--career {
    color: #c799ef;
}

.ticket-round--formation {
    color: #79c9f2;
}

.ticket-round-points {
    color: #718078;
    font-size: 0.53rem;
    font-weight: 700;
}

.ticket-round-separator {
    display: none;
}

.ticket-mode-fallback {
    color: #78d9a0;
    font-family: var(--font-tech);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.06em;
}

.ticket-stats {
    display: grid;
    grid-template-columns: auto auto;
    grid-template-rows: auto auto;
    align-items: center;
    justify-content: end;
    width: 100%;
    min-width: 0;
    gap: 3px 5px;
    padding: 3px 0 3px 12px;
    border-top: 0;
    border-left: 1px solid rgba(235, 255, 243, 0.1);
    text-align: right;
}

.ticket-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    grid-column: 1 / -1;
    margin: 0 0 2px auto;
    color: #8aa096;
    font-family: var(--font-tech);
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ticket-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--product-green-hover);
}

.status-live .ticket-status {
    color: #ec8a8a;
}

.status-live .ticket-status-dot {
    background: #eb5b5b;
}

.player-count-badge {
    grid-column: 1;
    grid-row: 2;
    color: #f5f8f6;
    font-size: 1.12rem;
}

.player-count-label {
    grid-column: 2;
    grid-row: 2;
    color: #718078;
    font-size: 0.58rem;
    margin: 1px 0 0 2px;
}

.lobby-empty-card,
.error-card {
    grid-column: 1 / -1;
    width: min(100%, 620px);
    margin: clamp(44px, 9vh, 92px) auto 0;
    padding: 24px;
    border: 0;
    border-top: 1px solid var(--product-line);
    border-bottom: 1px solid var(--product-line);
    border-radius: 0;
    background: rgba(7, 13, 9, 0.72);
    box-shadow: none;
    text-align: center;
}

.empty-state-subtitle,
.text-error-desc {
    margin: 8px auto 0;
    color: #91a098;
    font-family: var(--font-tech);
    font-size: 0.78rem;
    line-height: 1.45;
}

.lobby-dock {
    bottom: max(18px, env(safe-area-inset-bottom));
    gap: 5px;
    padding: 6px;
    border-color: var(--product-line);
    border-radius: 14px;
    background: rgba(5, 10, 7, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 8px rgba(0, 0, 0, 0.34);
    animation: none;
}

.dock-divider {
    background: var(--product-line);
    margin-block: 7px;
}

@media (hover: hover) and (pointer: fine) {
    .ticket-card:hover {
        border-color: var(--product-line-strong);
        background: rgba(16, 28, 20, 0.96);
        box-shadow: 0 8px 8px rgba(0, 0, 0, 0.34);
        transform: translate3d(0, -2px, 0);
    }

    .ticket-card.status-live:hover {
        border-color: rgba(235, 91, 91, 0.48);
        box-shadow: 0 8px 8px rgba(0, 0, 0, 0.34);
    }
}

.skeleton-card {
    min-height: 96px;
    height: 96px;
    margin: 0;
    border: 1px solid rgba(235, 255, 243, 0.08);
    border-left-width: 1px;
    border-radius: 12px;
    background-size: 300% 100%;
    animation-duration: 2.2s;
}

@media (max-width: 1400px) {
    .lobby-feed {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1050px) {
    .lobby-feed {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .lobby-view,
    .mode-select-container,
    .lobby-header-row,
    .lobby-feed {
        min-width: 0;
        max-width: 100%;
    }

    .lobby-view {
        overflow-x: hidden !important;
    }

    .lobby-header-row {
        padding-inline: 0;
    }

    .lobby-empty-card,
    .error-card,
    .empty-state-content {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .empty-state-subtitle,
    .text-error-desc {
        max-width: 32ch;
        overflow-wrap: anywhere;
    }

    .lobby-feed {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-auto-rows: minmax(80px, auto);
        gap: 8px;
        padding: 8px 8px 96px !important;
    }

    .ticket-card {
        grid-template-columns: minmax(0, 1fr) max-content;
        grid-template-rows: auto auto;
        gap: 4px 8px;
        min-height: 80px;
        padding: 7px 8px;
        background: rgba(7, 13, 9, 0.94);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    /* Put the round details across the full ticket so readable labels do not
       compete with the room title and participant count for one narrow row. */
    .ticket-info { display: contents; }
    .ticket-title-row { grid-column: 1; grid-row: 1; }
    .ticket-title { -webkit-line-clamp: 2; }
    .ticket-host { align-items: center; gap: 6px; }
    .ticket-meta { grid-column: 1 / -1; grid-row: 2; }
    .ticket-rounds { flex-wrap: wrap; }

    .ticket-stats {
        grid-column: 2;
        grid-row: 1;
        padding-left: 8px;
    }

    .ticket-status {
        font-size: 0.6875rem;
        letter-spacing: 0.02em;
    }

    .lobby-view .app-page-header {
        min-height: 52px;
        padding-block: 3px 2px;
    }

    .lobby-view .app-page-title {
        padding-block: 0.08em 0.07em;
    }

    .ticket-decades {
        display: none;
    }

    .ticket-round {
        flex: 1 1 76px;
        font-size: 0.6875rem;
        letter-spacing: 0;
    }

    .ticket-round-index,
    .ticket-round-points,
    .player-count-label {
        font-size: 0.6875rem;
    }

    .ticket-round-points,
    .player-count-label {
        color: #aebdb4;
    }

    .skeleton-card {
        min-height: 80px;
        height: 80px;
    }

    .lobby-dock {
        width: calc(100% - 16px);
        max-width: 520px;
        padding: 5px;
        border-radius: 14px;
    }

    .dock-btn {
        border-radius: var(--product-radius-control);
    }
}

@media (prefers-reduced-motion: reduce) {
    .ticket-card,
    .lobby-filter-popover,
    .lobby-filter-option,
    .lobby-filter-check,
    .skeleton-card,
    .radar-ring,
    .has-unread {
        animation: none !important;
        transition: none !important;
    }
}
