:root {
    --bg-body: #F0F4F8;
    --bg-surface: #FFFFFF;
    --bg-header: rgba(15, 27, 45, 0.95);
    --text-main: #1E293B;
    --text-muted: #64748B;
    --text-on-dark: #FFFFFF;
    --accent: #FF6B00;
    --accent-hover: #E55F00;
    --danger: #EF4444;
    --success: #10B981;
    --border: rgba(226, 232, 240, 0.8);
    --shadow-sm: 0 4px 12px rgba(15, 27, 45, 0.03);
    --shadow-md: 0 8px 24px rgba(15, 27, 45, 0.06);
    --shadow-lg: 0 16px 40px rgba(15, 27, 45, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --modal-overlay: rgba(15, 27, 45, 0.7);
    --font-main: 'Inter', sans-serif;
    --font-heading: 'Roboto Slab', serif;
    --radius-md: 16px;
    --radius-lg: 24px;
}

[data-theme="dark"] {
    --bg-body: #0F172A;
    --bg-surface: #1E293B;
    --bg-header: rgba(10, 16, 26, 0.95);
    --text-main: #F1F5F9;
    --text-muted: #94A3B8;
    --border: rgba(51, 65, 85, 0.6);
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.4);
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.05);
    --modal-overlay: rgba(0, 0, 0, 0.85);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: var(--font-main);
    background-color: var(--bg-body);
    color: var(--text-main);
    transition: background-color 0.3s, color 0.3s;
    line-height: 1.6;
    background-image: radial-gradient(circle at top right, rgba(255, 107, 0, 0.05), transparent 400px);
}
svg { width: 20px; height: 20px; flex-shrink: 0; }
button { font-family: inherit; }

/* Панель "стекло" */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

/* --- Модальное окно --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: var(--modal-overlay);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; backdrop-filter: blur(8px);
}
.modal-content {
    background: var(--bg-surface); padding: 40px; border-radius: 28px;
    width: 90%; max-width: 620px; box-shadow: 0 32px 64px rgba(0,0,0,0.2);
    border: 1px solid var(--border);
    animation: modalIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header { text-align: center; margin-bottom: 32px; }
.modal-logo { width: 80px; height: 80px; border-radius: 20px; margin-bottom: 20px; box-shadow: var(--shadow-md); }
.modal-header h2 { font-family: var(--font-heading); font-size: 28px; margin-bottom: 8px; }
.modal-header p { color: var(--text-muted); font-size: 15px; }

.role-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 32px; }
.role-btn {
    display: flex; align-items: center; gap: 14px; padding: 18px;
    background: var(--bg-body); border: 2px solid transparent;
    border-radius: 16px; cursor: pointer; font-weight: 600; font-size: 15px;
    color: var(--text-main); transition: all 0.2s; position: relative; text-align: left;
}
.role-btn svg { color: var(--text-muted); transition: color 0.2s; }
.role-btn:hover:not(.disabled) {
    border-color: var(--accent); background: var(--bg-surface);
    box-shadow: 0 8px 24px rgba(255, 107, 0, 0.12);
    transform: translateY(-3px);
}
.role-btn:hover:not(.disabled) svg { color: var(--accent); }
.role-btn.disabled { opacity: 0.5; cursor: not-allowed; background: transparent; border-color: var(--border); }
.role-btn small {
    position: absolute; top: 10px; right: 10px;
    background: var(--text-muted); color: var(--bg-surface);
    padding: 2px 8px; border-radius: 6px; font-size: 10px; font-weight: 800;
}

.theme-toggle-section { border-top: 1px solid var(--border); padding-top: 24px; text-align: center; }
.theme-toggle-section p { margin-bottom: 16px; color: var(--text-muted); font-size: 14px; font-weight: 500; }
.theme-switch { display: flex; justify-content: center; gap: 12px; }
.theme-btn {
    display: flex; align-items: center; gap: 8px; padding: 10px 24px;
    border: 2px solid var(--border); background: transparent; border-radius: 12px;
    cursor: pointer; color: var(--text-main); transition: all 0.2s; font-size: 14px; font-weight: 600;
}
.theme-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(255, 107, 0, 0.05); }

/* --- Шапка --- */
.site-header {
    background: var(--bg-header); color: var(--text-on-dark);
    padding: 16px 0; position: sticky; top: 0; z-index: 100;
    backdrop-filter: blur(12px); border-bottom: 1px solid rgba(255,255,255,0.05);
}
.header-container {
    max-width: 1400px; margin: 0 auto; padding: 0 24px;
    display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.logo-area { display: flex; align-items: center; gap: 14px; cursor: pointer; transition: opacity 0.2s; }
.logo-area:hover { opacity: 0.9; }
.site-logo { width: 44px; height: 44px; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.logo-text h1 { font-family: var(--font-heading); font-size: 20px; line-height: 1.1; }
.logo-text span { font-size: 11px; color: #94A3B8; text-transform: uppercase; letter-spacing: 1.5px; font-weight: 600; }

.search-bar { flex: 1; max-width: 520px; position: relative; }
.search-bar svg { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: #94A3B8; }
.search-bar input {
    width: 100%; padding: 14px 18px 14px 52px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05); color: #fff; font-family: var(--font-main);
    font-size: 15px; transition: all 0.2s;
}
.search-bar input::placeholder { color: #64748B; }
.search-bar input:focus { outline: none; background: rgba(255,255,255,0.1); border-color: var(--accent); box-shadow: 0 0 0 4px rgba(255,107,0,0.15); }

.header-actions { display: flex; gap: 12px; align-items: center; }
.icon-btn {
    background: rgba(255,255,255,0.08); border: none; color: #fff;
    width: 44px; height: 44px; border-radius: 12px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.icon-btn:hover { background: rgba(255,255,255,0.15); transform: translateY(-1px); }
.role-badge {
    display: flex; align-items: center; gap: 10px;
    background: var(--accent); color: #fff; border: none;
    padding: 0 20px; height: 44px; border-radius: 12px;
    font-weight: 600; font-size: 14px; cursor: pointer; transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.3);
}
.role-badge:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(255, 107, 0, 0.4); }

/* --- Макет --- */
.main-layout { max-width: 1400px; margin: 36px auto; padding: 0 24px; display: flex; gap: 32px; }
.sidebar { width: 280px; flex-shrink: 0; }
.sidebar-nav {
    background: var(--bg-surface); border-radius: var(--radius-lg); padding: 12px;
    border: 1px solid var(--border); box-shadow: var(--shadow-sm);
    position: sticky; top: 100px;
}
.nav-item {
    display: flex; align-items: center; gap: 14px; padding: 14px 16px;
    color: var(--text-main); text-decoration: none; border-radius: 12px;
    font-size: 15px; font-weight: 600; transition: all 0.2s; position: relative;
    cursor: pointer; margin-bottom: 2px;
}
.nav-item svg { color: var(--text-muted); transition: color 0.2s; }
.nav-item:hover { background: var(--bg-body); }
.nav-item:hover svg { color: var(--accent); }
.nav-item.active { background: rgba(255, 107, 0, 0.1); color: var(--accent); }
.nav-item.active svg { color: var(--accent); }
.nav-divider { height: 1px; background: var(--border); margin: 12px 8px; }
.nav-item.is-priority::before {
    content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 4px; height: 24px; background: var(--accent); border-radius: 0 4px 4px 0;
}

/* --- Главная (Hero Banner) --- */
.content { flex: 1; min-width: 0; }

.hero-banner {
    position: relative; border-radius: var(--radius-lg); overflow: hidden;
    padding: 60px 48px; margin-bottom: 40px; min-height: 320px;
    display: flex; align-items: center; box-shadow: var(--shadow-lg);
    /* Красивый градиент на фоне, если нет картинки */
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 50%, #0F172A 100%);
}

/* Светящиеся пятна на фоне */
.hero-banner::before {
    content: ''; position: absolute; top: -50px; right: -50px; width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(255,107,0,0.25) 0%, transparent 70%);
    border-radius: 50%; pointer-events: none; z-index: 1;
}
.hero-banner::after {
    content: ''; position: absolute; bottom: -50px; left: 10%; width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    border-radius: 50%; pointer-events: none; z-index: 1;
}

.hero-bg {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background-size: cover; background-position: center;
    opacity: 0.3; /* Картинка плавно смешивается с фоном */
    mix-blend-mode: luminosity; /* Делает картинку стильной */
    z-index: 0; transition: transform 0.8s ease;
}
.hero-banner:hover .hero-bg { transform: scale(1.05); }

.hero-content { position: relative; z-index: 2; max-width: 600px; color: #fff; }
.hero-content h1 { font-family: var(--font-heading); font-size: 44px; line-height: 1.15; margin-bottom: 20px; text-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.hero-content h1 span { color: var(--accent); }
.hero-content p { font-size: 17px; color: #CBD5E1; margin-bottom: 32px; max-width: 500px; line-height: 1.6; text-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.hero-stats { display: flex; gap: 40px; }
.hero-stat { display: flex; flex-direction: column; }
.hero-stat .num { font-family: var(--font-heading); font-size: 32px; font-weight: 700; color: var(--accent); line-height: 1; margin-bottom: 4px; }
.hero-stat .lbl { font-size: 13px; color: #94A3B8; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }

.section-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 24px; }
.section-title { font-family: var(--font-heading); font-size: 24px; color: var(--text-main); }
.section-subtitle { font-size: 14px; color: var(--text-muted); font-weight: 500; }

/* --- Карточки (Premium Design) --- */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; }

.article-card {
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 24px;
    box-shadow: var(--shadow-sm); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; flex-direction: column; cursor: pointer;
    position: relative; overflow: hidden; animation: cardIn 0.5s ease backwards;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.article-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
    background: var(--accent-color);
    transform: scaleX(0); transform-origin: left;
    transition: transform 0.4s ease;
}
.article-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.1);
    border-color: transparent;
}
.article-card:hover::before { transform: scaleX(1); }

.card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.card-badge {
    background: var(--accent-bg); color: var(--accent-color);
    padding: 6px 12px; border-radius: 8px; font-size: 12px;
    font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px;
}
.card-num { font-size: 13px; color: var(--text-muted); font-weight: 700; background: var(--bg-body); padding: 4px 10px; border-radius: 6px; }

.article-card h4 { font-size: 19px; margin-bottom: 10px; line-height: 1.35; color: var(--text-main); font-weight: 700; }
.article-card p { font-size: 14.5px; color: var(--text-muted); line-height: 1.6; flex: 1; margin-bottom: 24px; }

.card-footer { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 12px; border-top: 1px solid var(--border); padding-top: 16px; }
.punishment-tag {
    font-size: 13px; background: rgba(239, 68, 68, 0.1);
    color: var(--danger); padding: 6px 12px; border-radius: 8px; font-weight: 700;
    display: inline-flex; align-items: center; gap: 6px;
}
.card-arrow {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%; background: var(--bg-body);
    color: var(--text-muted); transition: all 0.3s;
}
.card-arrow svg { width: 18px; height: 18px; transition: transform 0.3s; }
.article-card:hover .card-arrow { background: var(--accent-bg); color: var(--accent-color); }
.article-card:hover .card-arrow svg { transform: translateX(2px); }

/* --- Страница статьи --- */
.article-page { max-width: 900px; }
.breadcrumbs { display: flex; gap: 10px; font-size: 14px; color: var(--text-muted); margin-bottom: 24px; font-weight: 500; }
.breadcrumbs a { color: var(--text-muted); text-decoration: none; transition: color 0.2s; }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs span.current { color: var(--text-main); font-weight: 700; }

.article-header { padding: 40px; margin-bottom: 24px; border-left: 6px solid var(--accent-color); }
.article-code-badge {
    display: inline-block; background: var(--accent-bg); color: var(--accent-color);
    padding: 8px 16px; border-radius: 10px; font-size: 13px;
    font-weight: 800; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 20px;
}
.article-header h1 { font-family: var(--font-heading); font-size: 36px; line-height: 1.25; margin-bottom: 12px; color: var(--text-main); }
.article-chapter { color: var(--text-muted); font-size: 15px; font-weight: 500; }

.article-body { padding: 40px; font-size: 17px; line-height: 1.9; margin-bottom: 24px; color: var(--text-main); }
.article-body p { margin-bottom: 20px; }
.article-body p:last-child { margin-bottom: 0; }

.punishment-block { background: rgba(239, 68, 68, 0.08); border-left: 6px solid var(--danger); padding: 24px 32px; border-radius: var(--radius-md); margin-bottom: 24px; }
.punishment-block h3 { font-size: 13px; color: var(--danger); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 1.5px; font-weight: 800; }
.punishment-block p { font-size: 20px; font-weight: 800; color: var(--text-main); }

.rp-note-block { background: rgba(255, 107, 0, 0.08); border-left: 6px solid var(--accent); padding: 24px 32px; border-radius: var(--radius-md); margin-bottom: 24px; }
.rp-note-block h3 { font-size: 13px; color: var(--accent); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 1.5px; font-weight: 800; }
.rp-note-block p { font-size: 16px; line-height: 1.7; color: var(--text-main); font-weight: 500; }

.back-btn {
    display: inline-flex; align-items: center; gap: 10px;
    background: var(--bg-surface); border: 1px solid var(--border);
    color: var(--text-main); padding: 12px 24px; border-radius: 12px;
    font-size: 15px; font-weight: 600; cursor: pointer; margin-bottom: 24px;
    transition: all 0.2s; box-shadow: var(--shadow-sm);
}
.back-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateX(-4px); }

/* --- Правила сервера --- */
.rules-header-card { padding: 36px 40px; margin-bottom: 24px; display: flex; align-items: center; gap: 24px; border-left: 6px solid var(--accent); }
.rules-header-icon { width: 64px; height: 64px; border-radius: 16px; background: rgba(255, 107, 0, 0.12); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.rules-header-icon svg { width: 32px; height: 32px; }
.rules-header-card h2 { font-family: var(--font-heading); font-size: 28px; margin-bottom: 6px; }
.rules-header-card p { color: var(--text-muted); font-size: 15px; font-weight: 500; }

.rules-page { max-width: 900px; }
.rules-section { padding: 36px 40px; margin-bottom: 24px; }
.rules-section h2 { font-family: var(--font-heading); font-size: 22px; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 2px solid var(--border); }
.rule-item { margin-bottom: 24px; }
.rule-item:last-child { margin-bottom: 0; }
.rule-item h3 { font-size: 17px; margin-bottom: 8px; color: var(--text-main); font-weight: 700; }
.rule-item p { font-size: 15px; color: var(--text-muted); line-height: 1.7; margin-bottom: 8px; }
.rule-punishment { font-size: 14px; color: var(--danger); font-weight: 800; background: rgba(239,68,68,0.1); display: inline-block; padding: 4px 12px; border-radius: 6px; }

/* Пустой раздел */
.empty-section { padding: 80px 32px; text-align: center; border-radius: var(--radius-lg); background: var(--bg-surface); border: 1px dashed var(--border); }
.empty-icon { display: inline-flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 50%; background: var(--bg-body); color: var(--text-muted); margin-bottom: 20px; }
.empty-icon svg { width: 36px; height: 36px; }
.empty-section h3 { font-family: var(--font-heading); font-size: 24px; margin-bottom: 8px; }
.empty-section p { color: var(--text-muted); font-size: 15px; }

/* Адаптивность */
@media (max-width: 900px) {
    .main-layout { flex-direction: column; gap: 24px; margin: 24px auto; }
    .sidebar { width: 100%; }
    .sidebar-nav { position: static; display: flex; overflow-x: auto; padding: 10px; }
    .nav-item { white-space: nowrap; padding: 12px 18px; margin-bottom: 0; }
    .nav-divider { display: none; }
    .header-container { flex-wrap: wrap; gap: 16px; }
    .search-bar { order: 3; max-width: 100%; flex-basis: 100%; }
    .role-grid { grid-template-columns: 1fr; }
    .hero-banner { padding: 40px 24px; }
    .hero-content h1 { font-size: 32px; }
    .article-header, .article-body, .rules-section { padding: 24px; }
}


/* Кнопки действий в статье (Избранное / Поделиться) */
.article-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-body);
    border: 1px solid var(--border);
    padding: 10px 16px;
    border-radius: 10px;
    color: var(--text-main);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.action-btn.active {
    background: rgba(255, 107, 0, 0.1);
    border-color: var(--accent);
    color: var(--accent);
}

.action-btn.active svg {
    fill: var(--accent);
}


/* --- Оглавление в правилах --- */
.rules-toc {
    padding: 24px;
    margin-bottom: 24px;
    border-left: 4px solid var(--accent);
}

.rules-toc h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--text-main);
}

.rules-toc ul {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 10px;
}

.rules-toc li a {
    display: inline-block;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.rules-toc li a:hover {
    background: var(--bg-body);
    color: var(--accent);
    transform: translateX(4px);
}

/* --- Кнопка Наверх --- */
.scroll-top-btn {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    box-shadow: 0 4px 16px rgba(255, 107, 0, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-top-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-4px);
}

.scroll-top-btn svg {
    width: 24px;
    height: 24px;
}

/* --- Карточки разделов --- */
.rules-section {
    padding: 30px 36px;
    margin-bottom: 24px;
    border: 1px solid rgba(255, 107, 0, 0.15);
    background: var(--bg-surface);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-lg);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.rules-section:hover {
    border-color: rgba(255, 107, 0, 0.4);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* --- Заголовки разделов --- */
.rules-section h2 {
    font-family: var(--font-heading);
    font-size: 22px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
}

/* --- Контейнер кнопки --- */
.to-top-wrapper {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    margin-top: 20px;
}

/* --- Кнопка К оглавлению --- */
.to-top-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    text-decoration: none;
    background: rgba(100, 116, 139, 0.12);
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid rgba(100, 116, 139, 0.25);
    transition: all 0.2s ease;
}

.to-top-btn::after {
    content: '↑';
    font-size: 14px;
    transition: transform 0.2s ease;
}

.to-top-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(255, 107, 0, 0.1);
}

.to-top-btn:hover::after {
    transform: translateY(-2px);
}