/* ============================================================
   WhaleRadr in-app pages — v1
   Dark style matching the landing page (whaleradr.us).
   Android adaptation: safe-area insets, fluid clamp() sizing,
   100dvh app shell, gesture-nav aware bottom tab bar.
   ============================================================ */

@font-face {
  font-family: "Inter";
  src: url("../assets/fonts/inter-latin.woff") format("woff");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../assets/fonts/jetbrains-mono-latin.woff") format("woff");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #05060f;
  --bg-elev: #0b0d1a;
  --bg-card: rgba(16, 20, 40, 0.72);
  --bg-card-solid: #0e1124;
  --border: rgba(120, 160, 255, 0.14);
  --border-strong: rgba(0, 245, 255, 0.35);
  --text: #e8ecff;
  --text-muted: #8b93b8;
  --cyan: #00f5ff;
  --violet: #a855f7;
  --magenta: #ff2bd6;
  --green: #22d3a6;
  --amber: #fbbf24;
  --red: #fb7185;
  --congress: #60a5fa;
  --whale: #22d3a6;
  --trader: #f472b6;
  --hedge: #a78bfa;
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Inter", system-ui, -apple-system, "Roboto", "Noto Sans", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Roboto Mono", monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* Layout */
  --app-max: 560px;
  --gutter: clamp(12px, 4vw, 20px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --tabbar-h: 60px;
  --touch: 44px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
  color-scheme: dark;
}

body {
  height: 100%;
  height: 100dvh;
  overflow: hidden; /* scrolling happens inside .main */
  overscroll-behavior: none;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(0, 245, 255, 0.10), transparent 60%),
    radial-gradient(90% 50% at 100% 100%, rgba(168, 85, 247, 0.10), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: clamp(14px, 3.9vw, 16px);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  background: none;
  border: 0;
  touch-action: manipulation;
}
a {
  color: inherit;
  text-decoration: none;
  touch-action: manipulation;
}
img {
  display: block;
  max-width: 100%;
}
svg {
  width: 1em;
  height: 1em;
  flex: none;
}
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.mono { font-family: var(--mono); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------------- App shell ---------------- */
.app {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--app-max);
  height: 100%;
  height: 100dvh;
  margin: 0 auto;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  overflow: hidden;
}
@media (min-width: 600px) {
  .app {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    box-shadow: 0 0 80px rgba(0, 0, 0, 0.6);
  }
}

.main {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}
.main:focus { outline: none; }

.page {
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 3vw, 14px);
  padding: clamp(10px, 3vw, 16px) var(--gutter) 20px;
}

/* ---------------- Top bar ---------------- */
.topbar {
  flex: none;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 12px;
  padding: calc(var(--safe-top) + 10px) var(--gutter) 10px;
  background: linear-gradient(180deg, rgba(5, 6, 15, 0.96), rgba(5, 6, 15, 0.86));
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 5;
}
.brand { display: flex; align-items: center; min-width: 0; }
.brand-logo {
  height: clamp(30px, 9vw, 38px);
  width: auto;
}
.topbar-heading {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  padding-top: 4px;
}
.page-title {
  font-size: clamp(1.35rem, 6vw, 1.7rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.15;
  white-space: nowrap;
}
.page-sub {
  color: var(--text-muted);
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-detail {
  grid-template-columns: var(--touch) 1fr var(--touch);
  padding-bottom: 6px;
  padding-top: calc(var(--safe-top) + 6px);
}
.topbar-detail .topbar-title {
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch);
  height: var(--touch);
  border-radius: 12px;
  color: var(--cyan);
  font-size: 22px;
}
.icon-btn:active { background: rgba(0, 245, 255, 0.08); }
.icon-btn-sm { flex: none; width: var(--touch); min-width: var(--touch); height: var(--touch); font-size: 18px; color: var(--text-muted); }

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(34, 211, 166, 0.08);
  border: 1px solid rgba(34, 211, 166, 0.35);
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(34, 211, 166, 0.6);
  animation: pulse 1.8s ease-out infinite;
  flex: none;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 211, 166, 0.6); }
  100% { box-shadow: 0 0 0 9px rgba(34, 211, 166, 0); }
}

/* ---------------- Bottom tab bar ---------------- */
.tabbar {
  position: relative;
  flex: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom); /* gesture navigation bar */
  background: rgba(7, 9, 20, 0.94);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 10;
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: var(--touch);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  transition: color 0.2s var(--ease);
}
.tab-icon { font-size: 22px; display: inline-flex; }
.tab.active { color: var(--cyan); }
.tab.active .tab-icon { filter: drop-shadow(0 0 6px rgba(0, 245, 255, 0.55)); }
.tab:active { opacity: 0.7; }

/* ---------------- Cards / glass ---------------- */
.glass {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}
.card { padding: clamp(12px, 3.6vw, 16px); }
.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.98rem;
  font-weight: 700;
  margin-bottom: 10px;
}
.card-text { color: var(--text-muted); font-size: 0.9rem; }
.card-foot { margin-top: 10px; color: var(--text-muted); font-size: 0.76rem; }
.title-icon { display: inline-flex; font-size: 18px; color: var(--cyan); }
.title-icon.tg { color: #2aabee; }

/* ---------------- Stats ---------------- */
.stats {
  padding: 10px clamp(12px, 3.6vw, 16px);
}
.stats-row {
  display: grid;
  grid-template-columns: auto repeat(3, 1fr);
  align-items: center;
  gap: 8px;
}
.stats-window {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}
.stat-num {
  font-family: var(--mono);
  font-weight: 600;
  font-size: clamp(0.95rem, 4.4vw, 1.15rem);
  color: var(--text);
  white-space: nowrap;
}
.stat-label { color: var(--text-muted); font-size: 0.7rem; }
.stats-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  color: var(--text-muted);
  font-size: 0.78rem;
}
.stats-total strong {
  font-family: var(--mono);
  color: var(--cyan);
  font-size: 0.95rem;
}
.bump { animation: bump 0.5s var(--ease); }
@keyframes bump {
  0% { transform: scale(1); color: var(--cyan); }
  40% { transform: scale(1.18); color: var(--cyan); }
  100% { transform: scale(1); }
}

/* ---------------- Filter chips ---------------- */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0;
  margin: 0 calc(-1 * var(--gutter));
  padding-left: var(--gutter);
  padding-right: var(--gutter);
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--touch);
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(16, 20, 40, 0.6);
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
}
.chip.active {
  color: var(--cyan);
  border-color: var(--border-strong);
  background: rgba(0, 245, 255, 0.08);
  box-shadow: 0 0 18px rgba(0, 245, 255, 0.12) inset;
}
.chip:active { transform: scale(0.97); }
.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}
.dot-congress { background: var(--congress); }
.dot-whale { background: var(--whale); }
.dot-hedge { background: var(--hedge); }
.dot-trader { background: var(--trader); }

/* ---------------- Alert cards ---------------- */
.feed-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.alert-card {
  position: relative;
  display: block;
  padding: clamp(12px, 3.6vw, 16px);
  overflow: hidden;
  transition: transform 0.15s var(--ease), border-color 0.2s var(--ease);
}
.alert-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--cat, var(--cyan));
  opacity: 0.9;
}
.alert-card:active { transform: scale(0.985); }
.cat-congress { --cat: var(--congress); }
.cat-whale { --cat: var(--whale); }
.cat-hedge { --cat: var(--hedge); }
.cat-trader { --cat: var(--trader); }

.alert-card.is-new {
  animation: slideIn 0.55s var(--ease);
  border-color: var(--cat, var(--cyan));
  box-shadow: 0 0 28px rgba(0, 245, 255, 0.14);
}
@keyframes slideIn {
  0% { opacity: 0; transform: translateY(-18px) scale(0.97); max-height: 0; }
  60% { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) scale(1); max-height: 260px; }
}

.alert-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.tag-congress { background: rgba(96, 165, 250, 0.15); color: var(--congress); border: 1px solid rgba(96, 165, 250, 0.35); }
.tag-whale { background: rgba(34, 211, 166, 0.15); color: var(--whale); border: 1px solid rgba(34, 211, 166, 0.35); }
.tag-trader { background: rgba(244, 114, 182, 0.15); color: var(--trader); border: 1px solid rgba(244, 114, 182, 0.35); }
.tag-hedge { background: rgba(167, 139, 250, 0.15); color: var(--hedge); border: 1px solid rgba(167, 139, 250, 0.35); }

.market {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 0.64rem;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.new-badge {
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #05060f;
  background: linear-gradient(120deg, var(--cyan), #7df9ff);
  animation: blink 1.2s ease-in-out 3;
}
@keyframes blink { 50% { opacity: 0.55; } }
.followed-mark {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 0.68rem;
}
.followed-mark svg { font-size: 12px; color: var(--green); }

.alert-who {
  font-size: clamp(1rem, 4.6vw, 1.15rem);
  font-weight: 700;
  line-height: 1.25;
}
.alert-action {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-top: 2px;
}
.asset { color: var(--cyan); font-weight: 700; }
.alert-bottom {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 8px;
}
.amount {
  font-family: var(--mono);
  font-weight: 600;
  font-size: clamp(1.25rem, 6vw, 1.5rem);
  color: var(--cyan);
  letter-spacing: -0.01em;
}
.sep { color: var(--text-muted); }
.rel { color: var(--text-muted); font-size: 0.8rem; }

.empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--text-muted);
}
.sample-note {
  text-align: center;
  color: rgba(139, 147, 184, 0.7);
  font-size: 0.7rem;
  padding: 6px 0 0;
}

/* ---------------- Detail ---------------- */
.detail-hero {
  position: relative;
  padding: clamp(14px, 4vw, 20px);
  overflow: hidden;
}
.detail-hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--cat, var(--cyan)), transparent);
}
.detail-who {
  font-size: clamp(1.4rem, 7vw, 1.9rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.detail-action {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 1rem;
}
.detail-amount {
  margin-top: 10px;
  font-family: var(--mono);
  font-weight: 600;
  font-size: clamp(2rem, 10vw, 2.6rem);
  color: var(--cyan);
  line-height: 1;
  text-shadow: 0 0 24px rgba(0, 245, 255, 0.25);
}
.kv {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.kv-row {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 10px;
  font-size: 0.86rem;
}
.kv-row dt { color: var(--text-muted); }
.kv-row dd { min-width: 0; overflow-wrap: anywhere; }
.addr { font-size: 0.78rem; word-break: break-all; }

/* Timeline */
.timeline {
  list-style: none;
  position: relative;
  padding-left: 6px;
}
.tl-step {
  position: relative;
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  padding-bottom: 16px;
}
.tl-step:last-child { padding-bottom: 2px; }
.tl-step::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 16px;
  bottom: -2px;
  width: 2px;
  background: var(--border);
}
.tl-step:last-child::before { display: none; }
.tl-dot {
  width: 14px;
  height: 14px;
  margin: 3px 0 0 4px;
  border-radius: 50%;
  background: var(--bg-elev);
  border: 2px solid var(--text-muted);
}
.tl-trade .tl-dot { border-color: var(--text-muted); }
.tl-filed .tl-dot { border-color: var(--cyan); background: var(--cyan); box-shadow: 0 0 12px rgba(0, 245, 255, 0.6); }
.tl-alert .tl-dot { border-color: var(--green); background: var(--green); box-shadow: 0 0 12px rgba(34, 211, 166, 0.5); }
.tl-news .tl-dot { border-color: var(--amber); }
.tl-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}
.tl-label { font-weight: 600; font-size: 0.92rem; }
.tl-filed .tl-label { color: var(--cyan); }
.tl-alert .tl-label { color: var(--green); }
.tl-news .tl-label { color: var(--amber); }
.tl-offset {
  flex: none;
  font-size: 0.76rem;
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.tl-time { color: var(--text-muted); font-size: 0.76rem; margin-top: 2px; }
.tl-note { color: var(--text-muted); font-size: 0.74rem; font-style: italic; margin-top: 2px; }

.gap-banner {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 10px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.07);
}
.gap-label { font-size: 0.82rem; color: var(--text-muted); }
.gap-value {
  grid-row: span 2;
  font-family: var(--mono);
  font-size: 1.3rem;
  color: var(--amber);
}
.gap-sub { font-size: 0.72rem; color: var(--text-muted); }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid transparent;
}
.btn svg { font-size: 18px; }
.btn:active { transform: scale(0.985); }
.btn:disabled { opacity: 0.6; }
.btn-block { width: 100%; }
.btn-primary {
  color: #05060f;
  background: linear-gradient(120deg, var(--cyan), #6cf6ff);
  box-shadow: 0 0 24px rgba(0, 245, 255, 0.25);
}
.btn-ghost {
  color: var(--text);
  border-color: var(--border-strong);
  background: rgba(0, 245, 255, 0.05);
}
.btn-follow {
  width: 100%;
  min-height: 52px;
  color: var(--green);
  border-color: rgba(34, 211, 166, 0.55);
  background: rgba(34, 211, 166, 0.10);
}
.btn-follow.is-following {
  color: var(--text);
  border-color: rgba(34, 211, 166, 0.8);
  background: rgba(34, 211, 166, 0.22);
}

/* ---------------- Following ---------------- */
.summary-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  font-size: 0.9rem;
}
.summary-bar strong { color: var(--cyan); font-family: var(--mono); }
.summary-bar span { color: var(--text-muted); }
.link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: var(--touch);
  color: var(--cyan);
  font-weight: 600;
  font-size: 0.84rem;
}
.group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.entity-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.entity-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 10px 10px 12px;
  min-height: 60px;
}
.entity-row .avatar { margin-top: 2px; }
.entity-row .follow-btn { margin-top: 2px; }

.avatar {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 1rem;
  color: var(--cat, var(--cyan));
  background: rgba(120, 160, 255, 0.10);
  border: 1px solid rgba(120, 160, 255, 0.28);
}
.entity-main { flex: 1 1 0; min-width: 0; }
.entity-name {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.entity-sub {
  color: var(--text-muted);
  font-size: 0.76rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.entity-meta {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.35;
}
.sample-flag {
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(139, 147, 184, 0.85);
}
.entity-addr {
  flex: 1 1 100%;
  margin-top: 0;
  padding-left: 50px; /* align with name, past the 40px avatar + gap */
}
.addr-tools, .addr-dd {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.addr-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.addr-short {
  font-size: 0.78rem;
  color: var(--text);
}
.addr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: var(--touch);
  min-width: var(--touch);
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--cyan);
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(0, 245, 255, 0.05);
  text-decoration: none;
}
.addr-btn svg { width: 14px; height: 14px; flex: none; }
.addr-btn:active { transform: scale(0.97); }
.search-wrap { margin: 4px 0 10px; }
.search-input { width: 100%; }
.group-title .group-count {
  margin-left: auto;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-muted);
}
.show-more {
  width: 100%;
  min-height: var(--touch);
  margin-top: 4px;
  margin-bottom: 4px;
  border-radius: 12px;
  border: 1px dashed var(--border-strong);
  color: var(--cyan);
  font-weight: 700;
  font-size: 0.84rem;
  background: rgba(0, 245, 255, 0.04);
}
.show-more:active { transform: scale(0.99); }
.empty-search {
  margin: 12px 0;
  color: var(--text-muted);
  text-align: center;
  font-size: 0.9rem;
}
.follow-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 104px;
  min-height: var(--touch);
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--cyan);
  font-size: 0.82rem;
  font-weight: 700;
  background: rgba(0, 245, 255, 0.05);
}
.follow-btn svg { font-size: 15px; }
.follow-btn.is-following {
  color: #05060f;
  background: linear-gradient(120deg, var(--green), #5eead4);
  border-color: transparent;
}
.follow-btn:active { transform: scale(0.97); }

.add-wallet .card-title { margin-bottom: 8px; }
.wallet-form {
  display: flex;
  gap: 8px;
}
.input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 48px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(5, 6, 15, 0.7);
  color: var(--text);
  font-size: 16px; /* prevents Android/iOS auto-zoom on focus */
}
.input::placeholder { color: rgba(139, 147, 184, 0.7); }
.input:focus { outline: none; border-color: var(--border-strong); }
.wallet-form .btn { flex: none; min-width: 76px; }
.form-hint { margin-top: 8px; color: var(--text-muted); font-size: 0.76rem; }
.form-hint.error { color: var(--red); }

/* ---------------- Settings ---------------- */
.setting-list { display: flex; flex-direction: column; }
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  border-bottom: 1px solid var(--border);
}
.setting-list .setting-row:last-child { border-bottom: 0; }
.setting-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.95rem;
}
.switch {
  position: relative;
  flex: none;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: rgba(139, 147, 184, 0.25);
  border: 1px solid var(--border);
  transition: background 0.2s var(--ease);
}
/* enlarge touch area to >=44px */
.switch::after {
  content: "";
  position: absolute;
  inset: -8px -4px;
}
.switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #dfe4ff;
  transition: transform 0.22s var(--ease);
}
.switch.on {
  background: linear-gradient(120deg, rgba(0, 245, 255, 0.85), rgba(34, 211, 166, 0.85));
  border-color: transparent;
}
.switch.on .switch-knob { transform: translateX(22px); background: #fff; }

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.segmented-2 { grid-template-columns: repeat(2, 1fr); margin-top: 12px; }
.seg {
  min-height: var(--touch);
  padding: 0 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(16, 20, 40, 0.6);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.86rem;
}
.seg.active {
  color: var(--cyan);
  border-color: var(--border-strong);
  background: rgba(0, 245, 255, 0.10);
}
.tg-status {
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
  overflow-wrap: break-word;
}
.tg-status .nowrap { white-space: nowrap; }
.tg-status.ok::before { content: "● "; color: var(--green); }
.tg-status.warn::before { content: "● "; color: var(--amber); }
.tg-status.err { color: var(--red); }
.tg-status.err::before { content: "● "; color: var(--red); }

.tg-card .field-label {
  display: block;
  margin: 12px 0 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
}
.input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}
.input-wrap .input { flex: 1 1 auto; }
.input-wrap .input-toggle {
  flex: none;
  width: var(--touch);
  height: var(--touch);
  min-width: var(--touch);
  color: var(--text-muted);
  font-size: 20px;
  border-radius: 12px;
}
.input-wrap .input-toggle:active { background: rgba(0, 245, 255, 0.08); color: var(--cyan); }

.tg-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.tg-actions .btn { margin: 0; min-height: var(--touch); font-size: 0.86rem; padding: 0 10px; }
@media (max-width: 360px) {
  .tg-actions { grid-template-columns: 1fr; }
}

.tg-toggle-row { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 4px; }
.tg-toggle-row.is-locked .switch {
  opacity: 0.45;
}
.switch[aria-disabled="true"] { cursor: not-allowed; }

.tg-guide {
  margin: 0 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(5, 6, 15, 0.45);
}
.tg-guide summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: var(--touch);
  padding: 8px 12px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
}
.tg-guide summary::-webkit-details-marker { display: none; }
.tg-guide summary::after {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--cyan);
  border-bottom: 2px solid var(--cyan);
  transform: rotate(45deg);
  transition: transform 0.2s var(--ease);
  margin-top: -4px;
}
.tg-guide[open] summary::after { transform: rotate(225deg); margin-top: 4px; }
.tg-guide ol {
  margin: 0;
  padding: 0 14px 8px 28px;
  color: var(--text-muted);
  font-size: 0.86rem;
}
.tg-guide li { margin-bottom: 6px; }
.tg-guide p {
  margin: 0;
  padding: 0 12px 12px;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.tg-guide code {
  font-family: var(--mono);
  font-size: 0.84em;
  color: var(--cyan);
}

/* ---------------- Me ---------------- */
.me-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 18px 14px;
}
.me-logo { width: clamp(170px, 52vw, 230px); height: auto; }
.me-tag { color: var(--text-muted); font-size: 0.84rem; }
.me-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.badge {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--green);
  border: 1px solid rgba(34, 211, 166, 0.35);
  background: rgba(34, 211, 166, 0.08);
}
.faq { display: flex; flex-direction: column; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item:last-child { border-bottom: 0; }
.faq-item summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 10px 0;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-icon {
  position: relative;
  flex: none;
  width: 18px;
  height: 18px;
}
.faq-icon::before,
.faq-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 2px;
  background: var(--cyan);
  transform: translate(-50%, -50%);
  transition: transform 0.2s var(--ease);
}
.faq-icon::after { transform: translate(-50%, -50%) rotate(90deg); }
.faq-item[open] .faq-icon::after { transform: translate(-50%, -50%) rotate(0deg); }
.faq-item p {
  color: var(--text-muted);
  font-size: 0.88rem;
  padding: 0 0 12px;
}
.disclaimer { border-color: rgba(251, 191, 36, 0.25); }
.disclaimer .title-icon { color: var(--amber); }
/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 14px);
  transform: translate(-50%, 12px);
  max-width: min(92vw, 480px);
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(14, 17, 36, 0.96);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  z-index: 50;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- Small screens (≤340px) ---------------- */
@media (max-width: 340px) {
  .page-sub { display: none; }
  .follow-btn { min-width: 0; padding: 0 10px; font-size: 0.76rem; }
  .avatar { width: 36px; height: 36px; }
  .stats-window { font-size: 0.68rem; }
  .kv-row { grid-template-columns: 64px 1fr; }
}

/* ---------------- Landscape phones ---------------- */
@media (orientation: landscape) and (max-height: 480px) {
  :root { --tabbar-h: 52px; }
  .topbar { padding-top: calc(var(--safe-top) + 6px); padding-bottom: 6px; }
  .topbar-heading { padding-top: 0; }
  .brand-logo { height: 28px; }
  .page-title { font-size: 1.2rem; }
}

/* ---------------- Tablets ---------------- */
@media (min-width: 768px) {
  :root { --app-max: 640px; }
  .feed-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .feed-list .empty { grid-column: 1 / -1; }
}

/* ---------------- Reduced motion ---------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
