:root {
  --bg: #080c14; --bg2: #0d1422; --surface: #101828; --surface2: #141f30;
  --border: #1e3050; --border2: #2a4570; --accent: #4a9eff; --accent2: #2d6fd4; --accent-dim: #1a3a6a;
  --text: #dce8f8; --muted: #7d97b8; --link: #6ab4ff; --danger: #f87171;
  --font-ui: 'Exo 2', system-ui, sans-serif; --font-body: 'Inter', system-ui, sans-serif;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 15px; line-height: 1.55; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(1px 1px at 10% 15%, rgba(255,255,255,.5) 0, transparent 100%),
    radial-gradient(1px 1px at 25% 40%, rgba(255,255,255,.3) 0, transparent 100%),
    radial-gradient(1px 1px at 55% 8%, rgba(255,255,255,.4) 0, transparent 100%),
    radial-gradient(1px 1px at 75% 20%, rgba(255,255,255,.5) 0, transparent 100%),
    radial-gradient(1px 1px at 88% 60%, rgba(74,158,255,.35) 0, transparent 100%),
    radial-gradient(2px 2px at 42% 80%, rgba(74,158,255,.25) 0, transparent 100%);
}
.wrap { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; background: rgba(8,12,20,.6); min-height: 100vh; }
main { display: block; }

/* шапка */
.topbar { background: linear-gradient(180deg,#0a1628,#0d1a2e); border-bottom: 1px solid var(--border); padding: 0 14px; display: flex; align-items: center; gap: 10px; min-height: 52px; }
.logo { font-family: var(--font-ui); font-size: 1.08rem; font-weight: 700; color: var(--text); white-space: nowrap; flex-shrink: 0; }
.logo:hover { text-decoration: none; }
.logo span { color: var(--accent); }
.ask-topbar-btn {
  flex: 1; max-width: 240px; margin: 0 auto; border: none; border-radius: 6px; padding: 10px 18px; cursor: pointer;
  background: linear-gradient(90deg,#7c3aed,#4a9eff); color: #fff; font: 700 .88rem var(--font-ui); letter-spacing: .04em;
  box-shadow: 0 0 14px rgba(124,58,237,.55), 0 0 28px rgba(74,158,255,.25); transition: box-shadow .2s, transform .1s;
}
.ask-topbar-btn:hover { box-shadow: 0 0 20px rgba(124,58,237,.8), 0 0 40px rgba(74,158,255,.4); transform: translateY(-1px); }
.topbar-links { font-size: .74rem; display: flex; gap: 12px; white-space: nowrap; flex-shrink: 0; }
@media (max-width: 520px) {
  .topbar { flex-wrap: wrap; padding-top: 8px; }
  .topbar-links { margin-left: auto; }
  .ask-topbar-btn { order: 3; flex-basis: 100%; max-width: none; margin-bottom: 8px; }
}

/* тикер */
.ticker-wrap { background: #070b12; border-bottom: 1px solid var(--border); padding: 6px 14px; display: flex; gap: 10px; overflow: hidden; }
.ticker-label { font-size: .62rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); white-space: nowrap; border-right: 1px solid var(--border2); padding: 3px 10px 0 0; }
.ticker-lines { flex: 1; display: flex; flex-direction: column; gap: 3px; overflow: hidden; min-width: 0; }
.ticker-row { height: 20px; position: relative; overflow: hidden; }
.ticker-item { position: absolute; inset: 0 auto auto 0; width: 100%; opacity: 0; font-size: .76rem; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticker-row .ticker-item:first-child { opacity: 1; }
.ticker-item a { color: var(--text); }
.ticker-item a:hover { color: var(--accent); text-decoration: none; }
.tick-cat { font-size: .63rem; padding: 1px 6px; border-radius: 3px; margin-right: 6px; font-weight: 600; }
.cat-c1 { background: #1a2e52; color: #6ab4ff; } .cat-c2 { background: #2a1a3a; color: #c084fc; } .cat-c3 { background: #1a2e20; color: #4ade80; }
.cat-c4 { background: #2e1a1a; color: #f87171; } .cat-c5 { background: #2e2a1a; color: #fbbf24; } .cat-c6 { background: #1e2a1a; color: #a3e635; }
.cat-c7 { background: #1a2535; color: #38bdf8; } .cat-c8 { background: #2e1a2e; color: #e879f9; }

/* навигация и заголовки */
.breadcrumb { padding: 7px 14px; font-size: .74rem; color: var(--muted); border-bottom: 1px solid var(--border); background: var(--bg2); overflow-wrap: anywhere; }
.breadcrumb .sep { opacity: .6; }
.page-h1 { margin: 0; padding: 12px 14px 10px; font: 700 1.12rem/1.35 var(--font-ui); background: var(--bg2); border-bottom: 1px solid var(--border); }
.page-h1 span { display: block; font: 400 .76rem var(--font-body); color: var(--muted); margin-top: 3px; }

/* календарь на главной */
.moon { background: linear-gradient(180deg,#0c1426,#0a1020); border-bottom: 1px solid var(--border); padding: 12px 14px 14px; }
.moon-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.moon-head h2 { margin: 0; font: 700 .95rem var(--font-ui); }
.moon-head h2 a { color: var(--text); }
.moon-head .all { font-size: .72rem; white-space: nowrap; }
.moon-today { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--border2); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.moon-icon { font-size: 2.3rem; line-height: 1; filter: drop-shadow(0 0 8px rgba(200,220,255,.35)); }
.moon-phase { font: 700 .95rem var(--font-ui); }
.moon-day { font-size: .72rem; color: var(--muted); margin-bottom: 4px; }
.moon-do { font-size: .8rem; }
.moon-do a { font-weight: 600; }
.moon-week { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; }
.moon-cell { display: flex; flex-direction: column; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 5px 2px; color: var(--text); }
.moon-cell:hover { text-decoration: none; border-color: var(--border2); }
.moon-cell.today { border-color: var(--accent); box-shadow: 0 0 8px rgba(74,158,255,.35); }
.moon-cell .wd { font-size: .6rem; color: var(--muted); text-transform: uppercase; }
.moon-cell .d { font-size: .8rem; font-weight: 600; }
.moon-cell .e { font-size: 1.05rem; line-height: 1.3; }
.moon-cell .t { font-size: .56rem; color: var(--muted); }
.moon-note { font-size: .64rem; color: var(--muted); margin-top: 6px; }

/* разделы форума */
.section { border-bottom: 1px solid var(--border); }
.section-head { background: linear-gradient(90deg,#0e2245,#0a1830); border-bottom: 1px solid var(--border2); padding: 8px 14px; display: flex; align-items: center; gap: 8px; }
.section-title { margin: 0; font: 600 .95rem var(--font-ui); }
.section-title a { color: var(--text); }
.section-count { margin-left: auto; font-size: .68rem; color: var(--muted); white-space: nowrap; }
.forum-row { background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 14px; display: flex; align-items: flex-start; gap: 9px; cursor: pointer; transition: background .12s; }
.forum-row:hover, .forum-row.active { background: var(--surface2); }
.forum-folder { font-size: 1rem; margin-top: 2px; }
.forum-info { flex: 1; min-width: 0; }
.forum-name { margin: 0 0 2px; font-size: .92rem; font-weight: 600; }
.forum-desc { font-size: .74rem; color: var(--muted); margin-bottom: 4px; }
.forum-tags { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 4px; }
.ftag { padding: 1px 7px; border-radius: 3px; font-size: .64rem; background: #0d1e35; color: var(--muted); border: 1px solid var(--border); }
.forum-last { font-size: .74rem; color: var(--muted); }
.forum-stats { text-align: right; font-size: .66rem; color: var(--muted); min-width: 52px; }
.forum-stats strong { display: block; font-size: .9rem; color: var(--text); }
.answer-panel { display: none; background: #090f1c; border-bottom: 1px solid var(--border); padding: 11px 14px 13px 38px; }
.answer-panel.open { display: block; }
.ai-label { font-size: .68rem; color: var(--accent); letter-spacing: .04em; margin-bottom: 7px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ai-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 5px var(--accent); }
.ai-text { font-size: .85rem; }
.ai-text strong { display: block; color: var(--link); margin-bottom: 4px; }
.read-more { display: inline-block; margin-top: 8px; font-size: .78rem; font-weight: 600; }
.related { margin-top: 12px; padding-top: 8px; border-top: 1px dashed var(--border); }
.related-title { font-size: .66rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 4px; font-weight: 600; }
.related a { display: block; font-size: .8rem; padding: 3px 0; }
.related a::before { content: '→ '; color: var(--muted); }
.stats-bar { background: var(--surface); padding: 8px 14px; display: flex; flex-wrap: wrap; gap: 16px; font-size: .74rem; color: var(--muted); }
.stats-bar span { color: var(--text); font-weight: 600; }

/* контент страниц */
.content { padding: 12px 14px 18px; }
.content h2 { font: 700 1.05rem var(--font-ui); margin: 22px 0 8px; }
.content h3 { font-size: .95rem; margin: 16px 0 6px; }
.content p, .content li { font-size: .92rem; }
.content table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: .86rem; display: block; overflow-x: auto; }
.content th, .content td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; vertical-align: top; }
.content th { background: var(--surface2); }
.intro { color: #c4d4ea; }
.short-answer { background: linear-gradient(90deg,#10203c,#0f1a2e); border: 1px solid var(--border2); border-left: 3px solid var(--accent); border-radius: 6px; padding: 10px 12px; margin: 6px 0 4px; font-size: .95rem; }
.answer-body h2:first-child { margin-top: 16px; }
.cta { margin: 20px 0; padding: 12px; background: var(--surface); border: 1px solid var(--border2); border-radius: 8px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: .9rem; }
.ask-inline { border: none; border-radius: 6px; padding: 9px 14px; cursor: pointer; background: linear-gradient(90deg,#7c3aed,#4a9eff); color: #fff; font: 700 .82rem var(--font-ui); }
.q-list { list-style: none; padding: 0; margin: 0; }
.q-list li { padding: 12px 0; border-bottom: 1px solid var(--border); }
.q-list h3 { margin: 0 0 4px; font-size: .95rem; }
.q-list p { margin: 0 0 4px; color: #c4d4ea; font-size: .86rem; }
.q-meta { font-size: .7rem; color: var(--muted); }
.sub-list li, .plain-list li { margin: 5px 0; }
.siblings { font-size: .8rem; color: var(--muted); margin-top: 18px; }
.empty { color: var(--muted); }
.link-btn { background: none; border: none; color: var(--link); padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }
.comments { margin-top: 26px; border-top: 1px solid var(--border); }
.events { padding-left: 18px; }

/* календарь на странице */
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; margin: 10px 0 6px; }
.cal-wd { font-size: .64rem; color: var(--muted); text-align: center; text-transform: uppercase; }
.cal-cell { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 4px 2px; min-height: 58px; display: flex; flex-direction: column; align-items: center; }
.cal-cell.empty { background: none; border: none; }
.cal-cell.today { border-color: var(--accent); box-shadow: 0 0 8px rgba(74,158,255,.35); }
.cal-cell .d { font-size: .78rem; font-weight: 600; }
.cal-cell .e { font-size: 1.05rem; }
.cal-cell .t { font-size: .54rem; color: var(--muted); text-align: center; line-height: 1.1; }
.cal-cell.ph-n, .cal-cell.ph-f { background: #14223e; }

/* поиск и подвал */
.bottom-search { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 10px 14px; display: flex; gap: 8px; }
.search-input { flex: 1; min-width: 0; background: var(--bg2); border: 1px solid var(--border); border-radius: 4px; padding: 8px 11px; font: .86rem var(--font-body); color: var(--text); }
.search-btn { background: var(--accent2); border: none; border-radius: 4px; padding: 8px 14px; font: 600 .8rem var(--font-body); color: #fff; cursor: pointer; }
.site-footer { background: var(--bg2); padding: 14px; text-align: center; font-size: .72rem; color: var(--muted); line-height: 2; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }
.footer-hubs { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 12px; margin: 6px 0; }
.sitemap-link { display: inline-block; border: 1px solid var(--border); border-radius: 3px; padding: 0 8px; font-size: .64rem; }

/* окно вопроса */
.ask-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.ask-overlay[hidden] { display: none; }
.ask-modal { background: var(--surface); border: 1px solid var(--border2); border-radius: 12px 12px 0 0; padding: 16px 16px 24px; width: 100%; max-width: 760px; animation: slideup .2s ease; }
@keyframes slideup { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.ask-title { font: 700 1rem var(--font-ui); margin: 0 0 12px; display: flex; justify-content: space-between; }
.ask-close { background: none; border: none; color: var(--muted); font-size: 1.2rem; cursor: pointer; }
.ask-textarea { width: 100%; background: var(--bg2); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; font: .9rem var(--font-body); color: var(--text); resize: vertical; height: 96px; margin-bottom: 10px; }
.ask-submit { width: 100%; background: var(--accent2); border: none; border-radius: 6px; padding: 11px; font: 600 .9rem var(--font-body); color: #fff; cursor: pointer; }
.ask-submit[disabled] { opacity: .6; cursor: wait; }
.ask-note { font-size: .74rem; color: var(--muted); text-align: center; margin-top: 8px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* админка */
.admin { padding-bottom: 40px; }
.admin-card { display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--border2); border-radius: 8px; margin: 12px 14px; padding: 14px; }
.admin-card label { display: flex; flex-direction: column; gap: 4px; font-size: .78rem; color: var(--muted); }
.admin-card input, .admin-card textarea, .admin-card select { background: var(--bg2); border: 1px solid var(--border); border-radius: 5px; padding: 8px; color: var(--text); font: .88rem var(--font-body); }
.admin-meta { font-size: .72rem; color: var(--muted); }
.admin-actions, .admin-toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-toolbar { margin: 12px 14px; }
.admin-actions .ask-submit { width: auto; padding: 10px 18px; }
.btn-sec, .btn-danger { border: 1px solid var(--border2); background: var(--surface2); color: var(--text); border-radius: 6px; padding: 10px 14px; cursor: pointer; font: .84rem var(--font-body); }
.btn-danger { border-color: #7f1d1d; color: var(--danger); }
.admin-msg { margin: 12px 14px; padding: 10px 12px; background: var(--surface2); border-radius: 6px; font-size: .84rem; overflow-wrap: anywhere; }
.admin-msg.err { color: var(--danger); }
.admin-h2 { font: 700 1rem var(--font-ui); margin: 20px 14px 4px; }
.admin-pub { margin: 0 14px; padding-left: 18px; font-size: .86rem; }
.admin-pub li { margin: 6px 0; }
details summary { cursor: pointer; font-size: .8rem; color: var(--accent); }
