/* ─── Online Mode Styles ─── */

/* Input fields */
.online-input {
    width: 100%;
    padding: 14px 18px;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 500;
    outline: none;
    transition: border-color var(--transition-fast);
}

.online-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
}

.online-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* Room code display */
.room-code-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    margin: 15px 0;
    background: rgba(99, 102, 241, 0.08);
    border: 1px dashed rgba(99, 102, 241, 0.3);
    border-radius: 20px;
}

.room-code-text {
    font-size: 2.5rem;
    font-weight: 900;
    letter-spacing: 12px;
    font-family: 'Courier New', monospace;
}

.code-letter {
    color: var(--primary);
    text-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}

.code-digit {
    color: #22d3ee;
    text-shadow: 0 0 15px rgba(34, 211, 238, 0.3);
}

/* Player list */
.online-player-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.online-player-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.online-player-item.small {
    padding: 6px 10px;
    font-size: 0.85rem;
}

/* Online indicator dot */
.online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
    flex-shrink: 0;
}

.online-dot.green {
    background: var(--success);
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

.online-dot.gray {
    background: var(--text-secondary);
    box-shadow: none;
    opacity: 0.3;
}

/* Chat container */
.online-chat {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
    margin: 10px 0;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.3) transparent;
}

.online-chat::-webkit-scrollbar {
    width: 4px;
}

.online-chat::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 4px;
}

/* Chat bubbles */
.chat-bubble {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 16px;
    padding-right: 40px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    animation: fadeIn 0.3s ease;
}

.chat-bubble-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.chat-name {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--primary);
}

.chat-order {
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0.5;
}

.chat-text {
    font-size: 0.95rem;
    line-height: 1.4;
}

/* Turn indicator */
.online-turn-indicator {
    text-align: center;
    padding: 12px;
    margin-top: 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.online-turn-indicator.active {
    color: var(--success);
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.2);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.15);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
    }
}

/* Toast notification */
.online-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 14px 24px;
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 3000;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    max-width: 90vw;
    text-align: center;
}

.online-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Reveal status grid */
.online-reveal-status {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: 15px;
}

/* Vote buttons */
.vote-btn {
    transition: all 0.2s ease !important;
}

.vote-btn:active:not(:disabled) {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: white !important;
    transform: scale(0.98);
}

/* ─── Emoji Reactions ─── */
.chat-react-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    padding: 10px;
    width: auto;
    /* Override global button width: 100% */
    cursor: pointer;
    opacity: 0.4;
    transition: opacity 0.2s, transform 0.2s;
}

.chat-react-btn:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.2);
}

.reaction-popover {
    position: absolute;
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    width: 170px;
    /* Forces 4 items per row if each is ~30px */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.15s ease-out;
}

.reaction-emoji {
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s;
    user-select: none;
    padding: 2px;
}

.reaction-emoji:hover {
    transform: scale(1.3);
}

/* Floating Animation */
.floating-emoji {
    position: absolute;
    font-size: 1.8rem;
    pointer-events: none;
    z-index: 999;
    animation: floatUpFade 2.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes floatUpFade {
    0% {
        opacity: 0;
        transform: translate(0, 0) scale(0.3) rotate(0deg);
    }

    15% {
        opacity: 1;
        transform: translate(var(--dx), -15px) scale(1.2) rotate(var(--rot));
    }

    100% {
        opacity: 0;
        transform: translate(calc(var(--dx) * 2), -90px) scale(0.9) rotate(calc(var(--rot) * 2));
    }
}