 
/* uInker Game Styles */

/* Desktop 90% zoom for game page only - better overview without being too small */
@media (min-width: 1024px) {
    /* Only apply zoom to game page, not login or lobby */
    body.game-page {
        zoom: 0.9;
        -webkit-transform: scale(0.9);
        -webkit-transform-origin: 0 0;
        transform: scale(0.9);
        transform-origin: 0 0;
        width: 111%; /* Compensate for the scaling (1/0.9) */
        height: 111%;
    }
}

/* Canvas and Drawing Styles */
.canvas-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    aspect-ratio: 8/5;
    border: 3px solid #999; /* Darker and thicker border to show better when zoomed */
    border-radius: 8px;
    overflow: hidden;
    background-color: white;
    margin: 0 auto;
    /* Improve border rendering when zoomed */
    box-shadow: 0 0 0 1px #666; /* Inner shadow for extra definition */
}

/* Extra border definition for zoomed game pages */
.game-page .canvas-container {
    border-color: #777; /* Darker border when zoomed */
    border-width: 3px;
}

/* Premium users get larger canvas when ads are removed */
.premium-layout .canvas-container {
    max-width: 1000px;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    /* Fix room card consistent heights on mobile */
    .room-item, .skeleton-room {
        min-height: 120px !important;
        height: auto !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* Ensure skeleton cards match real card layout */
    .skeleton-room {
        min-height: 120px !important;
        padding: 0.75rem !important;
    }
    
    /* Fix grid gaps for consistent spacing */
    #default-rooms, #custom-rooms, #default-rooms-skeleton, #custom-rooms-skeleton {
        gap: 0.75rem !important;
    }
}

/* Fix chat and guesses containers to flow normally - newest messages at bottom */
#guesses-container, #chat-container {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important; /* Change to flex-start to allow normal scrolling */
    padding-bottom: 8px !important; /* Less space - push bubbles down just a little */
    overflow-y: auto !important; /* Enable scrolling */
    max-height: 100%; /* Ensure containers don't exceed their bounds */
}

/* Fix both containers properly with lots of white space */
#guesses-container, #chat-container {
    margin: 8px !important; /* White space around the grey container inside white container */
    margin-bottom: 40px !important; /* Much bigger gap so grey doesn't get cut off by input */
    padding: 12px !important; /* White space inside grey containers */
    padding-bottom: 4px !important; /* Less padding = bubbles go down more, closer to input */
}


/* Desktop override - restore scrolling when window is small but on desktop */
@media (max-width: 768px) and (hover: hover) and (pointer: fine) {
    /* Remove mobile height constraints on desktop */
    .grid > div:nth-child(2) > div:nth-child(1) {
        max-height: none !important;
    }
    
    .grid > div:nth-child(2) > div:nth-child(1) .bg-white.rounded-lg.shadow-md {
        max-height: none !important;
    }
}


/* Narrow window layout adjustments - applies when window gets skinny */
@media screen and (max-width: 1200px) {
    /* Change grid to single column when window is narrow */
    .grid {
        display: block !important;
    }
    
    /* Canvas area - full width at top */
    .grid > div:nth-child(1) {
        width: 100% !important;
        margin-bottom: 0.25rem; /* Very small gap */
    }
    
    /* Player/Guess area - put side by side */
    .grid > div:nth-child(2) {
        width: 100% !important;
        display: flex !important;
        gap: 1rem; /* Slightly bigger horizontal gap between guess and players */
        margin-bottom: 0.25rem; /* Small vertical gap */
    }
    
    /* Each section in the middle row takes half width */
    .grid > div:nth-child(2) > div {
        flex: 1;
        margin-bottom: 0 !important;
    }
    
    /* Chat area - full width at bottom */
    .grid > div:nth-child(3) {
        grid-column: 1 !important;
        grid-row: 3 !important;
        width: 100% !important;
        margin-top: 1.5rem !important; /* Move chat down on narrow windows including mobile */
    }
}

/* Mobile landscape layout - with desktop exclusion */
/* Mobile landscape layout - with desktop exclusion */
@media screen and (orientation: landscape) and (max-width: 900px) and (pointer: coarse) and (hover: none) {
    /* REMOVED: Fix page isolation and prevent scroll-through - this breaks desktop scrolling */
    /* REMOVED: body, html overflow and min-height constraints */
    
    #login-page.hidden, #room-list-page.hidden, #game-page.hidden {
        display: none !important;
        visibility: hidden !important;
    }
    /* Make lobby buttons smaller in landscape mode */
    #room-list-page .room-card button {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.625rem !important;
        width: auto !important;
        min-width: unset !important;
    }
    
    /* Make upgrade to premium button smaller in lobby landscape mode */
    #room-list-page #upgrade-membership-btn-lobby {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.625rem !important;
        width: auto !important;
        min-width: unset !important;
    }
    
    /* Make join uinker button smaller in lobby landscape mode */
    #room-list-page #join-uinker-btn-lobby {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.625rem !important;
        width: auto !important;
        min-width: unset !important;
    }
    
    /* Add padding to uInker Rooms title text and make it bigger */
    #room-list-page h1 {
        padding: 0.5rem !important;
        margin: 0.5rem 0 !important;
        font-size: 2rem !important;
    }
    
    /* Ensure game page starts at top when entering room */
    #game-page {
        scroll-behavior: smooth !important;
        overflow-x: hidden !important;
        position: relative !important;
    }
    
    #game-page:not(.hidden) {
        animation: scrollToTop 0.1s ease-out !important;
    }
    
    @keyframes scrollToTop {
        from { 
            scroll-behavior: auto !important;
        }
        to { 
            scroll-behavior: auto !important;
        }
    }
    
    /* Override grid to create 2x2 layout - ONLY on game page */
    #game-page .grid {
        display: grid !important;
        grid-template-columns: 2fr 1fr !important;
        grid-template-rows: auto auto !important;
        row-gap: 0.125rem !important; /* Small vertical gap */
        column-gap: 0.5rem !important; /* Slightly bigger horizontal gap */
    }
    
    /* Canvas area - position 1,1 (top left) */
    .grid > div:nth-child(1) {
        grid-column: 1 !important;
        grid-row: 1 !important;
    }
    
    /* Sidebar column - split into two positions */
    .grid > div:nth-child(2) {
        display: contents !important; /* This breaks the div and lets children position individually */
    }
    
    /* Guess box (first child of sidebar) - position 2,1 (top right) */
    .grid > div:nth-child(2) > div:nth-child(1) {
        grid-column: 2 !important;
        grid-row: 1 !important;
        /* REMOVED: flex display and justify-content that was breaking chat flow */
    }
    
    /* Player list (second child of sidebar) - position 1,2 (bottom left) - make smaller to fit */
    .grid > div:nth-child(2) > div:nth-child(2) {
        grid-column: 1 !important;
        grid-row: 2 !important;
        width: 50% !important;
        margin-right: auto !important;
    }
    
    /* Chat box - position 2,2 (bottom right) - make wider to match player list */
    #game-page .grid > div:nth-child(3) {
        grid-column: 2 !important;
        grid-row: 2 !important;
        width: 200% !important;
        transform: translateX(-50%) !important;
        margin-top: 0 !important; /* Flush with top of players container */
        padding-top: 0 !important;
    }
    
    /* Canvas size */
    .canvas-container {
        max-width: 380px !important;
        aspect-ratio: 4/3 !important;
    }
    
    /* Guess container slightly smaller height - handled by more specific selector below */
    
    /* Player list compact */
    #players-list {
        height: 80px !important;
        overflow-y: auto;
    }
    
    /* Chat and guesses compact - match canvas height for landscape */
    #chat-container {
        height: 150px !important; /* Bigger since input is now smaller */
        margin-bottom: 8px !important; /* Reduce the big white space gap on mobile landscape */
        margin-top: 8px !important;
    }
    
    #guesses-container {
        height: 180px !important;
        margin-bottom: 8px !important; /* Reduce the big white space gap on mobile landscape */
        margin-top: 8px !important;
    }
    
    /* Make guess container wrapper match left container height on landscape - middle value */
    .grid > div:nth-child(2) > div:nth-child(1) {
        height: 370px !important; /* Between 350px (too small) and 390px (too big) */
        max-height: 370px !important;
        overflow: hidden !important;
    }
    
    /* Make grey guesses area fill most of the container like chat format */
    #guesses-container {
        height: 280px !important; /* Leave room for input at bottom */
        min-height: 280px !important;
        margin-bottom: 8px !important;
        margin-top: 8px !important;
    }
    
    
    /* Compact spacing */
    .bg-white.rounded-lg.shadow-md {
        padding: 0.25rem !important;
        margin-bottom: 0.25rem !important;
    }
    
    /* Smaller buttons for landscape mode */
    #game-page button {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.75rem !important;
        line-height: 1 !important;
    }
    
    /* Smaller header buttons specifically */
    .flex.gap-1 button {
        padding: 0.125rem 0.25rem !important;
        font-size: 0.625rem !important;
        margin: 0 !important;
    }
    
    /* Compact upgrade button */
    #upgrade-membership-btn-game {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.75rem !important;
        /* Allow transform for animation - overridden by specific animation rules below */
    }
    
    
    /* Make chat input moderately sized on mobile landscape */
    #game-page #chat-input {
        padding: 0.5rem 0.75rem !important;
        font-size: 1rem !important;
        height: 2.75rem !important;
        min-height: 2.75rem !important;
        line-height: 1.4 !important;
    }
    
    #game-page #send-chat-btn {
        padding: 0.5rem 1rem !important;
        font-size: 1rem !important;
        height: 2.75rem !important;
        min-height: 2.75rem !important;
        line-height: 1.4 !important;
    }
    
    /* Make all text in chat containers smaller */
    #chat-container * {
        font-size: 0.75rem !important;
    }
    
    /* Target usernames specifically */
    .player-name, .message-content {
        font-size: 0.75rem !important;
    }
    
    /* Target any waiting prompts */
    #chat-container div {
        font-size: 0.75rem !important;
    }
    
    /* Compact header with uInker and upgrade on same row */
    .flex.justify-between.items-center.mb-4.pb-3.border-b {
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        margin-bottom: 0.125rem !important;
        padding-bottom: 0.0625rem !important;
        position: relative !important;
        flex-wrap: wrap !important;
    }
    
    /* uInker title on left side of first row */
    .flex.justify-between.items-center.mb-4.pb-3.border-b > div:first-child {
        flex: 0 0 auto !important;
        order: 1 !important;
        text-align: left !important;
    }
    
    /* Upgrade button alone on second row centered */
    .flex.justify-between.items-center.mb-4.pb-3.border-b > div:nth-child(2) {
        flex: 1 1 100% !important;
        order: 3 !important;
        display: flex !important;
        justify-content: center !important;
        margin-top: 0.25rem !important;
    }
    
    /* Make uInker text compact */
    .w-1\/4 h1 {
        font-size: 0.875rem !important;
        margin: 0 !important;
        line-height: 1 !important;
    }
    
    .w-1\/4 p {
        display: none !important;
    }
    
    /* Upgrade button on same row as uInker - make smaller to match other buttons */
    #upgrade-membership-btn-game {
        padding: 0.0625rem 0.0625rem !important;
        font-size: 0.25rem !important;
        /* Allow transform for animation - overridden by specific animation rules below */
        line-height: 1 !important;
        margin: 0 !important;
        order: 2 !important;
    }
    
    /* Make upgrade button text smaller */
    #upgrade-membership-btn-game span,
    #upgrade-membership-btn-game * {
        font-size: 0.25rem !important;
    }
    
    /* Other buttons on first row with uInker */
    .w-1\/4:last-child {
        flex: 1 1 auto !important;
        display: flex !important;
        gap: 0.125rem !important;
        flex-wrap: wrap !important;
        justify-content: flex-end !important;
        align-items: center !important;
        order: 2 !important;
        margin-top: 0 !important;
        padding-bottom: 0.25rem !important;
    }
    
    .w-1\/4:last-child button {
        padding: 0.0625rem 0.0625rem !important;
        font-size: 0.25rem !important;
        line-height: 1 !important;
        margin: 0 !important;
    }
    
    /* Smaller all headers and text */
    h1, h2, h3 {
        font-size: 0.875rem !important;
    }
    
    /* Compact room info section */
    .flex.justify-between.items-center.mb-3 {
        margin-bottom: 0.125rem !important;
        gap: 0.125rem !important;
    }
    
    /* Make room title and round info slightly bigger */
    #room-title {
        font-size: 0.75rem !important;
        margin: 0 !important;
        line-height: 1 !important;
    }
    
    #timer, #round-info {
        font-size: 0.625rem !important;
        padding: 0.125rem 0.25rem !important;
        line-height: 1 !important;
    }
    
    #word-to-draw-outside {
        font-size: 0.625rem !important;
        padding: 0.125rem 0.25rem !important;
        line-height: 1 !important;
    }
    
    /* Make room info sections more compact */
    .flex.justify-between.items-center.mb-3 > div {
        flex-shrink: 1 !important;
        min-width: 0 !important;
    }
    
    /* Modal popups for landscape mode - make them fit and scrollable - ONLY on game page */
    #game-page .fixed.inset-0.bg-black {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
    }
    
    #game-page .fixed.inset-0 > div {
        max-width: 90vw !important;
        max-height: 85vh !important;
        overflow-y: auto !important;
        margin: 0 !important;
        position: relative !important;
    }
    
    /* Specific modal containers - ONLY on game page */
    #game-page #profile-modal .bg-white,
    #game-page #friends-modal .bg-white,
    #game-page #create-room-modal .bg-white {
        max-width: 90vw !important;
        max-height: 80vh !important;
        overflow-y: auto !important;
        padding: 0.5rem !important;
        margin: 0 !important;
    }
    
    /* Premium modal - make much thinner - ONLY on game page */
    #game-page #premium-upgrade-modal .bg-white {
        max-width: 60vw !important;
        max-height: 80vh !important;
        overflow-y: auto !important;
        padding: 0.5rem !important;
        margin: 0 !important;
    }
    
    /* Make modal content more compact - ONLY on game page */
    #game-page .modal-content h2, #game-page .modal-content h3 {
        font-size: 0.875rem !important;
        margin-bottom: 0.25rem !important;
    }
    
    #game-page .modal-content p, #game-page .modal-content label {
        font-size: 0.75rem !important;
        margin-bottom: 0.125rem !important;
    }
    
    #game-page .modal-content input, #game-page .modal-content select, #game-page .modal-content textarea {
        padding: 0.25rem !important;
        font-size: 0.75rem !important;
        margin-bottom: 0.25rem !important;
    }
    
    #game-page .modal-content button {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.75rem !important;
    }
    
    /* Fix premium modal layout - 2x2 grid for features - ONLY on game page */
    #game-page #premium-upgrade-modal .grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 0.25rem !important;
    }
    
    #game-page #premium-upgrade-modal .grid > div {
        width: auto !important;
        margin-bottom: 0 !important;
        display: block !important;
        position: static !important;
    }
    
    #game-page #premium-upgrade-modal .p-3 {
        padding: 0.25rem !important;
        margin-bottom: 0 !important;
        position: static !important;
        transform: none !important;
    }
    
    #game-page #premium-upgrade-modal h4 {
        font-size: 0.75rem !important;
        margin-bottom: 0.125rem !important;
    }
    
    #game-page #premium-upgrade-modal .text-xs {
        font-size: 0.625rem !important;
        line-height: 1.2 !important;
    }
    
    /* Center the premium modal properly - ONLY on game page */
    #game-page #premium-upgrade-modal {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Ensure close button is clickable - ONLY on game page */
    #game-page #premium-upgrade-modal button,
    #game-page #close-premium-modal {
        position: relative !important;
        z-index: 9999 !important;
        pointer-events: auto !important;
    }
    
    /* Modal header with close button - ONLY on game page */
    #game-page #premium-upgrade-modal .flex.justify-between {
        position: relative !important;
        z-index: 9999 !important;
    }
    
    /* Ensure scrollable content area in premium modal - ONLY on game page */
    #game-page #premium-upgrade-modal .overflow-y-auto {
        max-height: 55vh !important;
        overflow-y: auto !important;
    }
    
    /* Fix default rooms container to contain all rooms */
    #room-list-page .bg-white.rounded-lg.shadow-md.p-2:has(h2:contains("Default Rooms")) {
        height: auto !important;
        min-height: 70vh !important;
        overflow: visible !important;
        padding: 1rem !important;
        position: relative !important;
        z-index: 15 !important;
    }
    
    /* Simple 2x2 grid for lobby rooms */
    #room-list-page .grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        grid-template-rows: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
        height: auto !important;
        min-height: 60vh !important;
        padding: 0.5rem !important;
        grid-auto-flow: row !important;
        position: relative !important;
        z-index: 15 !important;
        overflow: visible !important;
    }
    
    /* Ensure all visible content is above overlay */
    #room-list-page h1,
    #room-list-page .flex,
    #room-list-page button {
        position: relative !important;
        z-index: 15 !important;
    }
    
    /* Hide custom rooms section specifically */
    #room-list-page #custom-rooms-section,
    #room-list-page .custom-rooms,
    #room-list-page [id*="custom"],
    #room-list-page div:has(h2:contains("Custom Rooms")),
    #room-list-page .bg-white:has(#custom-rooms),
    #room-list-page h2:contains("Custom Rooms"),
    #room-list-page #custom-rooms {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        top: -9999px !important;
        left: -9999px !important;
    }
    
    /* Extend proper background across full page width */
    #room-list-page {
        background-color: #f3f4f6 !important;
        width: 100vw !important;
        min-height: 100vh !important;
        position: relative !important;
        z-index: 10 !important;
    }
    
    /* Create background overlay specifically to hide custom rooms */
    #room-list-page::before {
        content: '' !important;
        position: absolute !important;
        top: 80vh !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        background-color: #f3f4f6 !important;
        z-index: 12 !important;
        pointer-events: none !important;
    }
    
    #room-list-page .container {
        background-color: #f3f4f6 !important;
        min-height: 100vh !important;
        position: relative !important;
        width: 100% !important;
        max-width: none !important;
        z-index: 10 !important;
    }
    
    /* Hide custom rooms section and tab completely */
    #room-list-page h2:contains("Custom Rooms"),
    #room-list-page .bg-white:has(h2:contains("Custom Rooms")),
    #room-list-page #custom-rooms,
    #room-list-page [id*="custom-room"] {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        overflow: hidden !important;
    }
    
    /* Only hide the specific custom rooms container */
    #room-list-page .bg-white.rounded-lg.shadow-md.p-4:has(h2:contains("Custom Rooms")) {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        top: -9999px !important;
        left: -9999px !important;
    }
    
    
    /* Force all room cards and their children to not float */
    #room-list-page .grid > *,
    #room-list-page .room-card,
    #room-list-page .room-card *,
    #room-list-page .grid .room-card,
    #room-list-page .grid > div:nth-child(7),
    #room-list-page .grid > div {
        float: none !important;
        clear: both !important;
        position: static !important;
        transform: none !important;
        left: auto !important;
        right: auto !important;
        top: auto !important;
        width: 100% !important;
    }
    
    #room-list-page .room-card {
        display: flex !important;
        flex-direction: column !important;
        padding: 0.75rem !important;
        padding-bottom: 2.5rem !important;
        margin: 0 !important;
        float: none !important;
        position: relative !important;
        min-height: 120px !important;
        height: auto !important;
        width: 100% !important;
        box-sizing: border-box !important;
        justify-content: flex-start !important;
    }
    
    #room-list-page .room-card h3 {
        font-size: 0.75rem !important;
        margin: 0 0 0.25rem 0 !important;
        line-height: 1.2 !important;
        word-break: break-word !important;
        hyphens: auto !important;
    }
    
    #room-list-page .room-card p {
        font-size: 0.625rem !important;
        margin: 0.05rem 0 !important;
        flex-grow: 1 !important;
        line-height: 1.1 !important;
        word-break: break-word !important;
        hyphens: auto !important;
        display: inline !important;
    }
    
    /* Make room button stick to bottom */
    #room-list-page .room-card button {
        position: absolute !important;
        bottom: 0.5rem !important;
        left: 0.5rem !important;
        right: 0.5rem !important;
    }
    
    /* Card positioning already handled above */
    
    #room-list-page .room-card button {
        padding: 0.25rem !important;
        font-size: 0.625rem !important;
        margin-top: auto !important;
        width: auto !important;
        min-width: unset !important;
    }
    
    /* Center the entire lobby page */
    #room-list-page .container {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        width: 100% !important;
        max-width: 95vw !important;
        margin: 0 auto !important;
        padding: 0.5rem !important;
    }
    
    /* Make lobby chat responsive for mobile */
    #room-list-page #lobby-chat {
        width: 47.5vw !important;
        max-width: 47.5vw !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        z-index: 100 !important;
        height: auto !important;
    }
    
    #room-list-page #lobby-chat .bg-white {
        width: 100% !important;
        padding: 0.25rem !important;
        border-radius: 0.5rem !important;
    }
    
    /* Make chat messages container properly sized for mobile */
    #room-list-page #lobby-chat-messages {
        height: 150px !important;
        max-height: 150px !important;
        overflow-y: auto !important;
    }
    
    /* Make chat input and button properly sized for mobile */
    #room-list-page #lobby-chat input {
        padding: 0.5rem !important;
        font-size: 14px !important;
        height: auto !important;
    }
    
    #room-list-page #lobby-chat button {
        padding: 0.5rem 1rem !important;
        font-size: 14px !important;
        height: auto !important;
    }
    
    /* Make chat messages readable on mobile */
    #room-list-page #lobby-chat .message {
        font-size: 16px !important;
    }
    
    #room-list-page #lobby-chat .player-name {
        font-size: 12px !important;
    }
    
    #room-list-page #lobby-chat .message-content {
        font-size: 16px !important;
    }
    
    /* Reduce margin needed for fixed chat */
    #room-list-page .grid {
        margin-bottom: 6vh !important;
    }
    
    /* Ensure entire page content is centered */
    #room-list-page {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        min-height: 100vh !important;
    }
    
    
    /* Override shine transforms in mobile landscape */
    #game-page #upgrade-membership-btn-game::before,
    #room-list-page #upgrade-membership-btn-lobby::before,
    #upgrade-membership-btn::before {
        transform: none !important;
        -webkit-transform: none !important;
        animation: shine 4s ease-in-out infinite !important;
        -webkit-animation: shine 4s ease-in-out infinite !important;
    }
    
    
}

/* iPad and tablet grid fixes */
@media (min-width: 769px) and (max-width: 1024px) {
    /* Force proper 3-column grid for iPad */
    #room-list-page .grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1rem !important;
        width: 100% !important;
        max-width: 900px !important;
        margin: 0 auto !important;
        padding: 1rem !important;
        box-sizing: border-box !important;
    }
    
    /* Ensure room cards stay in grid positions */
    #room-list-page .grid > * {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        display: block !important;
        position: relative !important;
        box-sizing: border-box !important;
    }
    
    /* Fix room card content */
    #room-list-page .room-card {
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
        min-height: 120px !important;
    }
}

/* Desktop: Reduce white space between grey containers and inputs like mobile */
@media screen and (min-width: 1025px) {
    #chat-container, #guesses-container {
        margin-bottom: 8px !important; /* Same as mobile - reduce big white space gap */
        margin-top: 8px !important;
    }
    
    /* Move chat container up to match spacing between other containers on desktop */
    #game-page .grid > div:nth-child(3) {
        margin-top: -1rem !important;
    }
}

/* Simple fix: Make premium popup scrollable with 2x2 grid and touch top */
#premium-upgrade-modal {
    overflow-y: auto !important;
    align-items: flex-start !important;
    padding-top: 0 !important;
}

#premium-upgrade-modal .overflow-y-auto {
    max-height: 70vh !important;
    overflow-y: auto !important;
}

#premium-upgrade-modal .grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    grid-template-rows: auto auto !important;
    gap: 0.75rem !important;
}

/* Override the Tailwind grid-cols-1 class specifically */
#premium-upgrade-modal .grid-cols-1 {
    grid-template-columns: 1fr 1fr !important;
}

/* Ensure each feature box fits properly in grid and aligns properly */
#premium-upgrade-modal .grid > div {
    width: 100% !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
}

/* Aggressively fix alignment of all feature boxes */
#premium-upgrade-modal .p-3,
#premium-upgrade-modal .p-3.border,
#premium-upgrade-modal .border.border-purple-200,
#premium-upgrade-modal .bg-purple-50 {
    width: 100% !important;
    margin: 0 !important;
    display: block !important;
    float: none !important;
    position: static !important;
    transform: none !important;
    left: auto !important;
    right: auto !important;
}

/* Force all grid items to be equal */
#premium-upgrade-modal .grid > div:nth-child(1),
#premium-upgrade-modal .grid > div:nth-child(2),
#premium-upgrade-modal .grid > div:nth-child(3),
#premium-upgrade-modal .grid > div:nth-child(4) {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    position: static !important;
}

/* Add padding above the bottom button */
#premium-upgrade-modal button:last-of-type,
#premium-upgrade-modal .bg-purple-600 {
    margin-top: 1.5rem !important;
}

/* Clean up all text alignment and add padding above first row */
#premium-upgrade-modal .grid {
    margin-top: 1rem !important;
}

/* Make all text content consistent and clean */
#premium-upgrade-modal .flex.items-center {
    align-items: center !important;
    gap: 0.75rem !important;
    padding: 1rem !important;
    flex-direction: row !important;
}

#premium-upgrade-modal .flex.items-center span:first-child {
    font-size: 1.5rem !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
}

#premium-upgrade-modal h4 {
    font-size: 1rem !important;
    font-weight: 600 !important;
    margin: 0 0 0.25rem 0 !important;
    line-height: 1.2 !important;
}

#premium-upgrade-modal .text-xs {
    font-size: 0.875rem !important;
    line-height: 1.3 !important;
    margin: 0 !important;
}

/* Fix all modal popups - centered, proper width, scrollable */
#profile-modal,
#friends-modal,
#create-room-modal,
#premium-upgrade-modal {
    align-items: flex-start !important;
    padding-top: 0 !important;
}

#profile-modal .bg-white,
#friends-modal .bg-white,
#create-room-modal .bg-white {
    max-width: 800px !important;
    width: 800px !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    margin: 2rem auto !important;
}

/* Make modal content scrollable - target the main modal container */
#profile-modal .bg-white,
#friends-modal .bg-white,
#create-room-modal .bg-white {
    max-height: 70vh !important;
    overflow-y: auto !important;
}

/* Ensure modal containers prevent background scrolling */
#profile-modal,
#friends-modal,
#create-room-modal {
    overflow: hidden !important;
}

/* General mobile chat positioning adjustment */
@media screen and (max-width: 768px) {
    /* Chat container flush with players container */
    #game-page .grid > div:nth-child(3) {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
    
    /* Make the grey chat and guesses containers bigger/taller on mobile and reduce bottom gap */
    #chat-container {
        height: 150px !important; /* Bigger since input is now smaller */
        min-height: 150px !important;
        margin-bottom: 8px !important; /* Reduce the big white space gap on mobile */
        margin-top: 8px !important;
    }
    
    #guesses-container {
        height: 180px !important;
        min-height: 180px !important;
        margin-bottom: 8px !important; /* Reduce the big white space gap on mobile */
        margin-top: 8px !important;
    }
    
    /* Make chat input moderately sized on mobile - higher specificity */
    #game-page #chat-input {
        padding: 0.5rem 0.75rem !important;
        font-size: 1rem !important;
        height: 2.75rem !important;
        min-height: 2.75rem !important;
        line-height: 1.4 !important;
        box-sizing: border-box !important;
    }
    
    #game-page #send-chat-btn {
        padding: 0.5rem 1rem !important;
        font-size: 1rem !important;
        height: 2.75rem !important;
        min-height: 2.75rem !important;
        line-height: 1.4 !important;
        box-sizing: border-box !important;
    }
    
    /* Make guess container wrapper match left container height on general mobile - middle value */
    .grid > div:nth-child(2) > div:nth-child(1) {
        height: 340px !important; /* Between 320px (too small) and 360px (too big) */
        max-height: 340px !important;
        overflow: hidden !important;
    }
    
    /* Make grey guesses area fill most of the container like chat format - general mobile */
    #guesses-container {
        height: 250px !important; /* Leave room for input at bottom */
        min-height: 250px !important;
        margin-bottom: 8px !important;
        margin-top: 8px !important;
    }
}

/* Mobile portrait optimizations - make it work better */
@media screen and (orientation: portrait) and (max-width: 768px) {
    /* Better canvas size for portrait */
    .canvas-container {
        max-width: 350px !important;
    }
    
    /* Compact containers for portrait - make taller and reduce gap */
    #chat-container {
        height: 150px !important; /* Bigger since input is now smaller */
        min-height: 150px !important;
        margin-bottom: 8px !important; /* Reduce the big white space gap on mobile portrait */
        margin-top: 8px !important;
    }
    
    #guesses-container {
        height: 180px !important;
        min-height: 180px !important;
        margin-bottom: 8px !important; /* Reduce the big white space gap on mobile portrait */
        margin-top: 8px !important;
    }
    
    /* Make guess container wrapper match left container height on portrait - middle value */
    .grid > div:nth-child(2) > div:nth-child(1) {
        height: 305px !important; /* Between 285px (too small) and 325px (too big) */
        max-height: 305px !important;
        overflow: hidden !important;
    }
    
    /* Make grey guesses area fill most of the container like chat format - portrait */
    #guesses-container {
        height: 215px !important; /* Leave room for input at bottom */
        min-height: 215px !important;
        margin-bottom: 8px !important;
        margin-top: 8px !important;
    }
    
    /* Chat container flush with players container on portrait */
    #game-page .grid > div:nth-child(3) {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
    
    /* Make chat input moderately sized on mobile portrait - higher specificity */
    #game-page #chat-input {
        padding: 0.5rem 0.75rem !important;
        font-size: 1rem !important;
        height: 2.75rem !important;
        min-height: 2.75rem !important;
        line-height: 1.4 !important;
        box-sizing: border-box !important;
    }
    
    #game-page #send-chat-btn {
        padding: 0.5rem 1rem !important;
        font-size: 1rem !important;
        height: 2.75rem !important;
        min-height: 2.75rem !important;
        line-height: 1.4 !important;
        box-sizing: border-box !important;
    }
    
    /* Compact spacing for most containers */
    .bg-white.rounded-lg.shadow-md {
        padding: 0.75rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    /* Ensure upgrade button animations work on mobile portrait */
    #upgrade-membership-btn.upgrade-pulse,
    #upgrade-membership-btn-game.upgrade-pulse-slow,
    #upgrade-membership-btn-lobby.upgrade-pulse {
        animation-play-state: running !important;
        -webkit-animation-play-state: running !important;
        transform: scale(1) !important;
        -webkit-transform: scale(1) !important;
    }
    
    /* Ensure shine effect works on mobile portrait */
    #upgrade-membership-btn::before,
    #upgrade-membership-btn-game::before,
    #upgrade-membership-btn-lobby::before {
        animation-play-state: running !important;
        -webkit-animation-play-state: running !important;
    }
}


#drawing-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: white;
    cursor: crosshair;
}


#drawing-canvas.disabled {
    cursor: not-allowed;
    pointer-events: none;
}

/* Color Picker Styles */
.color-picker {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.color-option {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #ddd;
    transition: border-color 0.2s ease;
}

.color-option:hover {
    border-color: #999;
}

.color-option.selected {
    border: 3px solid #000;
    transform: scale(1.1);
}

/* Brush Size Styles */
.brush-size {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    background-color: #f1f1f1;
    margin-right: 5px;
    transition: background-color 0.2s ease;
}

.brush-size:hover {
    background-color: #e0e0e0;
}

.brush-size.selected {
    background-color: #ccc;
    transform: scale(1.1);
}

/* Message Styles */
.message {
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    word-wrap: break-word;
    max-width: 100%;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.correct-guess {
    background-color: #10b981;
    color: white;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    animation: correctGuessAnimation 0.5s ease;
}

@keyframes correctGuessAnimation {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.regular-guess {
    background-color: #e5e7eb;
    color: #374151;
}

.system-message {
    background-color: #dbeafe;
    color: #1e40af;
    font-style: italic;
}

.friend-message {
    background-color: #f0fdf4;
    color: #15803d;
    border-left: 3px solid #22c55e;
}

.dm-message {
    background-color: #ede9fe;
    color: #5b21b6;
    border-left: 3px solid #8b5cf6;
    font-weight: 500;
}

/* Player List Styles */
.player-item {
    transition: all 0.3s ease;
    border-radius: 8px;
}

.player-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.player-item.current-drawer {
    background-color: #fef3c7 !important;
    border: 2px solid #f59e0b;
}

.player-item.guessed-correctly {
    background-color: #d1fae5 !important;
    border: 2px solid #10b981;
}

.player-item.idle {
    opacity: 0.6;
    background-color: #f3f4f6 !important;
}

/* Kick Animation */
@keyframes kickAnimation {
    0% { transform: translateX(0); }
    25% { transform: translateX(-10px) rotate(-5deg); }
    50% { transform: translateX(10px) rotate(5deg); }
    75% { transform: translateX(-10px) rotate(-5deg); }
    100% { transform: translateX(0) rotate(0); }
}

.kick-animation {
    animation: kickAnimation 0.5s ease-in-out;
}

/* Guesses Container Animation */
.guesses-container-correct {
    background-color: #d1fae5 !important;
    transition: background-color 0.5s ease;
}

/* Word Display Styles */
@keyframes subtlePulse {
    0% { transform: scale(1); }
    16.67% { transform: scale(1.02); }
    33.33% { transform: scale(1); }
    50% { transform: scale(1.02); }
    66.67% { transform: scale(1); }
    83.33% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

#word-to-draw-outside {
    font-size: 16px;
    font-weight: bold;
    padding: 8px 15px;
    background-color: #4f46e5;
    color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    animation: subtlePulse 3s 1 ease-in-out;
}

/* Timer Styles */
#timer.urgent {
    background-color: #fee2e2 !important;
    color: #dc2626 !important;
    animation: timerPulse 1s infinite;
}

@keyframes timerPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Tab Styles */
.tab-btn {
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: #6366f1 !important;
}

.tab-content {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Room Card Styles */
.room-card {
    transition: all 0.3s ease;
    border-radius: 8px;
}

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

.room-card.full {
    opacity: 0.7;
    background-color: #f9fafb;
}

.room-card.active {
    border-left: 4px solid #10b981;
}

/* Modal Styles */
.modal {
    backdrop-filter: blur(4px);
}

.modal-content {
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Button Styles */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    transform: translateY(-1px);
}

/* Loading Spinner */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

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

/* Notification Toast */
.notification-toast {
    animation: toastSlideIn 0.3s ease-out;
}

.notification-toast.hiding {
    animation: toastSlideOut 0.3s ease-in;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Chat Scroll Styles */
#chat-container::-webkit-scrollbar,
#guesses-container::-webkit-scrollbar {
    width: 6px;
}

#chat-container::-webkit-scrollbar-track,
#guesses-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#chat-container::-webkit-scrollbar-thumb,
#guesses-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

#chat-container::-webkit-scrollbar-thumb:hover,
#guesses-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .canvas-container {
        max-width: 100%;
        aspect-ratio: 8/5;
    }
    
    .color-picker {
        justify-content: center;
    }
    
    /* Ensure filter buttons work properly on mobile */
    .filter-btn {
        min-height: 44px !important; /* Apple recommends minimum 44px touch targets */
        touch-action: manipulation !important; /* Prevent zoom on tap */
        -webkit-touch-callout: none !important; /* Disable callout */
        -webkit-user-select: none !important; /* Disable text selection */
        user-select: none !important;
        padding: 0.5rem 0.75rem !important; /* Larger touch area */
        cursor: pointer !important;
        border: none !important;
        outline: none !important;
        display: inline-block !important;
        position: relative !important;
    }
    
    /* Remove hover effects on mobile for better touch experience */
    .filter-btn:hover {
        transform: none !important;
        box-shadow: none !important;
    }
    
    /* Ensure proper spacing between filter buttons on mobile */
    .flex.flex-wrap.gap-2 {
        gap: 0.5rem !important;
    }
    
    /* Ensure filtered rooms are properly hidden on mobile */
    .room-card.filter-hidden {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .room-card.hidden {
        display: none !important;
    }
    
    .color-option {
        width: 25px;
        height: 25px;
    }
    
    /* Ensure upgrade button animations work on mobile - override transform: none */
    .upgrade-pulse,
    .upgrade-pulse-slow,
    #upgrade-membership-btn.upgrade-pulse,
    #upgrade-membership-btn-game.upgrade-pulse-slow,
    #upgrade-membership-btn-lobby.upgrade-pulse {
        animation: upgrade-pulse 2s ease-in-out infinite !important;
        -webkit-animation: upgrade-pulse 2s ease-in-out infinite !important;
        animation-play-state: running !important;
        -webkit-animation-play-state: running !important;
        transform-origin: center !important;
        -webkit-transform-origin: center !important;
        /* Override any transform: none rules */
        transform: scale(1) !important;
        -webkit-transform: scale(1) !important;
    }
    
    /* Specific slow pulse for game button */
    #upgrade-membership-btn-game.upgrade-pulse-slow {
        animation: upgrade-pulse-slow 4s ease-in-out infinite !important;
        -webkit-animation: upgrade-pulse-slow 4s ease-in-out infinite !important;
    }
    
    /* Ensure shine effect works on mobile */
    #upgrade-membership-btn::before,
    #upgrade-membership-btn-game::before,
    #upgrade-membership-btn-lobby::before {
        animation: shine 4s ease-in-out infinite !important;
        -webkit-animation: shine 4s ease-in-out infinite !important;
        animation-play-state: running !important;
        -webkit-animation-play-state: running !important;
    }
    
    .brush-size {
        width: 35px;
        height: 35px;
    }
    
    #word-to-draw-outside {
        font-size: 14px;
        padding: 6px 12px;
    }
}

@media (max-width: 640px) {
    .canvas-container {
        max-width: 100%;
        aspect-ratio: 8/5;
    }
    
    #chat-container,
    #guesses-container {
        height: 200px;
    }
    
    .message {
        padding: 6px 10px;
        font-size: 14px;
    }
}

/* Dark Mode Support (if needed in future) */
@media (prefers-color-scheme: dark) {
    .canvas-container {
        border-color: #4b5563;
    }
    
    #drawing-canvas {
        background-color: #ffffff;
    }
}

/* Context Menu Styles */
.context-menu {
    position: fixed;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 20000;
    min-width: 150px;
    animation: contextMenuAppear 0.15s ease-out;
}

@keyframes contextMenuAppear {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.context-menu-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.1s ease;
    font-size: 14px;
    color: #374151;
}

.context-menu-item:hover {
    background-color: #f9fafb;
}

.context-menu-item:last-child {
    border-bottom: none;
}

.context-menu-item.danger {
    color: #dc2626;
}

.context-menu-item.danger:hover {
    background-color: #fef2f2;
}

.player-name {
    cursor: pointer;
    user-select: none;
}

.player-name:hover {
    text-decoration: underline;
}

/* Font variables for current user's own messages only */
:root {
    --user-username-font-family: system-ui, -apple-system, sans-serif;
    --user-messages-font-family: system-ui, -apple-system, sans-serif;
}

/* Apply custom fonts to current user's messages (visible to everyone) */
.message[data-is-current-user="true"] .player-name {
    font-family: var(--user-username-font-family, system-ui, -apple-system, sans-serif);
}

.message[data-is-current-user="true"] .message-content {
    font-family: var(--user-messages-font-family, system-ui, -apple-system, sans-serif);
}

/* For lobby chat - apply to current user's messages (visible to everyone) */
.lobby-message[data-is-current-user="true"] .player-name {
    font-family: var(--user-username-font-family, system-ui, -apple-system, sans-serif) !important;
}

.lobby-message[data-is-current-user="true"] .message-content {
    font-family: var(--user-messages-font-family, system-ui, -apple-system, sans-serif) !important;
}

/* Apply other users' custom fonts to their messages */
.message[data-user-fonts] .player-name {
    font-family: var(--message-username-font, system-ui, -apple-system, sans-serif);
}

.message[data-user-fonts] .message-content {
    font-family: var(--message-content-font, system-ui, -apple-system, sans-serif);
}

/* For lobby chat - apply other users' fonts */
.lobby-message[data-user-fonts] .player-name {
    font-family: var(--message-username-font, system-ui, -apple-system, sans-serif) !important;
}

.lobby-message[data-user-fonts] .message-content {
    font-family: var(--message-content-font, system-ui, -apple-system, sans-serif) !important;
}

/* Apply custom fonts to player names in the player list */
.player-list-item[data-user-fonts] .player-name,
.player-list-item[data-user-fonts] .player-name > span {
    font-family: var(--player-username-font, system-ui, -apple-system, sans-serif) !important;
}

/* Ensure score elements keep their default font */
.player-list-item .px-2.py-1.rounded.text-sm {
    font-family: system-ui, -apple-system, sans-serif !important;
}

/* Custom pulse animation for upgrade buttons - scale only, no fade */
@keyframes upgrade-pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.upgrade-pulse {
    animation: simple-flash 2s ease-in-out infinite !important;
    color: #ffffff !important; /* Force pure white text */
    text-shadow: none !important; /* Remove any text shadows that might dim the text */
    transition: none !important; /* Override transition-all that blocks animations */
}

/* Slow pulse animation for game page upgrade button */
@keyframes upgrade-pulse-slow {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.03);
    }
    100% {
        transform: scale(1);
    }
}

.upgrade-pulse-slow {
    animation: upgrade-pulse-slow 4s ease-in-out infinite !important;
    color: #ffffff !important;
    text-shadow: none !important;
    transition: none !important; /* Override transition-all that blocks animations */
}


/* Force white text on all upgrade buttons */
#upgrade-membership-btn,
#upgrade-membership-btn-game,
#upgrade-membership-btn-lobby {
    color: #ffffff !important;
    text-shadow: none !important;
    opacity: 1 !important;
    filter: none !important;
    -webkit-text-fill-color: #ffffff !important;
    text-decoration: none !important;
    font-weight: 900 !important; /* Extra bold font weight */
    font-style: normal !important;
    /* Force animations to work on ALL devices */
    animation-play-state: running !important;
    -webkit-animation-play-state: running !important;
}




/* Also target any child elements that might have different colors */
#upgrade-membership-btn *,
#upgrade-membership-btn-game *,
#upgrade-membership-btn-lobby * {
    color: #ffffff !important;
    text-shadow: none !important;
    opacity: 1 !important;
    -webkit-text-fill-color: #ffffff !important;
    font-weight: 900 !important; /* Extra bold font weight for child elements too */
}

/* Kick Vote Notification Animations */
@keyframes slideInRight {
    0% {
        transform: translateX(100%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    100% {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Victory Screen Animations */
@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

@keyframes celebrationFadeIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeOut {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.9);
    }
}

@keyframes podiumRise {
    0% {
        transform: translateY(100px) scale(0.8);
        opacity: 0;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes medalBounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    40% {
        transform: translateY(-20px) rotate(10deg);
    }
    60% {
        transform: translateY(-10px) rotate(-5deg);
    }
}

@keyframes textGlow {
    0% {
        text-shadow: 0 0 20px rgba(255,255,255,0.8);
    }
    50% {
        text-shadow: 0 0 40px rgba(255,255,255,1), 0 0 60px rgba(255,255,255,0.8);
    }
    100% {
        text-shadow: 0 0 20px rgba(255,255,255,0.8);
    }
}

.victory-title {
    animation: textGlow 2s ease-in-out infinite;
}

.podium-animation {
    animation: podiumRise 0.8s ease-out forwards;
}

.medal-bounce {
    animation: medalBounce 2s ease-in-out infinite;
}

/* Enhanced button effects */
.victory-button {
    position: relative;
    overflow: hidden;
}

.victory-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s;
}

.victory-button:hover::before {
    left: 100%;
}

/* Print Styles */
@media print {
    #drawing-canvas {
        border: 1px solid #000;
    }
    
    .hidden {
        display: none !important;
    }
    
    .context-menu {
        display: none !important;
    }
}

/* Drawing Vote Animations */
@keyframes voteFloat {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    50% {
        opacity: 1;
        transform: scale(1.2) translateY(-20px);
    }
    100% {
        opacity: 0;
        transform: scale(0.8) translateY(-50px);
    }
}

/* New Victory Effects Animations */
@keyframes bubbleFloat {
    0% {
        transform: translateY(0) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
        transform: translateY(-10px) scale(1);
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) scale(0.5);
        opacity: 0;
    }
}

@keyframes starTwinkle {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1.2) rotate(180deg);
    }
}

@keyframes sparkleFall {
    0% {
        transform: translateY(-100vh) rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg) scale(0.5);
        opacity: 0;
    }
}

@keyframes fireworkExplode {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(3);
        opacity: 0.8;
    }
    100% {
        transform: scale(5);
        opacity: 0;
    }
}

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

/* Vote button hover effects */
#drawing-vote-controls button {
    transition: all 0.2s ease-in-out;
}

#drawing-vote-controls button:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* Advanced Drawing Tools CSS */

/* Tool buttons */
.tool-btn {
    transition: all 0.2s ease;
    position: relative;
}

.tool-btn.selected {
    background-color: #4f46e5 !important;
    color: white;
}

/* Custom color picker styling */
#current-color-container {
    padding: 2px;
    transition: all 0.2s ease;
}

#current-color-container.selected {
    border-color: #4f46e5;
}

input[type="color"] {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 4px;
    background: none;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

/* Range slider styling */
input[type="range"] {
    -webkit-appearance: none;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #4f46e5;
    border-radius: 50%;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #4f46e5;
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

/* Saved colors section */
#saved-colors {
    min-height: 30px;
    border: 1px dashed #e5e7eb;
    border-radius: 4px;
    padding: 4px;
}

/* Canvas cursor styling for different tools */
.brush-tool {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='1' fill='black'/%3E%3Ccircle cx='10' cy='10' r='8' fill='none' stroke='black' stroke-width='1' opacity='0.5'/%3E%3C/svg%3E") 10 10, crosshair !important;
}

.fill-tool {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2l-7.5 7.5a1 1 0 0 0 0 1.4L11 17.4a1 1 0 0 0 1.4 0l7.5-7.5a1 1 0 0 0 0-1.4L12 2z'%3E%3C/path%3E%3Cpath d='M8 12h5'%3E%3C/path%3E%3Ccircle cx='12' cy='20' r='2' fill='red' opacity='0.7'/%3E%3C/svg%3E") 12 20, auto !important;
}

.eyedropper-tool {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 14v-4a8 8 0 0 0-16 0v4"></path><path d="M10 20h4"></path><path d="M12 16v4"></path><circle cx="12" cy="22" r="2" fill="red" opacity="0.7"/></svg>') 12 22, auto !important;
}

.spray-tool {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='1' fill='black'/%3E%3Ccircle cx='8' cy='8' r='0.5' fill='black' opacity='0.7'/%3E%3Ccircle cx='12' cy='8' r='0.5' fill='black' opacity='0.7'/%3E%3Ccircle cx='8' cy='12' r='0.5' fill='black' opacity='0.7'/%3E%3Ccircle cx='12' cy='12' r='0.5' fill='black' opacity='0.7'/%3E%3Ccircle cx='10' cy='6' r='0.5' fill='black' opacity='0.5'/%3E%3Ccircle cx='10' cy='14' r='0.5' fill='black' opacity='0.5'/%3E%3Ccircle cx='6' cy='10' r='0.5' fill='black' opacity='0.5'/%3E%3Ccircle cx='14' cy='10' r='0.5' fill='black' opacity='0.5'/%3E%3C/svg%3E") 10 10, crosshair !important;
}

.line-tool {
    cursor: crosshair !important;
}

.square-tool {
    cursor: crosshair !important;
}

.circle-tool {
    cursor: crosshair !important;
}

/* Flashing Chat Icon Animation */
@keyframes flashingChatIcon {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.3;
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.flashing-chat-icon {
    animation: flashingChatIcon 1s ease-in-out infinite;
}

/* Chat notification icon fade animation */
@keyframes chatNotificationFade {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.2;
        transform: scale(1.2);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.chat-notification-flashing {
    animation: chatNotificationFade 1.5s ease-in-out infinite;
}

/* Subtle flash animation with shine effect */
.mobile-flash-btn {
    animation: simple-flash 2s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

.mobile-flash-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shine 3s ease-in-out infinite;
}

@keyframes simple-flash {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes shine {
    0% { left: -100%; }
    50% { left: 100%; }
    100% { left: 100%; }
}

@keyframes flashNow {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Premium button shine effect */
@keyframes premiumShine {
    0% { 
        background-position: -200% center;
    }
    50% {
        background-position: 200% center;
    }
    100% {
        background-position: 200% center;
    }
}

.premium-shine-btn {
    position: relative;
    background: linear-gradient(90deg, #7c3aed, #9333ea, #c084fc, #9333ea, #7c3aed);
    background-size: 200% 100%;
    animation: premiumShine 10s ease-in-out infinite;
    overflow: hidden;
    color: white !important;
}

.premium-shine-btn:hover {
    animation-duration: 5s;
}

/* Premium badge responsive text */
#premium-badge .desktop-text,
#premium-badge-game .desktop-text {
    display: none;
}

#premium-badge .mobile-text,
#premium-badge-game .mobile-text {
    display: inline;
}

@media (min-width: 768px) {
    #premium-badge .desktop-text,
    #premium-badge-game .desktop-text {
        display: inline;
    }
    
    #premium-badge .mobile-text,
    #premium-badge-game .mobile-text {
        display: none;
    }
}

/* Mobile fixes for both premium and member command modals */
@media (max-width: 768px) {
    #premium-upgrade-modal,
    #member-commands-modal {
        overflow-y: auto !important;
        align-items: flex-start !important;
        padding: 10px !important;
    }
    
    #premium-upgrade-modal .bg-white,
    #member-commands-modal .bg-white {
        max-width: 95vw !important;
        max-height: 90vh !important;
        margin: 0 !important;
        overflow-y: auto !important;
    }
    
    #premium-upgrade-modal .overflow-y-auto,
    #member-commands-modal .overflow-y-auto {
        max-height: 75vh !important;
        overflow-y: auto !important;
    }
    
    /* Make close button larger and more accessible on mobile */
    #close-premium-modal,
    #close-commands-modal {
        font-size: 2rem !important;
        padding: 8px !important;
        margin: -8px !important;
        background: rgba(0,0,0,0.1) !important;
        border-radius: 50% !important;
        width: 40px !important;
        height: 40px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        position: relative !important;
        z-index: 9999 !important;
        pointer-events: auto !important;
        touch-action: manipulation !important;
    }
    
    /* Ensure grids work properly on mobile */
    #premium-upgrade-modal .grid,
    #member-commands-modal .grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        grid-template-rows: auto !important;
        gap: 1rem !important;
        width: 100% !important;
    }
    
    /* Fix individual grid items */
    #premium-upgrade-modal .grid > div,
    #member-commands-modal .grid > div {
        width: 100% !important;
        margin: 0 !important;
        padding: 0.75rem !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        position: relative !important;
        display: block !important;
    }
    
    /* Make buttons more touch-friendly */
    #premium-upgrade-modal button,
    #member-commands-modal button {
        min-height: 44px !important;
        font-size: 1rem !important;
        touch-action: manipulation !important;
    }
    
    /* Fix modal headers on mobile */
    #premium-upgrade-modal .flex.justify-between,
    #member-commands-modal .flex.justify-between {
        flex-wrap: nowrap !important;
        align-items: flex-start !important;
    }
    
    /* Ensure modal content doesn't overflow */
    #premium-upgrade-modal h2,
    #premium-upgrade-modal h3,
    #member-commands-modal h2,
    #member-commands-modal h3 {
        font-size: 1.1rem !important;
        line-height: 1.3 !important;
        margin-bottom: 0.5rem !important;
        clear: both !important;
    }
    
    #premium-upgrade-modal p,
    #member-commands-modal p {
        font-size: 0.9rem !important;
        line-height: 1.4 !important;
        margin-bottom: 0.5rem !important;
        clear: both !important;
    }
    
    /* Override any existing positioning that might cause overlap */
    #premium-upgrade-modal .grid-cols-1,
    #premium-upgrade-modal .grid-cols-2,
    #member-commands-modal .grid-cols-1,
    #member-commands-modal .grid-cols-2 {
        grid-template-columns: 1fr !important;
    }
    
    /* Ensure proper spacing between elements */
    #premium-upgrade-modal > div,
    #member-commands-modal > div {
        margin-bottom: 1rem !important;
    }
    
    /* Fix any absolute positioning that might cause issues */
    #premium-upgrade-modal *,
    #member-commands-modal * {
        position: static !important;
        transform: none !important;
        float: none !important;
    }
    
    /* Exception: keep the close button positioned */
    #close-premium-modal,
    #close-commands-modal {
        position: relative !important;
    }
}

/* Desktop styles */
@media (min-width: 769px) {
    #premium-upgrade-modal .grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        grid-template-rows: auto auto !important;
        gap: 0.75rem !important;
    }
    
    #member-commands-modal .grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
}

