:root {
  --ink: #172026;
  --muted: #63717b;
  --line: #dbe3e6;
  --paper: #f6f8f6;
  --panel: #ffffff;
  --pro: #126c5a;
  --pro-soft: #dff4ee;
  --con: #9d2f3b;
  --con-soft: #fae1e4;
  --accent: #d79d2f;
  --accent-soft: #fff0cf;
  --deep: #22343a;
  --shadow: 0 18px 48px rgba(23, 32, 38, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.side-nav {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 24px 18px;
  color: #eef6f2;
  background:
    linear-gradient(rgba(19, 38, 42, 0.88), rgba(19, 38, 42, 0.92)),
    url("https://images.unsplash.com/photo-1495020689067-958852a7765e?auto=format&fit=crop&w=900&q=80")
      center/cover;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.13);
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 3px;
  color: rgba(238, 246, 242, 0.72);
  font-size: 13px;
}

.category-list {
  display: grid;
  gap: 8px;
}

.category-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: rgba(238, 246, 242, 0.82);
  background: transparent;
  text-align: left;
}

.category-button.active,
.category-button:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.category-count {
  min-width: 28px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  text-align: center;
  font-size: 12px;
}

.new-room-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  margin-top: auto;
  border: 0;
  border-radius: 8px;
  color: #1b271d;
  background: var(--accent);
  font-weight: 800;
}

.workspace {
  padding: 28px;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--pro);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.12;
  letter-spacing: 0;
}

.search-wrap {
  width: min(380px, 100%);
}

.search-wrap input,
.composer input,
.composer textarea,
.composer select,
.comment-box textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

.search-wrap input {
  height: 46px;
  padding: 0 14px;
}

.news-strip {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 154px;
  margin-bottom: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 34px rgba(23, 32, 38, 0.06);
}

.strip-image {
  background:
    linear-gradient(rgba(18, 108, 90, 0.08), rgba(215, 157, 47, 0.08)),
    url("https://images.unsplash.com/photo-1504711434969-e33886168f5c?auto=format&fit=crop&w=900&q=80")
      center/cover;
}

.strip-content {
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 22px;
}

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

.strip-heading span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.source-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.source-pill {
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: #fff;
  color: var(--deep);
  font-size: 13px;
}

.source-pill:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.9fr) minmax(420px, 1.1fr);
  gap: 22px;
  align-items: start;
}

body:not(.room-page) .content-grid,
body.room-page .content-grid {
  grid-template-columns: minmax(0, 1fr);
}

body:not(.room-page) .debate-panel,
body.room-page .room-list-panel,
body.room-page .news-strip {
  display: none;
}

body:not(.room-page) .room-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.room-list-panel,
.debate-panel {
  min-width: 0;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-head h2 {
  margin: 0;
  font-size: 20px;
}

.section-head span {
  color: var(--muted);
  font-size: 14px;
}

.room-grid {
  display: grid;
  gap: 12px;
}

.room-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel);
  text-align: left;
  box-shadow: 0 8px 24px rgba(23, 32, 38, 0.045);
}

.room-card.active,
.room-card:hover {
  border-color: rgba(18, 108, 90, 0.38);
  box-shadow: 0 14px 34px rgba(18, 108, 90, 0.12);
}

.room-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.badge {
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  background: #edf2f0;
  font-size: 12px;
  font-weight: 700;
}

.badge.source {
  color: #8a5d0b;
  background: var(--accent-soft);
}

.room-card h3 {
  margin-bottom: 8px;
  font-size: 18px;
  line-height: 1.3;
}

.room-card p {
  display: -webkit-box;
  margin-bottom: 12px;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.room-stats {
  display: flex;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}

.page-button {
  min-width: 26px;
  height: 30px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--deep);
  font-weight: 800;
}

.page-button:hover:not(:disabled),
.page-button.active {
  color: var(--pro);
  text-decoration: underline;
  text-underline-offset: 5px;
}

.page-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.debate-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.debate-empty {
  display: grid;
  min-height: 430px;
  place-items: center;
  padding: 34px;
  text-align: center;
}

.debate-empty img {
  width: min(280px, 70%);
  margin-bottom: 20px;
  border-radius: 8px;
}

.debate-body {
  display: grid;
  gap: 22px;
  padding: 22px;
}

.back-button {
  justify-self: start;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--deep);
  font-weight: 800;
}

.back-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.topic-source {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.debate-title h2 {
  margin-bottom: 10px;
  font-size: 26px;
  line-height: 1.18;
}

.debate-title p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.62;
}

.stance-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stance-button {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 18px;
  font-weight: 900;
}

.stance-button.pro {
  color: var(--pro);
}

.stance-button.con {
  color: var(--con);
}

.stance-button.active.pro {
  border-color: var(--pro);
  background: var(--pro-soft);
}

.stance-button.active.con {
  border-color: var(--con);
  background: var(--con-soft);
}

.comment-sortbar {
  display: inline-flex;
  justify-self: start;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.comment-sortbar button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.comment-sortbar button.active {
  color: #fff;
  background: var(--deep);
}

.debate-lanes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.lane {
  min-width: 0;
}

.lane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-weight: 900;
}

.lane-head.pro {
  color: var(--pro);
}

.lane-head.con {
  color: var(--con);
}

.comment-box {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfa;
}

.comment-box textarea {
  min-height: 96px;
  padding: 12px;
  resize: vertical;
}

.comment-box button,
.primary-button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--deep);
  font-weight: 800;
}

.comment {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.comment p {
  margin-bottom: 0;
  line-height: 1.48;
}

.comment-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.vote-button,
.reply-button,
.icon-button,
.ghost-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--deep);
}

.vote-button {
  min-width: 58px;
}

.vote-button.active {
  border-color: var(--deep);
  background: var(--deep);
  color: #fff;
}

.reply-list {
  display: grid;
  gap: 8px;
  margin-left: 16px;
  padding-left: 12px;
  border-left: 2px solid var(--line);
}

.reply {
  padding: 10px 12px;
  border-radius: 8px;
  background: #f5f8f7;
}

.reply p {
  color: var(--deep);
  font-size: 14px;
}

.reply-form {
  display: grid;
  gap: 8px;
  margin-left: 16px;
  padding-left: 12px;
  border-left: 2px solid var(--accent);
}

.reply-form textarea {
  width: 100%;
  min-height: 74px;
  padding: 10px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

.reply-form button {
  justify-self: end;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  color: #fff;
  background: var(--deep);
  font-weight: 800;
}

.composer {
  width: min(620px, calc(100vw - 30px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

.composer::backdrop {
  background: rgba(23, 32, 38, 0.42);
}

.composer form {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.composer-head,
.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.composer h2 {
  margin: 0;
}

.composer label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.composer input,
.composer textarea,
.composer select {
  padding: 12px;
}

.ghost-button {
  min-width: 84px;
}

@media (max-width: 1080px) {
  .app-shell,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .side-nav {
    position: static;
    height: auto;
  }

  .category-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 720px) {
  .workspace {
    padding: 18px;
  }

  .topbar,
  .strip-heading {
    align-items: stretch;
    flex-direction: column;
  }

  h1 {
    font-size: 28px;
  }

  .news-strip,
  .debate-lanes,
  .stance-row {
    grid-template-columns: 1fr;
  }

  .strip-image {
    min-height: 130px;
  }

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

@media (max-width: 460px) {
  .category-list {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding: 14px;
  }
}
