
    :root {
      --primary: #3182F6;
      --primary-hover: #1d6df0;
      --primary-soft: #E8F1FE;
      --primary-tint: #F4F8FF;
      --bg: #f5f7fa;
      --card-bg: #ffffff;
      --text-main: #11181c;
      --text-sub: #5b6573;
      --text-muted: #9aa3af;
      --border: #eef0f4;
      --border-strong: #dfe3ea;
      --radius-md: 12px;
      --radius-lg: 16px;
      --radius-xl: 20px;
      --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
      --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
      --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.16);
    }
    * { box-sizing: border-box; }
    body { margin: 0; }
    .rewards-app {
      max-width: 480px;
      margin: 0 auto;
      min-height: 100vh;
      padding: 0 16px 32px;
      box-sizing: border-box;
      font-family: 'Inter', 'Noto Sans TC', 'Noto Sans KR', system-ui, -apple-system, sans-serif;
      background: var(--bg);
      color: var(--text-main);
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
    }
    /* 嵌入主站 Portfolio 时, 不撑满整屏, 仅作为该位置的一个区块。
       - 背景透明, 融入主站页面底色(主站自身已有底色与卡片层级)
       - 底部留出固定底栏(._tabBar)的安全高度, 避免最后一张卡片被底栏遮挡 */
    .rewards-embedded .rewards-app {
      min-height: auto;
      background: transparent;
      padding-bottom: calc(var(--mt-tabbar-h, 56px) + var(--mt-safe-bottom, 0px) + 20px);
    }
    /* Portfolio 列表区折叠按钮: 右上角, 与 tab 行同高 */
    .rewards-collapse-btn {
      position: absolute;
      top: 4px;
      right: 4px;
      width: 36px;
      height: 36px;
      border: 1px solid var(--border, #eef0f4);
      background: rgba(255, 255, 255, 0.92);
      border-radius: 10px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--text-sub, #5b6573);
      transition: background-color .15s, color .15s, box-shadow .15s;
      box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
      z-index: 5;
      font-family: inherit;
    }
    .rewards-collapse-btn:hover {
      background: var(--bg, #f5f7fa);
      color: var(--text-main, #11181c);
    }
    .rewards-collapse-btn:active { transform: scale(0.95); }
    .rewards-collapse-btn.collapsed { color: var(--primary, #3182F6); }
    .rewards-collapse-btn svg { transition: transform .2s ease; display: block; }
    /* 折叠行为由 JS 控制(隐藏 filterRow 之后的兄弟/表格),
       CSS 不再全局 nth-child 隐藏, 否则会把含按钮的 filterRow 也藏掉。 */
    /* Header */
    .header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 16px 4px 20px;
      gap: 12px;
    }
    .header-title {
      font-size: 20px;
      font-weight: 700;
      letter-spacing: 0.2px;
      color: var(--text-main);
      flex: 1;
    }
    .header-actions {
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .btn-primary {
      background: var(--primary);
      color: #fff;
      border: none;
      border-radius: 999px;
      padding: 9px 18px;
      font-size: 13.5px;
      font-weight: 700;
      cursor: pointer;
      box-shadow: 0 1px 2px rgba(49, 130, 246, 0.12), 0 4px 12px rgba(49, 130, 246, 0.18);
      transition: background-color .15s;
      font-family: inherit;
    }
    .btn-primary:hover { background: var(--primary-hover); }
    .btn-primary:active { transform: translateY(0.5px); }
    .btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
    /* Total reward card */
    .total-card {
      background: var(--card-bg);
      border-radius: var(--radius-xl);
      border: 1px solid var(--border);
      padding: 22px 22px 20px;
      box-shadow: var(--shadow-sm);
      margin-bottom: 12px;
    }
    .total-card-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 10px;
    }
    .total-label {
      font-size: 13px;
      color: var(--text-sub);
      font-weight: 500;
    }
    .total-amount {
      font-family: 'IBM Plex Mono', 'Inter', monospace;
      font-size: 36px;
      font-weight: 700;
      color: var(--text-main);
      letter-spacing: -0.5px;
      line-height: 1.1;
      display: flex;
      align-items: baseline;
      gap: 6px;
      margin-bottom: 14px;
    }
    .total-amount .unit {
      font-size: 16px;
      font-weight: 600;
      color: var(--text-sub);
    }
    .tier-row {
      display: flex;
      align-items: center;
      gap: 8px;
    }
    /* Tier 艺术字: 渐变 + 衬线斜体, 与其他文字明显区分 */
    .tier-art {
      font-family: 'Fraunces', 'Noto Sans TC', serif;
      font-style: italic;
      font-weight: 600;
      font-size: 18px;
      letter-spacing: 0.5px;
      background: linear-gradient(135deg, #3182F6 0%, #6366f1 50%, #2563eb 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
      color: transparent;
      padding: 0 2px;
      margin-top: 10px;
      display: block;
    }
    /* Metric cards (two in a row) — 左寬右窄, 比例 ≈ 1.4:1 */
    .metric-row {
      display: grid;
      grid-template-columns: 1.4fr 1fr;
      gap: 12px;
      margin-top: 12px;
    }
    .metric-card {
      background: var(--card-bg);
      border-radius: var(--radius-lg);
      border: 1px solid var(--border);
      padding: 16px 16px 16px;
      box-shadow: var(--shadow-sm);
      cursor: pointer;
      transition: box-shadow .15s, transform .15s;
      min-height: 96px;
    }
    .metric-card.clickable:hover { box-shadow: var(--shadow-md); }
    .metric-card.clickable:active { transform: translateY(0.5px); }
    .metric-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 14px;
    }
    .metric-label {
      font-size: 13px;
      color: var(--text-sub);
      font-weight: 500;
    }
    .metric-icon-btn {
      width: 28px;
      height: 28px;
      border-radius: 8px;
      background: var(--primary-tint);
      border: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--primary);
      transition: background-color .15s;
    }
    .metric-icon-btn:hover { background: var(--primary-soft); }
    .metric-value {
      font-family: 'IBM Plex Mono', 'Inter', monospace;
      font-size: 22px;
      font-weight: 700;
      color: var(--text-main);
      line-height: 1.1;
      display: flex;
      align-items: baseline;
      gap: 4px;
      margin-top: 6px;
    }
    .metric-value .unit {
      font-size: 13px;
      font-weight: 600;
      color: var(--text-sub);
    }
    /* 邀请板块 */
    .invite-card {
      background: var(--card-bg);
      border-radius: var(--radius-lg);
      border: 1px solid var(--border);
      padding: 18px 16px;
      box-shadow: var(--shadow-sm);
      margin-top: 12px;
    }
    .invite-title {
      font-size: 14px;
      font-weight: 600;
      color: var(--text-main);
      margin-bottom: 12px;
    }
    .invite-link-row {
      display: flex;
      gap: 8px;
      margin-bottom: 10px;
    }
    .invite-link {
      flex: 1;
      min-width: 0;
      height: 44px;
      border: 1px solid var(--border-strong);
      border-radius: 10px;
      padding: 0 14px;
      font-size: 12.5px;
      font-family: 'IBM Plex Mono', monospace;
      background: #fff;
      color: var(--text-sub);
      display: flex;
      align-items: center;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .invite-copy-btn {
      flex-shrink: 0;
      background: var(--primary);
      color: #fff;
      border: none;
      border-radius: 10px;
      padding: 0 16px;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      font-family: inherit;
      transition: background-color .15s;
      white-space: nowrap;
    }
    .invite-copy-btn:hover { background: var(--primary-hover); }
    .invite-copy-btn:active { transform: translateY(0.5px); }
    .invite-copy-btn.copied { background: #15803D; }
    .invite-desc {
      font-size: 12px;
      color: var(--text-muted);
      line-height: 1.5;
      margin-top: 10px;
    }
    /* Bottom sheet */
    .sheet-overlay {
      position: fixed;
      inset: 0;
      background: rgba(15, 23, 42, 0.45);
      z-index: 100;
      display: flex;
      align-items: flex-end;
      justify-content: center;
      animation: fadeIn .2s ease;
    }
    @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
    .sheet {
      background: var(--card-bg);
      width: 100%;
      max-width: 480px;
      max-height: 80vh;
      border-radius: 24px 24px 0 0;
      padding: 12px 20px 24px;
      box-shadow: var(--shadow-lg);
      display: flex;
      flex-direction: column;
      animation: slideUp .25s ease;
    }
    @keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
    .sheet-handle {
      width: 36px;
      height: 4px;
      background: #e2e6ec;
      border-radius: 2px;
      margin: 0 auto 14px;
    }
    .sheet-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 0 16px;
    }
    .sheet-title {
      font-size: 17px;
      font-weight: 700;
      color: var(--text-main);
    }
    .sheet-close {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      border: none;
      background: transparent;
      cursor: pointer;
      color: var(--text-sub);
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .sheet-close:hover { background: var(--bg); }
    .sheet-tabs {
      display: flex;
      gap: 8px;
      padding: 0 0 14px;
      border-bottom: 1px solid var(--border);
      margin-bottom: 6px;
    }
    .sheet-tab {
      flex: 1;
      padding: 10px 0;
      border: none;
      background: transparent;
      font-size: 14px;
      font-weight: 600;
      color: var(--text-sub);
      cursor: pointer;
      border-bottom: 2px solid transparent;
      font-family: inherit;
      transition: color .15s, border-color .15s;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 4px;
    }
    .sheet-tab.active {
      color: var(--primary);
      border-bottom-color: var(--primary);
    }
    .sheet-tab .count {
      font-family: 'IBM Plex Mono', monospace;
      font-size: 13px;
      opacity: 0.85;
    }
    .sheet-body {
      flex: 1;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }
    /* Reward list item */
    .r-item {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 14px 0;
      border-bottom: 1px solid var(--border);
    }
    .r-item:last-child { border-bottom: none; }
    .r-tag {
      flex-shrink: 0;
      font-size: 12px;
      font-weight: 700;
      padding: 4px 8px;
      border-radius: 6px;
      width: 44px;
      text-align: center;
    }
    .r-tag.direct { background: #E8F1FE; color: #1d6df0; }
    .r-tag.indirect { background: #FEF3C7; color: #B45309; }
    .r-tag.node { background: #F0FDF4; color: #15803D; }
    .r-info { flex: 1; min-width: 0; }
    .r-addr {
      font-family: 'IBM Plex Mono', monospace;
      font-size: 13px;
      color: var(--text-main);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .r-date {
      font-size: 12px;
      color: var(--text-muted);
      margin-top: 2px;
    }
    .r-amt {
      flex-shrink: 0;
      font-family: 'IBM Plex Mono', monospace;
      font-size: 15px;
      font-weight: 700;
      color: var(--text-main);
    }
    .r-amt .plus { color: #15803D; font-size: 13px; margin-right: 2px; }
    /* Invitee list */
    .inv-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 14px 0;
      border-bottom: 1px solid var(--border);
    }
    .inv-item:last-child { border-bottom: none; }
    .inv-addr {
      font-family: 'IBM Plex Mono', monospace;
      font-size: 13px;
      color: var(--text-main);
    }
    .inv-date {
      font-size: 12px;
      color: var(--text-muted);
    }
    .empty {
      padding: 40px 20px;
      text-align: center;
      color: var(--text-muted);
      font-size: 14px;
    }
    /* Modal (withdraw) */
    .modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(15, 23, 42, 0.5);
      z-index: 200;
      display: flex;
      align-items: flex-end;
      justify-content: center;
      animation: fadeIn .2s ease;
    }
    .modal {
      background: var(--card-bg);
      width: 100%;
      max-width: 480px;
      border-radius: 24px 24px 0 0;
      padding: 16px 20px 28px;
      box-shadow: var(--shadow-lg);
      animation: slideUp .25s ease;
      max-height: 90vh;
      overflow-y: auto;
    }
    .modal-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 0 12px;
    }
    .modal-title {
      font-size: 20px;
      font-weight: 700;
      color: var(--text-main);
    }
    .modal-close {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      border: none;
      background: transparent;
      cursor: pointer;
      color: var(--text-sub);
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .modal-close:hover { background: var(--bg); }
    .modal-sub {
      font-size: 13px;
      color: var(--text-sub);
      margin-bottom: 18px;
    }
    .modal-handle {
      width: 36px;
      height: 4px;
      background: #e2e6ec;
      border-radius: 2px;
      margin: 0 auto 12px;
    }
    .field-label {
      font-size: 13px;
      font-weight: 600;
      color: var(--text-main);
      margin-bottom: 8px;
    }
    .input-row {
      display: flex;
      gap: 8px;
      margin-bottom: 16px;
    }
    .input {
      flex: 1;
      height: 48px;
      border: 1px solid var(--border-strong);
      border-radius: 10px;
      padding: 0 14px;
      font-size: 14px;
      font-family: 'IBM Plex Mono', monospace;
      background: #fff;
      color: var(--text-main);
      outline: none;
      transition: border-color .15s;
    }
    .input:focus { border-color: var(--primary); }
    .input::placeholder { color: var(--text-muted); font-family: 'Inter', sans-serif; }
    .input-action {
      background: var(--primary-tint);
      color: var(--primary);
      border: none;
      border-radius: 10px;
      padding: 0 14px;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      font-family: inherit;
      transition: background-color .15s;
      white-space: nowrap;
    }
    .input-action:hover { background: var(--primary-soft); }
    .balance-row {
      display: flex;
      justify-content: flex-end;
      font-size: 12px;
      color: var(--text-sub);
      margin: -8px 0 16px;
    }
    .balance-row strong { color: var(--text-main); font-weight: 600; }
    .static-field {
      border: 1px solid var(--border-strong);
      border-radius: 10px;
      padding: 12px 14px;
      font-size: 14px;
      color: var(--text-main);
      display: flex;
      align-items: center;
      justify-content: space-between;
      background: #fff;
      margin-bottom: 16px;
    }
    .static-field-left {
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .token-icon {
      width: 22px;
      height: 22px;
      border-radius: 50%;
      background: linear-gradient(135deg, #26a17b, #50c89c);
      color: #fff;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 11px;
      font-weight: 700;
      font-family: 'Inter', sans-serif;
    }
    .token-icon.eth {
      background: linear-gradient(135deg, #627eea, #8aa2ff);
    }
    .preview-card {
      background: var(--bg);
      border-radius: 10px;
      padding: 14px 16px;
      margin: 8px 0 20px;
    }
    .preview-card .label {
      font-size: 12px;
      color: var(--text-sub);
      margin-bottom: 4px;
    }
    .preview-card .value {
      font-family: 'IBM Plex Mono', monospace;
      font-size: 18px;
      font-weight: 700;
      color: var(--text-main);
    }
    .preview-card .fee-note {
      font-size: 12px;
      color: var(--text-muted);
      margin-top: 4px;
      display: flex;
      justify-content: space-between;
    }
    .preview-card .fee-note .fee-val {
      font-family: 'IBM Plex Mono', monospace;
      color: var(--text-sub);
    }
    .submit-btn {
      width: 100%;
      height: 52px;
      background: var(--primary);
      color: #fff;
      border: none;
      border-radius: 999px;
      font-size: 16px;
      font-weight: 700;
      cursor: pointer;
      font-family: inherit;
      box-shadow: 0 1px 2px rgba(49, 130, 246, 0.12), 0 4px 12px rgba(49, 130, 246, 0.18);
      transition: background-color .15s;
    }
    .submit-btn:hover { background: var(--primary-hover); }
    .submit-btn:active { transform: translateY(0.5px); }
    .submit-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
    .toast {
      position: fixed;
      bottom: 32px;
      left: 50%;
      transform: translateX(-50%);
      background: rgba(17, 24, 28, 0.92);
      color: #fff;
      padding: 12px 20px;
      border-radius: 999px;
      font-size: 13px;
      z-index: 300;
      animation: fadeIn .2s ease;
    }

    /* ============ 桌面端宽度适配 ============
       默认 .rewards-app max-width: 480px 是为手机设计; 在电脑屏幕上(尤其板块被插到
       落地页 footer 上方时)需要放宽, 否则会是一条居中的窄手机条, 与桌面布局格格不入。
       分级放宽: 平板略宽, 电脑/嵌入主站吃满内容列宽度, 超宽屏再放宽一点。 */
    /* 注入根节点撑满主站内容列(与 footer 同级; footer 自身 max-width:1420px 居中) */
    #rewards-root { width: 100%; }

    @media (min-width: 640px) {
      .rewards-app {
        max-width: 720px;
        padding-left: 20px;
        padding-right: 20px;
      }
    }
    /* 平板/小桌面(常见电脑窗口 768-1023): 尽早放宽, 避免这个区间还是窄条 */
    @media (min-width: 768px) {
      .rewards-app {
        max-width: 880px;
        padding-left: 24px;
        padding-right: 24px;
      }
      .rewards-embedded .rewards-app {
        max-width: 960px;
      }
    }
    @media (min-width: 1024px) {
      /* 嵌入主站时真正贴合电脑屏幕宽度(对齐主站 1420px 内容列) */
      .rewards-embedded .rewards-app {
        max-width: 1200px;
      }
    }
    @media (min-width: 1440px) {
      .rewards-embedded .rewards-app {
        max-width: 1360px;
      }
    }
  