:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --panel: #ffffff;
  --text: #1f2328;
  --muted: #667085;
  --line: #d9dee7;
  --strong-line: #b7c0cc;
  --brand: #2f6fed;
  --brand-dark: #214ca3;
  --green: #2b7a4b;
  --amber: #b7791f;
  --rose: #b42345;
  --teal: #047481;
  --shadow: 0 16px 40px rgba(31, 35, 40, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(246, 244, 239, 0.96), rgba(246, 244, 239, 1)),
    repeating-linear-gradient(90deg, rgba(47, 111, 237, 0.05) 0 1px, transparent 1px 44px);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
}

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

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button {
  letter-spacing: 0;
}

.button.primary {
  border-color: transparent;
  background: var(--brand);
  color: #ffffff;
}

.button:focus-visible,
a:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(47, 111, 237, 0.28);
  outline-offset: 2px;
}

.site-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0 22px;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
  font-weight: 900;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: #1f2328;
  color: #ffffff;
  font-size: 13px;
  letter-spacing: 0;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.nav a {
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.nav a:hover,
.nav a[aria-current="page"] {
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 1px 0 var(--line);
}

.page-hero,
.forum-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 24px;
  align-items: stretch;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 12px;
  font-size: 56px;
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 14px;
  font-size: 22px;
  line-height: 1.2;
}

h3 {
  margin-bottom: 6px;
  font-size: 16px;
  line-height: 1.25;
}

.lead {
  max-width: 660px;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 18px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.visual-panel {
  position: relative;
  overflow: hidden;
  min-height: 260px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(47, 111, 237, 0.2), rgba(4, 116, 129, 0.16)),
    linear-gradient(180deg, #fdfdfc, #edf4ff);
}

.visual-panel::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(31, 35, 40, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(31, 35, 40, 0.1) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(0deg, rgba(31, 35, 40, 0.1) 1px, transparent 1px) 0 0 / 34px 34px;
}

.visual-card {
  position: absolute;
  display: grid;
  gap: 8px;
  width: min(72%, 320px);
  padding: 14px;
  border: 1px solid rgba(31, 35, 40, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 36px rgba(31, 35, 40, 0.1);
}

.visual-card.one {
  top: 32px;
  left: 24px;
}

.visual-card.two {
  right: 24px;
  bottom: 34px;
}

.visual-line {
  height: 10px;
  border-radius: 5px;
  background: #d5deed;
}

.visual-line.short {
  width: 58%;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 0;
}

.stat {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.stat strong {
  display: block;
  font-size: 24px;
  line-height: 1.1;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.forum-grid,
.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  margin-top: 24px;
}

.forum-list,
.thread-list,
.sidebar-stack {
  display: grid;
  gap: 14px;
}

.forum-card,
.thread-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(31, 35, 40, 0.04);
}

.forum-card,
.thread-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
}

.forum-card:hover,
.thread-card:hover {
  border-color: var(--strong-line);
  transform: translateY(-1px);
  transition: border-color 160ms ease, transform 160ms ease;
}

.forum-icon,
.avatar {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: #eaf0ff;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 900;
}

.forum-card p,
.thread-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.count {
  min-width: 92px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.panel {
  padding: 16px;
}

.panel + .panel {
  margin-top: 14px;
}

.tag-list,
.member-list,
.activity-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tag-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tag {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.member-list li,
.activity-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.member-list strong,
.activity-list strong {
  color: var(--text);
}

.tiny-avatar {
  display: grid;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 8px;
  background: #edf4ee;
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0 0;
}

.filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.filter.active {
  border-color: transparent;
  background: #1f2328;
  color: #ffffff;
}

.topic-modules {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.topic-module {
  display: grid;
  gap: 8px;
  min-height: 154px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(31, 35, 40, 0.04);
}

.topic-module:hover {
  border-color: var(--strong-line);
  transform: translateY(-1px);
  transition: border-color 160ms ease, transform 160ms ease;
}

.topic-module small {
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topic-module h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.topic-module p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.topic-module .meta {
  margin-top: auto;
}

.forum-tools,
.directory-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 170px auto;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.directory-tools {
  grid-template-columns: minmax(220px, 1fr) auto;
  margin: 18px 0 0;
}

.search-field,
.select-field,
.text-field,
.reply-box textarea,
.compose-dialog textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  letter-spacing: 0;
}

.search-field,
.select-field,
.text-field {
  padding: 8px 10px;
}

.select-field {
  appearance: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.thread-card.pinned {
  border-color: rgba(47, 111, 237, 0.38);
  background: linear-gradient(180deg, #ffffff, #f7faff);
}

.thread-card.read {
  background: rgba(255, 255, 255, 0.72);
}

.thread-card.read h2 {
  color: #4b5563;
}

.thread-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.mini-button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.mini-button:hover,
.mini-button.active {
  border-color: transparent;
  background: var(--brand);
  color: #ffffff;
}

.reply-box {
  display: none;
  grid-column: 2 / -1;
  gap: 10px;
  margin-top: -4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.reply-box.open {
  display: grid;
}

.reply-box textarea,
.compose-dialog textarea {
  min-height: 92px;
  resize: vertical;
  padding: 10px;
}

.reply-note {
  margin-top: 10px;
  padding: 10px;
  border-left: 3px solid var(--brand);
  background: rgba(47, 111, 237, 0.08);
  color: var(--muted);
  font-size: 14px;
}

.no-results {
  display: none;
  padding: 18px;
  border: 1px dashed var(--strong-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.no-results.show {
  display: block;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #edf4ff;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 900;
}

.theme-garden {
  --brand: #2b7a4b;
  --brand-dark: #1f5f3a;
}

.theme-garden .visual-panel {
  background:
    linear-gradient(120deg, rgba(83, 147, 90, 0.24), rgba(251, 249, 240, 0.22)),
    linear-gradient(135deg, #fbf9f0, #e7f4ea);
}

.theme-garden .forum-icon,
.theme-garden .avatar {
  background: #e8f5ec;
  color: #1f5f3a;
}

.theme-film {
  --brand: #b42345;
  --brand-dark: #8a1730;
}

.theme-film .visual-panel {
  background:
    repeating-linear-gradient(90deg, rgba(31, 35, 40, 0.16) 0 12px, transparent 12px 24px),
    linear-gradient(135deg, #fff5f5, #f9eef7);
}

.theme-film .forum-icon,
.theme-film .avatar {
  background: #fff0f3;
  color: #8a1730;
}

.theme-work {
  --brand: #047481;
  --brand-dark: #075c66;
}

.theme-work .visual-panel {
  background:
    linear-gradient(135deg, rgba(4, 116, 129, 0.24), rgba(183, 121, 31, 0.16)),
    linear-gradient(180deg, #f6ffff, #fff8eb);
}

.theme-work .forum-icon,
.theme-work .avatar {
  background: #e7f8fa;
  color: #075c66;
}

.theme-tech .visual-line:nth-child(2),
.theme-work .visual-line:nth-child(2) {
  background: #bfdbfe;
}

.theme-garden .visual-line:nth-child(2) {
  background: #bbf7d0;
}

.theme-film .visual-line:nth-child(2) {
  background: #fecdd3;
}

footer {
  margin-top: 30px;
  color: var(--muted);
  font-size: 13px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(31, 35, 40, 0.42);
}

.modal-backdrop.open {
  display: flex;
}

.compose-dialog {
  width: min(680px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(31, 35, 40, 0.22);
}

.compose-header,
.compose-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.compose-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.compose-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.field-row {
  display: grid;
  gap: 6px;
}

.field-row label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(360px, calc(100% - 36px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #1f2328;
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 14px 36px rgba(31, 35, 40, 0.18);
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 860px) {
  .page-hero,
  .forum-hero,
  .forum-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .stat-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topic-modules {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .forum-tools {
    grid-template-columns: 1fr 1fr;
  }

  .forum-tools .button {
    grid-column: 1 / -1;
  }

  .count {
    min-width: auto;
    text-align: left;
  }
}

@media (max-width: 620px) {
  .site-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 14px;
  }

  .topbar,
  .forum-card,
  .thread-card {
    align-items: stretch;
  }

  .topbar,
  .forum-card,
  .thread-card,
  .stat-row {
    grid-template-columns: 1fr;
  }

  .topbar,
  .forum-card,
  .thread-card {
    display: grid;
  }

  .nav {
    justify-content: flex-start;
  }

  .page-hero,
  .forum-hero {
    padding: 18px;
  }

  h1 {
    font-size: 34px;
  }

  .lead {
    font-size: 16px;
  }

  .visual-panel {
    min-height: 210px;
  }

  .tag-list {
    grid-template-columns: 1fr;
  }

  .topic-modules {
    grid-template-columns: 1fr;
  }

  .forum-tools,
  .directory-tools {
    grid-template-columns: 1fr;
  }

  .reply-box {
    grid-column: 1 / -1;
  }
}
