:root {
    --bg-main: #0a0b0e;
    --bg-card: #14161d;
    --bg-card-hover: #1a1d26;
    --bg-input: #101218;
    --border-color: #222632;
    --border-focus: #5865f2;
    --text-primary: #f1f3f9;
    --text-secondary: #8c96a8;
    --text-muted: #5a6475;
    --accent-blue: #5865f2;
    --accent-blue-hover: #4752c4;
    --accent-badge: #1e2438;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] {
    --bg-main: #f4f6fa;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-input: #eef2f7;
    --border-color: #dbe1e8;
    --border-focus: #5865f2;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --accent-badge: #eef2ff;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button, input {
    font-family: inherit;
    font-size: inherit;
}

img, svg {
    max-width: 100%;
}

body, 
.message-card, 
.search-input-group, 
.btn-primary, 
.btn-secondary, 
.stat-card, 
.user-result-card, 
.modal-card, 
.mini-stat, 
.plan-card, 
.filter-item, 
.brand-logo {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease, filter 0.2s ease;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.top-nav {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    padding: 20px 32px;
    width: 100%;
}

.top-nav-actions,
.nav-links {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: auto;
}

.auth-container {
    margin-left: auto;
}

.theme-toggle-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.theme-toggle-btn:hover {
    border-color: var(--accent-blue);
    transform: scale(1.05);
}

[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }
[data-theme="light"] .sun-icon { display: none; }
[data-theme="light"] .moon-icon { display: block; }

.main-container {
    max-width: 860px;
    width: 100%;
    margin: 10px auto 60px auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.brand-hero {
    text-align: center;
    margin-bottom: 24px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.brand-logo {
    max-width: 160px;
    width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    display: block;
}

[data-theme="light"] .brand-logo {
    filter: invert(1);
    mix-blend-mode: multiply;
}

.about-hero-text {
    text-align: center;
    margin-bottom: 36px;
    max-width: 640px;
}

.about-title {
    font-size: 32px;
    font-weight: 800;
    margin: 12px 0 8px 0;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.about-lead {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.about-features-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 12px 0 20px 0;
    text-align: center;
    width: 100%;
}

.about-section-grid,
.plans-grid,
.faq-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    width: 100%;
    margin-bottom: 36px;
    align-items: stretch;
}

.search-box-wrapper {
    width: 100%;
    position: relative;
    margin-bottom: 24px;
}

.search-input-group {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 8px 8px 8px 18px;
    box-shadow: var(--shadow);
}

.search-input-group:focus-within {
    border-color: var(--border-focus);
}

.search-icon {
    color: var(--text-muted);
    margin-right: 12px;
    flex-shrink: 0;
}

#global-search-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
}

.filter-badge-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--accent-badge);
    color: var(--accent-blue);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
}

.badge-remove {
    cursor: pointer;
    font-weight: bold;
}

.badge-remove:hover {
    color: var(--text-primary);
}

.search-history-tags {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    font-size: 12px;
}

.history-label {
    color: var(--text-muted);
    font-weight: 600;
}

.history-tag {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.history-tag:hover {
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.btn-primary {
    background: var(--accent-blue);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover {
    background: var(--accent-blue-hover);
}

.filter-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    box-shadow: var(--shadow);
    z-index: 50;
    overflow: hidden;
}

.filter-dropdown.hidden {
    display: none;
}

.filter-hint-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.8px;
    margin-bottom: 8px;
    padding: 0 8px;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    user-select: none;
}

.filter-item:hover {
    background: var(--bg-card-hover);
}

.filter-tag {
    font-family: monospace;
    font-weight: 700;
    color: var(--accent-blue);
    background: var(--accent-badge);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 13px;
}

.filter-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

.results-wrapper {
    width: 100%;
}

.results-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.results-meta {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.export-actions {
    display: none; 
    gap: 8px;
}

.export-actions.visible {
    display: flex; 
}

.feed-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.message-card:hover {
    border-color: var(--text-muted);
}

.msg-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.msg-author {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
}

.msg-meta {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.msg-content {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    word-break: break-word;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 30px;
}

.pill-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
}

.pill-name {
    font-size: 13px;
    font-weight: 600;
}

.tier-badge {
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    display: inline-block;
}

.tier-badge.premium {
    background: var(--accent-badge);
    color: var(--accent-blue);
    border-color: rgba(88, 101, 242, 0.3);
}

.tier-badge.admin {
    background: rgba(235, 69, 158, 0.15);
    color: #eb459e;
    border-color: rgba(235, 69, 158, 0.3);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
}

.btn-icon:hover { color: var(--text-primary); }

.btn-copy-small {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.btn-copy-small:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.btn-copy-small svg {
    stroke: currentColor !important;
}

.btn-discord {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #5865F2;
    color: #ffffff;
    border: none;
    border-radius: 30px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.btn-secondary {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-card-hover);
    border-color: var(--text-muted);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.toast {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    font-size: 13px;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-info { border-left: 4px solid var(--accent-blue); }
.toast-success { border-left: 4px solid #10b981; }
.toast-warning { border-left: 4px solid #f59e0b; }
.toast-error { border-left: 4px solid #ef4444; }
.toast.fade-out { opacity: 0; transform: translateY(10px); }

.skeleton-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.skeleton-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.skeleton-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-input);
    animation: skeleton-pulse 1.5s infinite ease-in-out;
}

.skeleton-line {
    height: 12px;
    border-radius: 4px;
    background: var(--bg-input);
    animation: skeleton-pulse 1.5s infinite ease-in-out;
}

.skeleton-line.short { width: 30%; }
.skeleton-line.medium { width: 60%; }
.skeleton-line.long { width: 90%; }

@keyframes skeleton-pulse {
    0% { opacity: 0.6; }
    50% { opacity: 0.3; }
    100% { opacity: 0.6; }
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    position: relative;
    box-shadow: var(--shadow);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

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

.profile-avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
}

.profile-meta h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.code-badge {
    font-family: monospace;
    font-size: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--accent-blue);
    padding: 2px 6px;
    border-radius: 4px;
}

.modal-stats-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 18px 0;
}

.mini-stat {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    display: flex;
    flex-direction: column;
}

.mini-label { font-size: 11px; color: var(--text-muted); }
.mini-val { font-size: 18px; font-weight: 700; }

.modal-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 14px;
}

.modal-tab-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.modal-tab-btn.active {
    background: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.modal-tab-content {
    display: none;
    max-height: 280px;
    overflow-y: auto;
}

.modal-tab-content.active { display: block; }

.guild-list { display: flex; flex-direction: column; gap: 8px; }

.guild-card {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
}

.modal-header-centered { text-align: center; margin-bottom: 20px; }

.icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--accent-blue);
}

.feature-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.feature-list li {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.feature-list li svg {
    color: var(--accent-blue);
    flex-shrink: 0;
}

.plan-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    position: relative;
}

.plan-card.featured {
    border-color: var(--accent-blue);
}

.featured-badge {
    position: absolute;
    top: -12px;
    right: 24px;
    background: var(--accent-blue);
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    border-radius: 20px;
}

.plan-header {
    margin-bottom: 12px;
}

.plan-title {
    font-size: 22px;
    font-weight: 700;
    margin: 10px 0 6px 0;
    color: var(--text-primary);
}

.plan-price {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
}

.plan-price span {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

.btn-full {
    width: 100%;
    display: block;
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
}

.empty-state { padding: 30px; text-align: center; color: var(--text-muted); font-size: 13px; }

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
}

.page-indicator { font-size: 12px; color: var(--text-muted); }

.stats-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    width: 100%;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    text-align: center;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.stat-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--accent-blue);
    line-height: 1.2;
}

.stat-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-top: 4px;
}

.user-result-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    box-shadow: var(--shadow);
    margin-bottom: 10px;
}

.user-result-card:hover {
    border-color: var(--border-focus);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

.user-result-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    object-fit: cover;
    flex-shrink: 0;
}

.user-result-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.user-result-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.user-result-global {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.user-result-sub {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-result-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.user-stat-pill {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 68px;
}

.user-stat-pill .stat-num {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-blue);
}

.user-stat-pill .stat-lbl {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
}

.discord-emoji {
    width: 22px;
    height: 22px;
    vertical-align: -0.2em;
    display: inline-block;
    object-fit: contain;
}

@media (max-width: 768px) {
    .about-section-grid,
    .plans-grid,
    .faq-grid,
    .stats-container {
        grid-template-columns: 1fr;
    }

    .top-nav {
        padding: 16px;
    }

    .main-container {
        padding: 0 16px;
    }

    .user-result-card {
        flex-wrap: wrap;
    }

    .results-header-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}