:root {
  --bg: #eef8ff;
  --bg-2: #dff2ff;
  --surface: rgb(255 255 255 / 82%);
  --surface-solid: #ffffff;
  --line: #d6e9f7;
  --text: #08223a;
  --soft: #45647c;
  --muted: #6d8aa2;
  --blue: #078cff;
  --blue-2: #00b7ff;
  --blue-3: #005fd1;
  --cyan: #6ee7ff;
  --danger: #ff3263;
  --success: #10b95c;
  --warning: #f5c542;
  --shadow: 0 24px 70px rgb(19 111 189 / 16%);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  max-width: 100vw;
  overflow-x: hidden;
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  background:
    radial-gradient(circle at 12% 8%, rgb(255 255 255 / 95%) 0 16rem, transparent 34rem),
    radial-gradient(circle at 90% 0, rgb(0 183 255 / 22%) 0 17rem, transparent 35rem),
    linear-gradient(180deg, #f7fcff 0, var(--bg) 28rem, #eaf8ff 100%);
}

a {
  color: var(--blue-3);
  text-decoration: none;
}

a:hover {
  color: var(--blue);
}

button,
input,
textarea,
select {
  font: inherit;
}

.container {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgb(255 255 255 / 72%);
  border-bottom: 1px solid rgb(214 233 247 / 85%);
  backdrop-filter: blur(18px);
}

.header-inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.site-title {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  font-size: 21px;
  font-weight: 900;
  letter-spacing: 0;
  flex-shrink: 0;
}

.site-title img {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  object-fit: cover;
  background: #fff;
  box-shadow: 0 10px 24px rgb(7 140 255 / 22%);
}

.main-nav {
  height: 46px;
  padding: 5px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  justify-content: center;
  background: rgb(255 255 255 / 70%);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 12px 28px rgb(42 133 202 / 9%);
}

.main-nav a {
  height: 34px;
  padding: 0 12px;
  border-radius: 13px;
  display: inline-flex;
  align-items: center;
  color: var(--soft);
  font-weight: 900;
  white-space: nowrap;
}

.main-nav a.active,
.main-nav a:hover {
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--blue-2));
}

.desktop-account {
  display: flex;
  align-items: center;
  gap: 12px;
}

.signin-link,
.register-button,
.primary-button,
.ghost-button {
  min-height: 42px;
  border-radius: 14px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.signin-link {
  color: var(--blue-3);
  background: transparent;
}

.register-button,
.primary-button {
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--blue-2));
  box-shadow: 0 14px 32px rgb(7 140 255 / 28%);
}

.ghost-button {
  color: var(--blue-3);
  background: rgb(255 255 255 / 72%);
  border: 1px solid var(--line);
}

.profile-pill {
  min-height: 44px;
  padding: 5px 7px 5px 5px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 10px 24px rgb(63 139 196 / 12%);
  font-weight: 900;
}

.profile-pill button,
.drawer-profile button {
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.avatar,
.mini-avatar {
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), #5ddcff);
  font-weight: 900;
}

.avatar {
  width: 34px;
  height: 34px;
}

.avatar.large {
  width: 58px;
  height: 58px;
  font-size: 24px;
}

.search-form {
  width: min(240px, 20vw);
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr 42px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
  overflow: hidden;
}

.search-form input {
  min-width: 0;
  border: 0;
  padding: 11px 12px 11px 16px;
  color: var(--text);
  background: transparent;
  outline: 0;
}

.search-form button {
  border: 0;
  color: var(--blue);
  background: transparent;
  font-size: 21px;
  cursor: pointer;
}

.app-shell {
  padding-top: 24px;
}

.breadcrumb {
  min-height: 24px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
}

.breadcrumb div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.home-overview {
  margin-bottom: 22px;
  padding: 24px 26px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 92%), rgb(221 246 255 / 84%)),
    radial-gradient(circle at 100% 0, rgb(0 183 255 / 18%), transparent 18rem);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.home-overview h1 {
  margin: 0;
  letter-spacing: 0;
}

.home-overview p {
  max-width: 720px;
  margin: 9px 0 0;
  color: var(--soft);
  font-size: 15px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.overview-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.page-head {
  margin-bottom: 18px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

h1 {
  margin: 0;
  color: #10243a;
  font-size: 29px;
  line-height: 1.15;
  font-weight: 900;
}

.page-head p {
  margin: 7px 0 0;
  color: var(--soft);
  overflow-wrap: anywhere;
}

.back-link {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 800;
}

.loading-box,
.empty-state {
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  color: var(--soft);
}

.forum-category,
.topic-row,
.composer,
.post-card,
.moderation-panel,
.closed-topic {
  background: var(--surface);
  border: 1px solid rgb(214 233 247 / 88%);
  box-shadow: 0 18px 40px rgb(31 132 210 / 10%);
  backdrop-filter: blur(18px);
}

.forum-category {
  margin-bottom: 20px;
  overflow: hidden;
  border-radius: 24px;
}

.category-head {
  width: 100%;
  height: 58px;
  padding: 0 22px;
  border: 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text);
  background: rgb(255 255 255 / 62%);
  text-align: left;
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
}

.chevron {
  color: var(--blue);
  font-size: 28px;
}

.forum-category.collapsed .forum-list {
  display: none;
}

.forum-category.collapsed .chevron {
  transform: rotate(-90deg);
}

.forum-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.forum-list.standalone {
  margin-bottom: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
}

.forum-row {
  min-height: 110px;
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) 100px 280px;
  gap: 20px;
  align-items: center;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.forum-row:last-child {
  border-bottom: 0;
}

.forum-row::before {
  content: "";
  position: absolute;
  inset: 18px auto 18px 0;
  width: 4px;
  border-radius: 999px;
  background: var(--blue);
}

.forum-row.amber::before { background: #f7b733; }
.forum-row.blue::before { background: var(--blue); }
.forum-row.red::before { background: #ff3e7f; }
.forum-row.cyan::before { background: #00d4ff; }
.forum-row.violet::before { background: #8b5cf6; }
.forum-row.orange::before { background: #ff8a2a; }

.forum-icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e6f7ff, #fff);
  box-shadow: inset 0 0 0 1px #d8efff, 0 12px 24px rgb(7 140 255 / 14%);
  font-size: 22px;
}

.forum-main {
  min-width: 0;
}

.forum-main h2,
.topic-row h2 {
  margin: 0 0 5px;
  font-size: 18px;
  line-height: 1.25;
}

.forum-main h2 a,
.topic-row h2 a {
  color: var(--text);
}

.forum-main p,
.topic-row p {
  margin: 0;
  color: var(--soft);
  overflow-wrap: anywhere;
}

.stats {
  justify-self: end;
  text-align: right;
}

.stats b {
  display: block;
  color: var(--blue-3);
  font-size: 20px;
  font-weight: 900;
}

.stats span {
  color: var(--muted);
}

.last-post {
  min-width: 0;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.mini-avatar {
  width: 40px;
  height: 40px;
}

.last-post .topic {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-weight: 900;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.last-post p {
  margin: 2px 0 0;
  color: var(--muted);
}

.topic-tools {
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topic-tools input,
.composer input,
.composer textarea,
.auth-form input,
.moderation-panel select {
  border: 1px solid var(--line);
  color: var(--text);
  background: #fff;
  outline: 0;
}

.topic-tools input {
  width: min(420px, 100%);
  border-radius: 15px;
  padding: 12px 14px;
}

.topic-tools span {
  color: var(--muted);
  font-weight: 800;
}

.topic-list {
  display: grid;
  gap: 10px;
}

.info-grid,
.search-results {
  display: grid;
  gap: 12px;
}

.info-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.info-card,
.user-card {
  min-width: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid rgb(214 233 247 / 88%);
  box-shadow: 0 18px 40px rgb(31 132 210 / 10%);
  backdrop-filter: blur(18px);
}

.info-card {
  min-height: 118px;
  padding: 20px;
  display: grid;
  align-content: center;
  gap: 7px;
  border-radius: 22px;
}

.info-card.wide {
  max-width: 720px;
}

.info-card b,
.user-card b {
  color: var(--text);
  font-size: 17px;
  font-weight: 900;
}

.info-card span,
.user-card span {
  margin: 0;
  color: var(--soft);
}

.user-card {
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: 20px;
}

.search-results h2 {
  margin: 8px 0 0;
  font-size: 18px;
}

.topic-row {
  min-height: 82px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 90px;
  gap: 14px;
  align-items: center;
  padding: 18px;
  border-radius: 20px;
}

.topic-status {
  width: 34px;
  height: 34px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--blue-3);
  background: #e8f7ff;
  box-shadow: inset 0 0 0 1px #cfeeff;
}

.topic-markers {
  margin-right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  vertical-align: 2px;
}

.topic-icon {
  min-width: 16px;
  min-height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
}

.topic-icon.pinned {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: #0e5a34;
  background: #dff9eb;
  font-size: 11px;
  font-weight: 900;
}

.tag {
  min-height: 19px;
  padding: 2px 7px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.tag.important { background: #ff2f63; }
.tag.approved { background: var(--success); }
.tag.rejected { background: var(--danger); }
.tag.review { color: #402f00; background: var(--warning); }

.composer,
.moderation-panel,
.closed-topic {
  margin-top: 16px;
  border-radius: 22px;
  padding: 18px;
}

.composer {
  display: grid;
  gap: 12px;
}

.composer label,
.auth-form label {
  display: grid;
  gap: 7px;
  color: var(--soft);
  font-weight: 900;
}

.composer input,
.composer textarea,
.auth-form input {
  width: 100%;
  border-radius: 14px;
  padding: 12px;
  resize: vertical;
}

.form-message {
  margin: 0;
  min-height: 20px;
  color: var(--danger);
}

.closed-topic {
  color: var(--blue-3);
  font-weight: 900;
}

.moderation-panel {
  margin: 0 0 14px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, auto) 190px auto minmax(80px, auto);
  gap: 12px;
  align-items: center;
}

.moderation-panel b {
  display: block;
}

.moderation-panel span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.moderation-panel label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--soft);
  font-weight: 900;
  white-space: nowrap;
}

.moderation-panel select {
  min-height: 40px;
  border-radius: 13px;
  padding: 0 10px;
}

.post-list {
  display: grid;
  gap: 12px;
}

.post-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  border-radius: 22px;
  overflow: hidden;
}

.post-card aside {
  padding: 20px;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 7px;
  background: linear-gradient(180deg, #e8f7ff, #fff);
  border-right: 1px solid var(--line);
}

.post-card small,
.post-body time {
  color: var(--muted);
}

.post-body {
  min-width: 0;
  padding: 20px;
}

.post-body p {
  margin: 14px 0 0;
  color: #17324a;
  font-size: 15px;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgb(8 34 58 / 48%);
  backdrop-filter: blur(8px);
}

.modal-card {
  width: min(430px, 100%);
  position: relative;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--soft);
  background: rgb(255 255 255 / 86%);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--blue-3);
  background: #f2fbff;
}

.auth-tabs {
  margin-right: 40px;
  margin-bottom: 18px;
  padding: 5px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: #edf8ff;
  border-radius: 17px;
}

.auth-tabs button {
  min-height: 38px;
  border: 0;
  color: var(--soft);
  background: transparent;
  border-radius: 13px;
  cursor: pointer;
  font-weight: 900;
}

.auth-tabs .active {
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--blue-2));
}

.auth-form {
  display: none;
  gap: 12px;
}

.auth-form.active {
  display: grid;
}

.captcha-box {
  min-height: 65px;
  display: none;
  justify-content: center;
  overflow: visible;
}

.captcha-box iframe {
  max-width: 100%;
}

body:has(.auth-form.active .captcha-box:not(:empty)) .auth-form.active .captcha-box {
  display: flex;
}

.hamburger,
.mobile-drawer,
.drawer-backdrop {
  display: none;
}

footer {
  padding: 24px 0 30px;
  display: flex;
  justify-content: center;
}

footer .container {
  display: flex;
  justify-content: center;
}

.footer-brand {
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 5px 13px 5px 5px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  background: rgb(255 255 255 / 72%);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 14px 34px rgb(31 132 210 / 12%);
  backdrop-filter: blur(16px);
  font-weight: 900;
}

.footer-brand img {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  object-fit: cover;
  box-shadow: 0 8px 18px rgb(7 140 255 / 20%);
}

.footer-copy {
  display: grid;
  min-width: 178px;
  justify-items: center;
  gap: 2px;
  text-align: center;
}

.footer-brand strong {
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  font-weight: 900;
}

.footer-brand span {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1;
  font-weight: 800;
}

@media (max-width: 900px) {
  html,
  body {
    width: 100%;
    overflow-x: hidden;
  }

  .container {
    width: 100%;
    max-width: 100%;
    padding-inline: 14px;
  }

  .header-inner {
    min-height: 64px;
    gap: 10px;
    justify-content: space-between;
  }

  .site-title {
    min-width: 0;
    flex: 1 1 auto;
    font-size: 18px;
  }

  .site-title span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .site-title img {
    width: 36px;
    height: 36px;
  }

  .desktop-account,
  .main-nav,
  .site-header .search-form,
  .breadcrumb {
    display: none;
  }

  .hamburger {
    width: 42px;
    height: 42px;
    border: 0;
    position: relative;
    display: inline-flex;
    flex: 0 0 42px;
    margin-left: auto;
    border-radius: 14px;
    background: rgb(255 255 255 / 78%);
    box-shadow: inset 0 0 0 1px var(--line);
  }

  .hamburger::before {
    content: "";
    position: absolute;
    left: 9px;
    top: 13px;
    display: block;
    width: 24px;
    height: 2px;
    background: var(--blue-3);
    box-shadow: 0 7px 0 var(--blue-3), 0 14px 0 var(--blue-3);
  }

  .app-shell {
    width: 100%;
    max-width: 100%;
    padding: 14px;
    overflow: hidden;
  }

  .app-view,
  .app-view > *,
  .forum-list {
    min-width: 0;
    max-width: 100%;
  }

  .home-overview {
    grid-template-columns: 1fr;
    padding: 18px;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .home-overview > div {
    min-width: 0;
  }

  .home-overview p,
  .page-head p,
  .forum-main p {
    max-width: 100%;
    word-break: break-word;
  }

  .forum-category,
  .topic-list {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .overview-actions {
    grid-template-columns: 1fr;
    justify-content: stretch;
    display: grid;
    width: 100%;
  }

  .overview-actions a,
  .overview-actions button {
    width: 100%;
  }

  .page-head {
    align-items: start;
    flex-direction: column;
  }

  h1 {
    font-size: 25px;
  }

  .forum-row {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    padding: 18px 14px;
    max-width: 100%;
    overflow: hidden;
  }

  .forum-main h2,
  .topic-row h2 {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .forum-icon {
    width: 42px;
    height: 42px;
  }

  .stats {
    grid-column: 2;
    justify-self: start;
    text-align: left;
  }

  .stats b {
    display: inline;
    font-size: 14px;
  }

  .last-post {
    display: none;
  }

  .topic-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .topic-tools input {
    width: 100%;
  }

  .topic-row {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .topic-row .stats {
    grid-column: 2;
  }

  .topic-markers {
    flex-wrap: wrap;
    vertical-align: middle;
  }

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

  .post-card aside {
    justify-items: start;
    grid-template-columns: 44px 1fr;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .post-card aside small {
    grid-column: 2;
  }

  .avatar.large {
    width: 44px;
    height: 44px;
    grid-row: span 2;
    font-size: 18px;
  }

  .moderation-panel {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .mobile-drawer {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: min(320px, 86vw);
    padding: 18px;
    overflow-y: auto;
    background: #fff;
    transform: translateX(-100%);
    transition: transform .18s ease;
    box-shadow: var(--shadow);
  }

  .drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgb(8 34 58 / 45%);
  }

  body.drawer-open .mobile-drawer,
  body.drawer-open .drawer-backdrop {
    display: block;
  }

  body.drawer-open .mobile-drawer {
    transform: translateX(0);
  }

  .drawer-close {
    margin-left: auto;
    display: block;
    border: 0;
    color: var(--soft);
    background: transparent;
    font-size: 30px;
    cursor: pointer;
  }

  .drawer-actions,
  .drawer-profile {
    display: grid;
    gap: 10px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
  }

  .mobile-drawer h4 {
    margin: 22px 0 8px;
  }

  .mobile-drawer > a {
    display: block;
    padding: 10px 4px;
    border-bottom: 1px solid var(--line);
    color: var(--soft);
    font-weight: 800;
  }

  .mobile-drawer > a.active {
    color: var(--blue-3);
  }

  .footer-brand {
    padding-right: 11px;
    gap: 8px;
  }

  .footer-brand img {
    width: 38px;
    height: 38px;
  }

  .footer-copy {
    min-width: 165px;
  }

  .footer-brand strong {
    font-size: 17px;
  }

  .footer-brand span {
    font-size: 10px;
  }

  .footer-brand span {
    font-size: 12px;
  }

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

}

@media (max-width: 430px) {
  .app-shell {
    padding-inline: 10px;
  }

  .category-head {
    padding-inline: 16px;
  }

  .forum-row {
    padding-inline: 10px;
  }

  .last-post {
    display: none;
  }
}
