// Favorite + Me + Search overlay + action screens + collab screens
// + 首页快捷入口的 4 个子屏幕：今天喝啥 / 换换口味 / 少踩雷 / 搜同款

// ───── Shared: 子屏 chrome（返回 + 标题） ─────
function ActionChrome({ title, subtitle, onBack }) {
  return (
    <div style={{ padding: '52px 16px 14px', display: 'flex', alignItems: 'center', gap: 10 }}>
      <button onClick={onBack} style={{
        width: 36, height: 36, borderRadius: 999, background: 'var(--surface)',
        boxShadow: 'var(--sh-1)', display: 'flex', alignItems: 'center', justifyContent: 'center',
        transform: 'rotate(180deg)',
      }}>
        <IconArrowRight size={16} color="var(--ink-2)" />
      </button>
      <div style={{ flex: 1 }}>
        <div style={{ fontSize: 17, fontWeight: 700, color: 'var(--ink-1)', lineHeight: 1.2 }}>{title}</div>
        {subtitle && <div style={{ fontSize: 11, color: 'var(--ink-3)', marginTop: 2 }}>{subtitle}</div>}
      </div>
    </div>
  );
}

function ChipRow({ options, value, onChange, scroll }) {
  return (
    <div style={{
      display: 'flex', gap: 8, padding: '0 16px',
      overflowX: scroll ? 'auto' : 'visible', flexWrap: scroll ? 'nowrap' : 'wrap',
    }}>
      {options.map(opt => {
        const on = value === opt.key;
        return (
          <button key={opt.key} onClick={() => onChange(opt.key)} style={{
            flex: scroll ? '0 0 auto' : '0 1 auto',
            padding: '8px 14px', borderRadius: 999,
            background: on ? 'var(--ink-1)' : 'var(--surface)',
            color: on ? '#fff' : 'var(--ink-2)',
            fontSize: 12, fontWeight: on ? 600 : 500,
            border: on ? 'none' : '0.5px solid var(--ink-5)',
            display: 'inline-flex', alignItems: 'center', gap: 4,
            whiteSpace: 'nowrap',
            transition: 'all 180ms ease',
          }}>
            {opt.emoji && <span>{opt.emoji}</span>}
            {opt.label}
          </button>
        );
      })}
    </div>
  );
}

function ReasonCard({ drink, reason, healthHint, onOpen, onPick }) {
  return (
    <div style={{
      background: 'var(--surface)', borderRadius: 22, padding: 14,
      boxShadow: 'var(--sh-1)', display: 'flex', flexDirection: 'column', gap: 12,
    }}>
      <div style={{ display: 'flex', gap: 12 }}>
        <button onClick={() => onOpen(drink)} style={{
          background: `linear-gradient(155deg, ${drink.colorA}, ${drink.colorB}33)`,
          width: 84, height: 84, borderRadius: 18, flexShrink: 0,
          display: 'flex', alignItems: 'center', justifyContent: 'center',
        }}>
          <CupPlaceholder colorA={drink.colorA} colorB={drink.colorB} size={64} />
        </button>
        <div style={{ flex: 1, minWidth: 0 }}>
          <div style={{ fontSize: 10.5, color: 'var(--ink-3)' }}>{drink.brand} · {drink.size}</div>
          <div style={{ fontSize: 15, fontWeight: 700, color: 'var(--ink-1)', marginTop: 2 }}>{drink.name}</div>
          <div style={{ display: 'flex', gap: 10, marginTop: 6, alignItems: 'baseline' }}>
            <span style={{ fontSize: 11, color: 'var(--ink-3)' }}>
              <b style={{ fontFamily: 'var(--font-num)', color: 'var(--data-cal)', fontSize: 13 }}>{drink.cal}</b> kcal
            </span>
            <span style={{ fontSize: 11, color: 'var(--ink-3)' }}>
              糖 <b style={{ fontFamily: 'var(--font-num)', color: '#C78500' }}>{drink.sugar}</b>g
            </span>
            <span style={{ fontSize: 11, color: 'var(--ink-3)' }}>
              ¥<b style={{ fontFamily: 'var(--font-num)', color: 'var(--ink-1)' }}>{drink.price}</b>
            </span>
          </div>
        </div>
      </div>
      <div style={{
        background: 'var(--sunken)', borderRadius: 14, padding: '10px 12px',
        fontSize: 12, color: 'var(--ink-2)', lineHeight: 1.55,
      }}>
        <span style={{ color: 'var(--brand-purple)', fontWeight: 600 }}>小 Y 说 · </span>
        {reason}
        {healthHint && (
          <span style={{ display: 'block', marginTop: 4, fontSize: 11, color: 'var(--ink-3)' }}>
            💡 {healthHint}
          </span>
        )}
      </div>
      <div style={{ display: 'flex', gap: 8 }}>
        <button onClick={() => onOpen(drink)} style={{
          flex: 1, padding: '10px 14px', borderRadius: 999,
          background: 'var(--sunken)', fontSize: 13, fontWeight: 500, color: 'var(--ink-2)',
        }}>看详情</button>
        <button onClick={() => onPick && onPick(drink)} style={{
          flex: 1.3, padding: '10px 14px', borderRadius: 999,
          background: 'var(--brand-yellow)', fontSize: 13, fontWeight: 600, color: 'var(--ink-1)',
          boxShadow: 'var(--sh-1)',
        }}>就这杯了 →</button>
      </div>
    </div>
  );
}

// ───── 1. 今天喝啥 ─────
function PickForMeScreen({ onBack, onOpenDrink }) {
  const now = new Date();
  const autoTime = now.getHours() < 11 ? 'morning' : now.getHours() < 17 ? 'afternoon' : 'evening';

  const moods = [
    { key: 'light',  emoji: '🥗', label: '想轻负担' },
    { key: 'wakeup', emoji: '⚡️', label: '提神一下' },
    { key: 'reward', emoji: '🎀', label: '犒劳自己' },
    { key: 'fruity', emoji: '🍓', label: '清爽解腻' },
  ];
  const times = [
    { key: 'morning',   label: '上午' },
    { key: 'afternoon', label: '下午' },
    { key: 'evening',   label: '晚上' },
  ];

  const [mood, setMood] = React.useState('light');
  const [time, setTime] = React.useState(autoTime);
  const [roll, setRoll] = React.useState(0);

  // mood + time → 按 health/caffeine/cal 过滤 & 排序
  const selection = React.useMemo(() => {
    const pool = [...DRINKS];
    const score = (d) => {
      let s = 0;
      if (mood === 'light')  s += (100 - d.cal / 5) + d.health * 1.2;
      if (mood === 'wakeup') s += d.caffeine * 0.6 + d.health * 0.5;
      if (mood === 'reward') s += (d.cal / 10) + (50 - Math.abs(d.sugar - 28));
      if (mood === 'fruity') s += (d.tags.includes('鲜果') ? 50 : 0) + (100 - d.cal / 6);
      if (time === 'evening' && d.caffeine > 80) s -= 40; // 晚上降权高咖啡因
      if (time === 'morning' && d.caffeine > 60) s += 15;
      return s + (roll * 7 * (d.id.length % 3 - 1)); // roll 变化出顺序
    };
    return pool.sort((a, b) => score(b) - score(a)).slice(0, 3);
  }, [mood, time, roll]);

  const reasonFor = (d, idx) => {
    const moodLine = {
      light:  `热量只有 ${d.cal} kcal，喝完不太会背刺今天的早餐`,
      wakeup: d.caffeine > 0
        ? `咖啡因 ${d.caffeine}mg，${d.caffeine > 100 ? '够劲儿但不上头' : '刚好提神不炸裂'}`
        : `不含咖啡因，但香气够冲，靠风味唤醒`,
      reward: `口感扎实，${d.tags.join('+')} 的组合就是要这种满足感`,
      fruity: d.tags.includes('鲜果') ? `真鲜果底，不是浓缩粉` : `清爽茶底，不甜到齁`,
    }[mood];
    const rank = ['最懂你这会儿', '姐妹替补席', '冷门但稳'][idx];
    return `${rank}：${moodLine}`;
  };

  const healthFor = (d, idx) => {
    if (idx === 0 && d.sugar < 20) return `比上周你常喝的黑糖珍珠少 ${38 - d.sugar}g 糖`;
    if (idx === 0) return `想更轻？换「三分糖」大概能砍 ${Math.round(d.sugar * 0.35)}g`;
    return null;
  };

  return (
    <div style={{ paddingBottom: 100 }}>
      <ActionChrome title="今天给你挑三杯" subtitle="说说心情，我来搭配" onBack={onBack} />

      <div style={{ padding: '0 0 16px' }}>
        <div style={{ fontSize: 11, color: 'var(--ink-3)', padding: '0 16px 8px', fontWeight: 500 }}>
          现在是什么状态
        </div>
        <ChipRow options={moods} value={mood} onChange={(k) => { setMood(k); setRoll(0); }} scroll />
      </div>

      <div style={{ padding: '0 0 20px' }}>
        <div style={{ fontSize: 11, color: 'var(--ink-3)', padding: '0 16px 8px', fontWeight: 500 }}>
          大概什么时候喝
        </div>
        <ChipRow options={times} value={time} onChange={(k) => { setTime(k); setRoll(0); }} />
      </div>

      <div style={{ padding: '0 16px', display: 'flex', flexDirection: 'column', gap: 14 }}>
        {selection.map((d, i) => (
          <ReasonCard key={`${d.id}-${roll}`} drink={d}
            reason={reasonFor(d, i)}
            healthHint={healthFor(d, i)}
            onOpen={onOpenDrink}
            onPick={onOpenDrink} />
        ))}
      </div>

      <div style={{ padding: '18px 16px 0', textAlign: 'center' }}>
        <button onClick={() => setRoll((r) => r + 1)} style={{
          padding: '10px 22px', borderRadius: 999,
          background: 'var(--surface)', boxShadow: 'var(--sh-1)',
          fontSize: 12, color: 'var(--ink-2)', fontWeight: 500,
          display: 'inline-flex', alignItems: 'center', gap: 6,
        }}>
          <IconShuffle size={14} color="var(--ink-2)" />
          都不想喝？换一组
        </button>
      </div>
    </div>
  );
}

// ───── 2. 换换口味 ─────
function ShuffleItScreen({ onBack, onOpenDrink }) {
  // 假设用户最近常喝 "黑糖珍珠鲜奶"（喜茶）
  const anchor = DRINKS.find(d => d.id === 'brown-pearl');
  const lowerLoad = DRINKS.filter(d => d.cal < anchor.cal && d.tags.some(t => anchor.tags.includes(t))).slice(0, 2);
  const crossLane = DRINKS.filter(d => !d.tags.some(t => anchor.tags.includes(t))).slice(0, 3);

  const MiniCard = ({ d, tagline }) => (
    <button onClick={() => onOpenDrink(d)} style={{
      background: 'var(--surface)', borderRadius: 18, padding: 12,
      boxShadow: 'var(--sh-1)', display: 'flex', gap: 12, alignItems: 'center',
      textAlign: 'left', width: '100%',
    }}>
      <div style={{
        background: `linear-gradient(155deg, ${d.colorA}, ${d.colorB}33)`,
        width: 56, height: 56, borderRadius: 14, flexShrink: 0,
        display: 'flex', alignItems: 'center', justifyContent: 'center',
      }}>
        <CupPlaceholder colorA={d.colorA} colorB={d.colorB} size={42} />
      </div>
      <div style={{ flex: 1, minWidth: 0 }}>
        <div style={{ fontSize: 10, color: 'var(--ink-3)' }}>{d.brand}</div>
        <div style={{ fontSize: 13, fontWeight: 600, color: 'var(--ink-1)' }}>{d.name}</div>
        <div style={{ fontSize: 11, color: 'var(--brand-purple)', marginTop: 3, fontWeight: 500 }}>{tagline}</div>
      </div>
      <div style={{ textAlign: 'right' }}>
        <div style={{ fontSize: 13, fontWeight: 700, fontFamily: 'var(--font-num)', color: 'var(--data-cal)' }}>
          {d.cal}
        </div>
        <div style={{ fontSize: 9, color: 'var(--ink-4)' }}>kcal</div>
      </div>
    </button>
  );

  return (
    <div style={{ paddingBottom: 100 }}>
      <ActionChrome title="换换口味" subtitle="别让奶茶变成习惯性动作" onBack={onBack} />

      {/* anchor */}
      <div style={{ padding: '0 16px 20px' }}>
        <div style={{
          padding: 14, borderRadius: 18,
          background: `linear-gradient(135deg, ${anchor.colorA}55, ${anchor.colorA}22)`,
          display: 'flex', alignItems: 'center', gap: 12,
        }}>
          <CupPlaceholder colorA={anchor.colorA} colorB={anchor.colorB} size={48} />
          <div style={{ flex: 1 }}>
            <div style={{ fontSize: 10, color: 'var(--ink-3)' }}>你最近常喝</div>
            <div style={{ fontSize: 14, fontWeight: 700 }}>{anchor.brand} · {anchor.name}</div>
            <div style={{ fontSize: 11, color: 'var(--ink-3)', marginTop: 2 }}>近 30 天 4 次 · 平均 420 kcal</div>
          </div>
        </div>
      </div>

      <Section title="同类升级" subtitle="口味接近，负担更轻">
        <div style={{ padding: '0 16px', display: 'flex', flexDirection: 'column', gap: 10 }}>
          {lowerLoad.length > 0
            ? lowerLoad.map(d => (
              <MiniCard key={d.id} d={d} tagline={`少 ${anchor.cal - d.cal} kcal · ${d.health > anchor.health ? '更健康' : '风味相近'}`} />
            ))
            : <div style={{ fontSize: 12, color: 'var(--ink-3)' }}>这周暂无更轻的同类款，要不直接换赛道？</div>}
        </div>
      </Section>

      <Section title="换个赛道" subtitle="跳出奶茶舒适圈，试点新的">
        <div style={{ padding: '0 16px', display: 'flex', flexDirection: 'column', gap: 10 }}>
          {crossLane.map((d, i) => (
            <MiniCard key={d.id} d={d} tagline={
              i === 0 ? `${d.tags[0]}系·评价最稳` :
              i === 1 ? `姐妹最近回购最多` :
              `健康分 ${d.health} · 想喝得聪明就点这杯`
            } />
          ))}
        </div>
      </Section>
    </div>
  );
}

// ───── 3. 少踩雷 ─────
function AvoidMissesScreen({ onBack, onOpenDrink }) {
  const [tab, setTab] = React.useState('love');

  // mock：利用现有 DRINKS + 预设评论
  const loved = [
    { d: DRINKS.find(x => x.id === 'matcha-latte'),  heat: 128, quote: '生椰底真的顶，不齁不腻，抹茶粉感刚好', author: '小棉袄爱摸鱼' },
    { d: DRINKS.find(x => x.id === 'oolong'),        heat: 96,  quote: '柠檬是真柠檬，茶底清爽，回购第三杯', author: '不喝奶茶会死' },
    { d: DRINKS.find(x => x.id === 'strawberry'),    heat: 72,  quote: '奶盖咸甜平衡得不错，草莓没踩雷', author: '秋梨膏没糖' },
  ];
  const tossed = [
    { d: DRINKS.find(x => x.id === 'brown-pearl'),   heat: 88, quote: '齁得我直灌水，黑糖浆是主角不是点缀', author: '糖分警察' },
    { d: DRINKS.find(x => x.id === 'mango-pomelo'),  heat: 54, quote: '椰浆味盖过芒果，感觉喝了一杯防晒霜', author: '热带水果复仇者' },
    { d: DRINKS.find(x => x.id === 'oat-coffee'),    heat: 37, quote: '双份浓缩对心脏不友好，手抖了一下午', author: '咖啡因小公主' },
  ];
  const items = tab === 'love' ? loved : tossed;

  return (
    <div style={{ paddingBottom: 100 }}>
      <ActionChrome title="本周避雷榜" subtitle="姐妹们亲测 · 别再踩坑" onBack={onBack} />

      {/* tabs */}
      <div style={{ padding: '0 16px 18px', display: 'flex', gap: 8 }}>
        <button onClick={() => setTab('love')} style={{
          flex: 1, padding: '12px 14px', borderRadius: 16,
          background: tab === 'love' ? 'var(--brand-yellow)' : 'var(--surface)',
          boxShadow: tab === 'love' ? 'var(--sh-1)' : 'none',
          border: tab === 'love' ? 'none' : '0.5px solid var(--ink-5)',
          fontSize: 13, fontWeight: tab === 'love' ? 700 : 500,
          color: tab === 'love' ? 'var(--ink-1)' : 'var(--ink-3)',
          display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 6,
        }}>
          <span>🔥</span> 被夸爆了
        </button>
        <button onClick={() => setTab('toss')} style={{
          flex: 1, padding: '12px 14px', borderRadius: 16,
          background: tab === 'toss' ? 'var(--ink-1)' : 'var(--surface)',
          boxShadow: tab === 'toss' ? 'var(--sh-1)' : 'none',
          border: tab === 'toss' ? 'none' : '0.5px solid var(--ink-5)',
          fontSize: 13, fontWeight: tab === 'toss' ? 700 : 500,
          color: tab === 'toss' ? '#fff' : 'var(--ink-3)',
          display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 6,
        }}>
          <span>💩</span> 吐槽满天飞
        </button>
      </div>

      <div style={{ padding: '0 16px', display: 'flex', flexDirection: 'column', gap: 12 }}>
        {items.map((x, i) => x.d && (
          <button key={x.d.id} onClick={() => onOpenDrink(x.d)} style={{
            background: 'var(--surface)', borderRadius: 20, padding: 14,
            boxShadow: 'var(--sh-1)', textAlign: 'left', width: '100%',
            display: 'flex', flexDirection: 'column', gap: 10,
          }}>
            <div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
              <div style={{
                position: 'relative',
                background: `linear-gradient(155deg, ${x.d.colorA}, ${x.d.colorB}33)`,
                width: 54, height: 54, borderRadius: 14, flexShrink: 0,
                display: 'flex', alignItems: 'center', justifyContent: 'center',
              }}>
                <CupPlaceholder colorA={x.d.colorA} colorB={x.d.colorB} size={42} />
                <div style={{
                  position: 'absolute', top: -6, left: -6,
                  background: tab === 'love' ? '#FF6B4A' : '#6B6B6B',
                  color: '#fff', fontSize: 10, fontWeight: 700,
                  padding: '2px 7px', borderRadius: 999, fontFamily: 'var(--font-num)',
                }}>#{i + 1}</div>
              </div>
              <div style={{ flex: 1 }}>
                <div style={{ fontSize: 10.5, color: 'var(--ink-3)' }}>{x.d.brand}</div>
                <div style={{ fontSize: 14, fontWeight: 700 }}>{x.d.name}</div>
                <div style={{ fontSize: 10.5, color: 'var(--ink-4)', marginTop: 2 }}>
                  本周 {x.heat} 人{tab === 'love' ? '推荐' : '吐槽'}
                </div>
              </div>
            </div>
            <div style={{
              background: tab === 'love' ? 'var(--brand-yellow-soft)' : 'var(--sunken)',
              borderRadius: 12, padding: '8px 10px',
              fontSize: 11.5, color: 'var(--ink-2)', lineHeight: 1.5,
            }}>
              <span style={{ color: 'var(--brand-purple)', fontWeight: 600 }}>@{x.author}：</span>
              {x.quote}
            </div>
          </button>
        ))}
      </div>
    </div>
  );
}

// ───── 4. 搜同款 ─────
function SameCheckScreen({ onBack, onOpenDrink }) {
  const [q, setQ] = React.useState('');
  const matches = q ? DRINKS.filter(d =>
    d.name.includes(q) || d.brand.includes(q) || d.tags.some(t => t.includes(q))
  ) : [];

  const trending = [
    { d: DRINKS.find(x => x.id === 'matcha-latte'),  tag: '小红书爆款',   caption: '#生椰拿铁 · 近 7 天 2.3w 篇' },
    { d: DRINKS.find(x => x.id === 'strawberry'),    tag: '博主同款',     caption: '@奶茶鉴定师 推荐同款' },
    { d: DRINKS.find(x => x.id === 'oolong'),        tag: '反向种草',     caption: '#不甜不踩雷 标签爬榜' },
  ];

  return (
    <div style={{ paddingBottom: 100 }}>
      <ActionChrome title="这杯值不值？" subtitle="刷到心动的，先查一下" onBack={onBack} />

      {/* 搜索 / 粘贴链接 */}
      <div style={{ padding: '0 16px 16px' }}>
        <div style={{
          background: 'var(--surface)', borderRadius: 18, padding: '4px 4px 4px 16px',
          boxShadow: 'var(--sh-1)',
          display: 'flex', alignItems: 'center', gap: 10,
        }}>
          <IconSearch size={18} color="var(--ink-3)" />
          <input value={q} onChange={e => setQ(e.target.value)}
                 placeholder="输入饮品名 / 品牌 / 配料"
                 style={{
                   flex: 1, background: 'transparent', border: 'none', outline: 'none',
                   fontSize: 14, padding: '10px 0', minWidth: 0,
                 }} />
          <button style={{
            padding: '10px 14px', borderRadius: 14,
            background: 'var(--brand-purple)', color: '#fff',
            fontSize: 12, fontWeight: 600, display: 'flex', alignItems: 'center', gap: 4,
          }}>
            <IconSparkle size={12} color="#fff" fill="#fff" stroke={0} />
            贴链接
          </button>
        </div>
        <div style={{ fontSize: 10.5, color: 'var(--ink-4)', marginTop: 8, paddingLeft: 4 }}>
          支持粘贴小红书 / 微博 / 抖音链接，自动识别饮品
        </div>
      </div>

      {/* 命中结果 or 种草列表 */}
      {q ? (
        <div style={{ padding: '0 16px' }}>
          <div style={{ fontSize: 11, color: 'var(--ink-3)', marginBottom: 10 }}>
            {matches.length} 个匹配
          </div>
          {matches.length === 0 ? (
            <div style={{
              padding: '32px 16px', textAlign: 'center', borderRadius: 16,
              background: 'var(--sunken)', fontSize: 12, color: 'var(--ink-3)',
            }}>
              没找到这款 · 试试换个关键词，或者直接粘贴链接
            </div>
          ) : matches.map(d => (
            <button key={d.id} onClick={() => onOpenDrink(d)} style={{
              width: '100%', textAlign: 'left', display: 'flex', alignItems: 'center', gap: 12,
              padding: '12px 4px', borderBottom: '0.5px solid var(--ink-5)',
            }}>
              <CupPlaceholder colorA={d.colorA} colorB={d.colorB} size={44} />
              <div style={{ flex: 1, minWidth: 0 }}>
                <div style={{ fontSize: 13, fontWeight: 600 }}>{d.name}</div>
                <div style={{ fontSize: 10.5, color: 'var(--ink-3)', marginTop: 2 }}>
                  {d.brand} · {d.cal} kcal · 糖 {d.sugar}g · ¥{d.price}
                </div>
              </div>
              <IconChevron size={14} color="var(--ink-4)" />
            </button>
          ))}
        </div>
      ) : (
        <>
          <div style={{ fontSize: 12, fontWeight: 600, padding: '4px 16px 10px', color: 'var(--ink-2)' }}>
            最近刷到最多的 3 款
          </div>
          <div style={{ padding: '0 16px', display: 'flex', flexDirection: 'column', gap: 10 }}>
            {trending.map(t => t.d && (
              <button key={t.d.id} onClick={() => onOpenDrink(t.d)} style={{
                background: 'var(--surface)', borderRadius: 18, padding: 14,
                boxShadow: 'var(--sh-1)', width: '100%', textAlign: 'left',
                display: 'flex', gap: 12, alignItems: 'center',
              }}>
                <div style={{
                  background: `linear-gradient(155deg, ${t.d.colorA}, ${t.d.colorB}33)`,
                  width: 64, height: 64, borderRadius: 16, flexShrink: 0,
                  display: 'flex', alignItems: 'center', justifyContent: 'center',
                }}>
                  <CupPlaceholder colorA={t.d.colorA} colorB={t.d.colorB} size={48} />
                </div>
                <div style={{ flex: 1, minWidth: 0 }}>
                  <div style={{
                    display: 'inline-block',
                    fontSize: 9.5, padding: '2px 8px', borderRadius: 999,
                    background: 'var(--brand-purple-soft)', color: 'var(--brand-purple)',
                    fontWeight: 600, marginBottom: 4,
                  }}>{t.tag}</div>
                  <div style={{ fontSize: 13, fontWeight: 700 }}>{t.d.name}</div>
                  <div style={{ fontSize: 10.5, color: 'var(--ink-3)', marginTop: 2 }}>{t.caption}</div>
                </div>
                <IconChevron size={14} color="var(--ink-4)" />
              </button>
            ))}
          </div>
        </>
      )}
    </div>
  );
}

// ───── FAVORITE ─────
// 收藏 tab：把收藏的饮品按品牌分组展示，偏轻社交，去掉工具属性。
function FavoriteScreen({ onOpenDrink }) {
  // 原型里没有真实收藏状态，挑前 6 款模拟。
  const FAV_IDS = React.useMemo(() => DRINKS.slice(0, 6).map(d => d.id), []);
  const favs = DRINKS.filter(d => FAV_IDS.includes(d.id));
  const grouped = React.useMemo(() => {
    const map = new Map();
    for (const d of favs) {
      if (!map.has(d.brandId)) map.set(d.brandId, []);
      map.get(d.brandId).push(d);
    }
    return Array.from(map.entries()).map(([brandId, items]) => ({
      brand: BRANDS.find(b => b.id === brandId),
      items,
    }));
  }, [favs]);

  return (
    <div style={{ paddingBottom: 100 }}>
      <MpChrome title="收藏" />
      <div style={{ padding: '0 16px 12px' }}>
        <div style={{ fontSize: 12, color: 'var(--ink-3)' }}>
          已收藏 <b style={{ color: 'var(--ink-1)', fontFamily: 'var(--font-num)' }}>{favs.length}</b> 款
          · 来自 <b style={{ color: 'var(--ink-1)', fontFamily: 'var(--font-num)' }}>{grouped.length}</b> 个品牌
        </div>
      </div>

      {favs.length === 0 ? (
        <div style={{ margin: '40px 16px', padding: 32, borderRadius: 20,
                      background: 'var(--surface)', boxShadow: 'var(--sh-1)',
                      textAlign: 'center' }}>
          <div style={{ fontSize: 36, marginBottom: 8 }}>♡</div>
          <div style={{ fontSize: 13, color: 'var(--ink-2)', fontWeight: 600 }}>还没有收藏</div>
          <div style={{ fontSize: 11, color: 'var(--ink-3)', marginTop: 6 }}>
            喜欢的饮品点一下爱心，就出现在这里
          </div>
        </div>
      ) : (
        <div style={{ padding: '0 16px', display: 'flex', flexDirection: 'column', gap: 18 }}>
          {grouped.map(({ brand, items }) => (
            <div key={brand?.id || 'unknown'}>
              <div style={{ display: 'flex', alignItems: 'center', gap: 8, marginBottom: 10 }}>
                <span style={{ width: 4, height: 14, borderRadius: 2,
                               background: brand?.color || 'var(--ink-4)' }} />
                <span style={{ fontSize: 14, fontWeight: 700, color: 'var(--ink-1)' }}>
                  {brand?.name || '其他'}
                </span>
                <span style={{ fontSize: 11, color: 'var(--ink-3)' }}>· {items.length} 款</span>
              </div>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
                {items.map(d => (
                  <button key={d.id} onClick={() => onOpenDrink?.(d)} style={{
                    display: 'flex', alignItems: 'center', gap: 12,
                    background: 'var(--surface)', borderRadius: 18, padding: 12,
                    boxShadow: 'var(--sh-1)', textAlign: 'left', border: 0, cursor: 'pointer',
                  }}>
                    <div style={{
                      width: 60, height: 60, borderRadius: 14,
                      background: `linear-gradient(180deg, ${d.colorA}55, ${d.colorA}22)`,
                      display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0,
                    }}>
                      <CupPlaceholder colorA={d.colorA} colorB={d.colorB} size={42} />
                    </div>
                    <div style={{ flex: 1, minWidth: 0 }}>
                      <div style={{ fontSize: 11, color: 'var(--ink-3)', marginBottom: 4 }}>{d.brand}</div>
                      <div style={{ fontSize: 14, fontWeight: 600, color: 'var(--ink-1)' }}>{d.name}</div>
                      <div style={{ display: 'flex', gap: 8, marginTop: 6, alignItems: 'center' }}>
                        <span style={{ fontSize: 11, color: 'var(--data-cal)', fontWeight: 600,
                                       fontFamily: 'var(--font-num)' }}>
                          {d.cal}<span style={{ fontSize: 9, marginLeft: 1 }}>kcal</span>
                        </span>
                        <span style={{ width: 2, height: 2, borderRadius: 99, background: 'var(--ink-4)' }} />
                        <span style={{ fontSize: 11, color: 'var(--ink-2)', fontWeight: 500,
                                       fontFamily: 'var(--font-num)' }}>
                          ¥{d.price}
                        </span>
                      </div>
                    </div>
                    <IconHeart size={18} color="var(--data-match)"
                               fill="var(--data-match)" stroke={0} />
                  </button>
                ))}
              </div>
            </div>
          ))}
        </div>
      )}
    </div>
  );
}

// ───── ME ─────
function MeScreen({ logEntries }) {
  const todayCal = logEntries.reduce((s, e) => s + e.totalCal, 0);
  return (
    <div style={{ paddingBottom: 100 }}>
      <MpChrome title="我的" />
      <div style={{ padding: '0 16px' }}>
        {/* profile */}
        <div style={{ display: 'flex', alignItems: 'center', gap: 14, padding: '4px 0 20px' }}>
          <div style={{ width: 64, height: 64, borderRadius: 999,
                        background: 'var(--brand-purple)',
                        display: 'flex', alignItems: 'center', justifyContent: 'center',
                        fontSize: 28, color: '#fff', fontWeight: 700 }}>Y</div>
          <div style={{ flex: 1 }}>
            <div style={{ fontSize: 18, fontWeight: 700 }}>喝啥_007</div>
            <div style={{ fontSize: 11, color: 'var(--ink-3)', marginTop: 2 }}>
              已打卡 <b style={{ color: 'var(--ink-1)', fontFamily: 'var(--font-num)' }}>34</b> 天 ·
              目标 <b style={{ color: 'var(--ink-1)', fontFamily: 'var(--font-num)' }}>少糖派</b>
            </div>
          </div>
          <button style={{ width: 32, height: 32, borderRadius: 999,
                           background: 'var(--surface)', boxShadow: 'var(--sh-1)',
                           display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
            <IconChevron size={14} color="var(--ink-3)" />
          </button>
        </div>

        {/* today log */}
        <div style={{ background: 'var(--surface)', borderRadius: 20, padding: 18,
                      marginBottom: 14, boxShadow: 'var(--sh-1)' }}>
          <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 12 }}>
            <div style={{ fontSize: 13, fontWeight: 600 }}>今日打卡</div>
            <div style={{ fontSize: 10, color: 'var(--ink-3)' }}>目标 1800 kcal</div>
          </div>
          <div style={{ fontSize: 30, fontWeight: 700, fontFamily: 'var(--font-num)', color: 'var(--data-cal)' }}>
            {todayCal} <span style={{ fontSize: 12, color: 'var(--ink-3)', fontWeight: 400 }}>kcal</span>
          </div>
          <div style={{ height: 6, background: 'var(--sunken)', borderRadius: 99, marginTop: 10, overflow: 'hidden' }}>
            <div style={{ width: `${Math.min(100, (todayCal / 1800) * 100)}%`, height: '100%',
                          background: 'var(--data-cal)', borderRadius: 99 }} />
          </div>
          {logEntries.length === 0 ? (
            <div style={{ marginTop: 14, padding: 16, background: 'var(--sunken)',
                          borderRadius: 12, fontSize: 11, color: 'var(--ink-3)', textAlign: 'center' }}>
              还没有打卡 · 去首页选一杯饮品试试
            </div>
          ) : (
            <div style={{ marginTop: 14, display: 'flex', flexDirection: 'column', gap: 8 }}>
              {logEntries.map((e, i) => (
                <div key={i} style={{ display: 'flex', alignItems: 'center', gap: 10,
                                      padding: '8px 10px', background: 'var(--sunken)', borderRadius: 12 }}>
                  <CupPlaceholder colorA={e.drink.colorA} colorB={e.drink.colorB} size={28} />
                  <div style={{ flex: 1 }}>
                    <div style={{ fontSize: 12, fontWeight: 600 }}>{e.drink.name}</div>
                    <div style={{ fontSize: 10, color: 'var(--ink-3)' }}>{e.drink.brand}</div>
                  </div>
                  <div style={{ fontSize: 13, fontWeight: 700, fontFamily: 'var(--font-num)',
                                color: 'var(--data-cal)' }}>{e.totalCal}</div>
                </div>
              ))}
            </div>
          )}
        </div>

        {/* menu grid */}
        <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 10 }}>
          {[
            { icon: IconHeart, label: '我的收藏', n: 12, color: 'var(--data-match)' },
            { icon: IconBookmark, label: '想喝清单', n: 4, color: 'var(--brand-purple)' },
            { icon: IconSparkle, label: '口味档案', n: null, color: 'var(--brand-yellow)' },
          ].map(({ icon: Ic, label, n, color }) => (
            <div key={label} style={{ background: 'var(--surface)', borderRadius: 16,
                                       padding: 14, boxShadow: 'var(--sh-1)',
                                       display: 'flex', alignItems: 'center', gap: 10 }}>
              <div style={{ width: 34, height: 34, borderRadius: 12, background: `${color}33`,
                            display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
                <Ic size={16} color={color} fill={color} stroke={0} />
              </div>
              <div style={{ flex: 1 }}>
                <div style={{ fontSize: 12, fontWeight: 600 }}>{label}</div>
                {n !== null && (
                  <div style={{ fontSize: 10, color: 'var(--ink-3)', fontFamily: 'var(--font-num)' }}>
                    {n} 项
                  </div>
                )}
              </div>
            </div>
          ))}
        </div>
      </div>
    </div>
  );
}

// ───── SEARCH OVERLAY ─────
function SearchOverlay({ onClose, onOpenDrink }) {
  const [q, setQ] = React.useState('');
  const results = q ? DRINKS.filter(d =>
    d.name.includes(q) || d.brand.includes(q) || d.tags.some(t => t.includes(q))
  ) : [];
  const hot = ['抹茶拿铁', '无糖', '0 卡', '生椰', '芋圆', '杨枝甘露'];
  return (
    <div style={{ position: 'absolute', inset: 0, background: 'var(--paper)', zIndex: 100,
                  display: 'flex', flexDirection: 'column' }}>
      {/* custom top bar */}
      <div style={{ paddingTop: 52, padding: '52px 16px 12px',
                    display: 'flex', alignItems: 'center', gap: 10 }}>
        <div style={{ flex: 1, height: 40, borderRadius: 999, background: 'var(--sunken)',
                      display: 'flex', alignItems: 'center', padding: '0 14px', gap: 8 }}>
          <IconSearch size={16} color="var(--ink-3)" />
          <input autoFocus value={q} onChange={e => setQ(e.target.value)}
                 placeholder="饮品、品牌或配料"
                 style={{ flex: 1, background: 'transparent', border: 'none', outline: 'none',
                          fontSize: 14 }} />
          {q && (
            <button onClick={() => setQ('')}>
              <IconX size={14} color="var(--ink-3)" />
            </button>
          )}
        </div>
        <button onClick={onClose} style={{ fontSize: 14, color: 'var(--ink-2)' }}>取消</button>
      </div>

      <div style={{ flex: 1, overflow: 'auto', padding: '0 16px' }}>
        {q === '' ? (
          <>
            <div style={{ fontSize: 12, color: 'var(--ink-3)', marginBottom: 8 }}>热门搜索</div>
            <div style={{ display: 'flex', flexWrap: 'wrap', gap: 8 }}>
              {hot.map(h => (
                <button key={h} onClick={() => setQ(h)} style={{
                  padding: '6px 12px', borderRadius: 999,
                  background: 'var(--sunken)', fontSize: 12, color: 'var(--ink-2)',
                }}>{h}</button>
              ))}
            </div>
          </>
        ) : (
          <div>
            <div style={{ fontSize: 11, color: 'var(--ink-3)', marginBottom: 10 }}>
              {results.length} 个结果
            </div>
            {results.map(d => (
              <button key={d.id} onClick={() => { onOpenDrink(d); onClose(); }} style={{
                width: '100%', display: 'flex', alignItems: 'center', gap: 12,
                padding: '10px 4px', borderBottom: '0.5px solid var(--ink-5)',
                textAlign: 'left',
              }}>
                <CupPlaceholder colorA={d.colorA} colorB={d.colorB} size={40} />
                <div style={{ flex: 1 }}>
                  <div style={{ fontSize: 13, fontWeight: 600 }}>{d.name}</div>
                  <div style={{ fontSize: 10, color: 'var(--ink-3)' }}>
                    {d.brand} · {d.cal} kcal · ¥{d.price}
                  </div>
                </div>
                <IconChevron size={14} color="var(--ink-4)" />
              </button>
            ))}
          </div>
        )}
      </div>
    </div>
  );
}

// ───── 全部周边（首页 → 周边 → 查看全部 入口） ─────
// 不挂在 Brand tab 里，独立页面。左侧品牌锚点，右侧滚动到对应品牌区。
function CollabAllScreen({ onBack, onOpenCollab }) {
  // 只显示有周边的品牌；保持 BRANDS 中的顺序
  const brandsWithCollabs = React.useMemo(() => {
    const ids = new Set(COLLAB_ITEMS.map(c => c.brandId));
    return BRANDS.filter(b => ids.has(b.id));
  }, []);

  const [activeBrandId, setActiveBrandId] = React.useState(brandsWithCollabs[0]?.id);
  const rightRef = React.useRef(null);
  const sectionRefs = React.useRef({});
  const isProgrammaticScroll = React.useRef(false);

  const itemsByBrand = React.useMemo(() => {
    const map = new Map();
    for (const c of COLLAB_ITEMS) {
      if (!map.has(c.brandId)) map.set(c.brandId, []);
      map.get(c.brandId).push(c);
    }
    return map;
  }, []);

  const onSelectBrand = (brandId) => {
    setActiveBrandId(brandId);
    const target = sectionRefs.current[brandId];
    const container = rightRef.current;
    if (!target || !container) return;
    isProgrammaticScroll.current = true;
    const top = target.offsetTop - 8;
    container.scrollTo({ top, behavior: 'smooth' });
    setTimeout(() => { isProgrammaticScroll.current = false; }, 500);
  };

  // 右侧滚动时同步左侧高亮
  const onRightScroll = () => {
    if (isProgrammaticScroll.current) return;
    const container = rightRef.current;
    if (!container) return;
    const threshold = container.scrollTop + 24;
    let current = brandsWithCollabs[0]?.id;
    for (const b of brandsWithCollabs) {
      const el = sectionRefs.current[b.id];
      if (el && el.offsetTop <= threshold) current = b.id;
    }
    if (current && current !== activeBrandId) setActiveBrandId(current);
  };

  return (
    <div style={{ display: 'flex', flexDirection: 'column', height: '100%', background: 'var(--paper)' }}>
      <ActionChrome title="全部周边" subtitle={`${COLLAB_ITEMS.length} 件 · ${brandsWithCollabs.length} 个品牌`} onBack={onBack} />

      <div style={{ flex: 1, display: 'flex', minHeight: 0 }}>
        {/* 左侧：品牌锚点 */}
        <div className="scroll" style={{
          width: 84, flexShrink: 0,
          background: 'var(--sunken)',
          overflowY: 'auto',
          paddingTop: 4, paddingBottom: 24,
        }}>
          {brandsWithCollabs.map(b => {
            const isActive = b.id === activeBrandId;
            return (
              <button key={b.id} onClick={() => onSelectBrand(b.id)} style={{
                position: 'relative', width: '100%',
                display: 'flex', flexDirection: 'column',
                alignItems: 'center', gap: 6,
                padding: '12px 4px',
                background: isActive ? 'var(--paper)' : 'transparent',
                border: 0, cursor: 'pointer',
              }}>
                {isActive && (
                  <span style={{
                    position: 'absolute', left: 0, top: 12, bottom: 12, width: 3,
                    background: 'var(--brand-purple)', borderRadius: '0 3px 3px 0',
                  }} />
                )}
                <div style={{
                  width: 40, height: 40, borderRadius: '50%',
                  background: b.color, color: '#fff',
                  display: 'flex', alignItems: 'center', justifyContent: 'center',
                  fontSize: 16, fontWeight: 700,
                  opacity: isActive ? 1 : 0.85,
                  boxShadow: isActive ? 'var(--sh-1)' : 'none',
                }}>
                  {b.glyph}
                </div>
                <span style={{
                  fontSize: 11,
                  color: isActive ? 'var(--ink-1)' : 'var(--ink-3)',
                  fontWeight: isActive ? 600 : 500,
                }}>{b.name}</span>
              </button>
            );
          })}
        </div>

        {/* 右侧：分组列表 */}
        <div ref={rightRef} className="scroll"
             onScroll={onRightScroll}
             style={{ flex: 1, overflowY: 'auto', padding: '8px 14px 32px' }}>
          {brandsWithCollabs.map(b => {
            const items = itemsByBrand.get(b.id) ?? [];
            return (
              <div key={b.id}
                   ref={(el) => { sectionRefs.current[b.id] = el; }}
                   style={{ paddingTop: 12, marginBottom: 8 }}>
                <div style={{
                  display: 'flex', alignItems: 'center', gap: 8,
                  padding: '0 2px 10px',
                }}>
                  <span style={{
                    width: 4, height: 14, borderRadius: 2,
                    background: b.color,
                  }} />
                  <span style={{ fontSize: 14, fontWeight: 700, color: 'var(--ink-1)' }}>
                    {b.name}
                  </span>
                  <span style={{ fontSize: 11, color: 'var(--ink-3)' }}>· {items.length} 件</span>
                </div>
                <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
                  {items.map(c => (
                    <button key={c.id} onClick={() => onOpenCollab?.(c)} style={{
                      display: 'flex', alignItems: 'stretch', gap: 12,
                      background: 'var(--surface)', borderRadius: 16, padding: 10,
                      boxShadow: 'var(--sh-1)', textAlign: 'left',
                      border: 0, cursor: 'pointer',
                    }}>
                      <div style={{
                        position: 'relative', flexShrink: 0,
                        width: 84, height: 84, borderRadius: 12, overflow: 'hidden',
                        background: `linear-gradient(150deg, ${c.colorA}, ${c.colorA}aa)`,
                        display: 'flex', alignItems: 'center', justifyContent: 'center',
                      }}>
                        <div className="placeholder" style={{
                          width: 64, height: 64, borderRadius: 10,
                          background: `repeating-linear-gradient(45deg, ${c.colorB}40 0 6px, ${c.colorB}20 6px 12px)`,
                          color: c.colorB, fontSize: 8, padding: 4,
                          display: 'flex', alignItems: 'center', justifyContent: 'center', textAlign: 'center',
                        }}>
                          [INSERT MERCH IMAGE]
                        </div>
                        <span style={{
                          position: 'absolute', top: 4, left: 4,
                          padding: '2px 6px', borderRadius: 999,
                          background: '#fff', color: c.colorB,
                          fontSize: 9, fontWeight: 600,
                        }}>{c.badge}</span>
                      </div>
                      <div style={{ flex: 1, minWidth: 0, display: 'flex', flexDirection: 'column', justifyContent: 'space-between' }}>
                        <div>
                          <div style={{
                            fontSize: 13, fontWeight: 600, color: 'var(--ink-1)', lineHeight: 1.3,
                            display: '-webkit-box', WebkitLineClamp: 1, WebkitBoxOrient: 'vertical',
                            overflow: 'hidden',
                          }}>
                            {c.name}
                          </div>
                          <div style={{
                            fontSize: 11, color: 'var(--ink-3)', lineHeight: 1.5, marginTop: 4,
                            display: '-webkit-box', WebkitLineClamp: 2, WebkitBoxOrient: 'vertical',
                            overflow: 'hidden',
                          }}>
                            {c.description}
                          </div>
                        </div>
                        <div style={{ marginTop: 8, fontSize: 10, color: 'var(--ink-3)' }}>
                          关联 {(c.drinkIds ?? []).length} 款饮品
                        </div>
                      </div>
                    </button>
                  ))}
                </div>
              </div>
            );
          })}
        </div>
      </div>
    </div>
  );
}

// ───── 周边详情 ─────
function CollabDetailScreen({ collab, onBack, onOpenDrink }) {
  const linkedDrinks = (collab.drinkIds ?? [])
    .map(id => DRINKS.find(d => d.id === id))
    .filter(Boolean);

  return (
    <div style={{ paddingBottom: 32 }}>
      <ActionChrome title="周边详情" subtitle={collab.brandName} onBack={onBack} />

      {/* hero — image placeholder + badge, mirrors CMS image_url slot */}
      <div style={{ padding: '0 16px 18px' }}>
        <div style={{
          position: 'relative', borderRadius: 24, overflow: 'hidden',
          background: `linear-gradient(150deg, ${collab.colorA}, ${collab.colorA}aa)`,
          height: 240, display: 'flex', alignItems: 'center', justifyContent: 'center',
          boxShadow: 'var(--sh-2)',
        }}>
          <div className="placeholder" style={{
            width: 180, height: 180, borderRadius: 24,
            background: `repeating-linear-gradient(45deg, ${collab.colorB}40 0 8px, ${collab.colorB}20 8px 16px)`,
            color: collab.colorB, fontSize: 11, padding: 8,
            display: 'flex', alignItems: 'center', justifyContent: 'center', textAlign: 'center',
          }}>
            [INSERT MERCH IMAGE]
          </div>
          <span style={{
            position: 'absolute', top: 14, left: 14,
            padding: '5px 12px', borderRadius: 999,
            background: '#fff', color: collab.colorB,
            fontSize: 12, fontWeight: 600,
            boxShadow: 'var(--sh-1)',
          }}>{collab.badge}</span>
        </div>
      </div>

      {/* title + brand */}
      <div style={{ padding: '0 16px 18px' }}>
        <div style={{ fontSize: 12, color: 'var(--ink-3)', marginBottom: 6 }}>
          {collab.brandName}
        </div>
        <div style={{ fontSize: 22, fontWeight: 700, color: 'var(--ink-1)', lineHeight: 1.3 }}>
          {collab.name}
        </div>
      </div>

      {/* description */}
      <div style={{ padding: '0 16px 24px' }}>
        <div style={{
          background: 'var(--surface)', borderRadius: 18, padding: '14px 16px',
          boxShadow: 'var(--sh-1)',
        }}>
          <div style={{ fontSize: 13, color: 'var(--ink-2)', lineHeight: 1.7, whiteSpace: 'pre-wrap' }}>
            {collab.description}
          </div>
        </div>
      </div>

      {/* linked drinks */}
      {linkedDrinks.length > 0 && (
        <div style={{ marginBottom: 24 }}>
          <div style={{ padding: '0 16px', marginBottom: 12 }}>
            <div style={{ fontSize: 17, fontWeight: 700, color: 'var(--ink-1)' }}>关联饮品</div>
            <div style={{ fontSize: 11, color: 'var(--ink-3)', marginTop: 2 }}>
              共 {linkedDrinks.length} 款
            </div>
          </div>
          <div style={{ display: 'flex', flexDirection: 'column', gap: 10, padding: '0 16px' }}>
            {linkedDrinks.map(d => (
              <button key={d.id} onClick={() => onOpenDrink?.(d)} style={{
                display: 'flex', alignItems: 'center', gap: 12,
                background: 'var(--surface)', borderRadius: 18, padding: 12,
                boxShadow: 'var(--sh-1)', textAlign: 'left', border: 0, cursor: 'pointer',
              }}>
                <div style={{
                  width: 64, height: 64, borderRadius: 14,
                  background: `linear-gradient(180deg, ${d.colorA}55, ${d.colorA}22)`,
                  display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0,
                }}>
                  <CupPlaceholder colorA={d.colorA} colorB={d.colorB} size={44} />
                </div>
                <div style={{ flex: 1, minWidth: 0 }}>
                  <div style={{ fontSize: 11, color: 'var(--ink-3)', marginBottom: 4 }}>{d.brand}</div>
                  <div style={{ fontSize: 14, fontWeight: 600, color: 'var(--ink-1)' }}>{d.name}</div>
                  <div style={{ display: 'flex', gap: 8, marginTop: 6, alignItems: 'center' }}>
                    <span style={{ fontSize: 11, color: 'var(--data-cal)', fontWeight: 600,
                                   fontFamily: 'var(--font-num)' }}>
                      {d.cal}<span style={{ fontSize: 9, marginLeft: 1 }}>kcal</span>
                    </span>
                    <span style={{ width: 2, height: 2, borderRadius: 99, background: 'var(--ink-4)' }} />
                    <span style={{ fontSize: 11, color: 'var(--ink-2)', fontWeight: 500,
                                   fontFamily: 'var(--font-num)' }}>
                      ¥{d.price}
                    </span>
                  </div>
                </div>
                <IconChevron size={14} color="var(--ink-4)" />
              </button>
            ))}
          </div>
        </div>
      )}
    </div>
  );
}

Object.assign(window, {
  LibraryScreen, FavoriteScreen, MeScreen, SearchOverlay,
  PickForMeScreen, ShuffleItScreen, AvoidMissesScreen, SameCheckScreen,
  CollabAllScreen, CollabDetailScreen,
});
