@import url('./guestRestriction.css');
@import url('./animations.css');

body.loading #ui-container > .screen {
    display: none !important;
}

body.loading #loading-screen {
    display: flex !important;
}

:root {
    --bg-color: #010409;
    --player-blue: #33C6F2;
    --house-cyan: #2DDFB7;
    --price-green: #1AF7AF;
    --price-red: #F73A8E;
    --text-light: #E6EDF3;
    --text-dark: #7D8590;
    --accent-cyan: #00E5FF;
    --accent-glow: rgba(0, 229, 255, 0.4);
    --accent-gold: #FFD700;
    --accent-gold-glow: rgba(255, 215, 0, 0.5);
    --accent-blitz-orange: #FF8C00; /* DarkOrange */
    --accent-blitz-glow: rgba(255, 140, 0, 0.5);
    --red-glow: rgba(247, 58, 142, 0.4);
    --panel-border: rgba(0, 229, 255, 0.2);
}

.text-price-green {
    color: var(--price-green);
}

/* 
 * Custom override for destructive action buttons to match the futuristic theme.
*/
#reset-profile-btn, #confirmation-confirm-btn {
    background-color: rgba(247, 58, 142, 0.15) !important;
    border-color: rgba(247, 58, 142, 0.5) !important;
    color: var(--price-red) !important;
}
#reset-profile-btn:hover, #confirmation-confirm-btn:hover {
    background-color: rgba(247, 58, 142, 0.3) !important;
    border-color: var(--price-red) !important;
    color: var(--text-light) !important;
    box-shadow: 0 0 15px var(--red-glow);
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    background: radial-gradient(ellipse at center, rgba(13, 37, 63, 0.2) 0%, var(--bg-color) 70%), var(--bg-color);
    color: var(--text-light);
    font-family: 'Exo 2', sans-serif;
    -webkit-touch-callout: none; /* iOS Safari */
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none; /* Old Firefox */
    -ms-user-select: none; /* IE 10+ and Edge */
    user-select: none; /* Standard syntax */
}

.font-mono { font-family: 'Roboto Mono', monospace; }

input, textarea {
    -webkit-user-select: text; /* Safari */
    -ms-user-select: text; /* IE 10+ and Edge */
    user-select: text; /* Standard syntax */
}

.screen {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}
.hidden-screen { 
    opacity: 0; 
    pointer-events: none; 
    transform: translateY(20px);
    display: none; /* This is the key fix to prevent event leakage */
}
.duel-arena {
    position: fixed;
    inset: 0;
    background-color: var(--bg-color);
    z-index: 0;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    pointer-events: none;
}
.duel-arena.visible {
    opacity: 1;
}
body.no-scroll {
    width: 100%;
    height: 100%;
    overflow: hidden;
}
body.in-duel {
    /* Force solid black background for the duel, overriding the default gradient */
    background: var(--bg-color) !important;
}

/* Level Chip - compact level badge reused across HUD, profile, and leaderboard */
.level-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
    padding: 2px 6px;
    border-radius: 9999px;
    background: linear-gradient(180deg, rgba(0,229,255,0.15), rgba(140, 0, 255, 0.15));
    border: 1px solid rgba(0,229,255,0.35);
    box-shadow: 0 0 10px rgba(0,229,255,0.15) inset, 0 0 8px rgba(140,0,255,0.1);
    transform: translateZ(0);
}
.level-chip .label {
    font-weight: 800;
    font-size: 10px;
    letter-spacing: 0.06em;
    color: var(--price-green);
}
.level-chip .value {
    font-weight: 900;
    font-size: 12px;
    color: var(--accent-cyan);
}

/* --- Tutorial Styles --- */
#tutorial-overlay {
    /* Make it a full-screen flex container */
    position: absolute;
    inset: 0;
    flex-direction: column;
    padding: 2rem 1rem; /* Using rem for consistent padding */
    z-index: 1000; /* Above backdrop and highlighter */
    pointer-events: none; /* Allow clicks to pass through the overlay itself */
}

/* Make the panel and buttons clickable */
#tutorial-overlay > * {
    pointer-events: auto;
}

#tutorial-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(1, 4, 9, 0.6);
    backdrop-filter: blur(5px);
    z-index: 990;
    opacity: 0;
    transition: opacity 0.3s ease-out, clip-path 0.35s ease-in-out;
    pointer-events: none;
    clip-path: polygon(0% 0%, 0% 100%, 100% 100%, 100% 0%, 0% 0%);
}
body.tutorial-active #tutorial-backdrop {
    opacity: 1;
}
#tutorial-highlighter {
    position: absolute;
    z-index: 991;
    pointer-events: none;
    transition: all 0.3s ease-in-out;
    box-shadow: 0 0 0 3px var(--accent-cyan), 0 0 25px var(--accent-cyan);
    border-radius: 8px;
    opacity: 0;
}
#tutorial-highlighter.visible {
    opacity: 1;
}

/* --- Staggered Entry Animation --- */
.animated-entry > * {
    animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
}
.animated-entry > *:nth-child(1) { animation-delay: 0.1s; }
.animated-entry > *:nth-child(2) { animation-delay: 0.2s; }
.animated-entry > *:nth-child(3) { animation-delay: 0.3s; }
.animated-entry > *:nth-child(4) { animation-delay: 0.4s; }
.animated-entry > *:nth-child(5) { animation-delay: 0.5s; }
.animated-entry > *:nth-child(6) { animation-delay: 0.6s; }

/* --- New Duel Screen Entry Animation --- */
.duel-screen-animated-entry > * {
    animation: zoom-in-fade-up 0.6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    opacity: 0;
}
.duel-screen-animated-entry > *:nth-child(1) { animation-delay: 0.1s; }
.duel-screen-animated-entry > *:nth-child(2) { animation-delay: 0.25s; }
.duel-screen-animated-entry > *:nth-child(3) { animation-delay: 0.4s; }
.duel-screen-animated-entry > *:nth-child(4) { animation-delay: 0.5s; }
.duel-screen-animated-entry > *:nth-child(5) { animation-delay: 0.6s; }

/* --- Auth/Menu Styles --- */
.title {
    font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase;
    background: linear-gradient(to bottom, var(--text-light) 70%, #b0c4de);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 15px var(--accent-glow);
}
.menu-btn {
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid var(--panel-border);
    color: var(--text-dark);
    padding: 0.5rem 1rem;
    font-weight: 700;
    font-size: 0.875rem;
    border-radius: 8px;
    transition: all 0.2s ease-out;
    text-align: center;
    cursor: pointer;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.menu-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}
.menu-btn-icon svg {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    color: var(--text-dark);
    transition: color 0.2s ease-out;
}
/* New Auth Button Styles */
.auth-btn {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    width: 100%;
    padding: 0.6rem 1rem; /* Slimmer: 10px vertical, 16px horizontal */
    gap: 0.75rem; /* 12px */
    border: 1px solid var(--panel-border);
    border-radius: 4px;
    color: var(--text-dark);
    background-color: transparent;
    font-weight: 700;
    font-size: 1rem; /* text-base */
    transition: all 0.3s ease;
    cursor: pointer;
}
.auth-btn:hover {
    color: var(--text-light);
    border-color: var(--accent-cyan);
    background-color: var(--accent-glow);
    box-shadow: 0 0 15px var(--accent-glow);
}
.menu-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.menu-panel {
    background: rgba(1, 4, 9, 0.75);
    backdrop-filter: blur(10px);
    border: 1px solid var(--panel-border);
    border-radius: 0.75rem;
    box-shadow: 0 0 25px rgba(0, 229, 255, 0.1);
    padding: 1.5rem;
}

/* Mute button icon visibility */
#toggle-duel-music-btn .duel-music-icon-off,
#toggle-duel-music-btn-mobile .duel-music-icon-off { display: none; }
#toggle-duel-music-btn .duel-music-icon-on,
#toggle-duel-music-btn-mobile .duel-music-icon-on { display: block; }

#toggle-duel-music-btn.is-muted .duel-music-icon-on,
#toggle-duel-music-btn-mobile.is-muted .duel-music-icon-on { display: none; }
#toggle-duel-music-btn.is-muted .duel-music-icon-off,
#toggle-duel-music-btn-mobile.is-muted .duel-music-icon-off { display: block; }

/* Apply to all menu screens. ID added for specificity to fix potential conflicts. */
#leverage-selection-screen, .menu-grid-background {
    /* A deep space background with parallax stars, sits on top of the body's gradient */
    background-color: transparent;
    background-image: 
        /* Layer 1: Close, dim stars */
        radial-gradient(circle, rgba(229, 237, 243, 0.4) 1px, transparent 1.5px),
        /* Layer 2: Mid-distance, brighter stars */
        radial-gradient(circle, rgba(229, 237, 243, 0.6) 1px, transparent 1.5px),
        /* Layer 3: Far, faint stars */
        radial-gradient(circle, rgba(229, 237, 243, 0.3) 1px, transparent 1.5px);
    background-repeat: repeat;
    background-size: 400px 400px, 250px 250px, 150px 150px;
    animation: stars-pan 300s linear infinite;
}

#ui-container {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 100; /* Ensure it's above duel-arena */
    background-color: transparent; /* Ensure it doesn't block background */
}

/* --- Hover Media Query --- */
/* These styles will only apply on devices that can truly hover, like a desktop with a mouse. */
@media (hover: hover) and (pointer: fine) {
    .menu-btn:hover:not(:disabled) {
        color: var(--text-light);
        background: var(--accent-glow);
        border-color: var(--accent-cyan);
        box-shadow: 0 0 20px var(--accent-glow);
        transform: translateY(-2px);
    }
    .menu-btn-icon:hover:not(:disabled) svg {
        color: var(--text-light);
    }
}

/* --- Active state for toggle buttons in settings --- */
.menu-btn.active {
    background: var(--accent-cyan);
    color: var(--bg-color);
    border-color: var(--accent-cyan);
}

/* --- Leverage Confirm Button - Green, Glowing, Animated --- */
#confirm-leverage-btn {
    background: linear-gradient(135deg, var(--price-green), #0fd891) !important;
    border: 2px solid var(--price-green) !important;
    color: var(--bg-color) !important;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    box-shadow:
        0 0 20px rgba(26, 247, 175, 0.3),
        0 0 40px rgba(26, 247, 175, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    animation: leverage-confirm-pulse 2s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

#confirm-leverage-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: leverage-confirm-shimmer 3s ease-in-out infinite;
}

#confirm-leverage-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #2fff94, var(--price-green)) !important;
    border-color: #4effc4 !important;
    box-shadow:
        0 0 30px rgba(26, 247, 175, 0.5),
        0 0 60px rgba(26, 247, 175, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

#confirm-leverage-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow:
        0 0 15px rgba(26, 247, 175, 0.4),
        inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

#confirm-leverage-btn:disabled {
    background: linear-gradient(135deg, #666, #555) !important;
    border-color: #666 !important;
    color: #999 !important;
    box-shadow: none;
    animation: none;
}

#confirm-leverage-btn:disabled::before {
    display: none;
}

/* Animations */
@keyframes leverage-confirm-pulse {
    0%, 100% {
        box-shadow:
            0 0 20px rgba(26, 247, 175, 0.3),
            0 0 40px rgba(26, 247, 175, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
    50% {
        box-shadow:
            0 0 30px rgba(26, 247, 175, 0.5),
            0 0 60px rgba(26, 247, 175, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
}

@keyframes leverage-confirm-shimmer {
    0% {
        left: -100%;
    }
    20%, 100% {
        left: 100%;
    }
}

/* --- Carousel Smoothing --- */
/* These properties enable native, hardware-accelerated scrolling on mobile devices,
   providing a much smoother "swipe" experience for the asset selection carousel. */
#carousel-viewport {
    scroll-snap-type: x mandatory; /* Ensures the carousel snaps to an item. */
    -webkit-overflow-scrolling: touch; /* Enables momentum-based scrolling on iOS. */
}

#coin-list {
    will-change: transform; /* Hints to the browser to optimize this element for scrolling. */
}

#coin-list > * {
    scroll-snap-align: center; /* Aligns the center of each item with the center of the viewport. */
}

/* --- Modal Styles --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(1, 4, 9, 0.8); /* Dark overlay */
    backdrop-filter: blur(8px); /* Frosted glass effect */
    z-index: 1000; /* Ensure it's on top */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease-out;
    pointer-events: none; /* Hidden by default */
}

.modal-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: rgba(13, 17, 23, 0.95); /* Slightly lighter than overlay */
    border: 1px solid var(--panel-border);
    border-radius: 0.75rem;
    box-shadow: 0 0 25px rgba(0, 229, 255, 0.15);
    padding: 2rem;
    max-width: 400px;
    text-align: center;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s ease-out;
}

.modal-content.wide {
    max-width: 600px;
}

/* Mobile-specific styles for confirmation modal */
@media (max-width: 639px) {
    .modal-content {
        padding: 1.5rem 1rem;
        margin: 0 1rem;
        max-height: 80vh;
        overflow-y: auto;
    }
    
    .modal-content.wide {
        max-width: none;
    }
    
    .confirmation-content.wide {
        max-width: none;
    }
    
    /* Make the confirmation modal more compact on mobile */
    .modal-title {
        font-size: 1.5rem;
        margin-bottom: 0.75rem;
    }
    
    .modal-message {
        font-size: 0.9rem;
        margin-bottom: 1rem;
        line-height: 1.4;
    }
    
    .modal-button, .modal-button-secondary {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
}

.confirmation-content.wide {
    max-width: 600px;
}

#confirmation-message {
    text-align: center;
}

.modal-overlay.visible .modal-content {
    transform: translateY(0);
    opacity: 1;
}

.modal-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent-cyan);
    margin-bottom: 1rem;
    text-shadow: 0 0 10px var(--accent-glow);
}

.modal-message {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.modal-button, .modal-button-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0.5rem;
}

.modal-button {
    background-color: var(--accent-cyan);
    color: var(--bg-color);
    border: 1px solid var(--accent-cyan);
    box-shadow: 0 0 15px var(--accent-glow);
}

.modal-button:hover {
    background-color: var(--player-blue);
    box-shadow: 0 0 20px var(--accent-glow);
}

.modal-button-secondary {
    background-color: transparent;
    color: var(--text-dark);
    border: 1px solid var(--panel-border);
}

.modal-button-secondary:hover {
    color: var(--text-light);
    border-color: var(--accent-cyan);
    background-color: rgba(0, 229, 255, 0.1);
}

/* Style for the "missing" special ability button */
.ability-btn.call-to-action {
    background-color: rgba(255, 255, 255, 0.05); /* Very subtle background */
    border-color: rgba(255, 255, 255, 0.2); /* Light border */
    color: var(--text-dark); /* Dim text */
    box-shadow: none; /* No glow */
    cursor: pointer;
}

.ability-btn.call-to-action:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-cyan);
    color: var(--text-light);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
}

.ability-btn.call-to-action .ability-btn-icon {
    font-size: 1.5rem; /* Make the question mark prominent */
    color: var(--text-dark);
}

/* --- Mobile-specific Overrides --- */
@media (max-width: 639px) {
    /* Make leverage selection screen more compact */
    #leverage-selection-screen .menu-panel {
        padding: 1rem;
    }
    .briefing-item-btn {
        width: 48px;
        height: 48px;
        padding: 0.5rem;
    }
    .briefing-item-btn .icon { 
        font-size: 28px; 
        width: 32px;
        height: 32px;
    }
    .briefing-item-btn .title { 
        display: none;
    }
}
.ability-btn.gray {
    background-color: rgba(128, 128, 128, 0.2);
    border-color: rgba(128, 128, 128, 0.5);
    color: #9ca3af; /* text-gray-400 */
}
.ability-btn.gray:hover {
    background-color: rgba(128, 128, 128, 0.4);
    border-color: #9ca3af;
    color: var(--text-light);
}
.ability-btn-mobile-rebuilt.gray {
    background-color: rgba(128, 128, 128, 0.2);
    border-color: rgba(128, 128, 128, 0.5);
    color: #9ca3af;
}
.ability-btn-mobile-rebuilt.gray:hover {
    background-color: rgba(128, 128, 128, 0.4);
    border-color: #9ca3af;
    color: var(--text-light);
}

.music-preview-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem; /* 28px */
    height: 1.75rem; /* 28px */
    border-radius: 9999px; /* circle */
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-dark);
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    flex-shrink: 0; /* Prevent the button from shrinking */
}

.music-preview-btn:hover {
    background-color: rgba(0, 229, 255, 0.2);
    color: var(--text-light);
}

.music-preview-btn.is-playing {
    background-color: var(--accent-cyan);
    color: var(--bg-color);
}

.emote-picker-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.emote-picker-item:hover {
    background: var(--accent-glow);
    border-color: var(--accent-cyan);
    transform: translateY(-4px);
}

.emote-display {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2.5rem; /* 40px */
    z-index: 50;
    animation: emote-pop-up 2.5s ease-out forwards;
    text-shadow: 0 2px 8px rgba(0,0,0,0.7);
    pointer-events: none;
}

select.menu-btn {
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2' stroke='%237D8590'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19.5 8.25l-7.5 7.5-7.5-7.5' /%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 0.7rem center; background-size: 1.2em; padding-right: 2.5rem;
}

/* --- Game Over Screen Animation --- */
#game-over-screen.is-visible #game-over-content {
    animation: fadeInUp 0.5s 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
}

@keyframes title-glow-pulse {
    0%, 100% {
        text-shadow: 0 0 15px var(--accent-glow);
    }
    50% {
        text-shadow: 0 0 25px var(--accent-cyan), 0 0 40px var(--accent-glow);
    }
}

/* Styles for Bundle Contents in Purchase Modal */
.purchase-bundle-contents {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.75rem; /* 12px */
    padding: 0.5rem;
    max-height: 100%;
    overflow-y: auto;
}

.purchase-bundle-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem; /* 4px */
    padding: 0.5rem;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 0.375rem; /* 6px */
}

.purchase-bundle-item .name {
    font-size: 0.75rem; /* 12px */
    color: var(--text-dark);
    text-align: center;
    line-height: 1.2;
}

/* Styles for Recently Played List */
.recent-player-entry { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem; background-color: rgba(0, 229, 255, 0.05); border-radius: 0.5rem; border: 1px solid var(--panel-border); }
.recent-player-avatar { width: 2.5rem; height: 2.5rem; border-radius: 9999px; overflow: hidden; background-color: #010409; flex-shrink: 0; }
.recent-player-name { flex-grow: 1; font-weight: 700; color: var(--text-light); }
.add-recent-friend-btn:disabled { opacity: 0.6; cursor: not-allowed; background-color: rgba(255, 255, 255, 0.1) !important; border-color: var(--panel-border) !important; color: var(--text-dark) !important; }

/* Currency Display Styles (used on Main Menu and Store) */
.currency-display {
    display: flex;
    align-items: center;
    gap: 0.5rem; /* 8px */
    background-color: rgba(0, 229, 255, 0.05);
    border: 1px solid var(--panel-border);
    padding: 0.25rem 0.75rem; /* 4px 12px */
    border-radius: 9999px; /* pill shape */
    font-weight: 700;
    font-size: 0.875rem; /* 14px */
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s ease;
}
.currency-display:hover {
    background-color: rgba(0, 229, 255, 0.1);
    border-color: var(--accent-cyan);
}

/* Main Menu Redesign 2.0 */
#main-menu-screen .menu-panel {
    max-width: 480px;
    padding: 2rem;
    background: rgba(1, 4, 9, 0.85);
    backdrop-filter: blur(15px);
}

/* Make main menu wider on desktop */
@media (min-width: 768px) {
    #main-menu-screen .menu-panel {
        max-width: 560px;
        padding: 2.5rem;
    }
}

/* Even wider main menu on larger desktop screens */
@media (min-width: 1024px) {
    #main-menu-screen .menu-panel {
        max-width: 600px;
        padding: 3rem;
    }
}

.avatar-glow {
    box-shadow: 0 0 25px var(--accent-glow), 0 0 40px rgba(0, 229, 255, 0.2);
}

/* ROBUST MAIN MENU AVATAR STYLING */
#main-menu-avatar-canvas,
#main-menu-avatar-emoji,
#main-menu-avatar-img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: inherit !important;
    pointer-events: none !important;
}

#main-menu-avatar-emoji {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 4rem !important;
    background: transparent !important;
    z-index: 10 !important;
}

#main-menu-avatar-canvas {
    z-index: 5 !important;
    background: transparent !important;
}

#main-menu-avatar-img {
    z-index: 3 !important;
    object-fit: contain !important;
}

/* ENSURE AVATAR CONTAINER IS ALWAYS VISIBLE */
.menu-panel .relative.w-32.h-32 {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 8rem !important;
    min-height: 8rem !important;
    background: rgba(0, 0, 0, 0.3) !important;
}

.menu-panel .bg-black\/30 {
    background: rgba(0, 0, 0, 0.3) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* HIDE LOADER FOR MAIN MENU */
#main-menu-avatar-loader {
    display: none !important;
}

.menu-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.menu-btn-icon-text {
    display: inline-block;
}

.grid .menu-btn {
    height: 100%;
    padding: 0.75rem;
    font-size: 1rem;
}

.col-span-2 {
    grid-column: span 2 / span 2;
}

.py-3 {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.text-lg {
    font-size: 1.125rem;
    line-height: 1.75rem;
}

.text-2xl {
    font-size: 1.5rem;
    line-height: 2rem;
}

/* Main Menu Redesign */
#main-menu-player-header {
    margin-bottom: 1rem;
}

#main-menu-player-header .relative {
    width: 6rem; /* 96px */
    height: 6rem; /* 96px */
}

#main-menu-player-name {
    font-size: 1.25rem; /* text-xl */
}

.currency-display {
    margin-bottom: 1rem;
}

.grid .menu-btn {
    height: 100%;
}

.col-span-2 {
    grid-column: span 2 / span 2;
}

.py-3 {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.text-lg {
    font-size: 1.125rem;
    line-height: 1.75rem;
}

/* Utility classes */
.text-center {
    text-align: center;
}

/* --- Leverage Selection Briefing Items --- */
.briefing-item-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    padding: 0.5rem;
    background: rgba(1, 4, 9, 0.6);
    border: 1px solid var(--panel-border);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease-out;
}

.briefing-item-btn:hover {
    background: var(--accent-glow);
    border-color: var(--accent-cyan);
    transform: translateY(-2px);
}

.briefing-item-btn.active {
    background: var(--accent-cyan);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px var(--accent-glow);
}

.briefing-item-btn .icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.briefing-item-btn .title {
    font-size: 0.7rem;
    font-weight: 700;
    text-align: center;
    margin-top: 0.25rem;
    color: var(--text-light);
    /* Allow wrapping to prevent overflow on long names */
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.1;
    width: 100%;
}

/* Hide text for abilities on desktop, show only icons */
@media (min-width: 640px) {
    .briefing-item-btn .title {
        display: none;
    }
    
    /* Adjust icon size when text is hidden */
    .briefing-item-btn .icon {
        width: 48px;
        height: 48px;
        font-size: 48px;
    }
    
    /* Make buttons square when text is hidden */
    .briefing-item-btn {
        width: 80px;
        height: 80px;
        margin: 0.5rem;
    }
    
    /* Better alignment for the ability rows */
    .briefing-row {
        display: flex;
        justify-content: center;
        gap: 1rem;
        margin: 1rem 0;
    }
    
    /* Center the special ability container */
    #leverage-special-ability-container {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    #leverage-special-ability-row {
        display: flex;
        justify-content: center;
        gap: 1rem;
        margin: 1rem 0;
    }
}

/* Make special ability tile wider and more tolerant to text length */
.briefing-item-btn[data-type="specialAbility"] {
    width: 8rem; /* ~w-32 */
    max-width: 100%;
}
.briefing-item-btn[data-type="specialAbility"] .title {
    font-size: 0.75rem;
}
