/* Dark Mode Theme for SemantleDeuce */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Connection status collapse behavior */
#connectionStatus {
    overflow: hidden;
    /* Default width for "Connected" state */
    width: 110px;
    /* Simple linear transitions without curves */
    transition: width 0.2s linear, 
                height 0.4s linear, 
                padding 0.4s linear, 
                border-radius 0.4s linear, 
                gap 0.3s linear;
}

/* Different widths for different states */
#connectionStatus.status-connected {
    width: 110px;
}

#connectionStatus.status-disconnected {
    width: 125px;
}

#connectionStatus.status-disconnected-with-button {
    width: 220px; /* Extra width for reconnect button */
}

#connectionStatus.status-reconnecting {
    width: 135px;
}

#connectionStatus.status-connecting {
    width: 110px; /* Width for "Connecting" text */
}

#connectionStatus.status-menu {
    width: 72px; /* Adjusted width for "Menu" text */
}

#connectionText {
    display: inline-block;
    max-width: 200px;
    white-space: nowrap;
    /* Simple linear transitions with transform for smooth text changes */
    transition: max-width 0.3s linear, 
                opacity 0.2s ease,
                margin 0.3s linear,
                transform 0.2s ease;
}

#connectionStatus.collapsed #connectionText {
    max-width: 0;
    opacity: 0;
    margin-left: 0 !important;
    /* Keep it simple with linear */
    transition: max-width 0.3s linear,
                opacity 0.2s linear,
                margin 0.3s linear;
}

/* Collapse container to a perfect circle (override inline styles) */
#connectionStatus.collapsed {
    width: 24px !important;
    height: 24px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    gap: 0 !important;
    justify-content: center !important;
}

/* Optionally enlarge the dot slightly when collapsed for visual clarity */
#connectionStatus.collapsed #connectionDot {
    width: 10px;
    height: 10px;
}


body {
    font-family: 'Poppins', sans-serif;
    background: #0a0a0a;
    background-image: 
        radial-gradient(ellipse at top left, rgba(124, 58, 237, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
        linear-gradient(135deg, #0a0a0a 0%, #111827 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Changed from center to flex-start */
    padding: 2rem 0;
    color: #e5e7eb;
    overscroll-behavior-y: contain; /* Prevent pull-to-refresh */
}

.container {
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 2rem;
    width: 90%;
    max-width: 900px;
    /* Natural height based on content */
    height: auto;
    overflow: visible;
    box-shadow: 
        0 20px 60px rgba(0,0,0,0.8),
        inset 0 1px 0 rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

h1 {
    text-align: center;
    background: linear-gradient(135deg, #a78bfa 0%, #c084fc 50%, #e879f9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2rem;
    font-size: 2.5rem;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
}

/* Collapsible section headers */
.collapsible-header {
    color: #c084fc;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    padding: 0.5rem;
    margin-left: -0.5rem;
    margin-right: -0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

/* Only apply hover effects on devices that support hovering (not touch devices) */
@media (hover: hover) and (pointer: fine) {
    .collapsible-header:hover {
        background: rgba(139, 92, 246, 0.1);
        transform: translateX(5px);
    }
}

/* Active state for all devices (when pressing/tapping) */
.collapsible-header:active {
    transform: translateX(3px);
    background: rgba(139, 92, 246, 0.1);
}

/* Touch devices - remove sticky hover state */
@media (hover: none) and (pointer: coarse) {
    .collapsible-header:hover {
        background: transparent;
        transform: none;
    }
}

.screen {
    display: none;
    visibility: hidden;
    position: absolute;
    top: -9999px;
    left: -9999px;
}

.screen.active {
    display: block;
    visibility: visible;
    position: static;
    top: auto;
    left: auto;
    animation: fadeIn 0.5s;
}

/* Hide screens when loading screen is shown */
.screen.hidden-by-loading {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes rotateX {
    from {
        transform: translate(-50%, -50%) rotateY(0deg);
    }
    to {
        transform: translate(-50%, -50%) rotateY(360deg);
    }
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #d1d5db;
}

input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #374151;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s;
    background: #1f2937;
    color: #e5e7eb;
}

/* Input wrapper - normal block on desktop */
.input-wrapper {
    display: block;
}

/* Make the game input 60% wide, left-aligned */
#gameScreen #guessInput {
    width: 60%;
    display: block; /* stays left-aligned by default */
    margin: 0;      /* no centering */
}

input:focus {
    outline: none;
    border-color: #8b5cf6;
    background: #111827;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

button {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: block;
    margin: 1rem auto;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.6);
    background: linear-gradient(135deg, #9333ea 0%, #7e22ce 100%);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.room-code {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    padding: 1rem;
    border-radius: 10px;
    text-align: center;
    margin: 1rem 0;
    border: 1px solid #374151;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}

.room-code h2 {
    color: #c084fc;
    font-size: 2rem;
    letter-spacing: 0.2rem;
    text-shadow: 0 0 20px rgba(192, 132, 252, 0.5);
    font-weight: 700;
}

.players-list {
    background: #1f2937;
    border-radius: 10px;
    padding: 1rem;
    margin: 1rem 0;
    border: 1px solid #374151;
}

.player {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    margin: 0.5rem 0;
    background: #111827;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    border: 1px solid #374151;
}

.player .player-name {
    flex: 1;
    font-weight: 600;
    color: #e5e7eb;
}

.add-friend-btn {
    padding: 0.25rem 0.75rem;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.add-friend-btn:hover {
    background: linear-gradient(135deg, #9333ea 0%, #7e22ce 100%);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.5);
    transform: translateY(-1px);
}

.timer {
    text-align: center;
    font-size: 1.5rem;
    color: #ef4444;
    margin: 1rem 0;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
    font-weight: 600;
}

/* removed .guess-input-container to allow input to scroll with content */

.guesses-list {
    /* Allow infinite expansion */
    overflow-y: visible;
    overflow-x: hidden; /* Hide horizontal overflow */
    position: relative; /* Establish positioning context */
    background: #1f2937;
    border-radius: 10px;
    padding: 1rem;
    margin: 1rem 0;
    border: 1px solid #374151;
    /* Enable GPU acceleration for smooth animations */
    will-change: contents;
    transform: translateZ(0);
    /* Avoid scroll anchoring jumps while content updates */
    overflow-anchor: none;
}

.guess-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Allow wrapping for long content */
    padding: 0.75rem;
    padding-left: 0.75rem; /* Removed extra padding since progress bar is now on the right */
    margin: 0.5rem 0;
    background: #111827;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    border: 1px solid #374151;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform-origin: center;
    position: relative;
    min-height: auto; /* Allow vertical growth */
}

/* Progress bar for common words */
.common-progress {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 6px;
    background: rgba(34, 197, 94, 0.2);
    border-radius: 3px;
    overflow: hidden;
}

.common-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    border-radius: 3px;
    transition: width 0.3s ease;
}

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

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

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

.guess-order {
    color: #6b7280;
    font-size: 0.85rem;
    min-width: 5px;
    margin-right: 0.5rem;
    text-align: left;
    opacity: 0.7;
    flex-shrink: 0; /* Prevent order number from shrinking */
}

.guess-word {
    font-weight: 600;
    color: #e5e7eb;
    flex: 1 1 auto; /* Allow to shrink and grow */
    word-break: break-word; /* Break long words */
    overflow-wrap: break-word; /* Alternative for better compatibility */
    hyphens: auto; /* Add hyphens when breaking */
    min-width: 0; /* Allow flex item to shrink below content size */
    padding-right: 0.5rem; /* Add some spacing */
}

.guess-score {
    font-size: 1.1rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 20px;
    min-width: 90px;
    text-align: center;
    margin-left: auto;
    flex-shrink: 0; /* Prevent score from shrinking */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.temp-symbol {
    font-size: 1.2rem;
}

.players-panel {
    background: #1f2937;
    border-radius: 10px;
    padding: 1rem;
    height: fit-content;
    position: sticky;
    top: 1rem;
    border: 1px solid #374151;
}

.game-player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    margin: 0.5rem 0;
    background: #111827;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    border: 1px solid #374151;
}

.game-player-item.spectator {
    opacity: 0.7;
    background: #0f172a;
}

.room-code-mini {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #374151;
    text-align: center;
}

.room-code-mini small {
    color: #9ca3af;
    display: block;
    margin-bottom: 0.25rem;
}

.room-code-mini strong {
    color: #c084fc;
    font-size: 1.2rem;
    letter-spacing: 0.1rem;
    text-shadow: 0 0 10px rgba(192, 132, 252, 0.5);
}

/* Score gradients */
.score-100 { 
    background: linear-gradient(135deg, #10b981 0%, #059669 100%); 
    color: white; 
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.6);
}
.score-90 { 
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); 
    color: white; 
}
.score-80 { 
    background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%); 
    color: white; 
}
.score-70 { 
    background: linear-gradient(135deg, #f97316 0%, #c2410c 100%); 
    color: white; 
}
.score-60 { 
    background: linear-gradient(135deg, #ec4899 0%, #be185d 100%); 
    color: white; 
}
.score-50 { 
    background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%); 
    color: white; 
}
.score-40 { 
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%); 
    color: white; 
}
.score-30 { 
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%); 
    color: white; 
}
.score-20 { 
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); 
    color: white; 
}
.score-10 { 
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%); 
    color: white; 
}
.score-0 { 
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%); 
    color: white; 
}
.score-neg20 { 
    background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%); 
    color: white; 
}
.score-neg40 { 
    background: linear-gradient(135deg, #10b981 0%, #059669 100%); 
    color: white; 
}
.score-neg60 { 
    background: linear-gradient(135deg, #64748b 0%, #475569 100%); 
    color: white; 
}
.score-neg80 { 
    background: linear-gradient(135deg, #475569 0%, #334155 100%); 
    color: white; 
}
.score-neg100 { 
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%); 
    color: white; 
}

.guess-player {
    color: #9ca3af;
    font-size: 0.9rem;
    margin: 0 1rem;
    min-width: 100px;
    text-align: right;
    flex-shrink: 0; /* Prevent player name from shrinking */
}

.hint-box {
    display: none !important; /* Deprecated - using banner system now */
}

.message {
    position: fixed !important;
    top: 20px !important;
    right: -400px !important; /* Start off-screen */
    transform: translateX(0) !important;
    z-index: 200;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    width: auto; /* Fit content */
    max-width: 350px;
    margin: 0;
    text-align: left;
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
    transition: right 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border-left: 4px solid;
    white-space: normal; /* Allow text to wrap when needed */
}

.message.show {
    right: 20px !important; /* Slide in */
}

@keyframes slideInBounce {
    0% { 
        right: -400px;
        opacity: 0;
    }
    60% {
        right: 10px;
        opacity: 1;
    }
    80% {
        right: 25px;
    }
    100% { 
        right: 20px;
        opacity: 1;
    }
}

.message.success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.95) 0%, rgba(5, 150, 105, 0.95) 100%);
    color: white;
    border-left-color: #10b981;
}

.message.error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.95) 0%, rgba(220, 38, 38, 0.95) 100%);
    color: white;
    border-left-color: #ef4444;
}

/* Winner display styling - reuses latest guess section container */
.winner-display {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.1) 0%, rgba(245, 158, 11, 0.1) 100%);
    border: 2px solid rgba(251, 191, 36, 0.3);
    border-radius: 12px;
    padding: 0.75rem;
    margin: 1rem 0;
    text-align: center;
    animation: slideDown 0.3s ease;
}

/* Latest guess section styling */
.latest-guess-section {
    background: rgba(139, 92, 246, 0.1);
    border: 2px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    padding: 0.75rem;
    margin: 0.5rem 0;
    animation: slideDown 0.3s ease;
}

.latest-guess-item {
    background: rgba(31, 41, 55, 0.8);
    border-radius: 8px;
    padding: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    font-weight: 600;
}

/* Guesses heading */
.guesses-heading {
    margin: 1rem 0 0.5rem 0;
    color: #e5e7eb;
}

/* Guess notification styling */
.guess-notification {
    display: inline-block;
    margin-left: 1rem;
    padding: 0.25rem 0.75rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    visibility: hidden;
}

.guess-notification.show {
    opacity: 1;
    visibility: visible;
}

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

.guess-notification.animate-in {
    animation: notificationPulse 0.4s ease-out;
}

/* Centered fade message for game start */
#gameMessage.centered-fade {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 200;
    padding: 1.5rem 3rem;
    background: rgba(17, 24, 39, 0.98);
    border: 2px solid rgba(139, 92, 246, 0.5);
    border-radius: 20px;
    max-width: 80%;
    margin: 0;
    color: #a78bfa;
    font-size: 1.2rem;
    font-weight: 700;
    box-shadow: 0 12px 48px rgba(139, 92, 246, 0.4);
    backdrop-filter: blur(20px);
    transition: opacity 0.5s ease;
}

.message.info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.95) 0%, rgba(37, 99, 235, 0.95) 100%);
    color: white;
    border-left-color: #3b82f6;
}

.message.hint {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.95) 0%, rgba(217, 119, 6, 0.95) 100%);
    color: white;
    border-left-color: #f59e0b;
}

/* Support for stacking multiple messages */
.message:nth-of-type(2) {
    top: 90px !important;
}

.message:nth-of-type(3) {
    top: 160px !important;
}

.message:nth-of-type(4) {
    top: 230px !important;
}

.winner-announcement {
    text-align: center;
    font-size: 1.6rem;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #fbbf24 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 20px rgba(251, 191, 36, 0.5));
    margin: 2rem 0;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Connection status indicator animations */
@keyframes connectionPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

@keyframes scoreUpdate {
    0% {
        transform: scale(1);
        color: inherit;
    }
    50% {
        transform: scale(1.1);
        color: #10b981;
    }
    100% {
        transform: scale(1);
        color: inherit;
    }
}

#connectionDot.connected {
    background: #10b981 !important;
    animation: connectionPulse 2s infinite;
}

#connectionDot.disconnected {
    background: #ef4444 !important;
}

#connectionDot.reconnecting {
    background: #f59e0b !important;
}

#connectionDot.connecting {
    background: #fbbf24 !important;
}

.result-message {
    font-size: 1.1rem;
    color: #e5e7eb;
    margin: 1rem 2rem 2rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    text-align: center;
}

.button-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.button-group button {
    flex: 1;
    max-width: 200px;
}

.hint-button {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    font-size: 0.9rem;
    padding: 0.65rem 1.3rem;
    border-radius: 25px;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3);
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1f2937;
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    border: 1px solid #374151;
}

.guess-counter {
    color: #d1d5db;
    font-weight: 600;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    margin: 0.5rem 0;
    background: #111827;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    border: 1px solid #374151;
}

.leaderboard-entry .rank {
    font-weight: 700;
    color: #c084fc;
    min-width: 30px;
    text-shadow: 0 0 5px rgba(192, 132, 252, 0.5);
}

.leaderboard-entry .name {
    flex: 1;
    margin: 0 1rem;
    font-weight: 600;
}

.leaderboard-entry .score {
    color: #a78bfa;
    font-weight: 700;
    font-size: 1.1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.stat-item {
    background: #1f2937;
    padding: 1rem;
    border-radius: 10px;
    text-align: center;
    border: 1px solid #374151;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #c084fc;
    text-shadow: 0 0 10px rgba(192, 132, 252, 0.5);
}

.stat-label {
    color: #9ca3af;
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.friend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    margin: 0.5rem 0;
    background: #111827;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    border: 1px solid #374151;
}

.friend-name {
    flex: 1;
    font-weight: 600;
    color: #e5e7eb;
}

.unfriend-btn {
    padding: 0.25rem 0.5rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.unfriend-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    transform: translateY(-1px);
}

.invite-btn {
    padding: 0.25rem 0.75rem;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    box-shadow: 0 2px 5px rgba(139, 92, 246, 0.3);
}

.invite-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(139, 92, 246, 0.5);
    background: linear-gradient(135deg, #9333ea 0%, #7e22ce 100%);
}

.invite-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    margin: 0.5rem 0;
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    border: 1px solid #6366f1;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1f2937;
    border-radius: 4px;
}

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

::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* User info container styles */
.user-info-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
    margin-bottom: 0.5rem;
    border: 1px solid rgba(139, 92, 246, 0.3);
    max-width: fit-content;
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 2px 6px rgba(139, 92, 246, 0.1);
}

.user-info-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-avatar {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 0.75rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    flex-shrink: 0;
}

.user-details {
    line-height: 1.2;
}

.user-name {
    font-weight: 600;
    color: #e5e7eb;
    font-size: 0.9rem;
}

.user-email {
    color: #9ca3af;
    font-size: 0.75rem;
}

.sign-out-btn {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.2s;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.sign-out-btn.hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Hide mobile-only elements on desktop */
.mobile-game-header {
    display: none;
}

.mobile-only-timer {
    display: none !important;
}

/* Hide mobile input container and counter on desktop */
.mobile-input-container {
    display: none !important;
}

.mobile-guess-counter {
    display: none !important;
}

/* Desktop game buttons */
.desktop-game-buttons {
    display: flex;
}

/* Mobile hint popup */
.mobile-hint-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.95) 0%, rgba(217, 119, 6, 0.95) 100%);
    border-radius: 20px;
    padding: 2rem;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    max-width: 90%;
    text-align: center;
}

.mobile-hint-popup.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.mobile-hint-content {
    color: white;
}

.mobile-hint-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.mobile-hint-text {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.4;
}

/* Responsive design */
@media (max-width: 768px) {
    /* Hide the main title on mobile to save space */
    h1 {
        display: none;
    }
    
    /* Show mobile header on mobile */
    .mobile-game-header {
        display: block !important;
        position: fixed; /* Changed from absolute to fixed */
        top: calc(10px + env(safe-area-inset-top, 0));
        left: calc(10px + env(safe-area-inset-left, 0));
        z-index: 150;
    }
    
    /* Guesses container stays visible on mobile */
    
    /* Hide game info on mobile */
    .game-info {
        display: none !important;
    }
    
    /* Hide desktop game buttons on mobile */
    .desktop-game-buttons {
        display: none !important;
    }
    
    #gameScreen > div {
        grid-template-columns: 1fr !important;
    }
    
    .players-panel {
        display: none; /* Hide players panel on mobile */
    }
    
    /* removed mobile-specific .guess-input-container styles */
    
    /* Mobile input styling moved to mobile-styles.css */
    
    /* Compact button group */
    .button-group {
        display: flex;
        gap: 0.5rem;
    }
    
    .button-group button {
        flex: 1;
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    /* Ensure headings are visible on mobile */
    .guesses-heading {
        display: block !important;
        color: #e5e7eb;
        font-size: 1.1rem;
    }
    
    /* Latest guess section styling */
    .latest-guess-section {
        background: rgba(139, 92, 246, 0.1);
        border: 2px solid rgba(139, 92, 246, 0.3);
        border-radius: 12px;
        padding: 0.75rem;
        margin: 0.5rem 0 1rem;
        animation: slideDown 0.3s ease;
    }
    
    .latest-guess-item {
        background: rgba(31, 41, 55, 0.8);
        border-radius: 8px;
        padding: 0.75rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 1rem;
        font-weight: 600;
    }
    
    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    /* Hide floating recent guesses on mobile */
    .recent-guesses-float {
        display: none !important;
    }
    
    /* Make guess items more compact on mobile */
    .guess-item {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    
    /* Ensure hint box is visible when shown */
    #hintBox {
        position: fixed;
        top: 120px;
        left: 0.75rem;
        right: 0.75rem;
        z-index: 99;
        background: rgba(139, 92, 246, 0.95);
        backdrop-filter: blur(10px);
    }
    
    /* Mobile game screen specific */
    #gameScreen {
        padding: 0;
        height: 100vh;
        overflow: visible;
        position: relative;
    }
    
    /* Main game area on mobile - use flex layout */
    #gameScreen > div > div:first-child {
        height: 100vh;
        display: flex;
        flex-direction: column;
        position: relative;
    }
    
    /* Ensure guesses list expands infinitely */
    .guesses-list {
        height: auto;
        min-height: 200px;
        overflow-y: visible !important; /* Allow expansion */
        overflow-x: hidden !important;
        background: rgba(31, 41, 55, 0.8) !important;
        border-radius: 8px;
        padding: 0.5rem !important;
        display: block !important;
        visibility: visible !important;
    }
    
}

/* Mobile container styles handled in mobile-styles.css */

@media (max-width: 600px) {
    .container {
        padding: 0; /* Remove default padding */
        /* Let content determine height */
        height: auto; /* Allow container to expand */
        overflow-y: auto; /* Allow scrolling */
        overflow-x: hidden;
        border-radius: 0;
        background: #0a0a0a; /* Solid background */
        box-shadow: none;
        border: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }
    
    h1 {
        display: none; /* Hide on small mobile too */
    }
    
    /* Ensure body takes full height */
    body {
        padding: 0;
        margin: 0;
    }
    
    .guesses-list {
        /* Remove max-height for mobile too */
    }
}

/* Reconnect Button - Hidden */
.reconnect-button {
    display: none !important; /* Hide the manual reconnect button */
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 20px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    z-index: 10000;
    animation: pulse 2s infinite;
}

.reconnect-button:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    transform: translateX(-50%) scale(1.05);
}

.reconnect-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

@keyframes pulse {
    0% {
        box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(245, 158, 11, 0.5);
    }
    100% {
        box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    }
}

/* Celebration Effects */
.celebration-winner-text {
    animation: celebrateText 10s ease-in-out;
    position: relative;
}

@keyframes celebrateText {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
    }
    10% {
        transform: scale(1.2) rotate(-5deg);
        text-shadow: 0 0 20px rgba(255, 215, 0, 1);
    }
    20% {
        transform: scale(1.3) rotate(5deg);
        text-shadow: 0 0 30px rgba(255, 100, 100, 1);
    }
    30% {
        transform: scale(1.2) rotate(-3deg);
        text-shadow: 0 0 25px rgba(100, 255, 100, 1);
    }
    40% {
        transform: scale(1.4) rotate(3deg);
        text-shadow: 0 0 35px rgba(100, 100, 255, 1);
    }
    50% {
        transform: scale(1.3) rotate(-2deg);
        text-shadow: 0 0 40px rgba(255, 255, 100, 1);
    }
    60% {
        transform: scale(1.2) rotate(2deg);
        text-shadow: 0 0 30px rgba(255, 100, 255, 1);
    }
    70% {
        transform: scale(1.3) rotate(-4deg);
        text-shadow: 0 0 25px rgba(100, 255, 255, 1);
    }
    80% {
        transform: scale(1.1) rotate(4deg);
        text-shadow: 0 0 20px rgba(255, 215, 0, 1);
    }
    90% {
        transform: scale(1.2) rotate(-2deg);
        text-shadow: 0 0 15px rgba(255, 215, 0, 0.9);
    }
}

.celebration-background {
    animation: backgroundCelebration 10s linear;
    position: relative;
    overflow: visible !important;
}

@keyframes backgroundCelebration {
    0% {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }
    10% {
        background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    }
    20% {
        background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    }
    30% {
        background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    }
    40% {
        background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    }
    50% {
        background: linear-gradient(135deg, #30cfd0 0%, #330867 100%);
    }
    60% {
        background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    }
    70% {
        background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    }
    80% {
        background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    }
    90% {
        background: linear-gradient(135deg, #ff6e7f 0%, #bfe9ff 100%);
    }
    100% {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }
}

/* Confetti animation */
.celebration-confetto {
    animation: confettiFall 3s linear forwards;
}

@keyframes confettiFall {
    to {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Firework particles */
.firework-particle {
    animation: fireworkFade 1.5s ease-out forwards;
}

@keyframes fireworkFade {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.3);
    }
}

/* Extra sparkle effect for winner */
.celebration-sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    animation: sparkle 1s linear infinite;
}

@keyframes sparkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Floating trophy animation */
.celebration-trophy {
    position: fixed;
    font-size: 100px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: trophyFloat 10s ease-in-out;
    z-index: 10000;
    pointer-events: none;
}

@keyframes trophyFloat {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(0deg);
        opacity: 0;
    }
    20% {
        transform: translate(-50%, -50%) scale(1.5) rotate(360deg);
        opacity: 1;
    }
    80% {
        transform: translate(-50%, -50%) scale(1.5) rotate(720deg);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(0) rotate(1080deg);
        opacity: 0;
    }
}

/* Floating waffle animation */
.celebration-waffle {
    position: fixed;
    font-size: 100px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: waffleFloat 10s ease-in-out;
    z-index: 10000;
    pointer-events: none;
}

@keyframes waffleFloat {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(0deg);
        opacity: 0;
    }
    20% {
        transform: translate(-50%, -50%) scale(1.5) rotate(360deg);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.8) rotate(540deg);
        opacity: 1;
    }
    80% {
        transform: translate(-50%, -50%) scale(1.5) rotate(720deg);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(0) rotate(1080deg);
        opacity: 0;
    }
}

/* Milestone Fireworks Animations */
.milestone-fireworks {
    position: fixed;
    pointer-events: none;
    z-index: 10000;
    width: 300px;
    height: 300px;
    transform: translate(-50%, -50%);
}

.firework-particle {
    position: absolute;
    font-size: 24px;
    animation-fill-mode: forwards;
    pointer-events: none;
}

/* Small fireworks for first 30+ score */
.firework-small {
    animation: fireworkSmall 5s ease-out forwards;
}

@keyframes fireworkSmall {
    0% {
        transform: translate(0, 0) scale(0);
        opacity: 0;
    }
    10% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--x), var(--y)) scale(0.3);
        opacity: 0;
    }
}

/* Big fireworks for new record */
.firework-big {
    animation: fireworkBig 5s ease-out forwards;
}

@keyframes fireworkBig {
    0% {
        transform: translate(0, 0) scale(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        transform: translate(0, 0) scale(1.5) rotate(180deg);
        opacity: 1;
    }
    50% {
        transform: translate(calc(var(--x) * 0.5), calc(var(--y) * 0.5)) scale(1.2) rotate(360deg);
        opacity: 1;
    }
    100% {
        transform: translate(var(--x), var(--y)) scale(0.2) rotate(720deg);
        opacity: 0;
    }
}

/* Center burst animation */
.firework-center {
    position: absolute;
    left: 50%;
    top: 50%;
    font-size: 40px;
    transform: translate(-50%, -50%);
    animation: centerBurst 5s ease-out forwards;
}

@keyframes centerBurst {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        transform: translate(-50%, -50%) scale(2) rotate(180deg);
        opacity: 1;
    }
    40% {
        transform: translate(-50%, -50%) scale(1.5) rotate(360deg);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(0.5) rotate(540deg);
        opacity: 0;
    }
}
