:root {
  --accent: #e50914;
  --background: #050505;
  --panel: #141414;
  --panel-2: #1f1f1f;
  --text: #ffffff;
  --muted: #b3b3b3;
  --line: rgba(255, 255, 255, 0.14);
  --logo-size: 180px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

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

a {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  min-height: 68px;
  padding: 0 clamp(18px, 3vw, 48px);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.98), rgba(0, 0, 0, 0.86));
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: clamp(20px, 3vw, 42px);
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.brand img {
  display: block;
  width: var(--logo-size);
  max-width: min(32vw, 260px);
  max-height: 54px;
  object-fit: contain;
  object-position: left center;
}

.main-menu,
.nav-actions,
.hero-actions,
.meta,
.topic-title-line,
.post-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.main-menu {
  gap: clamp(12px, 1.6vw, 26px);
  flex-wrap: wrap;
}

.main-menu a {
  color: rgba(255, 255, 255, 0.72);
  font-size: 15px;
  font-weight: 700;
  padding: 6px 0;
  text-decoration: none;
  white-space: nowrap;
}

.main-menu a:hover {
  color: #fff;
}

.nav-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.button,
button {
  border: 0;
  border-radius: 4px;
  background: var(--accent);
  color: white;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
}

.button.secondary,
button.secondary {
  background: rgba(255, 255, 255, 0.14);
}

.button.ghost,
button.ghost {
  background: transparent;
  border: 1px solid var(--line);
}

.compact {
  min-height: 34px;
  padding: 7px 11px;
  font-size: 0.9rem;
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 54vh;
  display: flex;
  align-items: flex-end;
  padding: 70px clamp(18px, 4vw, 56px);
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.98), rgba(0, 0, 0, 0.54), rgba(0, 0, 0, 0.16)),
    linear-gradient(0deg, var(--background), rgba(0, 0, 0, 0) 55%),
    url("/logo.png") right 8vw center / min(44vw, 720px) auto no-repeat,
    radial-gradient(circle at 76% 28%, rgba(229, 9, 20, 0.34), transparent 30%),
    #050505;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

.hero h1,
.discussion-head h1,
.topic-hero h1,
.form-page h1,
.auth-copy h1 {
  margin: 0 0 16px;
  font-size: clamp(40px, 8vw, 86px);
  line-height: 0.95;
}

.discussion-head h1,
.topic-hero h1,
.form-page h1 {
  font-size: clamp(34px, 5vw, 64px);
}

.auth-copy h1 {
  font-size: clamp(38px, 6vw, 72px);
}

.hero p,
.discussion-head p,
.auth-copy p {
  max-width: 650px;
  color: #f2f2f2;
  font-size: 20px;
  line-height: 1.45;
}

.page-grid,
.discussion-page,
.topic-page,
.form-page,
.auth-page,
.admin-page {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  padding: 34px 0 70px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 16px;
}

.section-heading h2,
.compact-heading h2 {
  margin: 0;
  font-size: 1.45rem;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.category-card,
.side-panel,
.topic-row,
.post-card,
.composer,
.panel-form,
.auth-callout,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.category-card {
  display: block;
  min-height: 190px;
  padding: 18px;
  text-decoration: none;
  transition: border-color 160ms ease, transform 160ms ease;
}

.category-card:hover {
  border-color: var(--category-accent);
  transform: translateY(-2px);
}

.category-swatch,
.status-dot {
  background: var(--category-accent, var(--accent));
}

.category-swatch {
  width: 42px;
  height: 5px;
  border-radius: 999px;
  margin-bottom: 34px;
}

.category-card h3,
.topic-row h3,
.empty-state h3 {
  margin: 0 0 8px;
}

.category-card p,
.topic-row p,
.empty-state p,
.post-body p {
  color: var(--muted);
  line-height: 1.55;
}

.category-card span {
  display: inline-block;
  margin-top: 8px;
  color: #f4f4f4;
  font-size: 0.9rem;
  font-weight: 700;
}

.side-panel {
  align-self: start;
  padding: 16px;
  background: #101010;
}

.discussion-page,
.topic-page,
.form-page,
.auth-page {
  padding: 42px 0 70px;
}

.admin-page {
  padding: 42px 0 70px;
}

.discussion-head,
.topic-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(170px, 300px) auto;
  gap: 10px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #101010;
  color: white;
  padding: 12px;
}

textarea {
  min-height: 150px;
  resize: vertical;
}

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

.compact-list {
  gap: 8px;
}

.topic-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) 78px;
  gap: 14px;
  align-items: stretch;
  padding: 14px;
  text-decoration: none;
  background: #111;
}

.topic-row:hover {
  border-color: rgba(255, 255, 255, 0.28);
}

.status-dot {
  width: 8px;
  border-radius: 999px;
}

.topic-title-line {
  align-items: baseline;
  flex-wrap: wrap;
}

.topic-title-line h3 {
  margin: 0;
}

.topic-main p {
  margin: 7px 0 9px;
}

.meta {
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.86rem;
}

.meta span + span::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-right: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
  vertical-align: middle;
}

.reply-count {
  display: grid;
  align-content: center;
  justify-items: center;
  color: var(--muted);
  border-left: 1px solid var(--line);
}

.reply-count strong {
  color: #fff;
  font-size: 1.25rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  color: #f6f6f6;
  font-size: 0.76rem;
  font-weight: 800;
}

.badge.solved {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.14);
  color: #bbf7d0;
}

.topic-hero {
  display: block;
}

.back-link {
  display: inline-block;
  margin-bottom: 16px;
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}

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

.post-card {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.post-card.solution {
  border-color: rgba(34, 197, 94, 0.55);
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.08);
}

.post-card aside {
  display: grid;
  align-content: start;
  gap: 8px;
  color: var(--muted);
}

.avatar,
.user-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--panel-2);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
}

.avatar.large {
  width: 52px;
  height: 52px;
  background: var(--accent);
}

.user-chip {
  gap: 8px;
  color: #f7f7f7;
  font-weight: 700;
}

.post-tools {
  justify-content: space-between;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.86rem;
}

.post-body p {
  margin: 18px 0 0;
  white-space: pre-wrap;
}

.composer,
.auth-callout {
  margin-top: 18px;
  padding: 18px;
}

.composer h2,
.auth-callout h2,
.panel-form h1,
.panel-form h2 {
  margin-top: 0;
}

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

.auth-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
  gap: 26px;
  align-items: start;
}

.auth-forms {
  display: grid;
  gap: 14px;
}

.panel-form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.panel-form label {
  display: grid;
  gap: 7px;
  color: #f2f2f2;
  font-weight: 700;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.settings-form,
.users-panel {
  margin-bottom: 16px;
}

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

.admin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #101010;
  padding: 12px;
}

.admin-row span {
  display: grid;
  gap: 4px;
}

.admin-row small,
.user-chip small {
  color: var(--muted);
  font-weight: 700;
}

.admin-row select {
  min-width: 140px;
}

.rank-grid {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 110px 110px;
  gap: 10px;
}

.toggle-row label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle-row input[type="checkbox"] {
  width: auto;
}

.danger {
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.5) !important;
}

.topic-actions {
  margin-top: 16px;
}

.score {
  color: #fff;
  font-weight: 800;
}

.notice {
  width: min(1180px, calc(100% - 36px));
  margin: 16px auto 0;
  border: 1px solid rgba(245, 158, 11, 0.42);
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.12);
  color: #fde68a;
  padding: 12px 14px;
}

.notice.inline {
  width: auto;
  margin: 0 0 14px;
}

.empty-state {
  padding: 24px;
  text-align: center;
}

.loading-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  color: var(--muted);
  font-weight: 700;
}

.loading-screen img {
  width: min(260px, 54vw);
}

@media (max-width: 920px) {
  .topbar,
  .topbar-left,
  .discussion-head,
  .auth-page {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .page-grid,
  .auth-page,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .discussion-head {
    display: grid;
  }

  .search-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .brand img {
    max-width: 180px;
  }

  .hero {
    min-height: 50vh;
    padding-top: 52px;
    background:
      linear-gradient(90deg, rgba(0, 0, 0, 0.98), rgba(0, 0, 0, 0.7)),
      url("/logo.png") right 18px top 44px / 220px auto no-repeat,
      #050505;
  }

  .hero h1,
  .discussion-head h1,
  .topic-hero h1,
  .form-page h1,
  .auth-copy h1 {
    font-size: 38px;
  }

  .hero p,
  .discussion-head p,
  .auth-copy p {
    font-size: 17px;
  }

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

  .reply-count {
    grid-column: 2;
    justify-items: start;
    border-left: 0;
  }

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

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

  .admin-row,
  .rank-grid {
    grid-template-columns: 1fr;
  }
}
