// fc-future.jsx · FUTURE STATE · SANDBOX
// Mapped-but-unbuilt concepts, parked here so they read as roadmap, not shipping
// build. Same shared kit + Balanced theme as the live screens. Screens:
//   · Tapered plan shape  (moved out of the Refine-Plan flow, see fc-onboarding)
//   · Learn · Library      (videos + articles)
//   · Fuel                 (nutrition / calorie guidance)
//   · Devices & Sync       (smart scales, wearables, Apple Health)
//   · Coach                (AI chat assistant)
//   · Find your fight      (pick a competition → rules prefilled)

const { Phone, StatusBar, HomeIndicator, LargeTitle, CompactNav, NavAction, GearButton,
        TabBar, SectionHeader, Card, Stat, GroupedList, Row, Toggle, TextButton, FC } = window;

// Diagonal-striped media placeholder with a mono caption + optional play glyph.
function MediaSlot({ h = 168, label = 'VIDEO', play = false, tone = 'paper' }) {
  const dark = tone === 'ink';
  const stripe = dark ? 'rgba(255,255,255,0.07)' : 'rgba(21,20,15,0.05)';
  const ink = dark ? 'rgba(255,255,255,0.6)' : 'var(--ink-3)';
  return (
    <div style={{ height: h, position: 'relative', background: dark ? 'var(--ink)' : 'var(--paper-2)',
      backgroundImage: `repeating-linear-gradient(45deg, ${stripe} 0, ${stripe} 1px, transparent 1px, transparent 9px)`,
      display: 'flex', alignItems: 'center', justifyContent: 'center', overflow: 'hidden' }}>
      {play && (
        <span style={{ width: 54, height: 54, borderRadius: '50%', background: dark ? 'var(--paper)' : 'var(--ink)', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
          <svg width="18" height="20" viewBox="0 0 18 20" fill="none"><path d="M2 2 L16 10 L2 18 Z" fill={dark ? 'var(--ink)' : 'var(--paper)'} /></svg>
        </span>
      )}
      <span style={{ position: 'absolute', left: 12, bottom: 10, fontFamily: 'var(--mono)', fontSize: 9.5, letterSpacing: '0.16em', color: ink, fontWeight: 600 }}>{label}</span>
    </div>
  );
}

// ══ TAPERED PLAN ══════════════════════════════════════════════════════════════
// Lives in fc-onboarding as OnbPlanOptions; the sandbox just renders it so the
// tapered/linear choice reads as a later add, not part of today's refine flow.
function FutTaperedPlan() { return window.OnbPlanOptions ? <window.OnbPlanOptions /> : null; }

// ══ LEARN · LIBRARY ═══════════════════════════════════════════════════════════
function FutLearnLibrary() {
  const watch = [
    ['Water loading, step by step', '8 MIN'],
    ['Reading the trend, not the scale', '5 MIN'],
    ['Rehydration that actually works', '6 MIN'],
  ];
  const read = [
    ['Why 1% a week is the ceiling', 'The science', '4 min'],
    ['Cutting around your cycle', 'For women', '6 min'],
    ['Fight-week checklist', 'Tactics', '3 min'],
  ];
  return (
    <Phone styleKey="balanced" label="Learn · Library">
      <StatusBar />
      <LargeTitle eyebrow="Learn" title="Library" trailing={<GearButton />} />
      <div style={{ flex: 1, padding: '2px 20px 28px', display: 'flex', flexDirection: 'column', gap: 24 }}>
        <div style={{ background: 'var(--paper)', borderRadius: 'var(--radius)', boxShadow: 'var(--card-shadow)', border: 'var(--card-border)', overflow: 'hidden' }}>
          <MediaSlot h={176} label="FEATURED · PRODUCT VIDEO" play tone="ink" />
          <div style={{ padding: '15px 17px' }}>
            <div style={{ fontFamily: 'var(--display)', fontSize: 10, letterSpacing: '0.14em', textTransform: 'uppercase', color: 'var(--accent)', fontWeight: 700 }}>Watch · 8 min</div>
            <div style={{ fontFamily: 'var(--sans)', fontSize: 18, fontWeight: 600, color: 'var(--ink)', marginTop: 6, textWrap: 'balance' }}>Make weight without wrecking the week before.</div>
          </div>
        </div>
        <div>
          <SectionHeader trailing={<TextButton>All videos</TextButton>}>Watch</SectionHeader>
          <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
            {watch.map((v, i) => (
              <div key={i} style={{ display: 'flex', alignItems: 'center', gap: 13, background: 'var(--paper)', borderRadius: 'var(--radius)', boxShadow: 'var(--card-shadow)', border: 'var(--card-border)', padding: 10 }}>
                <div style={{ width: 92, flexShrink: 0, borderRadius: 8, overflow: 'hidden' }}><MediaSlot h={58} label="" play /></div>
                <div style={{ flex: 1 }}>
                  <div style={{ fontFamily: 'var(--sans)', fontSize: 15, fontWeight: 600, color: 'var(--ink)', lineHeight: 1.3 }}>{v[0]}</div>
                  <div style={{ fontFamily: 'var(--mono)', fontSize: 10.5, letterSpacing: '0.08em', color: 'var(--ink-3)', fontWeight: 600, marginTop: 4 }}>{v[1]}</div>
                </div>
              </div>
            ))}
          </div>
        </div>
        <div>
          <SectionHeader>Read</SectionHeader>
          <GroupedList>
            {read.map((a, i) => (
              <Row key={i} last={i === read.length - 1} label={a[0]}
                control={<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
                  <span style={{ fontFamily: 'var(--mono)', fontSize: 10.5, letterSpacing: '0.06em', color: 'var(--ink-3)', fontWeight: 600 }}>{a[2]}</span>
                  <svg width="7" height="12" viewBox="0 0 7 12" fill="none"><path d="M1 1 L6 6 L1 11" stroke="var(--rule-2)" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/></svg>
                </div>} />
            ))}
          </GroupedList>
        </div>
      </div>
      <TabBar active="more" /><HomeIndicator />
    </Phone>
  );
}

// ══ FUEL · NUTRITION ══════════════════════════════════════════════════════════
function FutNutrition() {
  const macros = [['Protein', '185', 'g'], ['Carbs', '210', 'g'], ['Fat', '60', 'g']];
  const meals = [['Breakfast', 'Eggs, oats, berries', '480'], ['Lunch', 'Chicken, rice, greens', '620'],
    ['Snack', 'Greek yoghurt, fruit', '240'], ['Dinner', 'White fish, potato, veg', '560']];
  return (
    <Phone styleKey="balanced" label="Fuel · Nutrition">
      <StatusBar />
      <LargeTitle eyebrow="Cut phase · moderate deficit" title="Fuel" trailing={<GearButton />} eyebrowColor="var(--accent)" />
      <div style={{ flex: 1, padding: '2px 20px 28px', display: 'flex', flexDirection: 'column', gap: 22 }}>
        <Card pad={22}>
          <div style={{ display: 'flex', alignItems: 'baseline', justifyContent: 'space-between' }}>
            <span style={{ fontFamily: 'var(--display)', fontSize: 11, letterSpacing: '0.16em', textTransform: 'uppercase', color: 'var(--ink-3)', fontWeight: 600 }}>Today's target</span>
            <span style={{ fontFamily: 'var(--mono)', fontSize: 11, letterSpacing: '0.08em', color: 'var(--ink-3)', fontWeight: 600 }}>1,900 / 2,150 kcal</span>
          </div>
          <div style={{ display: 'flex', alignItems: 'flex-end', gap: 10, marginTop: 8 }}>
            <span style={{ fontFamily: 'var(--num)', fontWeight: 300, fontSize: 72, lineHeight: 0.85, letterSpacing: '-0.03em', color: 'var(--ink)' }}>2,150</span>
            <span style={{ fontFamily: 'var(--mono)', fontSize: 12, letterSpacing: '0.14em', color: 'var(--ink-3)', fontWeight: 600, paddingBottom: 8 }}>KCAL</span>
          </div>
          <div style={{ display: 'flex', marginTop: 20, paddingTop: 18, borderTop: '1px solid var(--rule)' }}>
            {macros.map((m, i) => <Stat key={m[0]} label={m[0]} value={m[1]} unit={m[2]} i={i} />)}
          </div>
        </Card>
        <div>
          <SectionHeader trailing={<TextButton>Swap</TextButton>}>Today's plan</SectionHeader>
          <GroupedList>
            {meals.map((m, i) => (
              <Row key={m[0]} last={i === meals.length - 1} label={m[0]} note={m[1]}
                control={<span style={{ fontFamily: 'var(--mono)', fontSize: 13, color: 'var(--ink-2)', fontWeight: 600 }}>{m[2]} kcal</span>} chevron={false} />
            ))}
          </GroupedList>
        </div>
        <div style={{ background: 'var(--accent-soft)', borderRadius: 'var(--radius)', padding: '16px 18px' }}>
          <div style={{ fontFamily: 'var(--sans)', fontSize: 13.5, lineHeight: 1.5, color: 'var(--ink)', textWrap: 'pretty' }}>Calories and macros track your cut phase and training load. They tighten in fight week and rebuild after weigh-in.</div>
        </div>
      </div>
      <TabBar active="more" /><HomeIndicator />
    </Phone>
  );
}

// ══ DEVICES & SYNC ════════════════════════════════════════════════════════════
function FutDevices() {
  const DeviceRow = ({ name, sub, status, on, last }) => (
    <Row label={name} note={sub} last={last} chevron={status !== 'toggle'}
      value={status === 'connected' ? 'Connected' : undefined}
      valueColor="var(--t-green)"
      control={status === 'toggle' ? <Toggle on={on} /> : status === 'add' ? <span style={{ fontFamily: 'var(--sans)', fontSize: 14.5, color: 'var(--accent)', fontWeight: 600 }}>Connect</span> : undefined} />
  );
  return (
    <Phone styleKey="balanced" label="Devices & Sync">
      <StatusBar />
      <CompactNav title="Devices & sync" trailing={<span style={{ width: 40 }} />} />
      <div style={{ flex: 1, padding: '6px 20px 28px', display: 'flex', flexDirection: 'column', gap: 22 }}>
        <div style={{ background: 'var(--ink)', color: 'var(--paper)', borderRadius: 'var(--radius)', padding: '22px 20px' }}>
          <div style={{ fontFamily: 'var(--sans)', fontSize: 19, fontWeight: 600, lineHeight: 1.3, textWrap: 'balance' }}>Step on the scale. The weigh-in logs itself.</div>
          <div style={{ fontFamily: 'var(--sans)', fontSize: 13.5, lineHeight: 1.55, color: 'rgba(246,244,239,0.82)', marginTop: 8, textWrap: 'pretty' }}>Connect a smart scale and your morning number lands in the trend automatically, no typing, no missed days.</div>
        </div>
        <div>
          <SectionHeader>Scales</SectionHeader>
          <GroupedList>
            <DeviceRow name="Smart scale" sub="Auto-logs your fasted morning weigh-in" status="connected" />
            <DeviceRow name="Body-composition scale" sub="Adds body-fat & hydration readings" status="add" last />
          </GroupedList>
        </div>
        <div>
          <SectionHeader>Health & wearables</SectionHeader>
          <GroupedList>
            <DeviceRow name="Apple Health" sub="Sync weight, workouts & sleep" status="toggle" on={true} />
            <DeviceRow name="Fitness tracker" sub="Training load feeds your targets" status="toggle" on={false} last />
          </GroupedList>
        </div>
      </div>
      <HomeIndicator />
    </Phone>
  );
}

// ══ COACH · AI CHAT ═══════════════════════════════════════════════════════════
function FutCoachAI() {
  const Bubble = ({ from, children }) => {
    const me = from === 'me';
    return (
      <div style={{ display: 'flex', justifyContent: me ? 'flex-end' : 'flex-start' }}>
        <div style={{ maxWidth: '82%', background: me ? 'var(--ink)' : 'var(--paper)', color: me ? 'var(--paper)' : 'var(--ink)',
          border: me ? 'none' : 'var(--card-border)', boxShadow: me ? 'none' : 'var(--card-shadow)',
          borderRadius: 18, borderBottomRightRadius: me ? 5 : 18, borderBottomLeftRadius: me ? 18 : 5,
          padding: '11px 15px', fontFamily: 'var(--sans)', fontSize: 14.5, lineHeight: 1.45, textWrap: 'pretty' }}>{children}</div>
      </div>
    );
  };
  return (
    <Phone styleKey="balanced" label="Coach · AI">
      <StatusBar />
      <CompactNav title="Coach" trailing={<span style={{ width: 40 }} />} />
      <div style={{ padding: '0 20px 6px', display: 'flex', alignItems: 'center', gap: 8 }}>
        <window.CoachMark sport={(window.FC && window.FC.sport) || 'boxing'} size={30} />
        <div>
          <div style={{ fontFamily: 'var(--sans)', fontSize: 14.5, fontWeight: 600, color: 'var(--ink)' }}>Your AI corner</div>
          <div style={{ fontFamily: 'var(--mono)', fontSize: 10, letterSpacing: '0.1em', textTransform: 'uppercase', color: 'var(--t-green)', fontWeight: 600 }}>Knows your camp</div>
        </div>
      </div>
      <div style={{ flex: 1, padding: '12px 20px 6px', display: 'flex', flexDirection: 'column', gap: 12, overflow: 'hidden' }}>
        <Bubble from="coach">You're 0.3 kg ahead of plan this week, nice. Want to hold or ease the deficit a touch?</Bubble>
        <Bubble from="me">I felt flat in training today.</Bubble>
        <Bubble from="coach">Common when you're ahead of pace. Add ~40g carbs around your session tomorrow and we'll still land on target. Keep tonight's dinner as planned.</Bubble>
        <div style={{ display: 'flex', gap: 8, flexWrap: 'wrap', marginTop: 2 }}>
          {['Am I on track?', 'What should I eat today?', 'Is this water weight?'].map(s => (
            <span key={s} style={{ fontFamily: 'var(--sans)', fontSize: 12.5, color: 'var(--ink-2)', border: '1px solid var(--rule-2)', borderRadius: 100, padding: '7px 12px' }}>{s}</span>
          ))}
        </div>
      </div>
      <div style={{ padding: '8px 16px 14px', borderTop: '1px solid var(--rule)', display: 'flex', alignItems: 'center', gap: 10 }}>
        <div style={{ flex: 1, background: 'var(--paper-2)', borderRadius: 22, padding: '11px 16px', fontFamily: 'var(--sans)', fontSize: 14.5, color: 'var(--ink-3)' }}>Ask your coach…</div>
        <span style={{ width: 40, height: 40, borderRadius: '50%', background: 'var(--ink)', display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0 }}>
          <svg width="17" height="17" viewBox="0 0 17 17" fill="none"><path d="M8.5 14 V3 M3.5 8 L8.5 3 L13.5 8" stroke="var(--paper)" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round"/></svg>
        </span>
      </div>
      <HomeIndicator />
    </Phone>
  );
}

// ══ FIND YOUR FIGHT · competition picker with prefilled rules ═════════════════
function FutCompetitionPicker() {
  const events = [
    ['Regional MMA Series 12', 'Sat 11 Jan · Manchester', true],
    ['State Grappling Open', 'Sun 19 Jan · Leeds', false],
    ['National Amateur Boxing', 'Sat 1 Feb · London', false],
  ];
  const rules = [['Weigh-in', 'Day before · 5 PM'], ['Class limit', '70.3 kg'], ['Gear allowance', 'None'], ['Re-weigh', 'No']];
  return (
    <Phone styleKey="balanced" label="Find Your Fight">
      <StatusBar />
      <CompactNav title="Find your fight" trailing={<NavAction>Manual</NavAction>} />
      <div style={{ flex: 1, padding: '6px 20px 28px', display: 'flex', flexDirection: 'column', gap: 20 }}>
        <div style={{ display: 'flex', alignItems: 'center', gap: 10, background: 'var(--paper-2)', borderRadius: 12, padding: '12px 14px' }}>
          <svg width="16" height="16" viewBox="0 0 16 16" fill="none"><circle cx="7" cy="7" r="5.2" stroke="var(--ink-3)" strokeWidth="1.5"/><path d="M11 11 L14.5 14.5" stroke="var(--ink-3)" strokeWidth="1.5" strokeLinecap="round"/></svg>
          <span style={{ fontFamily: 'var(--sans)', fontSize: 14.5, color: 'var(--ink-3)' }}>Search promotions & events</span>
        </div>
        <div>
          <SectionHeader>Near you</SectionHeader>
          <GroupedList>
            {events.map((e, i) => (
              <Row key={i} last={i === events.length - 1} label={e[0]} note={e[1]}
                control={e[2]
                  ? <span style={{ width: 22, height: 22, borderRadius: '50%', background: 'var(--accent)', display: 'flex', alignItems: 'center', justifyContent: 'center' }}><svg width="11" height="9" viewBox="0 0 11 9" fill="none"><path d="M1 4.5 L4 7.5 L10 1" stroke="#fff" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round"/></svg></span>
                  : undefined}
                chevron={!e[2]} />
            ))}
          </GroupedList>
        </div>
        <div>
          <SectionHeader>Rules · prefilled</SectionHeader>
          <GroupedList>
            {rules.map((r, i) => (
              <Row key={r[0]} last={i === rules.length - 1} label={r[0]} value={r[1]} chevron={false} />
            ))}
          </GroupedList>
          <div style={{ fontFamily: 'var(--sans)', fontSize: 12.5, color: 'var(--ink-3)', lineHeight: 1.5, padding: '10px 4px 0', textWrap: 'pretty' }}>Pulled from the promotion's published rules. Review before your plan is built.</div>
        </div>
      </div>
      <HomeIndicator />
    </Phone>
  );
}

// ══ WIN-BACK · re-engagement after a declined paywall / lapse ═════════════════
// The hard paywall has no free-home fallback, so re-engagement is the only
// recovery path (Logic & Flows §10). Calm, honest, the plan they built handed
// back — never a guilt trip. Reached from a reminder / email, not a live screen.
function FutWinBack() {
  const F = window.FC || {};
  const start = (F.planStart || 78.4).toFixed(1);
  const limit = (F.goalWeight || 74.4).toFixed(1);
  return (
    <Phone styleKey="balanced" label="Win-back">
      <StatusBar />
      <CompactNav title="" trailing={<NavAction>Close</NavAction>} onBack={false} />
      <div style={{ flex: 1, padding: '4px 20px 24px', display: 'flex', flexDirection: 'column', gap: 20, overflowY: 'auto' }}>
        <div>
          <div style={{ fontFamily: 'var(--display)', fontSize: 11, letterSpacing: '0.16em', textTransform: 'uppercase', color: 'var(--accent)', fontWeight: 700 }}>Your camp's still here</div>
          <div style={{ fontFamily: 'var(--sans)', fontSize: 26, fontWeight: 700, letterSpacing: '-0.02em', lineHeight: 1.15, color: 'var(--ink)', marginTop: 12, textWrap: 'balance' }}>Pick your cut back up. The fight hasn't moved.</div>
          <div style={{ fontFamily: 'var(--sans)', fontSize: 15, lineHeight: 1.55, color: 'var(--ink-2)', marginTop: 10, textWrap: 'pretty' }}>The {start} → {limit} kg plan you built is saved. You're <b style={{ color: 'var(--ink)', fontWeight: 600 }}>6 weeks out</b> now — still very makeable, but every week you wait makes the week-by-week steeper.</div>
        </div>

        <Card inverted pad={20}>
          <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
            <div><div style={{ fontFamily: 'var(--mono)', fontSize: 10, letterSpacing: '0.12em', color: 'rgba(246,244,239,0.55)', fontWeight: 600 }}>TODAY</div><div style={{ fontFamily: 'var(--num)', fontWeight: 300, fontSize: 30, color: 'var(--paper)', marginTop: 6 }}>{start}<span style={{ fontFamily: 'var(--mono)', fontSize: 11, marginLeft: 3 }}>kg</span></div></div>
            <svg width="22" height="14" viewBox="0 0 22 14" fill="none" style={{ opacity: 0.5 }}><path d="M1 7 H19 M14 2 L20 7 L14 12" stroke="#fff" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/></svg>
            <div style={{ textAlign: 'right' }}><div style={{ fontFamily: 'var(--mono)', fontSize: 10, letterSpacing: '0.12em', color: 'rgba(246,244,239,0.55)', fontWeight: 600 }}>FIGHT WEIGHT</div><div style={{ fontFamily: 'var(--num)', fontWeight: 300, fontSize: 30, color: '#f4a299', marginTop: 6 }}>{limit}<span style={{ fontFamily: 'var(--mono)', fontSize: 11, marginLeft: 3 }}>kg</span></div></div>
          </div>
          <div style={{ height: 1, background: 'rgba(246,244,239,0.16)', margin: '15px 0' }} />
          <div style={{ fontFamily: 'var(--sans)', fontSize: 13.5, color: 'rgba(246,244,239,0.9)', textWrap: 'pretty', lineHeight: 1.5 }}>Your projection, cut strategy and cycle-aware targets are exactly where you left them.</div>
        </Card>

        <div style={{ background: 'var(--accent-soft)', borderRadius: 'var(--radius)', padding: '16px 18px', display: 'flex', alignItems: 'flex-start', justifyContent: 'space-between', gap: 12 }}>
          <div>
            <div style={{ fontFamily: 'var(--display)', fontSize: 10, letterSpacing: '0.14em', textTransform: 'uppercase', color: 'var(--accent)', fontWeight: 700 }}>A hand to get going</div>
            <div style={{ fontFamily: 'var(--sans)', fontSize: 14.5, color: 'var(--ink)', lineHeight: 1.45, marginTop: 6, textWrap: 'pretty' }}>Come back this week and your <b>first month's half price</b>.</div>
          </div>
          <span style={{ fontFamily: 'var(--mono)', fontSize: 8.5, letterSpacing: '0.06em', color: 'var(--ink-3)', border: '1px solid var(--rule)', borderRadius: 4, padding: '2px 5px', flexShrink: 0 }}>PLACEHOLDER</span>
        </div>

        <div style={{ flex: 1, minHeight: 6 }} />
        <button style={{ width: '100%', background: 'var(--ink)', color: 'var(--paper)', border: 'none', borderRadius: 'var(--radius-ctl)', minHeight: 54, fontFamily: 'var(--display)', fontSize: 14, letterSpacing: '0.13em', fontWeight: 600 }}>PICK UP MY PLAN</button>
        <div style={{ textAlign: 'center', marginTop: 6 }}><TextButton>Not now</TextButton></div>
      </div>
      <HomeIndicator />
    </Phone>
  );
}

// ══ NEXT CAMP, SMARTER · missed-weight → fresh-start hook ═════════════════════
// Closes a missed cut on what the data says for next time, so the lowest moment
// becomes the reason to come back (Peak-End + Fresh Start). Supported, never
// judged (Copy Rules). Reached when starting the next camp, not from a live CTA.
function FutNextCampSmarter() {
  const learned = [
    ['Started tight', 'Six weeks for a 4 kg cut left no slack. Next camp we flag the start date earlier.'],
    ['Week-3 stall', 'Your trend flattened mid-camp. We hold a bigger margin under the 1%/wk ceiling.'],
    ['Luteal hold ran high', 'Your water swing measured +1.4 kg, above typical — next plan pre-cuts that buffer.'],
    ['Fight-week was steep', 'The last-week water drop was aggressive. We taper it sooner and gentler.'],
  ];
  return (
    <Phone styleKey="balanced" label="Next camp, smarter">
      <StatusBar />
      <CompactNav title="Last camp" trailing={<span style={{ width: 40 }} />} />
      <div style={{ flex: 1, padding: '6px 20px 26px', display: 'flex', flexDirection: 'column', gap: 20, overflowY: 'auto' }}>
        <div>
          <div style={{ fontFamily: 'var(--display)', fontSize: 11, letterSpacing: '0.16em', textTransform: 'uppercase', color: 'var(--ink-3)', fontWeight: 700 }}>What the data says</div>
          <div style={{ fontFamily: 'var(--sans)', fontSize: 25, fontWeight: 700, letterSpacing: '-0.02em', lineHeight: 1.18, color: 'var(--ink)', marginTop: 11, textWrap: 'balance' }}>Missed by 1.2 kg. Here's what changes next time.</div>
          <div style={{ fontFamily: 'var(--sans)', fontSize: 14.5, lineHeight: 1.55, color: 'var(--ink-2)', marginTop: 9, textWrap: 'pretty' }}>It happens, and it's fixable. Your logged camp tells us exactly where the cut got hard — so the next plan starts smarter, not from scratch.</div>
        </div>

        <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
          {learned.map((l, i) => (
            <div key={i} style={{ display: 'flex', gap: 13, background: 'var(--paper)', borderRadius: 'var(--radius)', boxShadow: 'var(--card-shadow)', border: 'var(--card-border)', padding: '15px 16px' }}>
              <span style={{ flexShrink: 0, width: 26, height: 26, borderRadius: 8, background: 'var(--accent-soft)', display: 'flex', alignItems: 'center', justifyContent: 'center', fontFamily: 'var(--num)', fontSize: 13, fontWeight: 500, color: 'var(--accent)' }}>{i + 1}</span>
              <div style={{ flex: 1 }}>
                <div style={{ fontFamily: 'var(--sans)', fontSize: 14.5, fontWeight: 600, color: 'var(--ink)' }}>{l[0]}</div>
                <div style={{ fontFamily: 'var(--sans)', fontSize: 12.5, color: 'var(--ink-3)', lineHeight: 1.5, marginTop: 3, textWrap: 'pretty' }}>{l[1]}</div>
              </div>
            </div>
          ))}
        </div>

        <div style={{ flex: 1, minHeight: 6 }} />
        <button style={{ width: '100%', background: 'var(--ink)', color: 'var(--paper)', border: 'none', borderRadius: 'var(--radius-ctl)', minHeight: 54, fontFamily: 'var(--display)', fontSize: 14, letterSpacing: '0.13em', fontWeight: 600 }}>PLAN MY NEXT CAMP</button>
      </div>
      <HomeIndicator />
    </Phone>
  );
}

// ══ REMINDER RE-ASK · harden the daily-loop trigger ═══════════════════════════
// The loop hinges on one trigger (a deferred, opt-in push). For push-declined
// users it re-asks with value framing, and offers the widget as a no-permission
// backup trigger (BFM Habit Loop; Spotify's weak-trigger miss). Sandbox concept.
function FutReminderReask() {
  return (
    <Phone styleKey="balanced" label="Reminder re-ask">
      <StatusBar />
      <CompactNav title="" trailing={<NavAction>Close</NavAction>} onBack={false} />
      <div style={{ flex: 1, padding: '4px 20px 24px', display: 'flex', flexDirection: 'column', gap: 20, overflowY: 'auto' }}>
        <div>
          <div style={{ fontFamily: 'var(--display)', fontSize: 11, letterSpacing: '0.16em', textTransform: 'uppercase', color: 'var(--accent)', fontWeight: 700 }}>One weigh-in a day</div>
          <div style={{ fontFamily: 'var(--sans)', fontSize: 26, fontWeight: 700, letterSpacing: '-0.02em', lineHeight: 1.15, color: 'var(--ink)', marginTop: 12, textWrap: 'balance' }}>Your morning weigh-in runs the whole plan.</div>
          <div style={{ fontFamily: 'var(--sans)', fontSize: 15, lineHeight: 1.55, color: 'var(--ink-2)', marginTop: 10, textWrap: 'pretty' }}>Miss the mornings and the trend goes quiet — your pace, projection and verdict all stall. A reminder keeps the habit on rails.</div>
        </div>

        <button style={{ width: '100%', background: 'var(--ink)', color: 'var(--paper)', border: 'none', borderRadius: 'var(--radius-ctl)', minHeight: 54, fontFamily: 'var(--display)', fontSize: 14, letterSpacing: '0.13em', fontWeight: 600 }}>TURN ON THE MORNING REMINDER</button>
        <div style={{ textAlign: 'center', fontFamily: 'var(--sans)', fontSize: 12.5, color: 'var(--ink-3)', marginTop: -8 }}>One ping, at your weigh-in time. Nothing else.</div>

        <div style={{ display: 'flex', alignItems: 'center', gap: 12, margin: '2px 0' }}>
          <div style={{ flex: 1, height: 1, background: 'var(--rule)' }} /><span style={{ fontFamily: 'var(--mono)', fontSize: 10, letterSpacing: '0.1em', textTransform: 'uppercase', color: 'var(--ink-3)', fontWeight: 600 }}>or, no notifications</span><div style={{ flex: 1, height: 1, background: 'var(--rule)' }} />
        </div>

        <div style={{ background: 'var(--paper)', borderRadius: 'var(--radius)', boxShadow: 'var(--card-shadow)', border: 'var(--card-border)', padding: '18px' }}>
          <div style={{ fontFamily: 'var(--sans)', fontSize: 16, fontWeight: 600, color: 'var(--ink)', textWrap: 'balance' }}>Add the Home Screen widget</div>
          <div style={{ fontFamily: 'var(--sans)', fontSize: 13, color: 'var(--ink-3)', lineHeight: 1.5, marginTop: 6, textWrap: 'pretty' }}>Your cut at a glance, every time you unlock your phone — no permission needed.</div>
          {/* widget preview */}
          <div style={{ marginTop: 15, display: 'flex', gap: 12, alignItems: 'center' }}>
            <div style={{ width: 128, flexShrink: 0, background: 'var(--ink)', color: 'var(--paper)', borderRadius: 16, padding: '13px 14px' }}>
              <div style={{ fontFamily: 'var(--mono)', fontSize: 8.5, letterSpacing: '0.12em', color: 'rgba(246,244,239,0.55)', fontWeight: 600 }}>23 DAYS OUT</div>
              <div style={{ display: 'flex', alignItems: 'baseline', gap: 3, marginTop: 5 }}><span style={{ fontFamily: 'var(--num)', fontWeight: 300, fontSize: 34, lineHeight: 0.9 }}>76.0</span><span style={{ fontFamily: 'var(--mono)', fontSize: 9, color: 'rgba(246,244,239,0.6)' }}>kg</span></div>
              <div style={{ fontFamily: 'var(--mono)', fontSize: 8.5, letterSpacing: '0.08em', color: '#8fbf6b', fontWeight: 700, marginTop: 6 }}>● ON TRACK</div>
            </div>
            <div style={{ flex: 1, fontFamily: 'var(--sans)', fontSize: 12, color: 'var(--ink-3)', lineHeight: 1.5, textWrap: 'pretty' }}>Tap it to log in two taps. The trigger that needs no permission.</div>
          </div>
          <button style={{ width: '100%', marginTop: 16, background: 'transparent', color: 'var(--ink)', border: '1px solid var(--rule-2)', borderRadius: 'var(--radius-ctl)', minHeight: 48, fontFamily: 'var(--display)', fontSize: 13, letterSpacing: '0.12em', fontWeight: 600 }}>ADD WIDGET</button>
        </div>
      </div>
      <HomeIndicator />
    </Phone>
  );
}

// ══ COACH VIEW · the coach's roster (peer/coach accountability layer) ═════════
// The product's one real social-proof / accountability lever (BFM: Strava-style
// social). A coach sees their stable at a glance and where to step in. Net-new
// future feature — sandbox only, never wired from a live athlete screen.
function FutCoachView() {
  const PaceChip = ({ tone, label }) => {
    const c = { green: ['var(--t-green)', 'var(--t-green-soft)'], amber: ['var(--mustard-deep)', 'var(--t-amber-soft)'], red: ['var(--t-red)', 'rgba(176,67,47,0.10)'] }[tone];
    return <span style={{ fontFamily: 'var(--mono)', fontSize: 9.5, letterSpacing: '0.06em', textTransform: 'uppercase', fontWeight: 700, color: c[0], background: c[1], borderRadius: 100, padding: '4px 9px', whiteSpace: 'nowrap' }}>{label}</span>;
  };
  const fighters = [
    ['DR', 'Reyes', 'MMA · Lightweight', '23 days', '76.0', 'green', 'On track'],
    ['SO', 'Okafor', 'Boxing · 70 kg', '9 days', '71.8', 'amber', 'Behind'],
    ['LM', 'Marsh', 'BJJ · Leve', '5 days', '74.9', 'red', 'Cutting fast'],
    ['MT', 'Tran', 'Judo · −63', '31 days', '65.1', 'green', 'On track'],
  ];
  return (
    <Phone styleKey="balanced" label="Coach view · roster">
      <StatusBar />
      <LargeTitle eyebrow="Coach · read-only" title="Your fighters" trailing={<GearButton />} eyebrowColor="var(--accent)" />
      <div style={{ flex: 1, padding: '2px 20px 28px', display: 'flex', flexDirection: 'column', gap: 20 }}>
        <div style={{ background: 'var(--ink)', color: 'var(--paper)', borderRadius: 'var(--radius)', padding: '18px 20px' }}>
          <div style={{ fontFamily: 'var(--sans)', fontSize: 18, fontWeight: 600, lineHeight: 1.3, textWrap: 'balance' }}>4 in camp. 2 need a look this morning.</div>
          <div style={{ fontFamily: 'var(--sans)', fontSize: 13, lineHeight: 1.5, color: 'rgba(246,244,239,0.82)', marginTop: 7, textWrap: 'pretty' }}>Each fighter shares their camp with you. You see the trend and the verdict — they own the cut.</div>
        </div>
        <div>
          <SectionHeader trailing={<span style={{ fontFamily: 'var(--mono)', fontSize: 10.5, letterSpacing: '0.06em', color: 'var(--ink-3)', fontWeight: 600 }}>NEEDS A LOOK</span>}>Sort · soonest first</SectionHeader>
          <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
            {fighters.map((f) => (
              <div key={f[1]} style={{ display: 'flex', alignItems: 'center', gap: 13, background: 'var(--paper)', borderRadius: 'var(--radius)', boxShadow: 'var(--card-shadow)', border: f[5] === 'red' ? '1px solid color-mix(in srgb, var(--t-red) 32%, transparent)' : 'var(--card-border)', padding: '13px 15px' }}>
                <span style={{ flexShrink: 0, width: 38, height: 38, borderRadius: '50%', background: 'var(--accent-soft)', display: 'flex', alignItems: 'center', justifyContent: 'center', fontFamily: 'var(--display)', fontSize: 13, fontWeight: 700, color: 'var(--accent)' }}>{f[0]}</span>
                <div style={{ flex: 1, minWidth: 0 }}>
                  <div style={{ fontFamily: 'var(--sans)', fontSize: 15.5, fontWeight: 600, color: 'var(--ink)' }}>{f[1]}</div>
                  <div style={{ fontFamily: 'var(--mono)', fontSize: 10.5, letterSpacing: '0.04em', color: 'var(--ink-3)', fontWeight: 600, marginTop: 3 }}>{f[2]} · {f[3]} out</div>
                </div>
                <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-end', gap: 6, flexShrink: 0 }}>
                  <span style={{ fontFamily: 'var(--num)', fontSize: 18, fontWeight: 400, color: 'var(--ink)' }}>{f[4]}<span style={{ fontFamily: 'var(--mono)', fontSize: 9.5, color: 'var(--ink-3)', marginLeft: 2 }}>kg</span></span>
                  <PaceChip tone={f[5]} label={f[6]} />
                </div>
              </div>
            ))}
          </div>
        </div>
        <div style={{ background: 'var(--accent-soft)', borderRadius: 'var(--radius)', padding: '15px 17px', fontFamily: 'var(--sans)', fontSize: 13, color: 'var(--ink-2)', lineHeight: 1.5, textWrap: 'pretty' }}>Tap a fighter for their trend, projection and weekly verdict. You can send a note; you can't change their plan — that stays theirs.</div>
      </div>
      <HomeIndicator />
    </Phone>
  );
}

Object.assign(window, {
  FutTaperedPlan, FutLearnLibrary, FutNutrition, FutDevices, FutCoachAI, FutCompetitionPicker,
  FutWinBack, FutNextCampSmarter, FutReminderReask, FutCoachView,
});
