/* =====================================================================
   RELAX WIKI — минималистичная тёмно-фиолетовая тема
   ===================================================================== */
:root {
  --bg:          #0e0d11;
  --text:        #e9e8ee;
  --text-muted:  #8f8b9c;
  --text-dim:    #6a6678;
  --accent:      #b28bf0;
  --accent-soft: rgba(178, 139, 240, .12);
  --line:        rgba(255, 255, 255, .07);
  --line-strong: rgba(255, 255, 255, .12);
  --surface:     rgba(255, 255, 255, .025);
  --topbar-h:    56px;
  --sidebar-w:   232px;
  --rail-w:      212px;
  --maxw:        1180px;
  --content-w:   720px;
}

* { box-sizing: border-box; }

/* Курсор-крестик в стиле Minecraft (белый плюс с чёрной обводкой) */
*, *::before, *::after {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M11 3H13V11H21V13H13V21H11V13H3V11H11Z' fill='%23ffffff' stroke='%23000000' stroke-width='0.6'/%3E%3C/svg%3E") 12 12, crosshair;
}

html {
  background: var(--bg);
}

html, body {
  margin: 0; padding: 0;
  color: var(--text);
  font-family: "Inter", "Segoe UI", -apple-system, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

body { background: transparent; }

/* Мягкие фиолетовые свечения на фоне (фиксированы, не скроллятся) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(760px 560px at 8% -8%,   rgba(139, 92, 246, .30), transparent 60%),
    radial-gradient(700px 560px at 100% 2%,  rgba(168, 85, 247, .22), transparent 55%),
    radial-gradient(680px 680px at 90% 104%, rgba(124, 58, 237, .26), transparent 60%),
    linear-gradient(180deg, #131020 0%, var(--bg) 60%);
}

/* Тонкая точечная сетка с плавным затуханием к краям */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px);
  background-size: 34px 34px;
  -webkit-mask-image: radial-gradient(circle at 50% 35%, #000 0%, transparent 85%);
          mask-image: radial-gradient(circle at 50% 35%, #000 0%, transparent 85%);
  opacity: .7;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--accent-soft); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ===== Верхняя панель ===== */
.topbar {
  position: sticky; top: 0;
  height: var(--topbar-h);
  background: rgba(14, 13, 17, .8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  z-index: 100;
}
.topbar-inner {
  max-width: var(--maxw);
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex; align-items: center; gap: 20px;
}

.menu-toggle {
  display: none;
  flex-direction: column; gap: 4px;
  width: 30px; height: 30px;
  background: none; border: none; cursor: pointer; padding: 0;
}
.menu-toggle span {
  height: 1.5px; width: 18px; margin: 0 auto;
  background: var(--text); border-radius: 2px;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px;
  display: block;
}
.brand-name { font-weight: 600; font-size: 16px; color: var(--text); letter-spacing: .2px; }

.search-wrap { position: relative; margin-left: auto; width: 240px; }
.search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}
#search {
  width: 100%;
  padding: 8px 14px 8px 36px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .15s, background .15s;
}
#search::placeholder { color: var(--text-dim); }
#search:focus { border-color: var(--line-strong); background: rgba(255,255,255,.04); }
.search-wrap:focus-within .search-icon { color: var(--text-muted); }

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: #17161c;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  overflow: hidden;
  display: none;
  box-shadow: 0 12px 34px rgba(0,0,0,.5);
}
.search-results.show { display: block; }
.search-results a {
  display: block; padding: 9px 14px;
  color: var(--text); font-size: 14px;
  border-bottom: 1px solid var(--line);
}
.search-results a:last-child { border-bottom: none; }
.search-results a:hover { background: var(--accent-soft); text-decoration: none; }
.search-results .empty { padding: 11px 14px; color: var(--text-muted); font-size: 14px; }

/* ===== Раскладка ===== */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--rail-w);
  max-width: var(--maxw);
  margin: 0 auto;
  align-items: start;
}

/* ===== Сайдбар ===== */
.sidebar {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 28px 20px 28px 24px;
  border-right: 1px solid var(--line);
}
.nav-group { margin-bottom: 26px; }
.nav-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--text-dim); font-weight: 600;
  margin: 0 0 10px 10px;
}
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li { margin: 1px 0; }
.sidebar a {
  display: block;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 14px;
  transition: color .12s, background .12s;
}
.sidebar a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.sidebar a.active { background: transparent; color: var(--accent); font-weight: 500; }

/* Закреплённый пункт: иконка-кнопка слева в отступе, текст на одном уровне с остальными */
.sidebar a.pinned {
  position: relative;
}
.sidebar a.pinned .pin-ico {
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
}

/* ===== Контент ===== */
.content {
  min-width: 0;
  padding: 48px 56px;
}
#article { max-width: var(--content-w); }

.page-title {
  font-size: 34px; font-weight: 700; letter-spacing: -.02em;
  margin: 0 0 6px; line-height: 1.2;
}
.page-subtitle {
  color: var(--text-muted); font-size: 16px;
  margin: 0 0 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.article-body h2 {
  font-size: 22px; font-weight: 650; letter-spacing: -.01em;
  margin: 40px 0 14px;
}
.article-body h3 { font-size: 17px; font-weight: 600; margin: 28px 0 10px; }
.article-body p { margin: 14px 0; color: #d6d4de; }
.article-body ul, .article-body ol { margin: 14px 0; padding-left: 24px; }
.article-body li { margin: 7px 0; color: #d6d4de; }
.article-body li::marker { color: var(--text-dim); }
.article-body strong { color: var(--text); font-weight: 650; }

.article-body code {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 1px 6px; border-radius: 5px;
  font-size: .86em; color: var(--accent);
  font-family: "SF Mono", "Consolas", monospace;
}

.article-body blockquote {
  margin: 20px 0; padding: 4px 18px;
  border-left: 2px solid var(--accent);
  color: var(--text-muted);
}

.contact-box {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: transparent;
  font-size: 15px;
}

/* Карточка контакта Discord */
.discord-card {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin: 4px 0 8px;
  padding: 14px 20px;
  border: 1px solid var(--line);
  border-left: 3px solid #5865F2;
  border-radius: 12px;
  background:
    linear-gradient(120deg, rgba(88, 101, 242, .10), transparent 70%);
}
.discord-ico { color: #5865F2; flex-shrink: 0; }
.discord-info { display: flex; flex-direction: column; line-height: 1.3; }
.discord-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-dim); font-weight: 600;
}
.discord-nick {
  font-size: 18px; font-weight: 700; color: var(--text);
  font-family: "Consolas", "SF Mono", monospace;
}

.wikitable {
  border-collapse: collapse;
  width: 100%; margin: 20px 0;
  font-size: 14px;
}
.wikitable th, .wikitable td {
  padding: 10px 14px; text-align: left;
  border-bottom: 1px solid var(--line);
}
.wikitable th { color: var(--text); font-weight: 600; border-bottom-color: var(--line-strong); }
.wikitable td { color: #d6d4de; }

/* ===== Сетка SCP-объектов ===== */
.scp-hint {
  font-size: 13px;
  color: var(--text-muted);
  padding: 10px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
}
.scp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  margin: 22px 0;
  clear: both;
}
.scp-card {
  position: relative;
  display: block;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
  color: inherit;
  transition: border-color .15s, transform .15s;
}
.scp-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}
.scp-img {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #17141f;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.scp-img .scp-photo,
.infobox-photo .scp-photo {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  z-index: 1;
}
/* Фирменная заглушка: логотип + номер объекта */
.scp-ph {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px;
  background:
    radial-gradient(120% 120% at 50% 0%, rgba(139,92,246,.12), transparent 60%),
    #16121f;
}
.scp-ph img {
  width: 46%; max-width: 84px;
  opacity: .28;
  filter: grayscale(.1);
}
.scp-ph span {
  font-family: "Consolas", monospace;
  font-size: 12px; letter-spacing: .08em;
  color: var(--text-dim);
}
.scp-badge {
  position: absolute;
  top: 8px; right: 8px;
  z-index: 2;
  padding: 2px 8px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  color: #17121f;
  background: var(--accent);
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.scp-meta {
  display: flex; flex-direction: column;
  padding: 10px 12px;
}
.scp-num { font-weight: 650; font-size: 14px; color: var(--text); }
.scp-name { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* Фото объекта в инфобоксе досье */
.infobox-photo {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #17141f;
  display: flex; align-items: center; justify-content: center;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.scp-back { clear: both; margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px; }

/* Инфобокс */
.infobox {
  float: right;
  width: 268px;
  margin: 0 0 20px 32px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.infobox-title {
  padding: 12px 16px;
  font-weight: 650; font-size: 15px;
  border-bottom: 1px solid var(--line);
}
.infobox-img {
  text-align: center; padding: 22px;
  font-size: 40px;
  border-bottom: 1px solid var(--line);
}
.infobox table { width: 100%; border-collapse: collapse; }
.infobox th, .infobox td {
  padding: 9px 16px; font-size: 13px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.infobox tr:last-child th, .infobox tr:last-child td { border-bottom: none; }
.infobox th { color: var(--text-muted); text-align: left; width: 42%; font-weight: 500; }
.infobox td { color: var(--text); }

/* ===== Правый рельс ===== */
.rail {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  padding: 48px 24px 0 8px;
}
.toc-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--text-dim); font-weight: 600;
  margin-bottom: 12px;
}
#toc-list { list-style: none; margin: 0; padding: 0; font-size: 13px; }
#toc-list li { margin: 0; }
#toc-list li.sub a { padding-left: 22px; }
#toc-list a {
  display: block; padding: 5px 10px;
  color: var(--text-muted);
  border-left: 1px solid var(--line);
  transition: color .12s, border-color .12s;
}
#toc-list a:hover { color: var(--text); border-left-color: var(--accent); text-decoration: none; }

/* ===== Оверлей для мобильного меню ===== */
.overlay {
  display: none;
  position: fixed; inset: var(--topbar-h) 0 0 0;
  background: rgba(0,0,0,.5);
  z-index: 80;
}
.overlay.show { display: block; }

/* ===== Адаптив ===== */
@media (max-width: 1040px) {
  .layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .rail { display: none; }
  .content { padding: 44px 48px; }
}
@media (max-width: 720px) {
  .menu-toggle { display: flex; }
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: var(--topbar-h); bottom: 0; left: 0;
    width: 260px; height: auto;
    background: var(--bg);
    transform: translateX(-105%);
    transition: transform .22s ease;
    z-index: 90;
  }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 32px 22px; }
  .page-title { font-size: 27px; }
  .infobox { float: none; width: auto; margin: 0 0 20px; }
  .search-wrap { width: 150px; }
}
