/* ... existing imports and root ... */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Modern Dark Palette */
    --primary: #6366f1;       /* Indigo 500 */
    --primary-hover: #4f46e5; /* Indigo 600 */
    --secondary: #a855f7;     /* Purple 500 */
    --accent: #ec4899;        /* Pink 500 */
    
    --bg-dark: #030712;       /* Gray 950 */
    --bg-gradient-start: #0f172a;
    --bg-gradient-end: #1e1b4b;

    --text-main: #f8fafc;     /* Slate 50 */
    --text-muted: #94a3b8;    /* Slate 400 */
    
    /* Glassmorphism Variables */
    --glass-bg: rgba(15, 23, 42, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.03);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.36);
    --backdrop-blur: 12px;

    --danger: #ef4444;
    --success: #22c55e;
    --gold: #eab308;
    
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;

    /* Backgrounds & Text */
    --bg-color: #ffffff;           /* Main background */
    --text-color: #334155;         /* Main text (dark gray, softer than pure black) */
    --text-muted: #64748b;         /* Secondary text (like your 'Code sent to...' message) */
    
    /* Borders & Inputs */
    --border-color: #cbd5e1;       /* The soft gray border for inputs */
    --input-bg: #f8fafc;           /* Very light gray for input backgrounds */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.15), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(236, 72, 153, 0.15), transparent 25%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    font-size: 15px;
    line-height: 1.5;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* --- Glass Panel Mixin --- */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--backdrop-blur));
    -webkit-backdrop-filter: blur(var(--backdrop-blur));
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: var(--radius-lg);
}

/* --- Buttons --- */
.btn {
    padding: 0.6rem 1.2rem;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    background: rgb(255, 131, 0);
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.start-btn, .submit-btn, .confirm-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.start-btn:hover, .submit-btn:hover, .confirm-btn:hover {
    background: linear-gradient(135deg, var(--primary-hover), var(--secondary));
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
}

/* --- Inputs --- */
input[type="text"], 
input[type="email"], 
input[type="password"], 
textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-main);
    font-size: 1rem;
    transition: all 0.2s ease;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* --- Auth & Header --- */
.auth-buttons {
    position: absolute;
    top: 1rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    z-index: 100;
}

.user-info {
    color: var(--text-muted);
    font-weight: 500;
}

/* --- Mobile Menu Logic --- */
.mobile-menu-container {
    position: relative;
    display: flex;
    align-items: center;
}

/* Default: Hamburger Hidden */
.hamburger-btn {
    display: none; /* Hidden on desktop */
    flex-direction: column;
    justify-content: space-around;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0.6rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    z-index: 101;
}

.hamburger-btn span {
    width: 100%;
    height: 2px;
    background-color: var(--text-main);
    border-radius: 2px;
    transition: all 0.3s linear;
    transform-origin: 1px;
}

.hamburger-btn.active span:nth-child(1) { transform: rotate(45deg); }
.hamburger-btn.active span:nth-child(2) { opacity: 0; transform: translateX(20px); }
.hamburger-btn.active span:nth-child(3) { transform: rotate(-45deg); }

/* Default: Menu Visible (Desktop) */
.mobile-menu {
    display: flex;
    gap: 1rem;
    position: static; /* Normal flow on desktop */
    background: transparent;
    padding: 0;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
}

/* --- Hero Section --- */
.hero {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeIn 0.8s ease-out;
}

.title {
    font-size: 5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
    background: linear-gradient(to right, #fff, #a5b4fc);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.participant-count {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    display: inline-flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    backdrop-filter: blur(4px);
}

.start-btn {
    padding: 1rem 3rem;
    font-size: 1.2rem;
    border-radius: var(--radius-full);
}

/* --- Main Question --- */
.question-container {
    max-width: 800px;
    width: 100%;
    margin-top: 2rem;
    padding: 2.5rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    box-shadow: var(--glass-shadow);
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.question-text {
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 2rem;
    line-height: 1.4;
}

.answers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.answer-btn {
    text-align: left;
    padding: 1.2rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.answer-btn:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--primary);
}

.answer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 2;
    position: relative;
}

/* Hide results by default */
.vote-count, .percentage-display {
    display: none;
    margin-left: 1rem;
    font-size: 0.9em;
    color: var(--text-muted);
}

/* Show results when container has .show-results class */
.show-results .vote-count, 
.show-results .percentage-display {
    display: inline-block;
}

.vote-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    width: 100%;
    background: rgba(0,0,0,0.2);
}

.vote-bar {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 1s cubic-bezier(0.22, 1, 0.36, 1);
}

.selected-answer {
    border-color: var(--accent);
    background: rgba(236, 72, 153, 0.1);
    box-shadow: 0 0 0 1px var(--accent);
}

.checkmark {
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s;
}
.selected-answer .checkmark {
    opacity: 1;
    transform: scale(1);
}

.continue-btn {
    margin-top: 2rem;
    width: 100%;
    justify-content: center;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--success), var(--primary));
    border: none;
    border-radius: var(--radius-full);
    color: white;
    cursor: pointer;
    display: flex;
    animation: fadeIn 0.5s ease;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
}
.continue-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
}

/* --- Chat Interface --- */
#chatroomContainer {
    width: 100%;
    max-width: 1000px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--glass-shadow);
    animation: fadeIn 0.5s ease;
    max-height: 85vh; /* Keep for desktop */
}

#chatroomHeader {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#chatroomHeader-Ad-1,
#chatroomHeader-Ad-2 {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatroom-header-info {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 1rem;
}
.chatroom-header-info span { color: var(--text-main); }

#chatView {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Crucial for flex scrolling */
    position: relative;
}

#chatMessages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

/* Chat Bubbles */
.message-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 70%;
    animation: messagePop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.message-wrapper.user {
    align-self: flex-end;
    align-items: flex-end;
}

.message-wrapper.other-user {
    align-self: flex-start;
    align-items: flex-start;
}

.message-content-container {
    display: flex;
    flex-direction: column;
    position: relative;
}

.message {
    padding: 0.8rem 1.2rem;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    gap: 0.8rem;
}

.message-bubble-content {
    display: flex;
    flex-direction: column;
}

/* My Messages */
.message-wrapper.user .message {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    background: linear-gradient(135deg, #000, #2f2736);
    background: rgba(255, 255, 255, 0.08);
    color: white;
    border-bottom-right-radius: 4px;
}

/* Others Messages */
.message-wrapper.other-user .message {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
}

/* System Messages */
.message-wrapper.system {
    align-self: center;
    max-width: 90%;
    opacity: 0.8;
}
.message-wrapper.system .message {
    background: transparent;
    box-shadow: none;
    font-style: italic;
    color: var(--text-muted);
    border: 1px dashed var(--glass-border);
    padding: 0.4rem 1rem;
}

.message-sender {
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
    opacity: 0.9;
}

.message-wrapper.other-user .message-sender a {
    color: var(--accent);
    text-decoration: none;
}
.message-wrapper.other-user .message-sender a:hover {
    text-decoration: underline;
}

/* --- FIX: Link Styling in Messages --- */
.message-text a {
    color: var(--accent); /* Use accent color for visibility */
    text-decoration: underline;
    text-underline-offset: 2px; /* Better readability */
    font-weight: 500;
    transition: color 0.2s, text-decoration-color 0.2s;
}

.message-text a:hover {
    color: var(--primary); /* Shift to primary on hover */
    text-decoration-color: var(--primary);
    cursor: pointer;
}

/* Ensure links in own messages (which have dark backgrounds) are readable */
.message-wrapper.user .message-text a {
    color: #fff;
    text-decoration-color: rgba(255,255,255,0.6);
}

.message-wrapper.user .message-text a:hover {
    color: rgba(255,255,255,0.9);
    text-decoration-color: #fff;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.1);
}

/* Chat Input Area */
#chatInputContainer {
    padding: 1.2rem;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--glass-border);
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

#chatInput {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-full);
    padding: 0.8rem 1.5rem;
    border: 1px solid transparent;
    color: white;
}
#chatInput:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
    box-shadow: none;
}

#sendChatBtn {
    border-radius: var(--radius-full);
    padding: 0.8rem 1.5rem;
}

/* --- Reply Bar --- */
#replyingToContainer {
    background: rgba(15, 23, 42, 0.9);
    border-top: 1px solid var(--glass-border);
    padding: 0.8rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    border-left: 3px solid var(--accent);
}

.reply-quote {
    background: rgba(0,0,0,0.2);
    border-left: 3px solid var(--text-muted);
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    border-radius: 0 8px 8px 0;
    color: var(--text-muted);
}

/* --- Message Actions (Hover) --- */
.message-actions {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 5px;
    
    /* Interaction Logic: */
    /* Default: Invisible to eyes and mouse */
    opacity: 0;
    visibility: hidden;
    
    /* Transition:
       - Opacity: Fades in/out smoothly (0.2s)
       - Visibility: Delays switching to 'hidden' by 0.3s. 
         This allows the element to remain interactive (clickable) 
         while it fades out, preventing it from disappearing mid-hover.
    */
    transition: opacity 0.2s ease-in-out, visibility 0s linear 0.3s;
    
    z-index: 100; /* Ensure above message bubble */
}

/* Show Actions */
.message-wrapper:hover .message-actions,
.message-actions:hover {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s; /* Show immediately, no delay */
}

/* Invisible Bridge: Fills gap between message and buttons so hover isn't lost */
.message-actions::after {
    content: '';
    position: absolute;
    top: -20px;
    bottom: -20px;
    width: 40px; /* Wide enough to span the gap */
    z-index: -1;
}

/* Position: Own Messages (Buttons on Left) */
.message-wrapper.user .message-actions { 
    right: 100%; 
    margin-right: 10px; 
}
.message-wrapper.user .message-actions::after {
    left: 100%; /* Extend bridge to the right towards message */
}

/* Position: Other Messages (Buttons on Right) */
.message-wrapper.other-user .message-actions { 
    left: 100%; 
    margin-left: 10px; 
}
.message-wrapper.other-user .message-actions::after {
    right: 100%; /* Extend bridge to the left towards message */
}

/* Action Buttons */
.message-action-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;  /* Enforce circle shape */
    min-height: 32px; /* Enforce circle shape */
    border-radius: 50%;
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;      /* Remove padding that causes skewing */
    flex-shrink: 0;  /* Prevent squeezing in flex containers */
    line-height: 1;
}

.message-action-btn:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
    border-color: var(--primary);
}

/* --- NEW: Reaction Picker (Hidden by default) --- */
.reaction-picker {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 5px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    padding: 0.3rem 0.5rem;
    display: flex;
    gap: 0.25rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(5px);
    transition: all 0.2s ease;
    z-index: 10;
}

/* Show on hover */
.message-content-container:hover .reaction-picker {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Style the emoji buttons inside picker */
.reaction-picker button {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.1s;
    padding: 0.2rem;
    border-radius: 50%;
}
.reaction-picker button:hover {
    transform: scale(1.3);
    background: rgba(255,255,255,0.1);
}

.reaction-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.8rem;
    margin-top: 4px;
    cursor: pointer;
}
.reaction-chip.user-reacted {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary);
}

/* --- Toast Notifications --- */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    padding: 0.8rem 2rem;
    border-radius: var(--radius-full);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    z-index: 2000;
    font-weight: 500;
    translate: 0 20px; /* Slide up effect */
}

.toast.show {
    opacity: 1;
    translate: 0 0;
}

.toast.level-up {
    background: linear-gradient(135deg, var(--gold), var(--primary));
    box-shadow: 0 10px 30px rgba(234, 179, 8, 0.4);
}


/* --- Modals --- */
.confirmation-modal, 
#emailLoginModal, 
#accountModal, 
#profileModal, 
#inboxModal, 
#adminPollModal, 
#summariesModal,
#dmModal,
#adminMessageModal {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    color: var(--text-main);
    padding: 20px; /* Reset padding for flex layout */
    overflow: hidden;
    
    /* CRITICAL FIX: Ensure modals are hidden by default but properly positioned */
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2000; /* Ensure they are above everything */
}

/* SHOW Modals when active */
.confirmation-modal.active, 
#emailLoginModal.active, 
#accountModal.active, 
#profileModal.active, 
#inboxModal.active, 
#adminPollModal.active, 
#summariesModal.active,
#dmModal.active,
#adminMessageModal.active {
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#accountModal, #profileModal, #inboxModal {
    width: 800px;
    max-width: 95vw;
    max-height: 85vh;
}

.modal-tabs {
    display: flex;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(0,0,0,0.2);
}

.modal-tab-btn {
    flex: 1;
    padding: 1rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.modal-tab-btn:hover {
    color: var(--text-main);
    background: rgba(255,255,255,0.02);
}

.modal-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

/* --- CRITICAL FIX: Display content correctly --- */
.modal-tab-content {
    display: none; /* Hidden by default */
}

.modal-tab-content.active {
    display: block; /* Shown when active */
}

.modal-scrollable-content {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

.modal-buttons {
    padding: 1rem 2rem;
    border-top: 1px solid var(--glass-border);
    background: rgba(0,0,0,0.2);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* --- Lists (Inbox, Social, Leaderboard) --- */
.inbox-item, .social-list-item, .leaderboard-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.2s;
}

/* --- FIX: Add style for read inbox items --- */
.inbox-item.read {
    opacity: 0.6;
    background: rgba(255, 255, 255, 0.01);
}

.inbox-item:hover, .social-list-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255,255,255,0.1);
}

/* --- Badges --- */
.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
}
.badge {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
    position: relative;
    cursor: help;
    transition: transform 0.2s;
}
.badge:hover {
    transform: translateY(-3px);
    border-color: var(--secondary);
}
.badge-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.badge-name { font-size: 0.8rem; font-weight: 600; }

/* --- Tree Visualization --- */
#treePageContainer {
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: var(--bg-dark);
    z-index: 500;
    display: none; /* Controlled by JS */
    flex-direction: column;
}
#tree-content-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.tree-explorer-header {
    padding: 1rem 2rem;
    background: var(--glass-bg);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    gap: 1rem;
    align-items: center;
}
.tree-explorer-body {
    flex: 1;
    position: relative;
    display: flex;
}
/*
#tree-container {
    flex: 1;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
}
#tree-info-panel {
    width: 450px;
    background: var(--glass-bg);
    border-left: 1px solid var(--glass-border);
    padding: 1.5rem;
    backdrop-filter: blur(20px);
    overflow-y: auto;
}
*/

#tree-container {
    flex: 1;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    position: relative;
    min-width: 0; /* Allow shrinking in flex container */
    min-height: 0; /* Allow shrinking in flex container */
}

#tree-info-panel {
    width: 450px;
    background: var(--glass-bg);
    border-left: 1px solid var(--glass-border);
    padding: 1.5rem;
    backdrop-filter: blur(20px);
    overflow-y: auto;
    /* Ensure it fills height on desktop but doesn't overflow parent */
    height: 100%; 
    flex-shrink: 0;
}

/* --- NEW: Tree Status Styles --- */
.tree-status-group {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-left: 1rem;
    margin-right: auto;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.tree-status-text {
    font-size: 0.85rem;
    opacity: 0.8;
}

.icon-btn {
    padding: 0.4rem;
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
    line-height: 1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.refreshing {
    animation: spin 1s linear infinite;
    pointer-events: none;
    opacity: 0.7;
}

@keyframes spin { 
    100% { transform: rotate(360deg); } 
}

/* --- NEW: Tree Visualization Enhancements --- */

/* 1. Improved Link Styling */
.tree-link {
    stroke: rgba(255, 255, 255, 0.15); /* Slightly brighter for better visibility */
    stroke-width: 1.5px;
    transition: stroke 0.3s, stroke-width 0.3s;
    pointer-events: none; /* Let clicks pass through to background/nodes */
}
.tree-link.active-path {
    stroke: var(--accent);
    stroke-width: 2.5px;
    stroke-opacity: 0.8;
    filter: drop-shadow(0 0 3px var(--accent));
    z-index: 10; /* Keep above other links */
}

/* 2. Improved Node Groups */
.tree-node-group {
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); /* Smooth pop effect */
}

/* 3. Node Circle Styling */
.tree-node-group circle {
    stroke: rgba(255, 255, 255, 0.5);
    stroke-width: 1.5px;
    transition: all 0.3s ease;
    transform-box: fill-box;
    transform-origin: center;
}

/* Hover Effect: Pop, glow, brighten */
.tree-node-group:hover circle {
    transform: scale(1.2);
    stroke: #fff;
    stroke-width: 2px;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.6));
    fill-opacity: 1;
}

/* Selected Node Styling */
.tree-node-group circle.selected-node {
    stroke: var(--accent);
    stroke-width: 3px;
    filter: drop-shadow(0 0 15px var(--accent));
    fill: var(--primary) !important; /* Override D3 fill if needed for emphasis */
    transform: scale(1.25);
}

/* 4. Text Styling */
.tree-node-group text {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    fill: #e2e8f0 !important; /* Ensure readable light text */
    text-shadow: 
        -1px -1px 0 rgba(0,0,0,0.8),  
         1px -1px 0 rgba(0,0,0,0.8),
        -1px  1px 0 rgba(0,0,0,0.8),
         1px  1px 0 rgba(0,0,0,0.8), /* Strong dark outline for contrast */
         0 2px 4px rgba(0,0,0,0.5);
    pointer-events: none;
    transition: font-weight 0.2s, fill 0.2s;
}

.tree-node-group:hover text {
    font-weight: 700;
    fill: #fff !important;
}

/* 5. Search Highlighting */
.tree-node-group.search-match circle {
    stroke: var(--success);
    stroke-width: 3px;
    animation: pulseSearch 1.5s infinite;
}
.tree-node-group.search-no-match {
    opacity: 0.15;
}

@keyframes pulseSearch {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* --- Glows --- */
.glow {
    position: fixed;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--primary), transparent 70%);
    filter: blur(80px);
    opacity: 0.15;
    pointer-events: none;
    z-index: -1;
}

/* --- Direct Messages Styling --- */
.dm-message {
    padding: 0.8rem 1.2rem;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    max-width: 75%;
    word-wrap: break-word;
    margin-bottom: 0.5rem;
    animation: messagePop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dm-message.sent {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.dm-message.received {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
}

/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes messagePop {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* --- Desktop Layout (Side-by-Side) --- */
.responsive-summaries-container {
    flex: 1; 
    display: flex; 
    flex-direction: row; /* Side-by-side */
    overflow: hidden;
    min-height: 400px; /* Ensures the modal doesn't collapse */
}

.summaries-sidebar {
    width: 250px; 
    flex-shrink: 0; /* Prevents the sidebar from squishing */
    border-right: 1px solid var(--glass-border); 
    list-style: none; 
    padding: 0; 
    margin: 0;
    overflow-y: auto; 
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
}

.summary-main-view {
    flex: 1; 
    padding: 2rem; 
    overflow-y: auto;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    /* NEW: Force the modal wrapper to take up the full screen width */
    #summariesModal {
        width: 100%;
        max-width: 100%;
        
        /* Optional: If you want it to feel like a native full-screen mobile app 
           rather than a floating box, you can uncomment these lines: */
        height: 100vh;
        border-radius: 0;
        border: none;
    }

    .responsive-summaries-container {
        flex-direction: column; /* Stacks them vertically! */
    }

    .summaries-sidebar {
        width: 100%; /* Take up full width */
        max-height: 150px; /* Crucial: Prevents the list from pushing the text off-screen */
        border-right: none; /* Remove vertical line */
        border-bottom: 1px solid var(--glass-border); /* Add horizontal line */
        display: flex;
        flex-direction: column;
    }

    .summary-main-view {
        padding: 1rem; /* Slightly less padding on small screens */
    }

    /* Prevent the whole page from scrolling */
    html, body {
        height: 100%;
        overflow: hidden;
        position: fixed; /* Prevents "rubber-banding" on iOS */
        width: 100%;
    }

    .title { font-size: 3rem; }
    /* 3. Fix the Chatroom Header */
    #chatroomContainer {
        flex: 1; /* Take all available space */
        height: auto; 
        display: flex;
        flex-direction: column;
        border-radius: 0;
        border: none;
        overflow: hidden; /* Encapsulate the sub-views */
    }
    /* 4. Keep Chat Input at the very bottom */
    #chatView {
        flex: 1;
        display: flex;
        flex-direction: column;
        height: 100%;
        min-height: 0; /* Essential for nested flex scrolling */
    }

    /* This is the ONLY part that should scroll */
    #chatMessages {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Pinned to the very bottom */
    #chatInputContainer {
        flex-shrink: 0;
        background: var(--bg-dark);
        border-top: 1px solid var(--glass-border);
        /* Use safe-area-inset to stay above the home indicator on new phones */
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
        width: 100%;
        position: relative; /* No longer needs 'absolute' or 'sticky' if parent is flex */
    }
    /* Reset the container so it doesn't try to center the chatroom */
    .container {
        height: 100%;
        max-height: 100vh;
        display: flex;
        flex-direction: column;
        padding: 0;
        justify-content: flex-start;
        align-items: stretch;
    }
    #accountModal, #profileModal, #inboxModal { width: 100%; height: 100%; border-radius: 0; }
    .message-wrapper { max-width: 85%; }
    /* Move Auth Buttons into the layout flow so they don't overlap */
    .auth-buttons {
        position: relative;
        top: 0;
        width: 100%;
        background: var(--bg-dark);
        border-bottom: 1px solid var(--glass-border);
        padding: 0.5rem 1rem;
        flex-shrink: 0; /* Ensures this bar never disappears */
        z-index: 1001;
    }
    #tree-info-panel { position: absolute; bottom: 0; left: 0; width: 100%; height: 40%; border-top: 1px solid var(--glass-border); border-left: none; }

    /* --- Tree Explorer Mobile Fixes --- */
    .tree-explorer-header {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.8rem;
    }
    .tree-explorer-header h2 {
        font-size: 1rem;
        margin-right: auto;
    }
    .tree-status-group {
        display: none; /* Hide 'Just now' text on very small screens to save space */
    }
    #tree-search-input {
        width: 100%;
        margin-top: 0.5rem;
        order: 5; /* Push search to new line */
    }
    
    .tree-explorer-body {
        flex-direction: column; /* Stack map on top of info panel */
    }

    #tree-container {
        flex: 1 1 auto; /* Map takes all available remaining space */
        width: 100%;
        min-height: 0;
        position: relative;
        order: 1; /* Ensure Map is visual first */
    }

    #tree-info-panel {
        width: 100%;
        height: auto;
        flex: 0 0 70%; /* Fixed height at bottom */
        position: relative; 
        border-left: none;
        border-top: 1px solid var(--glass-border);
        padding: 1rem;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
        z-index: 10;
        border-radius: 20px 20px 0 0;
        background: rgba(15, 23, 42, 0.98);
        order: 2; /* Panel below map */
    }
    
    .hamburger-btn {
        display: flex; /* Show hamburger on mobile */
    }
    
    .mobile-menu {
        display: none; /* Hide menu by default on mobile */
        position: absolute;
        top: 100%;
        right: 0;
        background: rgba(15, 23, 42, 0.95);
        border: 1px solid var(--glass-border);
        padding: 1rem;
        flex-direction: column; /* Stack items vertically */
        width: 200px; /* Optional: fix width or let it content-size */
        align-items: stretch; /* Stretch buttons to full width */
        border-radius: var(--radius-md);
    }
    .mobile-menu.active {
        display: flex;
    }
    
    .mobile-menu .btn {
        justify-content: flex-start; /* Align button text to left */
    }

    /* Hide Room Name, Status and adjacent separators on mobile */
    #roomIdDisplay,
    #roomIdDisplay + span,
    #roomStatusText,
    #roomStatusText + span {
        display: none;
    }

    /* Force hide simulate join button on mobile */
    #simulateJoinBtn {
        display: none !important;
    }

    /* ADDED: Spacing for mobile header elements to avoid overlap and align vertically */
    .participant-count {
        margin-top: 4rem;
    }

    #chatroomHeader {
        flex-shrink: 0; /* Stay at the top */
        margin-top: 0 !important; /* Remove old spacing fixes */
        padding: 0.8rem 1rem;
    }

    #chatroomHeader-Ad-1, 
    #chatroomHeader-Ad-2 {
        flex-shrink: 0; /* Stay at the top */
        margin-top: 0 !important; /* Remove old spacing fixes */
        padding: 0.8rem 1rem;
    }

    .chatroom-header-info {
        font-size: 0.85rem;
        flex-wrap: wrap; /* Let info wrap if the Room ID is long */
    }
    
    /* Make the View Chat / Summaries buttons take full width if needed */
    #chatroomHeader > div:last-child {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    /* Align Chatroom User Count and Summaries Button */
    .chatroom-header-info,
    #summariesBtn,
    #toggleChatInquiryBtn {
        margin-top: 0 !important; /* Remove that 4rem gap that pushes content down */
    }

    /* --- NEW: Shorten Tree Header Text on Mobile --- */
    .tree-explorer-header h2 {
        font-size: 0 !important; /* Hide 'Discussion Map' */
        margin-right: auto;
        display: flex;
        align-items: center;
    }
    .tree-explorer-header h2::after {
        content: 'Map'; /* Replace with 'Map' */
        font-size: 1rem;
    }
}

/* --- FIX: Add styles for inbox indicator --- */
#inboxBtn {
    position: relative;
}

#inbox-indicator {
    display: none; /* Toggled by JS */
    position: absolute;
    top: 5px;
    right: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--danger);
    box-shadow: 0 0 5px var(--danger);
    z-index: 10;
}

/* --- NEW: Inquiry View Styles --- */
.suggested-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.suggested-item:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.suggested-item.user-suggestion {
    border-color: var(--primary);
    background: linear-gradient(to bottom right, rgba(99, 102, 241, 0.05), rgba(255, 255, 255, 0.02));
}

.suggestion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.own-tag {
    background: var(--primary);
    color: white;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
}

.suggestion-question {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-main);
    line-height: 1.4;
}

.suggested-answers {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.suggested-answers li {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.suggestion-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
}

.vote-count-badge {
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.vote-suggestion-btn {
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
}

.vote-suggestion-btn.voted {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.pop-pref-vote-btn.selected-pop-vote {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
}

/* Energy Bar Layout */
.energy-bar-container {
    display: flex;
    gap: 6px;
    margin-bottom: 8px; /* Spacing above your chat input */
    padding-left: 4px;
}

/* Individual Dots */
.energy-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--border-color, #cbd5e1); /* Empty state (gray) */
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Filled State */
.energy-dot.active {
    background-color: var(--primary-color, #3b82f6); /* Full state (blue) */
    box-shadow: 0 0 5px rgba(59, 130, 246, 0.5); /* Subtle glow */
}

/* Enhanced Summary Links */
/* Container for the pills */
#summaries-list {
    /*display: flex;
    flex-wrap: wrap;
    gap: 8px;*/
    list-style: none;
    padding: 10px 0;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--glass-border);
    
    /* CRITICAL: Prevents vertical and horizontal stretching on desktop */
    /* align-items: flex-start;
    justify-content: flex-start; */
}

/* Slimmer, subtle pills */
.summary-link {
    /* Ensures the pill only expands to fit the text */
    display: inline-flex; 
    width: auto; 
    
    padding: 6px 12px;
    line-height: 1.2;
    border-radius: 16px;
    margin-bottom: 3px;
    margin-left: 8px;
    
    /* Subtle Gray Theme */
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #94a3b8; /* Light gray text */
    
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    white-space: nowrap;
}

.summary-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
    border-color: rgba(255, 255, 255, 0.3);
}

/* Active state logic */
.summary-link.active-summary {
    background: var(--primary); /* Using your primary purple/blue */
    color: #ffffff;
    border-color: var(--primary);
    font-weight: 500;
}

.site-footer {
    /*margin-top: 2rem;
    padding: 1rem;*/
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 0.8rem;
    border-top: 1px solid var(--glass-border);
    margin-top: -20px;
    position: relative;
}

.site-footer a {
    color: var(--text-muted);
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--primary);
}

@media (max-width: 767px) {
    .site-footer {
        /* Makes it invisible and takes up no space, but still in the HTML code for bots */
        opacity: 0;
        visibility: hidden;
        height: 0;
        margin: 0;
        padding: 0;
        /*pointer-events: none;*/
        margin-top: -20px;
    }
}

@media (max-width: 767px) {
    /*
    .site-footer {
        display: none;
    }
    */

    /* Only show when this specific class is present */
    .site-footer.show-mobile-footer {
        display: flex; 
        opacity: 1;
        visibility: visible;
        height: auto;
        padding: 1rem;
        position: absolute;
        top: 0px;
        margin-left: 14px;
        margin-top: 99%;
    }

    .site-footer.show-mobile-footer a {
        background-color: #030712;
    }

    .hero {
        margin-top: 276px;
    }
}

@media (max-width: 520px) {
    .hero {
        margin-top: 20px;
    }

    .site-footer.show-mobile-footer {
        margin-top: 140%;
    }

    .question-text {
        font-size: 1.0rem;
        margin-bottom: 0.5rem;
    }
}

/* Desktop: Standard Leaderboard */
#chatroomHeader-Ad-1 {
    width: 728px;
    height: 90px;
    margin: 0 auto;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.02); /* Subtle placeholder background */
}

/* Mobile: Mobile Leaderboard */
@media (max-width: 767px) {
    #chatroomHeader-Ad-1 {
        width: 320px; 
        height: 50px;
    }
}

/* --- Beta Testing Banner --- */
.beta-banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(90deg, #1a1a1a 0%, #2c2c2c 100%); /* Subtle dark gradient */
    border-bottom: 2px solid #ffcc00; /* Yellow/Gold safety strip */
    color: #f0f0f0;
    z-index: 2000; /* 1000 Must be below the GDPR popup (2000+) but above all game containers */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    display: block; /* Shown by default */
}

.beta-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 40px 10px 20px; /* Padding for the icon and close button */
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.9rem;
    line-height: 1.4;
    position: relative;
}

.beta-icon {
    font-size: 1.5rem;
}

.beta-content p {
    margin: 0;
}

.beta-content strong {
    color: #ffcc00; /* Highlight important text */
}

.beta-close-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.beta-close-btn:hover {
    color: white;
}

/* Add padding to the top of your main containers so the banner doesn't cover them */
body {
    padding-top: 60px; /* Adjust based on banner height */
}

@media (max-width: 767px) {
    .beta-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
        padding-right: 35px; /* Less padding, keep close button space */
    }
    .beta-icon {
        display: none; /* Hide icon on mobile for more text space */
    }
    body {
        padding-top: 80px; /* Banner takes more lines on mobile */
    }
    .site-footer {
        margin-top: -35px;
    }
}

/* styles.css */
.user-avatar {
    border-radius: 50%; /* Make it round */
    display: inline-block;
    vertical-align: middle;
    /* Optional: A subtle glow helps bright hues pop on dark chat backgrounds */
    filter: hue-rotate(var(--dynamic-hue)) drop-shadow(0 2px 4px rgba(255, 255, 255, 0.2));
    /* Ensure recoloring is buttery smooth */
    transition: filter 0.3s ease;
    /* New size positioning test */
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensures the image fills the box without stretching weirdly */
    display: block;    /* Removes annoying bottom spacing on images */
}

/*
@media (max-width: 640px) {
    .desktop-only {
        display: none !important;
    }
}
*/

.avatarContainer {
    width: 52px;
    height: 52px;
    display: flex;
}

#reputation-avatar,
#profile-avatar {
    width: 76px;
    height: 76px;
    display: flex;
}

/* --- Money Pit Full Screen Modal --- */
.full-screen-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(3, 7, 18, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 2000;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Allows scrolling if content is tall */
    padding: 3rem 1rem;
    box-sizing: border-box;
}

.money-pit-content {
    max-width: 1200px;
    width: 100%;
    position: relative;
    text-align: center;
    animation: fadeInScale 0.3s ease-out;
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

.close-full-btn {
    position: absolute;
    top: -2rem;
    right: 0;
    background: transparent;
    border: none;
    color: var(--text-muted, #9ca3af);
    font-size: 2.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close-full-btn:hover {
    color: var(--danger, #f43f5e);
}

.money-pit-title {
    font-size: 3rem;
    color: var(--gold, #fbbf24);
    margin-bottom: 0.5rem;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.3);
}

.money-pit-subtitle {
    color: var(--text-muted, #9ca3af);
    font-size: 1.1rem;
    margin-bottom: 3rem;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
    padding-bottom: 2rem;
}

.pricing-card {
    background: var(--glass-bg, rgba(255, 255, 255, 0.05));
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
    border-radius: 16px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    text-align: left;
    transition: transform 0.3s, box-shadow 0.3s;
}

.pricing-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.pricing-card.premium {
    border-color: var(--primary, #3b82f6);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.1);
}

.pricing-card.pro {
    border-color: var(--gold, #fbbf24);
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.1);
    position: relative;
    overflow: hidden;
}

.pricing-card.pro::before {
    content: "BEST VALUE";
    position: absolute;
    top: 15px;
    right: -30px;
    background: var(--gold, #fbbf24);
    color: #000;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 5px 30px;
    transform: rotate(45deg);
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.pricing-card h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    color: var(--text-main, #f8fafc);
}

.pricing-card .price {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: var(--text-main, #f8fafc);
}

.pricing-card .price-period {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted, #9ca3af);
}

.perks-list {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem 0;
    flex-grow: 1;
}

.perks-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-muted, #e2e8f0);
    font-size: 0.95rem;
    position: relative;
    padding-left: 1.5rem;
}

.perks-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success, #10b981);
    font-weight: bold;
}

.perks-list li:last-child {
    border-bottom: none;
}

.pricing-card .btn {
    width: 100%;
    margin-top: auto; /* Pushes button to bottom */
}

/* --- Theme Selector Grid --- */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.5rem;
}

.theme-option {
    padding: 0.5rem;
    border-radius: 8px;
    text-align: center;
    font-size: 0.8rem;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s, border-color 0.2s;
    background: var(--glass-bg, rgba(255,255,255,0.05));
    color: var(--text-main, #fff);
}

.theme-option:hover {
    transform: scale(1.05);
}

.theme-option.active {
    border-color: var(--gold, #fbbf24);
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.3);
}

/* --- Premium Chat Bubble Themes (Bulletproof Specificity) --- */

/* CYBERPUNK THEME */
.message-wrapper .message.theme-cyberpunk {
    background: #0f172a !important; 
    border: 1px solid #ec4899 !important;
    box-shadow: inset 0 0 10px rgba(236, 72, 153, 0.1) !important;
}
.message-wrapper .message.theme-cyberpunk .message-text,
.message-wrapper .message.theme-cyberpunk .message-sender,
.message-wrapper .message.theme-cyberpunk .message-sender a {
    color: #22d3ee !important;
}

/* SUNSET THEME */
.message-wrapper .message.theme-sunset {
    background: linear-gradient(135deg, #4c0519, #7c2d12) !important;
    border: 1px solid #f59e0b !important;
}
.message-wrapper .message.theme-sunset .message-text,
.message-wrapper .message.theme-sunset .message-sender,
.message-wrapper .message.theme-sunset .message-sender a {
    color: #fef3c7 !important;
}

/* MATRIX THEME */
.message-wrapper .message.theme-matrix {
    background: #052e16 !important;
    border: 1px solid #22c55e !important;
}
.message-wrapper .message.theme-matrix .message-text,
.message-wrapper .message.theme-matrix .message-sender,
.message-wrapper .message.theme-matrix .message-sender a {
    color: #4ade80 !important;
    font-family: 'Courier New', Courier, monospace !important; 
}

/* OCEAN THEME */
.message-wrapper .message.theme-ocean {
    background: #082f49 !important;
    border: 1px solid #38bdf8 !important;
}
.message-wrapper .message.theme-ocean .message-text,
.message-wrapper .message.theme-ocean .message-sender,
.message-wrapper .message.theme-ocean .message-sender a {
    color: #bae6fd !important;
}

/* Mobile: Mobile redmi 9c 360 */
@media (max-width: 480px) {
    .site-footer {
        margin-top: -20px;
        position: relative;
        /*border: 1px solid red;*/
    }

    .site-footer.show-mobile-footer {
        margin-top: 45%;
    }
}

/* Hide the explore map button on standard mobile screens */
@media (max-width: 768px) {
    #exploreDiscussionBtn {
        display: none !important;
    }
}

@media (max-width: 1439px) {
    #exploreDiscussionBtn {
        display: none !important;
    }
}

/* --- Mobile Overrides for Discussion Highlight Modal --- */
@media (max-width: 768px) {
    /* 1. Shrink Fonts */
    #fullSummaryModal h2 { font-size: 0.9rem !important; }
    #modalContextArea > div > div:first-child { font-size: 0.65rem !important; }
    #modalQuestionText { font-size: 0.9rem !important; line-height: 1.4 !important; }
    #modalAnswerText { font-size: 0.85rem !important; line-height: 1.4 !important; }
    #fullSummaryModal .modal-scrollable-content > div:nth-child(2) { font-size: 0.65rem !important; }
    
    #fullSummaryText, 
    #fullSummaryText div {
        font-size: 0.8rem !important;
        line-height: 1.4 !important;
    }

    #fullSummaryText button {
        font-size: 0.75rem !important;
        min-width: 32px !important;
        min-height: 28px !important;
        padding: 0 8px !important;
    }

    /* 2. TIGHTEN PADDING & MARGINS */
    
    /* Header and Footer Padding */
    #fullSummaryModal > div > div:first-child, /* Header */
    #fullSummaryModal > div > div:last-child { /* Footer */
        padding: 0.6rem 1rem !important; 
    }

    /* Main Inner Body Padding */
    #fullSummaryModal > div > div:nth-child(2) {
        padding: 1rem !important; 
    }

    /* Context Area (Topic/Answer spacing) */
    #modalContextArea {
        gap: 0.5rem !important; /* Bring question and answer closer */
        margin-bottom: 1rem !important;
        padding-bottom: 1rem !important;
    }

    /* Pagination Buttons Gap */
    #fullSummaryText > div:first-child {
        gap: 4px !important; /* Bring the 1, 2, 3 buttons closer together */
        padding-bottom: 8px !important; 
    }
}

/* --- Highlights Explorer Cards --- */
.explorer-card {
    background: var(--glass-bg, rgba(255, 255, 255, 0.05));
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    text-align: left;
    /* Notice: No hover transform or box-shadow here! */
}

/* --- Explorer Card "Read Full" Link --- */
.read-full-link {
    color: var(--secondary, #a855f7);
    font-weight: 600;
    display: inline-block;
    transition: color 0.2s ease, transform 0.2s ease;
    cursor: pointer; /* Makes it feel like a button */
}

/* The hover effect ONLY triggers when your mouse is actually over the link */
.read-full-link:hover {
    color: rgb(255, 131, 0); 
    transform: translateX(4px);     
}