/* Lavrik SMP+ — стили.
   Палитра сервера: градиент #FF0055 → #FF8899 и белый на тёмной сливовой основе —
   те же цвета, что в префиксе owner и в голограмме. Все значения собраны в PALETTE.md.
   Кнопки и плашка IP — «блоки» с нижней гранью. */

:root {
  --bg: #171216;
  --bg-deep: #100c10;
  --panel: #211a20;
  --panel-2: #2b2229;
  --line: #46343e;
  --ink: #f8f2f4;
  --muted: #b8a5ad;
  --red: #ff0055;       /* акцент: линии, маркеры, рамки */
  --red-soft: #ff6688;  /* красный для текста и ссылок на тёмном */
  --red-face: #d6004c;  /* заливка кнопок под белый текст (контраст 5.3) */
  --red-deep: #8f0033;  /* нижняя грань кнопок-блоков */
  --snow: #fff4f6;      /* белая заливка: плашка IP, закреп, бейджи */
  --snow-ink: #7a0029;  /* текст на белой заливке */
  --danger: #ff8478;
  --radius: 4px;
  --font-body: 'Onest', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Unbounded', 'Onest', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; scroll-padding-top: 5rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.6 var(--font-body);
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 4.5vw, 2.5rem); font-weight: 700; }
h2 { font-size: 1.3rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 500; }
p { margin: 0 0 1em; }
a { color: var(--red-soft); text-underline-offset: 3px; }
a:hover { color: #ff99aa; }
:focus-visible { outline: 3px solid var(--snow); outline-offset: 2px; border-radius: 2px; }
::selection { background: var(--red-face); color: #fff; }

.wrap { width: min(100% - 2rem, 70rem); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 0; background: var(--snow); color: var(--snow-ink); padding: .6rem 1rem; z-index: 100; }
.skip:focus { left: 1rem; top: 1rem; }
main { padding-block: 2rem 4rem; min-height: 70vh; }
main:focus, main:focus-visible { outline: none; } /* фокус на main ставится кодом при смене страницы */

/* ---------- шапка ---------- */
.top { background: var(--bg-deep); border-bottom: 2px solid #0b080b; position: sticky; top: 0; z-index: 20; }
.top-row { display: flex; align-items: center; gap: 1.25rem; min-height: 3.75rem; flex-wrap: wrap; padding-block: .4rem; }
.brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-name { font: 700 1.05rem var(--font-display); letter-spacing: -.01em; }
.nav { display: flex; gap: .25rem; }
.nav a { color: var(--muted); text-decoration: none; padding: .45rem .8rem; border-radius: var(--radius); font-weight: 500; }
.nav a:hover { color: var(--ink); background: var(--panel); }
.nav a[aria-current="page"] { color: #fff; background: var(--red-face); }
.account { margin-left: auto; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.account .who { color: var(--ink); text-decoration: none; font-weight: 600; padding: .35rem .6rem; border-radius: var(--radius); }
.account .who:hover { background: var(--panel); color: var(--ink); }

/* ---------- кнопки-блоки ---------- */
.btn {
  --face: var(--panel-2); --edge: #0c080c; --text: var(--ink);
  appearance: none; cursor: pointer; font: 600 .95rem var(--font-body);
  background: var(--face); color: var(--text);
  border: 0; border-radius: var(--radius); padding: .55rem 1rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 3px 0 var(--edge);
  transform: translateY(0); text-decoration: none; display: inline-flex; align-items: center; gap: .4rem;
  transition: transform .06s, box-shadow .06s, background-color .15s;
}
.btn:hover { background: color-mix(in srgb, var(--face), white 8%); color: var(--text); }
.btn:active { transform: translateY(3px); box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 0 0 var(--edge); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-primary { --face: var(--red-face); --edge: var(--red-deep); --text: #fff; }
.btn-danger { --face: #4a1424; --edge: #240a12; --text: #ffd6de; }
.btn-small { padding: .3rem .65rem; font-size: .85rem; box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 2px 0 var(--edge); }
.btn-small:active { transform: translateY(2px); }
.btn-ghost { --face: transparent; --edge: transparent; box-shadow: none; color: var(--muted); }
.btn-ghost:hover { background: var(--panel); color: var(--ink); }
.btn-ghost:active { transform: none; }

/* ---------- первый экран ---------- */
.hero {
  position: relative; padding: 3rem 0 2.5rem; margin-bottom: 2rem;
  border-bottom: 2px solid var(--line);
}
.hero::before {
  content: ''; position: absolute; inset: 0 calc(50% - 50vw); z-index: -1;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 40px 40px; opacity: .22;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 85%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 85%);
}
.hero h1 {
  font-size: clamp(2.2rem, 7vw, 4.4rem); letter-spacing: -.03em; max-width: 14ch; width: fit-content;
  color: var(--red-soft); /* запасной цвет, если градиент по тексту не поддерживается */
  background: linear-gradient(90deg, #ff0055, #ff8899 50%, #ff0055);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero .lead { font-size: 1.15rem; color: var(--muted); max-width: 36rem; margin: 1rem 0 1.75rem; }
.ip-row { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; align-items: center; }
.ip-plate {
  --face: var(--snow); --edge: var(--red);
  appearance: none; cursor: pointer; border: 0; border-radius: var(--radius);
  background: var(--face); color: var(--snow-ink);
  font: 500 clamp(1.15rem, 3.6vw, 1.9rem) var(--font-mono);
  padding: .8rem 1.4rem; display: inline-flex; align-items: center; gap: 1rem;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.3), inset 0 -2px 0 rgba(0,0,0,.12), 0 6px 0 var(--edge);
  transition: background-color .5s, color .5s, box-shadow .5s, transform .06s;
  max-width: 100%; overflow-wrap: anywhere; text-align: left; flex-wrap: wrap; gap: .3rem 1rem;
}
.ip-plate:hover { background: #fff; }
.ip-plate:active { transform: translateY(6px); box-shadow: inset 0 2px 0 rgba(255,255,255,.3), inset 0 -2px 0 rgba(0,0,0,.12), 0 0 0 var(--edge); }
.ip-plate .hint { font: 600 .8rem var(--font-body); opacity: .75; white-space: nowrap; }
.ip-plate.done { --face: var(--red-face); --edge: var(--red-deep); background: var(--red-face); color: #fff; }
.ip-plate.done:hover { background: var(--red-face); }
.ip-empty { color: var(--muted); border: 2px dashed var(--line); border-radius: var(--radius); padding: .8rem 1.2rem; max-width: 34rem; }
.status { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-weight: 500; }
.dot { width: .8rem; height: .8rem; border-radius: 2px; background: var(--line); flex: none; }
.dot.on { background: var(--snow); box-shadow: 0 0 0 3px rgba(255,0,85,.45); }
.dot.off { background: var(--danger); }
.status strong { color: var(--ink); }

/* ---------- секции и панели ---------- */
.cols { display: grid; gap: 2rem; grid-template-columns: repeat(2, 1fr); align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.panel-head a { font-weight: 500; font-size: .9rem; white-space: nowrap; }
.panel-body { padding: 1.25rem; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li + li { border-top: 1px solid var(--line); }
.list a.row { display: block; padding: .9rem 1.25rem; text-decoration: none; color: var(--ink); }
.list a.row:hover { background: var(--panel-2); }
.row-title { font-weight: 600; display: block; }
.row-meta { color: var(--muted); font-size: .88rem; }
.empty { color: var(--muted); padding: 1.5rem 1.25rem; margin: 0; }
.stats { display: flex; flex-wrap: wrap; gap: .5rem 1.75rem; color: var(--muted); margin-top: 2rem; }
.stats b { color: var(--ink); font-weight: 600; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-head p { margin: .4rem 0 0; color: var(--muted); }
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: .75rem; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--red-soft); }

/* ---------- форумные таблицы ---------- */
.cat-row { display: grid; grid-template-columns: 1fr auto auto; gap: 1.5rem; align-items: center; padding: 1rem 1.25rem; text-decoration: none; color: var(--ink); }
.cat-row:hover { background: var(--panel-2); }
.cat-row .num { text-align: right; min-width: 4.5rem; color: var(--muted); font-size: .88rem; }
.cat-row .num b { display: block; color: var(--ink); font-size: 1.05rem; }
.thread-row { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center; padding: .9rem 1.25rem; text-decoration: none; color: var(--ink); }
.thread-row:hover { background: var(--panel-2); }
.thread-row .side { text-align: right; color: var(--muted); font-size: .88rem; }
.thread-row .side b { color: var(--ink); font-weight: 600; }
.tag { display: inline-block; font-size: .75rem; font-weight: 600; padding: .05rem .45rem; border-radius: 2px; margin-right: .35rem; vertical-align: .1em; }
.tag-pin { background: var(--snow); color: var(--snow-ink); }
.tag-lock { background: var(--line); color: var(--ink); }
.badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: .05rem .4rem; border-radius: 2px; margin-left: .4rem; vertical-align: .1em; }
.badge-admin { background: var(--red-face); color: #fff; }
.badge-mod { background: var(--snow); color: var(--snow-ink); }
.badge-banned { background: #4a1424; color: #ffd6de; }

.post { display: grid; grid-template-columns: 11rem 1fr; border-bottom: 1px solid var(--line); }
.post:last-child { border-bottom: 0; }
.post-side { padding: 1.25rem; background: var(--panel-2); border-right: 1px solid var(--line); font-size: .9rem; color: var(--muted); }
.post-side a { font-weight: 600; font-size: 1rem; display: inline-block; overflow-wrap: anywhere; }
.post-main { padding: 1.25rem; min-width: 0; }
.post-meta { display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .85rem; margin-bottom: .75rem; flex-wrap: wrap; }
.post-actions { display: flex; gap: .25rem; margin-top: 1rem; }

/* ---------- текст статей и сообщений ---------- */
.prose { overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h2, .prose h3, .prose h4, .prose h5 { margin: 1.8em 0 .6em; }
.prose h2 { font-size: 1.3rem; }
.prose h3 { font-size: 1.1rem; }
.prose h4, .prose h5 { font-size: 1rem; }
.prose ul, .prose ol { padding-left: 1.4rem; margin: 0 0 1em; }
.prose li { margin: .25em 0; }
.prose li::marker { color: var(--red); }
.prose blockquote { margin: 0 0 1em; padding: .6rem 1rem; border-left: 4px solid var(--red); background: var(--panel-2); color: var(--ink); }
.prose code { font: 500 .9em var(--font-mono); background: var(--bg-deep); padding: .1em .4em; border-radius: 3px; color: #ffc2cf; }
.prose pre { background: var(--bg-deep); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; overflow-x: auto; margin: 0 0 1em; }
.prose pre code { background: none; padding: 0; color: var(--ink); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 1.5em 0; }
.prose img { max-width: 100%; height: auto; border-radius: var(--radius); }
.table-wrap { overflow-x: auto; margin: 0 0 1em; }
.prose table { border-collapse: collapse; min-width: 60%; }
.prose th, .prose td { border: 1px solid var(--line); padding: .5rem .8rem; text-align: left; vertical-align: top; }
.prose th { background: var(--panel-2); font-weight: 600; }

/* ---------- база знаний ---------- */
.kb-layout { display: grid; grid-template-columns: 15rem 1fr; gap: 2rem; align-items: start; }
.side-nav { position: sticky; top: 5rem; display: flex; flex-direction: column; gap: .15rem; }
.side-nav a { display: flex; justify-content: space-between; gap: .5rem; color: var(--muted); text-decoration: none; padding: .45rem .75rem; border-radius: var(--radius); font-weight: 500; }
.side-nav a:hover { background: var(--panel); color: var(--ink); }
.side-nav a[aria-current="true"] { background: var(--panel-2); color: var(--ink); box-shadow: inset 3px 0 0 var(--red); }
.side-nav small { color: var(--muted); }
.search { position: relative; margin-bottom: 1.5rem; }
.search input { width: 100%; font-size: 1.05rem; padding: .8rem 1rem; }
.kb-group + .kb-group { margin-top: 1.75rem; }
.kb-group h2 { margin-bottom: .75rem; font-size: 1.05rem; }
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 14rem; gap: 2.5rem; align-items: start; }
.article-layout .prose { max-width: 46rem; font-size: 1.04rem; line-height: 1.7; }
.toc { position: sticky; top: 5rem; font-size: .9rem; }
.toc p { color: var(--muted); font-weight: 600; margin-bottom: .5rem; }
.toc a { display: block; color: var(--muted); text-decoration: none; padding: .25rem 0 .25rem .75rem; border-left: 2px solid var(--line); cursor: pointer; }
.toc a.sub { padding-left: 1.5rem; }
.toc a:hover { color: var(--red-soft); border-left-color: var(--red); }

/* ---------- формы ---------- */
label { display: block; font-weight: 600; margin: 0 0 .35rem; }
input, textarea, select {
  font: inherit; color: var(--ink); background: var(--bg-deep);
  border: 2px solid var(--line); border-radius: var(--radius); padding: .6rem .8rem; width: 100%;
}
input::placeholder, textarea::placeholder { color: #947f8a; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--red); }
textarea { resize: vertical; min-height: 9rem; line-height: 1.5; }
textarea.editor { min-height: 22rem; font-family: var(--font-mono); font-size: .92rem; }
.field { margin-bottom: 1.1rem; }
.help { color: var(--muted); font-size: .88rem; margin: .35rem 0 0; }
.form-narrow { max-width: 26rem; }
.form-actions { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.error { color: var(--danger); font-weight: 500; min-height: 1.5em; margin: 0 0 .75rem; }
.notice { background: var(--panel-2); border-left: 4px solid var(--red); padding: .8rem 1rem; border-radius: var(--radius); margin-bottom: 1.5rem; }
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; }
.preview { border: 2px dashed var(--line); border-radius: var(--radius); padding: 1rem; min-height: 22rem; }
.preview > .help:only-child { margin: 0; }

.pager { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: 1.5rem; }
.pager a, .pager span { min-width: 2.2rem; text-align: center; padding: .35rem .6rem; border-radius: var(--radius); background: var(--panel); color: var(--ink); text-decoration: none; font-weight: 500; }
.pager a:hover { background: var(--panel-2); }
.pager span { background: var(--red-face); color: #fff; }
.pager .gap { background: none; color: var(--muted); min-width: 1rem; padding-inline: .2rem; }

table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: .7rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { color: var(--muted); font-weight: 600; font-size: .88rem; }
table.data select { width: auto; padding: .3rem .5rem; }
.scroll-x { overflow-x: auto; }
.stack { display: grid; gap: 2rem; }
.inline-form { display: flex; gap: .75rem; flex-wrap: wrap; align-items: end; }
.inline-form .field { margin: 0; flex: 1 1 12rem; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; margin: 0; }
.check input { width: auto; }

/* ---------- прочее ---------- */
.foot { border-top: 2px solid #0b080b; background: var(--bg-deep); color: var(--muted); padding: 1.5rem 0; font-size: .9rem; }
.skeleton { height: 8rem; border-radius: var(--radius); background: linear-gradient(90deg, var(--panel), var(--panel-2), var(--panel)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: grid; gap: .5rem; z-index: 50; max-width: calc(100vw - 2rem); }
.toast { background: var(--panel-2); border: 1px solid var(--line); border-left: 4px solid var(--red); padding: .7rem 1rem; border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.toast.err { border-left-color: var(--danger); }

@media (max-width: 52rem) {
  .cols, .kb-layout, .article-layout, .editor-grid { grid-template-columns: 1fr; }
  .side-nav, .toc { position: static; }
  .side-nav { flex-direction: row; flex-wrap: wrap; gap: .35rem; }
  .toc { order: -1; }
  .post { grid-template-columns: 1fr; }
  .post-side { border-right: 0; border-bottom: 1px solid var(--line); padding: .75rem 1.25rem; display: flex; gap: .75rem; align-items: baseline; flex-wrap: wrap; }
  .cat-row { grid-template-columns: 1fr auto; }
  .cat-row .num:nth-of-type(2) { display: none; }
  .account { margin-left: 0; width: 100%; }
  .hero { padding-top: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
