:root {
    --bg-main: #ffffff;
    --bg-sidebar: #f6f6f6;
    --border-color: #a2a9b1;
    --text-main: #202122;
    --text-muted: #54595d;
    --link-color: #0645ad;
    --link-hover: #0b0080;
}

body {
    margin: 0; padding: 0;
    font-family: sans-serif;
    background-color: var(--bg-sidebar); 
    color: var(--text-main);
    overflow-x: hidden;
}

#particles-js { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; }

.wiki-container {
    display: flex; 
    max-width: 1600px; 
    margin: 0 auto;
    position: relative; 
    z-index: 1;
}

/* Sidebar */
.wiki-sidebar {
    width: 160px; 
    padding: 20px 10px;
    font-size: 0.85rem;
}
.wiki-logo {
    display: block; width: 135px; height: 135px; margin: 0 auto 20px;
    background: url('/static/Media/Wiki/wiki-logo.png') no-repeat center/contain;
}
.wiki-menu { list-style: none; padding: 0; margin: 0; }
.wiki-menu li { margin-bottom: 8px; }
.wiki-menu a { text-decoration: none; color: var(--link-color); cursor: pointer; }
.wiki-menu a:hover { text-decoration: underline; color: var(--link-hover); }

/* Main Content */
.wiki-main {
    flex-grow: 1; 
    background: var(--bg-main);
    border: 1px solid var(--border-color); 
    border-top: none; border-bottom: none;
    padding: 25px 40px; 
    min-height: 100vh;
}
.wiki-topbar {
    display: flex; justify-content: flex-end; align-items: center; gap: 15px;
    margin-bottom: 20px; font-size: 0.85rem; border-bottom: 1px solid #eaecf0; padding-bottom: 10px;
}

/* Typography */
.wiki-title {
    font-family: 'Linux Libertine', 'Georgia', serif; font-size: 2.2rem; font-weight: normal;
    border-bottom: 1px solid var(--border-color); padding-bottom: 5px; margin-top: 0;
}
.wiki-content h2 { font-family: 'Linux Libertine', serif; font-weight: normal; border-bottom: 1px solid var(--border-color); padding-bottom: 3px; margin-top: 30px; }
.wiki-content p { line-height: 1.6; font-size: 0.95rem; }
.wiki-link { color: var(--link-color); text-decoration: none; }
.wiki-link:hover { text-decoration: underline; }

/* Welcome Banner */
.wiki-welcome-banner {
    border: 1px solid var(--border-color);
    background-color: #f8f9fa;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' opacity='0.03'%3E%3Ctext x='5' y='80' font-size='80' font-family='serif'%3EW%3C/text%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: left center; background-size: cover;
    padding: 1.2rem 1.5rem; display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 25px; flex-wrap: wrap; gap: 15px;
}
.welcome-left h1 { margin: 0; font-family: 'Linux Libertine', Georgia, serif; font-size: 2rem; font-weight: normal; color: #000; }
.welcome-left p { margin: 5px 0 0 0; font-size: 0.95rem; color: #202122; }
.welcome-right { text-align: right; font-size: 0.95rem; }

/* Image Generation Box */
.ai-img-placeholder {
    display: block; width: 300px; height: 200px; background: #f8f9fa; border: 1px solid #c8ccd1;
    margin: 15px auto; text-align: center; line-height: 200px; color: var(--text-muted); font-style: italic; float: right; margin-left: 20px;
}
.wiki-image-block {
    float: right; margin: 0 0 15px 20px; border: 1px solid #c8ccd1;
    background: #f8f9fa; padding: 3px; text-align: center; max-width: 350px;
}
.wiki-image-block img { max-width: 100%; height: auto; }

/* UI Elements */
.input-wiki { padding: 6px 8px; border: 1px solid var(--border-color); border-radius: 2px; font-family: sans-serif; width: 100%; box-sizing: border-box;}
.btn-wiki { padding: 6px 12px; background: #f8f9fa; border: 1px solid var(--border-color); cursor: pointer; font-size: 0.9rem; color: var(--text-main); border-radius: 2px; }
.btn-wiki.primary { background: #3366cc; color: white; border-color: #3366cc; font-weight: bold; }
.btn-wiki:hover { filter: brightness(0.95); }

/* Likes / Dislikes */
.interaction-bar {
    margin-top: 40px; padding: 15px; background: #f8f9fa;
    border: 1px solid #eaecf0; display: flex; align-items: center; gap: 15px;
}
.vote-btn { background: none; border: 1px solid #c8ccd1; padding: 5px 10px; cursor: pointer; border-radius: 2px;}
.vote-btn.active-like { background: #eaf3ff; border-color: #3366cc; color: #3366cc; }
.vote-btn.active-dislike { background: #fee7e6; border-color: #d33; color: #d33; }

/* =========================================
   МОДАЛЬНЫЕ ОКНА АВТОРИЗАЦИИ (ИСПРАВЛЕНО) 
   ========================================= */
.modal-overlay {
    position: fixed; 
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.6); 
    z-index: 9999;
    display: none; /* JS меняет это на flex */
    justify-content: center; 
    align-items: center;
}

.auth-card {
    background: #ffffff; 
    padding: 30px; 
    border: 1px solid var(--border-color);
    width: 100%; 
    max-width: 360px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    border-radius: 2px;
    z-index: 10000;
}