:root {
  --bg: #0d0d0f;
  --bg-nav: #0b0b0e;
  --surface: #141418;
  --surface-elev: #17171d;
  --surface-strong: #1a1a24;
  --border: #1f1f26;
  --text: #f5f5f7;
  --muted: #8a8a99;
  --primary: #1a8cff;
  --primary-hover: #3a9bff;
  --primary-contrast: #f5f8ff;
  --accent: #ff3b6a;
  --success: #32c27d;
  --danger: #ff5b6b;
  --radius-base: 6px;
  --radius-button: 8px;
  --radius-media: 10px;
  --shadow-ambient: 0 1px 2px rgba(0, 0, 0, 0.26);
  --left-rail-collapsed: 72px;
  --left-rail-expanded: 240px;
}

html[data-theme='dark'] {
  --bg: #0d0d0f;
  --bg-nav: #0b0b0e;
  --surface: #141418;
  --surface-elev: #17171d;
  --surface-strong: #1a1a24;
  --border: #1f1f26;
  --text: #f5f5f7;
  --muted: #8a8a99;
  --primary: #1a8cff;
  --primary-hover: #3a9bff;
  --primary-contrast: #f5f8ff;
}

html[data-theme='light'] {
  --bg: #f5f7fb;
  --bg-nav: #edf1f8;
  --surface: #ffffff;
  --surface-elev: #f7f9fd;
  --surface-strong: #eef3fb;
  --border: #d7deea;
  --text: #12131a;
  --muted: #5f6474;
  --primary: #1a7ff0;
  --primary-hover: #2e8fff;
  --primary-contrast: #f7f9ff;
  --accent: #d73461;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.28;
}

h1,
h2,
h3,
h4,
strong,
button,
input,
textarea,
select {
  font-family: 'Inter', 'Segoe UI', sans-serif;
}

h1,
h2,
h3,
h4 {
  font-weight: 600;
  letter-spacing: -0.01em;
}

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

a {
  color: var(--primary);
}

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

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.app-shell {
  --left-rail-width: var(--left-rail-collapsed);
  display: grid;
  grid-template-columns: var(--left-rail-width) minmax(600px, 680px) minmax(300px, 340px);
  justify-content: center;
  gap: 16px;
  min-height: 100vh;
  padding: 0 16px 16px;
  transition: grid-template-columns 120ms ease;
}

body.sidebar-expanded .app-shell {
  --left-rail-width: var(--left-rail-expanded);
}

.left-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 14px 10px;
  border-right: 1px solid var(--border);
  background: var(--bg-nav);
  border-radius: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.content {
  min-height: calc(100vh - 16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-base);
  background: var(--surface);
  overflow: auto;
}

.right-rail {
  position: sticky;
  top: 8px;
  height: calc(100vh - 16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-base);
  background: var(--surface);
  overflow: auto;
  padding: 12px;
}

.sidebar-hover-handle {
  position: fixed;
  top: 12px;
  left: 14px;
  z-index: 40;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-base);
  background: var(--surface-strong);
  box-shadow: var(--shadow-ambient);
}

.sidebar-hover-handle span {
  width: 3px;
  height: 12px;
  border-radius: 2px;
  background: var(--text);
  opacity: 0.8;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 4px;
  margin-bottom: 10px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-button);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.brand-copy h1 {
  margin: 0;
  font-size: 0.95rem;
}

.brand-copy p {
  margin: 2px 0 0;
  font-size: 0.76rem;
  color: var(--muted);
}

.main-nav {
  display: grid;
  gap: 4px;
}

.nav-btn {
  width: 100%;
  height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius-button);
  background: transparent;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
  text-align: left;
  font-weight: 500;
  color: var(--muted);
}

.nav-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-icon svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.nav-label {
  white-space: nowrap;
}

.nav-btn:hover,
.nav-btn.active {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface-strong);
}

.left-meta {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 10px 4px 2px;
}

.left-meta h2,
.panel h2 {
  margin: 0 0 6px;
  font-size: 0.79rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}

.left-meta p,
.hint,
.status,
.meta,
.inline-note,
.search-hit-btn span,
.screen-subtitle {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.78rem;
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-base);
  background: var(--surface-elev);
  padding: 12px;
  margin-bottom: 10px;
}

.presence-list,
.trend-list,
.feed-list,
.comment-list,
.message-list,
.server-list,
.dm-list,
.ping-user-list,
.search-results,
.channel-list,
.member-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.presence-list,
.trend-list,
.ping-user-list,
.search-results,
.channel-list,
.member-list {
  display: grid;
  gap: 6px;
}

.presence-list li,
.trend-list li {
  border: 1px solid var(--border);
  border-radius: var(--radius-base);
  background: var(--surface-strong);
  padding: 7px 8px;
  font-size: 0.82rem;
}

.mobile-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  display: none;
  gap: 8px;
  grid-auto-flow: column;
  grid-auto-columns: minmax(86px, 1fr);
  padding: 10px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  overflow-x: auto;
}

.mobile-nav .nav-btn {
  height: 38px;
  justify-content: center;
  font-size: 0.82rem;
  padding: 0;
  border-color: var(--border);
  background: var(--surface-elev);
}

body.auth-route .left-rail,
body.auth-route .right-rail,
body.auth-route .mobile-nav,
body.auth-route .sidebar-hover-handle {
  display: none;
}

body.auth-route .app-shell {
  grid-template-columns: minmax(0, 640px);
  justify-content: center;
  padding-top: 20px;
}

body.auth-route .content {
  border: 0;
  background: transparent;
}

body:not(.sidebar-expanded) .left-rail .brand-copy,
body:not(.sidebar-expanded) .left-rail .nav-label,
body:not(.sidebar-expanded) .left-rail .left-meta {
  opacity: 0;
  width: 0;
  max-height: 0;
  overflow: hidden;
  pointer-events: none;
}

body:not(.sidebar-expanded) .left-rail .main-nav {
  justify-items: center;
}

body:not(.sidebar-expanded) .left-rail .nav-btn {
  width: 52px;
  justify-content: center;
  padding: 0;
}

.login-page {
  width: 100%;
  max-width: 560px;
}

.login-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-base);
  background: var(--surface);
  padding: 16px;
  box-shadow: var(--shadow-ambient);
}

.login-card h2 {
  margin: 0;
  font-size: 1.3rem;
}

.login-logo {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-button);
  border: 1px solid var(--border);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auth-tab {
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-button);
  background: var(--surface);
  font-size: 0.84rem;
  font-weight: 500;
}

.auth-tab.active {
  background: var(--primary);
  color: var(--primary-contrast);
  border-color: transparent;
}

.auth-panel[hidden] {
  display: none;
}

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

.screen > :not(.screen-header):not(.feed-list) {
  margin-inline: 16px;
}

.screen-header {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  margin: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.screen-header h2 {
  margin: 0;
  font-size: 1.02rem;
}

.topbar-search-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-base);
  background: var(--surface-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.topbar-search-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.topbar-search-btn:hover {
  color: var(--text);
  border-color: var(--primary);
}

.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.72rem;
  color: var(--muted);
}

.inline-badge {
  margin-top: 2px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-strong);
}

.author-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.author-link,
.author-handle {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  white-space: nowrap;
}

.author-link {
  font-weight: 600;
  color: var(--text);
}

.author-handle {
  color: var(--muted);
}

.account-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 6px;
  min-height: 16px;
  font-size: 0.68rem;
  line-height: 1.1;
  vertical-align: middle;
}

.plus-tag {
  color: var(--primary-contrast);
  border-color: rgba(26, 140, 255, 0.5);
  background: rgba(26, 140, 255, 0.4);
  font-weight: 600;
}

.employee-tag {
  color: #cfe7ff;
  border-color: rgba(34, 193, 255, 0.45);
  background: rgba(34, 193, 255, 0.18);
  font-weight: 700;
}

.founder-tag {
  padding: 1px 5px;
  border-color: rgba(26, 140, 255, 0.45);
  background: rgba(26, 140, 255, 0.25);
}

.founder-tag img {
  width: 0.72rem;
  height: 0.72rem;
  display: block;
  border-radius: 2px;
}

.post-author-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: nowrap;
}

.post-author-row .author-link,
.post-author-row .author-handle,
.post-author-row .meta {
  font-size: 0.84rem;
}

.meta-dot {
  color: var(--muted);
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-base);
  background: var(--surface-elev);
  padding: 16px;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.79rem;
  color: var(--muted);
}

.legal-agreement {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--muted);
}

.legal-agreement input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  flex: 0 0 auto;
  accent-color: var(--primary);
}

.legal-agreement a {
  color: var(--primary);
  text-decoration: none;
}

.legal-agreement a:hover {
  text-decoration: underline;
}

input,
select,
textarea {
  width: 100%;
  border-radius: var(--radius-base);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
}

input,
select {
  height: 40px;
  padding: 0 10px;
}

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

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.primary-btn,
.secondary-btn,
.danger-btn {
  height: 40px;
  border-radius: var(--radius-button);
  padding: 0 14px;
  font-size: 0.84rem;
  font-weight: 500;
}

.primary-btn {
  border: 1px solid transparent;
  background: var(--primary);
  color: var(--primary-contrast);
}

.primary-btn:hover {
  background: var(--primary-hover);
}

.secondary-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
}

.secondary-btn:hover {
  border-color: var(--primary);
}

.danger-btn {
  border: 1px solid rgba(255, 91, 107, 0.5);
  background: rgba(255, 91, 107, 0.1);
  color: var(--danger);
}

.compact-btn {
  height: 32px;
  padding: 0 10px;
  font-size: 0.76rem;
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.inline-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: pingup-spin 0.75s linear infinite;
}

@keyframes pingup-spin {
  to {
    transform: rotate(360deg);
  }
}

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

.composer-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-base);
  background: var(--surface-elev);
  padding: 14px;
}

.media-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.media-chip {
  border: 1px solid var(--border);
  border-radius: var(--radius-base);
  background: var(--surface-strong);
  padding: 8px;
  font-size: 0.78rem;
  color: var(--muted);
}

.feed-list {
  display: grid;
  gap: 0;
}

.feed-list > li {
  border-bottom: 1px solid var(--border);
}

.feed-list > li:last-child {
  border-bottom: 0;
}

.post {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 14px 16px;
}

.post-header,
.message header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.post-body,
.post p,
.message p {
  margin: 8px 0;
  white-space: pre-wrap;
  line-height: 1.33;
}

.post-body.is-clamped {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.show-more-btn {
  border: 0;
  background: transparent;
  color: var(--primary);
  padding: 0;
  margin-top: -2px;
  font-size: 0.8rem;
  font-weight: 500;
}

.post .media-grid,
.message .media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.media-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-media);
  overflow: hidden;
  background: var(--surface-strong);
}

.media-card button {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
}

.media-card img,
.media-card video {
  width: 100%;
  max-height: 340px;
  object-fit: cover;
}

.media-card audio {
  width: 100%;
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 6px;
}

.icon-action {
  border: 0;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 0;
  min-height: 24px;
}

.icon-action .icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-action svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.icon-action .count {
  margin-left: 0;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
  font-size: 0.8rem;
  transition: max-width 110ms ease, opacity 110ms ease, margin-left 110ms ease;
}

.text-action .count {
  opacity: 1;
  max-width: 60px;
  margin-left: 0;
}

.post:hover .icon-action .count,
.icon-action:focus-visible .count {
  margin-left: 5px;
  max-width: 50px;
  opacity: 1;
}

.icon-action:hover {
  color: var(--text);
}

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

.moderation-action:hover {
  color: #ff8ba0;
}

.icon-action.pop-once .icon {
  animation: pingup-pop 120ms ease-out;
}

.icon-action.spin-once .icon {
  animation: pingup-rotate 100ms ease-out;
}

@keyframes pingup-pop {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.12);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes pingup-rotate {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(90deg);
  }
}

.comment-form {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

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

.comment-list .card {
  padding: 10px;
}

.message-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.message,
.server-item,
.dm-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-base);
  background: var(--surface-elev);
  padding: 10px;
}

.profile-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.profile-avatar {
  width: 82px;
  height: 82px;
}

.profile-meta h3 {
  margin: 0;
}

.profile-meta p {
  margin: 6px 0 0;
}

.profile-stats {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  color: var(--muted);
}

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

.ping-layout {
  align-items: start;
}

.ping-directory {
  max-height: calc(100vh - 190px);
  overflow: auto;
}

.room-directory-screen {
  gap: 10px;
}

.room-meta-row {
  margin-top: 8px;
}

.room-member-line {
  margin-top: 2px;
}

.ping-search {
  margin-top: 3px;
}

.ping-user-btn,
.channel-list button,
.server-list button,
.dm-list button {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-base);
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  padding: 8px;
}

.ping-user-btn:hover,
.channel-list button:hover,
.server-list button:hover,
.dm-list button:hover {
  border-color: var(--primary);
}

.ping-user-btn.active,
.channel-list button.active,
.server-list button.active,
.dm-list button.active {
  background: var(--surface-strong);
  border-color: var(--primary);
}

.ping-user-meta {
  display: grid;
  gap: 2px;
  line-height: 1.2;
}

.ping-user-meta span {
  color: var(--muted);
  font-size: 0.76rem;
}

.tabs {
  display: inline-flex;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
}

.tabs button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  padding: 6px 12px;
}

.tabs button.active {
  background: var(--primary);
  color: var(--primary-contrast);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-base);
  background: var(--surface-elev);
  padding: 12px;
}

.setting-row h3 {
  margin: 0;
  font-size: 0.9rem;
}

.pingai-card {
  padding: 0;
  overflow: hidden;
}

.pingai-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(26, 140, 255, 0.14), rgba(26, 140, 255, 0.05));
}

.pingai-head h3 {
  margin: 0;
}

.pingai-thread {
  list-style: none;
  margin: 0;
  padding: 12px 14px;
  display: grid;
  gap: 9px;
  max-height: 420px;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(26, 140, 255, 0.04), transparent 60%);
}

.pingai-message {
  display: grid;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-base);
  background: var(--surface-strong);
  padding: 10px;
}

.pingai-message.user {
  border-color: rgba(26, 140, 255, 0.45);
  background: rgba(26, 140, 255, 0.13);
}

.pingai-message.assistant {
  border-color: rgba(255, 59, 106, 0.3);
  background: rgba(255, 59, 106, 0.08);
}

.pingai-message.pending p {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pingai-role {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}

.pingai-message p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.35;
}

.pingai-empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius-base);
  padding: 12px;
  color: var(--muted);
  text-align: center;
}

.pingai-card .composer {
  border-top: 1px solid var(--border);
  padding: 12px 14px 14px;
}

.pingai-gate-card {
  background: linear-gradient(135deg, rgba(26, 140, 255, 0.15), rgba(255, 59, 106, 0.08));
}

.plus-card {
  background: linear-gradient(160deg, rgba(26, 140, 255, 0.18), rgba(20, 20, 24, 0.86));
  border-color: rgba(26, 140, 255, 0.42);
}

.plus-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.plus-card-head h3 {
  margin: 0;
}

.plus-price {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(26, 140, 255, 0.48);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--primary-contrast);
  background: rgba(26, 140, 255, 0.38);
  font-weight: 600;
}

.plus-feature-list {
  list-style: none;
  margin: 12px 0;
  padding: 0;
  display: grid;
  gap: 7px;
}

.plus-feature-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-base);
  background: rgba(13, 13, 15, 0.35);
  padding: 8px 10px;
}

.plus-feature-list li span {
  color: var(--primary);
  font-weight: 600;
}

.settings-avatar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-base);
  background: var(--surface-elev);
  padding: 10px;
}

.settings-avatar-preview {
  width: 72px;
  height: 72px;
}

.settings-avatar-actions {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 6px;
}

.settings-avatar-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.toggle {
  appearance: none;
  width: 46px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-strong);
  position: relative;
}

.toggle::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text);
  transition: transform 120ms ease;
}

.toggle:checked {
  background: var(--primary);
  border-color: var(--primary);
}

.toggle:checked::before {
  transform: translateX(17px);
  background: var(--primary-contrast);
}

.explore-mobile-search {
  display: none;
}

.media-viewer,
.search-modal {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  width: min(620px, calc(100vw - 24px));
  box-shadow: var(--shadow-ambient);
}

.media-viewer::backdrop,
.search-modal::backdrop {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
}

#media-viewer-content {
  padding: 12px;
}

.close-btn {
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-button);
  background: var(--surface-strong);
  padding: 0 12px;
  color: var(--text);
}

.close-btn:hover {
  border-color: var(--primary);
}

#media-viewer-close {
  margin: 0 12px 12px;
}

.search-modal-content {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.search-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.search-modal-head h2 {
  margin: 0;
  font-size: 1rem;
}

.search-results {
  max-height: 360px;
  overflow: auto;
}

.search-hit-btn {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-base);
  background: var(--surface-strong);
  text-align: left;
  padding: 9px 10px;
  display: grid;
  gap: 3px;
}

.search-hit-btn strong {
  font-size: 0.86rem;
  line-height: 1.2;
}

.search-hit-btn:hover {
  border-color: var(--primary);
}

.status {
  font-size: 0.8rem;
}

.success {
  color: var(--success);
}

.error {
  color: var(--danger);
}

.empty-state {
  border: 1px dashed var(--border);
  border-radius: var(--radius-base);
  padding: 16px;
  text-align: center;
  color: var(--muted);
}

.site-footer {
  margin: 0 16px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-base);
  background: var(--surface);
  padding: 10px 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.site-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.site-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.site-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 1320px) {
  .app-shell {
    grid-template-columns: var(--left-rail-width) minmax(0, 1fr) minmax(280px, 320px);
  }
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: var(--left-rail-width) minmax(0, 1fr);
  }

  .right-rail {
    display: none;
  }
}

@media (max-width: 880px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 0 0 72px;
    gap: 0;
  }

  .left-rail,
  .sidebar-hover-handle {
    display: none;
  }

  .content {
    min-height: calc(100vh - 72px);
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .mobile-nav {
    display: grid;
  }

  .topbar-search-btn {
    display: none;
  }

  .explore-mobile-search {
    display: grid;
    margin-bottom: 6px;
  }

  .split,
  .two-col {
    grid-template-columns: 1fr;
  }

  .screen > :not(.screen-header):not(.feed-list) {
    margin-inline: 12px;
  }

  .post {
    padding-inline: 12px;
  }

  .icon-action .count {
    margin-left: 5px;
    max-width: 50px;
    opacity: 1;
  }

  .site-footer {
    margin: 8px 10px 82px;
    gap: 8px;
    justify-content: flex-start;
  }

  .settings-avatar-row {
    align-items: flex-start;
    flex-direction: column;
  }
}
