/* Nodefeed client styles. Light and dark themes follow the system setting. */

:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f0f1ee;
  --border: #e3e4df;
  --text: #16181a;
  --muted: #646a70;
  --accent: #2f6f5e;
  --accent-text: #ffffff;
  --accent-soft: #e2efe9;
  --like: #d0384f;
  --repost: #1f8a5b;
  --danger: #c0352b;
  --shadow: 0 8px 30px rgb(0 0 0 / 0.12);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --tab-bar: 60px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111214;
    --surface: #18191c;
    --surface-2: #222429;
    --border: #2c2f35;
    --text: #eceef0;
    --muted: #9198a1;
    --accent: #5fbf9f;
    --accent-text: #0b1512;
    --accent-soft: #1d3029;
    --like: #f0657a;
    --repost: #4cc38a;
    --danger: #ff6b5e;
    --shadow: 0 8px 30px rgb(0 0 0 / 0.5);
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  text-decoration: underline;
}

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

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

code,
pre {
  font-family: var(--mono);
  font-size: 0.9em;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.skip-link {
  position: absolute;
  left: -999px;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
  z-index: 100;
  background: var(--surface);
  padding: 8px 12px;
  border-radius: 8px;
}

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

.small {
  font-size: 13px;
}

.center {
  text-align: center;
}

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

.icon {
  flex: none;
  display: block;
}

/* ------------------------------------------------------------------ buttons and forms */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none !important;
}

.button:hover {
  filter: brightness(1.06);
}

.button:disabled {
  opacity: 0.5;
  cursor: default;
}

.button.secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.button.secondary:hover {
  background: var(--surface-2);
}

.button.danger {
  background: var(--danger);
  color: #fff;
}

.button.small {
  min-height: 32px;
  padding: 0 14px;
  font-size: 14px;
}

.button.following .label-hover {
  display: none;
}

.button.following:hover .label-default {
  display: none;
}

.button.following:hover .label-hover {
  display: inline;
  color: var(--danger);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.icon-button:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.icon-button:disabled {
  opacity: 0.4;
  cursor: default;
}

.icon-button.small {
  width: 30px;
  height: 30px;
}

.icon-button.text {
  width: auto;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 600;
}

.icon-button.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.icon-button.bordered {
  border: 1px solid var(--border);
}

.link-button {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form label,
.inline-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-size: 14px;
}

.form p {
  margin: 0;
}

input:not([type="checkbox"]),
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-weight: 400;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea {
  resize: vertical;
}

.input-affix {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}

.input-affix:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input-affix span {
  padding: 0 4px 0 10px;
  color: var(--muted);
  font-weight: 400;
  white-space: nowrap;
}

.input-affix span:last-child {
  padding: 0 10px 0 2px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.input-affix input {
  border: 0;
  box-shadow: none !important;
  padding-left: 0;
  min-width: 60px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.inline-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.inline-form label {
  flex: 1;
  min-width: 0;
}

.checkbox {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
}

/* ------------------------------------------------------------------ layout */

.layout {
  display: grid;
  grid-template-columns: 1fr minmax(0, 620px) 1fr;
  max-width: 1280px;
  margin: 0 auto;
  min-height: 100vh;
}

.content {
  grid-column: 2;
  min-width: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding-bottom: 80px;
}

.sidebar {
  grid-column: 1;
  justify-self: end;
  position: sticky;
  top: 0;
  height: 100vh;
  width: 250px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  font-weight: 800;
  font-size: 20px;
  color: var(--text);
}

.brand:hover {
  text-decoration: none;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: 999px;
  color: var(--text);
  font-size: 17px;
}

.sidebar-nav a:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.sidebar-nav a.active {
  font-weight: 750;
}

.sidebar-nav a.active .icon {
  stroke-width: 2.6;
}

.nav-icon {
  position: relative;
  display: inline-flex;
}

.dot {
  position: absolute;
  top: -6px;
  right: -9px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.compose-button {
  margin-top: 12px;
  min-height: 48px;
  font-size: 16px;
}

.me-card {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 999px;
  color: var(--text);
}

.me-card:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.me-card .nav-label {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.me-card .nav-label > * {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-panel {
  grid-column: 3;
  position: sticky;
  top: 0;
  height: 100vh;
  width: 320px;
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.panel-card h3 {
  font-size: 16px;
  margin-bottom: 4px;
}

.panel-card p {
  margin: 4px 0 0;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.status-dot.on {
  background: var(--repost);
}

.tab-bar,
.fab {
  display: none;
}

.page-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 6px 12px 6px 16px;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  flex: 1;
  font-size: 19px;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-header .icon-button:first-child {
  margin-left: -8px;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.offline-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 14px;
}

/* Wide tablets and small laptops: icon rail, no side panel. */
@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 88px minmax(0, 620px) 1fr;
  }

  .side-panel {
    display: none;
  }

  .sidebar {
    width: 88px;
    align-items: center;
    padding: 12px 8px;
  }

  .nav-label {
    display: none !important;
  }

  .compose-button {
    width: 52px;
    padding: 0;
  }
}

/* Phones: bottom tab bar and a floating compose button. */
@media (max-width: 720px) {
  .layout {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .content {
    border: 0;
    min-height: 100vh;
    padding-bottom: calc(var(--tab-bar) + 80px + env(safe-area-inset-bottom));
  }

  .tab-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: flex;
    justify-content: space-around;
    height: calc(var(--tab-bar) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
  }

  .tab-bar a {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
  }

  .tab-bar a.active {
    color: var(--text);
  }

  .tab-bar a.active .icon {
    stroke-width: 2.6;
  }

  .fab {
    position: fixed;
    right: 18px;
    bottom: calc(var(--tab-bar) + 18px + env(safe-area-inset-bottom));
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-text);
    box-shadow: var(--shadow);
    cursor: pointer;
  }

  .in-conversation + .fab,
  .layout.in-conversation ~ .tab-bar {
    display: none;
  }

  .layout.in-conversation .content {
    padding-bottom: 0;
  }
}

/* ------------------------------------------------------------------ boot, spinner, empty states, toasts */

.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.spinner {
  width: 26px;
  height: 26px;
  margin: 28px auto;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.empty {
  padding: 56px 32px;
  text-align: center;
  color: var(--muted);
}

.empty .icon {
  margin: 0 auto 12px;
}

.empty h3 {
  color: var(--text);
  font-size: 18px;
  margin-bottom: 6px;
}

.empty p {
  margin: 0 auto;
  max-width: 380px;
}

.error-box {
  margin: 16px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--danger) 8%, transparent);
}

.error-box p {
  margin: 0 0 10px;
}

.toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow);
  font-weight: 550;
  animation: rise 0.2s ease-out;
  max-width: min(90vw, 480px);
}

.toast.error {
  background: var(--danger);
  color: #fff;
}

@media (max-width: 720px) {
  .toasts {
    bottom: calc(var(--tab-bar) + 90px + env(safe-area-inset-bottom));
  }
}

@keyframes rise {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
}

/* ------------------------------------------------------------------ avatars */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
}

.avatar.placeholder {
  background: hsl(var(--hue) 45% 50%);
  color: #fff;
  font-weight: 700;
}

/* ------------------------------------------------------------------ posts */

.compose-prompt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  text-align: left;
  cursor: text;
}

.compose-prompt:hover {
  background: var(--surface-2);
}

.reply-prompt {
  font-size: 15px;
  padding-left: 72px;
}

.new-posts {
  display: block;
  margin: 10px auto;
  padding: 8px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 650;
  cursor: pointer;
  position: sticky;
  top: 62px;
  z-index: 4;
  box-shadow: var(--shadow);
}

.post {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}

.post:hover {
  background: color-mix(in srgb, var(--surface-2) 45%, transparent);
}

.post.focused {
  cursor: default;
  background: transparent;
}

.post-reason {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px 40px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.post-reason a {
  color: inherit;
}

.post-layout {
  display: flex;
  gap: 12px;
}

.post-avatar {
  flex: none;
}

.post-main {
  flex: 1;
  min-width: 0;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}

.author-name {
  flex: 0 1 auto;
  color: var(--text);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The handle gives way first when the line is short. */
.handle {
  flex: 0 100 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.post-menu-anchor {
  position: relative;
  margin-left: auto;
}

.menu {
  position: absolute;
  right: 0;
  top: 32px;
  z-index: 10;
  min-width: 200px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  text-align: left;
  cursor: pointer;
  font-weight: 550;
}

.menu button:hover {
  background: var(--surface-2);
}

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

.reply-context {
  margin-top: 1px;
}

.post-title {
  font-size: 18px;
  margin: 4px 0 2px;
}

.post-text {
  overflow-wrap: anywhere;
  margin-top: 2px;
}

.post-text > :first-child {
  margin-top: 0;
}

.post-text > :last-child {
  margin-bottom: 0;
}

.post-text p {
  margin: 0 0 8px;
}

.post-text pre {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  overflow-x: auto;
}

.post-text blockquote {
  margin: 0 0 8px;
  padding-left: 12px;
  border-left: 3px solid var(--border);
  color: var(--muted);
}

.post-text img {
  max-width: 100%;
}

.post-text.large {
  font-size: 18px;
  margin-top: 8px;
}

.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag {
  font-size: 14px;
}

.full-time {
  margin-top: 12px;
}

.post-actions {
  display: flex;
  justify-content: space-between;
  max-width: 420px;
  margin: 6px 0 -6px -8px;
}

.action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 56px;
  height: 34px;
  padding: 0 8px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.action:hover {
  background: var(--surface-2);
}

.action.reply:hover,
.action.quote:hover {
  color: var(--accent);
}

.action.repost:hover,
.action.repost.active {
  color: var(--repost);
}

.action.like:hover,
.action.like.active {
  color: var(--like);
}

.action.active .icon {
  animation: pop 0.25s ease-out;
}

@keyframes pop {
  50% {
    transform: scale(1.25);
  }
}

.attachments {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.attachments.count-2,
.attachments.count-3,
.attachments.count-4 {
  grid-template-columns: 1fr 1fr;
}

.attachments.count-3 > :first-child {
  grid-row: span 2;
}

.attachment {
  position: relative;
  display: block;
  background: var(--surface-2);
}

.attachment img,
video.attachment {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 520px;
  object-fit: cover;
}

.attachments:not(.count-1) .attachment img {
  aspect-ratio: 1;
}

.attachments.count-1 .attachment img {
  height: auto;
  object-fit: contain;
}

.attachment.audio {
  width: 100%;
}

.attachment.file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px;
}

.alt-badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgb(0 0 0 / 0.7);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.quoted {
  display: block;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}

.quoted:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.quoted .post-meta {
  margin-bottom: 4px;
}

.quoted.loading,
.quoted.unavailable {
  color: var(--muted);
  font-size: 14px;
}

/* ------------------------------------------------------------------ threads */

.thread .ancestor .post {
  border-bottom: 0;
  position: relative;
}

.thread .ancestor .post::before {
  content: "";
  position: absolute;
  left: 37px;
  top: 60px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.replies.depth-1,
.replies.depth-2,
.replies.depth-3,
.replies.depth-4 {
  margin-left: 22px;
  border-left: 2px solid var(--border);
}

.engagement {
  display: flex;
  gap: 18px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.engagement .link-button {
  color: var(--muted);
}

.engagement strong {
  color: var(--text);
}

/* ------------------------------------------------------------------ explore, people */

.search-form {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 16px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
}

.side-panel .search-form {
  margin: 0;
}

.search-form:focus-within {
  border-color: var(--accent);
  background: var(--surface);
}

.search-form input {
  border: 0;
  background: transparent;
  box-shadow: none !important;
  padding: 10px 0;
}

.section-label {
  padding: 14px 16px 6px;
  font-weight: 750;
  font-size: 15px;
  border-bottom: 1px solid var(--border);
}

.person-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.person-names {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  color: var(--text);
}

.person-names:hover {
  text-decoration: none;
}

.person-names > * {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ notifications */

.notification {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.notification:hover {
  background: color-mix(in srgb, var(--surface-2) 45%, transparent);
  text-decoration: none;
}

.notification-icon {
  width: 32px;
  display: flex;
  justify-content: flex-end;
  font-size: 22px;
  line-height: 1;
}

.notification.reaction .notification-icon {
  color: var(--like);
}

.notification.repost .notification-icon {
  color: var(--repost);
}

.notification.follow .notification-icon {
  color: var(--accent);
}

.notification p {
  margin: 6px 0 0;
}

/* ------------------------------------------------------------------ profiles */

.profile-banner {
  height: 180px;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface-2));
  background-size: cover;
  background-position: center;
}

.profile-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 16px;
  margin-top: -48px;
}

.profile-avatar .avatar {
  border: 4px solid var(--surface);
  box-sizing: content-box;
}

.profile-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-bottom: 6px;
}

.profile-info {
  padding: 8px 16px 12px;
}

.profile-info h2 {
  font-size: 22px;
  font-weight: 800;
}

.did-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  margin-top: 2px;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.did-chip:hover {
  color: var(--text);
}

.did-chip.wide {
  display: flex;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
}

.did-chip.wide code {
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-about {
  margin: 10px 0 6px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.profile-website {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.tabs a {
  flex: 1;
  padding: 14px 8px;
  text-align: center;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  font-size: 14px;
}

.tabs a:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.tabs a.active {
  color: var(--text);
  font-weight: 650;
  border-bottom-color: var(--accent);
}

.tabs strong {
  color: var(--text);
}

.image-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-weight: 600;
  font-size: 14px;
}

.image-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.image-picker-preview {
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px dashed var(--border);
  background: var(--surface-2);
  color: var(--muted);
  overflow: hidden;
  cursor: pointer;
}

.image-picker.round .image-picker-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
}

.image-picker.wide .image-picker-preview {
  width: 180px;
  height: 64px;
  border-radius: 10px;
}

.image-picker-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-picker-actions {
  display: flex;
  gap: 6px;
}

/* ------------------------------------------------------------------ dialogs and the composer */

.modal {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.modal.wide {
  width: min(640px, calc(100vw - 24px));
}

.modal::backdrop {
  background: rgb(0 0 0 / 0.45);
}

.modal-body {
  padding: 4px 18px 18px;
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 -18px 8px;
  padding: 8px 10px 8px 18px;
  background: var(--surface);
}

.modal-header h2 {
  font-size: 18px;
}

@media (max-width: 720px) {
  .modal,
  .modal.wide {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }
}

.composer-context {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  border-radius: 12px;
  background: var(--surface-2);
}

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

.composer-fields {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.composer textarea,
.composer .composer-title {
  border: 0;
  padding: 8px 0;
  font-size: 17px;
  background: transparent;
  box-shadow: none !important;
}

.composer .composer-title {
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}

.composer textarea {
  min-height: 120px;
}

.composer-files {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.composer-file {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.composer-file img,
.composer-file .file-name {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  background: var(--surface-2);
}

.composer-file .file-name {
  display: grid;
  place-items: center;
  padding: 8px;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.composer-file input {
  font-size: 12px;
  padding: 6px 8px;
}

.composer-file .remove {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgb(0 0 0 / 0.65);
  color: #fff;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.composer-tools,
.composer-submit {
  display: flex;
  align-items: center;
  gap: 8px;
}

.composer-tools .icon-button {
  color: var(--accent);
}

.code {
  max-height: 50vh;
  overflow: auto;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 12.5px;
}

.account-did {
  display: grid;
  gap: 6px;
  margin-top: 16px;
}

.account-did input {
  font-family: var(--mono, monospace);
  font-size: 13px;
}

.verified {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--repost);
  font-weight: 600;
}

/* ------------------------------------------------------------------ messages */

.setup-card {
  margin: 24px 16px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.setup-card .icon {
  margin: 0 auto 10px;
  color: var(--accent);
}

.setup-card p {
  max-width: 440px;
  margin: 10px auto;
}

.conversation {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.conversation:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.conversation-text {
  flex: 1;
  min-width: 0;
}

.conversation-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.conversation-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation.unread .conversation-preview {
  color: var(--text);
  font-weight: 600;
}

.badge {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}

.conversation-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.e2e-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
}

.bubbles {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 16px 16px;
}

.bubble {
  max-width: 78%;
  padding: 8px 12px;
  border-radius: 18px;
}

.bubble p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bubble.incoming {
  align-self: flex-start;
  background: var(--surface-2);
  border-bottom-left-radius: 6px;
}

.bubble.outgoing {
  align-self: flex-end;
  background: var(--accent);
  color: var(--accent-text);
  border-bottom-right-radius: 6px;
}

.bubble-time {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  opacity: 0.7;
}

.message-form {
  position: sticky;
  bottom: 0;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.message-form p {
  margin: 0 0 6px;
}

.message-input {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.message-input textarea {
  min-height: 42px;
  max-height: 160px;
  border-radius: 21px;
  padding: 10px 16px;
  resize: none;
}

.icon-button.send {
  flex: none;
  width: 42px;
  height: 42px;
  background: var(--accent);
  color: var(--accent-text);
}

/* ------------------------------------------------------------------ settings */

.settings {
  padding: 0 16px 24px;
}

.settings-section {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.settings-section:last-child {
  border-bottom: 0;
}

.settings-section h2 {
  font-size: 17px;
  margin-bottom: 8px;
}

.settings-section p {
  margin: 6px 0 10px;
}

.phrase {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 12px;
  margin: 8px 0 12px;
  padding: 12px 12px 12px 36px;
  border-radius: 10px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 15px;
}

.phrase li::marker {
  color: var(--muted, currentColor);
  font-size: 12px;
}

@media (max-width: 420px) {
  .phrase {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ------------------------------------------------------------------ first run */

.welcome {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.welcome-card {
  width: min(460px, 100%);
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.welcome-card .brand {
  padding: 0;
  margin-bottom: 18px;
}

.welcome-card h2 {
  font-size: 22px;
}

.choice {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.choice:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.node-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--text);
}

.node-card .icon {
  color: var(--accent);
}

.sentinel {
  height: 1px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* ------------------------------------------------------------------ wallet sign-in and notifications */

.wallet-signin {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wallet-signin p {
  margin: 0;
}

.choice.wallet {
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.choice.wallet img {
  border-radius: 6px;
}

.choice.wallet .muted {
  margin-left: auto;
}

.choice:disabled {
  opacity: 0.5;
  cursor: default;
}

.qr-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
}

.qr {
  width: min(260px, 70vw);
  padding: 8px;
  border-radius: 12px;
  background: #fff; /* QR codes need a light background in dark mode too */
}

.qr svg {
  display: block;
  width: 100%;
  height: auto;
}

.status-text {
  display: flex;
  align-items: center;
  gap: 8px;
}

.spinner.inline {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin: 0;
  border-width: 2px;
}

.offline-banner.warning {
  background: color-mix(in srgb, #e8a33d 18%, var(--surface));
  color: var(--text);
}

.offline-banner .link-button {
  margin-left: auto;
  font-weight: 650;
}

.push-prompt {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 12px 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--accent-soft);
}

.push-prompt .icon {
  color: var(--accent);
}

.push-prompt p {
  flex: 1;
  min-width: 200px;
  margin: 0;
}
