@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

body.lobby-page {
    min-height: 100vh;
    min-width: 100vw;
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(ellipse 140% 90% at 50% 0%, rgba(16, 185, 129, 0.12) 0%, transparent 55%),
        radial-gradient(ellipse 100% 60% at 80% 90%, rgba(245, 158, 11, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse 60% 80% at 10% 50%, rgba(16, 185, 129, 0.05) 0%, transparent 45%),
        url('../assets/CP%20backgrund.png');
    background-size: 100% 100%, 100% 100%, 100% 100%, cover;
    background-repeat: no-repeat, no-repeat, no-repeat, no-repeat;
    background-position: center center;
    background-attachment: fixed;
    font-family: var(--font-body), sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

body.lobby-page::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(circle at center, rgba(5, 7, 9, 0) 45%, rgba(5, 7, 9, 0.55) 100%);
}

/* Video background – open screen only (two-video stack hides loop jump) */
.lobby-video-container {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

.lobby-video-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.lobby-video-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(1.1) contrast(1.1);
}

/* Logo entrance on open screen */
@keyframes lobby-logo-appear {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.lobby-logo-wrap.lobby-logo-appear {
    animation: lobby-logo-appear 0.6s ease-out 0.25s both;
}

.lobby-shell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    padding: 16px;
    background: transparent;
    font-family: var(--font-body);
    cursor: pointer;
    position: relative;
    overflow-x: hidden;
    z-index: 1;
}

.lobby-viewport {
    width: 100%;
    max-width: 100vw;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    overflow-x: hidden;
    padding-top: 0;
    padding-bottom: 0;
}

.lobby-viewport.is-payment {
    padding-bottom: 2rem;
    -webkit-overflow-scrolling: touch;
}

/* Mobile: payment screen must scroll so Pay button is reachable */
@media (max-width: 600px) {
    .lobby-shell:has(.lobby-viewport.is-payment) {
        max-height: 100vh;
        max-height: 100dvh;
        overflow: hidden;
    }

    .lobby-viewport.is-payment {
        justify-content: flex-start;
        align-items: stretch;
        overflow-y: auto;
        overflow-x: hidden;
        min-height: 0;
        max-height: 100vh;
        max-height: 100dvh;
    }

    .payment-shell {
        flex: 0 0 auto;
        padding-bottom: 2rem;
    }

    .payment-card {
        padding: 1rem;
    }
}

.rules-button {
    position: fixed !important;
    top: calc(16px + var(--safe-top)) !important;
    right: calc(16px + var(--safe-right)) !important;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--surface-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-premium);
    transition: all 0.2s ease;
    z-index: 1000;
}

.rules-button:hover {
    background: rgba(26, 29, 33, 1);
    border-color: var(--accent-emerald);
    transform: scale(1.05);
}

@media (max-width: 600px) {
    .rules-button {
        width: 44px;
        height: 44px;
        font-size: 1.3rem;
    }
}

.lobby-logo-wrap {
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
    margin-top: clamp(1rem, 4vh, 3.5rem);
    max-height: min(50vh, calc(100vh - 280px));
    flex-shrink: 0;
}

.lobby-logo {
    width: clamp(180px, 50vmin, 480px);
    height: clamp(180px, 50vmin, 480px);
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

@media (max-width: 600px) {
    .lobby-logo-wrap {
        margin-top: clamp(0.75rem, 2vh, 1.5rem);
        margin-bottom: 1rem;
        max-height: min(38vh, calc(100vh - 260px));
    }

    .lobby-logo {
        width: clamp(170px, 46vmin, 480px);
        height: clamp(170px, 46vmin, 480px);
    }
}

.lobby-form {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lobby-hidden-input {
    position: absolute;
    left: -9999px;
    top: -9999px;
    opacity: 0;
    pointer-events: none;
}

.lobby-input {
    width: 100%;
    max-width: 320px;
    box-sizing: border-box;
    padding: 1rem;
    font-size: 1.2rem;
    border-radius: 12px;
    border: 1px solid var(--border-glass);
    background: var(--surface-glass);
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-family: var(--font-body);
    box-shadow: var(--shadow-premium);
    text-align: center;
    outline: none;
    transition: box-shadow 0.2s ease, border 0.2s ease;
}

.lobby-input:focus {
    border-color: var(--accent-emerald);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.lobby-error {
    color: var(--accent-error);
    font-size: 1rem;
    margin-bottom: 1rem;
    min-height: 1.2em;
}

.lobby-play-button {
    width: 100%;
    max-width: 340px;
    box-sizing: border-box;
    padding: 1.2rem 0;
    font-size: 1.4rem;
    font-family: var(--font-body);
    font-weight: 700;
    color: #EAECEF;
    background: linear-gradient(180deg, #10B981 0%, #059669 100%);
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4), 0 0 20px rgba(16, 185, 129, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    cursor: pointer;
    margin-bottom: 2rem;
    transition: all 0.2s ease;
}

.lobby-play-button:hover {
    background: linear-gradient(180deg, #059669 0%, #047857 100%);
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.45), 0 0 24px rgba(16, 185, 129, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.lobby-play-button.is-disabled,
.lobby-play-button:disabled {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-glass);
    box-shadow: none;
    cursor: not-allowed;
    filter: grayscale(0.7);
}

.lobby-instructions {
    margin-top: 1.5rem;
    color: var(--text-primary);
    font-size: 1.1rem;
    text-align: center;
    list-style: none;
    padding: 0;
}

.lobby-instruction {
    margin-bottom: 0.5rem;
}

.payment-shell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem;
    max-width: 94vw;
    width: 100%;
    min-width: 0;
    margin: 0 auto;
}

.payment-card {
    background: var(--surface-glass);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow-premium), 0 0 0 1px rgba(16, 185, 129, 0.1), 0 0 40px rgba(245, 158, 11, 0.06);
    width: 100%;
    max-width: min(920px, 94vw);
    min-width: 0;
    overflow: visible;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.payment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    min-width: 0;
    margin-bottom: 1rem;
}

.payment-back-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 600;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.payment-back-button:hover {
    background: rgba(0, 0, 0, 0.35);
}

.payment-disconnect-button {
    padding: 0.5rem 1rem;
    font-size: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-glass);
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 600;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    transition: all 0.2s ease;
}

.payment-disconnect-button:hover {
    border-color: var(--accent-emerald);
}

.payment-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    text-align: center;
}

.payment-status-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin: 0 0 0.4rem 0;
    text-align: center;
}

.lobby-connected-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.lobby-connected-value {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1;
    color: var(--accent-emerald);
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 16px rgba(16, 185, 129, 0.35);
}

.wallet-status {
    text-align: center;
    width: 100%;
    min-width: 0;
}

.wallet-connected {
    margin-bottom: 1rem;
}

.wallet-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.wallet-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.wallet-address {
    font-size: 1.1rem;
    color: var(--accent-emerald);
    font-weight: 600;
    margin: 0;
}

.wallet-address-text {
    font-family: monospace;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    user-select: none;
}

.wallet-address-text:hover {
    background-color: rgba(16, 185, 129, 0.15);
}

.wallet-sync-button {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent-emerald) 0%, var(--accent-hover) 100%);
    color: #fff;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.wallet-sync-button.is-loading,
.wallet-sync-button:disabled {
    cursor: not-allowed;
    opacity: 0.7;
    background: rgba(255, 255, 255, 0.1);
}

.wallet-sync-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.wallet-sync-icon.is-spin {
    animation: spin 1s linear infinite;
}

.wallet-profile-chip-lite {
    margin: 0 auto 0.8rem auto;
    max-width: 560px;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.8rem;
    border-radius: 12px;
    border: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.04);
}

.wallet-profile-avatar-lite,
.wallet-profile-avatar-fallback-lite {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.wallet-profile-avatar-fallback-lite {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 700;
}

.wallet-profile-meta-lite {
    min-width: 0;
    flex: 1;
}

.wallet-profile-row-lite {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.wallet-profile-name-lite {
    color: var(--text-primary);
    font-size: 0.98rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wallet-profile-edit-btn-lite {
    border: 1px solid var(--border-glass);
    background: rgba(0, 0, 0, 0.32);
    color: var(--text-secondary);
    border-radius: 8px;
    padding: 0.35rem 0.65rem;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
}

.wallet-profile-edit-btn-lite:hover {
    border-color: var(--accent-emerald);
    color: var(--text-primary);
}

.wallet-profile-status-lite {
    margin: 0.35rem 0 0 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.wallet-profile-editor-lite {
    margin: 0 auto 1rem auto;
    max-width: 560px;
    width: 100%;
    padding: 0.75rem;
    border-radius: 12px;
    border: 1px solid var(--border-glass);
    background: rgba(0, 0, 0, 0.24);
    display: grid;
    gap: 0.45rem;
}

.wallet-profile-editor-label-lite {
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-align: left;
}

.wallet-profile-editor-input-lite {
    border: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 0.5rem 0.65rem;
    font-size: 0.9rem;
}

.wallet-profile-editor-input-lite:focus {
    outline: none;
    border-color: var(--accent-emerald);
}

.wallet-profile-editor-actions-lite {
    margin-top: 0.35rem;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.wallet-profile-save-btn-lite,
.wallet-profile-cancel-btn-lite {
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 0.42rem 0.78rem;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
}

.wallet-profile-save-btn-lite {
    background: linear-gradient(135deg, var(--accent-emerald) 0%, var(--accent-hover) 100%);
    color: #fff;
    border: none;
}

.wallet-profile-save-btn-lite:disabled,
.wallet-profile-cancel-btn-lite:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.wallet-profile-cancel-btn-lite {
    background: rgba(0, 0, 0, 0.32);
    color: var(--text-secondary);
}

.wallet-meta {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.wallet-meta-item {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
}

.wallet-meta-note {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
}

.wallet-meta-value {
    color: var(--text-primary);
    font-weight: 600;
}

.wallet-popup-warning {
    margin-top: 0.5rem;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.wallet-disconnected {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin: 0;
}

.room-selection {
    width: 100%;
    min-width: 0;
}

.room-selection-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin: 0 0 1.5rem 0;
}

.room-selection-title.is-narrow {
    margin: 0 0 0.5rem 0;
}

.room-selection-hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
    margin: 0 0 1rem 0;
}

.room-loading {
    text-align: center;
    padding: 2rem;
}

.room-loading-text {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.room-selection-wrapper {
    position: relative;
    width: 100%;
    min-width: 0;
    overflow: visible;
}

.room-list {
    display: flex;
    gap: 0.8rem;
    justify-content: flex-start;
    flex-wrap: nowrap;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 10px 12px;
    scroll-behavior: smooth;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-glass) transparent;
    -webkit-overflow-scrolling: touch;
}

.room-list::-webkit-scrollbar {
    height: 6px;
}

.room-list::-webkit-scrollbar-track {
    background: transparent;
}

.room-list::-webkit-scrollbar-thumb {
    background: var(--border-glass);
    border-radius: 3px;
}

.room-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Room card: fixed height so timer stays inside; clamp keeps it responsive */
.room-card {
    --room-card-size: clamp(120px, 14vw, 160px);
    --room-card-height: clamp(165px, 22vw, 200px);
    padding: clamp(0.6rem, 1.2vw, 1rem) clamp(0.6rem, 1vw, 0.8rem);
    font-size: clamp(0.8rem, 1.2vw, 0.95rem);
    border-radius: clamp(8px, 1.5vw, 12px);
    font-family: var(--font-body);
    font-weight: 600;
    background: var(--surface-glass);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    color: var(--text-primary);
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    min-height: var(--room-card-height);
    height: var(--room-card-height);
    width: var(--room-card-size);
    min-width: var(--room-card-size);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    flex: 0 0 auto;
    border: 1px solid var(--border-glass);
    cursor: pointer;
    overflow: hidden;
}

.room-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.room-card.selected {
    border: 2px solid var(--accent-emerald);
    background: linear-gradient(135deg, var(--accent-emerald) 0%, var(--accent-hover) 100%);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.room-card.blocked {
    background: rgba(0, 0, 0, 0.3);
    opacity: 0.6;
    cursor: not-allowed;
}

.room-card.blocked:hover {
    transform: none;
}

.room-card-title {
    font-family: var(--font-heading);
    font-size: clamp(0.95rem, 1.4vw, 1.15rem);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: clamp(0.3rem, 0.8vw, 0.5rem);
}

.room-card.selected .room-card-title {
    color: #fff;
}

.room-card-info {
    font-size: clamp(0.8rem, 1.1vw, 0.95rem);
    color: var(--text-secondary);
    margin-bottom: clamp(0.2rem, 0.5vw, 0.35rem);
}

.room-card.selected .room-card-info {
    color: rgba(255, 255, 255, 0.95);
}

.room-card-balance {
    font-size: clamp(0.8rem, 1.1vw, 0.95rem);
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: clamp(0.5rem, 1vw, 0.8rem);
}

.room-card.selected .room-card-balance {
    color: rgba(255, 255, 255, 0.98);
}

.room-card-entry-fee {
    font-size: clamp(0.8rem, 1.1vw, 0.95rem);
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: clamp(0.3rem, 0.8vw, 0.5rem);
}

.room-card.selected .room-card-entry-fee {
    color: rgba(255, 255, 255, 0.98);
}

.room-card-timer {
    font-size: clamp(0.8rem, 1.1vw, 0.95rem);
    font-weight: bold;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    padding: clamp(0.4rem, 0.8vw, 0.55rem) clamp(0.5rem, 1vw, 0.8rem);
    border-radius: clamp(6px, 1vw, 8px);
    border: 1px solid var(--border-glass);
    width: 100%;
    text-align: center;
    flex-shrink: 0;
}

.room-card.selected .room-card-timer {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.room-card.blocked .room-card-timer {
    background: var(--accent-error);
    border: 2px solid var(--accent-error);
    color: #fff;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.room-scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 1px solid rgba(16, 185, 129, 0.38);
    background: linear-gradient(160deg, rgba(10, 18, 30, 0.96) 0%, rgba(17, 30, 48, 0.96) 100%);
    color: #e8fff7;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.18s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.room-scroll-btn:hover {
    transform: translateY(calc(-50% - 1px));
    border-color: rgba(16, 185, 129, 0.72);
    background: linear-gradient(160deg, rgba(14, 25, 40, 0.97) 0%, rgba(24, 43, 66, 0.97) 100%);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(16, 185, 129, 0.22);
}

.room-scroll-btn:active {
    transform: translateY(-50%);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.room-scroll-btn:focus-visible {
    outline: 2px solid rgba(16, 185, 129, 0.8);
    outline-offset: 2px;
}

.room-scroll-btn.left {
    left: 0;
}

.room-scroll-btn.right {
    right: 0;
}

.wallet-connect {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.wallet-connect-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-family: var(--font-heading);
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent-emerald) 0%, var(--accent-hover) 100%);
    color: #fff;
    transition: all 0.2s ease;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
    width: 100%;
    max-width: 280px;
}

.wallet-connect-button.is-connecting,
.wallet-connect-button:disabled {
    cursor: not-allowed;
    filter: grayscale(0.7);
    opacity: 0.8;
}

.wallet-connect-icon {
    width: 24px;
    height: 24px;
}

.wallet-connect-icon.is-inverted {
    filter: brightness(0) invert(1);
}

.wallet-error {
    color: var(--accent-error);
    font-size: 0.9rem;
    text-align: center;
}

.entry-fee-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    background: var(--surface-glass);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-premium), 0 0 0 1px rgba(16, 185, 129, 0.08);
    max-width: 800px;
    width: 100%;
}

.entry-fee-amount {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.entry-fee-icon {
    width: 24px;
    height: 24px;
    image-rendering: pixelated;
}

.entry-fee-button {
    padding: 1rem 3rem;
    font-size: 1.2rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-family: var(--font-heading);
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent-emerald) 0%, var(--accent-hover) 100%);
    color: #fff;
    min-width: 200px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
    transition: all 0.2s ease;
}

.entry-fee-button.is-validating {
    background: linear-gradient(90deg, #FFA500 0%, #FFD700 100%);
    box-shadow: 0 2px 8px rgba(255, 165, 0, 0.3);
}

.entry-fee-button.is-invalid {
    background: linear-gradient(90deg, #FF6B6B 0%, #FF8E8E 100%);
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

.entry-fee-button.is-valid {
    background: linear-gradient(135deg, var(--accent-emerald) 0%, var(--accent-hover) 100%);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.entry-fee-button.is-loading,
.entry-fee-button:disabled {
    cursor: not-allowed;
    opacity: 0.8;
}

.entry-fee-note {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    margin-bottom: 0;
    text-align: center;
}

.entry-fee-retry {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 0.5rem;
    font-style: italic;
}

.lobby-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    box-sizing: border-box;
}

.asset-modal {
    background: var(--surface-glass);
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    font-family: var(--font-body);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-glass);
}

.asset-modal-title {
    margin: 0;
    padding: 1.25rem 1.5rem 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
}

.asset-modal-subtitle {
    margin: 0 1.5rem 1rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-align: center;
}

.asset-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 0 1.5rem 1rem;
    max-height: 320px;
    overflow-y: auto;
}

.asset-option {
    padding: 0;
    border: 2px solid var(--border-glass);
    border-radius: 12px;
    cursor: pointer;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
    transition: border-color 0.2s ease, transform 0.15s ease;
}

.asset-option:hover {
    border-color: var(--accent-emerald);
    transform: scale(1.02);
}

.asset-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    aspect-ratio: 1;
}

.asset-modal-footer {
    padding: 0 1.5rem 1.5rem;
    display: flex;
    justify-content: center;
}

.asset-skip-button {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-glass);
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 600;
    background: var(--surface-glass);
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.asset-skip-button:hover {
    color: var(--text-primary);
    border-color: var(--accent-emerald);
}

@media (max-width: 480px) {
    .asset-modal {
        padding: 0;
    }

    .asset-modal-title {
        padding: 1rem 1rem 0.5rem;
    }

    .asset-modal-subtitle {
        margin: 0 1rem 0.75rem;
        font-size: 0.9rem;
    }

    .asset-grid {
        padding: 0 1rem 1rem;
        gap: 8px;
        max-height: 280px;
    }
}

.funds-modal {
    background: var(--surface-glass);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    font-family: var(--font-body);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.funds-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.funds-content {
    padding: 2rem;
    color: var(--text-primary);
}

.funds-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 2rem 0;
    text-align: center;
}

.funds-box {
    border: 2px solid #ff6b6b;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background: var(--surface-glass);
}

.funds-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.funds-row.is-last {
    margin-bottom: 1.5rem;
}

.funds-label {
    color: var(--text-secondary);
    font-size: 1rem;
}

.funds-value {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

.funds-alert {
    background: #ff6b6b;
    border-radius: 8px;
    padding: 1rem;
    color: white;
    text-align: center;
}

.funds-alert-text {
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
}

.funds-tip {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 2rem;
    border: 1px solid #e9ecef;
    text-align: center;
}

.funds-tip-text {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.funds-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.funds-action {
    padding: 1rem 2rem;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 600;
    transition: all 0.2s ease;
    flex: 1;
    max-width: 150px;
}

.funds-action-primary {
    border: none;
    background: linear-gradient(135deg, var(--accent-emerald) 0%, var(--accent-hover) 100%);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(109, 250, 50, 0.3);
}

.funds-action-secondary {
    border: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

@media (max-width: 480px) {
    .funds-content {
        padding: 1.5rem 1rem;
    }

    .funds-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .funds-action {
        max-width: none;
        min-height: 44px;
    }
}

.rules-modal {
    background: var(--surface-glass);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    max-width: 600px;
    max-height: 80vh;
    box-shadow: var(--shadow-premium);
    font-family: var(--font-body);
    display: flex;
    flex-direction: column;
}

.rules-header {
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.rules-title {
    font-size: 2rem;
    font-weight: 900;
    color: var(--text-primary);
    margin: 0;
}

.rules-modal .close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 5px;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rules-modal .close-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.rules-content {
    padding: 2rem;
    overflow-y: auto;
    clip-path: inset(0 round 0 0 16px 16px);
    scrollbar-width: thin;
    scrollbar-color: var(--border-glass) transparent;
    color: var(--text-primary);
    line-height: 1.6;
}

.rules-content::-webkit-scrollbar {
    width: 8px;
}

.rules-content::-webkit-scrollbar-track {
    background: transparent;
}

.rules-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
}

.rules-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.rules-section {
    margin-bottom: 1.5rem;
}

.rules-section.is-last {
    margin-bottom: 1rem;
}

.rules-section-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    color: var(--text-primary);
}

.rules-text {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.rules-text:last-child {
    margin-bottom: 0;
}

.rules-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1rem;
}

.rules-table th {
    text-align: left;
    padding: 0.5rem;
    font-weight: 600;
    border-bottom: 2px solid var(--border-glass);
}

.rules-table td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-glass);
}

.rules-table tr:last-child td {
    border-bottom: none;
}

.rules-formula {
    font-size: 1rem;
    font-family: monospace;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.rules-goodluck {
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    color: var(--accent-emerald);
    margin-top: 1rem;
}

@media (max-width: 600px) {
    .rules-header {
        padding: 0.75rem 1rem;
    }

    .rules-content {
        padding: 1rem;
        overflow-x: auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .rules-table {
        min-width: 320px;
    }
}

@media (max-width: 600px) {
    .payment-status-row {
        gap: 0.45rem;
        margin-bottom: 0.25rem;
        flex-wrap: wrap;
    }

    .lobby-connected-label {
        font-size: 0.7rem;
    }

    .lobby-connected-value {
        font-size: 1rem;
    }

    .room-selection-wrapper {
        min-width: 0;
        overflow: visible;
        padding: 0 8px;
    }

    .room-list {
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        padding: 10px 12px;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .room-list::-webkit-scrollbar {
        display: none;
    }

    .room-card {
        --room-card-size: clamp(180px, 70vw, 260px);
        --room-card-height: clamp(165px, 38vw, 220px);
        width: var(--room-card-size);
        min-width: 180px;
        min-height: var(--room-card-height);
        height: var(--room-card-height);
        margin-right: 15px;
        scroll-snap-align: center;
        flex: 0 0 auto;
        margin-bottom: 0;
    }

    .room-list::after {
        content: "";
        flex: 0 0 20px;
        display: block;
    }

    .room-scroll-btn {
        display: none !important;
    }
}
