:root {
  --bg: #edf1f7;
  --bg-accent: radial-gradient(circle at top left, rgba(75, 126, 235, 0.14), transparent 24%), linear-gradient(180deg, #f6f8fc 0%, #edf1f7 46%, #e6ebf3 100%);
  --surface: rgba(255, 255, 255, 0.94);
  --surface-strong: #ffffff;
  --surface-muted: #f4f7fb;
  --surface-soft: rgba(231, 237, 247, 0.78);
  --text: #152033;
  --text-muted: #68758b;
  --line: rgba(120, 137, 166, 0.18);
  --line-strong: rgba(73, 96, 140, 0.26);
  --accent: #2f6fed;
  --accent-strong: #184fbe;
  --accent-soft: rgba(47, 111, 237, 0.1);
  --success: #1f8a55;
  --danger: #c13d4b;
  --shadow: 0 18px 40px rgba(24, 38, 67, 0.08);
  --shadow-soft: 0 8px 18px rgba(24, 38, 67, 0.08);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
}

html[data-theme="dark"] {
  --bg: #0f1725;
  --bg-accent: radial-gradient(circle at top left, rgba(80, 132, 255, 0.18), transparent 24%), linear-gradient(180deg, #131d2f 0%, #0f1725 52%, #0b1220 100%);
  --surface: rgba(18, 28, 44, 0.92);
  --surface-strong: #182335;
  --surface-muted: #223047;
  --surface-soft: rgba(39, 52, 74, 0.68);
  --text: #eef3ff;
  --text-muted: #9ba9c4;
  --line: rgba(130, 150, 191, 0.14);
  --line-strong: rgba(130, 150, 191, 0.28);
  --accent: #6a98ff;
  --accent-strong: #8aafff;
  --accent-soft: rgba(106, 152, 255, 0.16);
  --shadow: 0 24px 48px rgba(0, 0, 0, 0.34);
  --shadow-soft: 0 10px 24px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 15px/1.5 "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-accent);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-strong);
}

form,
p {
  margin: 0;
}

.shell {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
}

.page-shell {
  padding: 28px 0 72px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(18px);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 82px;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: inherit;
}

.brand-mark,
.user-chip-avatar,
.avatar-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, #2f6fed 0%, #5ca2ff 100%);
}

.brand-mark {
  width: 46px;
  height: 46px;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.brand-text {
  display: grid;
  gap: 2px;
}

.brand {
  display: block;
  color: var(--text);
  font: 800 1.3rem/1.1 "Inter", "Segoe UI", sans-serif;
  letter-spacing: -0.03em;
}

.brand-tagline {
  color: var(--text-muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  flex: 1;
}

.nav-links,
.nav-utilities {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-links a,
.nav > a,
.nav-group summary {
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--text);
  font-weight: 700;
}

.nav-links a:hover,
.nav > a:hover,
.nav-group summary:hover {
  background: var(--surface-soft);
}

.nav-group {
  position: relative;
}

.nav-group summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
}

.nav-group summary::-webkit-details-marker {
  display: none;
}

.nav-group summary::after {
  content: "▾";
  font-size: 0.75rem;
  color: var(--text-muted);
}

.nav-group[open] summary {
  background: var(--surface-soft);
}

.bell-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 44px;
  font-size: 1.1rem;
}

.bell-button::after {
  display: none;
}

.bell-badge {
  position: absolute;
  top: -4px;
  right: -2px;
}

.nav-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 220px;
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.nav-menu-wide {
  min-width: 320px;
}

.nav-menu a {
  padding: 11px 12px;
  border-radius: 12px;
  color: var(--text);
  font-weight: 700;
}

.nav-menu a:hover {
  background: var(--surface-soft);
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px 7px 7px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  box-shadow: var(--shadow-soft);
  color: var(--text);
}

.user-chip-avatar,
.avatar-placeholder {
  width: 42px;
  height: 42px;
  font-weight: 800;
}

.user-chip-text {
  display: grid;
  min-width: 0;
}

.user-chip-text strong,
.post-author strong,
.profile-mini strong {
  font-size: 0.96rem;
}

.user-chip-text span {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stack {
  display: grid;
  gap: 22px;
}

.feed-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}

.feed-main {
  gap: 20px;
}

.form-grid {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  color: var(--text);
  padding: 13px 15px;
  font: inherit;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(47, 111, 237, 0.35);
  box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.1);
}

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

button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  font: 800 0.95rem/1 "Inter", "Segoe UI", sans-serif;
  letter-spacing: -0.01em;
  box-shadow: 0 10px 20px rgba(47, 111, 237, 0.2);
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(47, 111, 237, 0.24);
  filter: saturate(1.05);
}

button.secondary,
.icon-button {
  color: var(--text);
  background: var(--surface-strong);
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
}

.icon-button {
  min-width: 82px;
}

.alert {
  padding: 16px 18px;
  margin-bottom: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
}

.alert.success {
  color: var(--success);
  border-color: rgba(31, 138, 85, 0.16);
  background: rgba(31, 138, 85, 0.09);
}

.alert.error {
  color: var(--danger);
  border-color: rgba(193, 61, 75, 0.18);
  background: rgba(193, 61, 75, 0.09);
}

.muted {
  color: var(--text-muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text-muted);
  font-size: 0.8rem;
}

.auth-shell {
  width: min(860px, 100%);
  margin: 12px auto 0;
}

h1,
h2,
h3 {
  margin: 0 0 10px;
  font-family: "Inter", "Segoe UI", sans-serif;
  letter-spacing: -0.03em;
}

code {
  padding: 2px 6px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.eyebrow {
  display: inline-block;
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.composer-card {
  padding: 26px;
}

.composer-header,
.profile-mini,
.profile-hero {
  display: flex;
  gap: 14px;
  align-items: center;
}

.composer-copy {
  display: grid;
  gap: 2px;
}

.section-title {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.35rem);
  line-height: 1;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 0.98rem;
}

.composer-input {
  min-height: 132px;
  padding: 18px 18px;
  border-radius: 20px;
  background: var(--surface-muted);
  border-color: transparent;
  font-size: 1.02rem;
}

.link-preview-live {
  display: grid;
  gap: 10px;
}

.link-preview-label {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.composer-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: end;
}

.inline-field {
  display: grid;
  gap: 8px;
  color: var(--text-muted);
  font-weight: 700;
}

.visibility-picker {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.visibility-picker legend {
  padding: 0;
  color: var(--text-muted);
  font-weight: 700;
}

.visibility-picker {
  grid-template-columns: repeat(4, minmax(0, auto));
  align-items: end;
}

.visibility-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-muted);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.visibility-option:hover {
  border-color: var(--accent);
  background: var(--surface-soft);
  transform: translateY(-1px);
}

.visibility-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.visibility-option-face {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-strong);
  font-size: 0.95rem;
}

.visibility-option-label {
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.visibility-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px rgba(47, 111, 237, 0.08);
}

.visibility-option:has(input:checked) .visibility-option-face {
  background: rgba(47, 111, 237, 0.14);
}

.upload-trigger {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 12px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  background: var(--surface-muted);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.upload-trigger:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.visually-hidden-file {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.upload-trigger-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--surface-strong);
  font-size: 1.2rem;
  box-shadow: var(--shadow-soft);
}

.upload-trigger-copy {
  display: grid;
  gap: 2px;
}

.upload-trigger-copy strong {
  color: var(--text);
  font-size: 0.95rem;
}

.upload-trigger-copy span {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.composer-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
}

.composer-preview-item {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface-muted);
}

.composer-preview-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.composer-preview-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 37, 0.72);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
}

.inline-field select {
  min-width: 180px;
}

.avatar-placeholder.small {
  width: 44px;
  height: 44px;
}

.avatar-placeholder.tiny {
  width: 34px;
  height: 34px;
  font-size: 0.82rem;
}

.avatar-placeholder.large {
  width: 92px;
  height: 92px;
  font-size: 2rem;
}

.post-card {
  padding: 20px 22px;
}

.post-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.post-author {
  display: flex;
  gap: 12px;
  align-items: center;
}

.profile-link-card {
  color: var(--text);
}

.profile-link-card:hover {
  color: var(--text);
  opacity: 0.9;
}

.profile-link-inline {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--text);
}

.profile-link-inline:hover {
  color: var(--text);
  text-decoration: underline;
}

.post-body {
  font-size: 1rem;
  line-height: 1.68;
}

.link-preview-card {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-muted);
  color: var(--text);
  text-decoration: none;
}

.link-preview-card:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.link-preview-image {
  width: 100%;
  height: 100%;
  min-height: 148px;
  object-fit: cover;
  display: block;
  background: var(--surface-strong);
}

.link-preview-copy {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 16px 18px;
}

.link-preview-site {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.link-preview-copy strong {
  font-size: 1rem;
  line-height: 1.35;
}

.link-preview-copy p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.5;
}

.reaction-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.reaction-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
}

.reaction-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface-strong);
  font-size: 0.7rem;
  line-height: 1;
}

.reaction-count {
  line-height: 1;
}

.post-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.action-button {
  width: auto;
  min-width: 52px;
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.82rem;
  line-height: 1;
  color: var(--text);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  border-radius: 999px;
}

.action-button:hover {
  background: var(--surface-soft);
  transform: none;
  box-shadow: none;
}

.action-button.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

.reaction-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  font-size: 0.78rem;
  line-height: 1;
}

.action-button.active .reaction-icon {
  background: rgba(47, 111, 237, 0.14);
}

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

.comment-item {
  display: flex;
  gap: 9px;
  align-items: flex-start;
}

.comment-bubble {
  flex: 1;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--surface-muted);
}

.comment-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.comment-form textarea {
  min-height: 48px;
  max-height: 132px;
  border-radius: 18px;
  background: var(--surface-muted);
  border-color: transparent;
}

.profile-avatar-preview,
.profile-avatar-large {
  display: block;
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid var(--surface-strong);
  box-shadow: var(--shadow-soft);
}

.profile-avatar-large {
  width: 92px;
  height: 92px;
}

.post-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.post-media-image {
  width: 100%;
  border-radius: 18px;
  display: block;
  object-fit: cover;
  max-height: 420px;
  border: 1px solid var(--line);
}

.feed-sidebar {
  position: sticky;
  top: 104px;
}

.sidebar-card {
  padding: 22px;
}

.sidebar-heading {
  margin-bottom: 16px;
}

.sidebar-heading h2 {
  margin: 0;
  font-size: 1.35rem;
}

.sidebar-links {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.sidebar-links a {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 700;
}

.sidebar-links a:hover {
  border-color: var(--line-strong);
  background: var(--surface-muted);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-weight: 800;
  box-shadow: 0 10px 20px rgba(47, 111, 237, 0.18);
}

.button-link:hover {
  color: #fff;
  filter: saturate(1.06);
}

.secondary-link {
  background: var(--surface-strong);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.secondary-link:hover {
  color: var(--text);
}

.social-page {
  display: grid;
  gap: 22px;
}

.social-hero {
  padding: 26px;
}

.group-hero {
  overflow: hidden;
  padding: 0;
}

.group-hero-cover {
  position: relative;
  height: 220px;
  background: linear-gradient(135deg, #2f6fed, #7cb2ff);
}

.group-cover-image,
.group-card-cover {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.group-cover-fallback {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(47, 111, 237, 0.92), rgba(124, 178, 255, 0.82));
}

.group-hero-content {
  display: flex;
  gap: 18px;
  align-items: flex-end;
  padding: 0 26px 22px;
  margin-top: -52px;
}

.group-hero-avatar,
.group-card-avatar {
  width: 112px;
  height: 112px;
  border-radius: 24px;
  object-fit: cover;
  border: 4px solid var(--surface-strong);
  box-shadow: var(--shadow);
  background: var(--surface-strong);
}

.group-card-cover {
  height: 120px;
  margin: -18px -18px 0;
  border-radius: 18px 18px 0 0;
}

.group-card-avatar {
  width: 76px;
  height: 76px;
  margin-top: -42px;
}

.group-hero-copy {
  display: grid;
  gap: 8px;
  padding-bottom: 8px;
}

.group-media-form {
  padding: 0 26px 26px;
}

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

.section-header h2 {
  margin: 0;
}

.friends-layout,
.messages-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: start;
}

.friend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.friend-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-muted);
}

.friend-copy {
  display: grid;
  gap: 4px;
}

.friend-actions,
.profile-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

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

.request-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.request-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.message-sidebar,
.message-panel {
  min-height: 520px;
}

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

.thread-link {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-muted);
  color: var(--text);
}

.thread-link:hover,
.thread-link.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

.thread-copy {
  display: grid;
  gap: 3px;
}

.thread-snippet {
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.thread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
}

.message-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
}

.message-window-ready {
  position: fixed;
  right: 24px;
  bottom: 20px;
  z-index: 45;
  width: min(420px, calc(100vw - 24px));
  min-height: 0;
  max-height: min(72vh, 760px);
  border-radius: 22px;
  box-shadow: 0 28px 60px rgba(14, 22, 38, 0.22);
}

.message-window-ready .message-stream {
  overflow: auto;
  max-height: min(46vh, 420px);
  padding-right: 6px;
}

.message-window-ready.is-closed {
  display: none;
}

.message-window-launcher {
  position: fixed;
  right: 24px;
  bottom: 20px;
  z-index: 44;
  max-width: min(320px, calc(100vw - 24px));
}

.incoming-chat-alert {
  position: fixed;
  right: 24px;
  bottom: 20px;
  z-index: 50;
  display: grid;
  gap: 12px;
  width: min(360px, calc(100vw - 24px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 26px 60px rgba(12, 20, 35, 0.26);
}

.incoming-chat-alert p {
  margin: 0;
  color: var(--muted);
}

.incoming-chat-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.message-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.message-panel-head h2 {
  margin: 0;
}

.message-stream {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 4px 4px 4px 0;
}

.message-bubble {
  display: grid;
  gap: 6px;
  max-width: min(560px, 90%);
  padding: 14px 16px;
  border-radius: 20px 20px 20px 8px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
}

.message-bubble.own {
  margin-left: auto;
  border-radius: 20px 20px 8px 20px;
  background: var(--accent-soft);
}

.message-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}

.message-form textarea {
  min-height: 72px;
  max-height: 180px;
}

.empty-state {
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 360px;
}

.profile-card {
  padding: 26px;
}

@media (max-width: 980px) {
  .feed-layout {
    grid-template-columns: 1fr;
  }

  .friends-layout,
  .messages-layout {
    grid-template-columns: 1fr;
  }

  .message-window-ready,
  .message-window-launcher,
  .incoming-chat-alert {
    right: 16px;
    left: 16px;
    width: auto;
    max-width: none;
  }

  .feed-sidebar {
    position: static;
  }

  .composer-footer {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .shell {
    width: min(100% - 18px, 1240px);
  }

  .topbar-inner {
    flex-direction: column;
    align-items: stretch;
    padding: 14px 0;
  }

  .nav {
    justify-content: flex-start;
    flex-direction: column;
    align-items: stretch;
  }

  .nav-links,
  .nav-utilities {
    width: 100%;
  }

  .nav-group {
    width: 100%;
  }

  .nav-group summary {
    width: 100%;
    justify-content: space-between;
  }

  .nav-menu {
    position: static;
    min-width: 0;
    margin-top: 8px;
  }

  .user-chip {
    width: 100%;
    justify-content: flex-start;
  }

  .visibility-picker {
    grid-template-columns: 1fr;
  }

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

  .link-preview-image {
    min-height: 188px;
  }

  .comment-form,
  .message-form {
    grid-template-columns: 1fr;
  }
}
