:root {
  color-scheme: dark;
  --bg: #111318;
  --panel: rgba(28, 31, 38, 0.86);
  --panel-solid: #20242d;
  --line: rgba(255, 255, 255, 0.12);
  --text: #f5f1e8;
  --muted: #a7afb9;
  --gold: #e8bd63;
  --teal: #44d1c3;
  --red: #ef7d72;
  --green: #83d48f;
  --ink: #0f1115;
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 10%, rgba(68, 209, 195, 0.14), transparent 26rem),
    radial-gradient(circle at 90% 28%, rgba(232, 189, 99, 0.11), transparent 24rem),
    linear-gradient(135deg, #111318 0%, #181b21 52%, #101115 100%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.side-nav,
.right-rail {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.side-nav {
  position: sticky;
  top: 18px;
  height: calc(100vh - 36px);
}

.brand,
.profile-panel,
.topbar,
.composer-head,
.composer-actions,
.feed-tools,
.post-header,
.post-actions,
.panel-title {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
  min-height: 56px;
}

.brand-mark,
.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--ink);
  background: linear-gradient(135deg, var(--gold), #f1df9f);
  font-weight: 900;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 12px 4px 12px 4px;
}

.brand h1,
.topbar h2,
.feed-tools h3,
.panel-title h3,
.post-card h3 {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
  line-height: 1.1;
}

.brand p,
.eyebrow,
.profile-panel small,
.composer-head span,
.feed-tools span,
.panel-title span,
.post-meta span,
.post-body,
.composer-actions span {
  color: var(--muted);
}

.brand p,
.eyebrow {
  margin: 2px 0 0;
  font-size: 12px;
  text-transform: uppercase;
}

.menu {
  display: grid;
  gap: 8px;
}

.menu-item,
.ghost-button,
.tag-cloud button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.menu-item {
  min-height: 42px;
  padding: 0 12px;
  text-align: left;
}

.menu-item.active,
.tag-option.active {
  color: var(--ink);
  background: var(--gold);
  border-color: transparent;
  font-weight: 800;
}

.panel,
.composer,
.post-card,
.topbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.23);
  backdrop-filter: blur(14px);
}

.panel,
.composer,
.post-card {
  padding: 16px;
}

.profile-panel {
  gap: 12px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 13px;
}

.profile-panel strong,
.profile-panel small {
  display: block;
}

.profile-panel strong {
  margin-top: 3px;
  font-size: 14px;
}

.stat-panel {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stat-panel strong,
.stat-panel span {
  display: block;
}

.stat-panel strong {
  color: var(--gold);
  font-size: 22px;
}

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

.feed-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.topbar {
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
}

.topbar h2 {
  margin-top: 3px;
  font-size: 26px;
}

.search-wrap {
  flex: 0 1 360px;
}

input,
textarea {
  width: 100%;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
}

input {
  height: 44px;
  padding: 0 13px;
}

textarea {
  min-height: 112px;
  resize: vertical;
  padding: 12px 13px;
  line-height: 1.55;
}

input:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(68, 209, 195, 0.16);
}

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

.composer-head {
  gap: 12px;
}

.composer-head strong,
.composer-head span {
  display: block;
}

.composer-actions {
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.segmented {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.tag-option {
  min-width: 62px;
  height: 34px;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
}

.primary-button,
.reply-form button {
  color: var(--ink);
  background: var(--teal);
  border: 0;
  border-radius: 8px;
  font-weight: 900;
}

.primary-button {
  min-width: 86px;
  height: 40px;
}

.primary-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.feed-tools {
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px;
}

.feed-tools h3 {
  font-size: 18px;
}

.ghost-button {
  min-height: 36px;
  padding: 0 12px;
}

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

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

.post-header {
  gap: 11px;
}

.post-meta {
  min-width: 0;
}

.post-meta strong,
.post-meta span {
  display: block;
}

.post-tag {
  margin-left: auto;
  padding: 5px 9px;
  color: var(--gold);
  background: rgba(232, 189, 99, 0.12);
  border: 1px solid rgba(232, 189, 99, 0.28);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.post-card h3 {
  font-size: 18px;
}

.post-body {
  margin: 0;
  line-height: 1.65;
  white-space: pre-wrap;
}

.post-actions {
  gap: 8px;
}

.post-actions button {
  min-height: 34px;
  padding: 0 11px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.like-button.liked {
  color: var(--ink);
  background: var(--green);
  border-color: transparent;
}

.comments {
  display: grid;
  gap: 8px;
}

.comment {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  line-height: 1.5;
}

.comment strong {
  margin-right: 6px;
  color: var(--gold);
}

.reply-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px;
  gap: 8px;
}

.reply-form button {
  min-height: 42px;
}

.panel-title {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-cloud button {
  min-height: 34px;
  padding: 0 10px;
}

.ranking ol {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.ranking li {
  display: flex;
  gap: 9px;
  color: var(--muted);
  line-height: 1.45;
}

.ranking li span {
  color: var(--gold);
  font-weight: 900;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .right-rail {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 12px;
  }

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

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

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

  .search-wrap {
    flex-basis: auto;
  }

  .right-rail {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .menu {
    grid-template-columns: 1fr;
  }

  .composer-actions {
    align-items: stretch;
  }

  .segmented,
  .primary-button,
  .composer-actions span {
    width: 100%;
  }

  .tag-option {
    flex: 1;
  }
}
