/* ============================================
   PICHE CLICKER - Styles v2
   Theme: Chill Cocooning Nature Fruity
   ============================================ */

/* CSS Variables */
:root {
    /* Nature palette */
    --bg-dark: #1a2e1a;
    --bg-medium: #2d4a2d;
    --bg-light: #3d5c3d;
    --bg-card: rgba(45, 74, 45, 0.8);

    /* Accent colors - Fruity */
    --accent-orange: #ff9f43;
    --accent-pink: #ff6b9d;
    --accent-green: #7bed9f;
    --accent-gold: #ffd32a;

    /* Text */
    --text-primary: #ffffff;
    --text-secondary: #b8d4b8;
    --text-muted: #7a9a7a;

    /* Effects */
    --glow-green: 0 0 20px rgba(123, 237, 159, 0.4);
    --glow-orange: 0 0 20px rgba(255, 159, 67, 0.4);
    --glow-gold: 0 0 20px rgba(255, 211, 42, 0.5);

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Border radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 50%;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Theme specific UI elements */
    --bg-header: rgba(26, 46, 26, 0.98);
    --bg-button-prestige: linear-gradient(135deg, #2d4a2d, #1a2e1a);
    --bg-button-plain: rgba(61, 92, 61, 0.6);
    --bg-stat-card: var(--bg-card);
}

/* ============================================
   PRESTIGE THEMES
   ============================================ */

/* Theme 0: Green (Default) - Already defined in :root */
/* Les thèmes de prestige sont désormais gérés via data/prestige.json et Prestige.js */


/* Header Buttons (Auth & Sync) */
.header-btn {
    background: var(--bg-button-plain);
    border: 2px solid var(--accent-green);
    border-radius: var(--radius-md);
    padding: var(--spacing-xs) var(--spacing-sm);
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-family: inherit;
    font-size: 0.9rem;
}

.header-btn:hover {
    background: var(--bg-medium);
    box-shadow: 0 0 15px var(--glow-green);
    transform: translateY(-2px);
}

#auth-btn {
    background: var(--bg-button-plain) !important;
    border-color: var(--accent-green);
    color: var(--text-primary);
}



/* ============================================
   PRESTIGE UI STYLES
   ============================================ */

/* Prestige Button */
.prestige-btn {
    background: var(--bg-button-prestige);
    border: 2px solid var(--text-muted);
    border-radius: var(--radius-md);
    padding: var(--spacing-xs) var(--spacing-sm);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 1.1rem;
    cursor: not-allowed;
    opacity: 0.6;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
}

.prestige-btn.available {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
    cursor: pointer;
    opacity: 1;
    box-shadow: var(--glow-gold);
}

.prestige-btn.available:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 211, 42, 0.6);
}

.prestige-btn.pulse {
    animation: prestige-pulse 2s infinite;
}

@keyframes prestige-pulse {

    0%,
    100% {
        box-shadow: 0 0 10px rgba(255, 211, 42, 0.4);
    }

    50% {
        box-shadow: 0 0 30px rgba(255, 211, 42, 0.8);
    }
}

/* Prestige Level Indicator */
.prestige-level-indicator {
    background: linear-gradient(135deg, var(--accent-gold), #ffa502);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    font-size: 0.9rem;
    text-shadow: 0 0 10px rgba(255, 211, 42, 0.5);
}

/* Prestige Modal */
.prestige-modal-content {
    max-width: 500px;
}

.prestige-bonus-preview {
    background: rgba(255, 211, 42, 0.1);
    border: 1px solid var(--accent-gold);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm);
    margin: var(--spacing-sm) 0;
    text-align: center;
    color: var(--accent-gold);
    font-weight: 600;
}

.prestige-riddle-section {
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin: var(--spacing-md) 0;
}

.prestige-riddle-text {
    font-style: italic;
    color: var(--text-secondary);
    line-height: 1.7;
    white-space: pre-line;
    margin-bottom: var(--spacing-md);
}

/* Prestige Hints (collapsible) */
.prestige-hints {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: var(--spacing-md);
}

.prestige-hint-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 211, 42, 0.08);
    border: 1px solid rgba(255, 211, 42, 0.2);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: var(--accent-gold);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    font-family: inherit;
    width: 100%;
    text-align: left;
}

.prestige-hint-toggle:hover {
    background: rgba(255, 211, 42, 0.15);
    border-color: rgba(255, 211, 42, 0.4);
}

.prestige-hint-toggle .hint-arrow {
    transition: transform 0.2s;
    font-size: 0.7rem;
}

.prestige-hint-toggle.open .hint-arrow {
    transform: rotate(90deg);
}

.prestige-hint-body {
    display: none;
    padding: 8px 12px;
    margin-top: 2px;
    background: rgba(255, 211, 42, 0.05);
    border-left: 3px solid rgba(255, 211, 42, 0.3);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-style: italic;
    line-height: 1.5;
}

.prestige-hint-body.open {
    display: block;
}

.prestige-answer-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--text-muted);
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color var(--transition-fast);
}

.prestige-answer-input:focus {
    outline: none;
    border-color: var(--accent-gold);
}

.prestige-answer-input.shake {
    animation: shake 0.5s;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-10px);
    }

    40%,
    80% {
        transform: translateX(10px);
    }
}

.prestige-confirm-btn {
    width: 100%;
    padding: var(--spacing-sm);
    background: linear-gradient(135deg, var(--accent-gold), #ffa502);
    border: none;
    border-radius: var(--radius-md);
    color: #1a1a1a;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-top: var(--spacing-sm);
}

.prestige-confirm-btn:hover {
    transform: scale(1.02);
    box-shadow: var(--glow-gold);
}

.prestige-confirm-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.prestige-requirement {
    text-align: center;
    margin: 10px 0;
    font-size: 0.95rem;
}

/* ============================================
   DYNAMIC PRESTIGE THEMES
   ============================================ */

/* Pulse theme: visible pulsing glow overlay */
.dynamic-theme-pulse::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    background: radial-gradient(ellipse at 50% 40%, var(--accent-green), transparent 60%);
    opacity: 0.04;
    animation: pulse-glow 1.6s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 0.02; transform: scale(1); }
    50% { opacity: 0.08; transform: scale(1.05); }
}

.dynamic-theme-pulse .prestige-btn,
.dynamic-theme-pulse .koala-button {
    box-shadow: var(--glow-green) !important;
}

/* Rainbow theme: elegant slow color shift */
.dynamic-theme-rainbow .clicker-zone,
.dynamic-theme-rainbow .visual-zone,
.dynamic-theme-rainbow .shop-zone,
.dynamic-theme-rainbow .leaderboard-zone {
    border: 1px solid var(--accent-green);
    transition: border-color 0.3s linear;
}

.dynamic-theme-rainbow .prestige-level-indicator {
    background: linear-gradient(90deg, var(--accent-green), var(--accent-gold), var(--accent-orange), var(--accent-pink)) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
}

/* RGB theme: aggressive rainbow with visible borders and glows */
.dynamic-theme-rgb .clicker-zone,
.dynamic-theme-rgb .visual-zone,
.dynamic-theme-rgb .shop-zone,
.dynamic-theme-rgb .leaderboard-zone {
    border: 2px solid var(--accent-green);
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.02), var(--glow-green);
    transition: none;
}

.dynamic-theme-rgb .prestige-btn {
    border-color: var(--accent-gold) !important;
    box-shadow: var(--glow-gold) !important;
}

.dynamic-theme-rgb .koala-button {
    box-shadow: var(--glow-green) !important;
}

.dynamic-theme-rgb .prestige-level-indicator {
    background: linear-gradient(90deg, var(--accent-green), var(--accent-gold), var(--accent-orange), var(--accent-pink)) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
}

.dynamic-theme-rgb .stats-bar {
    border-bottom: 2px solid var(--accent-green);
}

/* Wave theme: flowing gradients visible via overlay div */
.dynamic-theme-wave .clicker-zone,
.dynamic-theme-wave .visual-zone,
.dynamic-theme-wave .shop-zone,
.dynamic-theme-wave .leaderboard-zone {
    border: 1px solid var(--accent-green);
    transition: border-color 0.2s linear;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-medium) 50%, var(--bg-dark) 100%);
    color: var(--text-primary);
    height: 100vh;
    /* Fixed viewport height */
    overflow: hidden;
    /* No global scroll */
    display: flex;
    /* App layout */
    flex-direction: column;
    user-select: none;
    -webkit-user-select: none;
    /* Status bar padding for Capacitor/Android */
    padding-top: env(safe-area-inset-top, 36px);
}

/* Allow text selection in inputs */
input,
textarea {
    user-select: text;
    -webkit-user-select: text;
}

/* ... background animation remains ... */

/* ============================================
   STATS BAR (Totals only)
   ============================================ */
.stats-bar {
    background: var(--bg-header);
    /* Less transparency, no blur */
    border-bottom: 2px solid var(--accent-green);
    padding: var(--spacing-xs) var(--spacing-md);
    flex: 0 0 auto;
    /* Fixed heiht header */
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.stats-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-lg);
    flex-wrap: wrap;
    max-width: 1400px;
    margin: 0 auto;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--bg-stat-card);
    border-radius: var(--radius-md);
    min-width: 120px;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent-gold);
}

/* Fixed-width for play-time to prevent jitter */
#play-time {
    font-variant-numeric: tabular-nums;
    font-family: 'Courier New', monospace;
    display: inline-block;
    min-width: 80px;
    text-align: center;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   GAME CONTAINER
   ============================================ */
.game-container {
    display: grid;
    grid-template-columns: 1fr 0.8fr 1.2fr 1fr;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    max-width: 1900px;
    margin: 0 auto;
    /* Fill remaining vertical space */
    flex: 1;
    height: 100%;
    overflow: hidden;
    /* Prevent grid blow-up */
    width: 100%;
}

/* ============================================
   CLICKER ZONE (Left - centered with stats above)
   ============================================ */
.clicker-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
    gap: var(--spacing-md);
    /* Fill grid cell */
    height: 100%;
    overflow: visible;
}


/* Stats above koala */
.clicker-stats {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    text-align: center;
}

.current-piches {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.piches-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent-gold);
    text-shadow: var(--glow-gold);
    line-height: 1;
}

.piches-label {
    font-size: 1rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.piches-rates {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.rate-value {
    color: var(--accent-green);
    font-weight: 600;
}

.rate-divider {
    color: var(--text-muted);
}

.cps-display .rate-value {
    color: var(--accent-pink);
    font-weight: 700;
}

/* Koala button */
.koala-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.koala-button {
    background: radial-gradient(circle, var(--bg-light) 0%, var(--bg-medium) 100%);
    border: 4px solid var(--accent-green);
    border-radius: var(--radius-full);
    padding: var(--spacing-md);
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow:
        var(--glow-green),
        0 10px 40px rgba(0, 0, 0, 0.4);
    width: 220px;
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.koala-button:hover {
    transform: scale(1.05);
    border-color: var(--accent-gold);
    box-shadow:
        var(--glow-gold),
        0 15px 50px rgba(0, 0, 0, 0.5);
}

.koala-button:active {
    transform: scale(0.95);
}

.koala-img {
    width: 180px;
    height: 180px;
    object-fit: contain;
    transition: var(--transition-fast);
    pointer-events: none;
    border-radius: 50%;
}

/* Click animation */
.koala-button.clicked .koala-img {
    animation: koalaClick 0.2s ease-out;
}

@keyframes koalaClick {
    0% {
        transform: scale(1) rotate(0deg);
    }

    25% {
        transform: scale(1.1) rotate(90deg);
    }

    50% {
        transform: scale(0.9) rotate(180deg);
    }

    75% {
        transform: scale(1.05) rotate(270deg);
    }

    100% {
        transform: scale(1) rotate(360deg);
    }
}

/* Click effects container */
.click-effects {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}

.click-number {
    position: absolute;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent-gold);
    text-shadow:
        0 0 10px var(--accent-gold),
        2px 2px 0 var(--bg-dark);
    animation: floatUp 1s ease-out forwards;
    pointer-events: none;
    white-space: nowrap;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateY(-80px) scale(1.2);
    }
}

/* Critical Hit Style */
.click-number.crit {
    font-size: 2.5rem;
    color: #ffd700;
    text-shadow:
        0 0 20px #ffd700,
        0 0 40px #ff8c00,
        3px 3px 0 var(--bg-dark);
    animation: critFloat 1s ease-out forwards, critShake 0.1s ease-in-out 3;
}

@keyframes critFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1.5);
    }

    100% {
        opacity: 0;
        transform: translateY(-100px) scale(2);
    }
}

@keyframes critShake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* ============================================
   VISUAL ZONE (Center - stacked icons)
   ============================================ */
.visual-zone {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    border: 1px solid rgba(123, 237, 159, 0.2);
    display: flex;
    flex-direction: column;
    /* Fill grid cell */
    height: 100%;
    overflow: hidden;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    padding-bottom: var(--spacing-xs);
    border-bottom: 2px solid var(--accent-green);
}

.owned-items {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-xs);
}

/* Stacked item row */
.owned-item-row {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.owned-item-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.owned-item-header .count {
    color: var(--accent-gold);
    font-size: 1.1rem;
}

/* Stacked icons container */
.stacked-icons {
    display: flex;
    align-items: center;
    padding-left: var(--spacing-xs);
    max-width: 100%;
}

.stacked-icon {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    object-fit: contain;
    border-radius: var(--radius-sm);
    background: var(--bg-medium);
    border: 2px solid var(--accent-green);
    padding: 2px;
    transition: var(--transition-fast);
    position: relative;
    /* Dynamic overlap adjustment for larger size */
    margin-left: calc(-55px + ((100% - 70px) / var(--item-count, 1)));
}

.stacked-icon:first-child {
    margin-left: 0 !important;
}

.stacked-icon:hover {
    z-index: 10;
    transform: scale(1.3) translateY(-5px);
}

.empty-message {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: var(--spacing-lg);
    white-space: nowrap;
}

/* ============================================
   SHOP ZONE (Right)
   ============================================ */
/* ============================================
   SHOP ZONE (Right)
   ============================================ */
.shop-zone {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    position: relative;
    z-index: 10;
    /* Fix height to viewport to enable internal scrolling */
    height: calc(100vh - 120px);
    overflow: hidden;
}

.upgrades-section,
.shop-section {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    border: 1px solid rgba(123, 237, 159, 0.2);
    display: flex;
    flex-direction: column;
}

.upgrades-section {
    /* Upgrades take up to 40% of the space, but can shrink */
    flex: 0 1 40%;
    min-height: 150px;
}

.shop-section {
    /* Shop takes the rest */
    flex: 1;
    min-height: 0;
    /* Critical for nested flex scrolling */
}

/* Titles stay fixed */
.upgrades-section .section-title,
.shop-section .section-title {
    flex-shrink: 0;
}

/* Lists scroll independently */
.upgrades-list,
.shop-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    overflow-y: auto;
    /* Increased padding to prevent hover clip */
    padding: var(--spacing-sm);
    padding-right: var(--spacing-md);
    /* Space for scrollbar */
    flex: 1;
    /* Grow to fill the container */
    scrollbar-width: thin;
    /* Firefox */
}

/* Shop/Upgrade Item */
.shop-item,
.upgrade-item {
    display: grid;
    grid-template-columns: 95px 1fr auto;
    /* Increased to fit 85px icon */
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--bg-button-plain);
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition-normal);
    position: relative;
}

/* Buy Multiplier Selector */
.buy-multiplier-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    margin-bottom: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 2px solid var(--accent-green);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.multiplier-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 8px;
}

.multiplier-btn {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 700;
    background: var(--bg-button-plain);
    border: 2px solid var(--accent-green);
    border-radius: var(--radius-sm);
    color: var(--accent-green);
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: none;
    min-width: 50px;
}

.multiplier-btn:hover {
    background: rgba(123, 237, 159, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(123, 237, 159, 0.3);
}

.multiplier-btn.active {
    background: var(--accent-green);
    color: var(--bg-dark);
    box-shadow: 0 0 15px var(--accent-green);
    transform: scale(1.05);
}

.multiplier-btn:active {
    transform: scale(0.95);
}

.shop-item:hover,
.upgrade-item:hover {
    background: rgba(123, 237, 159, 0.15);
    border-color: var(--accent-green);
    transform: translateX(-5px) translateY(-5px) scale(1.02);
    /* Added Y lift */
    z-index: 1000 !important;
    /* Force on top */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    /* Stronger shadow */
}

.shop-item.affordable,
.upgrade-item.affordable {
    border-color: var(--accent-gold);
    box-shadow: inset 0 0 15px rgba(255, 211, 42, 0.15);
}

.shop-item.affordable:hover,
.upgrade-item.affordable:hover {
    background: rgba(255, 211, 42, 0.15);
    box-shadow: var(--glow-gold);
}

.shop-item:not(.affordable),
.upgrade-item:not(.affordable) {
    opacity: 0.5;
}

.shop-item.purchased {
    opacity: 0.3;
    pointer-events: none;
}

.shop-item.mystery {
    background: rgba(20, 30, 20, 0.4);
    border-color: transparent;
    cursor: default;
}

.shop-item.mystery .item-icon {
    filter: blur(10px) grayscale(100%) brightness(0.5);
}

.shop-item.mystery .item-name,
.shop-item.mystery .item-desc {
    color: var(--text-muted);
    font-family: monospace;
    letter-spacing: 3px;
}

.item-icon {
    width: 85px;
    height: 85px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    background: var(--bg-medium);
    padding: 2px;
    border: 1px solid rgba(123, 237, 159, 0.3);
}

.upgrade-item .item-icon {
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-light), var(--bg-medium));
}

.item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.item-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}

.item-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-bonus {
    font-size: 0.7rem;
    color: var(--accent-green);
    font-weight: 600;
    margin-top: 2px;
    padding: 2px 6px;
    background: rgba(123, 237, 159, 0.15);
    border-radius: var(--radius-sm);
    display: inline-block;
    white-space: nowrap;
}

.item-production {
    font-size: 0.8rem;
    color: var(--accent-green);
    font-weight: 600;
}

.item-owned {
    font-size: 0.75rem;
    color: var(--accent-orange);
    font-weight: 600;
}

/* Cost badge */
.item-cost {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(26, 46, 26, 0.8);
    border-radius: var(--radius-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    min-width: 70px;
}

.cost-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--accent-gold);
}

.cost-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   ACHIEVEMENT POPUP
   ============================================ */
.achievement-popup {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: linear-gradient(135deg, var(--bg-medium), var(--bg-dark));
    border: 3px solid var(--accent-gold);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md) var(--spacing-lg);
    box-shadow:
        var(--glow-gold),
        0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-normal);
}

.achievement-popup.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.achievement-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.achievement-icon {
    font-size: 2.5rem;
}

.achievement-text {
    display: flex;
    flex-direction: column;
}

.achievement-title {
    font-size: 0.8rem;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.achievement-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ============================================
   SAVE INDICATOR
   ============================================ */
.save-indicator {
    position: fixed;
    bottom: var(--spacing-md);
    right: var(--spacing-md);
    background: rgba(26, 46, 26, 0.95);
    border: 1px solid var(--accent-green);
    border-radius: var(--radius-md);
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.85rem;
    color: var(--accent-green);
    opacity: 0;
    transform: translateY(10px);
    transition: var(--transition-normal);
    z-index: 150;
}

.save-indicator.show {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 1200px) {

    /* Revert to Normal Scroll for smaller screens */
    body {
        height: auto;
        /* Allow body to grow */
        overflow-y: auto;
        /* Enable global scroll */
    }

    .game-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        height: auto;
        /* Grow with content */
        overflow: visible;
        display: flex;
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .clicker-zone,
    .visual-zone,
    .shop-zone {
        height: auto;
        /* Natural height */
        overflow: visible;
        flex: none;
        /* Don't fill parent */
    }

    /* Hide leaderboard on small screens */
    .leaderboard-zone {
        display: none;
    }

    /* Keep internal scrolling for lists if they get too long? 
       Or better: let them expand fully and scroll the page.
       Let's expand them. */
    .shop-zone {
        height: auto;
    }

    .upgrades-list,
    .shop-list {
        overflow: visible;
        height: auto;
    }

    .clicker-zone {
        order: 1;
        padding: var(--spacing-md);
        flex-direction: column;
    }

    .clicker-stats {
        order: -1;
    }

    .visual-zone {
        order: 3;
        min-height: 150px;
    }

    .shop-zone {
        order: 2;
        flex-direction: column;
        gap: var(--spacing-sm);
        height: auto;
        /* Let it grow, sections limit themselves */
        max-height: none;
        flex: none;
        overflow: visible;
        /* Don't clip borders */
    }

    .upgrades-section,
    .shop-section {
        width: 100%;
        /* Restore scrolling inside the box */
        min-height: 0;
        flex: 1;
        /* Allow them to share the 70vh space */
        overflow: hidden;
        /* Let lists handle scroll */
        display: flex;
        flex-direction: column;
    }

    .upgrades-list,
    .shop-list {
        overflow-y: auto;
        /* Internal scroll is BACK */
        height: auto;
        max-height: 100%;
        /* Fill the section */
    }

    .upgrades-section,
    .shop-section {
        width: 100%;
        max-height: none;
        min-height: auto;
        flex: none;
        /* Do not flex, take natural height */
    }


}

@media (max-width: 768px) {
    html {
        font-size: 14px;
    }

    .stats-container {
        gap: var(--spacing-sm);
    }

    .stat-item {
        min-width: 90px;
        padding: var(--spacing-xs);
    }

    .koala-button {
        width: 180px;
        height: 180px;
    }

    .koala-img {
        width: 140px;
        height: 140px;
    }

    .piches-value {
        font-size: 2rem;
    }

    .shop-zone {
        flex-direction: column;
    }

    .upgrades-section,
    .shop-section {
        max-height: 60vh;
        /* More breathing room */
    }

    .upgrades-list,
    .shop-list {
        padding-bottom: var(--spacing-md);
        /* Prevent item cut-off at bottom */
    }

    .game-container {
        padding: var(--spacing-sm);
    }
}

@media (max-width: 480px) {
    .stats-bar {
        padding: var(--spacing-xs);
    }

    .stat-item {
        min-width: 80px;
    }

    .koala-button {
        width: 150px;
        height: 150px;
    }

    .koala-img {
        width: 120px;
        height: 120px;
    }

    .item-icon {
        width: 70px;
        /* Increased from 60px */
        height: 70px;
    }

    .shop-item,
    .upgrade-item {
        grid-template-columns: 75px 1fr auto;
    }

    .item-cost {
        min-width: 55px;
        padding: 4px 8px;
    }

    .cost-value {
        font-size: 0.95rem;
    }
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-green);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-gold);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.hidden {
    display: none !important;
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }
}

/* ============================================
   CONTROLS CONTAINER
   ============================================ */
.controls-container {
    /* Flex layout for buttons */
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    /* Equal spacing between all buttons */
    align-items: center;
    justify-content: center;
    margin-top: auto;
    /* Pushes buttons to the bottom of the flex column */
    z-index: 150;
    width: 100%;
    padding-top: var(--spacing-md);
}

/* ============================================
   ACHIEVEMENTS BUTTON & MODAL
   ============================================ */
.achievements-btn {
    /* Position removed, handled by container */
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid rgba(255, 215, 0, 0.5);
    color: var(--accent-gold);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition-normal);
}

.achievements-btn:hover {
    background: rgba(255, 215, 0, 0.4);
    border-color: var(--accent-gold);
}

.achievements-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(4, 6, 10, 0.88);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(6px);
}

.achievements-modal.show {
    display: flex;
}

.achievements-modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 2px solid var(--accent-gold);
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    overscroll-behavior: contain;
}

.achievements-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
}

.achievements-modal-header h2 {
    margin: 0;
    color: var(--accent-gold);
}

.close-modal {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    color: rgba(255,255,255,0.5);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: all 0.15s;
    flex-shrink: 0;
}

.close-modal:hover {
    background: rgba(255,56,96,0.18);
    border-color: #ff3860;
    color: #ff3860;
}

.achievements-list {
    padding: var(--spacing-md);
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--spacing-sm);
}

.achievement-card {
    background: var(--bg-medium);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm);
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
    border: 1px solid rgba(123, 237, 159, 0.2);
    transition: var(--transition-fast);
}

.achievement-card.unlocked {
    border-color: var(--accent-gold);
    background: rgba(255, 215, 0, 0.1);
}

.achievement-card.locked {
    opacity: 0.5;
    filter: grayscale(0.8);
}

.achievement-card-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
}

.achievement-card-info {
    flex: 1;
    min-width: 0;
}

.achievement-card-name {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.achievement-card-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ============================================
   CIRCUIT MODAL (Energy Flow Diagram)
   ============================================ */
.circuit-modal-content {
    max-width: 950px !important;
    width: 95%;
}

.circuit-container {
    display: flex;
    padding: var(--spacing-md);
    gap: 0;
    min-height: 400px;
    max-height: 65vh;
    overflow-y: auto;
}

/* Branch layout */
.circuit-branch {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    padding: 0 var(--spacing-sm);
}

.circuit-branch-title {
    text-align: center;
    font-size: 1.05rem;
    color: var(--accent-gold);
    margin-bottom: var(--spacing-sm);
    letter-spacing: 0.5px;
}

/* Animated energy line along left edge of each branch */
.circuit-energy-line {
    position: absolute;
    left: 8px;
    top: 44px;
    bottom: 80px;
    width: 3px;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255, 159, 67, 0.6) 0px,
        rgba(255, 159, 67, 0.6) 6px,
        transparent 6px,
        transparent 12px
    );
    background-size: 3px 12px;
    animation: energy-flow 0.8s linear infinite;
    border-radius: 2px;
}

@keyframes energy-flow {
    0% { background-position: 0 0; }
    100% { background-position: 0 12px; }
}

/* Central spine */
.circuit-spine {
    width: 3px;
    background: linear-gradient(to bottom, transparent 5%, rgba(255, 159, 67, 0.3) 20%, rgba(255, 159, 67, 0.3) 80%, transparent 95%);
    position: relative;
    flex-shrink: 0;
    margin: 40px 6px;
}

.circuit-spine-dot {
    position: absolute;
    left: 50%;
    width: 8px;
    height: 8px;
    background: var(--accent-orange);
    border-radius: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 8px var(--accent-orange);
    animation: spine-dot 3s ease-in-out infinite;
}

.circuit-spine-dot:nth-child(1) { top: -4px; animation-delay: 0s; }
.circuit-spine-dot:nth-child(2) { top: -4px; animation-delay: 1s; }
.circuit-spine-dot:nth-child(3) { top: -4px; animation-delay: 2s; }

@keyframes spine-dot {
    0% { top: -4px; opacity: 1; }
    80% { opacity: 0.6; }
    100% { top: calc(100% + 4px); opacity: 0; }
}

/* Node container */
.circuit-nodes {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    padding-left: 18px;
}

/* Base node style */
.circuit-node {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(6px);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-orange);
    position: relative;
    font-size: 0.82rem;
    animation: node-appear 0.3s ease-out both;
}

/* Connector dot from energy line to node */
.circuit-node::before {
    content: '';
    position: absolute;
    left: -14px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-orange);
    transform: translateY(-50%);
    box-shadow: 0 0 4px rgba(255, 159, 67, 0.5);
}

/* Connector line */
.circuit-node::after {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    width: 7px;
    height: 2px;
    background: var(--accent-orange);
    transform: translateY(-50%);
}

/* Node type: source */
.circuit-node.node-source {
    border-left-color: var(--accent-orange);
    background: rgba(255, 159, 67, 0.08);
    box-shadow: 0 0 12px rgba(255, 159, 67, 0.1);
}

.circuit-node.node-source::before,
.circuit-node.node-source::after {
    background: var(--accent-orange);
}

/* Node type: additive */
.circuit-node.node-add {
    border-left-color: var(--accent-green);
}

.circuit-node.node-add::before {
    background: var(--accent-green);
    box-shadow: 0 0 4px rgba(123, 237, 159, 0.5);
}

.circuit-node.node-add::after {
    background: var(--accent-green);
}

/* Node type: multiplicative */
.circuit-node.node-mult {
    border-left-color: var(--accent-gold);
}

.circuit-node.node-mult::before {
    background: var(--accent-gold);
    box-shadow: 0 0 4px rgba(255, 215, 0, 0.5);
}

.circuit-node.node-mult::after {
    background: var(--accent-gold);
}

/* Node type: subtotal */
.circuit-node.node-subtotal {
    border-left: 3px dashed rgba(0, 210, 255, 0.7);
    background: rgba(0, 210, 255, 0.06);
    animation: node-appear 0.3s ease-out both, glow-pulse 2.5s ease-in-out infinite;
}

.circuit-node.node-subtotal::before {
    background: rgba(0, 210, 255, 0.8);
    box-shadow: 0 0 6px rgba(0, 210, 255, 0.6);
}

.circuit-node.node-subtotal::after {
    background: rgba(0, 210, 255, 0.6);
}

/* Node type: prestige */
.circuit-node.node-prestige {
    border-left: 3px double #ffd700;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.08), rgba(255, 159, 67, 0.06));
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.12);
}

.circuit-node.node-prestige::before {
    background: linear-gradient(135deg, #ffd700, #ff9f43);
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.7);
}

.circuit-node.node-prestige::after {
    background: #ffd700;
}

/* Node type: loot box buff (temporary) */
.circuit-node.node-buff {
    border-left: 3px solid rgba(0, 212, 255, 0.7);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.07), rgba(0, 255, 170, 0.04));
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.1);
    animation: circuit-buff-pulse 2s ease-in-out infinite;
}

.circuit-node.node-buff::before {
    background: linear-gradient(135deg, #00d4ff, #00ffaa);
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.7);
}

.circuit-node.node-buff::after {
    background: #00d4ff;
}

.circuit-node.node-buff .circuit-node-label {
    color: rgba(0, 212, 255, 0.9);
    font-weight: 600;
}

.circuit-node.node-buff .circuit-node-running {
    opacity: 1;
    color: #00d4ff;
    font-weight: 600;
}

.circuit-buff-timer {
    color: rgba(0, 212, 255, 0.8) !important;
    font-size: 0.7rem !important;
    font-variant-numeric: tabular-nums;
}

@keyframes circuit-buff-pulse {
    0%, 100% { box-shadow: 0 0 12px rgba(0, 212, 255, 0.1); }
    50%       { box-shadow: 0 0 20px rgba(0, 212, 255, 0.25); }
}

/* Node type: crit info */
.circuit-node.node-crit {
    border-left: 3px dotted rgba(255, 107, 129, 0.6);
    background: rgba(255, 107, 129, 0.05);
    opacity: 0.85;
}

.circuit-node.node-crit::before {
    background: rgba(255, 107, 129, 0.7);
    box-shadow: 0 0 4px rgba(255, 107, 129, 0.4);
}

.circuit-node.node-crit::after {
    background: rgba(255, 107, 129, 0.5);
}

/* Node inner elements */
.circuit-node-icon {
    font-size: 0.9rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.circuit-node-label {
    flex: 1;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.8rem;
}

.circuit-node.node-subtotal .circuit-node-label,
.circuit-node.node-prestige .circuit-node-label {
    color: var(--text-primary);
    font-weight: 600;
}

.circuit-node-effect {
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    flex-shrink: 0;
}

.circuit-node.node-add .circuit-node-effect { color: var(--accent-green); }
.circuit-node.node-mult .circuit-node-effect { color: var(--accent-gold); }
.circuit-node.node-subtotal .circuit-node-effect { color: rgba(0, 210, 255, 0.9); }
.circuit-node.node-prestige .circuit-node-effect { color: #ffd700; }
.circuit-node.node-crit .circuit-node-effect { color: rgba(255, 107, 129, 0.8); }

.circuit-node-running {
    font-size: 0.72rem;
    color: var(--text-muted);
    opacity: 0.7;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto;
    padding-left: 6px;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.circuit-node.node-subtotal .circuit-node-running {
    opacity: 1;
    color: rgba(0, 210, 255, 0.8);
    font-weight: 600;
}

.circuit-node.node-prestige .circuit-node-running {
    opacity: 1;
    color: #ffd700;
    font-weight: 600;
}

/* Final result box */
.circuit-final {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent-green);
    padding: 10px var(--spacing-sm);
    background: rgba(123, 237, 159, 0.08);
    border-radius: var(--radius-md);
    border: 2px solid rgba(123, 237, 159, 0.5);
    margin-top: var(--spacing-sm);
    box-shadow: 0 0 20px rgba(123, 237, 159, 0.1);
    animation: glow-pulse 3s ease-in-out infinite;
    position: relative;
}

/* Empty state */
.circuit-empty {
    text-align: center;
    padding: var(--spacing-lg);
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.85rem;
}

/* Animations */
@keyframes node-appear {
    from {
        opacity: 0;
        transform: translateX(-8px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes glow-pulse {
    0%, 100% {
        box-shadow: 0 0 8px rgba(123, 237, 159, 0.08);
    }
    50% {
        box-shadow: 0 0 18px rgba(123, 237, 159, 0.18);
    }
}

/* Circuit button (unchanged) */
.circuit-btn {
    background: rgba(255, 159, 67, 0.2);
    border: 1px solid rgba(255, 159, 67, 0.5);
    color: var(--accent-orange);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition-normal);
}

.circuit-btn:hover {
    background: rgba(255, 159, 67, 0.4);
    border-color: var(--accent-orange);
}

/* Legend */
.circuit-legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--spacing-sm) var(--spacing-md);
    padding: var(--spacing-sm);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.circuit-legend-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.circuit-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

/* Responsive: stack branches vertically on mobile */
@media (max-width: 700px) {
    .circuit-container {
        flex-direction: column;
        max-height: 75vh;
    }

    .circuit-spine {
        width: 100%;
        height: 3px;
        margin: var(--spacing-sm) 0;
        background: linear-gradient(to right, transparent 5%, rgba(255, 159, 67, 0.3) 20%, rgba(255, 159, 67, 0.3) 80%, transparent 95%);
    }

    .circuit-spine-dot {
        top: 50% !important;
        transform: translateY(-50%) !important;
        animation: spine-dot-h 3s ease-in-out infinite !important;
    }

    .circuit-spine-dot:nth-child(1) { left: -4px; }
    .circuit-spine-dot:nth-child(2) { left: -4px; }
    .circuit-spine-dot:nth-child(3) { left: -4px; }

    @keyframes spine-dot-h {
        0% { left: -4px; opacity: 1; }
        80% { opacity: 0.6; }
        100% { left: calc(100% + 4px); opacity: 0; }
    }

    .circuit-branch {
        padding: 0 var(--spacing-xs);
    }

    .circuit-legend {
        gap: var(--spacing-xs) var(--spacing-sm);
    }
}

/* ============================================
   UPGRADES HISTORY BUTTON
   ============================================ */
.upgrades-history-btn {
    /* Position removed, handled by container */
    background: rgba(100, 149, 237, 0.2);
    /* Cornflower Blue tint */
    border: 1px solid rgba(100, 149, 237, 0.5);
    color: #6495ED;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition-normal);
}

.upgrades-history-btn:hover {
    background: rgba(100, 149, 237, 0.4);
    border-color: #6495ED;
}

/* ============================================
   ENIGMAS BUTTON & MODAL
   ============================================ */
.enigmas-btn {
    background: var(--bg-button-plain);
    border: 2px solid var(--accent-green);
    border-radius: var(--radius-md);
    padding: var(--spacing-xs) var(--spacing-sm);
    color: var(--accent-green);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    opacity: 0.85;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: inherit;
}

.enigmas-btn:hover {
    opacity: 1;
    box-shadow: var(--glow-green);
    transform: scale(1.04);
}

.enigmas-modal-content {
    max-width: 540px;
    width: 90%;
}

.enigma-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    border: 1px solid rgba(123, 237, 159, 0.15);
    margin-bottom: 8px;
    background: var(--bg-card);
}

.enigma-list-item:hover {
    background: rgba(123, 237, 159, 0.1);
    border-color: rgba(123, 237, 159, 0.4);
}

.enigma-list-badge {
    min-width: 38px;
    text-align: center;
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--accent-gold);
    background: rgba(255, 211, 42, 0.1);
    border-radius: 6px;
    padding: 4px 6px;
}

.enigma-list-name {
    flex: 1;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.enigma-list-arrow {
    color: var(--accent-green);
    font-size: 1.4rem;
    font-weight: 700;
    opacity: 0.7;
}

/* ============================================
   ANIMATION PARTICLES
   ============================================ */
.flow-particle {
    position: fixed;
    width: 20px;
    height: 20px;
    background-image: url('assets/img/piche.png');
    /* Or a smaller icon */
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 2000;
    border-radius: 50%;
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.5));
}

@keyframes absorb-pulse {
    0% {
        transform: scale(1);
        text-shadow: 0 0 5px var(--accent-gold);
    }

    50% {
        transform: scale(1.2);
        text-shadow: 0 0 20px var(--accent-gold), 0 0 40px var(--accent-green);
        color: #fff;
    }

    100% {
        transform: scale(1);
        text-shadow: 0 0 5px var(--accent-gold);
    }
}

.absorbing {
    animation: absorb-pulse 0.3s infinite alternate;
}

/* ============================================
   RANDOM EVENTS - Generic Invader
   ============================================ */

/* Generic invader element - size and image set via JS */
.invader {
    position: fixed;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    cursor: pointer;
    z-index: 3000;
    filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.5));
    transition: transform 0.1s ease;
}

.invader:hover {
    transform: scale(1.2);
    filter: drop-shadow(0 5px 10px rgba(255, 0, 0, 0.5));
}

.invader.dead {
    animation: invaderDeath 0.3s ease-out forwards;
    pointer-events: none;
}

@keyframes invaderDeath {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }

    50% {
        transform: scale(1.3) rotate(180deg);
    }

    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

/* Event announcement banner */
.event-announcement {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.95), rgba(101, 67, 33, 0.95));
    border: 3px solid #8b4513;
    border-radius: var(--radius-lg);
    padding: var(--spacing-md) var(--spacing-xl);
    box-shadow: 0 0 30px rgba(139, 69, 19, 0.6), 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 5000;
    text-align: center;
    animation: eventSlideIn 0.5s ease-out;
}

.event-announcement.fade-out {
    animation: eventFadeOut 0.5s ease-out forwards;
}

@keyframes eventSlideIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes eventFadeOut {
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-30px);
    }
}

.event-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    margin-bottom: 5px;
}

.event-subtitle {
    font-size: 1rem;
    color: #f5deb3;
}

/* Insecticide button */
.insecticide-btn {
    margin-top: var(--spacing-sm);
    background: linear-gradient(135deg, #7bed9f, #2ed573);
    border: 2px solid #26de81;
    border-radius: var(--radius-md);
    padding: var(--spacing-xs) var(--spacing-md);
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a2e1a;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: 0 4px 15px rgba(46, 213, 115, 0.4);
}

.insecticide-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(46, 213, 115, 0.6);
}

/* Screen shake effect */
@keyframes screenShake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

.screen-shake {
    animation: screenShake 0.3s ease-out;
}

/* Damage feedback text */
.click-number.damage {
    color: #ff4757 !important;
    text-shadow:
        0 0 10px #ff4757,
        0 0 20px #ff0000,
        2px 2px 0 var(--bg-dark) !important;
}

/* ============================================
   MINIGAME MODAL
   ============================================ */

.minigame-modal {
    position: fixed;
    inset: 0;
    background: rgba(4, 6, 10, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(6px);
    animation: fadeIn 0.3s ease;
}

.minigame-content {
    background: var(--bg-card);
    border: 2px solid;
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: mp-modal-in 0.25s cubic-bezier(0.34,1.56,0.64,1);
}

.minigame-header {
    padding: var(--spacing-md);
    text-align: center;
    color: white;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.minigame-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.minigame-subtitle {
    font-size: 1rem;
    opacity: 0.9;
    margin-top: var(--spacing-xs);
}

.minigame-stake {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    margin-top: var(--spacing-sm);
    padding: 3px 12px;
    border-radius: 20px;
    background: rgba(13,242,160,0.1);
    border: 1px solid rgba(13,242,160,0.25);
    color: #0df2a0;
}

.minigame-board {
    padding: var(--spacing-md);
    display: flex;
    justify-content: center;
}

.minigame-status {
    text-align: center;
    padding: var(--spacing-sm);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-light);
}

.minigame-status.win {
    color: #2ed573;
    animation: pulse 0.5s ease;
}

.minigame-status.lose {
    color: #ff4757;
    animation: shake 0.5s ease;
}

.minigame-status.draw {
    color: #ffa502;
}

.minigame-actions {
    padding: var(--spacing-md);
    text-align: center;
}

.minigame-flee-btn {
    background: rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: var(--spacing-xs) var(--spacing-lg);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.minigame-flee-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* ============================================
   CONNECT 4 BOARD
   ============================================ */

.connect4-board {
    display: grid;
    grid-template-columns: repeat(7, 50px);
    grid-template-rows: repeat(6, 50px);
    gap: 4px;
    background: #2d3436;
    padding: 8px;
    border-radius: var(--radius-md);
}

.connect4-cell {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #1a1a2e;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid #444;
}

.connect4-cell:hover {
    background: #3a3a5e;
    transform: scale(1.05);
}

.connect4-cell.ai {
    background: radial-gradient(circle at 30% 30%, #ff6b6b, #e74c3c);
    box-shadow: inset 0 -3px 10px rgba(0, 0, 0, 0.3), 0 0 15px rgba(231, 76, 60, 0.5);
}

.connect4-cell.player {
    background: radial-gradient(circle at 30% 30%, #ffd93d, #f1c40f);
    box-shadow: inset 0 -3px 10px rgba(0, 0, 0, 0.3), 0 0 15px rgba(241, 196, 15, 0.5);
}

/* Connect 4 Results Overlay */
.connect4-results-overlay {
    background: rgba(45, 52, 54, 0.95);
    border: 2px solid #74b9ff;
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-top: var(--spacing-md);
    width: 100%;
    max-width: 400px;
    text-align: center;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    animation: fadeIn 0.3s ease;
}

.connect4-results-icon {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-xs);
}

.connect4-results-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #74b9ff;
}

.connect4-results-subtitle {
    font-size: 1rem;
    color: #dfe6e9;
    margin-bottom: var(--spacing-sm);
}

.connect4-continue-btn {
    background: linear-gradient(135deg, #0984e3, #74b9ff);
    border: 2px solid #0984e3;
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: 0 4px 15px rgba(9, 132, 227, 0.4);
}

.connect4-continue-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(9, 132, 227, 0.6);
}

/* ============================================
   TIC-TAC-TOE BOARD
   ============================================ */

.tictactoe-board {
    display: grid;
    grid-template-columns: repeat(3, 80px);
    grid-template-rows: repeat(3, 80px);
    gap: 8px;
    background: #2d3436;
    padding: 12px;
    border-radius: var(--radius-md);
}

.tictactoe-cell {
    width: 80px;
    height: 80px;
    background: #1a1a2e;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    transition: all 0.2s ease;
    border: 2px solid #444;
}

.tictactoe-cell:hover {
    background: #3a3a5e;
    transform: scale(1.05);
}

.tictactoe-cell.ai {
    color: #e74c3c;
    text-shadow: 0 0 15px rgba(231, 76, 60, 0.7);
}

.tictactoe-cell.player {
    color: #3498db;
    text-shadow: 0 0 15px rgba(52, 152, 219, 0.7);
}

/* Tic-Tac-Toe Results Overlay */
.tictactoe-results-overlay {
    background: rgba(45, 52, 54, 0.95);
    border: 2px solid #a4b0be;
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-top: var(--spacing-md);
    width: 100%;
    max-width: 300px;
    text-align: center;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    animation: fadeIn 0.3s ease;
}

.tictactoe-results-icon {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-xs);
}

.tictactoe-results-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #3498db;
}

.tictactoe-results-subtitle {
    font-size: 1rem;
    color: #dfe6e9;
    margin-bottom: var(--spacing-sm);
}

.tictactoe-continue-btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    border: 2px solid #3498db;
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
}

.tictactoe-continue-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.6);
}

/* ============================================
   ROCK-PAPER-SCISSORS-WELL (PFCP)
   ============================================ */

.rps-board {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    width: 100%;
    max-width: 420px;
}

.rps-prompt {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-light);
    text-align: center;
}

.rps-choices {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
}

.rps-choice-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 18px 12px;
    background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    color: var(--text-light);
}

.rps-choice-btn:hover {
    transform: scale(1.08);
    border-color: #e67e22;
    background: linear-gradient(135deg, rgba(230,126,34,0.2), rgba(230,126,34,0.08));
    box-shadow: 0 0 20px rgba(230,126,34,0.3);
}

.rps-choice-btn:active {
    transform: scale(0.95);
}

.rps-choice-emoji {
    font-size: 2.5rem;
}

.rps-choice-label {
    font-size: 0.95rem;
    font-weight: 600;
}

/* Rules box */
.rps-rules {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    width: 100%;
    font-size: 0.8rem;
    color: #b2bec3;
    line-height: 1.6;
}

.rps-rules-title {
    font-weight: 700;
    color: #dfe6e9;
    margin-bottom: 4px;
    font-size: 0.85rem;
}

.rps-rule-danger {
    color: #ff6b6b;
    font-weight: 600;
}

/* Waiting state */
.rps-waiting {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
}

.rps-your-pick {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-light);
}

.rps-waiting-text {
    font-size: 1.2rem;
    color: #ffa502;
    animation: pulse 1s infinite;
}

/* Reveal phase */
.rps-reveal {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    width: 100%;
    justify-content: center;
}

.rps-reveal-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    background: rgba(255,255,255,0.05);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-md);
    min-width: 120px;
    animation: fadeIn 0.4s ease;
}

.rps-reveal-side.winner {
    border-color: #2ed573;
    background: rgba(46,213,115,0.1);
    box-shadow: 0 0 20px rgba(46,213,115,0.2);
}

.rps-reveal-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #b2bec3;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.rps-reveal-emoji {
    font-size: 3rem;
}

.rps-reveal-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-light);
}

.rps-reveal-vs {
    font-size: 1.5rem;
    font-weight: 800;
    color: #636e72;
}

/* ============================================
   JEU DES BATONNETS (NIM)
   ============================================ */

.nim-board {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    width: 100%;
    max-width: 400px;
}

.nim-sticks-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    background: rgba(0,0,0,0.3);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255,255,255,0.1);
    min-height: 80px;
    width: 100%;
}

.nim-sticks-row {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.nim-stick {
    width: 8px;
    height: 50px;
    background: linear-gradient(180deg, #f9ca24, #f0932b);
    border-radius: 4px;
    box-shadow: 0 0 8px rgba(249,202,36,0.4);
    transition: all 0.3s ease;
}

.nim-counter {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-light);
}

.nim-last-move {
    font-size: 0.9rem;
    color: #b2bec3;
    font-style: italic;
}

.nim-actions {
    display: flex;
    gap: 10px;
}

.nim-take-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, rgba(142,68,173,0.3), rgba(142,68,173,0.15));
    border: 2px solid #8e44ad;
    border-radius: var(--radius-md);
    color: var(--text-light);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nim-take-btn:hover:not(.disabled) {
    transform: scale(1.08);
    background: linear-gradient(135deg, rgba(142,68,173,0.5), rgba(142,68,173,0.3));
    box-shadow: 0 0 15px rgba(142,68,173,0.4);
}

.nim-take-btn:active:not(.disabled) {
    transform: scale(0.95);
}

.nim-take-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: #636e72;
}

.nim-rules {
    font-size: 0.85rem;
    color: #ff6b6b;
    font-weight: 600;
    text-align: center;
}

/* ============================================
   CLICK DUEL (PvP Race to 100)
   ============================================ */

/* ============================================
   SUMO (ancien Click Duel)
   ============================================ */

.sumo-board {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    padding: 0.5rem;
    width: 100%;
}

.sumo-countdown {
    font-size: 4rem;
    font-weight: 800;
    color: var(--accent-gold);
    text-align: center;
    min-height: 5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clickduel-countdown-active { animation: clickduel-pulse 0.5s ease-in-out; }
.clickduel-countdown-go { color: var(--accent-green); animation: clickduel-go 0.4s ease-out; }

@keyframes clickduel-pulse {
    0% { transform: scale(1.5); opacity: 0.3; }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes clickduel-go {
    0% { transform: scale(2); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.sumo-arena {
    width: 100%;
    position: relative;
}

.sumo-label {
    position: absolute;
    top: 0;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    max-width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sumo-label-left { left: 0; }
.sumo-label-right { right: 0; text-align: right; }

.sumo-ring {
    margin-top: 1.4rem;
    width: 100%;
    height: 70px;
    background: linear-gradient(180deg, #3d2b1f 60%, #5a3825 100%);
    border-radius: 35px;
    border: 3px solid #8b5e3c;
    box-shadow: inset 0 4px 12px rgba(0,0,0,0.5), 0 0 20px rgba(139,94,60,0.3);
    position: relative;
    overflow: visible;
}

.sumo-edge {
    position: absolute;
    top: 0; bottom: 0;
    width: 6px;
    background: #ff6b35;
    border-radius: 3px;
    box-shadow: 0 0 8px rgba(255,107,53,0.8);
}
.sumo-edge-left { left: 0; border-radius: 35px 0 0 35px; }
.sumo-edge-right { right: 0; border-radius: 0 35px 35px 0; }

.sumo-fighters {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    transition: left 0.12s ease-out;
    font-size: 2.2rem;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6));
}

.sumo-fighter-me { transform: scaleX(1); }
.sumo-fighter-op { transform: scaleX(-1); }

.sumo-scores {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.8rem;
    margin-top: 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-family: 'Outfit', monospace;
}
.sumo-score-me { color: #7bed9f; }
.sumo-score-sep { color: var(--text-secondary); }
.sumo-score-op { color: #ff6b9d; }

.sumo-diff {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
}

.sumo-btn {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 4px solid #e67e22;
    background: linear-gradient(135deg, #ff9f43, #e67e22);
    color: white;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.05s ease, box-shadow 0.1s ease;
    box-shadow: 0 6px 20px rgba(255, 159, 67, 0.4);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.sumo-btn:not(:disabled):active,
.sumo-btn-pressed {
    transform: scale(0.92);
    box-shadow: 0 2px 8px rgba(255, 159, 67, 0.3);
}
.sumo-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

@media (max-width: 600px) {
    .sumo-btn { width: 120px; height: 120px; font-size: 0.95rem; }
    .sumo-fighters { font-size: 1.8rem; }
}

/* ============================================
   JEU DE LA CONFIANCE
   ============================================ */

.trust-board {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
    width: 100%;
}

.trust-pot {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-gold);
    text-align: center;
}

.trust-rules {
    background: rgba(255,255,255,0.04);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.trust-rule {
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.trust-rule b { color: var(--text-primary); }

.trust-actions {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.trust-btn {
    flex: 1;
    padding: 0.9rem 1.2rem;
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-fast);
    touch-action: manipulation;
    user-select: none;
}
.trust-btn-collab {
    background: linear-gradient(135deg, #2ed573, #17c15e);
    border-color: #2ed573;
    color: #0a2e1a;
    box-shadow: 0 4px 14px rgba(46,213,115,0.3);
}
.trust-btn-collab:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(46,213,115,0.45); }
.trust-btn-steal {
    background: linear-gradient(135deg, #ff4757, #c0392b);
    border-color: #ff4757;
    color: white;
    box-shadow: 0 4px 14px rgba(255,71,87,0.3);
}
.trust-btn-steal:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(255,71,87,0.45); }

.trust-waiting {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem;
}
.trust-waiting-icon { font-size: 2.5rem; }
.trust-waiting-text { color: var(--text-secondary); font-size: 0.9rem; text-align: center; }

.trust-reveal {
    gap: 1.2rem;
}
.trust-choices-reveal {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
}
.trust-reveal-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255,255,255,0.04);
    border-radius: var(--radius-md);
    padding: 0.75rem;
}
.trust-reveal-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.trust-reveal-choice {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}
.trust-reveal-vs {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-secondary);
}
.trust-outcome {
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    background: rgba(255,255,255,0.06);
    border-radius: var(--radius-md);
    width: 100%;
}

/* ============================================
   CHESS BOARD
   ============================================ */

.chess-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
}

.chess-board {
    display: grid;
    grid-template-columns: repeat(8, 45px);
    grid-template-rows: repeat(8, 45px);
    border: 3px solid #5d4e37;
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.chess-cell {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.chess-cell.light {
    background: #f0d9b5;
}

.chess-cell.dark {
    background: #b58863;
}

.chess-cell:hover {
    filter: brightness(1.1);
}

.chess-cell.selected {
    background: #7fc97f !important;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
}

.chess-cell.valid-target {
    position: relative;
}

.chess-cell.valid-target::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: rgba(0, 128, 0, 0.5);
    border-radius: 50%;
    pointer-events: none;
}

.chess-piece {
    font-size: 2rem;
    line-height: 1;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    user-select: none;
}

.chess-piece.player {
    color: #ffffff;
    text-shadow:
        1px 1px 0 #000,
        -1px 1px 0 #000,
        1px -1px 0 #000,
        -1px -1px 0 #000,
        0 2px 4px rgba(0, 0, 0, 0.5);
}

.chess-piece.ai {
    color: #1a1a1a;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.chess-status-indicator {
    padding: var(--spacing-xs) var(--spacing-md);
    font-weight: 700;
    border-radius: var(--radius-sm);
}

.chess-status-indicator.in-check {
    background: #ff4757;
    color: white;
    animation: pulse 0.5s ease infinite;
}

/* Chess Results Overlay */
.chess-results-overlay {
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid #b58863;
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    width: 100%;
    text-align: center;
    color: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    animation: fadeIn 0.3s ease;
}

.chess-results-icon {
    font-size: 3rem;
}

.chess-results-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffeaa7;
    text-shadow: 0 0 10px rgba(255, 234, 167, 0.5);
}

.chess-results-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
}

.chess-continue-btn {
    margin-top: var(--spacing-sm);
    background: linear-gradient(135deg, #2ed573, #1e9c57);
    border: 2px solid #2ed573;
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-xl);
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: 0 4px 15px rgba(46, 213, 115, 0.4);
}

.chess-continue-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(46, 213, 115, 0.6);
}

/* ============================================
   GO BOARD
   ============================================ */

.go-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
}

.go-board {
    display: grid;
    grid-template-columns: repeat(9, 35px);
    grid-template-rows: repeat(9, 35px);
    background: #dcb35c;
    background-image:
        linear-gradient(rgba(139, 90, 43, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139, 90, 43, 0.1) 1px, transparent 1px);
    background-size: 35px 35px;
    padding: 15px;
    border-radius: var(--radius-md);
    box-shadow:
        inset 0 0 20px rgba(139, 90, 43, 0.3),
        0 8px 25px rgba(0, 0, 0, 0.4);
    border: 3px solid #8b5a2b;
}

.go-cell {
    width: 35px;
    height: 35px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Grid lines */
.go-cell::before {
    content: '';
    position: absolute;
    background: #5d4e37;
}

.go-cell::before {
    width: 1px;
    height: 100%;
    left: 50%;
    top: 0;
}

.go-cell::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 1px;
    left: 0;
    top: 50%;
    background: #5d4e37;
}

/* Edge cells - shorter lines */
.go-cell.top::before {
    height: 50%;
    top: 50%;
}

.go-cell.bottom::before {
    height: 50%;
}

.go-cell.left::after {
    width: 50%;
    left: 50%;
}

.go-cell.right::after {
    width: 50%;
}

/* Star points (hoshi) */
.go-cell.star-point::before {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: #5d4e37;
    border-radius: 50%;
    z-index: 1;
    left: calc(50% - 4px);
    top: calc(50% - 4px);
}

.go-cell:hover {
    filter: brightness(1.05);
}

.go-stone {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    position: relative;
    z-index: 2;
    box-shadow:
        2px 2px 4px rgba(0, 0, 0, 0.4),
        inset -2px -2px 6px rgba(0, 0, 0, 0.2),
        inset 3px 3px 6px rgba(255, 255, 255, 0.1);
}

.go-stone.player {
    background: radial-gradient(circle at 30% 30%, #ffffff, #e0e0e0, #b0b0b0);
}

.go-stone.ai {
    background: radial-gradient(circle at 30% 30%, #4a4a4a, #2a2a2a, #0a0a0a);
}

.go-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
}

.go-score {
    display: flex;
    gap: var(--spacing-md);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.go-pass-btn {
    background: linear-gradient(135deg, #636e72, #2d3436);
    border: 2px solid #636e72;
    border-radius: var(--radius-md);
    padding: var(--spacing-xs) var(--spacing-md);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: var(--transition-normal);
}

.go-pass-btn:hover {
    transform: scale(1.05);
    background: linear-gradient(135deg, #74b9ff, #0984e3);
}

/* Go Results Panel (below board, not overlay) */
.go-results-overlay {
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid #dcb35c;
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    width: 100%;
    color: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    animation: fadeIn 0.3s ease;
}

.go-results-title {
    font-size: 1.5rem;
    font-weight: 800;
    text-align: center;
    color: #ffeaa7;
    text-shadow: 0 0 10px rgba(255, 234, 167, 0.5);
}

.go-results-grid {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: var(--spacing-md);
}

.results-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.results-column.player {
    color: #ffffff;
}

.results-column.ai {
    color: #adb5bd;
}

.side-name {
    font-weight: 700;
    font-size: 0.8rem;
    margin-bottom: var(--spacing-xs);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 4px;
}

.score-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

.score-total {
    margin-top: var(--spacing-xs);
    font-size: 1.1rem;
    font-weight: 800;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    padding-top: 4px;
    color: #2ed573;
}

.ai .score-total {
    color: #ff4757;
}

.results-divider {
    display: flex;
    align-items: center;
    font-weight: 800;
    font-style: italic;
    color: #dcb35c;
}

/* Territory Markers */
.go-territory-marker {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    z-index: 1;
}

.go-territory-marker.player {
    background: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.go-territory-marker.ai {
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}


@keyframes zoomIn {
    from {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }

    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.go-continue-btn {
    margin-top: var(--spacing-md);
    background: linear-gradient(135deg, #2ed573, #1e9c57);
    border: 2px solid #2ed573;
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-xl);
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: 0 4px 15px rgba(46, 213, 115, 0.4);
}

.go-continue-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(46, 213, 115, 0.6);
}

/* ============================================
   QUIZ MODAL - "QUI VEUT GAGNER DES PICHES"
   Style authentique QVGDM
   ============================================ */

.quiz-modal {
    position: fixed;
    inset: 0;
    background: rgba(4, 6, 10, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.quiz-modal.show {
    opacity: 1;
}

.quiz-content {
    /* Fond violet/bleu QVGDM dans le cadre */
    background:
        radial-gradient(ellipse at 50% 30%, rgba(138, 43, 226, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(75, 0, 130, 0.2) 0%, transparent 40%),
        linear-gradient(180deg, #1a0a2e 0%, #0d1b2a 50%, #0a0a20 100%);
    border: 3px solid rgba(138, 43, 226, 0.6);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 95%;
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    box-shadow:
        0 0 40px rgba(138, 43, 226, 0.4),
        0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.quiz-header {
    text-align: center;
    /* Enable header */
    display: block;
    margin-bottom: var(--spacing-md);
}

.quiz-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

.quiz-stake {
    margin-top: var(--spacing-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    font-size: 1.1rem;
}

.stake-label {
    color: var(--text-secondary);
}

.stake-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: #2ed573;
    text-shadow: 0 0 15px rgba(46, 213, 115, 0.6);
}

.stake-icon {
    font-size: 1.3rem;
}

/* Question en forme de losange/hexagone */
.quiz-question-container {
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(30, 40, 80, 0.95) 5%,
            rgba(40, 50, 100, 0.98) 50%,
            rgba(30, 40, 80, 0.95) 95%,
            transparent 100%);
    border: none;
    border-top: 2px solid rgba(100, 150, 255, 0.5);
    border-bottom: 2px solid rgba(100, 150, 255, 0.5);
    padding: var(--spacing-lg) var(--spacing-xl);
    position: relative;
    clip-path: polygon(3% 50%, 0% 0%, 97% 0%, 100% 50%, 97% 100%, 0% 100%);
    margin: 0 auto;
    max-width: 90%;
}

.quiz-question-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
            rgba(100, 150, 255, 0.1) 0%,
            transparent 20%,
            transparent 80%,
            rgba(100, 150, 255, 0.1) 100%);
    pointer-events: none;
}

.quiz-question {
    font-size: 1.1rem;
    font-weight: 500;
    color: #fff;
    text-align: center;
    line-height: 1.6;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Grille des réponses style QVGDM */
.quiz-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: var(--spacing-sm);
}

/* Bouton réponse en forme de losange/hexagone */
.quiz-choice {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(20, 30, 60, 0.95) 3%,
            rgba(30, 45, 80, 0.98) 50%,
            rgba(20, 30, 60, 0.95) 97%,
            transparent 100%);
    border: none;
    border-top: 1px solid rgba(80, 120, 200, 0.4);
    border-bottom: 1px solid rgba(80, 120, 200, 0.4);
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    text-align: left;
    color: #fff;
    clip-path: polygon(2% 50%, 0% 0%, 98% 0%, 100% 50%, 98% 100%, 0% 100%);
    position: relative;
    min-height: 50px;
}

.quiz-choice::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
            rgba(255, 255, 255, 0.05) 0%,
            transparent 50%,
            rgba(0, 0, 0, 0.1) 100%);
    pointer-events: none;
}

.quiz-choice:hover:not(:disabled) {
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(243, 156, 18, 0.4) 3%,
            rgba(230, 126, 34, 0.5) 50%,
            rgba(243, 156, 18, 0.4) 97%,
            transparent 100%);
    border-top-color: rgba(243, 156, 18, 0.8);
    border-bottom-color: rgba(243, 156, 18, 0.8);
}

.quiz-choice:disabled {
    cursor: not-allowed;
}

.quiz-choice.selected {
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(243, 156, 18, 0.6) 3%,
            rgba(255, 165, 0, 0.7) 50%,
            rgba(243, 156, 18, 0.6) 97%,
            transparent 100%);
    border-top-color: #ffa500;
    border-bottom-color: #ffa500;
}

.quiz-choice.blink {
    opacity: 0.4;
}

.quiz-choice.correct {
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(46, 213, 115, 0.6) 3%,
            rgba(39, 174, 96, 0.8) 50%,
            rgba(46, 213, 115, 0.6) 97%,
            transparent 100%) !important;
    border-top-color: #2ed573 !important;
    border-bottom-color: #2ed573 !important;
    animation: correctPulse 0.5s ease;
}

.quiz-choice.wrong {
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 71, 87, 0.6) 3%,
            rgba(231, 76, 60, 0.8) 50%,
            rgba(255, 71, 87, 0.6) 97%,
            transparent 100%) !important;
    border-top-color: #ff4757 !important;
    border-bottom-color: #ff4757 !important;
    animation: wrongShake 0.4s ease;
}

@keyframes correctPulse {

    0%,
    100% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.3);
    }
}

@keyframes wrongShake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-8px);
    }

    40% {
        transform: translateX(8px);
    }

    60% {
        transform: translateX(-6px);
    }

    80% {
        transform: translateX(6px);
    }
}

/* Lettre style QVGDM (hexagone orange) */
.choice-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    font-size: 0.9rem;
    font-weight: 800;
    color: #1a1a2e;
    flex-shrink: 0;
}

.choice-text {
    font-size: 0.9rem;
    line-height: 1.3;
    flex: 1;
}

.quiz-actions {
    text-align: center;
}

.quiz-flee-btn {
    background: linear-gradient(135deg, #636e72, #2d3436);
    border: 2px solid #636e72;
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-xl);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: var(--transition-normal);
}

.quiz-flee-btn:hover {
    transform: scale(1.05);
    background: linear-gradient(135deg, #74b9ff, #0984e3);
}

.quiz-result {
    display: none;
    text-align: center;
    padding: var(--spacing-lg);
}

.quiz-result.show {
    display: block;
    animation: resultSlideIn 0.5s ease-out;
}

@keyframes resultSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-win,
.result-lose,
.result-flee {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
}

.result-icon {
    font-size: 4rem;
    animation: resultBounce 0.5s ease;
}

@keyframes resultBounce {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }
}

.result-text {
    font-size: 1.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.result-win .result-text {
    color: #2ed573;
    text-shadow: 0 0 20px rgba(46, 213, 115, 0.8);
}

.result-lose .result-text {
    color: #ff4757;
    text-shadow: 0 0 20px rgba(255, 71, 87, 0.8);
}

.result-flee .result-text {
    color: #ffa502;
    font-size: 1.2rem;
}

.result-reward {
    font-size: 2rem;
    font-weight: 800;
    color: #2ed573;
    text-shadow: 0 0 15px rgba(46, 213, 115, 0.6);
}

.result-penalty {
    font-size: 2rem;
    font-weight: 800;
    color: #ff4757;
    text-shadow: 0 0 15px rgba(255, 71, 87, 0.6);
}

.quiz-continue-btn {
    background: linear-gradient(135deg, #a55eea, #8854d0);
    border: 2px solid #a55eea;
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-xl);
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: 0 4px 15px rgba(165, 94, 234, 0.4);
    margin-top: var(--spacing-md);
}

.quiz-continue-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(165, 94, 234, 0.6);
}

/* Responsive quiz */
@media (max-width: 600px) {
    .quiz-choices {
        grid-template-columns: 1fr;
    }

    .quiz-logo {
        font-size: 1.5rem;
    }

    .quiz-question {
        font-size: 1rem;
    }
}

/* ============================================
   CHICKEN MODE - Konami Code Easter Egg 🐔
   ============================================ */
body.chicken-mode {
    --bg-dark: #2e1a1a;
    --bg-medium: #4a2d2d;
    --bg-light: #5c3d3d;
    --bg-card: rgba(74, 45, 45, 0.8);

    --accent-orange: #ff6b6b;
    --accent-pink: #ff9ff3;
    --accent-green: #ff6b6b;
    /* Red instead of green */
    --accent-gold: #ffd93d;

    --text-secondary: #d4b8b8;
    --text-muted: #9a7a7a;

    --glow-green: 0 0 20px rgba(255, 107, 107, 0.4);
    --glow-orange: 0 0 20px rgba(255, 107, 107, 0.4);
}

body.chicken-mode .stats-bar {
    border-bottom-color: #ff6b6b;
    background: rgba(46, 26, 26, 0.98);
}

body.chicken-mode .koala-button {
    border-color: #ff6b6b;
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.4), 0 10px 40px rgba(0, 0, 0, 0.4);
}

body.chicken-mode .koala-button:hover {
    border-color: var(--accent-gold);
}

body.chicken-mode .section-title {
    border-bottom-color: #ff6b6b;
}

/* Item production text */
body.chicken-mode .item-production {
    color: #ff9f43;
    /* Orange instead of green */
}

/* Item owned count */
body.chicken-mode .item-owned {
    color: #ff9f43;
    /* Orange */
}

/* Rate values (per sec, per click) */
body.chicken-mode .rate-value {
    color: #ff6b6b;
}

/* Shop/Upgrade items borders */
body.chicken-mode .shop-item,
body.chicken-mode .upgrade-item {
    background: rgba(92, 61, 61, 0.6);
}

body.chicken-mode .shop-item.affordable,
body.chicken-mode .upgrade-item.affordable {
    border-color: var(--accent-gold);
    box-shadow: inset 0 0 15px rgba(255, 211, 42, 0.15);
}

body.chicken-mode .shop-item:hover,
body.chicken-mode .upgrade-item:hover {
    border-color: #ff6b6b;
    background: rgba(255, 107, 107, 0.15);
}

/* Item icons borders */
body.chicken-mode .item-icon {
    border-color: rgba(255, 107, 107, 0.3);
}

/* Stacked icons */
body.chicken-mode .stacked-icon {
    border-color: #ff6b6b;
}

/* Visual zone border */
body.chicken-mode .visual-zone {
    border-color: rgba(255, 107, 107, 0.2);
}

/* Upgrades and shop sections */
body.chicken-mode .upgrades-section,
body.chicken-mode .shop-section {
    border-color: rgba(255, 107, 107, 0.2);
}

/* Save indicator */
body.chicken-mode .save-indicator {
    border-color: #ff6b6b;
    color: #ff6b6b;
}

/* Achievement popup */
body.chicken-mode .achievement-popup {
    border-color: #ff6b6b;
}

/* ============================================
   LOBBY - GAME RULES BOX
   ============================================ */

.lobby-rules-box {
    margin: -0.25rem 0 0.25rem;
}

.rules-text {
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.04);
    border-left: 3px solid var(--accent-green);
    border-radius: 0 6px 6px 0;
    padding: 0.5rem 0.75rem;
}

.rules-text b { color: var(--text-primary); }

/* Rules also shown in waiting room */
.waiting-rules {
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.04);
    border-left: 3px solid var(--accent-green);
    border-radius: 0 6px 6px 0;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
}

.waiting-rules b { color: var(--text-primary); }

/* ============================================
   BUGHOUSE WAITING ROOM - Team layout
   ============================================ */

.bh-waiting-teams {
    display: flex;
    gap: 0.75rem;
    width: 100%;
}

.bh-waiting-team {
    flex: 1;
    border: 2px solid;
    border-radius: 8px;
    padding: 0.5rem 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.bh-waiting-team-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 0.1rem;
}

.bh-waiting-seat {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    background: rgba(255,255,255,0.04);
    border-radius: 5px;
    padding: 0.3rem 0.4rem;
    font-size: 0.72rem;
}

.bh-waiting-seat.occupied { background: rgba(255,255,255,0.08); }

.bh-ws-board { opacity: 0.55; font-size: 0.65rem; }
.bh-ws-side  { opacity: 0.7; font-size: 0.68rem; }
.bh-ws-name  { font-weight: 600; color: var(--text-primary); font-size: 0.75rem; }

/* ============================================
   BUGHOUSE CHESS 2v2
   ============================================ */

.bughouse-wrapper {
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    overflow-x: auto;
    padding: 0.25rem 0;
}

.bughouse-board-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
}

.bughouse-board-label {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-align: center;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: rgba(0,0,0,0.2);
}

.bughouse-turn-indicator {
    color: var(--accent-gold);
    animation: pulse-text 1s ease-in-out infinite;
}

@keyframes pulse-text {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Chess board */
.bughouse-chess-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    width: min(36vw, 280px);
    height: min(36vw, 280px);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.bughouse-chess-board.my-turn {
    border-color: var(--accent-gold);
    box-shadow: 0 0 8px rgba(255, 211, 42, 0.3);
}

.bughouse-chess-board.bh-sending {
    opacity: 0.6;
    pointer-events: none;
}

.bughouse-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    cursor: default;
    position: relative;
    transition: background 0.1s;
}

.bughouse-cell.light { background: #f0d9b5; }
.bughouse-cell.dark  { background: #b58863; }
.bughouse-cell.bh-selected { background: #f6f669 !important; }
.bughouse-cell.bh-valid-target::after {
    content: '';
    position: absolute;
    width: 32%;
    height: 32%;
    border-radius: 50%;
    background: rgba(0,0,0,0.25);
}
.bughouse-cell.bh-drop-target {
    background: rgba(100, 200, 255, 0.45) !important;
    box-shadow: inset 0 0 4px rgba(100,200,255,0.8);
}
.bughouse-cell.bh-check {
    background: rgba(220, 50, 50, 0.7) !important;
}

/* Piece */
.bughouse-piece {
    font-size: clamp(0.9rem, 3.5vw, 1.6rem);
    line-height: 1;
    user-select: none;
    cursor: pointer;
}
.bughouse-piece.bh-white { filter: drop-shadow(0 1px 1px rgba(0,0,0,0.5)); color: #fff; }
.bughouse-piece.bh-black { color: #1a1a1a; filter: drop-shadow(0 1px 0 rgba(255,255,255,0.3)); }
.bughouse-piece.my-piece { cursor: pointer; }

/* Pockets */
.bughouse-pocket {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2rem;
    padding: 0.3rem 0.4rem;
    background: rgba(0,0,0,0.25);
    border-radius: 6px;
    width: min(36vw, 280px);
    min-height: 2.2rem;
    box-sizing: border-box;
}

.pocket-header {
    width: 100%;
    font-size: 0.7rem;
    opacity: 0.8;
    margin-bottom: 0.1rem;
}

.pocket-name { font-weight: 600; }

.pocket-empty {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0 0.25rem;
}

.pocket-piece-btn {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    padding: 0.15rem 0.3rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: background 0.15s, border-color 0.15s;
    font-size: 0.8rem;
}

.pocket-piece-btn:hover:not(:disabled) {
    background: rgba(255,255,255,0.18);
    border-color: var(--accent-gold);
}

.pocket-piece-btn.pocket-selected {
    background: rgba(255, 211, 42, 0.25);
    border-color: var(--accent-gold);
    box-shadow: 0 0 6px rgba(255, 211, 42, 0.4);
}

.pocket-piece-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.pocket-count {
    font-size: 0.65rem;
    opacity: 0.8;
}

/* Promotion modal */
.bughouse-promotion-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(30, 46, 30, 0.97);
    border: 2px solid var(--accent-gold);
    border-radius: 8px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    z-index: 10;
}

.promo-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.promo-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    padding: 0.3rem 0.6rem;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 1.4rem;
}
.promo-btn:hover { background: rgba(255,255,255,0.2); }

.promo-cancel {
    font-size: 0.7rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

/* Players bar - Bughouse teams */
.bh-team-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.6rem;
    border-left: 3px solid;
    border-radius: 4px;
    background: rgba(0,0,0,0.15);
    margin-bottom: 0.2rem;
    flex-wrap: wrap;
}

.bh-team-label {
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 4rem;
    letter-spacing: 0.05em;
}

.bh-player-chip {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    transition: background 0.2s;
}

.bh-player-chip.active-turn {
    background: rgba(255, 211, 42, 0.15);
    border-color: var(--accent-gold);
}

.bh-player-chip.mated {
    opacity: 0.5;
    text-decoration: line-through;
}

.bh-player-chip.is-me { font-weight: 700; }

.bh-board-tag {
    font-size: 0.6rem;
    opacity: 0.6;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    padding: 0.05rem 0.25rem;
}

.bh-side-icon { opacity: 0.7; }

.bh-player-name { max-width: 7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bh-turn-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-gold);
    animation: pulse-dot 1s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.7); }
}

.bh-mated-tag {
    font-size: 0.6rem;
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.15);
    border-radius: 3px;
    padding: 0.05rem 0.25rem;
}

/* Result screen */
.bh-result-teams {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.bh-result-team {
    border: 2px solid;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    min-width: 8rem;
}

.bh-result-team.result-winner {
    background: rgba(123, 237, 159, 0.1);
}

.bh-result-team-label {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.bh-result-player {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 0.15rem 0;
}

.bh-result-player.is-me {
    color: var(--text-primary);
    font-weight: 600;
}

/* Bughouse clocks */
.bh-clock {
    font-family: monospace;
    font-variant-numeric: tabular-nums;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    background: rgba(255,255,255,0.08);
    color: var(--text-secondary);
    margin-left: auto;
    min-width: 3rem;
    text-align: center;
}
.bh-clock.bh-clock-active {
    background: rgba(255,211,42,0.2);
    color: var(--accent-gold);
}
.bh-clock.bh-clock-low {
    color: #ff9f43;
}
.bh-clock.bh-clock-critical {
    color: #ff6b6b;
    animation: clock-blink 0.5s infinite;
}
@keyframes clock-blink {
    50% { opacity: 0.5; }
}

/* Lobby time control row */
.lobby-timecontrol-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.lobby-timecontrol-row select {
    flex: 1;
}
.lobby-tc {
    font-size: 0.7rem;
    color: #64c8ff;
    opacity: 0.8;
}
.waiting-badge.tc {
    background: rgba(100,200,255,0.15);
    color: #64c8ff;
}

/* Disconnection indicators */
.bh-player-chip.disconnected {
    opacity: 0.5;
    border-style: dashed;
    border-color: #ff6b6b;
}
.bh-disconnected-tag {
    font-size: 0.6rem;
    color: #ff6b6b;
    background: rgba(255,107,107,0.15);
    border-radius: 3px;
    padding: 0.05rem 0.25rem;
}

/* Mobile UX - touch optimization */
.bughouse-cell { touch-action: manipulation; }
.pocket-piece-btn { touch-action: manipulation; min-width: 44px; min-height: 44px; }
.promo-btn { touch-action: manipulation; min-width: 48px; min-height: 48px; }
.bughouse-chess-board { touch-action: none; }

/* Scroll lock for game modal */
#lobby-game-modal .multiplayer-modal-content { overscroll-behavior: contain; }

/* Mobile: stack boards vertically */
@media (max-width: 600px) {
    .bughouse-wrapper {
        flex-direction: column;
        align-items: center;
    }

    .bughouse-chess-board {
        width: min(90vw, 280px);
        height: min(90vw, 280px);
    }

    .bughouse-pocket {
        width: min(90vw, 280px);
    }
}

/* Landscape mobile: side by side */
@media (max-width: 600px) and (orientation: landscape) {
    .bughouse-wrapper {
        flex-direction: row;
        gap: 0.5rem;
    }
    .bughouse-chess-board {
        width: min(42vh, 240px);
        height: min(42vh, 240px);
    }
    .bughouse-pocket {
        width: min(42vh, 240px);
    }
    .bughouse-board-label {
        font-size: 0.65rem;
    }
    .game-players-bar {
        display: none;
    }
}

/* Secret Announcement Modal */
.secret-announcement {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: secretFadeIn 0.5s ease;
}

.secret-content {
    text-align: center;
    animation: secretBounce 0.5s ease;
}

.secret-icon {
    font-size: 8rem;
    animation: secretSpin 1s ease;
}

.secret-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: #ff6b6b;
    text-shadow: 0 0 30px rgba(255, 107, 107, 0.8);
    margin-top: 1rem;
}

.secret-subtitle {
    font-size: 1.5rem;
    color: #ffd93d;
    margin-top: 0.5rem;
}

.secret-hint {
    font-size: 0.9rem;
    color: #888;
    margin-top: 2rem;
    font-family: monospace;
}

@keyframes secretFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes secretBounce {
    0% {
        transform: scale(0.5);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes secretSpin {
    0% {
        transform: rotate(-360deg) scale(0);
    }

    100% {
        transform: rotate(0) scale(1);
    }
}

.secret-announcement.fade-out {
    animation: secretFadeOut 0.5s ease forwards;
}

@keyframes secretFadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* ============================================
   AUTH & LEADERBOARD
   ============================================ */
.auth-controls {
    margin-left: auto;
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    max-height: 500px;
    overflow-y: auto;
    padding-right: var(--spacing-xs);
}

.leaderboard-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm);
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
}

.leaderboard-item.is-me {
    background: rgba(123, 237, 159, 0.1);
    border-color: var(--accent-green);
}

.leaderboard-item .rank {
    font-weight: bold;
    width: 40px;
}

.leaderboard-item .player-name {
    flex: 1;
    font-weight: 600;
}

.leaderboard-item .score {
    color: var(--accent-gold);
    font-weight: bold;
}

.leaderboard-item .date {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-left: var(--spacing-md);
}

.leaderboard-item.rank-1 .rank {
    color: #ffd700;
    font-size: 1.2rem;
}

.leaderboard-item.rank-2 .rank {
    color: #c0c0c0;
    font-size: 1.1rem;
}

.leaderboard-item.rank-3 .rank {
    color: #cd7f32;
    font-size: 1.05rem;
}

.auth-buttons-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
}

.auth-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    border: none;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    transition: var(--transition-normal);
}

.auth-btn.google {
    background: white;
    color: #444;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.auth-btn.google:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}

.auth-btn.email {
    background: var(--bg-light);
    color: var(--text-primary);
    border: 1px solid var(--accent-green);
}

.auth-btn.email:hover {
    background: var(--bg-medium);
}

.or-divider {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: var(--spacing-xs) 0;
}

/* User Profile Button */
.user-profile-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    background: rgba(0, 0, 0, 0.2);
    padding: 5px 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--text-muted);
    color: var(--text-secondary);
    cursor: pointer;
}

.user-profile-btn:hover {
    background: rgba(0, 0, 0, 0.4);
    color: var(--text-primary);
}

/* ============================================
   PROFILE MODAL
   ============================================ */
.profile-body {
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
}

.profile-avatar {
    position: relative;
    width: 100px;
    height: 100px;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid var(--accent-green);
    box-shadow: var(--glow-green);
    object-fit: cover;
    background: var(--bg-medium);
}

.profile-info {
    text-align: center;
}

.profile-email {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-family: monospace;
}

.profile-mines-section {
    width: 100%;
}

.profile-mines-info {
    font-size: 0.95rem;
    color: var(--accent-gold);
    background: rgba(255, 211, 42, 0.08);
    border: 1px solid rgba(255, 211, 42, 0.2);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    text-align: center;
    margin-bottom: 6px;
}

.profile-mines-btn {
    width: 100%;
    padding: 8px;
    background: rgba(255, 211, 42, 0.1);
    border: 1px solid rgba(255, 211, 42, 0.3);
    border-radius: var(--radius-sm);
    color: var(--accent-gold);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.profile-mines-btn:hover {
    background: rgba(255, 211, 42, 0.2);
}

.profile-mines-btn-edit {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    font-size: 0.75rem;
}

.profile-mines-btn-edit:hover {
    background: rgba(255, 255, 255, 0.1);
}

.profile-pseudo-section {
    width: 100%;
}

.profile-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--spacing-xs);
}

.profile-pseudo-row {
    display: flex;
    gap: var(--spacing-xs);
    align-items: stretch;
}

.profile-input {
    flex: 1;
    padding: var(--spacing-sm);
    background: var(--bg-dark);
    border: 2px solid var(--bg-light);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    transition: var(--transition-normal);
}

.profile-input:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: var(--glow-green);
}

.profile-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.profile-save-btn {
    width: 48px;
    min-height: 48px;
    background: linear-gradient(135deg, var(--accent-green), #2ed573);
    border: none;
    border-radius: var(--radius-md);
    color: var(--bg-dark);
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.profile-save-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--glow-green);
}

.profile-save-btn:active {
    transform: scale(0.95);
}

.profile-actions {
    width: 100%;
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--bg-light);
}

.profile-logout-btn {
    width: 100%;
    padding: var(--spacing-sm);
    background: rgba(255, 100, 100, 0.15);
    border: 1px solid rgba(255, 100, 100, 0.4);
    border-radius: var(--radius-md);
    color: #ff6b6b;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
}

.profile-logout-btn:hover {
    background: rgba(255, 100, 100, 0.3);
    border-color: #ff6b6b;
}

/* Success feedback for save */
.profile-save-btn.success {
    background: linear-gradient(135deg, var(--accent-gold), #f1c40f);
    animation: saveSuccess 0.5s ease;
}

@keyframes saveSuccess {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-notification {
    position: fixed;
    bottom: var(--spacing-lg);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid var(--bg-light);
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-notification.toast-success {
    border-color: var(--accent-green);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), var(--glow-green);
}

.toast-notification.toast-error {
    border-color: #ff6b6b;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 107, 107, 0.4);
}

.toast-notification.toast-info {
    border-color: var(--accent-gold);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), var(--glow-gold);
}

.toast-icon {
    font-size: 1.3rem;
}

.toast-message {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================
   LEADERBOARD ZONE (Widget)
   ============================================ */
.leaderboard-zone {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    border: 1px solid rgba(123, 237, 159, 0.2);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    overflow: hidden;
}

/* Leaderboard prestige tabs */
.leaderboard-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: var(--spacing-sm);
}

.leaderboard-tabs-compact {
    gap: 2px;
    margin-bottom: var(--spacing-xs);
}

.leaderboard-tab {
    padding: 4px 10px;
    border: 1px solid var(--text-muted);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.75rem;
    transition: var(--transition-fast);
}

.leaderboard-tabs-compact .leaderboard-tab {
    padding: 2px 6px;
    font-size: 0.7rem;
}

.leaderboard-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-green);
}

.leaderboard-tab.active {
    background: var(--accent-green);
    color: var(--bg-dark);
    border-color: var(--accent-green);
    font-weight: 600;
}

/* Leaderboard search input */
.leaderboard-search-input {
    width: 100%;
    padding: 6px 12px;
    margin-bottom: var(--spacing-xs);
    border: 1px solid var(--text-muted);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition-fast);
    box-sizing: border-box;
}

.leaderboard-search-input:focus {
    border-color: var(--accent-green);
    background: rgba(255, 255, 255, 0.1);
}

.leaderboard-search-input::placeholder {
    color: var(--text-muted);
}

.leaderboard-prestige-badge {
    display: inline-block;
    background: var(--accent-gold);
    color: var(--bg-dark);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 8px;
    margin-left: 4px;
    vertical-align: middle;
}

.leaderboard-widget {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    padding-right: var(--spacing-xs);
}

.leaderboard-loading {
    text-align: center;
    color: var(--text-muted);
    padding: var(--spacing-lg);
    font-style: italic;
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: var(--transition-fast);
}

.leaderboard-entry:hover {
    background: rgba(123, 237, 159, 0.1);
    border-color: var(--accent-green);
}

.leaderboard-entry.is-me {
    background: rgba(123, 237, 159, 0.15);
    border-color: var(--accent-green);
    box-shadow: var(--glow-green);
}

/* My position banner (shown above the list when user is not in visible results) */
.leaderboard-my-position {
    margin-bottom: 8px;
    padding: 8px;
    background: rgba(123, 237, 159, 0.08);
    border: 1px solid var(--accent-green);
    border-radius: 8px;
}

.leaderboard-my-position-label {
    font-size: 0.7em;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-green);
    font-weight: 700;
    margin-bottom: 4px;
    opacity: 0.85;
}

.leaderboard-my-position .leaderboard-entry,
.leaderboard-my-position .leaderboard-item {
    margin-bottom: 0;
    border: none;
    background: transparent;
    box-shadow: none;
}

/* Podium styles */
.leaderboard-entry.rank-1 {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 215, 0, 0.05));
    border-color: #ffd700;
}

.leaderboard-entry.rank-2 {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.2), rgba(192, 192, 192, 0.05));
    border-color: #c0c0c0;
}

.leaderboard-entry.rank-3 {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.2), rgba(205, 127, 50, 0.05));
    border-color: #cd7f32;
}

.leaderboard-rank {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    background: var(--bg-medium);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    flex-shrink: 0;
}

.leaderboard-entry.rank-1 .leaderboard-rank {
    background: linear-gradient(135deg, #ffd700, #ffed4a);
    color: #1a2e1a;
}

.leaderboard-entry.rank-2 .leaderboard-rank {
    background: linear-gradient(135deg, #c0c0c0, #e8e8e8);
    color: #1a2e1a;
}

.leaderboard-entry.rank-3 .leaderboard-rank {
    background: linear-gradient(135deg, #cd7f32, #dda15e);
    color: #1a2e1a;
}

.leaderboard-name {
    flex: 1;
    font-weight: 600;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.leaderboard-realname {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leaderboard-realname-inline {
    font-size: 0.8em;
    color: var(--text-muted);
    font-weight: 400;
    opacity: 0.7;
}

.leaderboard-score {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--accent-gold);
    white-space: nowrap;
}

.leaderboard-refresh-btn {
    margin-top: var(--spacing-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--bg-medium);
    border: 1px solid var(--bg-light);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
}

.leaderboard-refresh-btn:hover {
    background: var(--bg-light);
    border-color: var(--accent-green);
    color: var(--text-primary);
}

.leaderboard-empty {
    text-align: center;
    color: var(--text-muted);
    padding: var(--spacing-lg);
    font-style: italic;
}

/* ============================================
   HEADER CONTROLS
   ============================================ */
.auth-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    height: 100%;
}

.header-btn {
    background: radial-gradient(circle, var(--bg-light) 0%, var(--bg-medium) 100%);
    border: 2px solid var(--accent-green);
    border-radius: var(--radius-md);
    padding: 0 1rem;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    /* Fixed height for perfect alignment */
    min-width: 44px;
    /* Ensure square look for icons */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    /* Override koala-button defaults if mixed */
    width: auto !important;
}

.header-btn:hover {
    border-color: var(--accent-gold);
    box-shadow: var(--glow-gold);
    transform: translateY(-2px);
    color: var(--accent-gold);
}

.header-btn:active {
    transform: translateY(0);
}

/* Specific adjustments */
.header-btn.user-profile-btn {
    border-color: var(--accent-green);
    background: rgba(45, 74, 45, 0.5);
    /* Slightly transparent */
    padding-right: 1.2rem;
}

.header-btn.user-profile-btn:hover {
    border-color: var(--accent-gold);
}

/* ============================================
   CHALLENGES / PVP SYSTEM
   ============================================ */

/* Challenge button in leaderboard */
.leaderboard-challenge-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    border: none;
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    color: white;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition-fast);
    margin-left: auto;
    flex-shrink: 0;
}

.leaderboard-challenge-btn:hover {
    background: linear-gradient(135deg, #ff5252 0%, #e53935 100%);
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
}

.leaderboard-challenge-btn.modal-btn {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Attack button (PvP invasions) */
.leaderboard-attack-btn {
    background: linear-gradient(135deg, #9c27b0 0%, #7b1fa2 100%);
    border: none;
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    color: white;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.leaderboard-attack-btn:hover {
    background: linear-gradient(135deg, #ab47bc 0%, #8e24aa 100%);
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(156, 39, 176, 0.5);
}

.leaderboard-attack-btn.modal-btn {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Attack Modal */
.attack-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.attack-modal {
    background: var(--glass-bg, rgba(30, 30, 50, 0.95));
    border: 1px solid rgba(156, 39, 176, 0.4);
    border-radius: var(--radius-lg, 16px);
    padding: 24px;
    min-width: 320px;
    max-width: 400px;
    box-shadow: 0 0 30px rgba(156, 39, 176, 0.3);
}

.attack-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.attack-modal-header h3 {
    margin: 0;
    color: #e1bee7;
    font-size: 1.1rem;
}

.attack-modal-close {
    background: none;
    border: none;
    color: #999;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.attack-modal-close:hover {
    color: #fff;
}

.attack-type-select {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.attack-type-btn {
    flex: 1;
    padding: 10px 8px;
    border: 2px solid rgba(156, 39, 176, 0.3);
    border-radius: var(--radius-sm, 8px);
    background: rgba(156, 39, 176, 0.1);
    color: #e1bee7;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-fast, 0.2s);
    text-align: center;
}

.attack-type-btn:hover:not(.disabled) {
    border-color: rgba(156, 39, 176, 0.6);
    background: rgba(156, 39, 176, 0.2);
}

.attack-type-btn.active {
    border-color: #9c27b0;
    background: rgba(156, 39, 176, 0.3);
    box-shadow: 0 0 10px rgba(156, 39, 176, 0.3);
}

.attack-type-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.attack-stock {
    display: block;
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 2px;
}

.attack-quantity-section {
    margin-bottom: 16px;
}

.attack-quantity-section label {
    display: block;
    color: #e1bee7;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.attack-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: rgba(156, 39, 176, 0.3);
    border-radius: 3px;
    outline: none;
}

.attack-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #9c27b0;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(156, 39, 176, 0.5);
}

.attack-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #9c27b0;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 6px rgba(156, 39, 176, 0.5);
}

.attack-send-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #9c27b0 0%, #7b1fa2 100%);
    border: none;
    border-radius: var(--radius-sm, 8px);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast, 0.2s);
}

.attack-send-btn:hover {
    background: linear-gradient(135deg, #ab47bc 0%, #8e24aa 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(156, 39, 176, 0.4);
}

/* PvP Announcement (red hostile theme) */
.pvp-announcement {
    border-color: #ff2222 !important;
    background: linear-gradient(135deg, #ff2222ee, #991111bb) !important;
    animation: pvp-pulse 0.5s ease-in-out 3;
}

@keyframes pvp-pulse {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 34, 34, 0.3); }
    50% { box-shadow: 0 0 40px rgba(255, 34, 34, 0.6); }
}

/* Leaderboard entry adjustment for challenge button */
.leaderboard-entry {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* Challenge Modal */
.challenge-modal {
    position: fixed;
    inset: 0;
    background: rgba(4, 6, 10, 0.88);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(6px);
    animation: fadeIn 0.3s ease;
}

.challenge-modal-content {
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-medium) 100%);
    border: 2px solid var(--accent-green);
    border-radius: var(--radius-lg);
    padding: 0;
    max-width: 500px;
    width: 92%;
    max-height: 85vh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 30px rgba(123, 237, 159, 0.2);
    overflow-y: auto;
    overscroll-behavior: contain;
    animation: mp-modal-in 0.25s cubic-bezier(0.34,1.56,0.64,1);
}

.challenge-modal-header {
    background: linear-gradient(90deg, rgba(123,237,159,0.1), transparent);
    padding: var(--spacing-sm) var(--spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(123,237,159,0.22);
    backdrop-filter: blur(6px);
}

.challenge-modal-header h2 {
    margin: 0;
    color: var(--accent-green);
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-shadow: 0 0 14px rgba(123,237,159,0.5);
}

.challenge-modal-header .close-modal {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    color: rgba(255,255,255,0.5);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.challenge-modal-header .close-modal:hover {
    background: rgba(255,56,96,0.18);
    border-color: #ff3860;
    color: #ff3860;
}

.challenge-modal-body {
    padding: var(--spacing-md);
}

.challenge-modal-body p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    text-align: center;
}

/* Game selection grid */
.challenge-game-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-xs);
}

.challenge-game-btn {
    background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-medium) 100%);
    border: 2px solid var(--accent-green);
    border-radius: var(--radius-md);
    padding: var(--spacing-xs) var(--spacing-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.challenge-game-btn:hover {
    border-color: var(--accent-gold);
    transform: translateY(-3px);
    box-shadow: var(--glow-gold);
}

.challenge-game-btn .game-icon {
    font-size: 1.2rem;
}

.challenge-game-btn .game-name {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
}

/* Random game button */
.challenge-game-btn-random {
    position: relative;
    border: 2px solid transparent;
    background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-medium) 100%) padding-box,
                linear-gradient(135deg, #ff6b9d, #ffd32a, #7bed9f, #70a1ff, #a29bfe, #ff6b9d) border-box;
}

.challenge-game-btn-random:hover {
    background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-medium) 100%) padding-box,
                linear-gradient(135deg, #ffd32a, #7bed9f, #70a1ff, #a29bfe, #ff6b9d, #ffd32a) border-box;
}

/* Ranked/Unranked toggle */
.challenge-ranked-toggle {
    margin-bottom: var(--spacing-md);
    text-align: center;
}

.ranked-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.ranked-toggle-label input[type="checkbox"] {
    display: none;
}

.ranked-toggle-slider {
    width: 40px;
    height: 22px;
    background: var(--bg-light);
    border-radius: 11px;
    position: relative;
    transition: var(--transition-fast);
    border: 1px solid var(--text-muted);
}

.ranked-toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: var(--transition-fast);
}

.ranked-toggle-label input:checked + .ranked-toggle-slider {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

.ranked-toggle-label input:checked + .ranked-toggle-slider::after {
    left: 20px;
    background: white;
}

/* Waiting modal */
.challenge-waiting-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-light);
    border-top-color: var(--accent-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: var(--spacing-md) auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.challenge-game-info {
    color: var(--accent-gold);
    font-weight: 600;
    font-size: 1.1rem;
    margin: var(--spacing-md) 0;
}

.challenge-cancel-btn {
    background: rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: var(--spacing-sm) var(--spacing-lg);
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.2s;
    margin-top: var(--spacing-md);
}

.challenge-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* Incoming challenge notification */
.challenge-incoming {
    border-color: var(--accent-gold);
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(255, 211, 42, 0.3);
    }

    50% {
        box-shadow: 0 0 40px rgba(255, 211, 42, 0.6);
    }
}

.challenger-info {
    text-align: center;
    margin-bottom: var(--spacing-md);
}

.challenger-name {
    color: var(--accent-gold);
    font-size: 1.2rem;
    font-weight: 700;
    display: block;
}

.challenge-text {
    color: var(--text-secondary);
    font-size: 1rem;
}

.challenge-game-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    background: var(--bg-light);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin: var(--spacing-md) 0;
}

.challenge-game-info .game-icon {
    font-size: 1.5rem;
}

.challenge-game-info .game-name {
    color: var(--text-primary);
    font-weight: 600;
}

.challenge-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    margin-top: var(--spacing-lg);
}

.challenge-accept-btn {
    background: linear-gradient(135deg, var(--accent-green) 0%, #5cb85c 100%);
    border: none;
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-xl);
    color: var(--bg-dark);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.challenge-accept-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(123, 237, 159, 0.5);
}

.challenge-decline-btn {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    border: none;
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-xl);
    color: white;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.challenge-decline-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(220, 53, 69, 0.5);
}

/* PvP Game Modal */
.pvp-game-modal .pvp-content {
    max-width: 550px;
}

.pvp-header {
    background: linear-gradient(90deg, rgba(108,92,231,0.15), transparent);
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: 1px solid rgba(108,92,231,0.25);
    backdrop-filter: blur(6px);
}

.pvp-players {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-lg);
    width: 100%;
}

.pvp-player {
    background: rgba(0, 0, 0, 0.3);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
}

.pvp-player.active {
    background: var(--accent-gold);
    color: var(--bg-dark);
    box-shadow: 0 0 15px rgba(255, 211, 42, 0.5);
}

.pvp-player .player-indicator {
    font-weight: 700;
    font-size: 1rem;
}

.pvp-vs {
    font-weight: 800;
    font-size: 1.2rem;
    color: white;
}

/* Challenge badge */
.challenge-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
}

/* Animation keyframes */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Stakes styles */
.challenge-stake-info {
    background: rgba(13,242,160,0.1);
    border: 1px solid rgba(13,242,160,0.25);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 20px;
    margin: var(--spacing-md) 0;
    text-align: center;
}

.challenge-stake-info .stake-label {
    color: rgba(13,242,160,0.8);
    font-weight: 700;
    display: inline;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
}

.challenge-stake-info .stake-value {
    color: #0df2a0;
    font-weight: 800;
    font-size: 1.1rem;
}

.challenge-stakes {
    background: var(--bg-light);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin: var(--spacing-md) 0;
}

.stake-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-xs) 0;
}

.stake-row.opponent .stake-value {
    color: var(--accent-gold);
    font-weight: 700;
}

.stake-row.you .stake-value {
    color: var(--accent-green);
    font-weight: 700;
}

.challenge-warning {
    color: #ff6b6b !important;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
    margin: var(--spacing-sm) 0 !important;
}

/* PvP stakes display */
.player-stake {
    display: block;
    font-size: 0.8rem;
    color: var(--accent-gold);
    margin-top: 4px;
}

.pvp-player.active .player-stake {
    color: var(--bg-dark);
}

.pvp-total-stake {
    background: rgba(13,242,160,0.1);
    border: 1px solid rgba(13,242,160,0.25);
    color: #0df2a0;
    padding: 3px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    margin-top: var(--spacing-sm);
    display: inline-block;
}

/* CHESS PIECE COLORS (Absolute) */
.chess-piece.chess-white {
    color: #f0f0f0;
    text-shadow: 1px 1px 2px #000;
}

.chess-piece.chess-black {
    color: #1a1a1a;
    text-shadow: 0 0 1px #fff;
}

/* ============================================
   CHESS PROMOTION MODAL
   ============================================ */
.chess-promotion-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(2px);
    animation: fadeIn 0.2s ease;
}

.chess-promotion-title {
    color: var(--accent-gold);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-md);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.promotion-options {
    display: flex;
    gap: var(--spacing-sm);
}

.promotion-piece {
    width: 60px;
    height: 60px;
    background: var(--bg-light);
    border: 2px solid var(--accent-green);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.promotion-piece:hover {
    background: var(--accent-green);
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(123, 237, 159, 0.4);
}

.promotion-piece.chess-white {
    color: #f0f0f0;
    text-shadow: 1px 1px 2px #000;
}

.promotion-piece.chess-black {
    color: #1a1a1a;
    text-shadow: 0 0 1px #fff;
}

/* ============================================
   GO JAPANESE RULES (Marking Phase)
   ============================================ */
.go-stone.dead {
    opacity: 0.4;
    filter: grayscale(100%);
    box-shadow: inset 0 0 5px #ff0000;
    /* Subtle red hint */
    transform: scale(0.9);
    transition: all 0.3s ease;
}

.go-controls {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    justify-content: center;
    width: 100%;
}

.go-btn {
    padding: 6px 14px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.88rem;
    font-family: inherit;
    color: white;
    transition: var(--transition-fast);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.go-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.go-btn:active {
    transform: translateY(0);
}

.go-btn.pass {
    background: #e74c3c;
}

.go-btn.confirm {
    background: #2ecc71;
}

.go-btn.resume {
    background: #f1c40f;
    color: #333;
}

.go-phase-indicator {
    text-align: center;
    font-weight: bold;
    margin-bottom: 10px;
    padding: 8px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.3);
    color: #ecf0f1;
    border-left: 4px solid transparent;
}

.go-phase-indicator.playing {
    border-left-color: #3498db;
}

.go-phase-indicator.marking {
    background: rgba(241, 196, 15, 0.2);
    color: #f1c40f;
    border-left-color: #f1c40f;
    animation: markingPulse 2s infinite;
}

.go-phase-indicator.finished {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
    border-left-color: #2ecc71;
}

@keyframes markingPulse {
    0% {
        background: rgba(241, 196, 15, 0.1);
    }

    50% {
        background: rgba(241, 196, 15, 0.3);
    }

    100% {
        background: rgba(241, 196, 15, 0.1);
    }
}

/* ============================================
   EVENT TIMER INDICATOR
   ============================================ */

.event-timer-indicator {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1000;
    transition: all 0.3s ease;
    opacity: 0.6;
}

.event-timer-indicator:hover {
    opacity: 1;
}

.event-timer-indicator.warning {
    background: rgba(231, 76, 60, 0.9);
    opacity: 1;
    animation: timerPulse 1s infinite;
}

.event-timer-indicator.paused {
    background: rgba(52, 73, 94, 0.9);
}

.event-timer-indicator .timer-icon {
    font-size: 16px;
}

.event-timer-indicator .timer-text {
    font-weight: 500;
    min-width: 50px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-family: 'Courier New', monospace;
}

@keyframes timerPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* Sync Timer Indicator (top right, like event timer) */
.sync-timer-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1000;
    transition: all 0.3s ease;
    opacity: 0.6;
}

.sync-timer-indicator:hover {
    opacity: 1;
}

.sync-timer-indicator.warning {
    background: rgba(52, 152, 219, 0.9);
    opacity: 1;
    animation: timerPulse 1s infinite;
}

.sync-timer-indicator.paused {
    background: rgba(52, 73, 94, 0.9);
}

.sync-timer-indicator .timer-icon {
    font-size: 16px;
}

.sync-timer-indicator .timer-text {
    font-weight: 500;
    min-width: 50px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-family: 'Courier New', monospace;
}

/* ============================================
   ONBOARDING WIZARD
   ============================================ */

.onboarding-modal {
    position: fixed;
    inset: 0;
    background: rgba(4, 6, 10, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    backdrop-filter: blur(6px);
}

.onboarding-content {
    background: var(--bg-card);
    border: 2px solid var(--accent-green);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 450px;
    max-height: 85vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
}

.onboarding-header {
    background: var(--accent-green);
    padding: var(--spacing-md) var(--spacing-lg);
    text-align: center;
}

.onboarding-header h2 {
    color: var(--bg-dark);
    margin: 0;
    font-size: 1.2rem;
}

.onboarding-body {
    padding: var(--spacing-lg);
    text-align: center;
    overflow-y: auto;
    flex: 1;
}

.onboarding-body p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.onboarding-actions {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
    margin-top: var(--spacing-md);
}

.onboarding-btn {
    padding: 10px 24px;
    border-radius: var(--radius-md);
    border: 2px solid var(--text-muted);
    background: var(--bg-light);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: var(--transition-fast);
}

.onboarding-btn-yes {
    background: var(--accent-green);
    color: var(--bg-dark);
    border-color: var(--accent-green);
}

.onboarding-btn-yes:hover {
    transform: translateY(-2px);
    box-shadow: var(--glow-green);
}

.onboarding-btn-no:hover,
.onboarding-btn-back:hover {
    border-color: var(--accent-green);
}

.onboarding-promo-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin: var(--spacing-md) 0;
    max-height: 200px;
    overflow-y: auto;
}

.onboarding-promo-btn {
    padding: 6px 14px;
    border: 1px solid var(--text-muted);
    border-radius: var(--radius-sm);
    background: var(--bg-light);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition-fast);
}

.onboarding-promo-btn:hover {
    border-color: var(--accent-green);
    background: rgba(123, 237, 159, 0.1);
}

.onboarding-name-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
    margin: var(--spacing-sm) 0;
    max-height: 250px;
    overflow-y: auto;
}

.onboarding-name-btn {
    padding: 4px 10px;
    border: 1px solid var(--text-muted);
    border-radius: var(--radius-sm);
    background: var(--bg-light);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition-fast);
}

.onboarding-name-btn:hover {
    border-color: var(--accent-green);
    background: rgba(123, 237, 159, 0.1);
}

.onboarding-search {
    width: 100%;
    padding: 8px 12px;
    margin-bottom: var(--spacing-sm);
    border: 1px solid var(--text-muted);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    box-sizing: border-box;
}

.onboarding-search:focus {
    border-color: var(--accent-green);
}

.onboarding-pseudo-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--accent-green);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-size: 1.1rem;
    text-align: center;
    outline: none;
    box-sizing: border-box;
}

/* ============================================
   JUICY EFFECTS SYSTEM
   ============================================ */

/* Combo Display — positioned below the koala button */
#combo-display {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: fit-content;
    margin: 12px auto 0 auto;
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    text-align: center;
    transform-origin: center center;
    background: none !important;
    background-color: transparent !important;
    backdrop-filter: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0;
    margin-bottom: 0;
    border-radius: 0;
}

#combo-display.active {
    opacity: 1;
}

#combo-display .combo-count {
    display: block;
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--accent-gold);
    text-shadow:
        0 0 10px rgba(255, 211, 42, 0.5),
        0 0 20px rgba(255, 211, 42, 0.2);
    line-height: 1;
    background: none !important;
    -webkit-text-stroke: none;
}

#combo-display .combo-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-top: 2px;
    background: none !important;
}

#combo-display.rare .combo-count {
    color: #70a1ff;
    text-shadow:
        0 0 10px rgba(112, 161, 255, 0.5),
        0 0 20px rgba(112, 161, 255, 0.2);
}

#combo-display.epic .combo-count {
    color: #a29bfe;
    text-shadow:
        0 0 10px rgba(162, 155, 254, 0.5),
        0 0 20px rgba(162, 155, 254, 0.2);
}

#combo-display.legendary .combo-count {
    color: #ff6b9d;
    text-shadow:
        0 0 12px rgba(255, 107, 157, 0.6),
        0 0 25px rgba(255, 107, 157, 0.25);
    animation: legendaryPulse 0.5s ease infinite;
}

@keyframes legendaryPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

#combo-display.pulse .combo-count {
    animation: comboPop 0.15s ease-out;
}

@keyframes comboPop {
    0% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Particle Effects */
.juice-particle {
    position: fixed;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    animation: particleFly 0.6s ease-out forwards;
}

@keyframes particleFly {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) scale(0);
    }
}

.juice-particle.purchase-particle {
    animation: particleFlyUp 0.6s ease-out forwards;
}

@keyframes particleFlyUp {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) scale(0.5);
    }
}

.juice-particle.milestone-particle {
    animation: particleBurst 0.8s ease-out forwards;
}

@keyframes particleBurst {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(0);
    }

    20% {
        transform: translate(0, 0) scale(1.5);
    }

    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) scale(0);
    }
}

/* Screen Flash */
#screen-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9996;
    opacity: 0;
    transition: opacity 0.1s ease;
}

#screen-flash.active {
    opacity: 1;
}

#screen-flash.flash-crit {
    background: radial-gradient(circle at center, rgba(255, 107, 157, 0.3) 0%, transparent 70%);
}

#screen-flash.flash-combo {
    background: radial-gradient(circle at center, rgba(255, 211, 42, 0.2) 0%, transparent 70%);
}

#screen-flash.flash-purchase {
    background: radial-gradient(circle at center, rgba(123, 237, 159, 0.2) 0%, transparent 70%);
}

#screen-flash.flash-achievement {
    background: radial-gradient(circle at center, rgba(255, 211, 42, 0.4) 0%, transparent 70%);
}

#screen-flash.flash-milestone {
    background: radial-gradient(circle at center, rgba(255, 211, 42, 0.5) 0%, transparent 60%);
}

/* Juice Shake */
@keyframes juice-shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px) rotate(-0.5deg);
    }

    50% {
        transform: translateX(5px) rotate(0.5deg);
    }

    75% {
        transform: translateX(-3px) rotate(-0.3deg);
    }
}

/* Juice Pulse for numbers */
.juice-pulse {
    animation: juicePulse 0.2s ease-out;
}

@keyframes juicePulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
    }
}

/* Confetti */
.confetti {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    animation: confettiFall 3s ease-out forwards;
    transform-origin: center;
}

@keyframes confettiFall {
    0% {
        opacity: 1;
        transform: translateY(0) translateX(0) rotate(0deg);
    }

    100% {
        opacity: 0;
        transform: translateY(100vh) translateX(var(--drift)) rotate(var(--rotation));
    }
}

/* Enhanced click number animation */
.click-number {
    animation: floatUpJuicy 0.8s ease-out forwards !important;
}

@keyframes floatUpJuicy {
    0% {
        opacity: 1;
        transform: translateY(0) scale(0.5);
    }

    20% {
        transform: translateY(-10px) scale(1.2);
    }

    100% {
        opacity: 0;
        transform: translateY(-80px) scale(0.8);
    }
}

.click-number.crit {
    animation: critFloatJuicy 1s ease-out forwards !important;
}

@keyframes critFloatJuicy {
    0% {
        opacity: 1;
        transform: translateY(0) scale(0.5) rotate(-5deg);
    }

    15% {
        transform: translateY(-15px) scale(1.5) rotate(5deg);
    }

    30% {
        transform: translateY(-25px) scale(1.3) rotate(-3deg);
    }

    100% {
        opacity: 0;
        transform: translateY(-100px) scale(0.6) rotate(0deg);
    }
}

/* Enhanced koala button feedback */
.koala-button:active {
    transform: scale(0.92);
}

.koala-button.clicked {
    animation: koalaClickJuicy 0.2s ease-out;
}

@keyframes koalaClickJuicy {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(0.9);
    }

    75% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* Shop item hover effects */
.shop-item {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.shop-item:hover:not(.locked) {
    transform: translateX(5px) scale(1.02);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3), var(--glow-green);
}

.shop-item:active:not(.locked) {
    transform: translateX(2px) scale(0.98);
}

/* Purchase success animation */
.shop-item.just-bought {
    animation: purchaseSuccess 0.4s ease-out;
}

@keyframes purchaseSuccess {
    0% {
        transform: scale(1);
    }

    30% {
        transform: scale(1.05);
        background: rgba(123, 237, 159, 0.3);
    }

    100% {
        transform: scale(1);
    }
}

/* Upgrade button effects */
.upgrade-item {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.upgrade-item:hover:not(.locked):not(.purchased) {
    transform: scale(1.05);
    z-index: 10;
}

.upgrade-item:active:not(.locked):not(.purchased) {
    transform: scale(0.95);
}

/* Stats value animations */
.piches-value,
.stat-value {
    transition: transform 0.1s ease-out;
}

.piches-value.updating,
.stat-value.updating {
    animation: valueUpdate 0.3s ease-out;
}

@keyframes valueUpdate {
    0% {
        transform: scale(1);
        color: inherit;
    }

    50% {
        transform: scale(1.1);
        color: var(--accent-gold);
    }

    100% {
        transform: scale(1);
        color: inherit;
    }
}

/* Achievement popup enhancement */
.achievement-popup.show {
    animation: achievementSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes achievementSlideIn {
    0% {
        transform: translateY(-100px) scale(0.5);
        opacity: 0;
    }

    60% {
        transform: translateY(10px) scale(1.05);
    }

    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Prestige button enhanced animation */
.prestige-btn.available.pulse {
    animation: prestigePulseJuicy 1.5s infinite;
}

@keyframes prestigePulseJuicy {

    0%,
    100% {
        box-shadow: 0 0 10px rgba(255, 211, 42, 0.4);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 30px rgba(255, 211, 42, 0.8), 0 0 60px rgba(255, 211, 42, 0.4);
        transform: scale(1.05);
    }
}

/* ============================================
   ADMIN DASHBOARD
   ============================================ */

/* Floating admin button */
.admin-fab {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: var(--bg-card);
    color: var(--accent-orange);
    border: 2px solid var(--accent-orange);
    border-radius: var(--radius-full);
    width: 50px;
    height: 50px;
    font-size: 24px;
    cursor: pointer;
    z-index: 9999;
    box-shadow: var(--glow-orange);
    transition: var(--transition-normal);
    backdrop-filter: blur(10px);
}

.admin-fab:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 0 30px rgba(255, 159, 67, 0.6);
}

/* Modal overlay */
.admin-overlay {
    display: flex;
    position: fixed;
    inset: 0;
    background: rgba(4, 6, 10, 0.88);
    backdrop-filter: blur(6px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

/* Main modal container */
.admin-modal {
    background: var(--bg-dark);
    border: 1px solid rgba(255, 159, 67, 0.3);
    border-radius: var(--radius-lg);
    max-width: 1200px;
    width: 95%;
    height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6), 0 0 40px rgba(255, 159, 67, 0.1);
}

/* Modal header */
/* Tab bar — hidden on desktop, visible on mobile */
.admin-mobile-tabs {
    display: none;
    gap: 5px;
    flex: 1;
    justify-content: center;
    padding: 0 8px;
}

.admin-tab-btn {
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.admin-tab-btn.active {
    background: var(--accent-orange);
    color: #1a1a1a;
    border-color: var(--accent-orange);
    font-weight: 700;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--bg-medium);
    border-bottom: 1px solid rgba(255, 159, 67, 0.2);
    flex-shrink: 0;
}

.admin-header h2 {
    color: var(--accent-orange);
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Two-column layout */
.admin-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left column: user management */
.admin-users-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    min-width: 0;
}

.admin-users-toolbar {
    padding: var(--spacing-xs) var(--spacing-md);
    background: rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
    flex-shrink: 0;
}

.admin-users-toolbar h3 {
    color: var(--accent-green);
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
}

.admin-search-input {
    flex: 1;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition-fast);
}

.admin-search-input:focus {
    border-color: var(--accent-green);
    box-shadow: 0 0 8px rgba(123, 237, 159, 0.2);
}

.admin-search-input::placeholder {
    color: var(--text-muted);
}

.admin-btn-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-btn-icon:hover {
    background: var(--accent-green);
    color: var(--bg-dark);
    border-color: var(--accent-green);
}

/* User table */
.admin-table-wrap {
    flex: 1;
    overflow-y: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-primary);
    table-layout: fixed;
    font-size: 0.88rem;
}

.admin-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.admin-table thead tr {
    background: var(--bg-medium);
}

.admin-table th {
    padding: 10px var(--spacing-sm);
    text-align: left;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-table td {
    padding: 10px var(--spacing-sm);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

.admin-table tbody tr {
    transition: var(--transition-fast);
}

.admin-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.admin-user-name {
    font-weight: 600;
    color: var(--accent-green);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-user-id {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-user-mines {
    font-size: 0.72rem;
    color: #7ecfff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.admin-mines-promo {
    font-size: 0.65rem;
    background: rgba(126, 207, 255, 0.15);
    color: #7ecfff;
    border-radius: 3px;
    padding: 0 4px;
    vertical-align: middle;
}

.admin-interceptor-badge {
    font-size: 0.65rem;
    background: rgba(255, 255, 255, 0.08);
    color: #888;
    border-radius: 3px;
    padding: 1px 5px;
    vertical-align: middle;
    margin-left: 4px;
}

.admin-interceptor-badge.active {
    background: rgba(255, 71, 87, 0.2);
    color: #ff6b7a;
}

.admin-piches {
    color: var(--accent-gold);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-date {
    color: var(--text-secondary);
    font-size: 0.82rem;
}

/* Reset button in table */
.admin-btn-danger {
    background: transparent;
    color: #ff6b6b;
    border: 1px solid rgba(255, 107, 107, 0.3);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.admin-btn-danger:hover {
    background: rgba(255, 107, 107, 0.15);
    border-color: #ff6b6b;
    box-shadow: 0 0 10px rgba(255, 107, 107, 0.2);
}

/* Right column: debug tools */
.admin-debug-panel {
    width: 380px;
    background: rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: var(--spacing-md);
    gap: var(--spacing-md);
}

.admin-debug-panel h3 {
    color: var(--accent-orange);
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid rgba(255, 159, 67, 0.2);
}

/* Debug section card */
.admin-debug-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-debug-card h4 {
    color: var(--text-secondary);
    margin: 0 0 var(--spacing-sm) 0;
    font-size: 0.88rem;
    font-weight: 600;
}

/* Debug inputs */
.admin-debug-input {
    flex: 1;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.4);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition-fast);
    min-width: 0;
    -moz-appearance: textfield;
    appearance: textfield;
}

.admin-debug-input::-webkit-outer-spin-button,
.admin-debug-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.admin-debug-input:focus {
    border-color: var(--accent-orange);
    box-shadow: 0 0 10px rgba(255, 159, 67, 0.25);
    background: rgba(0, 0, 0, 0.5);
}

.admin-debug-input::placeholder {
    color: var(--text-muted);
}

.admin-debug-row {
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
}

.admin-debug-row + .admin-debug-row {
    margin-top: var(--spacing-xs);
}

/* Debug action buttons */
.admin-btn-action {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    transition: var(--transition-fast);
    white-space: nowrap;
    font-family: inherit;
}

.admin-btn-action:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
}

.admin-btn-action.blue {
    background: linear-gradient(135deg, #0984e3, #6c5ce7);
}

.admin-btn-action.purple {
    background: linear-gradient(135deg, #6c5ce7, #a855f7);
}

.admin-btn-action.pink {
    background: linear-gradient(135deg, #e84393, #fd79a8);
}

.admin-btn-action.orange {
    background: linear-gradient(135deg, #e17055, #ff9f43);
}

.admin-btn-action.full-width {
    width: 100%;
}

/* Debug select */
.admin-debug-select {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    width: 100%;
    cursor: pointer;
    transition: var(--transition-fast);
}

.admin-debug-select:focus {
    border-color: var(--accent-orange);
}

.admin-debug-select option {
    background: var(--bg-dark);
    color: var(--text-primary);
}

/* Password modal */
.admin-pw-modal {
    display: flex;
    position: fixed;
    inset: 0;
    background: rgba(4, 6, 10, 0.88);
    backdrop-filter: blur(6px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.admin-pw-card {
    background: var(--bg-dark);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 107, 107, 0.1);
}

.admin-pw-card h3 {
    color: #ff6b6b;
    margin: 0 0 var(--spacing-sm) 0;
    font-size: 1.3rem;
}

.admin-pw-card p {
    color: var(--text-secondary);
    margin: 0 0 var(--spacing-md) 0;
    font-size: 0.9rem;
}

.admin-pw-input {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    padding: 14px;
    border-radius: var(--radius-md);
    width: 100%;
    font-size: 1.4rem;
    text-align: center;
    letter-spacing: 5px;
    font-weight: bold;
    outline: none;
    margin-bottom: var(--spacing-md);
    box-sizing: border-box;
    transition: var(--transition-fast);
}

.admin-pw-input:focus {
    border-color: #ff6b6b;
    box-shadow: 0 0 12px rgba(255, 107, 107, 0.2);
}

.admin-pw-actions {
    display: flex;
    justify-content: center;
    gap: var(--spacing-sm);
}

.admin-btn-cancel {
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.88rem;
    transition: var(--transition-fast);
}

.admin-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.admin-btn-confirm-danger {
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    border: none;
    background: linear-gradient(135deg, #d63031, #e84393);
    color: white;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    font-size: 0.88rem;
    transition: var(--transition-fast);
}

.admin-btn-confirm-danger:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
}

/* Admin loading state */
.admin-loading {
    text-align: center;
    padding: var(--spacing-lg);
    color: var(--text-muted);
}

.admin-error {
    text-align: center;
    padding: var(--spacing-lg);
    color: #ff6b6b;
    font-weight: 600;
}

/* Responsive */
/* ===== ADMIN GIVE BUTTON ===== */
/* Shared admin table action button base */
.admin-btn-give,
.admin-btn-interceptor,
.admin-btn-mines,
.admin-btn-freeze {
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.82rem;
    font-family: inherit;
    margin-right: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.admin-btn-give {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.admin-btn-give:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.5);
}

.admin-btn-interceptor {
    background: linear-gradient(135deg, #ff6b9d 0%, #c44569 100%);
}

.admin-btn-interceptor:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 157, 0.4);
}

.admin-btn-mines {
    background: linear-gradient(135deg, #4ecdc4 0%, #2cb5ac 100%);
}

.admin-btn-mines:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(78, 205, 196, 0.4);
}

.admin-btn-freeze {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
}

.admin-btn-freeze:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.4);
}

/* ===== GIVE RESOURCES MODAL ===== */
.admin-give-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 6, 10, 0.88);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.admin-give-modal {
    background: linear-gradient(145deg, #1a1a1a 0%, #0f0f0f 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    width: 90%;
    max-width: 720px;
    max-height: 90vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6),
                0 0 1px rgba(255, 255, 255, 0.1) inset;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.admin-give-header {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: var(--spacing-md) var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-give-title {
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-give-icon {
    font-size: 1.8rem;
    line-height: 1;
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.4));
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.admin-give-title h2 {
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.admin-give-subtitle {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.5);
    margin: 4px 0 0 0;
    font-weight: 500;
}

.admin-give-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.4rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.admin-give-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    transform: rotate(90deg);
}

.admin-give-body {
    padding: var(--spacing-lg);
    max-height: calc(90vh - 160px);
    overflow-y: auto;
}

.admin-give-section {
    margin-bottom: var(--spacing-lg);
}

.admin-give-section h3 {
    font-size: 1rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: var(--spacing-sm);
}

/* Presets Grid */
.admin-give-presets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.admin-preset-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.admin-preset-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transition: left 0.5s ease;
}

.admin-preset-btn:hover::before {
    left: 100%;
}

.admin-preset-btn:hover {
    border-color: rgba(102, 126, 234, 0.6);
    background: rgba(102, 126, 234, 0.08);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.2);
}

.admin-preset-btn:active {
    transform: translateY(-2px);
}

.preset-emoji {
    font-size: 1.4rem;
    margin-bottom: 4px;
}

.preset-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
    margin-bottom: 4px;
}

.preset-desc {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    font-family: 'Courier New', monospace;
}

/* Custom Fields Grid */
.admin-give-grid {
    display: grid;
    gap: var(--spacing-md);
}

.admin-give-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-give-field label {
    font-size: 0.9rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    letter-spacing: 0.3px;
}

.admin-give-input {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px 16px;
    color: #fff;
    font-size: 1rem;
    font-family: 'Courier New', monospace;
    transition: all 0.2s ease;
}

.admin-give-input:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.admin-give-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.admin-give-hint {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
}

/* Preview Section */
.admin-give-preview {
    background: rgba(102, 126, 234, 0.05);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
}

.admin-give-preview-content {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.admin-give-preview-empty {
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    font-style: italic;
    margin: 0;
}

.preview-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.preview-item:last-child {
    border-bottom: none;
}

.preview-label {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
}

.preview-value {
    color: #4ecdc4;
    font-weight: 700;
}

.preview-auto {
    opacity: 0.7;
}

.preview-auto .preview-value {
    color: rgba(78, 205, 196, 0.7);
}

/* Footer */
.admin-give-footer {
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: var(--spacing-sm) var(--spacing-lg);
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
}

.admin-give-cancel,
.admin-give-confirm {
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
}

.admin-give-cancel {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-give-cancel:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.admin-give-confirm {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.admin-give-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.admin-give-confirm:active {
    transform: translateY(0);
}

.admin-give-confirm-icon {
    font-size: 1.2rem;
    font-weight: 900;
}

/* Scrollbar for modal body */
.admin-give-body::-webkit-scrollbar {
    width: 8px;
}

.admin-give-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 4px;
}

.admin-give-body::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 4px;
}

.admin-give-body::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

@media (max-width: 900px) {
    .admin-body {
        flex-direction: column;
    }

    .admin-debug-panel {
        width: 100%;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
        max-height: 40vh;
    }

    .admin-users-panel {
        border-right: none;
    }

    .admin-give-modal {
        width: 95%;
        max-width: none;
    }

    .admin-give-presets {
        grid-template-columns: repeat(2, 1fr);
    }

    .admin-give-header {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .admin-give-body {
        padding: var(--spacing-md);
    }

    .admin-give-footer {
        padding: var(--spacing-sm) var(--spacing-md);
    }
}

/* ============================================
   MOBILE RESPONSIVE — 600px
   Full-screen modals, admin card layout
   ============================================ */
@media (max-width: 600px) {

    /* --- Modals full-screen --- */
    .minigame-content,
    .quiz-content,
    .prestige-modal-content {
        max-width: 100%;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .minigame-modal,
    .quiz-modal {
        align-items: stretch;
    }

    /* Close buttons: 44px tap targets */
    .minigame-content .close-modal,
    .quiz-close-btn,
    .close-modal {
        min-width: 44px;
        min-height: 44px;
        font-size: 1.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* --- Timer indicators: move below stats bar --- */
    .event-timer-indicator {
        top: auto;
        bottom: 70px;
        left: 10px;
        font-size: 12px;
        padding: 6px 10px;
    }

    .sync-timer-indicator {
        top: auto;
        bottom: 70px;
        right: 10px;
        font-size: 12px;
        padding: 6px 10px;
    }

    /* --- Admin modal full-screen --- */
    .admin-modal {
        width: 100%;
        height: 100%;
        max-width: 100%;
        border-radius: 0;
    }

    /* Show tab bar on mobile */
    .admin-mobile-tabs {
        display: flex;
    }

    /* Shrink title to make room for tabs */
    .admin-header h2 {
        font-size: 0.9rem;
        white-space: nowrap;
    }

    /* Tab-based panel switching: hide both panels by default */
    .admin-users-panel,
    .admin-debug-panel {
        display: none;
    }

    /* Show only the active tab panel */
    .admin-users-panel.admin-tab-active {
        display: flex;
        flex: 1;
        overflow: hidden;
    }

    .admin-debug-panel.admin-tab-active {
        display: flex;
        flex-direction: column;
        flex: 1;
        overflow-y: auto;
        max-height: none;
        width: 100%;
    }

    /* Admin toolbar: wrap on mobile */
    .admin-users-toolbar {
        flex-wrap: wrap;
    }

    .admin-search-input {
        width: 100%;
        order: 10;
    }

    /* Admin table → card layout */
    .admin-table thead {
        display: none;
    }

    .admin-table,
    .admin-table tbody {
        display: block;
    }

    .admin-table tbody tr {
        display: block;
        background: var(--bg-card);
        border-radius: var(--radius-md);
        margin-bottom: var(--spacing-sm);
        padding: var(--spacing-sm);
        border: 1px solid rgba(255, 255, 255, 0.08);
    }

    .admin-table tbody tr:hover {
        background: rgba(255, 255, 255, 0.06);
    }

    .admin-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    }

    .admin-table td:last-child {
        border-bottom: none;
        flex-wrap: wrap;
        gap: 6px;
        padding-top: 8px;
    }

    .admin-table td:last-child::before {
        width: 100%;
        margin-bottom: 4px;
    }

    .admin-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        font-size: 0.78rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-right: var(--spacing-sm);
        flex-shrink: 0;
    }

    /* Action buttons: full-width touch targets */
    .admin-btn-give,
    .admin-btn-freeze,
    .admin-btn-interceptor,
    .admin-btn-mines,
    .admin-btn-danger {
        flex: 1;
        min-height: 42px;
        min-width: 0;
        margin-right: 0;
        font-size: 0.8rem;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
    }

    /* Admin debug panel: full width, no max-height */
    .admin-debug-panel {
        max-height: none;
        width: 100%;
    }

    .admin-debug-panel .admin-btn-action {
        width: 100%;
        min-height: 44px;
    }

    /* Admin debug cards: collapsible on mobile */
    .admin-debug-card h4 {
        cursor: pointer;
        position: relative;
        padding-right: 24px;
        padding-top: 4px;
        padding-bottom: 4px;
        min-height: 36px;
        display: flex;
        align-items: center;
    }

    .admin-debug-card h4::after {
        content: '▼';
        position: absolute;
        right: 0;
        font-size: 0.7rem;
        transition: transform 0.2s ease;
    }

    .admin-debug-card.collapsed h4::after {
        transform: rotate(-90deg);
    }

    .admin-debug-card.collapsed .admin-debug-row,
    .admin-debug-card.collapsed select,
    .admin-debug-card.collapsed .admin-btn-action,
    .admin-debug-card.collapsed div:not(:first-child) {
        display: none;
    }

    /* Admin give modal: full-screen */
    .admin-give-modal {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    /* Admin debug inputs: larger touch targets */
    .admin-debug-input,
    .admin-debug-select {
        min-height: 44px;
        font-size: 1rem;
        padding: 10px 14px;
    }

    .admin-debug-row {
        gap: 8px;
    }

    /* Admin pw card: wider on mobile */
    .admin-pw-card {
        width: 92%;
    }

    .admin-pw-input {
        min-height: 52px;
        font-size: 1.5rem;
    }

    .admin-give-presets {
        grid-template-columns: repeat(2, 1fr);
    }

    /* --- Challenge modals: full-screen --- */
    .challenge-modal-content {
        max-width: 100%;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }

    .challenge-modal-body {
        padding: var(--spacing-md);
        overflow-y: auto;
        flex: 1;
    }

    .challenge-game-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--spacing-xs);
    }

    .challenge-game-btn {
        padding: var(--spacing-xs);
    }

    .challenge-game-btn .game-icon {
        font-size: 1.1rem;
    }

    .challenge-game-btn .game-name {
        font-size: 0.78rem;
    }

    /* PvP game modal: full-screen */
    .pvp-game-modal .pvp-content {
        max-width: 100%;
        width: 100%;
        border-radius: 0;
    }

    .pvp-players {
        gap: var(--spacing-sm);
    }

    .pvp-player {
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    .pvp-vs {
        font-size: 1rem;
    }
}

/* ============================================
   MOBILE RESPONSIVE — 480px (enriched)
   Stats bar, game boards, buy multiplier
   ============================================ */
@media (max-width: 480px) {

    /* --- Stats bar --- */
    .stat-item {
        min-width: 60px;
        padding: 4px 6px;
    }

    .stat-label {
        font-size: 0.6rem;
    }

    .stat-value {
        font-size: 1rem;
    }

    .stats-container {
        gap: var(--spacing-xs);
    }

    /* --- Buy multiplier: wrap on small screens --- */
    .buy-multiplier-selector {
        flex-wrap: wrap;
        padding: 8px;
        gap: 6px;
    }

    .multiplier-btn {
        min-width: 40px;
        padding: 6px 10px;
        font-size: 12px;
    }

    .multiplier-label {
        font-size: 12px;
        width: 100%;
        margin-bottom: 2px;
    }

    /* --- Game boards: responsive sizing --- */
    .chess-board {
        grid-template-columns: repeat(8, calc((100vw - 80px) / 8));
        grid-template-rows: repeat(8, calc((100vw - 80px) / 8));
    }

    .chess-cell {
        width: calc((100vw - 80px) / 8);
        height: calc((100vw - 80px) / 8);
        font-size: clamp(1rem, 5vw, 1.8rem);
    }

    .go-board {
        grid-template-columns: repeat(9, calc((100vw - 90px) / 9));
        grid-template-rows: repeat(9, calc((100vw - 90px) / 9));
        background-size: calc((100vw - 90px) / 9) calc((100vw - 90px) / 9);
        padding: 10px;
    }

    .go-cell {
        width: calc((100vw - 90px) / 9);
        height: calc((100vw - 90px) / 9);
    }

    .connect4-board {
        grid-template-columns: repeat(7, calc((100vw - 80px) / 7));
        grid-template-rows: repeat(6, calc((100vw - 80px) / 7));
    }

    .connect4-cell {
        width: calc((100vw - 80px) / 7);
        height: calc((100vw - 80px) / 7);
    }

    .tictactoe-board {
        grid-template-columns: repeat(3, calc((100vw - 80px) / 3));
        grid-template-rows: repeat(3, calc((100vw - 80px) / 3));
    }

    .tictactoe-cell {
        width: calc((100vw - 80px) / 3);
        height: calc((100vw - 80px) / 3);
        font-size: clamp(2rem, 10vw, 3rem);
    }

    /* --- Controls buttons: touch-friendly --- */
    .minigame-controls button,
    .chess-controls button,
    .go-controls button {
        min-height: 44px;
        min-width: 44px;
    }

    /* --- Piches value smaller --- */
    .piches-value {
        font-size: 1.6rem;
    }

    /* --- Challenge game grid: 2 columns on very small --- */
    .challenge-game-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* --- Challenge actions: stack vertically --- */
    .challenge-actions {
        flex-direction: column;
        gap: var(--spacing-xs);
    }

    .challenge-accept-btn,
    .challenge-decline-btn {
        padding: var(--spacing-sm) var(--spacing-md);
        width: 100%;
    }

    /* --- PvP header: stack players vertically --- */
    .pvp-players {
        flex-direction: column;
        gap: var(--spacing-xs);
    }

    .pvp-vs {
        font-size: 0.9rem;
    }
}

/* ============================================
   MOBILE RESPONSIVE — 360px
   Very small phones
   ============================================ */
@media (max-width: 360px) {

    .stat-item {
        min-width: 50px;
        padding: 3px 4px;
    }

    .stat-label {
        font-size: 0.55rem;
    }

    .stat-value {
        font-size: 0.85rem;
    }

    /* Hide prestige stat on very small screens to save space */
    .stat-item:last-child {
        display: none;
    }

    /* Shop items: stack icon + info vertically */
    .shop-item,
    .upgrade-item {
        grid-template-columns: 60px 1fr;
        grid-template-rows: auto auto;
    }

    .item-cost {
        grid-column: 1 / -1;
        justify-self: stretch;
        text-align: center;
    }

    .koala-button {
        width: 120px;
        height: 120px;
    }

    .koala-img {
        width: 100px;
        height: 100px;
    }

    .piches-value {
        font-size: 1.3rem;
    }
}

/* ============================================
   TOUCH DEVICES — remove hover transforms
   ============================================ */
@media (hover: none) {
    .shop-item:hover,
    .upgrade-item:hover {
        transform: none;
    }

    .header-btn:hover {
        transform: none;
    }

    .admin-btn-danger:hover,
    .admin-btn-action:hover,
    .admin-give-confirm:hover {
        transform: none;
    }

    .connect4-cell:hover {
        transform: none;
    }

    .invader:hover {
        transform: none;
    }
}

/* ============================================
   CREDITS FOOTER
   ============================================ */
.credits-footer {
    position: fixed;
    bottom: 10px;
    right: 10px;
    padding: 10px 15px;
    background: rgba(26, 46, 26, 0.9);
    border: 1px solid rgba(123, 237, 159, 0.3);
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    color: #b8d4b8;
    z-index: 100;
}

@media (max-width: 480px) {
    .credits-footer {
        position: relative;
        bottom: auto;
        right: auto;
        margin: var(--spacing-md) auto;
        text-align: center;
        max-width: 300px;
    }
}

/* ============================================
   MULTIPLAYER LOBBY SYSTEM (4-Player) — ARCADE EDITION
   ============================================ */

/* ---------- CSS variables for lobby theme ---------- */
:root {
    --lby-cyan:    #00e5ff;
    --lby-yellow:  #ffe600;
    --lby-red:     #ff3860;
    --lby-green:   #0df2a0;
    --lby-bg:      #080c10;
    --lby-surface: #0e141b;
    --lby-border:  rgba(0, 229, 255, 0.22);
    --lby-glow:    0 0 18px rgba(0, 229, 255, 0.35);
}

/* ---------- Overlay ---------- */
.multiplayer-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 6, 10, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(8px) saturate(1.4);
    animation: mp-overlay-in 0.18s ease;
}
@keyframes mp-overlay-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ---------- Modal shell ---------- */
.multiplayer-modal-content {
    background: var(--lby-bg);
    border: 1.5px solid var(--lby-border);
    border-radius: 12px;
    padding: 0;
    max-width: 540px;
    width: calc(100% - 2rem);
    max-height: 92dvh;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    box-shadow: var(--lby-glow), 0 32px 80px rgba(0,0,0,0.7);
    animation: mp-modal-in 0.22s cubic-bezier(0.34,1.56,0.64,1);
}
/* Game modal needs to be wider to fit board + pieces */
.lobby-game {
    max-width: 900px;
}
@keyframes mp-modal-in {
    from { transform: scale(0.93) translateY(12px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
}

/* ---------- Header ---------- */
.multiplayer-modal-content .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem 0.9rem;
    border-bottom: 1px solid var(--lby-border);
    background: linear-gradient(90deg, rgba(0,229,255,0.07), transparent);
    position: sticky;
    top: 0;
    z-index: 2;
    backdrop-filter: blur(6px);
}
.multiplayer-modal-content .modal-header h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--lby-cyan);
    text-shadow: 0 0 14px rgba(0,229,255,0.5);
}
.multiplayer-modal-content .modal-close-btn {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    color: rgba(255,255,255,0.55);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}
.multiplayer-modal-content .modal-close-btn:hover {
    background: rgba(255,56,96,0.18);
    border-color: var(--lby-red);
    color: var(--lby-red);
}

/* ---------- Lobby Browser ---------- */
.lobby-browser-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.6rem;
    padding: 1rem 1.25rem 0.5rem;
}
.lobby-browser-actions .btn-primary {
    grid-column: 1;
}
.lobby-browser-actions .btn-secondary {
    grid-column: 2;
    aspect-ratio: 1;
    padding: 0;
    width: 40px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
}

#lobby-list-container {
    padding: 0 1.25rem 1.25rem;
}

.lobby-list-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: var(--lby-surface);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    margin-bottom: 0.5rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.lobby-list-item:hover {
    border-color: rgba(0,229,255,0.3);
    box-shadow: 0 0 0 1px rgba(0,229,255,0.08);
}

.lobby-info { display: flex; flex-direction: column; gap: 0.2rem; }
.lobby-game-type {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #fff;
}
.lobby-creator {
    color: rgba(255,255,255,0.4);
    font-size: 0.8rem;
}

.lobby-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    font-size: 0.8rem;
}
.lobby-players-count {
    background: rgba(0,229,255,0.12);
    border: 1px solid rgba(0,229,255,0.25);
    color: var(--lby-cyan);
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
}
.lobby-stake {
    color: var(--lby-yellow);
    font-weight: 600;
    font-size: 0.8rem;
}

.lobby-empty, .lobby-loading {
    text-align: center;
    color: rgba(255,255,255,0.3);
    padding: 2.5rem 1rem;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
}

/* ---------- Create Lobby Form ---------- */
.lobby-create .lobby-form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    padding: 1.1rem 1.25rem 1.25rem;
}

.lobby-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.lobby-field-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.45);
}
.lobby-form label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.45);
}
.lobby-form select,
.lobby-form input[type="number"] {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border-radius: 8px;
    border: 1.5px solid rgba(255,255,255,0.1);
    background: var(--lby-surface);
    color: #fff;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: textfield;
}
.lobby-form input[type="number"]::-webkit-outer-spin-button,
.lobby-form input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.lobby-form select:focus,
.lobby-form input[type="number"]:focus {
    outline: none;
    border-color: var(--lby-cyan);
    box-shadow: 0 0 0 3px rgba(0,229,255,0.12);
}

/* Stake input with prefix */
.lobby-stake-field {
    position: relative;
}
.lobby-stake-field::before {
    content: '🪙';
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    z-index: 1;
    pointer-events: none;
}
.lobby-stake-field input {
    padding-left: 2.4rem !important;
}

.lobby-mode-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1.5px solid rgba(255,255,255,0.1);
}
.btn-toggle {
    padding: 0.7rem 0.5rem;
    border: none;
    background: var(--lby-surface);
    color: rgba(255,255,255,0.45);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.btn-toggle + .btn-toggle {
    border-left: 1.5px solid rgba(255,255,255,0.1);
}
.btn-toggle.active {
    background: rgba(0,229,255,0.14);
    color: var(--lby-cyan);
    text-shadow: 0 0 10px rgba(0,229,255,0.5);
}

/* ---------- Waiting Room ---------- */
.lobby-waiting .multiplayer-modal-content,
.lobby-waiting {
    max-width: 420px;
}

.waiting-header-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 1.25rem 0;
}
.waiting-info {
    display: flex;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem 0;
    flex-wrap: wrap;
}
.waiting-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
}
.waiting-badge.ranked {
    background: rgba(255,230,0,0.12);
    border: 1px solid rgba(255,230,0,0.3);
    color: var(--lby-yellow);
}
.waiting-badge.casual {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.5);
}
.waiting-badge.stake {
    background: rgba(13,242,160,0.1);
    border: 1px solid rgba(13,242,160,0.25);
    color: var(--lby-green);
}
.waiting-id {
    color: rgba(255,255,255,0.2);
    font-size: 0.72rem;
    font-family: monospace;
    padding: 0.6rem 1.25rem 0;
    display: block;
}

.waiting-seats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 0.85rem 1.25rem;
}

.waiting-seat {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 0.85rem;
    border-radius: 10px;
    border: 1.5px solid rgba(255,255,255,0.07);
    background: var(--lby-surface);
    transition: border-color 0.25s, box-shadow 0.25s;
    min-height: 58px;
}
.waiting-seat.occupied {
    border-color: rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.06);
}
.waiting-seat.occupied .seat-name {
    animation: none;
}
.waiting-seat.empty .seat-name {
    color: rgba(255,255,255,0.2);
    font-style: italic;
    font-size: 0.82rem;
    animation: pulse-text 2.5s ease-in-out infinite;
}

.seat-color-bar {
    width: 4px;
    height: 32px;
    border-radius: 4px;
    flex-shrink: 0;
}
.seat-color {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1;
    margin-bottom: 0.1rem;
}
.seat-name {
    color: #fff;
    font-weight: 600;
    font-size: 0.88rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 90px;
}
.seat-info { display: flex; flex-direction: column; gap: 0.15rem; overflow: hidden; }

.waiting-status {
    text-align: center;
    font-size: 0.82rem;
    letter-spacing: 0.06em;
    color: rgba(255,255,255,0.35);
    padding: 0 1.25rem 0.2rem;
    animation: pulse-text 2.5s ease-in-out infinite;
}

.waiting-actions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.5rem 1.25rem 1.25rem;
}
#lobby-start-btn {
    width: 100%;
    padding: 0.9rem;
    background: linear-gradient(135deg, var(--lby-green), #00b894);
    color: #050d09;
    font-weight: 900;
    font-size: 1rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 0 24px rgba(13,242,160,0.35);
    transition: all 0.2s;
    font-family: inherit;
}
#lobby-start-btn:hover:not(:disabled) {
    box-shadow: 0 0 36px rgba(13,242,160,0.55);
    transform: translateY(-1px);
}
#lobby-start-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@keyframes pulse-text {
    0%, 100% { opacity: 0.35; }
    50%       { opacity: 0.75; }
}

/* ---------- Game Players Bar ---------- */
.game-players-bar {
    display: flex;
    gap: 0.4rem;
    padding: 0.75rem 1rem 0;
    flex-wrap: wrap;
}

.game-player {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    background: var(--lby-surface);
    border: 1.5px solid rgba(255,255,255,0.07);
    font-size: 0.82rem;
    transition: all 0.2s;
    flex-shrink: 0;
}
.game-player.active-turn {
    border-color: var(--lby-cyan);
    background: rgba(0,229,255,0.08);
    box-shadow: 0 0 12px rgba(0,229,255,0.2);
}
.game-player.is-me { font-weight: 700; }
.game-player.forfeited { opacity: 0.35; text-decoration: line-through; }
.game-player.passed { opacity: 0.55; }

.player-color-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 5px currentColor;
}
.player-name { color: #fff; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-pieces-left { color: rgba(255,255,255,0.4); font-size: 0.75rem; }
.player-status {
    font-size: 0.7rem;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.turn-indicator {
    background: rgba(0,229,255,0.18);
    color: var(--lby-cyan);
    animation: pulse-text 1.5s ease-in-out infinite;
}

/* ---------- Game modal layout ---------- */
.lobby-game .modal-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.lobby-game .modal-header h2 { flex: 1; }
#lobby-forfeit-btn {
    background: transparent;
    color: rgba(255,56,96,0.6);
    border: 1px solid rgba(255,56,96,0.25);
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-family: inherit;
    transition: all 0.2s;
    flex-shrink: 0;
}
#lobby-forfeit-btn:hover {
    background: rgba(255,56,96,0.1);
    color: var(--lby-red);
    border-color: rgba(255,56,96,0.5);
}

#game-board-container {
    padding: 0.75rem 1rem 1rem;
    overflow-x: auto;
}

/* ---------- Mobile responsive ---------- */
@media (max-width: 480px) {
    .multiplayer-modal-content {
        border-radius: 16px 16px 0 0;
        max-height: 92dvh;
        margin-top: auto;
    }
    .multiplayer-modal-overlay {
        align-items: flex-end;
    }
    @keyframes mp-modal-in {
        from { transform: translateY(100%); opacity: 0.5; }
        to   { transform: translateY(0); opacity: 1; }
    }
    .lobby-list-item {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
    }
    .lobby-list-item .btn-small {
        grid-column: 2;
        grid-row: 1 / 3;
        align-self: center;
    }
    .lobby-meta {
        flex-direction: row;
        align-items: center;
    }
    .waiting-seats {
        grid-template-columns: 1fr 1fr;
    }
    .game-players-bar {
        gap: 0.3rem;
    }
    .game-player {
        font-size: 0.75rem;
        padding: 0.3rem 0.5rem;
    }
    .player-pieces-left { display: none; }

    /* Blokus: stack vertically on mobile */
    .blokus-layout {
        flex-direction: column;
        align-items: center;
    }
    .blokus-piece-panel {
        max-height: 200px;
        width: 100%;
    }
    .blokus-piece-panel h3 {
        text-align: center;
    }
    .blokus-pieces-grid {
        justify-content: center;
    }
}

/* Blokus Layout */
.blokus-layout {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.blokus-board-area {
    flex-shrink: 0;
    /* Make board scale down if container is narrow */
    max-width: 100%;
    overflow: hidden;
}
.blokus-canvas {
    display: block;
    max-width: 100%;
    height: auto !important;
    border: 1.5px solid var(--lby-border);
    border-radius: 6px;
    cursor: crosshair;
    image-rendering: pixelated;
    touch-action: none;
}

.blokus-info-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
}
.blokus-turn-info {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.1rem;
    text-align: center;
}

/* Piece Panel */
.blokus-piece-panel {
    flex: 1;
    max-height: 480px;
    overflow-y: auto;
}
.blokus-piece-panel h3 {
    margin: 0 0 0.5rem;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
}

.blokus-pieces-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.blokus-piece-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px;
    border: 2px solid transparent;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    transition: all 0.2s;
}
.blokus-piece-btn:hover { background: rgba(255, 255, 255, 0.1); }
.blokus-piece-btn.selected {
    border-color: var(--lby-cyan);
    background: rgba(0, 229, 255, 0.12);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.25);
}
.piece-label {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.4);
}

/* Drag ghost (mobile drag-and-drop) */
.blokus-drag-ghost {
    position: fixed;
    pointer-events: none;
    z-index: 99999;
    opacity: 0.85;
    border-radius: 4px;
    transform: translateZ(0);
    will-change: left, top;
}

.blokus-controls-bar {
    width: 100%;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.5rem;
}
.blokus-ctrl-btn {
    padding: 0.5rem 1rem;
    border: 1.5px solid var(--lby-border);
    background: var(--lby-surface);
    color: var(--lby-cyan);
    border-radius: 8px;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.blokus-ctrl-btn:hover,
.blokus-ctrl-btn:active {
    background: rgba(0,229,255,0.1);
    border-color: var(--lby-cyan);
}
.blokus-controls-hint {
    width: 100%;
    text-align: center;
    color: rgba(255, 255, 255, 0.25);
    font-size: 0.72rem;
    margin-top: 0.3rem;
}
/* Hide keyboard hint on touch devices */
@media (hover: none) {
    .blokus-controls-hint { display: none; }
}

/* ---------- Result Screen ---------- */
.game-result-overlay {
    position: absolute;
    inset: 0;
    background: rgba(4,6,10,0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    z-index: 10;
    animation: mp-modal-in 0.28s cubic-bezier(0.34,1.56,0.64,1);
    padding: 1.5rem;
}

.game-result-content {
    text-align: center;
    width: 100%;
    max-width: 360px;
}
.game-result-content h2 {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.3rem;
}
.game-result-content h2:has(+ .result-winnings) { color: var(--lby-green); text-shadow: 0 0 20px rgba(13,242,160,0.4); }

.result-winnings {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(13,242,160,0.1);
    border: 1px solid rgba(13,242,160,0.3);
    border-radius: 20px;
    color: var(--lby-green);
    font-size: 1.1rem;
    font-weight: 800;
    padding: 0.35rem 1rem;
    margin-bottom: 1.2rem;
}

.result-scores {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1.4rem;
}

.result-player {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 0.85rem;
    background: var(--lby-surface);
    border: 1.5px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    text-align: left;
    transition: border-color 0.2s;
}
.result-player.is-me {
    border-color: rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.07);
}
.result-player.is-winner {
    border-color: rgba(13,242,160,0.45);
    box-shadow: 0 0 12px rgba(13,242,160,0.1);
}

.result-rank {
    font-size: 0.9rem;
    font-weight: 900;
    color: rgba(255,255,255,0.3);
    width: 28px;
    flex-shrink: 0;
}
.result-player.is-winner .result-rank { color: var(--lby-yellow); }
.result-color-dot {
    width: 11px; height: 11px;
    border-radius: 50%;
    flex-shrink: 0;
}
.result-name { flex: 1; color: #fff; font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-score { color: rgba(255,255,255,0.45); font-size: 0.8rem; white-space: nowrap; }
.result-crown { font-size: 1rem; flex-shrink: 0; }

/* ---------- 4J Entry Button ---------- */
.leaderboard-4j-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    float: right;
    margin-bottom: 0.5rem;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 5px 12px;
    background: rgba(0,229,255,0.1);
    border: 1.5px solid rgba(0,229,255,0.35) !important;
    color: var(--lby-cyan) !important;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}
.leaderboard-4j-btn:hover {
    background: rgba(0,229,255,0.18) !important;
    box-shadow: 0 0 12px rgba(0,229,255,0.25);
    filter: none !important;
}
.leaderboard-4j-btn::before { content: '⬡'; font-size: 0.85em; }

/* ---------- Shared lobby buttons ---------- */
.btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    border: none;
    padding: 0.6rem 1.1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-family: inherit;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    transition: all 0.2s;
}
.btn-primary:hover { filter: brightness(1.15); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); filter: brightness(0.95); }

.btn-secondary {
    background: rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0.6rem 1.1rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.12); }

.btn-danger {
    background: transparent;
    color: rgba(255,56,96,0.8);
    border: 1.5px solid rgba(255,56,96,0.35);
    padding: 0.6rem 1.1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-family: inherit;
    font-size: 0.88rem;
    transition: all 0.2s;
    width: 100%;
}
.btn-danger:hover {
    background: rgba(255,56,96,0.1);
    border-color: var(--lby-red);
    color: var(--lby-red);
}

.btn-small { padding: 0.35rem 0.7rem !important; font-size: 0.82rem !important; }

/* Responsive */
@media (max-width: 700px) {
    .blokus-layout {
        flex-direction: column;
    }
    .blokus-canvas {
        max-width: 100%;
        height: auto;
    }
    .blokus-piece-panel {
        max-height: 200px;
    }
    .waiting-seats {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   ANNOUNCEMENT BANNER (info, pas de gel)
   ============================================ */

#announcement-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 20px;
    background: linear-gradient(90deg, #0d6efd 0%, #0dcaf0 50%, #0d6efd 100%);
    background-size: 200% 100%;
    animation: announce-slide 4s ease infinite;
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
    text-align: center;
}

@keyframes announce-slide {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.announcement-banner-icon {
    font-size: 1.1rem;
}

.announcement-banner-message {
    flex: 1;
    max-width: 700px;
}

.announcement-banner-close {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: #fff;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.announcement-banner-close:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* Push content down when announcement banner is visible */
body.announcement-active {
    padding-top: 44px;
}

/* ============================================
   FREEZE BANNER (travaux, gèle le jeu)
   ============================================ */

#freeze-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 20px;
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    text-shadow: 0 1px 4px rgba(0,0,0,0.9), 0 0 10px rgba(0,0,0,0.8);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
    text-align: center;
}

/* Pseudo-élément animé via transform (GPU, zéro repaint) */
#freeze-banner::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: -46px;
    right: -46px;
    background-image: repeating-linear-gradient(
        -45deg,
        #1a1a00 0px,
        #1a1a00 16px,
        #f5c518 16px,
        #f5c518 32px
    );
    will-change: transform;
    animation: freeze-stripes-move 1.2s linear infinite;
    z-index: 0;
}

/* Contenu du bandeau au-dessus du pseudo-élément */
#freeze-banner > * {
    position: relative;
    z-index: 1;
}

@keyframes freeze-stripes-move {
    from { transform: translateX(0); }
    to   { transform: translateX(46px); }
}

.freeze-banner-icon {
    font-size: 1.2rem;
    animation: freeze-pulse 1.5s ease-in-out infinite;
}

@keyframes freeze-pulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.25); }
}

.freeze-banner-message {
    flex: 1;
    max-width: 600px;
}

.freeze-banner-admin-btn {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #f5c518;
    color: #f5c518;
    padding: 4px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    transition: background 0.2s;
    white-space: nowrap;
}

.freeze-banner-admin-btn:hover {
    background: rgba(245, 197, 24, 0.2);
}

/* When game is frozen: dim game content visually */
body.freeze-active .main-content,
body.freeze-active .game-area,
body.freeze-active #koala-btn,
body.freeze-active .shop-container,
body.freeze-active .upgrades-container,
body.freeze-active .stats-panel {
    filter: grayscale(30%) opacity(0.7);
    transition: filter 0.4s ease;
}

/* Push content down when banner is visible */
body.freeze-active {
    padding-top: 44px;
}

/* Stack both banners if both active */
body.announcement-active.freeze-active {
    padding-top: 88px;
}

body.announcement-active #freeze-banner {
    top: 44px;
}

/* ============================================
   LOOT BOX SYSTEM
   ============================================ */

/* FAB button */
.lootbox-fab {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid rgba(255, 211, 42, 0.5);
    background: linear-gradient(135deg, rgba(45,74,45,0.95), rgba(26,46,26,0.95));
    color: white;
    font-size: 1.6rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4), 0 0 15px rgba(255,211,42,0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lootbox-fab:hover {
    transform: scale(1.12);
    box-shadow: 0 6px 25px rgba(0,0,0,0.5), 0 0 25px rgba(255,211,42,0.4);
}

/* Modal */
.lootbox-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9000;
    align-items: center;
    justify-content: center;
}
.lootbox-modal.show {
    display: flex;
}
.lootbox-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    pointer-events: none;
}
.lootbox-modal.show .lootbox-modal-backdrop {
    pointer-events: all;
}
.lootbox-modal-content {
    position: relative;
    background: linear-gradient(145deg, rgba(30,55,30,0.97), rgba(15,30,15,0.98));
    border: 1px solid rgba(123,237,159,0.25);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    max-width: 700px;
    width: 95%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 40px rgba(123,237,159,0.1);
    z-index: 1;
    animation: slideUp 0.3s ease;
}
.lootbox-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.15s ease;
}
.lootbox-modal-close:hover { color: white; }
.lootbox-modal-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--accent-gold);
    text-align: center;
    margin-bottom: 4px;
    text-shadow: 0 0 20px rgba(255,211,42,0.3);
}
.lootbox-modal-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--spacing-md);
}

/* Cards grid */
.lootbox-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--spacing-md);
}
.lootbox-card {
    background: rgba(255,255,255,0.04);
    border: 2px solid var(--tier-color, #aaa);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-align: center;
}
.lootbox-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.lootbox-card-emoji { font-size: 2.5rem; }
.lootbox-card-name {
    font-weight: 800;
    font-size: 1rem;
    color: var(--tier-color, white);
}
.lootbox-card-cost {
    font-size: 0.85rem;
    color: var(--accent-gold);
    font-weight: 700;
}
.lootbox-card-rewards {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-align: left;
    width: 100%;
}
.lootbox-card-rewards li {
    padding: 2px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.lootbox-card-rewards li:last-child { border-bottom: none; }

/* Loot box card tier-specific borders */
.lootbox-card-loot_box_common  { border-color: #a0a0a0; }
.lootbox-card-loot_box_rare    { border-color: #5599ff; box-shadow: 0 0 15px rgba(85,153,255,0.2); }
.lootbox-card-loot_box_legendary { border-color: #ffd32a; box-shadow: 0 0 20px rgba(255,211,42,0.25); }

/* Open button */
.lootbox-open-btn {
    width: 100%;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--tier-color, #aaa);
    background: rgba(255,255,255,0.05);
    color: white;
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}
.lootbox-open-btn:not(.disabled):hover {
    background: rgba(255,255,255,0.12);
    transform: scale(1.03);
}
.lootbox-open-btn::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -60%;
    width: 40%;
    height: 200%;
    background: rgba(255,255,255,0.08);
    transform: rotate(20deg);
    animation: shimmerSlide 2.5s infinite;
}
.lootbox-open-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
@keyframes shimmerSlide {
    0%   { left: -60%; }
    100% { left: 120%; }
}

/* (Old 3D box + reward reveal styles removed — replaced by V2 gift box system) */

/* ============================================================
   LOOTBOX V2 — Interactive Gift Box Animation
   5-click piñata: drop → click to shake+swell → explode → card reveal
   Rarity-based: .lb-rarity-nothing / buff / legendary
   Performance-optimized: transform+opacity only, reduced particles
   ============================================================ */

/* -- Rarity color tokens -- */
.lb-rarity-nothing   {
    --lb-rarity-color:#999; --lb-rarity-glow:rgba(150,150,150,.3); --lb-rarity-glow-s:rgba(150,150,150,.75);
}
.lb-rarity-buff {
    --lb-rarity-color:#00d4ff; --lb-rarity-glow:rgba(0,212,255,.3); --lb-rarity-glow-s:rgba(0,212,255,.75);
}
.lb-rarity-legendary {
    --lb-rarity-color:#ffd32a; --lb-rarity-glow:rgba(255,211,42,.3); --lb-rarity-glow-s:rgba(255,211,42,.75);
}
.lb-rarity-mystery {
    --lb-rarity-color:#888; --lb-rarity-glow:rgba(128,128,128,.2); --lb-rarity-glow-s:rgba(128,128,128,.5);
}

/* ── KEYFRAMES ────────────────────────────────────────────── */
@keyframes lbGiftDropIn {
    0%   { transform: translateY(-280px) scale(0.4); opacity:0; }
    55%  { transform: translateY(18px)   scale(1.06); opacity:1; }
    75%  { transform: translateY(-8px)   scale(0.98); }
    90%  { transform: translateY(4px)    scale(1.01); }
    100% { transform: translateY(0)      scale(1);    opacity:1; }
}
@keyframes lbGiftIdle {
    0%,100% { transform: translateY(0); }
    50%     { transform: translateY(-7px); }
}
@keyframes lbShake1 {
    0%,100% { transform: translate(0) rotateZ(0deg); }
    20%     { transform: translateX(-10px) rotateZ(-4deg); }
    40%     { transform: translateX(10px) rotateZ(4deg); }
    60%     { transform: translateX(-5px) rotateZ(-2deg); }
    80%     { transform: translateX(3px) rotateZ(1deg); }
}
@keyframes lbShake2 {
    0%,100% { transform: translate(0) rotateZ(0deg); }
    15%     { transform: translateX(-16px) rotateZ(-6deg); }
    30%     { transform: translateX(16px) rotateZ(6deg); }
    50%     { transform: translateX(-10px) rotateZ(-4deg); }
    65%     { transform: translateX(6px) rotateZ(2deg); }
    80%     { transform: translateX(-2px) rotateZ(-1deg); }
}
@keyframes lbShake3 {
    0%,100% { transform: translate(0,0) rotateZ(0deg); }
    10%     { transform: translate(-22px,-8px) rotateZ(-10deg); }
    22%     { transform: translate(20px,6px) rotateZ(9deg); }
    35%     { transform: translate(-15px,-4px) rotateZ(-7deg); }
    50%     { transform: translate(10px,2px) rotateZ(5deg); }
    65%     { transform: translate(-6px,0) rotateZ(-2deg); }
    80%     { transform: translate(3px,0) rotateZ(1deg); }
}
@keyframes lbShake4 {
    0%,100% { transform: translate(0,0) rotateZ(0deg); }
    8%      { transform: translate(-30px,-12px) rotateZ(-14deg); }
    18%     { transform: translate(28px,10px) rotateZ(12deg); }
    28%     { transform: translate(-22px,-6px) rotateZ(-9deg); }
    40%     { transform: translate(18px,4px) rotateZ(7deg); }
    52%     { transform: translate(-12px,0) rotateZ(-5deg); }
    66%     { transform: translate(8px,0) rotateZ(3deg); }
    80%     { transform: translate(-4px,0) rotateZ(-1deg); }
}
@keyframes lbScreenShake {
    0%,100% { transform: translate(0,0); }
    15%     { transform: translate(-5px,3px); }
    30%     { transform: translate(4px,-4px); }
    45%     { transform: translate(-3px,4px); }
    60%     { transform: translate(5px,-2px); }
    75%     { transform: translate(-2px,2px); }
}
@keyframes lbAuraPulse {
    0%,100% { opacity: var(--aura-lo, 0.12); transform: translate(-50%,-50%) scale(1); }
    50%     { opacity: var(--aura-hi, 0.22); transform: translate(-50%,-50%) scale(1.08); }
}
@keyframes lbIconPop {
    0%   { transform: scale(0); opacity:0; }
    55%  { transform: scale(1.18); opacity:1; }
    75%  { transform: scale(0.92); }
    90%  { transform: scale(1.04); }
    100% { transform: scale(1); opacity:1; }
}
@keyframes lbIconFloat {
    0%,100% { transform: translateY(0) scale(1); }
    50%     { transform: translateY(-4px) scale(1.04); }
}
@keyframes lbSlideUp {
    from { transform: translateY(14px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
@keyframes lbCardReveal {
    0%   { transform: translateY(50px) scale(0.25); opacity:0; }
    45%  { transform: translateY(-8px) scale(1.06); opacity:1; }
    65%  { transform: translateY(3px) scale(0.98); }
    82%  { transform: translateY(-2px) scale(1.01); }
    100% { transform: translateY(0) scale(1); opacity:1; }
}
@keyframes lbShineSweep {
    0%,100% { transform:translateX(-150%) skewX(-20deg); }
    50%     { transform:translateX(150%)  skewX(-20deg); }
}
@keyframes lbCardGlow {
    0%,100% { box-shadow: 0 0 16px var(--lb-rarity-glow); }
    50%     { box-shadow: 0 0 32px var(--lb-rarity-glow-s), 0 0 60px var(--lb-rarity-glow); }
}
@keyframes lbParticleBurst {
    0%   { transform:translate(-50%,-50%) rotate(var(--p-angle)) translateX(0); opacity:1; }
    85%  { opacity:0.6; }
    100% { transform:translate(-50%,-50%) rotate(var(--p-angle)) translateX(var(--p-dist)); opacity:0; }
}
@keyframes lbSparkleFloat {
    0%   { transform:translate(var(--s-x),var(--s-y)) scale(0); opacity:0; }
    25%  { opacity:1; transform:translate(var(--s-x),var(--s-y)) scale(1); }
    100% { transform:translate(var(--s-x),calc(var(--s-y) - 70px)) scale(0.2); opacity:0; }
}
@keyframes lbTapPulse {
    0%,100% { opacity:0.3; }
    50%     { opacity:0.75; }
}
@keyframes lbHitParticle {
    0%   { transform: translate(-50%,-50%) rotate(var(--hp-angle)) translateX(0); opacity:1; }
    100% { transform: translate(-50%,-50%) rotate(var(--hp-angle)) translateX(var(--hp-dist)); opacity:0; }
}
@keyframes lbInnerGlow {
    0%,100% { opacity: 0.35; }
    50%     { opacity: 0.9; }
}
@keyframes lbScreenFlash {
    0%   { opacity:0; }
    25%  { opacity:0.65; }
    100% { opacity:0; }
}

/* ── ROOT OVERLAY ──────────────────────────────────────────── */
.lb-anim-overlay {
    position: fixed; inset: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.lb-screen-shake { animation: lbScreenShake 0.32s ease-out !important; }
.lb-screen-flash::after {
    content: '';
    position: absolute; inset: 0;
    background: white;
    z-index: 9999;
    animation: lbScreenFlash 0.28s ease-out forwards;
    pointer-events: none;
}

/* ── DARK BG + RARITY TINT ─────────────────────────────────── */
.lb-bg-dark {
    position: absolute; inset: 0;
    background: #050505;
    transition: background 0.5s ease;
}
.lb-rarity-legendary .lb-bg-dark { background: radial-gradient(ellipse 80% 70% at 50% 42%, #140d00 0%, #020100 60%, #000 100%); }
.lb-rarity-buff      .lb-bg-dark { background: radial-gradient(ellipse 80% 70% at 50% 42%, #00131a 0%, #000d10 60%, #000 100%); }
.lb-rarity-nothing   .lb-bg-dark { background: radial-gradient(ellipse 80% 70% at 50% 42%, #0a0a0a 0%, #050505 60%, #000 100%); }

/* ── AURA (replaces rotating rays — opacity-only animation, GPU-free) */
.lb-aura {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 480px; height: 480px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--lb-rarity-color, #888) 0%, transparent 68%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}
.lb-intensity-1 .lb-aura { --aura-lo:.04; --aura-hi:.06; opacity:.04; }
.lb-intensity-2 .lb-aura { --aura-lo:.07; --aura-hi:.12; opacity:.07; animation: lbAuraPulse 1.2s ease-in-out infinite; }
.lb-intensity-3 .lb-aura { --aura-lo:.12; --aura-hi:.20; opacity:.12; animation: lbAuraPulse 0.9s ease-in-out infinite; }
.lb-intensity-4 .lb-aura { --aura-lo:.18; --aura-hi:.30; opacity:.18; animation: lbAuraPulse 0.55s ease-in-out infinite; }
.lb-phase-explode .lb-aura { opacity: 0.45; }
.lb-phase-reveal  .lb-aura { --aura-lo:.12; --aura-hi:.18; opacity:.12; animation: lbAuraPulse 2s ease-in-out infinite; }

/* ── VIGNETTE ──────────────────────────────────────────────── */
.lb-vignette {
    position: absolute; inset: 0;
    background: radial-gradient(ellipse 60% 55% at 50% 50%, transparent 10%, rgba(0,0,0,.92) 100%);
    pointer-events: none;
}

/* ── STAGE — main content block, vertically centered ──────── */
.lb-stage {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* ── GIFT WRAP (model-viewer container + click target) ─────── */
.lb-gift-wrap {
    position: relative;
    width: 260px; height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform;
}
.lb-gift-wrap:active { cursor: grabbing; }

/* ── INNER GLOW (light from inside, builds with clicks) ────── */
.lb-inner-glow {
    position: absolute;
    top: 50%; left: 50%;
    width: 240px; height: 240px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, var(--lb-rarity-color, #ffd32a) 0%, transparent 60%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 0;
}
.lb-glow-level-1 { opacity: 0.08; }
.lb-glow-level-2 { opacity: 0.18; }
.lb-glow-level-3 { opacity: 0.32; animation: lbInnerGlow 0.9s ease-in-out infinite; }
.lb-glow-level-4 { opacity: 0.50; animation: lbInnerGlow 0.5s ease-in-out infinite; }
.lb-glow-pulse   { animation: lbInnerGlow 0.35s ease-in-out infinite !important; opacity: 0.7 !important; }

/* ── RIPPLE SHOCKWAVE (spawned per click) ───────────────────── */
@keyframes lbRipple {
    0%   { transform: translate(-50%,-50%) scale(0); opacity: 0.55; }
    100% { transform: translate(-50%,-50%) scale(3.5); opacity: 0; }
}
.lb-ripple {
    position: absolute;
    top: 50%; left: 50%;
    width: 130px; height: 130px;
    border-radius: 50%;
    border: 2px solid var(--lb-rarity-color, #fff);
    pointer-events: none;
    animation: lbRipple 0.48s ease-out forwards;
    will-change: transform, opacity;
}

/* ── CLICK TEXT (naturally below gift in flex flow) ─────────── */
.lb-click-text {
    font-size: 1rem;
    font-weight: 700;
    color: rgba(255,255,255,0.6);
    text-shadow: 0 1px 6px rgba(0,0,0,.9);
    letter-spacing: 0.06em;
    text-align: center;
    transition: color 0.2s ease, font-size 0.2s ease;
    min-height: 2rem;
    line-height: 2rem;
}
.lb-click-text.lb-text-intensity-1 { color: rgba(255,255,255,0.75); font-size: 1.05rem; }
.lb-click-text.lb-text-intensity-2 { color: rgba(255,255,255,0.9); font-size: 1.2rem; }
.lb-click-text.lb-text-intensity-3 {
    font-size: 1.35rem; font-weight: 800;
    color: var(--lb-rarity-color, #ffd32a);
}
.lb-click-text.lb-text-intensity-4 {
    font-size: 1.6rem; font-weight: 900;
    color: var(--lb-rarity-color, #ffd32a);
    letter-spacing: 0.1em;
}

/* ── PHASE ANIMATIONS ──────────────────────────────────────── */
.lb-phase-drop .lb-gift-wrap {
    animation: lbGiftDropIn 0.75s cubic-bezier(0.175,0.885,0.32,1.275) forwards;
}
.lb-phase-idle .lb-gift-wrap {
    animation: lbGiftIdle 2.8s ease-in-out infinite;
}
.lb-gift-wrap.lb-hit-1 { animation: lbShake1 0.38s ease-out; }
.lb-gift-wrap.lb-hit-2 { animation: lbShake2 0.4s ease-out; }
.lb-gift-wrap.lb-hit-3 { animation: lbShake3 0.44s ease-out; }
.lb-gift-wrap.lb-hit-4 { animation: lbShake4 0.48s ease-out; }

/* ── EXPLOSION PARTICLES ───────────────────────────────────── */
.lb-explosion-ring { position:absolute; top:50%; left:50%; pointer-events:none; }
.lb-exp-particle {
    position: absolute;
    width: var(--p-size,8px); height: var(--p-size,8px);
    background: var(--p-color,#ffd32a);
    border-radius: 50%;
    top: 0; left: 0;
    animation: lbParticleBurst 0.58s ease-out both;
    will-change: transform, opacity;
}

/* ── HIT PARTICLES ─────────────────────────────────────────── */
.lb-hit-particle {
    position: absolute;
    top: 50%; left: 50%;
    width: var(--hp-size, 5px);
    height: var(--hp-size, 5px);
    background: var(--lb-rarity-color, #ffd32a);
    border-radius: 50%;
    animation: lbHitParticle 0.42s ease-out forwards;
    pointer-events: none;
    will-change: transform, opacity;
}

/* ── REWARD EMERGE ─────────────────────────────────────────── */
.lb-reward-emerge {
    position: relative; z-index: 10;
    display: flex; flex-direction: column;
    align-items: center; gap: 20px;
}
.lb-card-anim { animation: lbCardReveal 0.55s cubic-bezier(0.175,0.885,0.32,1.275) both; }

/* ── REWARD CARD ───────────────────────────────────────────── */
.lb-reward-card {
    position: relative;
    width: 260px;
    padding: 36px 28px 24px;
    border-radius: 20px;
    background: linear-gradient(160deg, rgba(18,12,4,.98) 0%, rgba(6,4,2,.99) 100%);
    border: 2px solid var(--lb-rarity-color,#ffd32a);
    animation: lbCardGlow 1.8s ease-in-out 0.5s infinite;
    overflow: hidden;
    display: flex; flex-direction: column;
    align-items: center; gap: 16px;
}
.lb-card-shine {
    position: absolute; inset: 0;
    background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.18) 48%, transparent 66%);
    animation: lbShineSweep 3s ease-in-out 0.8s infinite;
    pointer-events: none;
}
.lb-card-sparkles-layer { position:absolute; inset:0; pointer-events:none; overflow:visible; }
.lb-sparkle {
    position: absolute;
    top: 50%; left: 50%;
    width: var(--s-size,6px); height: var(--s-size,6px);
    background: var(--s-color,#ffd32a);
    clip-path: polygon(50% 0%,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%);
    animation: lbSparkleFloat 2.4s ease-out var(--s-delay,0s) infinite;
}
.lb-card-inner {
    position: relative; z-index: 2;
    display: flex; flex-direction: column;
    align-items: center; gap: 14px;
}
.lb-reward-icon-big {
    font-size: 5.5rem; line-height: 1;
    animation: lbIconPop 0.5s cubic-bezier(0.175,0.885,0.32,1.275) 0.12s both,
               lbIconFloat 2.4s ease-in-out 0.8s infinite;
}
.lb-reward-label-big {
    font-size: 1.2rem; font-weight: 800;
    color: #fff; text-align: center; max-width: 200px;
    text-shadow: 0 2px 12px rgba(0,0,0,.9);
    letter-spacing: 0.03em;
    animation: lbSlideUp 0.3s ease 0.35s both;
}
.lb-tap-hint {
    font-size: 0.75rem;
    color: rgba(255,255,255,.4);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    animation: lbTapPulse 2s ease-in-out 1.2s infinite;
}

/* ============================================
   ACTIVE BUFF PILLS
   ============================================ */
.lootbox-buffs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    padding: 4px 0;
    min-height: 0;
}
.buff-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    animation: buffAppear 0.3s ease;
    white-space: nowrap;
}
.buff-pill.buff-click {
    background: rgba(255,107,107,0.15);
    border: 1px solid rgba(255,107,107,0.5);
    color: #ff6b6b;
}
.buff-pill.buff-prod {
    background: rgba(123,237,159,0.15);
    border: 1px solid rgba(123,237,159,0.5);
    color: #7bed9f;
}
@keyframes buffAppear {
    from { opacity: 0; transform: scale(0.8); }
    to   { opacity: 1; transform: scale(1); }
}

/* ============================================
   LOOTBOX — Single free box UI
   ============================================ */
.lootbox-single-card {
    background: rgba(255,255,255,0.05);
    border-radius: 16px;
    padding: 24px 20px 20px;
    text-align: center;
    border: 2px solid rgba(255,211,42,0.3);
    transition: border-color 0.3s, box-shadow 0.3s;
}
.lootbox-single-card.lb-ready {
    border-color: #ffd32a;
    box-shadow: 0 0 20px rgba(255,211,42,0.25);
}
.lootbox-single-card.lb-cooldown {
    border-color: rgba(150,150,150,0.3);
    opacity: 0.85;
}
.lb-single-emoji {
    font-size: 3.5rem;
    margin-bottom: 8px;
    animation: lbPulse 2s ease-in-out infinite;
}
.lb-cooldown .lb-single-emoji { animation: none; opacity: 0.5; }
@keyframes lbPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}
.lb-single-name {
    font-weight: 800;
    font-size: 1.2rem;
    color: #ffd32a;
    margin-bottom: 8px;
}
.lb-single-status {
    margin-bottom: 12px;
    font-size: 0.9rem;
}
.lb-ready-badge {
    background: rgba(100,255,120,0.15);
    border: 1px solid rgba(100,255,120,0.5);
    color: #7bed9f;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 700;
}
.lb-cooldown-badge {
    background: rgba(200,200,200,0.1);
    border: 1px solid rgba(200,200,200,0.3);
    color: #aaa;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    font-family: monospace;
}
.lb-rewards-list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
    text-align: left;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.65);
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 10px;
}
.lb-rewards-list li {
    padding: 3px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.lb-rewards-list li:last-child { border-bottom: none; }

/* FAB ready glow effect */
.lootbox-fab.lb-fab-ready {
    animation: lbFabPulse 2s ease-in-out infinite;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4), 0 0 20px rgba(255,211,42,0.6);
}
@keyframes lbFabPulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(0,0,0,0.4), 0 0 15px rgba(255,211,42,0.4); }
    50% { box-shadow: 0 4px 20px rgba(0,0,0,0.4), 0 0 30px rgba(255,211,42,0.8); }
}

.lootbox-admin-test-btn:hover {
    background: rgba(255,107,107,0.18);
    transform: scale(1.03);
    box-shadow: 0 0 15px rgba(255,107,107,0.2);
}

/* ============================================================
   LOOTBOX V3 — Juicy UX upgrades
   Speed lines · Light beams · Confetti · Cracks · Rarity tag · Value ×N
   ============================================================ */

/* ── FAB : double ring pulsant quand disponible ─────────────── */
.lootbox-fab { overflow: visible; }
.lootbox-fab.lb-fab-ready::before,
.lootbox-fab.lb-fab-ready::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(255,211,42,0.75);
    pointer-events: none;
    animation: lbFabRing 2s ease-out infinite;
}
.lootbox-fab.lb-fab-ready::after {
    inset: -11px;
    border-color: rgba(255,211,42,0.3);
    animation-delay: 0.55s;
}
@keyframes lbFabRing {
    0%   { transform: scale(1); opacity: 0.85; }
    100% { transform: scale(1.65); opacity: 0; }
}

/* ── Texte de progression des clics ────────────────────────── */
.lb-click-prompt {
    font-size: 1rem;
    font-weight: 700;
    color: rgba(255,255,255,0.6);
    text-shadow: 0 1px 6px rgba(0,0,0,0.9);
    letter-spacing: 0.07em;
    text-align: center;
    min-height: 2.2rem;
    line-height: 2.2rem;
    transition: color 0.2s ease, font-size 0.15s ease;
    position: relative; z-index: 6;
    pointer-events: none;
}

/* ── Cracks overlay sur le cadeau ──────────────────────────── */
.lb-cracks-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    overflow: visible;
}
.lb-crack {
    position: absolute;
    top: 50%; left: 50%;
    height: 2px;
    width: var(--crack-length, 40%);
    background: linear-gradient(to right, var(--lb-rarity-color, rgba(255,220,80,0.9)) 0%, transparent 100%);
    transform-origin: 0 50%;
    transform: translateY(-50%) rotate(var(--crack-angle, 0deg));
    opacity: var(--crack-opacity, 0.4);
    filter: blur(0.4px);
    box-shadow: 0 0 7px var(--lb-rarity-color, rgba(255,220,80,0.7));
    pointer-events: none;
    transition: opacity 0.15s ease;
}

/* ── Speed lines (horizontal streaks à l'explosion) ─────────── */
.lb-speed-lines-container {
    position: absolute; inset: 0;
    pointer-events: none;
    z-index: 8;
    overflow: hidden;
}
.lb-speed-line {
    position: absolute;
    top: var(--sl-top, 50vh);
    left: 110vw;
    width: var(--sl-width, 150px);
    height: 1px;
    background: linear-gradient(to left, transparent, var(--lb-rarity-color, rgba(255,255,255,0.9)) 45%, transparent);
    animation: lbSpeedLine 0.32s ease-in var(--sl-delay, 0s) forwards;
    pointer-events: none;
}
@keyframes lbSpeedLine {
    0%   { transform: translateX(0); opacity: 0; }
    8%   { opacity: 1; }
    100% { transform: translateX(-135vw); opacity: 0; }
}

/* ── Rayons de lumière (slow rotating beams) ─────────────────── */
.lb-beams {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 1px; height: 1px;
    pointer-events: none;
    z-index: 2;
    animation: lbBeamRotate 28s linear infinite;
}
.lb-beam {
    position: absolute;
    top: 0; left: 0;
    width: 82vmax;
    height: 3px;
    transform-origin: 0 50%;
    transform: translateY(-50%) rotate(var(--beam-angle, 0deg));
    background: linear-gradient(to right, var(--lb-rarity-color, rgba(255,211,42,0.15)) 0%, transparent 62%);
    opacity: var(--beam-opacity, 0.1);
    pointer-events: none;
}
@keyframes lbBeamRotate {
    0%   { transform: translate(-50%,-50%) rotate(0deg); }
    100% { transform: translate(-50%,-50%) rotate(360deg); }
}

/* ── Confettis (legendary) ──────────────────────────────────── */
.lb-confetti-container {
    position: absolute; inset: 0;
    pointer-events: none;
    z-index: 12;
    overflow: hidden;
}
.lb-confetti-piece {
    position: absolute;
    top: -20px;
    width: var(--cf-size, 8px);
    height: calc(var(--cf-size, 8px) * 0.65);
    background: var(--cf-color, #ffd32a);
    animation: lbConfettiFall var(--cf-dur, 2.2s) linear var(--cf-delay, 0s) infinite;
    pointer-events: none;
}
@keyframes lbConfettiFall {
    0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
    80%  { opacity: 0.75; }
    100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ── Badge de rareté (sur la carte) ────────────────────────── */
.lb-rarity-tag {
    font-size: 0.6rem;
    font-weight: 900;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    padding: 5px 18px;
    border-radius: 30px;
    border: 1px solid var(--lb-rarity-color, #ffd32a);
    color: var(--lb-rarity-color, #ffd32a);
    background: rgba(0,0,0,0.55);
    position: relative; z-index: 3;
    text-shadow: 0 0 10px var(--lb-rarity-color, rgba(255,211,42,0.8));
    animation: lbRarityTagDrop 0.45s cubic-bezier(0.175,0.885,0.32,1.275) 0.05s both;
    white-space: nowrap;
}
@keyframes lbRarityTagDrop {
    0%   { transform: translateY(-18px) scale(0.82); opacity: 0; }
    55%  { transform: translateY(3px) scale(1.07); opacity: 1; }
    80%  { transform: translateY(-1px) scale(0.97); }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* ── Valeur principale ×N ───────────────────────────────────── */
.lb-reward-value-big {
    position: relative; z-index: 2;
    text-align: center;
    display: flex; flex-direction: column; align-items: center;
    gap: 0;
    animation: lbValueRise 0.58s cubic-bezier(0.175,0.885,0.32,1.275) 0.2s both;
}
.lb-value-main {
    display: block;
    font-size: 4.8rem;
    font-weight: 900;
    line-height: 1;
    color: var(--lb-rarity-color, #ffd32a);
    text-shadow: 0 0 28px var(--lb-rarity-glow-s, rgba(255,211,42,0.9)), 0 2px 10px rgba(0,0,0,0.95);
    letter-spacing: -0.03em;
}
.lb-value-unit {
    display: block;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.32em;
    color: rgba(255,255,255,0.5);
    margin-top: -5px;
}
@keyframes lbValueRise {
    0%   { transform: scale(0.4) translateY(24px); opacity: 0; }
    55%  { transform: scale(1.13) translateY(-4px); opacity: 1; }
    75%  { transform: scale(0.96) translateY(2px); }
    90%  { transform: scale(1.02); }
    100% { transform: scale(1); opacity: 1; }
}

/* ── Reward card — upgrades V3 ──────────────────────────────── */
.lb-reward-card {
    width: 292px;
    padding-top: 18px;
    gap: 10px;
}
.lb-rarity-legendary .lb-reward-card {
    width: 325px;
    background: linear-gradient(160deg, rgba(28,18,0,.99) 0%, rgba(12,6,0,.99) 100%);
    box-shadow: 0 0 70px rgba(255,211,42,0.38), 0 0 140px rgba(255,211,42,0.12), inset 0 0 35px rgba(255,211,42,0.06);
}
.lb-rarity-legendary .lb-card-shine {
    animation: lbShineSweep 1.5s ease-in-out 0.5s infinite;
    background: linear-gradient(115deg, transparent 20%, rgba(255,240,160,.28) 46%, transparent 72%);
}
.lb-rarity-legendary .lb-reward-icon-big { font-size: 6.2rem; }
.lb-rarity-buff .lb-reward-card {
    background: linear-gradient(160deg, rgba(0,18,28,.99) 0%, rgba(0,10,18,.99) 100%);
}
.lb-rarity-nothing .lb-reward-card {
    width: 242px;
    border-color: rgba(130,130,130,0.4);
    opacity: 0.78;
}
.lb-rarity-nothing .lb-reward-icon-big { font-size: 4rem; opacity: 0.5; }

/* ============================================
   PROFILE SETTINGS TOGGLES
   ============================================ */

.profile-settings-section {
    margin: 14px 0;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
}

.profile-settings-section .profile-label {
    margin-bottom: 10px;
    font-size: 0.8rem;
    color: var(--text-muted, #888);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.profile-setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 0.92rem;
    color: var(--text-primary, #eee);
}

.profile-setting-row + .profile-setting-row {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.setting-perf-label small {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted, #888);
    margin-top: 2px;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
    flex-shrink: 0;
    margin-left: 10px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #555;
    border-radius: 24px;
    transition: background 0.2s;
}

.toggle-slider:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}

input:checked + .toggle-slider {
    background: var(--accent-primary, #6c63ff);
}

input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

/* ============================================
   PERF MODE — 3D → emoji fallback
   ============================================ */

.perf-mode #lb-gift-3d {
    display: none;
}

.perf-mode .lb-gift-wrap::after {
    content: '🎁';
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 100px;
    width: 260px;
    height: 260px;
}
.lb-rarity-nothing .lb-reward-label-big { opacity: 0.62; }
.lb-rarity-nothing .lb-reward-value-big { display: none !important; }

/* ============================================
   COSMETICS SYSTEM
   ============================================ */

/* Koala display container — wraps the base image, layers are absolute within */
.koala-display {
    position: relative;
    flex-shrink: 0;
    /* Size is set by the koala-img content; flex-shrink:0 prevents compression.
       Button's flex centering handles positioning within the round button.
       Layers (absolute) are relative to this container = image bounds. */
}

/* Cosmetic overlay layers — absolute, non-interactive */
.koala-layer {
    position: absolute;
    pointer-events: none;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 2;
}

/* Z-index stacking order */
.koala-costume   { z-index: 1; }
.koala-hat       { z-index: 3; }
.koala-glasses   { z-index: 4; }
.koala-accessory { z-index: 5; }

/* ── Cosmetics FAB ── */
.cosmetics-fab {
    position: fixed;
    bottom: 170px; /* stack above lootbox-fab with gap */
    right: 20px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(160, 90, 220, 0.85), rgba(80, 40, 160, 0.9));
    border: 2px solid rgba(200, 130, 255, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(120, 60, 200, 0.5);
    cursor: pointer;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 900;
}

.cosmetics-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(150, 80, 255, 0.7);
}

/* Completion badge on FAB */
.cosmetics-fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: linear-gradient(135deg, #a855f7, #7c3aed);
    border-radius: 10px;
    padding: 1px 5px;
    font-size: 9px;
    font-weight: 700;
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    pointer-events: none;
    white-space: nowrap;
}

/* Admin unlock all button */
.cosmetics-admin-unlock-all {
    padding: 4px 12px;
    background: rgba(255, 180, 0, 0.15);
    border: 1px solid rgba(255, 180, 0, 0.4);
    border-radius: 8px;
    color: #ffd700;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    white-space: nowrap;
}

.cosmetics-admin-unlock-all:hover {
    background: rgba(255, 180, 0, 0.3);
    color: white;
}

/* ── Cosmetics Modal ── */
.cosmetics-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}

.cosmetics-modal.show {
    display: flex;
}

.cosmetics-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.cosmetics-modal-content {
    position: relative;
    background: linear-gradient(135deg, rgba(25, 15, 50, 0.97), rgba(15, 8, 35, 0.98));
    border: 1px solid rgba(160, 80, 255, 0.4);
    border-radius: 20px;
    padding: 24px;
    width: min(800px, 95vw);
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(160, 80, 255, 0.15);
    z-index: 1;
}

.cosmetics-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.cosmetics-modal-title {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, #c084fc, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.cosmetics-modal-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.cosmetics-modal-close:hover {
    color: white;
    background: rgba(255,255,255,0.1);
}

/* Progress bar */
.cosmetics-progress-bar {
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}

.cosmetics-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #a855f7, #818cf8);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.cosmetics-progress-label {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.5);
    text-align: right;
    margin-top: 3px;
    flex-shrink: 0;
}

/* Category tabs */
.cosmetics-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.cosmetics-tab {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(160, 80, 255, 0.3);
    background: rgba(160, 80, 255, 0.08);
    color: rgba(255,255,255,0.6);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.cosmetics-tab:hover {
    background: rgba(160, 80, 255, 0.2);
    color: white;
}

.cosmetics-tab.active {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.4), rgba(129, 140, 248, 0.4));
    border-color: rgba(200, 130, 255, 0.6);
    color: white;
}

/* Main body: preview + grid */
.cosmetics-body {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 16px;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

/* Preview panel */
.cosmetics-preview-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.cosmetics-preview-display {
    position: relative;
    width: 130px;
    height: 130px;
    border-radius: 16px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(160, 80, 255, 0.2);
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cosmetics-preview-base {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: relative;
    z-index: 1;
    border-radius: 12px;
}

.cosmetics-preview-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
    pointer-events: none;
}

.cosmetics-preview-layer.p-costume  { z-index: 2; }
.cosmetics-preview-layer.p-hat      { z-index: 3; }
.cosmetics-preview-layer.p-glasses  { z-index: 4; }
.cosmetics-preview-layer.p-accessory{ z-index: 5; }

.cosmetics-unequip-btn {
    padding: 5px 14px;
    background: rgba(255,80,80,0.15);
    border: 1px solid rgba(255,80,80,0.35);
    border-radius: 8px;
    color: rgba(255,150,150,0.9);
    font-size: 0.78rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    width: 100%;
    text-align: center;
}

.cosmetics-unequip-btn:hover {
    background: rgba(255,80,80,0.3);
    color: white;
}

.cosmetics-equipped-label {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.35);
    text-align: center;
}

/* Cosmetics grid */
.cosmetics-grid-panel {
    overflow-y: auto;
    padding-right: 4px;
}

.cosmetics-grid-panel::-webkit-scrollbar {
    width: 4px;
}

.cosmetics-grid-panel::-webkit-scrollbar-thumb {
    background: rgba(160,80,255,0.4);
    border-radius: 2px;
}

.cosmetics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
    gap: 8px;
}

/* Cosmetic item card */
.cosmetic-card {
    position: relative;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.2s;
    aspect-ratio: 1;
    justify-content: center;
    user-select: none;
}

.cosmetic-card:hover {
    border-color: rgba(160,80,255,0.5);
    background: rgba(160,80,255,0.12);
    transform: translateY(-2px);
}

.cosmetic-card.locked {
    opacity: 0.45;
    cursor: default;
    filter: grayscale(0.6);
}

.cosmetic-card.locked:hover {
    transform: none;
    border-color: rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
}

.cosmetic-card.equipped {
    border-color: rgba(200,130,255,0.7);
    background: rgba(160,80,255,0.2);
    box-shadow: 0 0 12px rgba(160,80,255,0.4);
}

/* Rarity border accent */
.cosmetic-card[data-rarity="common"]    { --rarity-color: rgba(150,200,255,0.4); }
.cosmetic-card[data-rarity="rare"]      { --rarity-color: rgba(130,100,255,0.5); }
.cosmetic-card[data-rarity="legendary"] { --rarity-color: rgba(255,180,40,0.5); }

.cosmetic-card[data-rarity="rare"]      { border-color: var(--rarity-color); }
.cosmetic-card[data-rarity="legendary"] { border-color: var(--rarity-color); }

.cosmetic-card-icon {
    font-size: 26px;
    line-height: 1;
}

.cosmetic-card-img {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.cosmetic-card-name {
    font-size: 0.62rem;
    color: rgba(255,255,255,0.7);
    text-align: center;
    line-height: 1.2;
    max-width: 68px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cosmetic-card-lock {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 11px;
    opacity: 0.5;
}

.cosmetic-card-equipped-badge {
    position: absolute;
    top: 3px;
    left: 3px;
    font-size: 9px;
    background: rgba(160,80,255,0.8);
    border-radius: 4px;
    padding: 1px 3px;
    color: white;
    font-weight: 700;
}

/* Tint preview swatch */
.cosmetic-tint-swatch {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

/* Empty state */
.cosmetics-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px;
    color: rgba(255,255,255,0.3);
    font-size: 0.9rem;
}

/* Cosmetic unlock toast */
.cosmetic-unlock-toast {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Responsive: collapse preview panel on small screens */
@media (max-width: 540px) {
    .cosmetics-body {
        grid-template-columns: 1fr;
    }

    .cosmetics-preview-panel {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
    }

    .cosmetics-preview-display {
        width: 80px;
        height: 80px;
    }

    .cosmetics-modal-content {
        padding: 16px;
        gap: 12px;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.modal-content--narrow {
    max-width: 400px;
}

.modal-content--xnarrow {
    max-width: 380px;
}

.text-center {
    text-align: center;
}

.welcome-modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.welcome-modal-text {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.welcome-modal-earnings {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--accent-green);
    margin: 20px 0;
}

.welcome-modal-time {
    color: var(--text-muted);
}

.welcome-modal-btn {
    width: 200px;
    height: 50px;
    font-size: 1.2rem;
    border-radius: 10px;
    margin-top: 20px;
}

.auth-subtitle {
    font-size: 0.8rem;
    color: #aaa;
    margin-top: 20px;
}