:root {
  color-scheme: light;
  --bg: #f6f7f2;
  --surface: #ffffff;
  --surface-2: #f0f3ed;
  --text: #141414;
  --muted: #6a6f67;
  --line: #dfe4dc;
  --accent: #d83d52;
  --accent-strong: #b6233a;
  --amber: #c68522;
  --danger: #b72d20;
  --success: #287a3f;
  --shadow: 0 18px 50px rgb(30 34 29 / 10%);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

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

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

a:hover {
  text-decoration: underline;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(320px, 430px);
  align-items: stretch;
  justify-content: center;
  min-height: 100vh;
  padding: 28px;
}

.auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 28px;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.brand-row {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 10px;
  color: var(--text);
  font-size: 15px;
  font-weight: 850;
}

.brand-row img {
  width: 34px;
  height: 34px;
}

.auth-heading {
  margin: 54px 0 24px;
}

.auth-heading p,
.kicker {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

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

h1,
h2 {
  margin: 0;
  line-height: 1.08;
}

h1 {
  font-size: 34px;
}

h2 {
  font-size: 15px;
}

.form-stack {
  display: grid;
  gap: 15px;
}

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

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

input {
  min-height: 44px;
  padding: 10px 12px;
}

textarea {
  min-height: 92px;
  padding: 12px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(216 61 82 / 17%);
}

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

.message[data-type="success"] {
  color: var(--success);
}

.primary-button,
.ghost-button,
.icon-button,
.icon-link,
.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-weight: 800;
}

.primary-button,
.ghost-button {
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
}

.primary-button {
  border: 1px solid var(--text);
  background: var(--text);
  color: #ffffff;
}

.primary-button:hover {
  background: #303030;
}

.primary-button.compact,
.ghost-button.compact {
  min-height: 34px;
  padding-inline: 12px;
}

.ghost-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.ghost-button:hover,
.icon-button:hover,
.icon-link:hover,
.action-button:hover {
  background: var(--surface-2);
}

.switch-link {
  margin: 22px 0 0;
  color: var(--muted);
  text-align: center;
}

.switch-link a {
  color: var(--text);
  font-weight: 800;
}

.app-shell {
  display: grid;
  grid-template-columns: 74px minmax(0, 680px);
  width: min(100%, 754px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--surface);
}

.rail,
.feed-shell {
  border-left: 1px solid var(--line);
}

.feed-shell {
  min-width: 0;
  border-right: 1px solid var(--line);
}

.rail {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  align-self: start;
  height: 100vh;
  padding: 14px 12px;
}

.rail-brand,
.icon-link,
.icon-button,
.action-button {
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
}

.rail-brand {
  display: grid;
  place-items: center;
  border-radius: 8px;
}

.rail-brand img {
  width: 34px;
  height: 34px;
}

.rail-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-top: 36px;
}

.icon-link.active {
  color: var(--accent-strong);
}

.feed-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 94%);
  backdrop-filter: blur(12px);
  padding: 16px 18px;
}

.feed-header h1 {
  font-size: 22px;
}

.profile-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

.profile-chip div {
  display: grid;
  min-width: 0;
}

.profile-chip strong {
  max-width: 170px;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar {
  display: inline-grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--text);
  color: #ffffff;
  font-size: 15px;
  font-weight: 850;
}

.avatar.small {
  width: 32px;
  height: 32px;
  font-size: 13px;
}

.composer,
.post {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 18px;
}

.composer-form {
  display: grid;
  gap: 10px;
}

.composer-actions,
.reply-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
}

#char-count {
  color: var(--muted);
  font-size: 13px;
}

.posts {
  min-height: 320px;
}

.post-body,
.comment-body {
  min-width: 0;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 7px;
}

.post-meta strong {
  font-size: 15px;
}

.post-meta span,
.post-meta time {
  color: var(--muted);
  font-size: 14px;
}

.post-content {
  margin: 8px 0 0;
  font-size: 15px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.post-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.action-button {
  width: 34px;
  height: 34px;
  color: var(--muted);
}

.action-button svg {
  width: 18px;
  height: 18px;
}

.action-button.danger {
  color: var(--danger);
}

.comments {
  display: grid;
  gap: 0;
  margin-top: 14px;
  border-left: 2px solid var(--line);
  padding-left: 14px;
}

.comment {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  padding-top: 12px;
}

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

.reply-form textarea {
  min-height: 66px;
}

.empty-state {
  display: grid;
  min-height: 260px;
  place-items: center;
  color: var(--muted);
  padding: 24px;
  text-align: center;
}

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

@media (max-width: 720px) {
  .auth-shell {
    grid-template-columns: 1fr;
    padding: 14px;
  }

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

  .rail {
    position: sticky;
    z-index: 10;
    grid-row: 2;
    height: auto;
    border-top: 1px solid var(--line);
    background: var(--surface);
    padding: 8px 12px;
    bottom: 0;
  }

  .rail-brand {
    display: none;
  }

  .rail-nav {
    flex-direction: row;
    justify-content: space-around;
    padding: 0;
  }

  .feed-shell {
    grid-row: 1;
    border-left: 0;
    border-right: 0;
  }

  .feed-header {
    padding-inline: 14px;
  }

  .profile-chip div {
    display: none;
  }

  .composer,
  .post {
    padding-inline: 14px;
  }

  .composer-actions,
  .reply-actions {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .composer-actions .message,
  .reply-actions .message {
    grid-column: 1 / -1;
  }
}
