:root {
  color-scheme: dark;
  --bg: #0c1018;
  --bg-2: #121823;
  --surface: rgba(22, 29, 43, 0.76);
  --surface-strong: rgba(28, 37, 53, 0.94);
  --surface-soft: rgba(255, 255, 255, 0.055);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.2);
  --text: #f5f7fb;
  --muted: #9aa9bd;
  --muted-2: #708198;
  --teal: #44f1c8;
  --coral: #ff7a66;
  --gold: #f4c95d;
  --violet: #a98bff;
  --sky: #69c7ff;
  --green: #9bea75;
  --danger: #ff5470;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.38);
  --radius: 8px;
  --radius-sm: 6px;
  --ease: cubic-bezier(0.2, 0.9, 0.22, 1);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body[data-theme="sunrise"] {
  color-scheme: light;
  --bg: #f6f0e8;
  --bg-2: #fff9ef;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.95);
  --surface-soft: rgba(28, 35, 47, 0.055);
  --line: rgba(32, 42, 59, 0.13);
  --line-strong: rgba(32, 42, 59, 0.22);
  --text: #1e2634;
  --muted: #667388;
  --muted-2: #8995a6;
  --teal: #0ca982;
  --coral: #e85649;
  --gold: #bb8418;
  --violet: #6f54df;
  --sky: #087fbd;
  --green: #4b962e;
  --shadow: 0 20px 60px rgba(95, 67, 35, 0.16);
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse at 20% -10%, rgba(68, 241, 200, 0.15), transparent 42%),
    radial-gradient(ellipse at 90% 20%, rgba(255, 122, 102, 0.13), transparent 40%),
    linear-gradient(135deg, var(--bg), var(--bg-2) 55%, var(--bg));
  color: var(--text);
  font-family: var(--font);
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--teal), white 12%);
  outline-offset: 3px;
}

img {
  display: block;
  max-width: 100%;
}

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

#signalCanvas,
.ambient-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

#signalCanvas {
  z-index: 0;
  opacity: 0.42;
}

.ambient-grid {
  z-index: 1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-position: center;
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), transparent 78%);
}

.app-shell {
  position: relative;
  z-index: 2;
  width: min(1540px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 40px;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(210px, 0.7fr) minmax(260px, 1.25fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-strong), transparent 12%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--teal), transparent 32%);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--teal), transparent 5%), var(--sky)),
    var(--surface-soft);
  color: #071013;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 0 28px color-mix(in srgb, var(--teal), transparent 76%);
}

.brand strong,
.brand small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand strong {
  font-size: 16px;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.search {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--muted);
  transition: border-color 180ms var(--ease), background 180ms var(--ease), transform 180ms var(--ease);
}

.search:focus-within {
  border-color: color-mix(in srgb, var(--teal), transparent 38%);
  background: color-mix(in srgb, var(--surface-soft), var(--teal) 7%);
  transform: translateY(-1px);
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: 0;
}

.search input::placeholder {
  color: var(--muted-2);
}

.top-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.icon-button,
.language-button,
.primary-button,
.segment,
.tag-pill,
.channel-button,
.reaction-button,
.composer-prompt,
.composer-avatar {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--text);
  transition:
    transform 180ms var(--ease),
    border-color 180ms var(--ease),
    background 180ms var(--ease),
    box-shadow 180ms var(--ease),
    color 180ms var(--ease);
}

.icon-button {
  display: inline-grid;
  width: 46px;
  height: 46px;
  place-items: center;
  padding: 0;
}

.language-button {
  display: inline-grid;
  width: 46px;
  height: 46px;
  place-items: center;
  padding: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 950;
}

.language-button.active {
  border-color: color-mix(in srgb, var(--violet), transparent 28%);
  background: color-mix(in srgb, var(--violet), transparent 82%);
  color: var(--text);
}

.icon-button:hover,
.language-button:hover,
.primary-button:hover,
.segment:hover,
.tag-pill:hover,
.channel-button:hover,
.reaction-button:hover,
.composer-prompt:hover,
.composer-avatar:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  background: color-mix(in srgb, var(--surface-soft), white 5%);
}

.icon-button.active {
  border-color: color-mix(in srgb, var(--gold), transparent 24%);
  color: var(--gold);
  box-shadow: 0 0 24px color-mix(in srgb, var(--gold), transparent 82%);
}

.primary-button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 16px;
  border-color: color-mix(in srgb, var(--teal), transparent 22%);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--teal), transparent 5%), color-mix(in srgb, var(--sky), transparent 5%));
  color: #061317;
  font-weight: 900;
  box-shadow: 0 14px 38px color-mix(in srgb, var(--teal), transparent 80%);
}

.primary-button:hover {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--teal), white 8%), color-mix(in srgb, var(--sky), white 10%));
  box-shadow: 0 18px 46px color-mix(in srgb, var(--teal), transparent 72%);
}

.workspace {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.sidebar,
.right-rail {
  position: sticky;
  top: 98px;
  display: grid;
  gap: 14px;
}

.profile-panel,
.nav-panel,
.side-card,
.spotlight-card,
.feed-header,
.composer-inline,
.thread-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.profile-panel {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
}

.profile-panel img {
  width: 84px;
  height: 84px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.profile-panel p,
.profile-panel strong {
  margin: 0;
}

.profile-panel p {
  color: var(--muted);
  font-size: 13px;
}

.profile-panel strong {
  display: block;
  margin-top: 4px;
  font-size: 34px;
  line-height: 1;
}

.nav-panel,
.side-card {
  padding: 14px;
}

.panel-title {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.channel-button {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 9px;
  text-align: left;
}

.channel-button.active {
  border-color: color-mix(in srgb, var(--teal), transparent 35%);
  background: color-mix(in srgb, var(--teal), transparent 90%);
  box-shadow: inset 3px 0 0 var(--teal);
}

.channel-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--channel-color);
  color: #071013;
  font-weight: 900;
}

.channel-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 800;
}

.channel-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pulse-panel {
  overflow: hidden;
}

.pulse-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  color: var(--muted);
  font-size: 14px;
}

.pulse-row strong {
  color: var(--text);
  font-size: 18px;
}

.activity-bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  height: 62px;
  align-items: end;
  margin-top: 10px;
}

.activity-bars span {
  height: var(--h);
  min-height: 12px;
  border-radius: 5px 5px 0 0;
  background: linear-gradient(to top, var(--coral), var(--gold), var(--teal));
  animation: barPulse 1.9s var(--ease) infinite alternate;
  animation-delay: calc(var(--h) * -0.02);
}

.feed-column {
  display: grid;
  min-width: 0;
  gap: 14px;
}

.feed-header {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.feed-header h1,
.spotlight-copy h2,
.composer-modal h2 {
  margin: 0;
  letter-spacing: 0;
}

.feed-header h1 {
  max-width: 720px;
  font-size: clamp(28px, 4.2vw, 58px);
  line-height: 0.95;
}

.segmented {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.16);
}

.segment {
  min-height: 36px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.segment.active {
  border-color: color-mix(in srgb, var(--coral), transparent 30%);
  background: color-mix(in srgb, var(--coral), transparent 80%);
  color: var(--text);
}

.tag-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 1px 8px;
  scrollbar-width: thin;
}

.tag-pill {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.tag-pill.active {
  border-color: color-mix(in srgb, var(--violet), transparent 30%);
  background: color-mix(in srgb, var(--violet), transparent 82%);
  color: var(--text);
}

.composer-inline {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
}

.composer-avatar {
  width: 48px;
  height: 48px;
  overflow: hidden;
  padding: 0;
}

.composer-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.composer-prompt {
  min-width: 0;
  padding: 0 14px;
  color: var(--muted);
  text-align: left;
}

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

.thread-card {
  position: relative;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 14px;
  overflow: hidden;
  padding: 14px;
  transform: translateY(12px);
  opacity: 0;
  animation: riseIn 520ms var(--ease) forwards;
}

.thread-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--thread-color);
  content: "";
}

.thread-card:hover {
  border-color: color-mix(in srgb, var(--thread-color), transparent 45%);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42), 0 0 28px color-mix(in srgb, var(--thread-color), transparent 86%);
  transform: translateY(-2px);
}

.author-avatar {
  position: relative;
}

.author-avatar img {
  width: 52px;
  height: 52px;
  border: 2px solid color-mix(in srgb, var(--thread-color), white 18%);
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.status-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 13px;
  height: 13px;
  border: 2px solid var(--bg-2);
  border-radius: 50%;
  background: var(--green);
}

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

.thread-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.thread-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.channel-chip,
.tag-chip {
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid color-mix(in srgb, var(--thread-color), transparent 42%);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--thread-color), transparent 88%);
  color: var(--text);
}

.thread-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.thread-title {
  margin: 0;
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.12;
}

.thread-title button {
  display: inline;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}

.thread-title button:hover {
  color: color-mix(in srgb, var(--thread-color), white 18%);
}

.score-pill {
  min-width: 56px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.16);
  color: var(--gold);
  font-weight: 950;
  text-align: center;
}

.thread-excerpt {
  margin: 9px 0 12px;
  color: var(--muted);
  line-height: 1.55;
}

.thread-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  justify-content: space-between;
}

.reaction-row,
.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.reaction-button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.reaction-button.active {
  border-color: color-mix(in srgb, var(--thread-color), transparent 30%);
  background: color-mix(in srgb, var(--thread-color), transparent 82%);
  color: var(--text);
}

.stat-row {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.stat-row span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.spotlight-card {
  overflow: hidden;
}

.spotlight-media {
  position: relative;
  height: 176px;
  overflow: hidden;
}

.spotlight-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 800ms var(--ease);
}

.spotlight-card:hover .spotlight-media img {
  transform: scale(1.06);
}

.live-dot {
  position: absolute;
  right: 12px;
  bottom: 12px;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid color-mix(in srgb, var(--danger), white 16%);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.58);
  color: white;
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.live-dot::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 15px var(--danger);
  content: "";
  animation: blink 1.2s ease-in-out infinite;
}

.spotlight-copy {
  padding: 15px;
}

.spotlight-copy h2 {
  font-size: 24px;
  line-height: 1.05;
}

.spotlight-copy p:last-child {
  margin: 9px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.trend-list,
.member-stack {
  display: grid;
  gap: 10px;
}

.trend-item,
.member-item {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.trend-item strong,
.trend-item span,
.member-item strong,
.member-item span {
  display: block;
}

.trend-item strong,
.member-item strong {
  font-size: 14px;
}

.trend-item span,
.member-item span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.trend-meter {
  width: 58px;
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.09);
}

.trend-meter i {
  display: block;
  width: var(--value);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--coral), var(--gold), var(--teal));
}

.member-item {
  justify-content: flex-start;
}

.member-item img {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 18px;
}

.modal-layer.open {
  display: grid;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 5, 10, 0.66);
  backdrop-filter: blur(12px);
}

.thread-modal,
.composer-modal {
  position: relative;
  width: min(820px, 100%);
  max-height: min(820px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-strong);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.55);
  animation: modalIn 260ms var(--ease);
}

.thread-modal {
  padding: 20px;
}

.close-button {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}

.modal-topic {
  padding-right: 58px;
}

.modal-topic h2 {
  margin: 8px 0 10px;
  font-size: clamp(26px, 4vw, 44px);
  line-height: 1;
}

.modal-topic p {
  color: var(--muted);
  line-height: 1.6;
}

.comment-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.comment-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.comment-item img {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.comment-item strong {
  font-size: 14px;
}

.comment-item p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.reply-box {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.reply-box textarea,
.composer-modal textarea,
.composer-modal input,
.composer-modal select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--text);
  outline: 0;
}

.reply-box textarea,
.composer-modal textarea {
  resize: vertical;
}

.reply-box textarea {
  min-height: 98px;
  padding: 12px;
}

.composer-modal {
  display: grid;
  gap: 14px;
  padding: 24px;
}

.composer-modal h2 {
  font-size: clamp(28px, 4vw, 48px);
}

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

.composer-modal input,
.composer-modal textarea,
.composer-modal select {
  min-height: 46px;
  padding: 10px 12px;
}

.composer-modal select {
  appearance: none;
}

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

.submit-button {
  width: fit-content;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 80;
  max-width: min(360px, calc(100% - 40px));
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--teal), transparent 34%);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: var(--shadow);
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms var(--ease), transform 220ms var(--ease);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.empty-state {
  padding: 34px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

.particle-pop {
  position: fixed;
  z-index: 90;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pop-color, var(--teal));
  pointer-events: none;
  animation: particlePop 650ms var(--ease) forwards;
}

@keyframes riseIn {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes modalIn {
  from {
    transform: translateY(22px) scale(0.98);
    opacity: 0;
  }
}

@keyframes barPulse {
  to {
    transform: scaleY(0.78);
    filter: hue-rotate(30deg);
  }
}

@keyframes blink {
  50% {
    opacity: 0.42;
  }
}

@keyframes particlePop {
  to {
    transform: translate(var(--tx), var(--ty)) scale(0.2);
    opacity: 0;
  }
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .right-rail {
    position: static;
    grid-column: 1 / -1;
    grid-template-columns: 1.1fr 1fr 1fr;
  }
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 20px, 760px);
    padding-top: 10px;
  }

  .topbar {
    position: static;
    grid-template-columns: 1fr auto;
  }

  .search {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .top-actions .primary-button {
    width: 46px;
    padding: 0;
  }

  .top-actions .primary-button svg {
    margin: 0;
  }

  .top-actions .primary-button {
    font-size: 0;
    gap: 0;
  }

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

  .sidebar,
  .right-rail {
    position: static;
  }

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

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

  .feed-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .right-rail {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 14px, 520px);
  }

  .topbar {
    gap: 10px;
    padding: 9px;
  }

  .brand-mark,
  .icon-button,
  .language-button,
  .top-actions .primary-button {
    width: 38px;
    height: 38px;
  }

  .brand {
    gap: 8px;
  }

  .brand strong {
    max-width: 72px;
    font-size: 14px;
  }

  .brand small {
    display: none;
  }

  .top-actions {
    gap: 4px;
  }

  .profile-panel {
    grid-template-columns: 74px minmax(0, 1fr);
  }

  .profile-panel img {
    width: 74px;
    height: 74px;
  }

  .channel-list,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .segmented {
    width: 100%;
  }

  .segment {
    flex: 1;
  }

  .thread-card {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
  }

  .author-avatar img {
    width: 40px;
    height: 40px;
  }

  .thread-title-row {
    grid-template-columns: 1fr;
  }

  .score-pill {
    width: fit-content;
  }

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

  .reaction-row,
  .stat-row {
    width: 100%;
  }

  .modal-layer {
    padding: 8px;
  }

  .thread-modal,
  .composer-modal {
    max-height: calc(100vh - 16px);
  }

  .thread-modal {
    padding: 16px;
  }

  .composer-modal {
    padding: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  #signalCanvas {
    display: none;
  }
}
