:root {
  --bg0: #020406;
  --bg1: #0a0d12;
  --bg2: #161b22;
  --card: rgba(18, 20, 24, 0.9);
  --card2: rgba(22, 25, 29, 0.84);
  --surface: rgba(255, 255, 255, 0.05);
  --surface-strong: rgba(255, 255, 255, 0.08);
  --text: #eef4ff;
  --muted: rgba(221, 228, 238, 0.76);
  --border: rgba(198, 208, 220, 0.34);
  --shadow: 0 20px 60px rgba(1, 8, 18, 0.42);
  --radius: 16px;
  --primary: #58b2ff;
  --primary2: #9bd5ff;
  --danger: #ff7e7e;
  color-scheme: dark;
  font-family: "Segoe UI", "Trebuchet MS", Verdana, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(1100px 680px at 8% 0%, rgba(92, 104, 120, 0.16), transparent 58%),
    radial-gradient(900px 520px at 92% 18%, rgba(150, 158, 170, 0.1), transparent 56%),
    linear-gradient(180deg, var(--bg0), var(--bg1) 52%, var(--bg2));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(125deg, rgba(255, 255, 255, 0.05), transparent 24%),
    linear-gradient(305deg, rgba(255, 255, 255, 0.03), transparent 28%);
  opacity: 0.45;
}

body.app--embed .container {
  padding: 18px 18px 24px;
}

body.app--embed .hero {
  min-height: clamp(240px, 34vh, 320px);
  padding-top: 26px;
}

a {
  color: inherit;
  text-decoration: none;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.hidden {
  display: none !important;
}

.container {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 24px 36px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(4, 15, 28, 0.76);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand__logo {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
}

.brand__name {
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hero {
  min-height: clamp(300px, 42vh, 390px);
  padding: clamp(56px, 10vh, 112px) 0 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  transition: min-height 220ms ease, padding 220ms ease;
}

body.app--active .hero {
  min-height: 0;
  padding-top: 10px;
  padding-bottom: 12px;
}

h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(32px, 7vw, 48px);
  line-height: 1.04;
  letter-spacing: -0.03em;
}

h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.01em;
}

h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

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

.small {
  font-size: 12px;
}

.search {
  margin-top: 18px;
  width: min(100%, 620px);
  margin-inline: auto;
}

.hero__actions {
  margin-top: 18px;
  display: flex;
  justify-content: center;
}

.hero__send-btn {
  min-width: min(100%, 220px);
}

body.app--active .search {
  margin-top: 10px;
}

.search__field {
  position: relative;
  width: 100%;
}

.search__field--locked .search__input {
  cursor: pointer;
  color: rgba(221, 228, 238, 0.72);
  background: rgba(255, 255, 255, 0.04);
}

.search__field--locked .search__icon {
  color: rgba(221, 228, 238, 0.82);
}

.search__icon {
  position: absolute;
  top: 50%;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: rgba(221, 228, 238, 0.58);
  transform: translateY(-50%);
  cursor: pointer;
  transition: color 140ms ease, background 140ms ease;
}

.search__icon:hover {
  color: rgba(238, 244, 255, 0.92);
  background: rgba(255, 255, 255, 0.06);
}

.search__icon:focus-visible {
  outline: 2px solid rgba(155, 213, 255, 0.88);
  outline-offset: 2px;
}

.search__icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.search__input {
  width: 100%;
  padding: 14px 50px 14px 15px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  outline: none;
}

.search__input::placeholder,
.editor__textarea::placeholder {
  color: rgba(221, 228, 238, 0.46);
}

.search__input:focus,
.editor__textarea:focus {
  border-color: rgba(88, 178, 255, 0.7);
  box-shadow: 0 0 0 4px rgba(88, 178, 255, 0.18);
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.035), transparent 34%),
    linear-gradient(180deg, rgba(17, 19, 23, 0.96), rgba(11, 13, 16, 0.94));
  box-shadow: var(--shadow);
}

.card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card__header--board {
  align-items: center;
  flex-wrap: nowrap;
}

.card__header .row {
  margin-top: 0;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

#searchResultsSection.grid {
  grid-template-columns: 1fr;
}

@media (min-width: 920px) {
  .grid {
    grid-template-columns: 1fr 1fr;
  }

  #searchResultsSection.grid {
    grid-template-columns: 1fr;
  }
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.row--right {
  justify-content: flex-end;
}

.mailbox-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex: 0 0 auto;
}

.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 10px 13px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
  user-select: none;
  font-weight: 600;
}

.btn:hover {
  transform: translateY(-1px);
  background: var(--surface-strong);
  border-color: rgba(214, 222, 232, 0.48);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn:disabled:hover {
  background: var(--surface);
  border-color: var(--border);
}

.btn:focus-visible,
.tool:focus-visible,
.tab:focus-visible,
.item:focus-visible,
.wallet-option:focus-visible,
.emoji-btn:focus-visible,
.thread-reaction:focus-visible,
.thread-action:focus-visible {
  outline: 2px solid rgba(155, 213, 255, 0.88);
  outline-offset: 2px;
}

.btn--primary {
  border-color: rgba(108, 185, 255, 0.62);
  background: linear-gradient(135deg, rgba(49, 131, 227, 0.96), rgba(127, 201, 255, 0.5));
  box-shadow: 0 10px 26px rgba(34, 91, 161, 0.28);
}

.btn--primary:hover {
  border-color: rgba(155, 213, 255, 0.7);
}

.btn--connect {
  position: relative;
  padding-right: 18px;
}

.btn--ghost {
  background: transparent;
}

.btn--icon {
  padding-inline: 12px;
}

.btn--disconnect {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 12px;
  flex: 0 0 auto;
}

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

.btn--disconnect:hover {
  border-color: rgba(255, 126, 126, 0.42);
  color: #ffd8d8;
}

.connect-indicator {
  position: absolute;
  top: -7px;
  right: -8px;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 999px;
  border: 1px solid rgba(104, 255, 161, 0.46);
  background: rgba(5, 22, 11, 0.94);
  box-shadow:
    0 0 0 1px rgba(6, 13, 24, 0.38),
    0 0 14px rgba(92, 255, 147, 0.28),
    0 0 28px rgba(92, 255, 147, 0.16);
  pointer-events: none;
}

.connect-indicator__dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #5cff93;
  box-shadow:
    0 0 10px rgba(92, 255, 147, 0.95),
    0 0 18px rgba(92, 255, 147, 0.48);
}

.connect-indicator__count {
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  color: #dbffe8;
  letter-spacing: 0.01em;
}

.status {
  margin-top: 10px;
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
}

.hero > .muted,
.hero > .status {
  width: min(100%, 620px);
}

.hero-guide-row {
  width: min(100%, 620px);
  display: none;
  justify-content: flex-end;
  margin-top: 8px;
}

.hero-guide-toggle {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(198, 208, 220, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.hero-guide-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(214, 222, 232, 0.36);
  background: rgba(255, 255, 255, 0.08);
}

.hero-guide-toggle:focus-visible {
  outline: 2px solid rgba(155, 213, 255, 0.88);
  outline-offset: 2px;
}

.hero-guide {
  width: min(100%, 620px);
  margin-top: 12px;
  padding: 14px 15px;
  border: 1px solid rgba(198, 208, 220, 0.16);
  border-radius: 14px;
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.03), transparent 38%),
    linear-gradient(180deg, rgba(20, 22, 27, 0.92), rgba(14, 16, 20, 0.9));
  text-align: left;
  box-shadow: 0 14px 32px rgba(2, 6, 12, 0.18);
}

.hero-guide__title {
  margin: 0 0 8px;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.hero-guide__intro {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

.hero-guide__list {
  margin: 10px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.hero-guide__list li {
  overflow-wrap: anywhere;
}

body.app--active .hero-guide-row {
  display: none;
}

body.app--active .hero-guide {
  display: none;
}

body.app--active .hero > .muted {
  display: none;
}

body.app--active .hero > .status {
  margin-top: 6px;
}

body.app--active .container {
  gap: 12px;
}

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

.status--ok {
  color: var(--primary2);
}

.editor {
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.16);
  border-radius: 14px;
  overflow: hidden;
}

.editor__toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.editor__spacer {
  flex: 1 1 auto;
}

.tool,
.tab {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-weight: 700;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
}

.tool:hover,
.tab:hover {
  border-color: rgba(255, 255, 255, 0.24);
}

.tab--active {
  border-color: rgba(88, 178, 255, 0.64);
  background: rgba(88, 178, 255, 0.16);
}

.editor__textarea {
  width: 100%;
  border: 0;
  outline: none;
  padding: 12px;
  background: transparent;
  color: var(--text);
  resize: vertical;
}

.editor__preview {
  padding: 12px;
  background: rgba(0, 0, 0, 0.12);
}

.emoji-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.secret-field {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.secret-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 13px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  outline: none;
}

.secret-input::placeholder {
  color: rgba(221, 228, 238, 0.46);
}

.secret-input:focus {
  border-color: rgba(88, 178, 255, 0.7);
  box-shadow: 0 0 0 4px rgba(88, 178, 255, 0.18);
}

.emoji-btn {
  border: 1px solid rgba(214, 222, 232, 0.18);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-radius: 999px;
  min-width: 40px;
  padding: 7px 10px;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.emoji-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(155, 213, 255, 0.44);
  background: rgba(255, 255, 255, 0.08);
}

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

.list--panel {
  min-height: 120px;
  max-height: 460px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  padding-bottom: 8px;
}

.mailbox-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  margin-left: auto;
}

.item {
  border: 1px solid rgba(207, 215, 225, 0.16);
  background:
    linear-gradient(180deg, rgba(24, 27, 32, 0.94), rgba(17, 19, 23, 0.92));
  border-radius: 14px;
  padding: 10px 10px 12px;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
  overflow: visible;
}

.item:hover {
  transform: translateY(-1px);
  border-color: rgba(214, 222, 232, 0.28);
  background: linear-gradient(180deg, rgba(31, 34, 39, 0.96), rgba(20, 22, 27, 0.94));
}

.item--active {
  border-color: rgba(198, 208, 220, 0.42);
  box-shadow: 0 0 0 1px rgba(214, 222, 232, 0.1), 0 18px 38px rgba(3, 6, 10, 0.28);
}

.item--unread {
  border-color: rgba(107, 176, 255, 0.4);
  box-shadow:
    inset 3px 0 0 rgba(107, 176, 255, 0.95),
    0 14px 28px rgba(3, 8, 16, 0.24);
}

.item__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.item__top-main {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.item__title {
  min-width: 0;
  font-weight: 800;
  font-size: 14px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item__new-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #76bcff;
  box-shadow: 0 0 10px rgba(118, 188, 255, 0.7);
  flex: 0 0 auto;
}

.item__time {
  color: rgba(221, 228, 238, 0.68);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.item__meta {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 0;
}

.item__snippet {
  margin-top: 3px;
  color: rgba(238, 244, 255, 0.9);
  font-size: 13px;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  overflow: hidden;
  text-overflow: clip;
  overflow-wrap: anywhere;
}

.item__stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  min-width: 0;
  white-space: nowrap;
}

.item__stat--new {
  color: #d9ecff;
}

.item__stat--icon svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
  flex: 0 0 auto;
}

.badge {
  border: 1px solid rgba(214, 222, 232, 0.18);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
}

.divider {
  height: 1px;
  margin: 10px 0;
  background: rgba(255, 255, 255, 0.1);
}

.prose {
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.prose p {
  margin: 6px 0;
}

.prose a {
  color: var(--primary2);
  text-decoration: underline;
  text-decoration-color: rgba(155, 213, 255, 0.54);
}

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95em;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 8px;
}

.reply {
  margin-top: 12px;
  display: grid;
  gap: 8px;
  overflow: hidden;
}

.reply .row,
.reply .secret-field {
  margin-top: 0;
}

.thread-unlock {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 10px;
  border: 1px solid rgba(214, 222, 232, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.thread-unlock__row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.thread-unlock__row > * {
  min-width: 0;
}

.thread-unlock__row .secret-input {
  flex: 1 1 auto;
  min-width: 0;
}

.thread-messages {
  gap: 8px;
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.thread-message-row {
  display: flex;
  justify-content: flex-start;
  padding-right: 34px;
}

.thread-message-row--own {
  justify-content: flex-end;
  padding-left: 34px;
  padding-right: 0;
}

.thread-message {
  width: min(82%, 680px);
  border: 1px solid rgba(214, 222, 232, 0.14);
  border-radius: 16px 16px 16px 6px;
  padding: 7px 8px;
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.04), transparent 42%),
    linear-gradient(180deg, rgba(24, 27, 32, 0.96), rgba(15, 17, 21, 0.94));
  box-shadow: 0 16px 34px rgba(2, 6, 12, 0.3);
  overflow: hidden;
}

.thread-message--own {
  border-color: rgba(198, 208, 220, 0.24);
  border-radius: 16px 16px 6px 16px;
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.05), transparent 42%),
    linear-gradient(180deg, rgba(31, 34, 39, 0.98), rgba(20, 23, 28, 0.95));
}

.thread-message--root {
  border-color: rgba(198, 208, 220, 0.22);
}

.thread-message__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  min-width: 0;
}

.thread-message__meta-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.thread-message__author {
  min-width: 0;
  margin-right: auto;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-message__time {
  color: rgba(221, 228, 238, 0.68);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.thread-message__body {
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.thread-message__body--locked {
  display: grid;
  gap: 4px;
}

.thread-message__lock-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
}

.thread-inline-unlock {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.thread-inline-unlock__input.secret-input {
  min-width: 0;
  flex: 1 1 auto;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.thread-inline-unlock__btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(214, 222, 232, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.thread-inline-unlock__btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.thread-inline-unlock__btn:hover {
  transform: translateY(-1px);
}

.thread-inline-unlock__btn--locked {
  color: #ffd8d8;
  border-color: rgba(255, 126, 126, 0.34);
  background: rgba(94, 22, 22, 0.28);
}

.thread-inline-unlock__btn--ready {
  color: #d8ffe7;
  border-color: rgba(92, 255, 147, 0.4);
  background: rgba(8, 72, 36, 0.36);
}

.thread-inline-unlock__status {
  margin-top: 2px;
  font-size: 11px;
}

.thread-message__body p {
  margin: 2px 0;
}

.thread-message__body > :first-child {
  margin-top: 0;
}

.thread-message__body > :last-child {
  margin-bottom: 0;
}

.thread-message__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.thread-reaction,
.thread-action {
  border: 1px solid rgba(214, 222, 232, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-radius: 999px;
  width: 22px;
  height: 22px;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.thread-reaction svg,
.thread-action svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

.thread-reaction:hover,
.thread-action:hover {
  transform: translateY(-1px);
  border-color: rgba(214, 222, 232, 0.3);
  background: rgba(255, 255, 255, 0.08);
}

.thread-reaction--active {
  color: #ffd5e7;
  border-color: rgba(255, 153, 194, 0.38);
  background: rgba(109, 24, 55, 0.34);
}

.thread-action--delete {
  color: #ffd8d8;
  border-color: rgba(255, 126, 126, 0.3);
  background: rgba(94, 22, 22, 0.28);
}

.thread-action--delete:hover {
  border-color: rgba(255, 126, 126, 0.52);
  background: rgba(122, 24, 24, 0.34);
}

#threadSection,
#threadReplies,
.thread-message,
.thread-unlock,
.reply,
.secret-field,
.secret-input,
.status,
.prose {
  min-width: 0;
}

#composerSection {
  position: fixed;
  inset: 50% auto auto 50%;
  z-index: 60;
  width: min(980px, calc(100vw - 40px));
  min-height: 0;
  max-height: calc(100vh - 40px);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  transform: translate(-50%, -50%);
  backface-visibility: hidden;
  border: 1px solid var(--border);
  border-radius: 20px;
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.035), transparent 34%),
    linear-gradient(180deg, rgba(17, 19, 23, 0.985), rgba(11, 13, 16, 0.975));
  box-shadow: 0 34px 80px rgba(0, 0, 0, 0.46);
}

#threadSection {
  position: fixed;
  inset: 50% auto auto 50%;
  z-index: 58;
  width: min(760px, calc(100vw - 40px));
  height: min(calc(100dvh - 24px), 900px);
  max-height: calc(100dvh - 24px);
  padding: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 20px;
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.035), transparent 34%),
    linear-gradient(180deg, rgba(17, 19, 23, 0.985), rgba(11, 13, 16, 0.975));
  overflow-x: hidden;
  overflow-y: hidden;
  overscroll-behavior: contain;
  transform: translate(-50%, -50%);
  backface-visibility: hidden;
  box-shadow: 0 34px 80px rgba(0, 0, 0, 0.46);
}

#threadSection .card__header {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  margin: 0;
  padding: 12px 16px 10px;
  border-bottom: 1px solid rgba(214, 222, 232, 0.08);
  background: linear-gradient(180deg, rgba(14, 18, 24, 0.98), rgba(14, 18, 24, 0.92));
  backface-visibility: hidden;
}

#threadSection .card__header > :first-child {
  min-width: 0;
}

#threadSection .card__header .row--right {
  margin-top: 0;
  margin-left: auto;
  flex: 0 0 auto;
  justify-content: flex-end;
  flex-wrap: nowrap;
}

#threadModalCloseBtn {
  color: #fff !important;
}

#threadModalCloseBtn svg {
  fill: #fff !important;
  color: #fff !important;
}

#threadModalCloseBtn svg path {
  fill: #fff !important;
}

.thread-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

#threadUnlockPanel {
  margin: 12px 18px 0;
}

#threadReplies {
  margin: 12px 18px 0;
  padding-bottom: 14px;
}

#replyComposer {
  margin: 0;
  padding: 14px 18px 18px;
  border-top: 1px solid rgba(214, 222, 232, 0.08);
  background:
    linear-gradient(180deg, rgba(15, 18, 22, 0.92), rgba(15, 18, 22, 0.98));
}

.thread-admin-actions {
  display: flex;
  justify-content: center;
  padding: 0 18px 18px;
  border-top: 1px solid rgba(214, 222, 232, 0.08);
  background: linear-gradient(180deg, rgba(15, 18, 22, 0.98), rgba(12, 15, 19, 1));
}

.thread-admin-actions__delete {
  color: #ffd8d8;
  border-color: rgba(255, 126, 126, 0.3);
  background: rgba(94, 22, 22, 0.28);
}

.thread-admin-actions__delete:hover {
  border-color: rgba(255, 126, 126, 0.52);
  background: rgba(122, 24, 24, 0.34);
}

#replyComposer h3 {
  margin: 0;
  font-size: 13px;
}

#replyComposer .editor__textarea,
#replyComposer textarea {
  min-height: 92px;
  max-height: 160px;
  overflow-y: auto;
}

#composerSection .card__header {
  position: sticky;
  top: -18px;
  z-index: 3;
  margin: -18px -18px 10px;
  padding: 18px 18px 12px;
  border-bottom: 1px solid rgba(214, 222, 232, 0.08);
  background: linear-gradient(180deg, rgba(14, 18, 24, 0.98), rgba(14, 18, 24, 0.92));
  backface-visibility: hidden;
}

#composerSection .editor__textarea,
#composerSection .editor__preview {
  min-height: min(320px, 38vh);
  max-height: min(420px, 48vh);
  overflow-y: auto;
}

.message-modal-backdrop-open {
  overflow: hidden;
}

.thread-modal-content {
  display: grid;
  gap: 0;
  max-height: calc(100vh - 150px);
  overflow: hidden;
}

.footer {
  position: relative;
  z-index: 1;
  padding: 18px 24px 36px;
  text-align: center;
}

.legal-page .container {
  max-width: 920px;
}

.legal-hero {
  min-height: 0;
  padding: 40px 0 14px;
  align-items: flex-start;
  text-align: left;
}

.legal-hero h1 {
  margin-bottom: 10px;
}

.legal-layout {
  display: grid;
  gap: 18px;
}

.legal-card {
  display: grid;
  gap: 18px;
}

.legal-card section {
  display: grid;
  gap: 8px;
}

.legal-card h2 {
  margin: 0;
  font-size: 18px;
}

.legal-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
}

.legal-card li + li {
  margin-top: 6px;
}

.legal-note {
  padding: 14px 16px;
  border: 1px solid rgba(255, 126, 126, 0.26);
  border-radius: 14px;
  background: rgba(94, 22, 22, 0.18);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal__backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: rgba(2, 9, 18, 0.8);
  backdrop-filter: blur(10px);
}

.modal__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(9, 21, 37, 0.97), rgba(12, 28, 48, 0.95));
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.4);
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

#composerModalBackdrop {
  z-index: 55;
  background: rgba(2, 9, 18, 0.88);
  backdrop-filter: blur(14px);
}

#threadModalBackdrop {
  z-index: 54;
  background: rgba(2, 9, 18, 0.88);
  backdrop-filter: blur(14px);
}

.wallet-picker {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.wallet-picker__helper {
  margin: 0;
  line-height: 1.55;
}

.wallet-picker-options {
  display: grid;
  gap: 12px;
}

.wallet-option {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 15px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.wallet-option:hover {
  transform: translateY(-1px);
  border-color: rgba(155, 213, 255, 0.44);
  background: rgba(255, 255, 255, 0.08);
}

.wallet-option:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

.wallet-option:disabled:hover {
  transform: none;
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.05);
}

.wallet-option-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.wallet-option-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(155, 213, 255, 0.18);
  background: linear-gradient(180deg, rgba(88, 178, 255, 0.18), rgba(255, 255, 255, 0.04));
  color: var(--primary2);
  flex: 0 0 auto;
}

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

.wallet-option-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.wallet-option__title {
  display: block;
  font-weight: 700;
}

.wallet-option-meta {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 720px) {
  .container {
    padding-inline: 16px;
  }

  body.app--active .container {
    max-width: none;
    gap: 10px;
    padding-inline: 0;
  }

  body.app--active .hero,
  body.app--active .search,
  body.app--active #searchStatus {
    padding-left: 16px;
    padding-right: 16px;
  }

  .topbar {
    padding-inline: 14px;
  }

  .brand {
    gap: 0;
  }

  .brand__name {
    display: none;
  }

  .search {
    flex-direction: column;
  }

  .card__header,
  .item__top,
  .modal__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .card__header--board,
  #inboxSection .card__header--board {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
  }

  #searchResultsSection .card__header--board {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 10px;
  }

  .card__header--board > :first-child {
    min-width: 0;
  }

  .card__header--board .muted.small,
  #mailboxStatus {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mailbox-toolbar {
    width: auto;
    margin-top: 0;
    margin-left: auto;
    flex: 0 0 auto;
    justify-content: flex-end;
    flex-wrap: nowrap;
  }

  #searchResultsSection .row--right {
    width: 100%;
    margin-top: 0;
    margin-left: 0;
    flex: 0 0 auto;
    justify-content: flex-start;
  }

  .row {
    flex-wrap: wrap;
  }

  .row--right {
    justify-content: flex-start;
  }

  .modal {
    padding: 14px;
  }

  .modal__panel {
    padding: 16px;
  }

  body.app--active #searchResultsSection .card,
  body.app--active #inboxSection .card {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    box-shadow: none;
  }

  body.app--active .list--panel {
    min-height: 0;
    max-height: none;
    overflow: visible;
    padding-right: 0;
    padding-bottom: 0;
  }

  #composerSection,
  #threadSection,
  .message-modal {
    inset: auto 0 0 0;
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 22px 22px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    padding: 16px;
    transform: none;
  }

  #composerSection {
    padding: 0;
    border-radius: 0;
    border: 0;
    height: 100dvh;
    max-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
  }

  #threadSection {
    padding: 0;
    border-radius: 0;
    border: 0;
    height: 100dvh;
    max-height: 100dvh;
  }

  #threadSection .card__header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px 8px;
  }

  #threadUnlockPanel,
  #threadReplies {
    margin-left: 16px;
    margin-right: 16px;
  }

  #replyComposer {
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  }

  .thread-admin-actions {
    padding: 0 16px calc(16px + env(safe-area-inset-bottom));
  }

  #composerSection .card__header {
    position: relative;
    top: 0;
    margin: 0;
    padding: 14px 16px 12px;
    flex: 0 0 auto;
  }

  #composerSection .editor,
  #composerSection .emoji-bar,
  #composerSection .secret-field,
  #composerSection > .row {
    margin-left: 16px;
    margin-right: 16px;
  }

  #composerSection .editor {
    margin-top: 10px;
  }

  #composerSection .editor__toolbar {
    flex-wrap: wrap;
  }

  #composerSection > .row {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }

  #threadReplies {
    padding-bottom: 16px;
  }

  #threadReplies.thread-messages {
    overflow: visible;
    max-height: none;
  }

  .thread-modal-content {
    max-height: calc(100vh - 116px);
  }

  .wallet-option-row {
    align-items: flex-start;
  }

  .thread-message {
    width: min(86%, 100%);
  }

  .thread-unlock__row {
    flex-wrap: wrap;
  }

  .thread-message__meta {
    flex-direction: row;
    align-items: center;
  }

  .thread-message__meta-actions {
    width: auto;
    justify-content: flex-end;
  }
}
