/* =========================================================
 * FusionX — Stylesheet
 * Modern, responsive, three themes (light / dim / dark).
 * ========================================================= */

/* ---------- themes ---------- */

:root {
  --accent: #6d5df6;
  --accent-2: #22d3ee;
  --accent-grad: linear-gradient(135deg, #6d5df6 0%, #22d3ee 100%);
  --danger: #ef4466;
  --success: #16b374;
  --warning: #f59e0b;
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --shadow: 0 8px 30px rgba(0, 0, 0, .12);
}

body[data-theme="light"] {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --panel-2: #eef1f8;
  --text: #17203a;
  --muted: #66708c;
  --border: #e3e7f2;
  --hover: #f2f4fb;
  --scrim: rgba(23, 32, 58, .45);
}

body[data-theme="dim"] {
  --bg: #101725;
  --panel: #18202f;
  --panel-2: #1f2a3d;
  --text: #e8ecf6;
  --muted: #8b96b0;
  --border: #273349;
  --hover: #1d2839;
  --scrim: rgba(2, 6, 16, .6);
}

body[data-theme="dark"] {
  --bg: #05060a;
  --panel: #0d0f16;
  --panel-2: #141824;
  --text: #e9ebf2;
  --muted: #7d8499;
  --border: #1d2231;
  --hover: #12151f;
  --scrim: rgba(0, 0, 0, .7);
}

/* ---------- base ---------- */

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  transition: background .25s, color .25s;
}
body.modal-open { overflow: hidden; }

a { color: var(--accent); text-decoration: none; overflow-wrap: anywhere; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .85em;
  background: var(--panel-2);
  border-radius: 6px;
  padding: 1px 6px;
  overflow-wrap: anywhere;
}
pre {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  overflow-x: auto;
  margin: 8px 0;
}
pre code { background: none; padding: 0; }

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.fine-print { font-size: .8rem; color: var(--muted); margin-top: 10px; }

/* ---------- buttons & inputs ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 .92rem var(--font);
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: filter .15s, background .15s, transform .05s;
  color: #fff;
  background: var(--accent);
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.1); text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--accent-grad); }
.btn.danger { background: var(--danger); }
.btn.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn.ghost:hover { background: var(--hover); }
.btn.sm { padding: 6px 14px; font-size: .84rem; }
.btn.block { width: 100%; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border: none; border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: .95rem;
  transition: background .15s, color .15s;
  flex: none;
}
.icon-btn:hover { background: var(--hover); color: var(--text); text-decoration: none; }

.input, textarea.input {
  width: 100%;
  font: .95rem var(--font);
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
  transition: border .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
textarea.input { resize: vertical; }

.field-label { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin: 14px 0 6px; }
.field-error { color: var(--danger); font-size: .85rem; min-height: 1.2em; margin-top: 8px; }
.check-row { display: flex; gap: 10px; align-items: flex-start; font-size: .88rem; margin-top: 16px; cursor: pointer; }
.check-row input { margin-top: 3px; accent-color: var(--accent); }

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

#topBar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 18px;
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.brand .brand-x { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-tag { font-size: .72rem; color: var(--muted); font-weight: 500; display: none; }
@media (min-width: 900px) { .brand-tag { display: inline; } }
.topbar-spacer { flex: 1; }

#walletArea { display: flex; align-items: center; gap: 8px; }
.balance-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--accent-grad);
  color: #fff; font-weight: 700; font-size: .85rem;
  border-radius: 999px; padding: 7px 14px;
}
.balance-chip:hover { text-decoration: none; filter: brightness(1.08); }
.addr-chip {
  font-family: ui-monospace, Menlo, monospace; font-size: .8rem;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px; padding: 7px 12px;
}
.addr-chip:hover { text-decoration: none; background: var(--hover); }

#layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 660px) 320px;
  gap: 24px;
  max-width: 1290px;
  margin: 0 auto;
  padding: 20px 16px 80px;
  align-items: start;
}

/* left nav */
#sidebar { position: sticky; top: 74px; display: flex; flex-direction: column; gap: 4px; }
#sidebar a {
  display: flex; align-items: center; gap: 14px;
  font-size: 1.02rem; font-weight: 600;
  color: var(--text);
  padding: 11px 16px;
  border-radius: 999px;
  transition: background .15s;
}
#sidebar a i { width: 22px; text-align: center; color: var(--muted); transition: color .15s; }
#sidebar a:hover { background: var(--hover); text-decoration: none; }
#sidebar a.active { background: var(--panel); box-shadow: var(--shadow); }
#sidebar a.active i { color: var(--accent); }
.sidebar-sep { border: none; border-top: 1px solid var(--border); margin: 10px 16px; }
.sidebar-heading { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 8px 16px 2px; }

/* right side */
#rightSide { position: sticky; top: 74px; display: flex; flex-direction: column; gap: 18px; }
.search-row { display: flex; gap: 8px; }
.search-row .input { border-radius: 999px; padding-left: 16px; }

/* ---------- panels & cards ---------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.panel h3 { font-size: 1rem; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.panel h3 i { color: var(--accent); }

.center-panel { text-align: center; padding: 44px 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.panel-hero-icon { font-size: 2.4rem; background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.page-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.page-title h2 { font-size: 1.25rem; }
.page-title.with-back { margin-left: -6px; }
.section-title { font-size: 1.02rem; margin: 18px 0 10px; }

.routePage { display: none; }
.routePage.visible { display: block; animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }

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

.avatar {
  width: 44px; height: 44px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--accent-grad);
  color: #fff; font-weight: 700; font-size: 1.1rem;
  overflow: hidden;
  user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 32px; height: 32px; font-size: .85rem; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.4rem; }
.avatar.xl { width: 96px; height: 96px; font-size: 2.2rem; border: 4px solid var(--panel); }

/* ---------- post & comment cards ---------- */

.post-card, .comment-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 10px;
  margin-bottom: 14px;
  transition: border-color .15s, background .15s;
}
.post-card.clickable { cursor: pointer; }
.post-card.clickable:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }

.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-top-right { display: flex; align-items: center; gap: 8px; }

.author { display: flex; align-items: center; gap: 11px; color: var(--text); min-width: 0; }
.author:hover { text-decoration: none; }
.author:hover .author-nick { text-decoration: underline; }
.author-names { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.author-nick { font-weight: 700; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.author-user { font-size: .8rem; color: var(--muted); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .72rem; font-weight: 700;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  padding: 3px 10px; border-radius: 999px;
  white-space: nowrap;
}

.card-body { margin: 10px 0 4px; font-size: .96rem; overflow-wrap: anywhere; }
.card-body p { margin-bottom: 8px; }
.card-body p:last-child { margin-bottom: 0; }
.card-body img { border-radius: var(--radius-sm); max-height: 420px; }
.card-body h1, .card-body h2, .card-body h3 { margin: 10px 0 6px; }
.card-body ul, .card-body ol { padding-left: 24px; margin-bottom: 8px; }
.card-body blockquote { border-left: 3px solid var(--accent); padding-left: 12px; color: var(--muted); margin: 8px 0; }
.readMore { font-size: .85rem; font-weight: 600; }

.card-actions {
  display: flex; align-items: center; gap: 4px;
  border-top: 1px solid var(--border);
  margin-top: 10px; padding-top: 4px;
}
.stat-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: none; border: none; cursor: pointer;
  color: var(--muted); font: 600 .82rem var(--font);
  padding: 7px 12px; border-radius: 999px;
  transition: background .15s, color .15s;
}
.stat-btn:hover { background: var(--hover); color: var(--accent); }
.stat-btn.active-like { color: var(--success); }
.stat-btn.active-dislike { color: var(--danger); }
.stat-count { min-width: 12px; text-align: left; }

.comment-card { padding: 13px 16px 8px; }
.comment-context { margin-bottom: 4px; }
.comment-context > a { display: inline-block; margin: 0 0 4px 6px; }

/* quoted / repost frame */
.quoted {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-top: 10px;
  color: var(--text);
  background: var(--panel-2);
  transition: border-color .15s;
}
.quoted:hover { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.quoted.static:hover { border-color: var(--border); }
.quoted-head { display: flex; align-items: center; gap: 8px; font-size: .85rem; margin-bottom: 6px; }
.quoted-body { font-size: .9rem; }

.hidden-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-style: dashed; }
.hidden-note { color: var(--muted); font-size: .9rem; }

/* card dropdown menu */
.card-menu { position: relative; }
.menu-dropdown {
  display: none;
  position: absolute; right: 0; top: 38px; z-index: 30;
  min-width: 180px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-menu.open .menu-dropdown { display: block; }
.menu-dropdown button {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  background: none; border: none; cursor: pointer;
  font: 500 .9rem var(--font);
  color: var(--text);
  padding: 10px 14px;
  text-align: left;
}
.menu-dropdown button:hover { background: var(--hover); }
.menu-dropdown button i { width: 16px; color: var(--muted); }

/* ---------- composer ---------- */

.composer { margin-bottom: 16px; }
.composer-row { display: flex; gap: 12px; }
.composer-row textarea {
  flex: 1;
  border: none; outline: none; resize: vertical;
  background: transparent;
  color: var(--text);
  font: 1rem var(--font);
  padding-top: 10px;
  min-height: 56px;
}
.composer-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.composer.locked { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.composer.locked p { margin: 0; }

/* ---------- tabs ---------- */

.tab-row { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab-btn {
  background: none; border: none; cursor: pointer;
  font: 600 .95rem var(--font);
  color: var(--muted);
  padding: 10px 18px;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.page-tabs { margin-top: 4px; }

/* ---------- profile ---------- */

.profile-header { padding: 0 0 18px; overflow: hidden; }
.cover {
  height: 180px;
  background: var(--accent-grad);
  position: relative;
}
.cover-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-head-row {
  display: flex; justify-content: space-between; align-items: flex-end;
  padding: 0 18px;
  margin-top: -48px;
  position: relative;
  z-index: 2; /* paint above the cover, which is position:relative */
}
.profile-actions { padding-bottom: 6px; }
.profile-nick { padding: 10px 18px 0; font-size: 1.3rem; }
.profile-user { padding: 0 18px; color: var(--muted); font-size: .92rem; }
.profile-bio { padding: 10px 18px 0; font-size: .95rem; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 18px 0; font-size: .85rem; color: var(--muted); }
.profile-meta-item i { margin-right: 5px; }
.profile-stats { display: flex; flex-wrap: wrap; gap: 18px; padding: 12px 18px 0; font-size: .9rem; color: var(--muted); }
.profile-stats b { color: var(--text); }

/* ---------- wallet page ---------- */

.wallet-hero {
  background: var(--accent-grad);
  border: none;
  color: #fff;
  margin-bottom: 18px;
}
.wallet-balance-label { font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
.wallet-balance { font-size: 2.4rem; font-weight: 800; line-height: 1.2; }
.wallet-balance small { font-size: 1.1rem; font-weight: 600; opacity: .85; }
.wallet-addr-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.wallet-addr-row code { background: rgba(255,255,255,.16); color: #fff; padding: 5px 10px; border-radius: 8px; font-size: .82rem; }
.wallet-hero .icon-btn { color: #fff; }
.wallet-hero .icon-btn:hover { background: rgba(255,255,255,.18); color: #fff; }

.wallet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
@media (max-width: 720px) { .wallet-grid { grid-template-columns: 1fr; } }

.key-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 6px;
}
.key-box code { flex: 1; background: none; padding: 0; font-size: .8rem; }
.danger-box { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }

.settings-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}
.settings-row:first-of-type { border-top: none; }
.settings-row p { font-size: .84rem; margin-top: 2px; }

/* RPC manager */
.rpc-status {
  display: flex; align-items: center; gap: 8px;
  font-size: .86rem; color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.rpc-status b { color: var(--text); }
.rpc-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; }
.rpc-item {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.rpc-item.active { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); background: color-mix(in srgb, var(--accent) 6%, var(--panel)); }
.rpc-dot { color: var(--border); font-size: .8rem; flex: none; }
.rpc-item.active .rpc-dot { color: var(--success); }
.rpc-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.rpc-meta code { background: none; padding: 0; font-size: .82rem; overflow-wrap: anywhere; }
.rpc-tags { display: flex; gap: 6px; }

.settings-field { margin-bottom: 4px; }
.settings-input-row { display: flex; gap: 10px; align-items: flex-start; }
.settings-input-row .btn { flex: none; margin-top: 2px; }

/* ---------- widgets (right side) ---------- */

.stat-tiles { display: flex; gap: 12px; }
.stat-tile {
  flex: 1; text-align: center;
  background: var(--panel-2);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
}
.stat-tile b { display: block; font-size: 1.3rem; }
.stat-tile span { font-size: .78rem; color: var(--muted); }

.mini-user { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-radius: var(--radius-sm); color: var(--text); }
.mini-user:hover { background: var(--hover); text-decoration: none; }
.mini-user-names { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.mini-user-names b { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-user-names span { font-size: .78rem; }

.link-list { display: flex; flex-direction: column; gap: 2px; }
.link-list a { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: .88rem; padding: 7px 6px; border-radius: var(--radius-sm); }
.link-list a:hover { background: var(--hover); text-decoration: none; }
.link-list a i { width: 18px; text-align: center; color: var(--muted); }

/* ---------- modal ---------- */

.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: var(--scrim);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 8vh 16px 16px;
  overflow-y: auto;
  animation: fadeIn .15s ease;
}
.modal {
  width: 100%; max-width: 460px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: popIn .18s ease;
}
.modal.wide { max-width: 620px; }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 0;
}
.modal-head h3 { font-size: 1.1rem; }
.modal-body { padding: 14px 20px 20px; }
.modal-text { font-size: .92rem; color: var(--muted); }
.modal-text b, .modal-text code { color: var(--text); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.modal-actions .block { flex: 1; }

.unlock-id { display: flex; align-items: center; gap: 12px; background: var(--panel-2); border-radius: var(--radius-sm); padding: 12px; }
.unlock-label { font-size: .78rem; color: var(--muted); }
.unlock-addr { font-size: .78rem; }

.notice {
  display: flex; flex-direction: column; gap: 10px;
  font-size: .88rem;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-top: 14px;
}
.notice.warn { border-color: color-mix(in srgb, var(--warning) 55%, var(--border)); }
.notice.warn > i { color: var(--warning); font-size: 1.05rem; }
.notice .key-box { margin-top: 0; }
.notice .btn { align-self: flex-start; }

.progress-track { height: 6px; background: var(--panel-2); border-radius: 999px; margin-top: 12px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent-grad); transition: width .2s; }

/* ---------- toasts & tx cards ---------- */

#toasts {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
  z-index: 130;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
  padding: 10px 18px;
  font-size: .9rem; font-weight: 500;
  opacity: 0; transform: translateY(-8px);
  transition: opacity .25s, transform .25s;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: none; }
.toast.success i { color: var(--success); }
.toast.error i { color: var(--danger); }
.toast.info i { color: var(--accent); }

#txCards {
  position: fixed; right: 18px; bottom: 18px; z-index: 120;
  display: flex; flex-direction: column; gap: 10px;
  max-width: min(380px, calc(100vw - 36px));
}
.tx-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  opacity: 0; transform: translateY(12px);
  transition: opacity .25s, transform .25s;
}
.tx-card.show { opacity: 1; transform: none; }
.tx-card.success { border-left-color: var(--success); }
.tx-card.success .tx-icon { color: var(--success); }
.tx-card.error { border-left-color: var(--danger); }
.tx-card.error .tx-icon { color: var(--danger); }
.tx-icon { font-size: 1.25rem; flex: none; }
.tx-info { flex: 1; min-width: 0; }
.tx-title { font-weight: 700; font-size: .9rem; }
.tx-sub { font-size: .78rem; color: var(--muted); overflow-wrap: anywhere; }

/* ---------- spinners, skeletons, empty states ---------- */

.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2.5px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex: none;
}
.tx-card .spinner, .btn .spinner { width: 16px; height: 16px; }
@keyframes spin { to { transform: rotate(360deg); } }

.inline-loader { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: .88rem; padding: 18px; }
.feed-sentinel { min-height: 8px; }
.feed-error { text-align: center; color: var(--muted); padding: 20px; font-size: .9rem; }

/* new-posts banner (Twitter-style) */
.new-posts-banner {
  display: block; width: 100%;
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  color: var(--accent);
  font: 600 .9rem var(--font);
  border-radius: var(--radius);
  padding: 11px 14px;
  cursor: pointer;
  margin-bottom: 14px;
  transition: filter .15s, background .15s;
}
.new-posts-banner:hover { background: color-mix(in srgb, var(--accent) 16%, var(--panel)); }
.new-posts-banner:disabled { cursor: default; opacity: .8; }
.new-posts-banner .spinner { vertical-align: -3px; margin-right: 6px; }

.feed-notice {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  text-align: center;
  color: var(--muted);
  font-size: .88rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
}

/* toggle switch */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch-track {
  width: 38px; height: 22px; flex: none;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  position: relative;
  transition: background .2s, border-color .2s;
}
.switch-track::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .2s, background .2s;
}
.switch input:checked + .switch-track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(16px); background: #fff; }
.switch-label { font-size: .84rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.switch input:checked ~ .switch-label { color: var(--accent); }

.skeleton { pointer-events: none; }
.sk-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sk-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--panel-2); animation: pulse 1.4s ease infinite; }
.sk-line { display: block; height: 12px; border-radius: 6px; background: var(--panel-2); animation: pulse 1.4s ease infinite; margin-bottom: 10px; }
.sk-line.w40 { width: 40%; } .sk-line.w70 { width: 70%; } .sk-line.w90 { width: 90%; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

.empty-state { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty-state i { font-size: 2rem; margin-bottom: 10px; display: block; opacity: .6; }

/* ---------- footer & mobile nav ---------- */

footer {
  text-align: center;
  color: var(--muted);
  font-size: .8rem;
  padding: 24px 16px 90px;
}

#mobileNav { display: none; }

/* ---------- responsive ---------- */

@media (max-width: 1160px) {
  #layout { grid-template-columns: 72px minmax(0, 1fr) 300px; }
  #sidebar a span { display: none; }
  #sidebar a { justify-content: center; padding: 13px; }
  #sidebar a i { width: auto; font-size: 1.15rem; }
  .sidebar-heading { display: none; }
}

@media (max-width: 940px) {
  #layout { grid-template-columns: 72px minmax(0, 1fr); }
  #rightSide { display: none; }
}

@media (max-width: 640px) {
  #layout { grid-template-columns: minmax(0, 1fr); padding: 14px 10px 90px; }
  #sidebar { display: none; }
  #topBar { padding: 8px 12px; }
  .brand span.brand-name { display: none; }
  .addr-chip { display: none; }

  #mobileNav {
    display: flex;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
    background: color-mix(in srgb, var(--panel) 92%, transparent);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    justify-content: space-around;
    padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  }
  #mobileNav a {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    color: var(--muted); font-size: .66rem; font-weight: 600;
    padding: 4px 10px; border-radius: 10px;
  }
  #mobileNav a i { font-size: 1.15rem; }
  #mobileNav a.active { color: var(--accent); }
  #mobileNav a:hover { text-decoration: none; }

  .cover { height: 130px; }
  .profile-head-row { margin-top: -40px; }
  .avatar.xl { width: 80px; height: 80px; }
  .wallet-balance { font-size: 1.9rem; }
  .modal-overlay { padding: 4vh 10px 10px; }
}
