/* income-transfer-v1（copy 自 airdrop-transfer-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; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-card); }
.card[hidden] { display: none !important; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 0; }
.card-head b { font-size: 15px; }
.head-sub { font-size: 12px; font-weight: 700; color: var(--text-soft); font-variant-numeric: tabular-nums; }

/* ============ PILLS ============ */
.pill { padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.pill-green  { background: rgba(16, 185, 129, 0.12); color: #047857; }
.pill-amber  { background: rgba(245, 158, 11, 0.14); color: #b45309; }

/* ============ HERO ============ */
.hero-card { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.hero-top { display: flex; align-items: center; justify-content: space-between; }
.round-tag { font-size: 13px; font-weight: 800; color: var(--text-soft); }
.hero-price { display: flex; align-items: baseline; gap: 8px; }
.hero-price b { font-size: 40px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.hero-price span { font-size: 13px; font-weight: 700; color: var(--text-soft); }
.hero-note { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--text-soft); }

/* ============ 轉賬表單 ============ */
.xf-body { padding: 14px 18px 18px; }

.bm-amount { display: flex; flex-direction: column; gap: 6px; }
.bm-amount span { font-size: 12px; font-weight: 700; color: var(--text-soft); }
.bm-amount input {
  font: inherit;
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft, #f8fafc);
  color: var(--text);
  outline: none;
  width: 100%;
}
.bm-amount input:focus { border-color: var(--primary); background: var(--surface); }

.bm-chips { display: flex; gap: 8px; margin-top: 10px; }
.bm-chips button {
  flex: 1;
  padding: 8px 0;
  border-radius: 999px;
  background: var(--surface-soft, #f1f5f9);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.bm-chips button:hover { border-color: var(--primary); color: var(--primary-dark); }

.bm-err { margin: 12px 0 0; font-size: 12.5px; font-weight: 700; color: #b91c1c; }
.bm-err[hidden] { display: none !important; }

.bm-break { margin-top: 12px; display: flex; flex-direction: column; }
.bm-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 9px 0;
  border-top: 1px dashed var(--line);
  font-size: 13px;
  color: var(--text-soft);
}
.bm-row:first-child { border-top: 0; }
.bm-row b { color: var(--text); font-variant-numeric: tabular-nums; }
.bm-row b.hl { color: var(--primary-dark); font-size: 15px; }

.bm-confirm {
  width: 100%;
  margin-top: 14px;
  padding: 13px;
  border-radius: 999px;
  background: var(--cta-bg);
  color: var(--cta-text);
  font-size: 15px;
  font-weight: 800;
  transition: background 0.15s, opacity 0.15s;
}
.bm-confirm:hover:not(:disabled) { background: var(--primary-dark); }
.bm-confirm:disabled { opacity: 0.4; cursor: default; }

/* ============ 轉賬記錄 ============ */
.recs-card { padding-bottom: 8px; }
#recs { padding: 6px 18px 10px; display: flex; flex-direction: column; }
.rec-empty { margin: 8px 0 12px; font-size: 13px; color: var(--text-soft); }
.rec-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.rec-row:first-child { border-top: 0; }
.rec-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rec-main b { font-size: 14px; }
.rec-main small { font-size: 11.5px; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.rec-amt { font-size: 14px; font-weight: 800; color: #047857; font-variant-numeric: tabular-nums; display: inline-flex; align-items: baseline; gap: 4px; }
.rec-amt small { font-size: 11px; font-weight: 700; color: var(--text-soft); }

/* ============ 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; }
.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; }

/* ============ 慶祝彩蛋 ============ */
.gift-cheer {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: opacity 0.25s;
}
.gift-cheer[hidden] { display: none !important; }
.gift-cheer.out { opacity: 0; }
.gc-burst { position: absolute; left: 50%; top: 50%; }
.gc-burst i {
  position: absolute;
  width: 8px;
  height: 13px;
  border-radius: 2px;
  opacity: 0;
  animation: gc-fly 2s forwards;
}
@keyframes gc-fly {
  0% {
    transform: translate(0, 0) rotate(0);
    opacity: 1;
    animation-timing-function: cubic-bezier(0.18, 0.72, 0.4, 1);
  }
  38% {
    transform: translate(calc(var(--tx) * 0.55), var(--upy)) rotate(calc(var(--rot) * 0.45));
    opacity: 1;
    animation-timing-function: cubic-bezier(0.45, 0.05, 0.6, 0.5);
  }
  85% { opacity: 1; }
  100% {
    transform: translate(var(--tx), var(--ty)) rotate(var(--rot));
    opacity: 0;
  }
}
.gc-card {
  position: relative;
  background: var(--surface);
  border-radius: 22px;
  box-shadow: var(--shadow-float);
  padding: 26px 34px;
  text-align: center;
  cursor: default;
  animation: gc-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes gc-pop {
  from { opacity: 0; transform: scale(0.6); }
  to   { opacity: 1; transform: none; }
}
.gc-ic {
  width: 54px; height: 54px;
  margin: 0 auto 10px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary-soft), #fce7f3);
  color: var(--primary-dark);
}
.gc-ic svg { margin: 0 auto; }
.gc-card b { display: block; font-size: 18px; margin-bottom: 4px; }
.gc-card small { font-size: 12.5px; color: var(--text-soft); }

/* ============ TOAST ============ */
.w-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;
}
.w-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.w-toast[hidden] { display: none !important; }

/* ============ 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); }
}

/* ============ 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; }

  .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 .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; }
  body.nav-hidden .to-top { bottom: 28px; }
}

/* ============ income-transfer-v1 附加 ============ */
/* 雙幣結餘 hero */
.hero-duo { display: flex; gap: 28px; }
.hd-item { display: flex; align-items: baseline; gap: 7px; }
.hd-item b { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.hd-item span { font-size: 13px; font-weight: 700; color: var(--text-soft); }
.hd-item.pulse b { color: #047857; }
.hd-item.usdc b { color: #2775ca; }

/* 代幣切換 chips */
.tok-chips { display: flex; gap: 8px; margin-bottom: 14px; }
.tok-chips button {
  flex: 1;
  padding: 9px 0;
  border-radius: 999px;
  background: var(--surface-soft, #f1f5f9);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 800;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.tok-chips button:hover { border-color: var(--primary); }
.tok-chips button.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); }

/* USDC 記錄配色 */
.rec-amt.usdc { color: #2775ca; }

@media (max-width: 480px) {
  .hero-duo { flex-direction: column; gap: 6px; }
}
