:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #eef4ff;
  --surface-3: #f8fbff;
  --text: #18212f;
  --muted: #677489;
  --border: #dce5f0;
  --accent: #1d4ed8;
  --accent-strong: #1e40af;
  --success: #15803d;
  --danger: #dc2626;
  --shadow: 0 12px 40px rgba(15, 23, 42, .08);
  --radius: 22px;
}
html[data-theme="dark"] {
  --bg: #09101b;
  --surface: #101927;
  --surface-2: #162438;
  --surface-3: #0f1d2e;
  --text: #ecf2fb;
  --muted: #9bb0c9;
  --border: #22314a;
  --shadow: 0 14px 50px rgba(0,0,0,.4);
}
* { box-sizing: border-box; }
body { margin:0; font:16px/1.72 Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background:linear-gradient(180deg,var(--bg),color-mix(in srgb,var(--bg) 92%, #fff)); color:var(--text); }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width:100%; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.container { width:min(1180px, calc(100% - 32px)); margin:0 auto; }
.site-header { position:sticky; top:0; z-index:20; backdrop-filter: blur(14px); background: color-mix(in srgb, var(--bg) 78%, transparent); border-bottom:1px solid var(--border); }
.topbar { display:grid; grid-template-columns: 1fr auto auto; gap:20px; align-items:center; padding:18px 0; }
.brand-box { min-width: 0; }
.site-title a { font-size:1.25rem; font-weight:800; color:var(--text); }
.site-tagline { color:var(--muted); font-size:.95rem; }
.main-nav { display:flex; gap:16px; flex-wrap:wrap; }
.main-nav a { color:var(--text); font-weight:600; }
.theme-toggle { border:1px solid var(--border); background:var(--surface); color:var(--text); min-width:44px; height:44px; padding:0 12px; border-radius:999px; cursor:pointer; box-shadow:var(--shadow); display:flex; align-items:center; gap:6px; }
.main-shell { padding:32px 0 48px; }
.hero-card, .card, .post-card, .article-card, .filter-card, .auth-card, .admin-panel, .mini-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow); }
.soft-card { background: linear-gradient(180deg, var(--surface), var(--surface-3)); }
.hero-card { display:flex; justify-content:space-between; gap:24px; padding:30px; margin-bottom:24px; }
.eyebrow { text-transform:uppercase; letter-spacing:.12em; color:var(--accent-strong); font-weight:700; font-size:.78rem; }
.hero-card h1, .article-head h1, .card h1 { margin:.25rem 0 .5rem; font-size:clamp(2rem, 4vw, 3rem); line-height:1.08; }
.hero-card p { max-width: 760px; }
.hero-stats { display:grid; grid-template-columns: repeat(3, minmax(90px,1fr)); gap:12px; min-width:320px; }
.hero-stats div { background:var(--surface-2); border-radius:18px; padding:18px; text-align:center; }
.hero-stats span { display:block; font-size:1.75rem; font-weight:800; }
.hero-stats small { color:var(--muted); }
.layout-grid { display:grid; grid-template-columns: minmax(0, 1fr) 320px; gap:24px; }
.filter-card, .article-card, .card { padding:24px; }
.form-grid { display:grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap:14px; }
.compact-grid { margin-bottom:16px; }
label { display:grid; gap:8px; font-weight:600; color:var(--muted); }
input, textarea, select { width:100%; padding:12px 14px; border-radius:14px; border:1px solid var(--border); background:var(--surface); color:var(--text); }
textarea { resize:vertical; }
.btn { display:inline-flex; align-items:center; justify-content:center; gap:8px; border-radius:14px; border:1px solid var(--border); padding:11px 16px; font-weight:700; cursor:pointer; background:var(--surface); color:var(--text); text-decoration:none; }
.btn.primary { background:var(--accent); color:white; border-color:transparent; }
.btn.ghost { background:transparent; }
.btn.danger { background:var(--danger); color:white; border-color:transparent; }
.btn.small { padding:8px 11px; font-size:.88rem; }
.actions-row { display:flex; flex-wrap:wrap; gap:12px; align-items:center; }
.post-card { padding:24px; margin-top:16px; }
.post-card.compact { margin-top:12px; }
.post-card h2, .mini-card h3 { margin:.4rem 0 .5rem; line-height:1.2; }
.post-card-meta { display:flex; flex-wrap:wrap; gap:12px; color:var(--muted); font-size:.92rem; }
.tag-list { display:flex; flex-wrap:wrap; gap:10px; margin-top:14px; }
.tag-pill { display:inline-flex; align-items:center; gap:8px; padding:8px 12px; border-radius:999px; background:var(--surface-2); color:var(--text); font-size:.92rem; }
.tag-pill span { color:var(--muted); }
.sidebar-card { margin-bottom:16px; }
.sidebar-links { margin:0; padding-left:18px; }
.pagination { display:flex; flex-wrap:wrap; gap:10px; margin-top:24px; }
.pagination a { width:42px; height:42px; border-radius:12px; display:grid; place-items:center; background:var(--surface); border:1px solid var(--border); color:var(--text); }
.pagination .is-active { background:var(--accent); color:#fff; border-color:transparent; }
.article-head { margin-bottom:22px; }
.prose { font-size:1.06rem; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre { margin:1rem 0; }
.prose h2, .prose h3 { margin-top:1.8rem; }
.prose blockquote { padding:12px 16px; border-left:4px solid var(--accent); background:var(--surface-2); border-radius:12px; }
.prose pre { padding:16px; overflow:auto; background:#0f172a; color:#e5e7eb; border-radius:16px; }
.prose table { width:100%; border-collapse:collapse; }
.prose th, .prose td { border:1px solid var(--border); padding:10px 12px; }
.breadcrumbs { color:var(--muted); margin-bottom:10px; }
.author-box { margin-top:24px; display:flex; justify-content:space-between; gap:20px; align-items:flex-start; }
.author-box h2 { margin:.25rem 0 .5rem; }
.share-panel { margin-top:24px; }
.share-buttons { display:flex; flex-wrap:wrap; gap:10px; }
.share-btn { display:inline-flex; align-items:center; gap:10px; padding:12px 14px; border-radius:16px; border:1px solid var(--border); background:var(--surface); color:var(--text); cursor:pointer; text-decoration:none; box-shadow: inset 0 0 0 1px transparent; }
.share-btn:hover { text-decoration:none; border-color:var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.share-btn.is-done { border-color: var(--success); }
.share-icon { width:20px; height:20px; display:inline-flex; align-items:center; justify-content:center; }
.share-icon svg { width:20px; height:20px; display:block; }
.hint, .muted { color:var(--muted); font-size:.92rem; margin-top:12px; }
.related-section { margin-top:24px; padding:24px; }
.related-grid { display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:16px; }
.mini-card { padding:18px; }
.section-head { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:16px; }
.archive-list { display:grid; gap:18px; }
.comments-section { margin-top:24px; }
#vk_comments, #vk_like { margin-top: 16px; }
.site-footer { border-top:1px solid var(--border); margin-top:40px; padding:30px 0 50px; }
.footer-grid { display:grid; grid-template-columns: 1fr auto; gap:24px; align-items:start; }
.footer-links { display:flex; gap:16px; flex-wrap:wrap; margin-bottom:10px; }
.not-found { text-align:center; padding:50px 24px; }
.admin-body { background:var(--bg); }
.auth-card { width:min(560px, calc(100% - 32px)); margin:7vh auto; padding:28px; }
.stack-form { display:grid; gap:14px; }
.notice { padding:14px 16px; border-radius:14px; margin-bottom:16px; }
.notice.success { background: color-mix(in srgb, var(--success) 14%, var(--surface)); color: var(--success); }
.notice.error { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); }
.admin-layout { display:grid; grid-template-columns: 280px 1fr; min-height:100vh; }
.admin-sidebar { padding:24px; border-right:1px solid var(--border); background:var(--surface); }
.admin-sidebar nav { display:grid; gap:10px; margin:18px 0 26px; }
.admin-content { padding:24px; }
.admin-panel { padding:24px; }
.admin-panel-head { margin-bottom:18px; }
.editor-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
.editor-grid .full { grid-column: 1 / -1; }
.toolbar { display:flex; flex-wrap:wrap; gap:10px; }
.table-card { overflow:auto; }
.admin-table { width:100%; border-collapse:collapse; }
.admin-table th, .admin-table td { padding:12px 10px; border-bottom:1px solid var(--border); text-align:left; vertical-align:top; }
.actions-inline { display:flex; gap:10px; flex-wrap:wrap; }
.compact-form { margin-top:18px; }
@media (max-width: 980px) {
  .topbar, .layout-grid, .footer-grid, .admin-layout, .hero-card, .author-box { grid-template-columns: 1fr; display:grid; }
  .hero-stats, .related-grid, .editor-grid, .form-grid { grid-template-columns: 1fr; }
}


.autopost-box{border:1px solid var(--line,#d0d7de);border-radius:16px;padding:16px;background:rgba(59,130,246,.04)}
.checkbox-inline{display:inline-flex;align-items:center;gap:8px;margin-right:18px;margin-bottom:8px}
.muted{opacity:.75;font-size:.95rem}
.inline-form{display:inline}
.actions-inline{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
small{font-size:.8rem;line-height:1.4}
.auth-card--clean h1 { margin-top: 0; }
.auth-form input { min-height: 46px; }
.field-actions { display:block; margin-top:8px; }
.media-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.import-card { gap:18px; }
.import-note ul { margin:0; padding-left:18px; }
.prose img { max-width:100%; height:auto; border-radius:18px; display:block; margin:1rem auto; }
input[type="file"] { min-height: 46px; }
@media (max-width: 720px) {
  .media-grid { grid-template-columns:1fr; }
}


.social-strip{display:flex;gap:14px;flex-wrap:wrap;align-items:center;padding:0 0 14px;color:var(--muted);font-size:.92rem}
.social-strip a{color:var(--muted);font-weight:600}
.social-strip__meta{margin-left:auto}
.social-strip__sep{opacity:.5}
.footer-meta p{margin:.35rem 0}
.info-strip{margin-top:24px;display:grid;gap:10px}
.info-strip__links{display:flex;flex-wrap:wrap;gap:14px}
.social-follow{margin-top:24px}
.social-pills .tag-pill{font-weight:600}
.admin-bulkbar{margin-bottom:14px}
@media (max-width:980px){
  .social-strip{padding-bottom:12px}
  .social-strip__meta{margin-left:0}
}

.post-card h2 a, .mini-card h3 a, .sidebar-links--tight a { overflow-wrap:anywhere; word-break:break-word; }
.sidebar-links--tight li { margin-bottom: .55rem; }
.sidebar-links--tight a { display:inline-block; max-width:100%; }
.pagination-gap { display:grid; place-items:center; width:28px; color:var(--muted); }
.archive-day { border-top:1px solid var(--border); padding-top:10px; margin-top:10px; }
.archive-day summary { cursor:pointer; font-weight:700; margin-bottom:8px; }
.spoiler { background:color-mix(in srgb, var(--text) 16%, transparent); color:transparent; border-radius:6px; padding:0 .25em; transition:.2s; }
.spoiler:hover, .spoiler:focus { color:inherit; }
.thread-box { margin-top:12px; }
.reactions-box { margin-top:24px; }
.reactions-grid { display:grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap:10px; }
.reaction-btn { width:100%; border:1px solid var(--border); background:var(--surface-2); color:var(--text); border-radius:16px; padding:12px; display:grid; gap:4px; justify-items:center; cursor:pointer; }
.reaction-btn strong { font-size:1.1rem; }
.reaction-btn small { color:var(--muted); }
@media (max-width: 720px) { .reactions-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }


.source-box{margin-top:24px}
.source-box__meta{display:flex;flex-wrap:wrap;gap:10px;margin-bottom:14px}
.share-buttons{align-items:stretch}
.share-btn{min-height:48px;padding:10px 12px;font-size:.95rem}
.share-btn span:last-child{white-space:nowrap}
@media (max-width: 720px){
  .share-buttons{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
  .share-btn{width:100%;justify-content:center}
  .social-strip{display:grid;grid-auto-flow:column;grid-auto-columns:max-content;overflow-x:auto;overscroll-behavior-x:contain;padding-bottom:10px;white-space:nowrap}
  .social-strip__sep,.social-strip__meta{display:none}
}

.topbar{display:flex;justify-content:space-between;gap:16px;align-items:flex-start}
.topnav{display:flex;flex-wrap:wrap;gap:12px;justify-content:flex-end}
.topnav a,.brand{font-weight:700}
.brand-tagline{margin:.35rem 0 0;color:var(--muted)}
.main-shell{overflow-x:hidden}
.card,.post-card,.article-card,.mini-card,.tag-pill,.share-btn,.reaction-btn,input,textarea,select{box-sizing:border-box}
.article-content,.post-card,.mini-card,.sidebar-card,.card{overflow-wrap:anywhere;word-break:break-word}
img,video,iframe,table{max-width:100%}
.post-card p,.mini-card p{margin:.75rem 0 0}
.preview-footer{display:flex;justify-content:space-between;gap:14px;align-items:center;flex-wrap:wrap;margin-top:14px}
.mini-reactions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.mini-reactions span{display:inline-flex;align-items:center;gap:6px;padding:6px 10px;border-radius:999px;background:var(--surface-2);font-size:.88rem}
.post-more{font-weight:700}
.taxonomy-listing,.taxonomy-posts,.taxonomy-tree{padding:24px}
.taxonomy-pills .tag-pill{font-weight:600}
.thread-tree{display:grid;gap:14px}
.thread-node{padding:16px;border:1px solid var(--border);border-radius:18px;background:var(--surface)}
.thread-depth-3{margin-left:18px}.thread-depth-4{margin-left:36px}.thread-depth-5{margin-left:54px}.thread-depth-6{margin-left:72px}.thread-depth-7{margin-left:90px}.thread-depth-8{margin-left:108px}
.mobile-filter-head{display:none;margin-bottom:12px}
#vk_comments iframe,#vk_like iframe{max-width:100% !important}
.source-box .btn{max-width:100%}
@media (max-width: 980px){
  .topbar,.layout-grid,.footer-grid,.admin-layout,.hero-card,.author-box{display:grid;grid-template-columns:1fr}
  .topnav{justify-content:flex-start}
}
@media (max-width: 720px){
  body{font-size:15px}
  .container{padding-inline:12px}
  .hero-card,.filter-card,.article-card,.card,.post-card,.related-section,.taxonomy-listing,.taxonomy-posts,.taxonomy-tree{padding:16px}
  .topnav{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .topnav a{padding:10px 12px;border:1px solid var(--border);border-radius:12px;background:var(--surface)}
  .mobile-filter-head{display:flex;justify-content:space-between;gap:8px;align-items:center}
  .preview-footer{align-items:flex-start}
  .thread-depth-3,.thread-depth-4,.thread-depth-5,.thread-depth-6,.thread-depth-7,.thread-depth-8{margin-left:0}
  .hero-stats{min-width:0}
  .share-buttons{grid-template-columns:1fr 1fr}
}
@media (max-width: 480px){
  .share-buttons,.reactions-grid,.related-grid{grid-template-columns:1fr}
  .topnav{grid-template-columns:1fr}
  .post-card-meta{gap:8px}
}


.page-content{display:block}
.header-actions{display:flex;align-items:center;gap:10px}
.nav-toggle{display:none;border:1px solid var(--border);background:var(--surface);color:var(--text);min-height:44px;padding:0 14px;border-radius:999px;cursor:pointer;box-shadow:var(--shadow);font-weight:700}
.topnav,.social-strip{min-width:0}
.social-strip{border-top:1px solid var(--border);padding-top:14px}
@media (max-width: 980px){
  .site-header{position:static}
  .topbar{display:grid;grid-template-columns:1fr auto;align-items:start}
  .topnav{grid-column:1 / -1}
}
@media (max-width: 720px){
  .header-actions{justify-content:flex-end}
  .nav-toggle{display:inline-flex;align-items:center;justify-content:center}
  .theme-toggle{min-width:auto;padding:0 14px}
  [data-nav-panel]{display:none}
  body.nav-open [data-nav-panel], [data-nav-panel].is-open{display:flex}
  .topnav.is-open{display:grid;grid-template-columns:1fr 1fr;gap:8px}
  .social-strip.is-open{display:grid;grid-template-columns:1fr;gap:10px;white-space:normal;overflow:visible;padding-top:12px}
  .social-strip.is-open a{overflow-wrap:anywhere}
  .social-strip.is-open .social-strip__sep{display:none}
  .social-strip.is-open .social-strip__meta{display:block;margin-left:0}
}

.btn.danger{background:var(--danger);color:#fff;border-color:var(--danger)}
.btn.danger:hover{filter:brightness(.95)}
.topnav a{min-height:44px;display:inline-flex;align-items:center}
label.checkbox-inline{padding:.35rem 0}
datalist{display:none}
@supports not (color: color-mix(in srgb, white 50%, black)){
  .notice.success{background:rgba(20,140,80,.08)}
  .notice.error{background:rgba(180,40,40,.08)}
}
