/* Main Header Branding */
.header {
    width: 100%;
    padding: 24px 32px 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    background: linear-gradient(to bottom, rgba(5, 5, 8, 0.9), transparent);
    backdrop-filter: blur(20px);
    z-index: 1000;
}

.header-content {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.branding {
    display: flex;
    align-items: center;
    gap: 16px;
    /* Tighter gap for logo-on-right */
}

.header-logo {
    height: 32px;
    width: auto;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 2.2rem;
    /* Slightly larger for the vertical lockup */
    font-weight: 800;
    color: white;
    margin: 0;
    line-height: 1;
    letter-spacing: 0.1em;
    /* Increased letter-spacing for Chinese title */
    white-space: nowrap;
}

.brand-subtitle {
    display: block;
    font-size: 0.9rem;
    /* Much smaller for a true subtitle feel */
    font-weight: 500;
    color: var(--text-secondary);
    margin: 2px 0 0 2px;
    letter-spacing: 0.2em;
    /* Wide spacing for modern brand feel */
    text-transform: uppercase;
    opacity: 0.8;
}


.connection-badge {
    position: absolute;
    top: 24px;
    right: 32px;
    font-size: 0.8rem;
    color: #ff4444;
}

/* Room List & Hall */
.room-list-container {
    display: none;
    flex-direction: column;
    width: 100%;
    height: 100%;
    gap: 32px;
    padding: 40px 32px 60px;
    max-width: 1200px;
    margin: 0 auto;
}

.room-list-container.active {
    display: flex;
}

.row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 8px;
}

/* Room Grid & Cards */
.room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    padding: 10px 0 60px;
}

.room-card-wrapper {
    padding: 20px 24px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    margin-bottom: 24px;
}

/* Compact Room Card */
.room-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 16px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    min-height: 150px;
}

.room-card:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.room-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    padding-right: 32px;
    /* Space for more btn */
}

.room-card-more-btn {
    position: absolute;
    top: 14px;
    right: 12px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
}

.room-card-more-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.room-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    line-height: 1.3;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 4px;
}

.room-category-badge {
    background: rgba(243, 194, 106, 0.1);
    border: 1px solid rgba(243, 194, 106, 0.2);
    color: var(--gold);
    font-size: 0.7rem;
    padding: 3px 6px;
    border-radius: 6px;
    font-weight: 600;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.room-summary {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 4px 0 8px 0;
    opacity: 0.8;
}

.room-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
}

.room-avatars-stack {
    display: flex;
    align-items: center;
}

.stacked-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #1a1a1a;
    margin-left: -8px;
    overflow: hidden;
    background: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: white;
}

.stacked-avatar:first-child {
    margin-left: 0;
}

.stacked-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.social-btn img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.room-date {
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.6;
}

.room-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.room-date {
    opacity: 0.7;
    font-feature-settings: 'tnum';
}

.room-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 12px;
}

.play-action {
    margin-left: auto;
    font-size: 1.4rem;
    color: var(--gold);
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.room-card:hover .play-action {
    opacity: 1;
    transform: scale(1);
}

.room-status-badge {
    position: absolute;
    top: 0;
    left: 0;
    background: var(--purple);
    color: white;
    padding: 2px 8px;
    font-size: 0.6rem;
    font-weight: 800;
    border-bottom-right-radius: 8px;
}

/* ==============================================
   PREMIUM LIVE ROOM HEADER
   ============================================== */

.live-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7) 0%, transparent 100%);
}

.header-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.header-btn:active {
    transform: scale(0.95);
}

.live-header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
    margin: 0 16px;
    overflow: hidden;
}

.live-avatars {
    display: flex;
    align-items: center;
}

.live-avatars .participant {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-left: -8px;
    border: 2px solid rgba(0, 0, 0, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    flex-shrink: 0;
}

.live-avatars .participant:first-child {
    margin-left: 0;
}

.live-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
}

.live-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: white;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.live-topic-row {
    max-width: 100%;
}

.live-topic {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    max-width: 260px;
    /* Limits width and triggers ellipsis */
}

.live-pulse {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ff3b30;
    animation: pulse 2s infinite;
    flex-shrink: 0;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

/* Chat Container (Main Wrapper) */
.chat-container {
    display: none;
    flex-direction: column;
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    /* Mobile viewport fix */
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    background: linear-gradient(135deg, rgba(15, 15, 20, 0.95) 0%, rgba(5, 5, 10, 0.98) 100%);
    backdrop-filter: blur(50px);
    -webkit-backdrop-filter: blur(50px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(100%);
}

.chat-container.active {
    display: flex;
    transform: translateY(0);
}

/* Messages Container - Apple Music Lyrics Style */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 40vh 32px 40vh;
    /* Large vertical padding to center first/last items */
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    /* Fade mask at top and bottom */
    mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
}

.messages-container::-webkit-scrollbar {
    display: none;
}

/* Live Lyrics Line - Apple Music Style */
.live-lyrics-line {
    text-align: left;
    padding: 16px 24px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    filter: blur(2px);
    opacity: 0.4;
    transform: scale(0.92);
}

.live-lyrics-line:hover {
    filter: blur(0);
    opacity: 0.6;
    background: rgba(255, 255, 255, 0.03);
}

.live-lyrics-line.active {
    filter: blur(0);
    opacity: 1;
    transform: scale(1);
    background: linear-gradient(135deg, rgba(243, 194, 106, 0.12) 0%, rgba(243, 194, 106, 0.03) 100%);
    border-left: 4px solid var(--gold);
    padding-left: 20px;
}

.live-lyrics-line.user-line {
    filter: blur(0);
    opacity: 1;
    text-align: right;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.15) 0%, rgba(236, 72, 153, 0.08) 100%);
    border-left: none;
    border-right: 4px solid var(--purple);
    padding-right: 20px;
    padding-left: 24px;
}

.live-lyrics-meta {
    display: block;
    font-size: 0.85rem;
    color: var(--gold);
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: 0.03em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.live-lyrics-meta .avatar-img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    overflow: hidden;
}

.live-lyrics-line.user-line .live-lyrics-meta {
    color: var(--purple);
}

.live-lyrics-text {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
}

.live-lyrics-line.active .live-lyrics-text {
    color: #fff;
    text-shadow: 0 0 30px rgba(243, 194, 106, 0.4);
}

/* Message Bubbles */
.message {
    display: flex;
    gap: 16px;
    max-width: 85%;
    animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message .avatar {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.message .bubble {
    padding: 16px 20px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    position: relative;
    transition: all 0.3s ease;
}

.message.user .bubble {
    background: linear-gradient(135deg, var(--purple) 0%, var(--pink) 100%);
    border: none;
    box-shadow: 0 10px 20px rgba(168, 85, 247, 0.2);
}

.message .sender {
    font-size: 0.8rem;
    color: var(--gold);
    margin-bottom: 6px;
    font-weight: 700;
}

.message .content {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
}

/* Live Mode Sentence Highlighting (Apple Podcast Style) */
.message .content .sentence {
    display: inline;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    padding: 2px 4px;
    border-radius: 6px;
    margin: 0 1px;
}

.message .content .sentence.active {
    color: var(--gold);
    text-shadow: 0 0 20px rgba(243, 194, 106, 0.5);
    background: rgba(243, 194, 106, 0.1);
    font-weight: 600;
}

/* Text Toggle Logic */
.messages-container.hidden-text .bubble,
.messages-container.hidden-text .live-lyrics-line {
    opacity: 0 !important;
    filter: blur(8px);
    pointer-events: none;
    transform: scale(0.95);
}

.messages-container.hidden-text .message.user .bubble {
    opacity: 1;
    filter: none;
}

/* ==============================================
   PREMIUM FLOATING CONTROLS
   ============================================== */

.live-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 20px 32px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.6) 50%, transparent 100%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    z-index: 200;
}

.mic-hint {
    background: rgba(243, 194, 106, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(243, 194, 106, 0.2);
    color: var(--gold);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    animation: fadeInDown 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    pointer-events: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


.action-bar {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 28px;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.action-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.action-btn:active {
    transform: scale(0.9);
}

.action-btn.active {
    background: rgba(255, 255, 255, 0.15);
    color: var(--gold);
}

.action-btn.muted {
    color: rgba(255, 255, 255, 0.4);
}

/* Mic Action Button - Meeting Style */
.action-btn.mic-action {
    background: rgba(255, 255, 255, 0.05);
}

.action-btn.mic-action.speaking {
    background: rgba(52, 199, 89, 0.2);
    color: #34c759;
    animation: speaking-glow 1.5s infinite;
}

.action-btn.mic-action i {
    transition: transform 0.2s;
}

.action-btn.mic-action.speaking i {
    transform: scale(1.1);
}

@keyframes speaking-glow {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.3);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(52, 199, 89, 0);
    }
}

/* Input Row */
.input-row {
    display: flex;
    gap: 12px;
    width: 100%;
    max-width: 500px;
}

.live-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 14px 20px;
    border-radius: 24px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s;
}

.live-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.live-input:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05);
}

/* Microphone Button */
/* ==============================================
   PREMIUM IMMERSIVE VISUALS
   ============================================== */

/* 1. Dynamic Ambient Background */
.live-room-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(125deg, #0f0f14 0%, #1a1a2e 40%, #16213e 100%);
    overflow: hidden;
}

.live-room-bg::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(76, 29, 149, 0.15), transparent 60%),
        radial-gradient(circle at 80% 20%, rgba(243, 194, 106, 0.1), transparent 50%);
    animation: ambientShift 20s ease-in-out infinite alternate;
    opacity: 0.6;
}

@keyframes ambientShift {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(-50px, -20px) scale(1.1);
    }
}

/* 2. Active Speaker Glow */
.participant {
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    position: relative;
}

.participant.speaking {
    transform: scale(1.15);
    border-color: var(--gold) !important;
    box-shadow: 0 0 0 2px rgba(243, 194, 106, 0.6),
        0 0 15px rgba(243, 194, 106, 0.4),
        0 0 30px rgba(243, 194, 106, 0.2);
    z-index: 10;
}

.participant.speaking::after {
    content: '';
    position: absolute;
    top: -4px;
    right: -4px;
    bottom: -4px;
    left: -4px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    opacity: 0;
    animation: ripple 1.5s infinite cubic-bezier(0, 0.2, 0.8, 1);
}

@keyframes ripple {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* 3. Floating Reactions (Particles) */
.floating-reaction {
    position: fixed;
    pointer-events: none;
    animation: floatUp 2s ease-out forwards;
    z-index: 9999;
    font-size: 24px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

@keyframes floatUp {
    0% {
        transform: translateY(0) scale(0.5) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 1;
        transform: translateY(-20px) scale(1.2) rotate(10deg);
    }

    100% {
        transform: translateY(-150px) scale(1) rotate(-20deg);
        opacity: 0;
    }
}

/* 4. Mini Waveform in Header */
.mini-waveform {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 16px;
    margin-left: 8px;
    opacity: 0.6;
}

.mini-bar {
    width: 2px;
    height: 100%;
    background: var(--gold);
    border-radius: 1px;
    animation: miniWave 1s ease-in-out infinite;
}

.mini-bar:nth-child(2) {
    animation-delay: 0.1s;
}

.mini-bar:nth-child(3) {
    animation-delay: 0.2s;
}

.mini-bar:nth-child(4) {
    animation-delay: 0.3s;
}

@keyframes miniWave {

    0%,
    100% {
        height: 20%;
        opacity: 0.5;
    }

    50% {
        height: 100%;
        opacity: 1;
    }
}

/* 5. Premium Toast Notification */
.premium-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(20, 20, 30, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
}

.premium-toast.active {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.premium-toast i {
    color: var(--gold);
}


/* Microphone Button */
.mic-btn {
    width: 48px;

    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.mic-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
}

.mic-btn.recording {
    background: rgba(255, 59, 48, 0.2);
    border-color: rgba(255, 59, 48, 0.5);
    color: #ff3b30;
    animation: recording-pulse 1s infinite;
}

@keyframes recording-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.4);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(255, 59, 48, 0);
    }
}

.send-btn-live {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cyan) 0%, var(--purple) 100%);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(94, 234, 212, 0.3);
}

.send-btn-live:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(94, 234, 212, 0.4);
}

.send-btn-live:active {
    transform: scale(0.95);
}

/* Creator Controls */
.creator-controls {
    margin-top: 8px;
}

.end-btn {
    background: rgba(255, 59, 48, 0.15);
    border: 1px solid rgba(255, 59, 48, 0.3);
    color: #ff3b30;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.end-btn:hover {
    background: rgba(255, 59, 48, 0.25);
}

/* Audio Progress (if needed) */
.audio-progress-container {
    display: none;
}

/* Audio Progress */
.audio-progress-container {
    margin-bottom: 12px;
}

/* Live Mode Visualizer Overlay */
.live-visualizer-overlay {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 4px;
    height: 120px;
    z-index: 50;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.live-visualizer-overlay.hidden {
    display: none;
}

.live-visualizer-overlay .v-bar {
    width: 6px;
    height: 10px;
    background: linear-gradient(to top, var(--pink) 0%, var(--gold) 100%);
    border-radius: 3px;
    box-shadow: 0 0 15px rgba(243, 194, 106, 0.3);
    transition: height 0.3s ease;
}

/* organic staggered animation */
.live-visualizer-overlay.is-speaking .v-bar {
    animation: live-bounce 1s ease-in-out infinite;
}

/* Symmetrical height distribution + staggered delay */
.live-visualizer-overlay .v-bar:nth-child(1),
.live-visualizer-overlay .v-bar:nth-child(14) {
    height: 15px;
    animation-duration: 1.1s;
}

.live-visualizer-overlay .v-bar:nth-child(2),
.live-visualizer-overlay .v-bar:nth-child(13) {
    height: 25px;
    animation-duration: 0.9s;
    animation-delay: 0.1s;
}

.live-visualizer-overlay .v-bar:nth-child(3),
.live-visualizer-overlay .v-bar:nth-child(12) {
    height: 40px;
    animation-duration: 1.3s;
    animation-delay: 0.2s;
}

.live-visualizer-overlay .v-bar:nth-child(4),
.live-visualizer-overlay .v-bar:nth-child(11) {
    height: 55px;
    animation-duration: 1.0s;
    animation-delay: 0.3s;
}

.live-visualizer-overlay .v-bar:nth-child(5),
.live-visualizer-overlay .v-bar:nth-child(10) {
    height: 70px;
    animation-duration: 1.2s;
    animation-delay: 0.4s;
}

.live-visualizer-overlay .v-bar:nth-child(6),
.live-visualizer-overlay .v-bar:nth-child(9) {
    height: 85px;
    animation-duration: 0.8s;
    animation-delay: 0.5s;
}

.live-visualizer-overlay .v-bar:nth-child(7),
.live-visualizer-overlay .v-bar:nth-child(8) {
    height: 100px;
    animation-duration: 1.4s;
    animation-delay: 0.6s;
}

@keyframes live-bounce {

    0%,
    100% {
        transform: scaleY(1);
        opacity: 0.7;
    }

    50% {
        transform: scaleY(1.5);
        opacity: 1;
        filter: brightness(1.2);
    }
}

/* ==============================================
   CHARACTER SELECTION GRID
   ============================================== */
.character-grid {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 10px 4px;
    margin-bottom: 12px;
    scrollbar-width: none;
    /* Hide scrollbar Firefox */
}

.character-grid::-webkit-scrollbar {
    display: none;
    /* Hide scrollbar Chrome */
}

.character-card {
    flex: 0 0 auto;
    width: 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
    opacity: 0.7;
}

.character-card:hover {
    opacity: 1;
    transform: translateY(-2px);
}

.character-card.selected {
    opacity: 1;
    transform: scale(1.05);
}

.character-card .avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color 0.2s;
    margin-bottom: 6px;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.character-card.selected .avatar {
    border-color: var(--cyan);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

.character-card .char-name {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.character-card.selected .char-name {
    color: var(--cyan);
    font-weight: 500;
}


/* ==============================================
   AVATAR ASSETS
   ============================================== */

.avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
}

.room-category .avatar-img {
    width: 18px;
    height: 18px;
    margin-right: 2px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.message .avatar .avatar-img {
    border-radius: 12px;
}

.participant .avatar-img {
    border-radius: 50%;
}

/* User Profile & Auth */
.header-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-login {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-login:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.03);
    padding: 4px 12px 4px 4px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.user-info:hover {
    background: rgba(255, 255, 255, 0.08);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.user-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #151518;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    min-width: 140px;
    padding: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    z-index: 1001;
}

.dropdown-item {
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

/* Modal Overlay & Base */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    /* Controlled by JS */
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

/* Login Modal - Designer Overhaul */
/* Login Modal - Designer Overhaul */
.login-modal {
    max-width: 420px;
    width: 90%;
    background: rgba(15, 15, 20, 0.95);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 32px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    padding: 0;
    overflow: hidden;
    animation: modal-enter 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    display: flex;
    flex-direction: column;
}

@keyframes modal-enter {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-close-icon {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.modal-close-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: rotate(90deg);
}

.login-brand {
    padding: 48px 40px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Center the logo */
}

.login-logo {
    height: 48px;
    width: auto;
    filter: drop-shadow(0 4px 15px rgba(0, 0, 0, 0.5));
}

.login-modal .modal-body {
    padding: 0 40px 48px;
    flex-grow: 1;
}

.login-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 0 8px;
    color: white;
}

.login-desc {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 32px;
}

.social-login-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.google-btn-v2 {
    background: white;
    color: #1f1f1f;
    border: none;
    height: 56px;
    border-radius: 16px;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.google-btn-v2:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.2);
    filter: brightness(1.05);
}

.wechat-btn-v2 {
    background: #07c160;
    color: white;
    border: none;
    height: 56px;
    border-radius: 16px;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.wechat-btn-v2:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(7, 193, 96, 0.3);
    background: #06ad56;
}

.login-footer {
    padding: 24px 40px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
    position: relative;
}

.login-footer .terms {
    margin: 0;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    line-height: 1.6;
}

.login-footer a {
    color: #f3c26a !important;
    /* Explicitly use var(--gold) value to bypass CSS variables issues */
    text-decoration: none !important;
    font-weight: 600;
    margin: 0 4px;
    transition: color 0.2s ease;
    border-bottom: 1px solid rgba(243, 194, 106, 0.2);
}

.login-footer a:hover {
    color: #ffffff !important;
    border-bottom-color: #ffffff;
}

/* Replay Filters Styling */
#replayFilters {
    background: rgba(255, 255, 255, 0.03);
    padding: 4px 12px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.filter-group {
    display: flex;
    gap: 4px;
}

.filter-tab {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 16px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-tab.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.filter-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.8);
}

.premium-select-sm {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='rgba(255,255,255,0.4)'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 14px;
    padding-right: 28px !important;
}

.room-stats {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
}

.stat-item.duration {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-item.duration i {
    font-size: 0.7rem;
    color: var(--cyan);
    opacity: 0.8;
}

.stat-item i {
    font-size: 0.8rem;
}

.room-action-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.4);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.9rem;
}

.room-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
}

.room-action-btn:active {
    transform: translateY(0);
}

.share-btn:hover {
    color: #10b981;
}

/* Emerald */
.like-btn:hover {
    color: var(--gold);
}

.dislike-btn:hover {
    color: #f43f5e;
}

/* Rose */
.save-btn:hover {
    color: #3b82f6;
}

/* Blue */

/* Share Modal & Grid */
.share-modal-compact {
    max-width: 360px;
    width: 90%;
    padding: 24px !important;
    border-radius: 28px !important;
}

/* Autoplay Overlay for Replay Player */
/* Unmute Indicator (YouTube Style) */
.unmute-indicator {
    position: absolute;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(243, 194, 106, 0.95);
    color: #000;
    padding: 10px 24px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    z-index: 5000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    animation: slideInDown 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.unmute-indicator:hover {
    transform: translateX(-50%) scale(1.05);
}

.unmute-indicator.fade-out {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-40px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.autoplay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: white;
    font-weight: 600;
}

.play-pulse-btn {
    width: 80px;
    height: 80px;
    background: var(--gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: black;
    box-shadow: 0 0 20px rgba(184, 134, 11, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(184, 134, 11, 0.7);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 15px rgba(184, 134, 11, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(184, 134, 11, 0);
    }
}

.share-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 20px 0 10px;
}

.social-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px 8px;
    border-radius: 16px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.social-btn i {
    font-size: 1.4rem;
    transition: transform 0.2s;
}

.social-btn img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    transition: transform 0.2s;
}

.social-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    color: white;
}

.social-btn:hover i {
    transform: scale(1.1);
}

/* Social Platform Colors */
.social-btn.wechat:hover {
    color: #07C160;
    border-color: #07C160;
}

.social-btn.whatsapp:hover {
    color: #25D366;
    border-color: #25D366;
}

.social-btn.discord:hover {
    color: #5865F2;
    border-color: #5865F2;
}

.social-btn.youtube:hover {
    color: #FF0000;
    border-color: #FF0000;
}

.social-btn.x-twitter:hover {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.4);
}

.social-btn.facebook:hover {
    color: #1877F2;
    border-color: #1877F2;
}

.social-btn.linkedin:hover {
    color: #0A66C2;
    border-color: #0A66C2;
}

.social-btn.reddit:hover {
    color: #FF4500;
    border-color: #FF4500;
}

.social-btn.pinterest:hover {
    color: #BD081C;
    border-color: #BD081C;
}

.social-btn.redbook:hover {
    color: #FF2442;
    border-color: #FF2442;
}

.social-btn.email:hover {
    color: #EA4335;
    border-color: #EA4335;
}

.social-btn.copy:hover {
    color: var(--gold);
    border-color: var(--gold);
}

/* Replay Player Interactions */
.player-interactions {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-top: 24px;
    padding-bottom: 20px;
}

.player-action-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 1.4rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.player-action-btn:hover {
    color: white;
    transform: scale(1.1);
}

.player-action-btn:active {
    transform: scale(0.95);
}

#playerShareBtn:hover {
    color: #10b981;
}

#playerLikeBtn:hover {
    color: var(--gold);
}

#playerDislikeBtn:hover {
    color: #f43f5e;
}

#playerSaveBtn:hover {
    color: #3b82f6;
}


.player-action-btn.active {
    opacity: 1;
}

/* Room More Menu */
.room-more-menu {
    position: fixed;
    /* Matches JS */
    background: rgba(25, 25, 30, 0.95);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 6px;
    z-index: 1000;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: max-content;
    animation: menu-slide-up 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes menu-slide-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.room-more-item {
    background: none;
    border: none;
    color: white;
    padding: 8px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
    width: 120px;
    text-align: left;
}

.room-more-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.room-more-item i {
    width: 16px;
    text-align: center;
    opacity: 0.7;
}

.room-action-btn.more-btn {
    opacity: 0.6;
}

.room-action-btn.more-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}