/* nostr-shell-client — coracle-inspired styling, no libraries. */
:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --side: #1b1f2a;
  --side-2: #262c3a;
  --text: #1a1d24;
  --muted: #8a90a0;
  --line: #e6e8ee;
  --accent: #7c5cff;
  --accent-soft: #efeaff;
  --like: #ff4d6d;
  --danger: #e5484d;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}

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

/* ---- App shell ---- */
.app {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: 230px;
  flex: none;
  background: var(--side);
  color: #dfe3ee;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem 0.75rem;
}
.brand {
  font-size: 1.15rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem 0.75rem;
  color: #fff;
}

.account {
  background: var(--side-2);
  color: #dfe3ee;
  border: 1px solid #333a4c;
  border-radius: 8px;
  padding: 0.45rem 0.5rem;
  margin-bottom: 0.75rem;
  font: inherit;
}

.navitem {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: #c3c9d8;
  padding: 0.6rem 0.7rem;
  border-radius: 10px;
  font: inherit;
  cursor: pointer;
  transition:
    background 0.12s,
    color 0.12s;
}
.navitem:hover {
  background: var(--side-2);
  color: #fff;
}
.navitem.active {
  background: var(--accent);
  color: #fff;
}
.navitem .ico {
  font-size: 1.1rem;
  width: 1.2rem;
  text-align: center;
}
/* Unread-DM count pushed to the right edge of the Messages nav item. */
.nav-badge {
  margin-left: auto;
  min-width: 1.25rem;
  padding: 0 0.4rem;
  height: 1.25rem;
  line-height: 1.25rem;
  text-align: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
}

/* ---- Content ---- */
.content {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
  overflow: hidden;
}
.panel {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
.messages-panel {
  overflow: hidden;
}
.scroll {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

/* ---- Compose ---- */
.compose.note {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}
.compose.note textarea {
  resize: vertical;
  padding: 0.6rem;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfbfd;
}
.compose-actions {
  display: flex;
  justify-content: flex-end;
}

/* ---- Buttons ---- */
button.primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 0.45rem 1.1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button.primary:hover {
  filter: brightness(1.07);
}

/* ---- Notes / feed ---- */
.feed .note,
.note {
  border-bottom: 1px solid var(--line);
}
.note {
  padding: 0.85rem 1rem;
}
/* Feed "New" divider: a thin accent rule between notes that arrived since the
   last feed visit (above) and already-seen notes (below), with a centered
   label. Placed server-side inside the feed list (see view::feed_items). */
.feed-new-divider {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.15rem 1rem;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.feed-new-divider::before,
.feed-new-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--accent);
  opacity: 0.55;
}
.note-main {
  display: flex;
  gap: 0.7rem;
}
.avatar {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  background: var(--accent-soft);
}
.avatar.lg {
  width: 4rem;
  height: 4rem;
}
.avatar.ph {
  background: linear-gradient(135deg, #d9d4ff, #c7e6ff);
}
.note-body {
  flex: 1;
  min-width: 0;
}
.note-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
}
.author {
  font-weight: 600;
}
/* Relative age (e.g. "2h"), with the full UTC date on hover (title). */
.note-date {
  font-size: 0.72rem;
  color: var(--muted);
  cursor: default;
}
/* Author npub next to the name; click copies the full npub to the clipboard. */
.npub-copy {
  font-size: 0.72rem;
  color: var(--muted);
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
}
.npub-copy:hover {
  color: var(--accent);
  text-decoration: underline;
}
.reply-tag {
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--bg);
  padding: 0 0.4rem;
  border-radius: 6px;
}
/* Notifications: the "↩ replied to you" / "@ mentioned you" header on a card. */
.notif-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.25rem;
}
/* Count of relays a note was delivered from; full URL list on hover (title). */
.seen-relays {
  font-size: 0.72rem;
  color: var(--muted);
  cursor: default;
  white-space: nowrap;
}
.note-text {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0.2rem 0 0.15rem;
}

/* Inline media (images / video / audio) rendered from URLs in a note. */
.note-media {
  display: block;
  max-width: 100%;
  max-height: 28rem;
  margin: 0.5rem 0 0.15rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
}
audio.note-media {
  width: 100%;
  max-width: 28rem;
  max-height: none;
}

/* Responsive 16:9 wrapper for YouTube / Vimeo iframe embeds. */
.note-embed {
  position: relative;
  width: 100%;
  max-width: 40rem;
  aspect-ratio: 16 / 9;
  margin: 0.5rem 0 0.15rem;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg);
}
.note-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Links extracted inline from a note's prose. */
.note-text a {
  color: var(--accent, #3b82f6);
  text-decoration: underline;
  word-break: break-all;
}

/* nostr: @mentions (npub / nprofile) inlined in the prose. */
.mention {
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.mention:hover {
  text-decoration: underline;
}

/* Inline preview of a quoted note (nostr:note / nostr:nevent). */
.note-ref {
  margin: 0.5rem 0 0.15rem;
}
.note-ref-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
  background: var(--bg);
  cursor: pointer;
}
.note-ref-card:hover {
  border-color: var(--accent);
}
.note-ref-card .avatar.sm {
  width: 1.5rem;
  height: 1.5rem;
}
.note-ref-loading {
  display: inline-block;
  padding: 0.4rem 0.6rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
}
/* A quote nested inside a preview is shown static (not fetched). */
.note-ref-static {
  color: var(--accent);
  font-weight: 600;
}

/* Avatars / names that open a user's profile when clicked. */
.clickable {
  cursor: pointer;
}
.author.clickable:hover {
  text-decoration: underline;
}

.note-actions {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.25rem;
}
.act {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.act:hover {
  background: var(--bg);
  color: var(--text);
}
.act.danger:hover {
  background: #fdecec;
  color: var(--danger);
}
.act.like::before {
  content: "♡ ";
}
.act.like:hover {
  color: var(--like);
}
.act.like.liked {
  color: var(--like);
}
.act.like.liked::before {
  content: "♥ ";
}

.reply-child {
  border-bottom: none;
  padding: 0.6rem 0 0.2rem 1.2rem;
  margin-left: 1.2rem;
  border-left: 2px solid var(--line);
}

.reply-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.reply-form textarea {
  resize: vertical;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  background: #fbfbfd;
}
.reply-actions {
  display: flex;
  justify-content: flex-end;
}

/* ---- Thread view ---- */
.thread-view {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.back {
  align-self: flex-start;
  margin: 0.75rem 1rem 0;
  background: transparent;
  border: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
}
.thread-view h3 {
  margin: 0.5rem 1rem;
}
/* Reply tree: each item is emitted depth-first with --d = nesting level. */
.thread-view .note {
  margin-left: calc(var(--d, 0) * 1.2rem);
}
.thread-view .note.nested {
  border-left: 2px solid var(--line);
  border-bottom: none;
}
.thread-view .note.focused {
  background: var(--accent-soft);
  border-radius: var(--radius);
}

/* ---- Messages ---- */
.dm-open {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}
.dm-open .dm-add {
  flex: 1;
  min-width: 12rem;
  display: flex;
}
.dm-open input {
  flex: 1;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font: inherit;
}
/* Slack-style recipient chips in the DM composer + participant tags in the
   thread header. */
.dm-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex-basis: 100%;
}
.dm-chips:empty {
  display: none;
}
.dm-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.35rem 0.2rem 0.5rem;
  background: var(--panel, rgba(127, 127, 127, 0.12));
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.85em;
}
.dm-chip-x {
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  line-height: 1;
  padding: 0 0.2rem;
  color: inherit;
  opacity: 0.6;
}
.dm-chip-x:hover {
  opacity: 1;
}
.avatar.tiny {
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
}
.dm-participants {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0 0.5rem 0.35rem;
}
.dm-participant {
  font-size: 0.8em;
  padding: 0.1rem 0.45rem;
  background: var(--panel, rgba(127, 127, 127, 0.12));
  border-radius: 999px;
}
/* Header topic editor: a compact input that replaces the title in place while
   editing (toggled by the ✎/✓ buttons), so setting a topic costs no vertical
   space above the composer. */
.dm-topic-edit {
  flex: 1;
  min-width: 0;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font: inherit;
}
.dm-topic-btn {
  flex: none;
  min-width: 2rem;
  min-height: 2rem;
  padding: 0 0.4rem;
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.dm-topic-btn:hover {
  filter: brightness(1.15);
}
/* Signal-style full-screen swap: the list view and the chat view each fill the
   Messages panel; only one is shown at a time (data-show on $dmOpen). Same on
   desktop and mobile. */
.dm-list-view,
.dm-chat-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.conv-list {
  flex: 1;
}
/* #thread container + the thread fragment's root both fill the chat view so the
   pinned top bar / scrolling messages / composer stack works. */
.dm-thread,
.dm-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
/* Pinned conversation header (back button + name) shared by the list view's
   "Messages" bar and the open chat's top bar. */
.dm-topbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.dm-topbar .dm-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dm-back,
.dm-new {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0 0.5rem;
  background: transparent;
  border: none;
  color: var(--accent);
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.dm-new {
  margin-left: auto;
}
.dm-back:hover,
.dm-new:hover {
  filter: brightness(1.15);
}

.conv {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.conv:hover {
  background: var(--bg);
}
.conv-body {
  flex: 1;
  min-width: 0;
}
.conv-body small {
  overflow-wrap: anywhere;
}
/* Per-conversation unread count in the conversation list. */
.unread-badge {
  flex: none;
  min-width: 1.25rem;
  padding: 0 0.4rem;
  height: 1.25rem;
  line-height: 1.25rem;
  text-align: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
}

.msgs {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.5rem;
}
.bubble {
  max-width: 70%;
  padding: 0.45rem 0.7rem;
  border-radius: 0.9rem;
  background: var(--bg);
}
.bubble.out {
  align-self: flex-end;
  background: var(--accent-soft);
}
/* NIP-17 strict-delivery notice appended into #msgs when a recipient has no
   kind:10050 DM-relay list (the wrap was not sent). */
.dm-notice {
  align-self: center;
  max-width: 85%;
  margin: 0.25rem 0;
  padding: 0.35rem 0.7rem;
  border-radius: 0.6rem;
  background: var(--danger-soft, rgba(200, 60, 60, 0.12));
  color: var(--danger, #b23);
  font-size: 0.78rem;
  text-align: center;
}
.who {
  font-size: 0.7rem;
  color: var(--muted);
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}
/* Per-message timestamp in a DM bubble; full UTC date on hover (title). */
.msg-date {
  font-size: 0.66rem;
  color: var(--muted);
  opacity: 0.8;
}
/* Encrypted DM attachments. The decrypted <img> must stay inside its bubble —
   without a cap it renders at natural size, overflowing the max-width:70% bubble
   and spilling left past the text (mirrors .note-media). */
.msg-att {
  max-width: 100%;
}
.msg-media {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: 24rem;
  margin: 0.25rem 0 0.1rem;
  border-radius: 10px;
}
form.compose {
  display: flex;
  gap: 0.4rem;
  padding: 0.5rem;
  border-top: 1px solid var(--line);
}
form.compose input {
  flex: 1;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font: inherit;
}
form.compose button {
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font: inherit;
  cursor: pointer;
}

/* ---- Profile ---- */
.profile-edit {
  padding: 1.25rem;
}
.profile-head {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}
.profile-head h2 {
  margin: 0 0 0.15rem;
}
.profile-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.profile-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.profile-form input,
.profile-form textarea {
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  color: var(--text);
  background: #fbfbfd;
}
.profile-form button {
  align-self: flex-start;
  margin-top: 0.3rem;
}

/* Full npub (with a copy button), shown on own and read-only profiles. */
.npub {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.2rem;
}
.npub code {
  font-size: 0.78rem;
  color: var(--muted);
  word-break: break-all;
  background: var(--bg);
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
}
.copy-btn {
  flex: none;
  background: var(--accent-soft);
  color: var(--accent);
  border: none;
  border-radius: 6px;
  padding: 0.15rem 0.5rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.copy-btn:hover {
  filter: brightness(0.97);
}

/* Read-only profile view. */
.profile-view {
  padding: 1.25rem;
}
/* Align "Back" with the avatar/content left edge (override .back's margins). */
.profile-view .back {
  margin: 0 0 0.9rem;
  padding: 0;
}
.profile-view .profile-head {
  align-items: flex-start;
}
.profile-view .follow-btn {
  margin-left: auto;
}
.profile-about {
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 1rem;
}

/* ---- Follows ---- */
.follows {
  padding: 1rem 1.25rem;
}
.follows h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.follows .count {
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--bg);
  border-radius: 999px;
  padding: 0 0.55rem;
}
.follow-add {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.follow-add input {
  flex: 1;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font: inherit;
}
.follow-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}
.follow-id {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ---- Account chip (sidebar) ---- */
.account {
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Login gate ---- */
.login-gate {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 50;
}
.login-box {
  width: 100%;
  max-width: 26rem;
  margin: 1.5rem;
  padding: 2rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(20, 22, 30, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.login-box h1 {
  margin: 0 0 0.25rem;
  font-size: 1.4rem;
}
.login-box label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-top: 0.35rem;
}
.login-box textarea,
.login-box input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  font: inherit;
  background: #fbfbfd;
  resize: vertical;
}
.login-box .primary {
  margin-top: 0.75rem;
}
.err {
  color: var(--danger);
  font-size: 0.85rem;
  min-height: 1.1em;
  margin: 0.25rem 0 0;
}

/* ---- Mobile: sidebar becomes a bottom tab bar ---- */
@media (max-width: 640px) {
  .app {
    flex-direction: column-reverse;
    height: 100dvh; /* 100vh overshoots behind mobile Safari's URL bar */
  }
  .sidebar {
    width: 100%;
    flex-direction: row;
    gap: 0;
    padding: 0.3rem 0.4rem calc(0.3rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--side-2);
  }
  .sidebar .brand,
  .sidebar .account {
    display: none;
  }
  .navitem {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    gap: 0.15rem;
    padding: 0.35rem 0;
    font-size: 0.65rem;
    text-align: center;
  }
  .navitem .ico {
    font-size: 1.25rem;
    width: auto;
  }
  .panel {
    border-left: none;
    border-right: none;
  }

  /* Messages already fill the screen one view at a time (same as desktop);
     only the bubble width needs loosening on narrow screens. */
  .bubble {
    max-width: 85%;
  }
}

/* ---- Settings / relays ---- */
#settings-panel {
  padding: 1rem 1.25rem;
}
.account-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.account-box strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  word-break: break-all;
}
.logout {
  margin-left: auto;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--danger);
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  font: inherit;
  cursor: pointer;
}
.logout:hover {
  background: #fff5f5;
}
.relay-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.75rem 0;
}
.relay-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbfd;
}
.relay-url {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  word-break: break-all;
}
.relay-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  flex: none;
}
.relay-dot.on {
  background: #2fbf71;
}
.relay-dot.off {
  background: #c6cad4;
}
.relay-dm {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: none;
  font-size: 0.75rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.relay-dm input {
  accent-color: var(--accent);
  cursor: pointer;
}
.relay-del,
.relay-browse {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
}
.relay-del:hover {
  color: var(--danger);
  background: #fff5f5;
}
.relay-browse:hover {
  color: var(--accent);
  background: var(--accent-soft);
}
.relay-events {
  margin-top: 1.25rem;
}
.relay-events-title {
  overflow-wrap: anywhere;
}
.relay-add {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.relay-add input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  font: inherit;
  background: #fbfbfd;
}

.blossom-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.75rem 0;
}

.blossom-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbfd;
}

.blossom-url {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  word-break: break-all;
}

.blossom-del {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
}

.blossom-del:hover {
  color: var(--danger);
  background: #fff5f5;
}

/* Error/notification toasts: the host appends self-dismissing fragments into
   #toast-host over the live SSE stream. Fixed bottom-right stack, above all. */
.toast-host {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(90vw, 380px);
  pointer-events: none; /* let clicks through the gaps; toasts re-enable it */
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.16);
  font-size: 0.85rem;
  line-height: 1.35;
  animation: toast-in 0.18s ease-out;
}
.toast-error {
  background: var(--danger-soft, rgba(200, 60, 60, 0.12));
  border-color: var(--danger);
  color: var(--danger, #b23);
}
.toast-msg {
  flex: 1;
  word-break: break-word;
}
.toast-close {
  flex: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  opacity: 0.6;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0;
}
.toast-close:hover {
  opacity: 1;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
