:root {
    --l2-gold: #c5a059;
    --l2-gold-dark: #8e6d2d;
    --l2-bg: #0f1115;
    --l2-card: #1a1d23;
    --l2-accent: #3b82f6;
    --l2-glass: rgba(26, 29, 35, 0.7);
}

html {
    overflow-y: scroll; /* Скролбар завжди видимий — лейаут не стрибає */
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--l2-bg);
    color: #e2e8f0;
    line-height: 1.6;
}

body.wiki-intro-lock {
    overflow: hidden;
}

#main-content {
    transition: opacity 0.15s ease;
}

.l2-font { font-family: 'Marcellus', serif; }

.gold-gradient {
    background: linear-gradient(135deg, var(--l2-gold) 0%, var(--l2-gold-dark) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Premium Card Style with Glassmorphism */
.section-card {
    background: var(--l2-glass);
    border: 1px solid rgba(197, 160, 89, 0.15);
    border-radius: 16px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.section-card:hover {
    border-color: var(--l2-gold);
    transform: translateY(-4px);
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
    background: rgba(197, 160, 89, 0.05);
}

.badge-premium {
    background: linear-gradient(90deg, #ffd700, #b8860b);
    color: black;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.list-dot {
    color: var(--l2-gold);
    margin-right: 10px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    height: 42px; /* Стабільна висота для всіх кнопок */
    padding: 0 15px;
    color: #94a3b8;
    border-radius: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-left: 3px solid transparent;
    margin-bottom: 2px;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #f1f5f9;
    padding-left: 20px;
}

.sidebar-link.active {
    background: linear-gradient(90deg, rgba(197, 160, 89, 0.15) 0%, transparent 100%);
    color: var(--l2-gold);
    border-left-color: var(--l2-gold);
    font-weight: 600;
}

.warning-box {
    background: rgba(239, 68, 68, 0.05);
    border-left: 4px solid #ef4444;
    padding: 15px;
    border-radius: 8px;
    backdrop-filter: blur(5px);
}

/* AI Assistant Styles */
.ai-chat-bubble {
    background: linear-gradient(135deg, #1e1b4b 0%, #1a1d23 100%);
    border: 1px solid rgba(55, 48, 163, 0.5);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

@keyframes pulse-gold {
    0% { box-shadow: 0 0 0 0 rgba(197, 160, 89, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(197, 160, 89, 0); }
    100% { box-shadow: 0 0 0 0 rgba(197, 160, 89, 0); }
}

.ai-btn-pulse {
    animation: pulse-gold 2s infinite;
}

.wiki-intro-overlay {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at top, rgba(59, 130, 246, 0.12), transparent 34%),
        linear-gradient(180deg, rgba(8, 10, 14, 0.94), rgba(8, 10, 14, 0.98));
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.55s ease, visibility 0.55s ease;
    visibility: hidden;
}

.wiki-intro-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

.wiki-intro-overlay.is-leaving {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.wiki-intro-card {
    width: min(100%, 460px);
    padding: 32px 28px;
    text-align: center;
    border-radius: 24px;
    border: 1px solid rgba(197, 160, 89, 0.22);
    background:
        linear-gradient(180deg, rgba(26, 29, 35, 0.96), rgba(12, 14, 19, 0.96));
    box-shadow:
        0 24px 64px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    animation: wiki-intro-float 2.2s ease-in-out infinite alternate;
}

.wiki-intro-glyph {
    font-size: 42px;
    line-height: 1;
    margin-bottom: 14px;
    text-shadow: 0 0 24px rgba(197, 160, 89, 0.28);
}

.wiki-intro-kicker {
    margin: 0 0 10px;
    color: #a78bfa;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.36em;
    text-transform: uppercase;
}

.wiki-intro-title {
    margin: 0;
    color: #f8fafc;
    font-family: 'Marcellus', serif;
    font-size: clamp(2rem, 4vw, 2.8rem);
    line-height: 1.05;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.wiki-intro-subtitle {
    margin: 12px 0 0;
    color: #94a3b8;
    font-size: 0.95rem;
}

@keyframes wiki-intro-float {
    0% {
        transform: translateY(0) scale(1);
    }
    100% {
        transform: translateY(-8px) scale(1.01);
    }
}

/* Markdown response styling */
#ai-text-output table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
}

#ai-text-output th, #ai-text-output td {
    border: 1px solid rgba(197, 160, 89, 0.2);
    padding: 8px;
    text-align: left;
}

#ai-text-output th {
    background: rgba(197, 160, 89, 0.1);
}

/* Scrollbar Style */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--l2-bg);
}
::-webkit-scrollbar-thumb {
    background: var(--l2-gold-dark);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--l2-gold);
}

/* Lucide Icon Helpers */
.wiki-icon {
    display: inline-block;
    vertical-align: middle;
    width: 1.1em;
    height: 1.1em;
    stroke-width: 1.75;
}

h2 .wiki-icon, h3 .wiki-icon, h4 .wiki-icon {
    stroke-width: 2;
    margin-right: 0.15em;
    margin-top: -0.1em;
}

/* Mobile Sidebar Drawer & Backdrop */
@media (max-width: 767px) {
    #sidebar-container {
        position: fixed;
        top: 0;
        left: -280px; /* Off-screen default */
        width: 280px;
        height: 100vh;
        z-index: 100;
        background: rgba(10, 12, 16, 0.96);
        border-right: 1px solid rgba(197, 160, 89, 0.2);
        padding: 24px 16px;
        overflow-y: auto;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        backdrop-filter: blur(15px);
        margin: 0 !important;
    }

    #sidebar-container.open {
        transform: translateX(280px); /* Slide in drawer */
        box-shadow: 10px 0 40px rgba(0, 0, 0, 0.8);
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.65);
        backdrop-filter: blur(4px);
        z-index: 90;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .sidebar-backdrop.active {
        opacity: 1;
        pointer-events: auto;
    }
}
