:root {
  color-scheme: light;
  --bg: #0a0a0a;
  --surface: #151515;
  --surface-soft: #202020;
  --ink: #f4f4f5;
  --muted: #a1a1aa;
  --line: #303030;
  --accent: #ff9900;
  --accent-strong: #ffb22e;
  --blue: #ff9900;
  --green: #facc15;
  --shadow: 0 18px 42px rgba(0, 0, 0, .36);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #050505 0, #0d0d0d 280px, var(--bg) 100%);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--accent-strong);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 12px;
  z-index: 20;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
}

.skip-link:focus {
  left: 12px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid #2b2b2b;
  background: rgba(0, 0, 0, .97);
  backdrop-filter: blur(12px);
}

.navbar {
  min-height: 72px;
}

.navbar-toggler {
  border-color: rgba(255, 255, 255, .24);
}

.navbar-toggler-icon {
  filter: invert(1);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0;
  min-width: max-content;
  color: #fff;
  font-weight: 900;
  font-size: 26px;
  line-height: 1;
  letter-spacing: 0;
}

.brand:hover {
  color: #fff;
}

.brand-mark {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  border-radius: 6px;
  background: var(--accent);
  color: #000;
  padding: 4px 8px 5px;
  font-size: 26px;
  font-weight: 950;
  letter-spacing: 0;
}

.brand-text {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  padding: 4px 8px 5px 0;
  letter-spacing: .02em;
}

.search-form {
  display: flex;
  gap: 8px;
  width: min(470px, 100%);
  margin: 0 auto;
}

.search-form .form-control {
  border: 1px solid #333;
  border-radius: 6px;
  background: #1c1c1c;
  color: #fff;
}

.search-form .form-control::placeholder {
  color: rgba(255, 255, 255, .68);
}

.btn {
  border-radius: 6px;
  font-weight: 700;
}

.btn-accent {
  border: 0;
  background: var(--accent);
  color: #000;
}

.btn-accent:hover {
  background: var(--accent-strong);
  color: #000;
}

.btn-ghost {
  border: 1px solid #3a3a3a;
  color: #fff;
  background: #151515;
}

.btn-ghost:hover {
  border-color: rgba(255, 255, 255, .4);
  color: #fff;
}

.nav-links {
  gap: 2px;
  margin-left: 24px;
}

.nav-link {
  color: rgba(255, 255, 255, .72);
  font-weight: 700;
}

.nav-link:hover,
.nav-link.active {
  color: var(--accent);
}

.auth-actions {
  display: flex;
  gap: 8px;
  margin-left: 16px;
}

.hero-section {
  background:
    radial-gradient(circle at 80% 20%, rgba(255, 153, 0, .22), transparent 34%),
    linear-gradient(115deg, rgba(0, 0, 0, .98), rgba(18, 18, 18, .88)),
    url("/img/fon.png") center / cover;
  color: #fff;
  border-bottom: 1px solid #292929;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 32px;
  align-items: end;
  min-height: 360px;
  padding-top: 56px;
  padding-bottom: 56px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 860px;
  margin-bottom: 16px;
  font-size: clamp(34px, 5vw, 62px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  font-size: 24px;
  line-height: 1.2;
}

h3 {
  font-size: 22px;
  line-height: 1.28;
}

.hero-text {
  max-width: 680px;
  color: rgba(255, 255, 255, .82);
  font-size: 18px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.hero-panel {
  display: grid;
  gap: 12px;
  padding: 20px;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  background: rgba(0, 0, 0, .68);
}

.hero-panel div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.hero-panel strong {
  font-size: 26px;
}

.hero-panel span {
  color: rgba(255, 255, 255, .74);
}

.layout-grid {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 280px;
  gap: 20px;
  align-items: start;
  padding-top: 28px;
  padding-bottom: 44px;
}

.side-block,
.post-card,
.feed-head {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.side-block {
  padding: 18px;
  margin-bottom: 16px;
}

.side-block h2 {
  margin-bottom: 14px;
  font-size: 18px;
}

.topic-list,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.topic-list a,
.tag-row a {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border-radius: 999px;
  border: 1px solid #333;
  background: #0e0e0e;
  color: #d4d4d8;
  font-size: 14px;
  font-weight: 700;
}

.topic-list a {
  padding: 5px 10px;
}

.tag-row a {
  padding: 4px 9px;
}

.side-link,
.trend,
.question-link {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  color: #f4f4f5;
  font-weight: 700;
}

.trend span,
.question-link strong,
.cta p {
  color: var(--muted);
  font-weight: 500;
}

.question-link {
  align-items: flex-start;
  flex-direction: column;
}

.question-link span {
  font-weight: 750;
}

.question-link strong {
  font-size: 13px;
}

.digest-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.digest-list a {
  color: #f4f4f5;
  font-weight: 650;
}

.highlight {
  border-top: 4px solid var(--accent);
}

.feed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 18px 22px;
}

.feed-head h2 {
  margin-bottom: 0;
}

.feed-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.feed-tabs a {
  min-width: max-content;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 800;
}

.feed-tabs a.active {
  background: var(--accent);
  color: #000;
}

.post-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  margin-bottom: 14px;
  overflow: hidden;
}

.vote-rail {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 8px;
  padding: 18px 8px;
  background: #0f0f0f;
  color: var(--muted);
}

.vote-rail button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #191919;
  color: var(--accent);
  line-height: 1;
}

.vote-rail strong {
  color: var(--accent);
  font-size: 18px;
}

.post-body {
  padding: 20px 22px;
}

.post-meta,
.post-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.post-meta {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 14px;
}

.post-meta a {
  color: var(--blue);
  font-weight: 800;
}

.post-body h3 {
  margin-bottom: 10px;
}

.post-body h3 a:hover {
  color: var(--accent);
}

.post-body p {
  margin-bottom: 16px;
  color: #d4d4d8;
}

.post-footer {
  justify-content: space-between;
}

.comments-link {
  color: var(--muted);
  font-weight: 800;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 22px;
}

.pager a {
  display: inline-flex;
  min-width: 42px;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: #f4f4f5;
  font-weight: 800;
}

.pager a.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #000;
}

.pager a[aria-disabled="true"] {
  opacity: .48;
  pointer-events: none;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: #050505;
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 22px;
  padding-bottom: 22px;
}

.footer-grid p {
  margin: 0;
  color: var(--muted);
}

.footer-grid nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.legacy-page {
  min-height: calc(100vh - 170px);
  padding-bottom: 44px;
}

.legacy-page > .r35:first-child {
  height: 28px;
}

.legacy-page .container > .row {
  align-items: flex-start;
  gap: 0;
}

.legacy-page .yap,
.legacy-page .novosti_i_sobytiya,
.legacy-page .row > [class*="col-"][style*="background"] {
  border: 1px solid var(--line) !important;
  border-radius: 6px;
  background: var(--surface) !important;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.legacy-page .yap {
  padding: 18px !important;
}

.legacy-page .yap h2,
.legacy-page .novosti_i_sobytiya h1,
.legacy-page .novosti_i_sobytiya h2,
.legacy-page .row > [class*="col-"][style*="background"] h2 {
  color: #fff;
}

.legacy-page .yap a {
  display: inline-flex;
  width: 100%;
  min-height: 32px;
  align-items: center;
  margin: 2px 0;
  padding: 5px 9px;
  border: 1px solid #333;
  border-radius: 6px;
  background: #0f0f0f;
  color: #e4e4e7;
  font-weight: 700;
}

.legacy-page .yap a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.legacy-page .novosti_i_sobytiya {
  padding: 24px !important;
}

.legacy-page .statya {
  border: 1px solid var(--line);
  border-radius: 6px !important;
  background: #101010 !important;
  padding: 22px !important;
}

.legacy-page .statya + .r30 {
  height: 18px;
}

.legacy-page .statya h1 {
  margin-bottom: 10px;
  color: #fff;
  font-size: 24px;
}

.legacy-page .statya img,
.legacy-page .carousel img,
.legacy-page .novosti_i_sobytiya img {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #2b2b2b;
}

.legacy-page .statya p,
.legacy-page .novosti_i_sobytiya p,
.legacy-page .novosti_i_sobytiya li {
  color: #d4d4d8;
}

.legacy-page .novosti_i_sobytiya a,
.legacy-page .row > [class*="col-"][style*="background"] a {
  color: var(--accent);
  font-weight: 800;
}

.legacy-page .row > [class*="col-"][style*="background"] {
  padding: 18px !important;
}

.legacy-page .row > [class*="col-"][style*="background"] p {
  color: #d4d4d8;
}

.legacy-page .carousel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101010;
}

.legacy-page .carousel-item {
  padding: 14px;
}

.legacy-page .carousel-item a {
  display: block;
  padding: 12px 0 2px;
  font-size: 20px;
}

.legacy-page .form-control,
.legacy-page .form-select,
.modal-content .form-control {
  border: 1px solid #333;
  border-radius: 6px;
  background: #111;
  color: #fff;
}

.legacy-page .form-control:focus,
.legacy-page .form-select:focus,
.modal-content .form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 .2rem rgba(255, 153, 0, .18);
}

.legacy-page .btn-primary,
.legacy-page .btn-warning,
.btn-header {
  border: 0 !important;
  border-radius: 6px !important;
  background: var(--accent) !important;
  color: #000 !important;
  font-weight: 800;
}

.legacy-page .pagination {
  gap: 8px;
}

.legacy-page .page-link {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #151515;
  color: #fff;
}

.legacy-page .page-link:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: #000;
}

.modal-content {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}

.modal-header,
.modal-footer {
  border-color: var(--line);
}

.btn-close {
  filter: invert(1);
}

.hub-editor-source {
  display: none;
}

.hub-editor {
  overflow: hidden;
  border: 1px solid #333;
  border-radius: 6px;
  background: #0f0f0f;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), 0 18px 38px rgba(0, 0, 0, .24);
}

.hub-editor-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border-bottom: 1px solid #333;
  background: linear-gradient(180deg, #181818, #0f0f0f);
}

.hub-editor-select {
  min-height: 36px;
  border: 1px solid #333;
  border-radius: 6px;
  background: #0a0a0a;
  color: #fff;
  padding: 0 10px;
  font-weight: 800;
}

.hub-editor-stats {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.hub-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  border-bottom: 1px solid #333;
  background: #050505;
}

.hub-editor-group {
  display: inline-flex;
  gap: 6px;
  padding-right: 8px;
  border-right: 1px solid #2b2b2b;
}

.hub-editor-group:last-child {
  border-right: 0;
}

.hub-editor-button {
  display: inline-flex;
  min-width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid #333;
  border-radius: 6px;
  background: #171717;
  color: #fff;
  font-weight: 900;
  line-height: 1;
  transition: border-color .15s ease, background .15s ease, color .15s ease, transform .15s ease;
}

.hub-editor-button:hover,
.hub-editor-button:focus,
.hub-editor-button.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #000;
}

.hub-editor-button:hover {
  transform: translateY(-1px);
}

.hub-editor-button-wide {
  min-width: 46px;
}

.hub-editor-canvas {
  min-height: 280px;
  padding: 26px;
  color: #f4f4f5;
  outline: none;
  font-size: 17px;
  line-height: 1.7;
  background:
    linear-gradient(90deg, rgba(255, 153, 0, .08) 0, transparent 3px),
    #0f0f0f;
}

.hub-editor-canvas:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
}

.hub-editor-canvas h2 {
  margin: 18px 0 10px;
  color: #fff;
  font-size: 26px;
}

.hub-editor-canvas h3 {
  margin: 16px 0 8px;
  color: #fff;
  font-size: 22px;
}

.hub-editor-canvas p {
  margin-bottom: 14px;
}

.hub-editor-canvas pre {
  overflow-x: auto;
  padding: 14px;
  border: 1px solid #333;
  border-radius: 6px;
  background: #050505;
  color: #facc15;
}

.hub-editor-canvas blockquote {
  margin: 16px 0;
  padding: 12px 16px;
  border-left: 4px solid var(--accent);
  background: #171717;
  color: #e4e4e7;
}

.hub-editor-canvas img {
  max-width: 100%;
  height: auto;
  margin: 12px 0;
  border-radius: 6px;
  border: 1px solid #333;
}

.hub-editor-canvas figure {
  margin: 16px 0;
}

.hub-editor-canvas figcaption {
  color: var(--muted);
  font-size: 13px;
}

.hub-editor-html {
  width: 100%;
  min-height: 220px;
  border: 0;
  border-top: 1px solid #333;
  background: #050505;
  color: #facc15;
  padding: 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  outline: none;
}

@media (max-width: 1199px) {
  .layout-grid {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .right-sidebar {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }

  .right-sidebar .side-block {
    margin-bottom: 0;
  }
}

@media (max-width: 991px) {
  .navbar-collapse {
    padding: 18px 0;
  }

  .search-form,
  .auth-actions,
  .nav-links {
    width: 100%;
    margin: 12px 0 0;
  }

  .auth-actions {
    flex-wrap: wrap;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .layout-grid {
    grid-template-columns: 1fr;
  }

  .left-sidebar,
  .right-sidebar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .left-sidebar .side-block,
  .right-sidebar .side-block {
    margin-bottom: 0;
  }
}

@media (max-width: 640px) {
  .brand {
    font-size: 21px;
  }

  .brand-mark,
  .brand-text {
    min-height: 31px;
    font-size: 21px;
  }

  .hero-grid {
    padding-top: 36px;
    padding-bottom: 36px;
  }

  .search-form,
  .feed-head,
  .post-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .left-sidebar,
  .right-sidebar {
    grid-template-columns: 1fr;
  }

  .post-card {
    grid-template-columns: 1fr;
  }

  .vote-rail {
    grid-template-columns: repeat(3, max-content);
    align-items: center;
    justify-content: start;
    padding: 12px 16px;
  }

  .post-body {
    padding: 18px 16px;
  }
}
