:root {
    --bg-gradient-start: #020617;
    --bg-gradient-end: #0f172a;
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #818cf8;
    --accent-hover: #a5b4fc;
    --sparks-neon: #9333ea;
    --sparks-glow: rgba(147, 51, 234, 0.5);
}

html {
    scroll-behavior: smooth;
    height: 100%;
}

body {
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    /* Changed from 100% to 100vh for reliable sticky footer */
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
    scroll-behavior: smooth;
}

* {
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

*:hover {
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

h1,
h2,
h3,
.logo,
.title {
    font-family: 'Poppins', sans-serif;
    letter-spacing: -0.02em;
}

/* Body rules merged above to avoid duplication */

.container {
    padding: 3rem 2rem 4rem;
    width: 100%;
    margin: 0 auto;
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 10;
    max-width: 1000px;
    transition: max-width 0.25s cubic-bezier(0.22, 1, 0.36, 1),
        min-height 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

/* --- Page transition animations --- */
@keyframes page-exit {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateY(-6px) scale(0.99);
    }
}

@keyframes page-enter {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.99);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.page-exit {
    animation: page-exit 0.12s ease-in forwards;
    pointer-events: none;
}

.page-enter {
    animation: page-enter 0.22s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.shadow-glass {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.counter-card {
    padding: 3rem 2.5rem;
    text-align: center;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.counter-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #ffffff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.title {
    font-family: 'Poppins', sans-serif;
    letter-spacing: -0.02em;
}

/* Auth Specific UI */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-field {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    padding: 1rem;
    border-radius: 12px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.input-field:focus {
    border-color: var(--accent-hover);
}

.input-field:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.auth-buttons {
    display: flex;
    gap: 1rem;
}

.auth-btn {
    flex: 1;
    padding: 1rem;
    font-size: 1rem;
}

.error-text {
    color: #ef4444;
    font-size: 0.9rem;
    min-height: 1.2rem;
}

/* Top Bar Details */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--accent-hover);
    cursor: pointer;
    font-weight: 600;
    transition: color 0.2s;
    font-size: 0.9rem;
}

.btn-icon:hover {
    color: white;
}

/* Game Core Specific */
.counter-display {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100px;
    width: 100%;
    padding: 0.5rem 0;
}

.count-value {
    font-size: clamp(3rem, 15vw, 9rem);
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(135deg, #818cf8, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    user-select: none;
    white-space: nowrap;
}

.count-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
    opacity: 0.7;
    margin-top: -0.25rem;
}

.count-value.pop {
    transform: scale(1.1) translateY(-4px);
}

.game-stats-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(129, 140, 248, 0.12);
    border-radius: 14px;
    align-self: center;
    width: fit-content;
}

.game-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}

.game-stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--accent-color);
    line-height: 1;
    transition: color 0.1s ease, text-shadow 0.1s ease, transform 0.1s ease;
}

.game-stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    opacity: 0.7;
}

.game-stat-divider {
    width: 1px;
    height: 2rem;
    background: rgba(129, 140, 248, 0.2);
}

#click-btn {
    width: 220px !important;
    height: 220px !important;
    min-width: 220px !important;
    min-height: 220px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    margin: 0.5rem auto;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.2s, box-shadow 0.2s;
    user-select: none;
    touch-action: none;
    flex-shrink: 0;
    align-self: center !important;
    aspect-ratio: 1 / 1 !important;
}

#click-btn:active {
    transform: scale(0.92);
}

.ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: ripple-animation 600ms linear;
    background-color: rgba(255, 255, 255, 0.7);
    pointer-events: none;
    width: 100px;
    height: 100px;
    margin-top: -50px;
    margin-left: -50px;
    display: block;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

.game-stats-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(129, 140, 248, 0.15);
    border-radius: 20px;
    padding: 2rem 2rem 1.25rem;
    box-sizing: border-box;
    align-self: center;
    transition: width 0.3s ease;
    overflow: visible;
}

#game-section {
    box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    gap: 1rem;
    padding: 2.5rem 2.5rem 2rem;
    overflow: visible;
}

/* Prevent the 200% ::before glow from extending the document height */
#game-section::before {
    display: none;
}

/* Leaderboard Specific Elements */
.leaderboard-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 0.25rem;
    margin-bottom: 1rem;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--card-bg);
    color: var(--text-primary);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    padding: 0 0 0 0.75rem;
    text-align: left;
}


.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 0 1rem;
    height: 3.75rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-sizing: border-box;
}

.leaderboard-rank {
    width: 30px;
    flex-shrink: 0;
    font-weight: 800;
    color: var(--accent-hover);
}

.leaderboard-name {
    margin: 0 0.5rem 0 1rem;
    font-weight: 600;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-score {
    font-weight: 800;
    background: linear-gradient(135deg, #818cf8, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-left: auto;
    padding-left: 1rem;
    flex-shrink: 0;
    white-space: nowrap;
}

.leaderboard-dm-btn {
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    border-radius: 8px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.leaderboard-item:hover .leaderboard-dm-btn {
    opacity: 1;
    border-color: var(--card-border);
    color: var(--accent-hover);
}

.leaderboard-dm-btn:hover {
    background: rgba(99, 102, 241, 0.15) !important;
}

/* Global Buttons */
.btn-primary,
.btn-secondary {
    border: none;
    border-radius: 16px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
    padding: 1.25rem 2.5rem;
    font-size: 1.25rem;
    box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.39);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}

.btn-primary:disabled {
    opacity: 0.4;
    filter: grayscale(1);
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
    transform: translateY(2px) scale(0.98);
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.2);
}

/* Flat variants (no glow/shadow) */
.btn-flat {
    box-shadow: none !important;
    transform: none !important;
}

.btn-flat:hover {
    box-shadow: none !important;
    transform: none !important;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.btn-secondary:active {
    transform: translateY(2px) scale(0.98);
}

/* Links and Text Buttons */
.auth-links {
    margin-top: 0.5rem;
    display: flex;
    justify-content: center;
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.2s;
    text-decoration: underline;
    text-decoration-color: transparent;
}

.btn-text:hover {
    color: var(--accent-hover);
    text-decoration-color: var(--accent-hover);
}

/* App Footer */
.app-footer {
    width: 100%;
    margin-top: auto;
    /* Push footer to bottom */
    flex-shrink: 0;
    padding: 2.5rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--card-border);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    max-width: 1200px;
    width: 100%;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.footer-divider {
    width: 1px;
    height: 14px;
    background: rgba(255, 255, 255, 0.1);
}

.copyright {
    font-size: 0.85rem;
    color: var(--text-secondary);
    opacity: 0.8;
    margin: 0;
    width: 100%;
    text-align: center;
}

.app-footer .btn-text {
    font-size: 0.85rem;
    text-decoration: none;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
    opacity: 0.8;
}

.app-footer .btn-text:hover {
    color: var(--accent-hover);
    opacity: 1;
}

@media (max-width: 768px) {
    .footer-content {
        gap: 0.6rem;
        text-align: center;
    }
}

/* App Header Banner */
/* ─── Modern Header ───────────────────────────────────────────────── */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0 1.25rem;
    background: rgba(10, 15, 30, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    animation: slideDown 0.4s ease-out;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
    padding: 0.5rem 0;
}

.logo {
    margin: 0;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-primary);
    flex-shrink: 0;
}

.logo svg {
    color: var(--sparks-neon);
    filter: drop-shadow(0 0 6px var(--sparks-neon));
}

.logo span {
    font-family: 'Poppins', sans-serif !important;
    font-weight: 700 !important;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
    white-space: nowrap;
    position: relative;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.nav-link.active {
    color: var(--accent-hover);
    background: rgba(129, 140, 248, 0.1);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 25%;
    right: 25%;
    height: 2px;
    background: var(--accent-color);
    border-radius: 2px;
}

.header-separator {
    width: 1px;
    height: 1.25rem;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 0.35rem;
    flex-shrink: 0;
}

.header-user-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.sparks-pill {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(147, 51, 234, 0.1);
    border: 1px solid rgba(147, 51, 234, 0.25);
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--sparks-neon);
    cursor: pointer;
    transition: all 0.2s ease;
}

.sparks-pill:hover {
    background: rgba(147, 51, 234, 0.18);
    border-color: rgba(147, 51, 234, 0.4);
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.user-pill:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chevron-icon {
    margin-left: 1px;
    opacity: 0.5;
}

.header-cta {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 0.4rem 1.1rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.header-cta:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Keep legacy nav-group and nav-pill for backward compat */
.nav-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-pill {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.nav-pill:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* User Dropdown */
.user-dropdown {
    position: relative;
    display: inline-block;
}

#user-display-badge {
    cursor: pointer;
    user-select: none;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 200px;
    background: #1e1b4b;
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 0.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    gap: 0.25rem;
    z-index: 1000;
    animation: slideUpScale 0.2s ease-out;
}

.dropdown-menu.visible {
    display: flex;
}

@keyframes slideUpScale {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.dropdown-item {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    background: transparent;
    border: none;
    width: 100%;
}

.dropdown-item:hover {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-hover);
}

.dropdown-item.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.dropdown-divider {
    height: 1px;
    background: var(--card-border);
    margin: 0.4rem 0.5rem;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.logo {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #818cf8, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

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

.info-badges {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #e2e8f0;
    font-weight: 600;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, background 0.2s;
    user-select: none;
}

.badge:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.1);
}

/* New Feature Cards */
.feature-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: transform 0.2s, background 0.2s;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    aspect-ratio: 1 / 1;
    width: 100%;
}

.feature-card:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.08);
}

.feature-subtext {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-top: 0.25rem;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.modal-overlay.fade-out {
    animation: modal-fade-out 0.25s ease-in forwards;
    pointer-events: none;
}

@keyframes modal-fade-out {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    max-width: 400px;
    padding: 2.5rem 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

/* --- Toggle Switch --- */
.toggle-switch {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.toggle-switch input {
    display: none;
}

.toggle-track {
    width: 44px;
    height: 24px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    position: relative;
    transition: background 0.25s, border-color 0.25s;
}

.toggle-thumb {
    width: 18px;
    height: 18px;
    background: var(--text-secondary);
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.25s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.toggle-switch input:checked+.toggle-track {
    background: var(--accent-color);
    border-color: var(--accent-color);
}

.toggle-switch input:checked+.toggle-track .toggle-thumb {
    transform: translateX(20px);
    background: #fff;
}

/* --- DM Privacy Segmented Buttons --- */

.dm-privacy-group {
    display: flex;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--card-border);
}

.dm-privacy-btn {
    flex: 1;
    padding: 0.45rem 0;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    border: none;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.dm-privacy-btn:not(:last-child) {
    border-right: 1px solid var(--card-border);
}

.dm-privacy-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.dm-privacy-btn.active {
    background: var(--accent-color);
    color: #fff;
    font-weight: 600;
}

/* --- Chat Bubbles --- */

.chat-msg {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    animation: fadeIn 0.2s ease;
    align-self: flex-start;
    /* left-align by default */
    max-width: 80%;
    /* constrain overall bubble group width */
    text-align: left;
}

.chat-msg .chat-meta {
    font-size: 0.7rem;
    color: var(--text-secondary);
    padding: 0 0.5rem;
}

.chat-msg .chat-bubble {
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 12px 12px 12px 4px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    word-break: break-word;
    line-height: 1.4;
    font-family: 'Inter', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
}

.chat-msg.self {
    align-self: flex-end;
    /* right-align own messages */
}

.chat-msg.self .chat-meta {
    text-align: right;
}

.chat-msg.self .chat-bubble {
    background: rgba(139, 92, 246, 0.3);
    border-color: rgba(139, 92, 246, 0.4);
    border-radius: 12px 12px 4px 12px;
}

/* DM section responsive layout */
#dm-section .dm-inner {
    display: flex;
    gap: 1.25rem;
    height: clamp(300px, 60vh, 600px);
}

#dm-section #dm-user-list {
    width: clamp(300px, 42%, 420px);
    flex-shrink: 0;
}

@media (max-width: 600px) {
    #dm-section .dm-inner {
        flex-direction: column;
        height: auto;
    }

    #dm-section #dm-user-list {
        width: 100%;
        max-height: 160px;
    }
}

/* Feature Cards Responsive Container */
.info-badges {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    width: 100%;
    max-width: 1000px;
    margin: 1rem auto 0;
}

@media (max-width: 800px) {
    .info-badges {
        grid-template-columns: 1fr;
    }
}

/* Landing page stats row — always side-by-side on desktop, stack on mobile */
.landing-stats-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 1.5rem;
    width: 100%;
    max-width: 1000px;
    margin-top: 1.5rem;
    align-items: stretch;
}

.landing-stats-row>.counter-card {
    flex: 1;
    min-width: 0;
}

@media (max-width: 600px) {
    .landing-stats-row {
        flex-direction: column;
    }
}

/* --- Admin Panel Improvements --- */
#admin-section {
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
}

#admin-chat-monitor {
    height: 650px !important;
    font-family: 'Inter', sans-serif;
}

.admin-user-row {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    margin-bottom: 0.5rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.admin-user-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

#duel-game-section {
    display: none;
    flex-direction: column;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.5rem 0;
}

#admin-users-list {
    height: 480px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 12px;
    border: 1px solid var(--card-border);
}

/* Global Custom Scrollbar */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 4px;
}

*:hover::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

.admin-user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1rem;
    cursor: pointer;
    flex-wrap: wrap;
    /* Allows wrapping to avoid clipping */
    gap: 0.5rem;
    font-family: 'Inter', sans-serif;
}

.admin-user-info>div.user-details {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
    /* Prevents text overflow cutting off the right flex item */
}

.admin-actions-container {
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    background: rgba(0, 0, 0, 0.25);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-actions-container.expanded {
    max-height: 1000px;
    /* Increased to avoid clipping large content */
    opacity: 1;
}

.admin-actions-inner {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.admin-actions-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.admin-group-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
    padding-left: 0.2rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.admin-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.6rem;
}

.admin-action-btn {
    padding: 0.6rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.admin-action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.admin-action-btn.danger {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.admin-action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

.admin-action-btn.warning {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.admin-action-btn.warning:hover {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.4);
    color: #f59e0b;
}

.admin-action-btn.accent {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.2);
    color: var(--accent-hover);
}

.admin-action-btn.accent:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.4);
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 9999;
}

.toast {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    border-left: 4px solid var(--accent-color);
}

.toast.error {
    border-left-color: #ef4444;
}

.toast.success {
    border-left-color: #10b981;
}

#admin-search-clear:hover {
    color: var(--text-primary) !important;
}

#admin-sort-select {
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 0.75rem 2.8rem 0.75rem 1rem !important;
    font-size: 0.9rem;
    color: var(--text-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    background-size: 1.1rem;
    transition: all 0.2s ease;
    outline: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

#admin-sort-select:hover {
    background-color: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
}

#admin-sort-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

#admin-sort-select option {
    background: #1e1b4b;
    color: var(--text-primary);
    padding: 10px;
}


.monitor-msg {
    animation: fadeInSlideUp 0.3s ease forwards;
    border-left: 2px solid transparent;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0px;
}

.monitor-msg:hover {
    background: rgba(255, 255, 255, 0.05);
    border-left-color: var(--accent-color);
}

@keyframes fadeInSlideUp {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Inline Monitor Buttons */
.monitor-actions {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.monitor-msg:hover .monitor-actions {
    opacity: 1;
}

.monitor-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.monitor-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.monitor-btn.delete:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.monitor-btn.mute:hover {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.3);
}

.monitor-btn.timeout:hover {
    background: rgba(99, 102, 241, 0.2);
    color: var(--accent-hover);
    border-color: rgba(99, 102, 241, 0.3);
}

.monitor-btn.ban:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

/* --- Sparks Currency & Store --- */
.sparks-nav-btn {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(190, 18, 255, 0.3) !important;
    background: rgba(190, 18, 255, 0.05) !important;
}

.sparks-nav-btn:hover {
    background: rgba(190, 18, 255, 0.15) !important;
    transform: translateY(-2px);
    box-shadow: 0 0 20px var(--sparks-glow);
    border-color: var(--sparks-neon) !important;
}

.sparks-icon {
    filter: drop-shadow(0 0 8px var(--sparks-neon));
    animation: sparks-neon-flicker 3s infinite;
}

@keyframes sparks-neon-flicker {

    0%,
    100% {
        filter: drop-shadow(0 0 6px var(--sparks-neon)) brightness(1);
    }

    50% {
        filter: drop-shadow(0 0 10px var(--sparks-neon)) brightness(1.1);
    }
}

.sparks-logo-large {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 120px;
    height: 120px;
    margin-bottom: 0.5rem;
    position: relative;
    /* Invisible container, pure focus on the bolt */
}

.sparks-logo-large svg {
    position: relative;
    z-index: 5;
    width: 80px;
    height: 80px;
    color: var(--sparks-neon);
    filter:
        drop-shadow(0 0 10px var(--sparks-neon)) drop-shadow(0 0 30px var(--sparks-neon)) drop-shadow(0 0 60px rgba(147, 51, 234, 0.4));
    animation: celestial-float 5s infinite ease-in-out;
}

/* The 'Plasma Bloom' behind all sparks icons */
.sparks-logo-large::before,
.tier-icon::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(147, 51, 234, 0.25) 0%, transparent 70%);
    filter: blur(20px);
    animation: plasma-pulse 4s infinite ease-in-out alternate;
    z-index: 1;
}

@keyframes celestial-float {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-12px) rotate(1.5deg);
    }
}

@keyframes plasma-pulse {
    from {
        transform: scale(0.85);
        opacity: 0.3;
    }

    to {
        transform: scale(1.2);
        opacity: 0.6;
    }
}

/* Store Card Icon Stylings - Borderless & Ethereal */
.tier-icon {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 0.5rem;
}

.tier-icon svg {
    position: relative;
    z-index: 5;
    color: var(--sparks-neon);
    filter:
        drop-shadow(0 0 8px var(--sparks-neon)) drop-shadow(0 0 20px var(--sparks-neon));
}

.spark-particle,
.spark-burst-ring {
    pointer-events: none;
    z-index: 200;
}

/* Prismatic secondary glow that breathes behind the bolt */
.sparks-logo-large::before {
    content: '';
    position: absolute;
    width: 100px;
    height: 100px;
    background: var(--sparks-neon);
    filter: blur(40px);
    opacity: 0.25;
    border-radius: 50%;
    animation: core-breath 5s infinite alternate ease-in-out;
    z-index: 2;
}

@keyframes core-breath {
    from {
        transform: scale(0.8);
        opacity: 0.15;
    }

    to {
        transform: scale(1.2);
        opacity: 0.3;
    }
}



.spark-tier-card {
    padding: 2.25rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 36px;
    position: relative;
    min-height: 380px;
    width: 100%;
    min-width: 0;
    /* Prevents content from pushing width */
    box-sizing: border-box;
}

.secret-tier {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.08), rgba(99, 102, 241, 0.08)) !important;
    border-color: rgba(147, 51, 234, 0.3) !important;
    margin: 1rem auto 0 auto;
    padding: 2rem 1.5rem;
    overflow: visible;
    width: 100%;
    max-width: 650px;
    /* Further narrowed for a tighter, more substantial feel */
    justify-self: center;
    position: relative;
    z-index: 1;
    min-height: 380px !important;
    /* Force same height as unhidden cards */
}

.whale-icons {
    display: flex;
    align-items: center;
    /* Centered alignment for a balanced radiance */
    justify-content: center;
    gap: 0;
    /* Removing gap to use negative margins for overlap */
    margin-bottom: 1rem;
    min-height: 160px;
    width: 100%;
    position: relative;
    pointer-events: none;
}

.whale-icons svg {
    margin: 0 -0.5rem;
    /* Negative margin to force the bolts to overlap */
    position: relative;
}

.bolt-ultra-far {
    opacity: 0.12;
    filter: blur(2.5px);
}

.bolt-far {
    opacity: 0.25;
    filter: blur(2px);
}

.extra-bolt {
    opacity: 0.45;
    filter: blur(1.5px);
    animation: bolt-float 4s infinite ease-in-out;
}

.main-bolt {
    filter: drop-shadow(0 0 20px var(--sparks-neon));
    animation: bolt-main 3s infinite ease-in-out;
}

@keyframes bolt-float {

    0%,
    100% {
        transform: translateY(0) scale(0.9);
    }

    50% {
        transform: translateY(-6px) scale(1);
    }
}

@keyframes bolt-main {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-8px) scale(1.1);
    }
}

.tier-close-btn {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.75rem;
    cursor: pointer;
    opacity: 0.4;
    transition: 0.3s;
}

.tier-close-btn:hover {
    opacity: 1;
    color: var(--sparks-neon);
}

/* --- Responsive Layouts --- */
.sparks-tiers {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.5rem;
    margin: 1rem auto 0 auto;
    /* Balanced top margin, zero bottom to let padding handle spacing */
    width: 100%;
    max-width: 1400px;
    scroll-margin-top: 100px;
    /* Helps scroll adjustments */
}

@media (max-width: 1400px) {
    .sparks-tiers {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.5rem;
        max-width: 800px;
    }

    .secret-tier {
        grid-column: 1 / -1 !important;
        width: 100% !important;
        max-width: 100% !important;
        justify-self: stretch !important;
        transform: none !important;
        margin-top: 1rem;
    }
}

@media (max-width: 750px) {
    .sparks-tiers {
        grid-template-columns: 1fr;
        max-width: 400px;
    }
}

@keyframes static-flicker {

    0%,
    100% {
        opacity: 1;
        filter: brightness(1);
    }

    50% {
        opacity: 0.98;
        filter: brightness(1.1);
    }
}

.spark-tier-card:hover {
    transform: translateY(-10px);
    background: rgba(147, 51, 234, 0.08);
    border-color: rgba(147, 51, 234, 0.4);
    box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.6);
}

.spark-tier-card.featured {
    border-color: rgba(147, 51, 234, 0.4);
    background: rgba(147, 51, 234, 0.08);
}

.spark-tier-card.featured::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 36px;
    /* Matched exactly to .spark-tier-card to fix corner gaps */
    padding: 2px;
    background: linear-gradient(135deg, #9333ea, #6366f1);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    z-index: -1;
}

.tier-badge {
    position: absolute;
    top: -10px;
    background: linear-gradient(135deg, #9333ea, #6366f1);
    color: white;
    padding: 0.2rem 0.85rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.4);
}

.tier-amount {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
}

.tier-bonus {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--sparks-neon);
    background: rgba(147, 51, 234, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 100px;
    text-transform: uppercase;
    white-space: nowrap;
    text-align: center;
}

.tier-price {
    font-size: 1.6rem;
    font-weight: 800;
    color: #fff;
    margin: 0.25rem 0;
}

.buy-sparks-btn {
    width: 90%;
    padding: 0.75rem !important;
    font-size: 0.85rem !important;
    background: var(--sparks-neon) !important;
    border-radius: 12px !important;
    font-weight: 700 !important;
}

.buy-sparks-btn:hover {
    filter: brightness(1.1);
    box-shadow: 0 8px 20px -5px var(--sparks-glow) !important;
    transform: translateY(-1px);
}

@keyframes sparks-pop {
    0% {
        transform: scale(1);
    }

    35% {
        transform: scale(1.28);
        box-shadow: 0 0 22px var(--sparks-glow), 0 0 8px var(--sparks-glow);
    }

    65% {
        transform: scale(0.94);
    }

    100% {
        transform: scale(1);
        box-shadow: none;
    }
}

@keyframes sparks-count-flash {
    0% {
        color: inherit;
        text-shadow: none;
    }

    25% {
        color: #fff;
        text-shadow: 0 0 12px var(--sparks-neon);
    }

    100% {
        color: inherit;
        text-shadow: none;
    }
}

.sparks-purchased {
    animation: sparks-pop 0.52s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.sparks-count-flash {
    animation: sparks-count-flash 0.65s ease forwards;
}

@keyframes spark-earn-float {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    10% {
        opacity: 1;
        transform: translateY(-10px) scale(1.4);
    }

    60% {
        opacity: 1;
        transform: translateY(-60px) scale(1.1);
    }

    100% {
        opacity: 0;
        transform: translateY(-110px) scale(0.85);
    }
}

.spark-earn-float {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    font-size: 1.45rem;
    font-weight: 900;
    color: #e9d5ff;
    text-shadow: 0 0 8px #9333ea, 0 0 20px #9333ea, 0 0 40px rgba(147, 51, 234, 0.7);
    animation: spark-earn-float 2.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    user-select: none;
    white-space: nowrap;
    letter-spacing: 0.03em;
}

@keyframes click-btn-spark-glow {
    0% {
        box-shadow: var(--btn-shadow, none);
    }

    12% {
        box-shadow: 0 0 0 7px rgba(147, 51, 234, 0.45), 0 0 55px 20px rgba(147, 51, 234, 0.55);
    }

    100% {
        box-shadow: var(--btn-shadow, none);
    }
}

.click-btn-spark-pulse {
    animation: click-btn-spark-glow 2.2s ease-out forwards;
}

@keyframes spark-burst-ring {
    0% {
        transform: translate(-50%, -50%) scale(0.1);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
}

.spark-burst-ring {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    animation: spark-burst-ring forwards;
}

.spark-burst-ring.ring1 {
    width: 72px;
    height: 72px;
    border: 2.5px solid #c084fc;
    box-shadow: 0 0 14px #9333ea, inset 0 0 8px rgba(147, 51, 234, 0.35);
    animation-duration: 1.1s;
    animation-timing-function: cubic-bezier(0.2, 0, 0.7, 1);
}

.spark-burst-ring.ring2 {
    width: 115px;
    height: 115px;
    border: 1.5px solid rgba(192, 132, 252, 0.55);
    box-shadow: 0 0 10px rgba(147, 51, 234, 0.4);
    animation-duration: 1.4s;
    animation-timing-function: cubic-bezier(0.15, 0, 0.7, 1);
}

@keyframes spark-particle-fly {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(var(--tx, 0px), var(--ty, -40px)) scale(0.2);
    }
}

.spark-particle {
    position: fixed;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #c084fc;
    box-shadow: 0 0 8px #9333ea, 0 0 16px rgba(147, 51, 234, 0.6);
    pointer-events: none;
    z-index: 9998;
    animation: spark-particle-fly 1.6s cubic-bezier(0.2, 0, 0.8, 1) forwards;
}

/* --- Shop Section --- */
#shop-section {
    gap: 1.5rem;
    padding: 2.5rem;
}

/* --- Shop Tabs --- */
.shop-tabs {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.shop-tab {
    padding: 0.6rem 1.75rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}

.shop-tab:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.shop-tab.active {
    background: rgba(129, 140, 248, 0.15);
    border-color: rgba(129, 140, 248, 0.4);
    color: #818cf8;
}

.shop-empty-state {
    text-align: center;
    padding: 2rem;
}

.shop-panel {
    animation: page-enter 0.22s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.shop-panel-exit {
    animation: page-exit 0.12s ease-in forwards;
    pointer-events: none;
}

.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

.shop-item-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.shop-item-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(129, 140, 248, 0.3);
}

.shop-item-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 0 10px rgba(129, 140, 248, 0.3));
}

.adrenaline-shop-icon {
    position: relative;
    margin-left: -8px;
    filter: drop-shadow(0 0 12px rgba(220, 38, 38, 0.5));
}

.adrenaline-shop-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-40%, -50%);
    width: 77px;
    height: 77px;
    background: radial-gradient(circle, rgba(220, 38, 38, 0.25) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(10px);
    pointer-events: none;
}

.shop-item-name {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

.shop-item-description {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.shop-item-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--sparks-neon);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin: 0.5rem 0 0.75rem;
}

.btn-buy {
    width: 100%;
    padding: 0.875rem;
    font-size: 1rem;
    border-radius: 12px;
}

.btn-buy.active-item {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
    cursor: default;
    box-shadow: none;
    transform: none !important;
}

/* --- Status Effects Bar --- */
#status-effects-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    width: 90%;
    height: 3.25rem;
    padding: 0.35rem 1rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(129, 140, 248, 0.15);
    box-sizing: border-box;
    overflow: visible;
    align-self: center;
    position: relative;
}

#status-effects-empty-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0;
    user-select: none;
    letter-spacing: 0.01em;
    position: absolute;
    transition: opacity 0.5s ease;
}

#status-effects-empty-text.visible {
    opacity: 0.45;
    transition: opacity 0.5s ease 0.5s;
}

#adrenaline-timer-text,
#double-down-timer-text {
    min-width: 2.5ch;
    width: 2.5ch;
    text-align: left;
    display: inline-block;
}

#adrenaline-pill,
#double-down-pill {
    transition: opacity 0.5s ease, width 0.5s ease, max-width 0.5s ease, min-width 0.5s ease, padding 0.5s ease, margin 0.5s ease;
    overflow: hidden;
    white-space: nowrap;
    width: 5.5rem;
    min-width: 5.5rem;
    justify-content: center;
}

#adrenaline-pill.pill-hidden,
#double-down-pill.pill-hidden {
    max-width: 0;
    min-width: 0;
    width: 0;
    padding: 0;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}

/* --- Adrenaline Shot Active Effects --- */

.adrenaline-badge {
    background: rgba(220, 38, 38, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(220, 38, 38, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #dc2626;
    font-weight: 800;
    font-size: 0.95rem;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.2);
    animation: adrenaline-pulse 2s infinite ease-in-out;
}

@keyframes adrenaline-pulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(220, 38, 38, 0.2);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 4px 25px rgba(220, 38, 38, 0.4);
    }
}

.adrenaline-active-btn {
    box-shadow:
        0 0 10px rgba(220, 38, 38, 0.4),
        0 0 30px rgba(220, 38, 38, 0.35),
        0 0 60px rgba(220, 38, 38, 0.25),
        0 0 100px rgba(220, 38, 38, 0.15),
        0 0 140px rgba(220, 38, 38, 0.08) !important;
    border: none !important;
    animation: adrenaline-btn-glow 1.5s infinite ease-in-out;
}

@keyframes adrenaline-btn-glow {

    0%,
    100% {
        box-shadow:
            0 0 10px rgba(220, 38, 38, 0.4),
            0 0 30px rgba(220, 38, 38, 0.35),
            0 0 60px rgba(220, 38, 38, 0.25),
            0 0 100px rgba(220, 38, 38, 0.15),
            0 0 140px rgba(220, 38, 38, 0.08);
    }

    50% {
        box-shadow:
            0 0 15px rgba(220, 38, 38, 0.5),
            0 0 40px rgba(220, 38, 38, 0.4),
            0 0 80px rgba(220, 38, 38, 0.3),
            0 0 120px rgba(220, 38, 38, 0.2),
            0 0 160px rgba(220, 38, 38, 0.1);
    }
}

.adrenaline-active-text {
    background: linear-gradient(135deg, #b91c1c, #dc2626) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    text-shadow: none !important;
}

/* --- Double-Down Active Effects --- */
.double-down-badge {
    background: rgba(22, 163, 74, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(22, 163, 74, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #16a34a;
    font-weight: 800;
    font-size: 0.95rem;
    box-shadow: 0 4px 15px rgba(22, 163, 74, 0.2);
    animation: double-down-pulse 2s infinite ease-in-out;
}

@keyframes double-down-pulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(22, 163, 74, 0.2);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 4px 25px rgba(22, 163, 74, 0.4);
    }
}

.double-down-shop-icon {
    position: relative;
    margin-left: -8px;
    filter: drop-shadow(0 0 12px rgba(22, 163, 74, 0.5));
}

.double-down-shop-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-40%, -50%);
    width: 77px;
    height: 77px;
    background: radial-gradient(circle, rgba(22, 163, 74, 0.25) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(10px);
    pointer-events: none;
}

/* ── Vault Shop Icon ──────────────────────────────────────────── */
.vault-shop-icon {
    position: relative;
    margin-left: -8px;
    margin-bottom: -0.25rem;
    filter: drop-shadow(0 0 12px rgba(234, 179, 8, 0.5));
}

.vault-shop-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-40%, -50%);
    width: 77px;
    height: 77px;
    background: radial-gradient(circle, rgba(234, 179, 8, 0.25) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(10px);
    pointer-events: none;
}

.vault-status {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-top: 0.5rem;
    margin-bottom: 0;
    text-align: center;
}

.vault-status.vault-full {
    color: #eab308;
}

.vault-divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    margin: 0.6rem 0;
}

.vault-upgrades-row {
    display: flex;
    gap: 0.75rem;
    width: 100%;
}

.vault-upgrade-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.vault-upgrade-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    text-align: center;
}

.vault-upgrade-detail {
    font-size: 0.72rem;
    color: var(--text-secondary);
    opacity: 0.7;
    text-align: center;
    margin: 0;
}

.vault-dots {
    display: flex;
    gap: 0.35rem;
    justify-content: center;
}

.vault-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
}

.vault-dot.active {
    background: var(--accent-color);
    box-shadow: 0 0 8px rgba(129, 140, 248, 0.6);
}

.vault-upgrade-btn {
    width: 100%;
    min-height: 3.4rem;
    padding: 0.6rem 0.5rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    line-height: 1.3;
}

.vault-upgrade-btn .vault-btn-cost {
    font-size: 0.78rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    opacity: 0.9;
}

.vault-upgrade-btn:disabled {
    opacity: 0.4;
    filter: grayscale(1);
    cursor: not-allowed;
    pointer-events: none;
}

.vault-claim-btn {
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* ── Friends Section ──────────────────────────────────────────── */
.friends-add-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.friends-section-label {
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 0.5rem;
}

.friends-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.friend-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    transition: background 0.15s;
}

.friend-card:hover {
    background: rgba(255, 255, 255, 0.04);
}

.friend-card-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.friend-card-actions {
    display: flex;
    gap: 0.5rem;
}

.friend-card-actions button {
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.15s, opacity 0.15s;
}

.friend-btn-accept {
    background: var(--accent-color);
    color: #fff;
}

.friend-btn-accept:hover {
    background: var(--accent-hover);
}

.friend-btn-message {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-hover);
}

.friend-btn-message:hover {
    background: rgba(99, 102, 241, 0.25);
}

.friend-btn-decline,
.friend-btn-remove {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.friend-btn-decline:hover,
.friend-btn-remove:hover {
    background: rgba(239, 68, 68, 0.25);
}

/* ── Profile & Avatar System ────────────────────────── */
.username-clickable {
    cursor: pointer;
    transition: color 0.15s;
}

.username-clickable:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.avatar-inline {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.avatar-inline-letter {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.65rem;
    flex-shrink: 0;
    color: var(--text-primary);
}

/* ── Presence Indicators ───────────────────────────────────── */
.avatar-presence-wrapper {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
}

.presence-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #0d1117;
    background: #747f8d;
    transition: background-color 0.3s ease;
}

.presence-dot.online {
    background: #3ba55d;
}

.presence-dot.idle {
    background: #faa61a;
}

.presence-dot.offline {
    background: #747f8d;
}

.profile-popup-btn {
    width: 100%;
    padding: 0.65rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    transition: background 0.15s;
}

.profile-popup-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.profile-popup-btn.danger {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.profile-popup-btn.danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.profile-popup-divider {
    height: 1px;
    width: 100%;
    background: rgba(255, 255, 255, 0.15);
    margin: 0.3rem 0;
}

.profile-popup-btn.accent {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.profile-popup-btn.accent:hover {
    background: var(--accent-hover);
}

.profile-stat-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1rem 0.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.profile-stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.profile-stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

@media (max-width: 600px) {
    .profile-stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ── Duel Mode ─────────────────────────────────────────────────── */

/* Queue spinner */
.duel-queue-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Outer container — wraps the whole duel game in one card */
.duel-outer-container {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2rem 2rem 1.5rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Duel Countdown Overlay */
#duel-countdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 20, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

#duel-countdown-number {
    font-size: 8rem;
    font-weight: 900;
    background: linear-gradient(135deg, #73c4f6, #a35fe7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
    filter: drop-shadow(0 0 30px rgba(115, 196, 246, 0.5));
    animation: countdown-pulse 0.6s ease-out;
    line-height: 1;
}

#duel-countdown-number.go {
    font-size: 6rem;
    background: linear-gradient(135deg, #4ade80, #22d3ee);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 40px rgba(74, 222, 128, 0.6));
}

@keyframes countdown-pulse {
    0% {
        transform: scale(1.6);
        opacity: 0.3;
    }

    50% {
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Timer wrapper — bar + text below */
#duel-timer-wrapper {
    margin-bottom: 1.25rem;
}

#duel-timer-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

#duel-timer-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, rgb(115, 196, 246), rgb(163, 95, 231));
    border-radius: 3px;
    transition: width 0.5s linear;
}

#duel-timer-bar.warning {
    background: linear-gradient(90deg, #f59e0b, #eab308);
}

#duel-timer-bar.danger {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

#duel-timer-text {
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Arena layout */
#duel-arena {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
    justify-content: center;
}

/* Player cards */
.duel-player-card {
    flex: none;
    width: 300px;
    background: rgba(15, 23, 42, 0.45);
    border: 3.5px solid rgba(115, 196, 246, 0.95);
    border-radius: 20px;
    padding: 1.25rem 1rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    box-shadow: 0 0 40px rgba(115, 196, 246, 0.4), 0 0 12px rgba(115, 196, 246, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.duel-player-card.opponent {
    border-color: rgba(163, 95, 231, 0.95);
    box-shadow: 0 0 40px rgba(163, 95, 231, 0.4), 0 0 12px rgba(163, 95, 231, 0.3);
}

.duel-player-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
}

.duel-avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: rgba(129, 140, 248, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    overflow: hidden;
    border: 2px solid transparent;
}

.duel-player-card:not(.opponent) .duel-avatar {
    border-color: rgb(115, 196, 246);
    box-shadow: 0 0 10px rgba(115, 196, 246, 0.2);
}

.duel-player-card.opponent .duel-avatar {
    border-color: rgb(163, 95, 231);
    box-shadow: 0 0 10px rgba(163, 95, 231, 0.2);
}

.duel-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.duel-player-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.duel-player-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

.duel-clicks-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 0.25rem;
}

.duel-click-count {
    font-size: 4.5rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    margin: 0.15rem 0 0.25rem;
}

.duel-player-card:not(.opponent) .duel-click-count {
    color: rgb(115, 196, 246);
    text-shadow: 0 0 15px rgba(115, 196, 246, 0.3);
}

.duel-player-card.opponent .duel-click-count {
    color: rgb(163, 95, 231);
    text-shadow: 0 0 15px rgba(163, 95, 231, 0.3);
}

/* Duel click button — circular, matching main game */
.duel-click-button {
    width: 130px;
    height: 130px;
    min-width: 130px;
    min-height: 130px;
    padding: 0;
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0.5rem 0;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s;
    user-select: none;
    touch-action: none;
    position: relative;
    overflow: hidden;
}

.duel-click-button:active {
    transform: scale(0.92);
}

/* Self button — cyan */
#duel-click-btn {
    background: rgb(115, 196, 246);
    border: none;
    box-shadow: 0 0 25px rgba(115, 196, 246, 0.25);
    color: #fff;
}

#duel-click-btn:hover {
    box-shadow: 0 0 35px rgba(115, 196, 246, 0.35);
}

/* Opponent button — purple */
.duel-click-button.opponent-btn {
    background: rgb(163, 95, 231);
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: default;
    box-shadow: 0 0 25px rgba(163, 95, 231, 0.2);
}

.duel-click-button.opponent-btn:active {
    transform: none;
}

.duel-stats-row {
    display: flex;
    gap: 0;
    margin-top: 1rem;
    padding: 0.75rem 0.5rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    width: 100%;
}

.duel-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    position: relative;
}

.duel-stat:first-child::after {
    content: "";
    position: absolute;
    right: 0;
    top: 20%;
    bottom: 20%;
    width: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.duel-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Color-coded stat values */
.duel-player-card:not(.opponent) .duel-stat-value {
    color: rgb(115, 196, 246);
}

.duel-player-card.opponent .duel-stat-value {
    color: rgb(163, 95, 231);
}

.duel-stat-label {
    font-size: 0.55rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* VS divider */
.duel-vs {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4.2rem;
    font-weight: 900;
    font-family: 'Montserrat', sans-serif;
    color: #fff;
    min-width: 20px;
    margin: 0 -1.8rem;
    transform: translateX(-12px);
    -webkit-text-stroke: 2px #fff;
    user-select: none;
    letter-spacing: -10px;
    font-style: italic;
    flex-shrink: 0;
    z-index: 10;
    position: relative;
}

.duel-vs-v,
.duel-vs-s {
    display: inline-block;
    position: relative;
    text-shadow:
        0 0 10px rgba(22, 190, 255, 0.9),
        0 0 25px rgba(115, 196, 246, 0.7),
        0 0 50px rgba(163, 95, 231, 0.5);
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.35));
    animation: vs-letter-pulse 3s ease-in-out infinite;
}

.duel-vs-v {
    transform: translateY(-6px);
}

.duel-vs-s {
    transform: translateY(6px);
    animation-delay: 0.15s;
}

@keyframes vs-letter-pulse {

    0%,
    100% {
        text-shadow:
            0 0 10px rgba(22, 190, 255, 0.9),
            0 0 25px rgba(115, 196, 246, 0.7),
            0 0 50px rgba(163, 95, 231, 0.5);
        filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.35));
    }

    50% {
        text-shadow:
            0 0 15px rgba(22, 190, 255, 1),
            0 0 35px rgba(115, 196, 246, 0.85),
            0 0 65px rgba(163, 95, 231, 0.65);
        filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.5));
    }
}

/* Result overlay */
#duel-result-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.duel-result-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2.5rem;
    text-align: center;
    max-width: 500px;
    width: 90%;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.duel-result-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    line-height: 1.1;
}

.duel-result-subtitle {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    opacity: 0.85;
}

.duel-result-subtitle.cheat {
    color: #b11414;
    opacity: 1;
}

.duel-result-title.win {
    background: linear-gradient(135deg, #4ade80, #22d3ee);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.duel-result-title.lose {
    background: linear-gradient(135deg, #f87171, #fb923c);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}


.duel-result-title.tie {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.duel-result-scores {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.duel-result-player {
    flex: 1;
}

.duel-result-player-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.duel-result-player-clicks {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

.duel-result-player-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.duel-result-vs {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--accent-color);
    opacity: 0.6;
}

/* Responsive */
@media (max-width: 700px) {
    #duel-arena {
        flex-direction: column;
        align-items: center;
    }

    .duel-player-card {
        max-width: 100%;
        width: 100%;
    }

    .duel-vs {
        font-size: 2rem;
        min-width: auto;
        padding: 0.25rem 0;
        margin: 0 -0.5rem;
    }

    .duel-vs-v {
        transform: translateY(-5px);
    }

    .duel-vs-s {
        transform: translateY(5px);
    }

    .duel-click-count {
        font-size: 2.5rem;
    }

    .duel-click-button {
        width: 110px;
        height: 110px;
        min-width: 110px;
        min-height: 110px;
    }

    .duel-outer-container {
        padding: 1.25rem 1rem 1rem;
    }
}

/* ── Party Panel (Desktop) ────────────────────────────────────── */
.party-panel {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 180px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 0.75rem;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.party-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.party-panel-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.party-count {
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0.5;
}

.party-leave-btn {
    background: none;
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.party-leave-btn:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.15);
    border-color: #f87171;
}

.party-leave-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.party-slots {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.party-slot {
    border-radius: 8px;
    padding: 0.4rem 0.5rem;
    min-height: 36px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    position: relative;
}

.party-slot-self {
    background: rgba(129, 140, 248, 0.1);
    border: 1px solid rgba(129, 140, 248, 0.2);
}

.party-slot-empty {
    border: 1px dashed rgba(255, 255, 255, 0.1);
    background: transparent;
}

.party-invite-placeholder {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.party-invite-placeholder:hover {
    color: var(--accent-color);
}

.party-invite-plus {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px dashed rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.party-invite-text {
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.party-slot-filled {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    position: relative;
}

.party-slot-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.party-slot-avatar img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.party-slot-name {
    font-size: 0.8rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.party-slot-crown {
    font-size: 0.7rem;
    flex-shrink: 0;
}

.party-slot-actions {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 0.2rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.party-slot:hover .party-slot-actions {
    opacity: 1;
}

.party-action-btn {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.party-action-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.party-kick-btn {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.party-kick-btn:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.4);
}

.party-promote-btn {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.party-promote-btn:hover:not(:disabled) {
    background: rgba(251, 191, 36, 0.4);
}

.party-create-btn {
    font-size: 0.8rem;
    padding: 0.5rem;
    border-radius: 8px;
    width: 100%;
}

/* ── Party Invite Toast ───────────────────────────────────────── */
#party-invite-toast-container {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 300px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.party-invite-toast {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(129, 140, 248, 0.3);
    border-radius: 12px;
    padding: 0.75rem;
    animation: slideInRight 0.3s ease-out;
    pointer-events: all;
}

.party-invite-toast-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.party-invite-toast-label {
    font-size: 0.65rem;
    color: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.party-invite-toast-user {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.party-invite-toast-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.party-invite-toast-actions button {
    flex: 1;
    padding: 0.4rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.party-invite-accept-btn {
    background: rgba(74, 222, 128, 0.2);
    color: #4ade80;
}

.party-invite-accept-btn:hover {
    background: rgba(74, 222, 128, 0.35);
}

.party-invite-decline-btn {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.party-invite-decline-btn:hover {
    background: rgba(239, 68, 68, 0.35);
}

.party-invite-timer-bar {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.party-invite-timer-fill {
    height: 100%;
    background: var(--accent-color);
    border-radius: 2px;
    transition: width 0.1s linear;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ── Party Invite Picker ──────────────────────────────────────── */
.party-invite-friend-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.party-invite-friend-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.party-invite-friend-name {
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.party-invite-send-btn {
    background: rgba(129, 140, 248, 0.2);
    color: var(--accent-color);
    border: none;
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}

.party-invite-send-btn:hover {
    background: rgba(129, 140, 248, 0.35);
}

.party-invite-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Party Mobile FAB ─────────────────────────────────────────── */
.party-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(129, 140, 248, 0.9);
    color: white;
    border: none;
    cursor: pointer;
    z-index: 91;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(129, 140, 248, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.party-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(129, 140, 248, 0.4);
}

.party-fab-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #f87171;
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Party Mobile Drawer ──────────────────────────────────────── */
.party-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
}

.party-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 260px;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(16px);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 200;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.party-drawer.open {
    transform: translateX(0);
}

.party-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}

.party-drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
}

/* ── Mobile responsive for party ──────────────────────────────── */
@media (max-width: 600px) {
    #party-panel {
        display: none !important;
    }

    #party-invite-toast-container {
        right: 12px;
        bottom: 90px;
        width: calc(100vw - 24px);
        max-width: 340px;
    }
}