/* receive-v1 — self-contained per prototype principle. */

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-sans); -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* ============ APP SHELL ============ */
.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 680px) 320px;
  gap: 24px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

/* ============ SIDEBAR ============ */
.sidebar { position: sticky; top: 24px; height: calc(100vh - 48px); display: flex; flex-direction: column; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 14px; font-size: 32px; font-weight: 800; margin-bottom: 36px; color: var(--text); }
.brand img { width: 42px; height: 42px; object-fit: contain; }
.sidebar nav { display: flex; flex-direction: column; gap: 8px; }
.sidebar nav a {
  padding: 14px 18px; color: var(--text-soft); border-radius: 999px; font-weight: 600; font-size: 16px;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.sidebar nav a.active, .sidebar nav a:hover { background: var(--surface); color: var(--text); box-shadow: var(--shadow-card); }
.new-post { border-radius: 999px; background: var(--cta-bg); color: var(--cta-text); font-weight: 700; padding: 14px 22px; font-size: 16px; }

/* ============ MAIN ============ */
.main { min-width: 0; display: flex; flex-direction: column; gap: 14px; }

.topbar {
  display: flex; align-items: center; gap: 10px;
  min-height: 44px;
}
.topbar .back {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--text-soft);
  transition: background 0.15s, color 0.15s;
}
.topbar .back:hover { background: var(--surface-soft); color: var(--text); }
.topbar h1 { font-size: 28px; margin: 0; font-weight: 700; letter-spacing: -0.01em; flex: 1; }
.topbar-brand { display: none; align-items: center; gap: 8px; color: var(--text); font-weight: 800; font-size: 22px; letter-spacing: -0.01em; }
.topbar-brand img { width: 24px; height: 24px; object-fit: contain; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.wallet-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 700; font-size: 13px;
  font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
  transition: background 0.15s, transform 0.15s, border-color 0.15s;
}
.wallet-chip:hover { background: var(--surface); border-color: var(--primary); transform: translateY(-1px); }
.wallet-chip .ic { display: inline-flex; align-items: center; line-height: 1; }
.wallet-chip .ic svg { display: block; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-card); }

/* ============ QR CARD ============ */
.qr-card {
  padding: 28px 24px;
  text-align: center;
}
.qr-frame {
  display: inline-block;
  padding: 16px;
  background: white;
  border-radius: 18px;
  border: 1px solid var(--line);
  margin-bottom: 18px;
  position: relative;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
@media (hover: hover) {
  .qr-frame:hover {
    border-color: var(--primary);
    transform: scale(1.015);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.14);
  }
}
.qr-frame:active { transform: scale(0.985); }
.qr-frame svg {
  width: 220px; height: 220px;
  display: block;
  margin: 0 auto;
}
/* Pulse heart logo centered on QR (cute touch + classic QR "logo overlay" feel) */
.qr-frame .qr-logo {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.qr-frame .qr-logo .inner {
  background: white;
  border-radius: 12px;
  padding: 8px;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.qr-frame .qr-logo svg {
  width: 26px;
  height: 26px;
  color: var(--primary);
}

.qr-handle {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0;
}
.qr-handle .at { color: var(--text-muted); font-weight: 700; margin-right: 1px; }
.qr-note {
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.55;
  margin: 8px 0 0;
}

/* Address / handle row with copy button */
.addr-row {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.addr-row .label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.addr-row .value {
  flex: 1; min-width: 0;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}
.addr-row button {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 700; font-size: 13px;
  transition: background 0.15s, color 0.15s;
}
.addr-row button:hover { background: var(--primary); color: white; }
.addr-row button.copied { background: var(--success); color: white; }
.addr-row svg { width: 14px; height: 14px; }

/* Quick action row */
.actions-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.actions-row .act {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.actions-row .act:hover { background: var(--primary-soft); border-color: var(--primary); transform: translateY(-1px); }
.actions-row .act svg { width: 22px; height: 22px; color: var(--primary); }

/* On-chain Solana address card */
.chain-card { padding: 16px 18px; }
.chain-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.chain-head .label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.chain-tag {
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 800;
}
.chain-addr-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chain-addr {
  flex: 1; min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  word-break: break-all;
  background: var(--surface-soft, #f1f5f9);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.chain-addr-row button {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 700; font-size: 13px;
  transition: background 0.15s, color 0.15s;
}
.chain-addr-row button:hover { background: var(--primary); color: white; }
.chain-addr-row button.copied { background: var(--success); color: white; }
.chain-addr-row button svg { width: 14px; height: 14px; }
.chain-note {
  color: var(--text-soft);
  font-size: 12.5px;
  line-height: 1.6;
  margin: 10px 0 0;
}
.chain-warn {
  margin: 10px 0 0;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #92400e;
  font-size: 12.5px;
  line-height: 1.55;
}

/* Recent received */
.recent-card { padding: 18px 20px; }
.recent-card h2 { font-size: 14px; font-weight: 800; margin: 0 0 12px; letter-spacing: 0.02em; }
.recent-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.recent-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.recent-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.recent-list li:first-child { padding-top: 0; }
.recent-list .ic {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(16,185,129,0.12);
  color: var(--success);
  display: grid; place-items: center;
  font-size: 16px;
}
.recent-list .meta { flex: 1; min-width: 0; }
.recent-list .meta b { display: block; font-weight: 700; font-size: 13px; }
.recent-list .meta small { color: var(--text-soft); font-size: 12px; }
.recent-list .amt {
  font-weight: 800; font-size: 14px;
  color: var(--success);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.recent-list .amt small { font-size: 10px; opacity: 0.7; margin-left: 3px; }

/* ============ RIGHT PANEL ============ */
.right-panel { display: flex; flex-direction: column; gap: 18px; }
.right-panel .card { padding: 18px; }
.right-panel h2 { font-size: 16px; margin: 0 0 12px; font-weight: 700; }
.right-panel p { font-size: 13px; line-height: 1.6; margin: 0 0 8px; color: var(--text); }
.right-panel p:last-child { margin-bottom: 0; }

.howto { background: linear-gradient(180deg, var(--surface), var(--primary-soft)); }
.howto ol {
  padding-left: 0;
  margin: 8px 0 0;
  list-style: none;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.howto ol li {
  counter-increment: step;
  padding-left: 28px;
  position: relative;
  font-size: 13px;
  line-height: 1.55;
}
.howto ol li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 0;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 800;
  display: grid; place-items: center;
}

.tips-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.tips-list li {
  display: flex;
  gap: 8px;
  font-size: 13px;
  line-height: 1.55;
}
.tips-list li::before { content: "·"; color: var(--primary); font-weight: 800; }

/* ============ TOAST ============ */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: var(--text);
  color: white;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow-float);
  z-index: 1000;
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============ BACK TO TOP ============ */
.to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 50;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--text);
  color: white;
  display: grid;
  place-items: center;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.32);
  opacity: 0;
  transform: translateY(8px) scale(0.9);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s, background 0.15s;
}
.to-top.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
@media (hover: hover) {
  .to-top:hover { background: var(--primary-dark); }
}
.to-top:active { transform: translateY(0) scale(0.94); }

/* ============ MOBILE NAV ============ */
.mobile-nav { display: none; }

/* ============ RESPONSIVE ============ */
@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 12px;
    padding-bottom: 96px;
    gap: 12px;
  }
  .sidebar, .right-panel { display: none; }

  .topbar {
    position: sticky; top: 0; z-index: 10;
    background: rgba(248, 250, 252, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 12px 4px; margin: 0 0 12px;
  }
  .topbar h1 { display: none; }
  .topbar-brand { display: inline-flex; flex: 1; }

  .qr-frame svg { width: 200px; height: 200px; }

  .mobile-nav {
    position: fixed;
    left: 12px; right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow-card);
    padding: 10px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 20;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s;
  }
  .mobile-nav.nav-hidden {
    transform: translateY(calc(100% + 24px));
    opacity: 0;
    pointer-events: none;
  }
  .mobile-nav a { text-align: center; font-size: 12px; color: var(--text-soft); padding: 8px 4px; }
  .mobile-nav a.active { color: var(--text); font-weight: 600; }
  .mobile-nav .compose-btn {
    width: 46px; height: 46px;
    margin: auto; padding: 0;
    border-radius: 50%;
    background: var(--cta-bg); color: var(--cta-text);
    display: grid; place-items: center; line-height: 1;
  }

  .to-top {
    bottom: 88px; right: 16px; width: 42px; height: 42px;
    transition: opacity 0.2s, transform 0.2s, background 0.15s,
                bottom 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }
  body.nav-hidden .to-top { bottom: 28px; }
}
