// fc-reveal-recommended-options.jsx — three decluttered directions for the
// "★ Recommended" plan-reveal screen. The brief: the current screen stacks five
// similar-weight blocks (masthead → number card → coach card → a dense 5-row
// Use/Cap/Skip table → a hollow-ring list), so nothing leads and the strategy
// table reads like a spreadsheet. Each direction below fixes that a different way:
//
//   B · The Verdict   — one unified clay poster carries goal + hero number; the
//                       strategy collapses into calm USING / SKIPPING groups.
//   C · Native        — the app's own SectionHeader + grouped-list vocabulary;
//                       hierarchy from clear labels, not decoration. Feels iOS.
//   D · Editorial     — maximum restraint: one focal number, the proof chart,
//                       one read, strategy as one prose line. Breathes.
//
// Same engine numbers (usePosterData) as the ★ Recommended so they compare 1:1.

const rro = window;

// ── shared helpers (uniquely named to avoid global collisions) ───────────────
function rroStratGroups(strats) {
  return {
    using: strats.filter((s) => s.tone === 'green'),
    cap: strats.filter((s) => s.tone === 'amber'),
    skip: strats.filter((s) => s.tone === 'red'),
  };
}
const RRO_GREEN = 'var(--green, #2f5a24)';
const RRO_AMBER = 'var(--mustard, #a87b22)';
const RRO_CLAY = window.POSTER_CLAY || '#e9ddcd';

function RROTick({ color = RRO_GREEN }) {
  return (
    <span style={{ flexShrink: 0, marginTop: 3, width: 16, height: 16, borderRadius: '50%', display: 'flex', alignItems: 'center', justifyContent: 'center', background: color }}>
      <svg width="9" height="7" viewBox="0 0 11 9" fill="none"><path d="M1 4.5 L4 7.5 L10 1" stroke="#fff" strokeWidth="2.1" strokeLinecap="round" strokeLinejoin="round" /></svg>
    </span>
  );
}

// ════════════════════════════════════════════════════════════════════════════
// B · THE VERDICT — the top is a single clay poster: eyebrow, goal echo, then a
// hairline and the giant make-weight number with the cut read. No competing white
// hero card. The strategy stops being a 5-row colour table and becomes two calm
// groups (USING / SKIPPING) with one capped note. Locked plan is the strong close.
// ════════════════════════════════════════════════════════════════════════════
function RevealRecommendedB() {
  const data = rro.usePosterData();
  const { c, d, strats, stratIntro } = data;
  if (!c.tip) return null;
  const { Num, CoachTip, SportGlyph } = rro;
  const g = rroStratGroups(strats);
  const divisionLabel = d.division || d.sport;
  const dateStr = c.FC.fightDateShort || 'Jan 1';

  return (
    <rro.RevealFrame label="Reveal · B · The Verdict" footer={<rro.PrimaryNext label="See my full plan" sub="Your camp is built — yours to keep." />}>
      <div style={{ flex: 1, display: 'flex', flexDirection: 'column' }}>

        {/* ══ ONE POSTER: goal echo + hero number, together ══ */}
        <div style={{ background: RRO_CLAY, color: 'var(--ink)', padding: '24px 24px 26px' }}>
          <div style={{ display: 'flex', alignItems: 'flex-start', justifyContent: 'space-between', gap: 14 }}>
            <div style={{ flex: 1 }}>
              <div style={{ fontFamily: 'var(--mono)', fontSize: 9.5, letterSpacing: '0.14em', textTransform: 'uppercase', color: 'var(--ink-3)', fontWeight: 700 }}>
                {d.sport} · {c.weighShort} weigh-in · {d.weeks} weeks out
              </div>
              <div style={{ fontFamily: 'var(--sans)', fontSize: 21, fontWeight: 700, letterSpacing: '-0.02em', lineHeight: 1.2, color: 'var(--ink)', textWrap: 'balance', marginTop: 11 }}>
                {d.firstName ? `${d.firstName}, your ` : 'Your '}safe line to make {divisionLabel} by <span style={{ color: 'var(--accent)' }}>{dateStr}</span>.
              </div>
            </div>
            {c.glyph && SportGlyph && <SportGlyph name={c.glyph} size={30} ink="var(--ink)" accent="var(--accent)" />}
          </div>

          <div style={{ height: 1, background: 'rgba(21,20,15,0.14)', margin: '20px 0 18px' }} />

          <div style={{ display: 'flex', alignItems: 'flex-end', justifyContent: 'space-between', gap: 12 }}>
            <div>
              <div style={{ fontFamily: 'var(--mono)', fontSize: 9.5, letterSpacing: '0.16em', textTransform: 'uppercase', color: 'var(--ink-3)', fontWeight: 700 }}>Make-weight target</div>
              <div style={{ display: 'flex', alignItems: 'flex-end', gap: 10, marginTop: 6 }}>
                {Num ? <Num size={78} weight={300} color="var(--ink)">{d.targetW.toFixed(1)}</Num> : null}
                <span style={{ fontFamily: 'var(--mono)', fontSize: 13, color: 'var(--ink-3)', fontWeight: 600, paddingBottom: 12 }}>KG</span>
              </div>
            </div>
            <div style={{ textAlign: 'right', paddingBottom: 6 }}>
              <div style={{ display: 'inline-flex', alignItems: 'center', gap: 6, fontFamily: 'var(--mono)', fontSize: 10, letterSpacing: '0.1em', textTransform: 'uppercase', fontWeight: 700, color: RRO_GREEN }}>
                <span style={{ width: 6, height: 6, borderRadius: '50%', background: RRO_GREEN }} />Safe pace
              </div>
              <div style={{ fontFamily: 'var(--num)', fontWeight: 500, fontSize: 22, letterSpacing: '-0.02em', color: 'var(--accent)', marginTop: 8 }}>−{d.cut.toFixed(1)}<span style={{ fontFamily: 'var(--mono)', fontSize: 11, fontWeight: 600, marginLeft: 3 }}>kg</span></div>
              <div style={{ fontFamily: 'var(--mono)', fontSize: 9, letterSpacing: '0.06em', textTransform: 'uppercase', color: 'var(--ink-3)', fontWeight: 600, marginTop: 3 }}>from today · {d.ratePct.toFixed(2)}%/wk</div>
            </div>
          </div>
        </div>

        <div style={{ padding: '24px 24px 26px', display: 'flex', flexDirection: 'column' }}>

          {/* ══ COACH'S READ — editorial lead, no box ══ */}
          <div>
            <div style={{ fontFamily: 'var(--mono)', fontSize: 9.5, letterSpacing: '0.14em', textTransform: 'uppercase', color: 'var(--accent)', fontWeight: 700 }}>Your coach's read</div>
            <div style={{ fontFamily: 'var(--sans)', fontSize: 18.5, fontWeight: 600, lineHeight: 1.32, color: 'var(--ink)', letterSpacing: '-0.01em', marginTop: 11, textWrap: 'balance' }}>{c.tip.headline}</div>
            <div style={{ fontFamily: 'var(--sans)', fontSize: 14, lineHeight: 1.55, color: 'var(--ink-2)', marginTop: 10, textWrap: 'pretty' }}>{c.tip.body}</div>
          </div>

          {/* ══ CUT STRATEGY — calm USING / SKIPPING groups, not a colour table ══ */}
          <div style={{ marginTop: 26, borderTop: '1px solid var(--rule)', paddingTop: 22 }}>
            <div style={{ fontFamily: 'var(--sans)', fontSize: 17, fontWeight: 700, letterSpacing: '-0.01em', color: 'var(--ink)' }}>Recommended cut strategy</div>
            <div style={{ fontFamily: 'var(--sans)', fontSize: 13.5, lineHeight: 1.5, color: 'var(--ink-2)', marginTop: 8, textWrap: 'pretty' }}>{stratIntro}</div>

            <div style={{ marginTop: 18, display: 'flex', flexDirection: 'column', gap: 10 }}>
              <div style={{ fontFamily: 'var(--mono)', fontSize: 9, letterSpacing: '0.14em', textTransform: 'uppercase', fontWeight: 700, color: RRO_GREEN }}>Using</div>
              {g.using.map((s, i) => (
                <div key={i} style={{ display: 'flex', gap: 11, alignItems: 'flex-start' }}>
                  <RROTick />
                  <div style={{ flex: 1, minWidth: 0 }}>
                    <span style={{ fontFamily: 'var(--sans)', fontSize: 14.5, fontWeight: 600, color: 'var(--ink)' }}>{s.t}</span>
                    <span style={{ fontFamily: 'var(--sans)', fontSize: 13.5, color: 'var(--ink-3)', lineHeight: 1.45 }}> — {s.s}</span>
                  </div>
                </div>
              ))}
            </div>

            {g.cap.length > 0 && (
              <div style={{ marginTop: 16, background: 'var(--amber-soft, rgba(168,123,34,0.14))', borderRadius: 12, padding: '12px 14px', display: 'flex', gap: 10, alignItems: 'flex-start' }}>
                <span style={{ flexShrink: 0, marginTop: 2, fontFamily: 'var(--mono)', fontSize: 8.5, letterSpacing: '0.06em', textTransform: 'uppercase', fontWeight: 700, color: RRO_AMBER, border: `1px solid ${RRO_AMBER}`, borderRadius: 100, padding: '2px 7px' }}>Cap</span>
                <div style={{ flex: 1, minWidth: 0 }}>
                  <span style={{ fontFamily: 'var(--sans)', fontSize: 14, fontWeight: 600, color: 'var(--ink)' }}>{g.cap[0].t}</span>
                  <span style={{ fontFamily: 'var(--sans)', fontSize: 13, color: 'var(--ink-2)', lineHeight: 1.45 }}> — {g.cap[0].s}</span>
                </div>
              </div>
            )}

            {g.skip.length > 0 && (
              <div style={{ marginTop: 16, display: 'flex', gap: 10, alignItems: 'baseline' }}>
                <span style={{ flexShrink: 0, fontFamily: 'var(--mono)', fontSize: 9, letterSpacing: '0.14em', textTransform: 'uppercase', fontWeight: 700, color: 'var(--ink-3)' }}>Skipping</span>
                <div style={{ flex: 1, fontFamily: 'var(--sans)', fontSize: 13.5, color: 'var(--ink-2)', lineHeight: 1.5, textWrap: 'pretty' }}>
                  {g.skip.map((s) => s.t).join(' and ')} — hard to time and not worth the muscle. We leave them off.
                </div>
              </div>
            )}
          </div>

          {/* ══ LOCKED PLAN — the strong close ══ */}
          <div style={{ marginTop: 24, background: 'var(--paper)', border: '1px solid var(--rule)', borderRadius: 'var(--radius)', padding: '16px 18px', display: 'flex', alignItems: 'center', gap: 13 }}>
            <svg width="17" height="18" viewBox="0 0 12 13" fill="none" style={{ flexShrink: 0 }}><rect x="1.5" y="5.5" width="9" height="6.5" rx="1.5" stroke="var(--accent)" strokeWidth="1.2" /><path d="M3.5 5.5 V4 a2.5 2.5 0 0 1 5 0 V5.5" stroke="var(--accent)" strokeWidth="1.2" /></svg>
            <div style={{ flex: 1 }}>
              <div style={{ fontFamily: 'var(--sans)', fontSize: 14.5, color: 'var(--ink)', fontWeight: 600 }}>Your day-by-day plan is ready</div>
              <div style={{ fontFamily: 'var(--sans)', fontSize: 12.5, color: 'var(--ink-3)', marginTop: 1 }}>All {d.weeks * 7} days, mapped to fight day.</div>
            </div>
          </div>

          <div style={{ marginTop: 14, fontFamily: 'var(--sans)', fontSize: 12, color: 'var(--ink-3)', lineHeight: 1.5, textWrap: 'pretty' }}>
            Cycle-aware targets, weigh-in reminders and your event's exact caps fine-tune once you set up camp.
          </div>

        </div>
      </div>
    </rro.RevealFrame>
  );
}

// ════════════════════════════════════════════════════════════════════════════
// C · NATIVE — the reveal built from the app's own list vocabulary. A single clean
// number card, then labelled sections (SectionHeader) each holding one grouped
// list. Hierarchy comes from consistent labels + white cards on the off-white
// surface, not from five different decorations. Reads calm and iOS-native.
// ════════════════════════════════════════════════════════════════════════════
function RevealRecommendedC() {
  const data = rro.usePosterData();
  const { c, d, strats, stratIntro } = data;
  if (!c.tip) return null;
  const { Num, SectionHeader } = rro;
  const g = rroStratGroups(strats);
  const divisionLabel = d.division || d.sport;
  const dateStr = c.FC.fightDateShort || 'Jan 1';
  const ceiling = 1.0;
  const pacePos = Math.min(100, (d.ratePct / ceiling) * 100);

  const Group = ({ children }) => (
    <div style={{ background: 'var(--paper)', borderRadius: 'var(--radius)', border: '1px solid var(--rule)', overflow: 'hidden' }}>{children}</div>
  );

  return (
    <rro.RevealFrame label="Reveal · C · Native" footer={<rro.PrimaryNext label="See my full plan" sub="Your camp is built — yours to keep." />}>
      <div style={{ padding: '20px 18px 26px', display: 'flex', flexDirection: 'column', gap: 20 }}>

        {/* ══ goal echo — quiet, one line ══ */}
        <div>
          <div style={{ fontFamily: 'var(--mono)', fontSize: 9.5, letterSpacing: '0.14em', textTransform: 'uppercase', color: 'var(--ink-3)', fontWeight: 700 }}>{d.sport} · {c.weighShort} weigh-in · {d.weeks} weeks out</div>
          <div style={{ fontFamily: 'var(--sans)', fontSize: 19, fontWeight: 700, letterSpacing: '-0.02em', lineHeight: 1.22, color: 'var(--ink)', textWrap: 'balance', marginTop: 9 }}>
            {d.firstName ? `${d.firstName}, your ` : 'Your '}safe line to make {divisionLabel} by <span style={{ color: 'var(--accent)' }}>{dateStr}</span>.
          </div>
        </div>

        {/* ══ HERO number card — the focal point, pace as a clean labelled bar ══ */}
        <div style={{ background: 'var(--paper)', borderRadius: 'var(--radius)', border: '1px solid var(--rule)', padding: 20 }}>
          <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
            <span style={{ fontFamily: 'var(--mono)', fontSize: 10, letterSpacing: '0.16em', color: 'var(--ink-3)', fontWeight: 700 }}>MAKE-WEIGHT TARGET</span>
            <span style={{ display: 'inline-flex', alignItems: 'center', gap: 6, fontFamily: 'var(--mono)', fontSize: 10, letterSpacing: '0.08em', textTransform: 'uppercase', fontWeight: 700, color: RRO_GREEN }}><span style={{ width: 6, height: 6, borderRadius: '50%', background: RRO_GREEN }} />Safe pace</span>
          </div>
          <div style={{ display: 'flex', alignItems: 'flex-end', gap: 12, marginTop: 10 }}>
            {Num ? <Num size={74} weight={300} color="var(--ink)">{d.targetW.toFixed(1)}</Num> : null}
            <div style={{ paddingBottom: 9 }}>
              <div style={{ fontFamily: 'var(--mono)', fontSize: 13, color: 'var(--ink-3)', fontWeight: 600 }}>KG</div>
              <div style={{ fontFamily: 'var(--mono)', fontSize: 12, color: 'var(--accent)', fontWeight: 700, marginTop: 5 }}>−{d.cut.toFixed(1)} FROM TODAY</div>
            </div>
          </div>
          <div style={{ marginTop: 16, borderTop: '1px solid var(--rule)', paddingTop: 14 }}>
            <div style={{ display: 'flex', justifyContent: 'space-between', fontFamily: 'var(--mono)', fontSize: 9.5, letterSpacing: '0.06em', textTransform: 'uppercase', color: 'var(--ink-3)', fontWeight: 600 }}>
              <span>Your pace · {d.ratePct.toFixed(2)}%/wk</span><span>1%/wk ceiling</span>
            </div>
            <div style={{ marginTop: 8, position: 'relative', height: 6, borderRadius: 100, background: 'var(--rule)' }}>
              <div style={{ position: 'absolute', left: 0, top: 0, bottom: 0, width: `${pacePos}%`, borderRadius: 100, background: RRO_GREEN }} />
              <div style={{ position: 'absolute', right: 0, top: -3, bottom: -3, width: 2, background: 'var(--accent)' }} />
            </div>
          </div>
        </div>

        {/* ══ COACH'S READ ══ */}
        <div>
          <SectionHeader>The coach's read</SectionHeader>
          <div style={{ background: RRO_CLAY, borderRadius: 'var(--radius)', padding: '18px 18px 20px' }}>
            <div style={{ fontFamily: 'var(--sans)', fontSize: 16, fontWeight: 600, lineHeight: 1.3, color: 'var(--ink)', letterSpacing: '-0.01em', textWrap: 'balance' }}>{c.tip.headline}</div>
            <div style={{ fontFamily: 'var(--sans)', fontSize: 13.5, lineHeight: 1.55, color: 'var(--ink-2)', marginTop: 9, textWrap: 'pretty' }}>{c.tip.body}</div>
          </div>
        </div>

        {/* ══ CUT STRATEGY — one grouped list; ticks for use, dashes for skip ══ */}
        <div>
          <SectionHeader>Recommended cut strategy</SectionHeader>
          <div style={{ fontFamily: 'var(--sans)', fontSize: 13, lineHeight: 1.5, color: 'var(--ink-3)', padding: '0 4px 11px', textWrap: 'pretty' }}>{stratIntro}</div>
          <Group>
            {g.using.map((s, i) => (
              <div key={'u' + i} style={{ display: 'flex', gap: 12, padding: '13px 16px', alignItems: 'flex-start', borderBottom: '1px solid var(--rule)' }}>
                <RROTick />
                <div style={{ flex: 1, minWidth: 0 }}>
                  <div style={{ fontFamily: 'var(--sans)', fontSize: 14.5, fontWeight: 600, color: 'var(--ink)' }}>{s.t}</div>
                  <div style={{ fontFamily: 'var(--sans)', fontSize: 12.5, color: 'var(--ink-3)', marginTop: 2, lineHeight: 1.4 }}>{s.s}</div>
                </div>
              </div>
            ))}
            {g.cap.map((s, i) => (
              <div key={'c' + i} style={{ display: 'flex', gap: 12, padding: '13px 16px', alignItems: 'flex-start', borderBottom: '1px solid var(--rule)' }}>
                <span style={{ flexShrink: 0, marginTop: 3, width: 16, height: 16, borderRadius: '50%', border: `1.5px solid ${RRO_AMBER}`, display: 'flex', alignItems: 'center', justifyContent: 'center' }}><span style={{ width: 6, height: 2, borderRadius: 2, background: RRO_AMBER }} /></span>
                <div style={{ flex: 1, minWidth: 0 }}>
                  <div style={{ fontFamily: 'var(--sans)', fontSize: 14.5, fontWeight: 600, color: 'var(--ink)' }}>{s.t} <span style={{ fontFamily: 'var(--mono)', fontSize: 8.5, letterSpacing: '0.06em', textTransform: 'uppercase', fontWeight: 700, color: RRO_AMBER }}>· capped</span></div>
                  <div style={{ fontFamily: 'var(--sans)', fontSize: 12.5, color: 'var(--ink-3)', marginTop: 2, lineHeight: 1.4 }}>{s.s}</div>
                </div>
              </div>
            ))}
            {g.skip.map((s, i) => (
              <div key={'s' + i} style={{ display: 'flex', gap: 12, padding: '13px 16px', alignItems: 'flex-start', borderBottom: i === g.skip.length - 1 ? 'none' : '1px solid var(--rule)' }}>
                <span style={{ flexShrink: 0, marginTop: 3, width: 16, height: 16, borderRadius: '50%', border: '1.5px solid var(--rule-2)', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
                  <svg width="7" height="7" viewBox="0 0 8 8" fill="none"><path d="M1 1 L7 7 M7 1 L1 7" stroke="var(--ink-3)" strokeWidth="1.3" strokeLinecap="round" /></svg>
                </span>
                <div style={{ flex: 1, minWidth: 0 }}>
                  <div style={{ fontFamily: 'var(--sans)', fontSize: 14.5, fontWeight: 600, color: 'var(--ink-2)' }}>{s.t}</div>
                  <div style={{ fontFamily: 'var(--sans)', fontSize: 12.5, color: 'var(--ink-3)', marginTop: 2, lineHeight: 1.4 }}>{s.s}</div>
                </div>
              </div>
            ))}
          </Group>
        </div>

        {/* ══ LOCKED ══ */}
        <div style={{ background: 'var(--paper)', border: '1px solid var(--rule)', borderRadius: 'var(--radius)', padding: '15px 18px', display: 'flex', alignItems: 'center', gap: 12 }}>
          <svg width="16" height="17" viewBox="0 0 12 13" fill="none" style={{ flexShrink: 0 }}><rect x="1.5" y="5.5" width="9" height="6.5" rx="1.5" stroke="var(--accent)" strokeWidth="1.2" /><path d="M3.5 5.5 V4 a2.5 2.5 0 0 1 5 0 V5.5" stroke="var(--accent)" strokeWidth="1.2" /></svg>
          <span style={{ fontFamily: 'var(--sans)', fontSize: 14, color: 'var(--ink)', fontWeight: 600, flex: 1 }}>Your day-by-day plan for all {d.weeks * 7} days is ready.</span>
        </div>

      </div>
    </rro.RevealFrame>
  );
}

// ════════════════════════════════════════════════════════════════════════════
// D · EDITORIAL — maximum restraint. One focal number on paper, the proof chart
// (daily noise vs. the trend we read through it), one line of read, and the
// strategy compressed to a single prose line. Almost no rules. Breathes.
// ════════════════════════════════════════════════════════════════════════════
function RevealRecommendedD() {
  const data = rro.usePosterData();
  const { c, d, strats, stratIntro } = data;
  if (!c.tip) return null;
  const { Num, HeroGlide } = rro;
  const g = rroStratGroups(strats);
  const divisionLabel = d.division || d.sport;
  const dateStr = c.FC.fightDateShort || 'Jan 1';
  const usingNames = g.using.map((s) => s.t.toLowerCase()).join(' and ');
  const skipNames = g.skip.map((s) => s.t.toLowerCase()).join(' and ');

  return (
    <rro.RevealFrame label="Reveal · D · Editorial" footer={<rro.PrimaryNext label="See my full plan" sub="Your camp is built — yours to keep." />}>
      <div style={{ flex: 1, display: 'flex', flexDirection: 'column', padding: '30px 26px 30px' }}>

        {/* ══ goal echo ══ */}
        <div style={{ fontFamily: 'var(--mono)', fontSize: 9.5, letterSpacing: '0.16em', textTransform: 'uppercase', color: 'var(--ink-3)', fontWeight: 700 }}>{d.sport} · {c.weighShort} weigh-in · {d.weeks} wks out</div>
        <div style={{ fontFamily: 'var(--sans)', fontSize: 22, fontWeight: 700, letterSpacing: '-0.025em', lineHeight: 1.18, color: 'var(--ink)', textWrap: 'balance', marginTop: 12 }}>
          {d.firstName ? `${d.firstName}, your ` : 'Your '}safe line to make {divisionLabel} by <span style={{ color: 'var(--accent)' }}>{dateStr}</span>.
        </div>

        {/* ══ THE NUMBER — editorial hero, no card ══ */}
        <div style={{ marginTop: 34, display: 'flex', alignItems: 'flex-end', gap: 16 }}>
          {Num ? <Num size={104} weight={200} color="var(--ink)">{d.targetW.toFixed(1)}</Num> : null}
          <div style={{ paddingBottom: 14 }}>
            <div style={{ fontFamily: 'var(--mono)', fontSize: 13, color: 'var(--ink-3)', fontWeight: 600, letterSpacing: '0.08em' }}>KG</div>
            <div style={{ fontFamily: 'var(--num)', fontWeight: 500, fontSize: 20, letterSpacing: '-0.02em', color: 'var(--accent)', marginTop: 6 }}>−{d.cut.toFixed(1)}</div>
          </div>
        </div>
        <div style={{ marginTop: 10, display: 'flex', alignItems: 'center', gap: 10, fontFamily: 'var(--mono)', fontSize: 10, letterSpacing: '0.08em', textTransform: 'uppercase', fontWeight: 600, color: 'var(--ink-3)' }}>
          <span style={{ display: 'inline-flex', alignItems: 'center', gap: 6, color: RRO_GREEN }}><span style={{ width: 6, height: 6, borderRadius: '50%', background: RRO_GREEN }} />Safe pace</span>
          <span style={{ color: 'var(--rule-2)' }}>·</span>
          <span>{d.ratePct.toFixed(2)}%/wk — under the 1% ceiling</span>
        </div>

        {/* ══ THE PROOF — one chart, the trend under the daily noise ══ */}
        {HeroGlide && (
          <div style={{ marginTop: 30 }}>
            <HeroGlide c={c} width={341} height={172} annotate={false} />
          </div>
        )}

        {/* ══ THE READ — its own labelled beat ══ */}
        <div style={{ marginTop: 30, paddingTop: 26, borderTop: '1px solid var(--rule)' }}>
          <div style={{ fontFamily: 'var(--mono)', fontSize: 9.5, letterSpacing: '0.14em', textTransform: 'uppercase', color: 'var(--accent)', fontWeight: 700 }}>The read</div>
          <div style={{ fontFamily: 'var(--sans)', fontSize: 18.5, fontWeight: 600, lineHeight: 1.34, color: 'var(--ink)', letterSpacing: '-0.01em', textWrap: 'balance', marginTop: 12 }}>{c.tip.headline}</div>
          <div style={{ fontFamily: 'var(--sans)', fontSize: 14, lineHeight: 1.6, color: 'var(--ink-2)', marginTop: 11, textWrap: 'pretty' }}>{c.tip.body}</div>
        </div>

        {/* ══ STRATEGY — labelled beat; scannable rows grouped Using / Capped / Skipping ══ */}
        <div style={{ marginTop: 28, paddingTop: 26, borderTop: '1px solid var(--rule)' }}>
          <div style={{ fontFamily: 'var(--mono)', fontSize: 9.5, letterSpacing: '0.14em', textTransform: 'uppercase', color: 'var(--accent)', fontWeight: 700 }}>Cut strategy</div>
          <div style={{ fontFamily: 'var(--sans)', fontSize: 14, lineHeight: 1.55, color: 'var(--ink-2)', marginTop: 11, textWrap: 'pretty' }}>{stratIntro}</div>

          <div style={{ marginTop: 20, display: 'flex', flexDirection: 'column', gap: 18 }}>
            <div>
              <div style={{ fontFamily: 'var(--mono)', fontSize: 9, letterSpacing: '0.14em', textTransform: 'uppercase', fontWeight: 700, color: RRO_GREEN, marginBottom: 12 }}>Using</div>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 13 }}>
                {g.using.map((s, i) => (
                  <div key={i} style={{ display: 'flex', gap: 12, alignItems: 'flex-start' }}>
                    <RROTick />
                    <div style={{ flex: 1, minWidth: 0 }}>
                      <div style={{ fontFamily: 'var(--sans)', fontSize: 15, fontWeight: 600, color: 'var(--ink)' }}>{s.t}</div>
                      <div style={{ fontFamily: 'var(--sans)', fontSize: 13, color: 'var(--ink-3)', lineHeight: 1.45, marginTop: 1 }}>{s.s}</div>
                    </div>
                  </div>
                ))}
              </div>
            </div>

            {g.cap.length > 0 && (
              <div>
                <div style={{ fontFamily: 'var(--mono)', fontSize: 9, letterSpacing: '0.14em', textTransform: 'uppercase', fontWeight: 700, color: RRO_AMBER, marginBottom: 12 }}>Capped</div>
                <div style={{ display: 'flex', gap: 12, alignItems: 'flex-start' }}>
                  <span style={{ flexShrink: 0, marginTop: 3, width: 16, height: 16, borderRadius: '50%', border: `1.5px solid ${RRO_AMBER}`, display: 'flex', alignItems: 'center', justifyContent: 'center' }}><span style={{ width: 6, height: 2, borderRadius: 2, background: RRO_AMBER }} /></span>
                  <div style={{ flex: 1, minWidth: 0 }}>
                    <div style={{ fontFamily: 'var(--sans)', fontSize: 15, fontWeight: 600, color: 'var(--ink)' }}>{g.cap[0].t}</div>
                    <div style={{ fontFamily: 'var(--sans)', fontSize: 13, color: 'var(--ink-3)', lineHeight: 1.45, marginTop: 1 }}>{g.cap[0].s}</div>
                  </div>
                </div>
              </div>
            )}

            {g.skip.length > 0 && (
              <div>
                <div style={{ fontFamily: 'var(--mono)', fontSize: 9, letterSpacing: '0.14em', textTransform: 'uppercase', fontWeight: 700, color: 'var(--ink-3)', marginBottom: 8 }}>Skipping</div>
                <div style={{ fontFamily: 'var(--sans)', fontSize: 14, lineHeight: 1.55, color: 'var(--ink-2)', textWrap: 'pretty' }}>
                  <strong style={{ fontWeight: 700, color: 'var(--ink)' }}>{g.skip.map((s) => s.t).join(' and ')}</strong> — hard to time and not worth the muscle. We leave them off.
                </div>
              </div>
            )}
          </div>
        </div>

        <div style={{ flex: 1 }} />

        {/* ══ LOCKED — quiet close ══ */}
        <div style={{ marginTop: 30, paddingTop: 20, borderTop: '1px solid var(--rule)', display: 'flex', alignItems: 'center', gap: 11 }}>
          <svg width="15" height="16" viewBox="0 0 12 13" fill="none" style={{ flexShrink: 0 }}><rect x="1.5" y="5.5" width="9" height="6.5" rx="1.5" stroke="var(--ink-3)" strokeWidth="1.2" /><path d="M3.5 5.5 V4 a2.5 2.5 0 0 1 5 0 V5.5" stroke="var(--ink-3)" strokeWidth="1.2" /></svg>
          <span style={{ fontFamily: 'var(--sans)', fontSize: 13.5, color: 'var(--ink-2)', flex: 1 }}>Your day-by-day plan for all {d.weeks * 7} days is ready.</span>
        </div>

      </div>
    </rro.RevealFrame>
  );
}

// ── FIGHT-WEEK CUT STRATEGY CHART ─────────────────────────────────────────
// A fight-week timeline. Coloured section bands mark the stages in the order &
// rough timing a combat athlete runs them: water load → low-fibre → low sodium
// → sweat/sauna → weigh-in. The line holds flat through the water-load plateau
// then steps down through each water tactic, landing exactly on make-weight.
// Grounded in the app's logic — fight-week water = cut × 0.28 (d.fwWater), split
// across the three tactics by typical yield (fibre ~1% bw, sodium ~0.75%, sauna ~1%).
// monotone cubic (Fritsch–Carlson) through x-increasing points — smooth but
// never overshoots, so a descent can't bow below the make-weight floor.
function _rroMono(pts) {
  const n = pts.length;
  if (n < 2) return '';
  const xs = pts.map((p) => p[0]), ys = pts.map((p) => p[1]);
  const dx = [], sl = [];
  for (let i = 0; i < n - 1; i++) { dx[i] = xs[i + 1] - xs[i]; sl[i] = (ys[i + 1] - ys[i]) / dx[i]; }
  const m = [sl[0]];
  for (let i = 1; i < n - 1; i++) {
    if (sl[i - 1] * sl[i] <= 0) { m[i] = 0; }
    else { const w1 = 2 * dx[i] + dx[i - 1], w2 = dx[i] + 2 * dx[i - 1]; m[i] = (w1 + w2) / (w1 / sl[i - 1] + w2 / sl[i]); }
  }
  m[n - 1] = sl[n - 2];
  let path = `M ${xs[0].toFixed(2)} ${ys[0].toFixed(2)}`;
  for (let i = 0; i < n - 1; i++) {
    const c1x = xs[i] + dx[i] / 3, c1y = ys[i] + m[i] * dx[i] / 3;
    const c2x = xs[i + 1] - dx[i] / 3, c2y = ys[i + 1] - m[i + 1] * dx[i] / 3;
    path += ` C ${c1x.toFixed(2)} ${c1y.toFixed(2)}, ${c2x.toFixed(2)} ${c2y.toFixed(2)}, ${xs[i + 1].toFixed(2)} ${ys[i + 1].toFixed(2)}`;
  }
  return path;
}

// One combined plan: the whole cut on a single timeline — real weight coming
// off gradually across camp, then the fight-week water tactics (low-fibre, low
// sodium, sweat/sauna) stepping the last kilos off, landing on make-weight.
function RROStrategyDescent({ d, width = 341, height = 244 }) {
  const fwWater = d.fwWater || 0;
  const target = d.targetW;
  const campKg = d.campKg != null ? d.campKg : Math.max(0, (d.cut || 0) - fwWater);
  const hasWater = !!d.water && fwWater > 0;
  const startW = +(target + campKg + fwWater).toFixed(1);
  const fwStart = +(target + fwWater).toFixed(1);
  const yields = [1.0, 0.75, 1.0];
  const ysum = yields[0] + yields[1] + yields[2];
  const drops = yields.map((y) => fwWater * y / ysum);

  // stages left→right: the camp (real weight, the bulk) then the fight-week tactics
  const bands = hasWater ? [
    { name: 'Camp · real weight', frac: 0.44, drop: campKg,   color: '#4f7a86', camp: true },
    { name: 'Low-fibre',          frac: 0.17, drop: drops[0], color: '#6b8f5a' },
    { name: 'Low sodium',         frac: 0.16, drop: drops[1], color: '#c79a3a' },
    { name: 'Sweat / sauna',      frac: 0.23, drop: drops[2], color: 'var(--accent)' },
  ] : [
    { name: 'Camp · real weight', frac: 1, drop: campKg + fwWater, color: '#4f7a86', camp: true },
  ];
  const boundaryWhen = hasWater
    ? ['Start', 'Fight wk', '48h', '24h', 'Weigh-in']
    : ['Start', 'Weigh-in'];

  const W = width, H = height, padL = 12, padR = 42, padT = 34, padB = 30;
  const innerW = W - padL - padR, innerH = H - padT - padB;
  const bandTop = padT, bandBot = H - padB;

  const xs = [padL];
  bands.forEach((b) => xs.push(+(xs[xs.length - 1] + b.frac * innerW).toFixed(2)));
  // boundary weights (for nodes / dividers)
  const wts = [startW];
  let cur = startW;
  bands.forEach((b) => { cur = +(cur - b.drop).toFixed(3); wts.push(cur); });

  const span = Math.max(0.4, startW - target);
  const wTop = startW + span * 0.10, wBot = target - span * 0.16;
  const yAt = (w) => bandTop + innerH * (1 - (w - wBot) / (wTop - wBot));

  // line points: the camp band is sampled into an eased curve (loss decelerates);
  // the fight-week bands stay as clean straight steps between boundaries.
  const linePts = [[xs[0], yAt(startW)]];
  bands.forEach((b, i) => {
    if (b.camp) {
      const n = 4, x0 = xs[i], w0 = wts[i];
      for (let k = 1; k <= n; k++) {
        const t = k / n, ease = 1 - Math.pow(1 - t, 1.8);
        linePts.push([x0 + (xs[i + 1] - x0) * t, yAt(w0 - b.drop * ease)]);
      }
    } else {
      linePts.push([xs[i + 1], yAt(wts[i + 1])]);
    }
  });
  const linePath = _rroMono(linePts);
  const yTarget = yAt(target);
  const yStart = yAt(startW);

  return (
    <svg width="100%" viewBox={`0 0 ${W} ${H}`} style={{ display: 'block', overflow: 'visible' }} role="img" aria-label={`Full cut plan from ${startW} to ${target} kg: ${campKg.toFixed(1)} kg of real weight off across camp${hasWater ? `, then ${fwWater.toFixed(1)} kg of water off in fight week via low-fibre, low sodium and sweat/sauna` : ''}.`}>
      {/* coloured section bands — quiet backdrop */}
      {bands.map((b, i) => (
        <rect key={i} x={xs[i]} y={bandTop} width={xs[i + 1] - xs[i]} height={bandBot - bandTop} fill={b.color} opacity="0.09" />
      ))}
      {/* thin band dividers */}
      {xs.slice(1, -1).map((x, i) => (
        <line key={i} x1={x} y1={bandTop} x2={x} y2={bandBot} stroke="var(--paper-2)" strokeWidth="1" opacity="0.7" />
      ))}

      {/* stage names ABOVE the plot, centred in each band */}
      {bands.map((b, i) => (
        <text key={i} x={(xs[i] + xs[i + 1]) / 2} y={padT - 11} textAnchor="middle" style={{ fontFamily: 'var(--mono)', fontSize: 7.2, letterSpacing: '0.03em', textTransform: 'uppercase', fontWeight: 700, fill: b.color }}>{b.name}</text>
      ))}

      {/* start weight guide */}
      <line x1={padL} y1={yStart} x2={W - padR} y2={yStart} stroke="var(--ink-3)" strokeWidth="1" strokeDasharray="2 3" opacity="0.4" />

      {/* make-weight floor */}
      <line x1={padL} y1={yTarget} x2={W - padR} y2={yTarget} stroke="var(--accent)" strokeWidth="1" strokeDasharray="2 4" opacity="0.55" />

      {/* the descent — smooth monotone curve */}
      <path d={linePath} fill="none" stroke="var(--ink)" strokeWidth="2.4" strokeLinejoin="round" strokeLinecap="round" />

      {/* nodes; weigh-in gets the emphasis */}
      {wts.map((w, i) => {
        const last = i === wts.length - 1;
        return <circle key={i} cx={xs[i]} cy={yAt(w)} r={last ? 5 : 3.2} fill={last ? 'var(--accent)' : 'var(--ink)'} stroke="var(--paper)" strokeWidth="2" />;
      })}

      {/* timing ticks at the boundaries, below the plot */}
      {xs.map((x, i) => {
        const last = i === xs.length - 1;
        return (
          <text key={i} x={x} y={H - padB + 16} textAnchor={i === 0 ? 'start' : last ? 'end' : 'middle'} style={{ fontFamily: 'var(--mono)', fontSize: 8, letterSpacing: '0.04em', textTransform: 'uppercase', fontWeight: last ? 700 : 500, fill: last ? 'var(--accent)' : 'var(--ink-3)' }}>{boundaryWhen[i]}</text>
        );
      })}
    </svg>
  );
}

// ════════════════════════════════════════════════════════════════════════════
// E · EDITORIAL + STRATEGY DESCENT — the D layout, but the proof is the cut-
// strategy graph: fight-week weight stepping down as low-fibre, low sodium and
// sweat/sauna come in. No trend chart, no pace-vs-ceiling caption.
// ════════════════════════════════════════════════════════════════════════════
function RevealRecommendedE() {
  const data = rro.usePosterData();
  const { c, d, strats, stratIntro } = data;
  if (!c.tip) return null;
  const { Num } = rro;
  const g = rroStratGroups(strats);
  const divisionLabel = d.division || d.sport;
  const dateStr = c.FC.fightDateShort || 'Jan 1';

  return (
    <rro.RevealFrame label="Reveal · E · Editorial + strategy descent" footer={<rro.PrimaryNext label="See my full plan" sub="Your camp is built — yours to keep." />}>
      <div style={{ flex: 1, display: 'flex', flexDirection: 'column', padding: '30px 26px 30px' }}>

        {/* ══ goal echo ══ */}
        <div style={{ fontFamily: 'var(--mono)', fontSize: 9.5, letterSpacing: '0.16em', textTransform: 'uppercase', color: 'var(--ink-3)', fontWeight: 700 }}>{d.sport} · {c.weighShort} weigh-in · {d.weeks} wks out</div>
        <div style={{ fontFamily: 'var(--sans)', fontSize: 22, fontWeight: 700, letterSpacing: '-0.025em', lineHeight: 1.18, color: 'var(--ink)', textWrap: 'balance', marginTop: 12 }}>
          {d.firstName ? `${d.firstName}, your ` : 'Your '}safe line to make {divisionLabel} by <span style={{ color: 'var(--accent)' }}>{dateStr}</span>.
        </div>

        {/* ══ THE NUMBER — editorial hero; KG baseline-aligned to the number ══ */}
        <div style={{ marginTop: 32, display: 'flex', alignItems: 'flex-end', gap: 10 }}>
          {Num ? <Num size={104} weight={200} color="var(--ink)">{d.targetW.toFixed(1)}</Num> : null}
          <span style={{ fontFamily: 'var(--mono)', fontSize: 15, color: 'var(--ink-3)', fontWeight: 600, letterSpacing: '0.08em', paddingBottom: 15 }}>KG</span>
        </div>
        <div style={{ marginTop: 12, display: 'flex', alignItems: 'center', gap: 10, fontFamily: 'var(--mono)', fontSize: 10, letterSpacing: '0.06em', textTransform: 'uppercase', fontWeight: 600, color: 'var(--ink-3)' }}>
          <span style={{ display: 'inline-flex', alignItems: 'center', gap: 6, color: RRO_GREEN }}><span style={{ width: 6, height: 6, borderRadius: '50%', background: RRO_GREEN }} />Safe pace</span>
          <span style={{ color: 'var(--rule-2)' }}>·</span>
          <span style={{ color: 'var(--ink-2)' }}>−{d.cut.toFixed(1)} kg in {d.weeks} weeks</span>
        </div>

        {/* ══ THE READ — editorial (no box); the sport read + what this cut protects,
             combined. Bespoke to the sport and their pace. ══ */}
        {(() => {
          const pr = (rro.FC_SPORT_PROTECT || {})[d.sport] || (rro.FC_SPORT_PROTECT || {}).Other || { protect: 'your strength and stamina across the whole fight.' };
          const safe = d.ratePct <= (rro.SAFE_RATE_PCT || 1.0) + 0.005;
          return (
            <div style={{ marginTop: 24 }}>
              <div style={{ fontFamily: 'var(--sans)', fontSize: 18.5, fontWeight: 600, lineHeight: 1.34, color: 'var(--ink)', letterSpacing: '-0.01em', textWrap: 'balance' }}>{c.tip.headline}</div>
              <div style={{ fontFamily: 'var(--sans)', fontSize: 14, lineHeight: 1.6, color: 'var(--ink-2)', marginTop: 11, textWrap: 'pretty' }}>{c.tip.body}</div>
              <div style={{ fontFamily: 'var(--sans)', fontSize: 14, lineHeight: 1.6, color: 'var(--ink-2)', marginTop: 11, textWrap: 'pretty' }}>
                {pr.protect}{' '}
                {safe
                  ? <React.Fragment>At <strong style={{ fontWeight: 600, color: 'var(--ink)' }}>{d.ratePct.toFixed(2)}%/wk</strong> you’re inside the safe line, so the weight comes off as fat, not muscle — that stays intact.</React.Fragment>
                  : <React.Fragment>At <strong style={{ fontWeight: 600, color: 'var(--ink)' }}>{d.ratePct.toFixed(2)}%/wk</strong> you’re past the 1%/wk line — the point where that starts to erode. Give the cut more time and it holds.</React.Fragment>}
              </div>
            </div>
          );
        })()}

        {/* ══ CUT STRATEGY — one merged beat: the recommended personalised cut on one
             timeline (real weight across camp → fight-week water tactics), then the
             Using / Capped / Skipping breakdown. ══ */}
        <div style={{ marginTop: 28, paddingTop: 26, borderTop: '1px solid var(--rule)' }}>
          <div style={{ fontFamily: 'var(--mono)', fontSize: 9.5, letterSpacing: '0.14em', textTransform: 'uppercase', color: 'var(--accent)', fontWeight: 700 }}>Recommended cut strategy</div>
          <div style={{ fontFamily: 'var(--sans)', fontSize: 18.5, fontWeight: 700, letterSpacing: '-0.02em', lineHeight: 1.25, color: 'var(--ink)', marginTop: 10, textWrap: 'balance' }}>{d.firstName ? `${d.firstName}, your` : 'Your'} personalised {(!!d.water && (d.fwWater || 0) > 0) ? 'fight-week ' : ''}cut strategy</div>
          <div style={{ fontFamily: 'var(--sans)', fontSize: 14, lineHeight: 1.55, color: 'var(--ink-2)', marginTop: 10, textWrap: 'pretty' }}>{stratIntro}</div>

          {/* the whole cut on one timeline — real weight across camp, then fight-week water */}
          <div style={{ marginTop: 18 }}>
            <RROStrategyDescent d={d} width={341} height={244} />
          </div>
          {/* what's been done vs what sharpens later — the honest split */}
          <div style={{ marginTop: 14, display: 'flex', flexDirection: 'column', gap: 10 }}>
            <div style={{ display: 'flex', gap: 10, alignItems: 'baseline' }}>
              <span style={{ flexShrink: 0, width: 92, fontFamily: 'var(--mono)', fontSize: 8.5, letterSpacing: '0.08em', textTransform: 'uppercase', fontWeight: 700, color: RRO_GREEN }}>What's set</span>
              <div style={{ flex: 1, fontFamily: 'var(--sans)', fontSize: 12.5, lineHeight: 1.5, color: 'var(--ink-2)', textWrap: 'pretty' }}>
                {d.campKg.toFixed(1)} kg of real weight comes off across camp{(!!d.water && (d.fwWater || 0) > 0) ? `, then the final ${d.fwWater.toFixed(1)} kg is water in fight week` : ''} — that's your recommended cut strategy today.
              </div>
            </div>
            <div style={{ display: 'flex', gap: 10, alignItems: 'baseline' }}>
              <span style={{ flexShrink: 0, width: 92, fontFamily: 'var(--mono)', fontSize: 8.5, letterSpacing: '0.08em', textTransform: 'uppercase', fontWeight: 700, color: 'var(--accent)' }}>Sharpens later</span>
              <div style={{ flex: 1, fontFamily: 'var(--sans)', fontSize: 12.5, lineHeight: 1.5, color: 'var(--ink-2)', textWrap: 'pretty' }}>
                We refine the pace and the fight-week tactics week to week as you log — this is the starting line, not the final call.
              </div>
            </div>
          </div>

          <div style={{ marginTop: 22, paddingTop: 20, borderTop: '1px solid var(--rule)', display: 'flex', flexDirection: 'column', gap: 18 }}>
            <div>
              <div style={{ fontFamily: 'var(--mono)', fontSize: 9, letterSpacing: '0.14em', textTransform: 'uppercase', fontWeight: 700, color: RRO_GREEN, marginBottom: 12 }}>Using</div>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 13 }}>
                {g.using.map((s, i) => (
                  <div key={i} style={{ display: 'flex', gap: 12, alignItems: 'flex-start' }}>
                    <RROTick />
                    <div style={{ flex: 1, minWidth: 0 }}>
                      <div style={{ fontFamily: 'var(--sans)', fontSize: 15, fontWeight: 600, color: 'var(--ink)' }}>{s.t}</div>
                      <div style={{ fontFamily: 'var(--sans)', fontSize: 13, color: 'var(--ink-3)', lineHeight: 1.45, marginTop: 1 }}>{s.s}</div>
                    </div>
                  </div>
                ))}
              </div>
            </div>

            {g.cap.length > 0 && (
              <div>
                <div style={{ fontFamily: 'var(--mono)', fontSize: 9, letterSpacing: '0.14em', textTransform: 'uppercase', fontWeight: 700, color: RRO_AMBER, marginBottom: 12 }}>Capped</div>
                <div style={{ display: 'flex', gap: 12, alignItems: 'flex-start' }}>
                  <span style={{ flexShrink: 0, marginTop: 3, width: 16, height: 16, borderRadius: '50%', border: `1.5px solid ${RRO_AMBER}`, display: 'flex', alignItems: 'center', justifyContent: 'center' }}><span style={{ width: 6, height: 2, borderRadius: 2, background: RRO_AMBER }} /></span>
                  <div style={{ flex: 1, minWidth: 0 }}>
                    <div style={{ fontFamily: 'var(--sans)', fontSize: 15, fontWeight: 600, color: 'var(--ink)' }}>{g.cap[0].t}</div>
                    <div style={{ fontFamily: 'var(--sans)', fontSize: 13, color: 'var(--ink-3)', lineHeight: 1.45, marginTop: 1 }}>{g.cap[0].s}</div>
                  </div>
                </div>
              </div>
            )}

            {g.skip.length > 0 && (
              <div>
                <div style={{ fontFamily: 'var(--mono)', fontSize: 9, letterSpacing: '0.14em', textTransform: 'uppercase', fontWeight: 700, color: 'var(--ink-3)', marginBottom: 8 }}>Skipping</div>
                <div style={{ fontFamily: 'var(--sans)', fontSize: 14, lineHeight: 1.55, color: 'var(--ink-2)', textWrap: 'pretty' }}>
                  <strong style={{ fontWeight: 700, color: 'var(--ink)' }}>{g.skip.map((s) => s.t).join(' and ')}</strong> — hard to time and not worth the muscle. We leave them off.
                </div>
              </div>
            )}
          </div>
        </div>

        <div style={{ flex: 1 }} />

        {/* ══ LOCKED — quiet close ══ */}
        <div style={{ marginTop: 30, paddingTop: 20, borderTop: '1px solid var(--rule)', display: 'flex', alignItems: 'center', gap: 11 }}>
          <svg width="15" height="16" viewBox="0 0 12 13" fill="none" style={{ flexShrink: 0 }}><rect x="1.5" y="5.5" width="9" height="6.5" rx="1.5" stroke="var(--ink-3)" strokeWidth="1.2" /><path d="M3.5 5.5 V4 a2.5 2.5 0 0 1 5 0 V5.5" stroke="var(--ink-3)" strokeWidth="1.2" /></svg>
          <span style={{ fontFamily: 'var(--sans)', fontSize: 13.5, color: 'var(--ink-2)', flex: 1 }}>Your day-by-day plan for all {d.weeks * 7} days is ready.</span>
        </div>

      </div>
    </rro.RevealFrame>
  );
}

// ════════════════════════════════════════════════════════════════════════════
// ★ MERGED — the chosen direction: merges 9 + 10 + E.
//   · Top: E's editorial masthead through the safe-pace line.
//   · "Your target": #9's card, bespoke like E, concise — proves it's built from
//     their answers by citing the derived numbers, never by claiming it.
//   · "Why you can trust it": #10's trend-not-noise proof chart.
//   · "Your camp is set": locked plan — ready now, more sharpens as they go.
//   · "Sharpens in setup": #10's levers, all open, no selector circle. The cut
//     strategy proves it's bespoke to this fighter / sport / gender / formulas.
// ════════════════════════════════════════════════════════════════════════════

// bespoke cut strategy — used tactics are little green versions of the skip
// treatment (same compact row, green marker); skipped ones keep the muted ✕.
// No "Cap": sweat/sauna is a Use with its 5%-bodyweight ceiling in the detail.
function MergedStrategyBody({ data }) {
  const { c, d, strats } = data;
  const sex = window.__sex || (window.FC && window.FC.sex) || 'M';
  const use = strats.filter((s) => s.tone !== 'red');
  const skip = strats.filter((s) => s.tone === 'red');
  const Row = ({ green, t, s }) => (
    <div style={{ display: 'flex', gap: 11, alignItems: 'flex-start' }}>
      <span style={{ flexShrink: 0, marginTop: 2, width: 17, height: 17, borderRadius: '50%', display: 'flex', alignItems: 'center', justifyContent: 'center', background: green ? RRO_GREEN : 'transparent', border: green ? 'none' : '1.5px solid var(--rule-2)' }}>
        {green
          ? <svg width="8" height="6.5" viewBox="0 0 11 9" fill="none"><path d="M1 4.5 L4 7.5 L10 1" stroke="#fff" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round" /></svg>
          : <svg width="7" height="7" viewBox="0 0 8 8" fill="none"><path d="M1 1 L7 7 M7 1 L1 7" stroke="var(--ink-3)" strokeWidth="1.3" strokeLinecap="round" /></svg>}
      </span>
      <div style={{ flex: 1, minWidth: 0 }}>
        <div style={{ fontFamily: 'var(--sans)', fontSize: 13.5, fontWeight: 600, color: green ? 'var(--ink)' : 'var(--ink-2)' }}>{t}</div>
        <div style={{ fontFamily: 'var(--sans)', fontSize: 12, color: 'var(--ink-3)', marginTop: 1, lineHeight: 1.4 }}>{s}</div>
      </div>
    </div>
  );
  return (
    <React.Fragment>
      {/* why THIS strategy — proves it's derived from their sport, weigh-in rule, formulas, sex */}
      <div style={{ fontFamily: 'var(--sans)', fontSize: 12.5, lineHeight: 1.5, color: 'var(--ink-2)', textWrap: 'pretty' }}>
        Your <strong style={{ fontWeight: 600 }}>{d.sport}</strong> weighs in {c.weighPhrase || (d.water ? 'the day before' : 'the same day')} — {d.water
          ? <>{d.rehyd}, so a measured water taper is safe on top of your {d.campKg.toFixed(1)} kg real-weight base. Sweat stays capped at <strong style={{ fontWeight: 600 }}>5% of bodyweight</strong>, inside that window.</>
          : <>no rehydration window, so every kilo is real weight. Water tricks are ruled out.</>}
        {sex === 'F' && <> Because you train through a cycle, we hold these targets against your luteal-phase water — a hormonal swing never reads as behind.</>}
      </div>
      <div style={{ marginTop: 14, display: 'flex', flexDirection: 'column', gap: 12 }}>
        {use.map((s, i) => <Row key={'u' + i} green t={s.t} s={s.s} />)}
        {skip.map((s, i) => <Row key={'s' + i} t={s.t} s={s.s} />)}
      </div>
    </React.Fragment>
  );
}

function RevealMerged() {
  const data = rro.usePosterData();
  const { c, d, strats } = data;
  if (!c.tip) return null;
  const { Num, Card, SectionHeader, Stat, PlanTicks, PosterGlide, TrendLegend } = rro;
  const { locked, total } = data;
  const divisionLabel = d.division || d.sport;
  const dateStr = c.FC.fightDateShort || 'Jan 1';
  const pr = (rro.FC_SPORT_PROTECT || {})[d.sport] || (rro.FC_SPORT_PROTECT || {}).Other || { tag: 'Strength · gas', protect: 'your strength and stamina across the whole fight.' };
  const tagPhrase = pr.tag.toLowerCase().replace(/\s*·\s*/, ' and ').replace(/^your\s+/, '');

  // sharpen levers — reuse the shared set, but swap in the bespoke cut strategy.
  // Each carries its own CTA — the actual setup step that sharpens it.
  const MERGED_CTA = { strategy: 'Review my cut strategy', rules: 'Confirm my rules', cycle: 'Set up cycle tracking', weighin: 'Set my weigh-in time' };
  const levers = rro.buildLevers(data).map((lv) => ({
    ...lv,
    cta: MERGED_CTA[lv.key] || 'Set this up',
    body: lv.key === 'strategy' ? <MergedStrategyBody data={data} /> : lv.body,
  }));

  return (
    <rro.RevealFrame label="Reveal · ★ Merged" footer={<rro.PrimaryNext label="See my full plan" sub="Your camp is ready — yours to keep." />}>
      <div style={{ flex: 1, display: 'flex', flexDirection: 'column', padding: '30px 24px 28px', gap: 24 }}>

        {/* ══ TOP — from E, through the safe-pace line ══ */}
        <div>
          <div style={{ fontFamily: 'var(--mono)', fontSize: 9.5, letterSpacing: '0.16em', textTransform: 'uppercase', color: 'var(--ink-3)', fontWeight: 700 }}>{d.sport} · {c.weighShort} weigh-in · {d.weeks} wks out</div>
          <div style={{ fontFamily: 'var(--sans)', fontSize: 22, fontWeight: 700, letterSpacing: '-0.025em', lineHeight: 1.18, color: 'var(--ink)', textWrap: 'balance', marginTop: 12 }}>
            {d.firstName ? `${d.firstName}, your ` : 'Your '}safe line to make {divisionLabel} by <span style={{ color: 'var(--accent)' }}>{dateStr}</span>.
          </div>
          <div style={{ marginTop: 32, display: 'flex', alignItems: 'flex-end', gap: 10 }}>
            {Num ? <Num size={104} weight={200} color="var(--ink)">{d.targetW.toFixed(1)}</Num> : null}
            <span style={{ fontFamily: 'var(--mono)', fontSize: 15, color: 'var(--ink-3)', fontWeight: 600, letterSpacing: '0.08em', paddingBottom: 15 }}>KG</span>
          </div>
          <div style={{ marginTop: 12, display: 'flex', alignItems: 'center', gap: 10, fontFamily: 'var(--mono)', fontSize: 10, letterSpacing: '0.06em', textTransform: 'uppercase', fontWeight: 600, color: 'var(--ink-3)' }}>
            <span style={{ display: 'inline-flex', alignItems: 'center', gap: 6, color: RRO_GREEN }}><span style={{ width: 6, height: 6, borderRadius: '50%', background: RRO_GREEN }} />Safe pace</span>
            <span style={{ color: 'var(--rule-2)' }}>·</span>
            <span style={{ color: 'var(--ink-2)' }}>−{d.cut.toFixed(1)} kg in {d.weeks} weeks</span>
          </div>
        </div>

        {/* ══ YOUR TARGET — #9's card, bespoke + concise; proves it's built from their answers ══ */}
        <div>
          <SectionHeader>Your target</SectionHeader>
          <Card pad={20}>
            <div style={{ fontFamily: 'var(--sans)', fontSize: 15, lineHeight: 1.55, color: 'var(--ink)', textWrap: 'pretty' }}>
              Your {divisionLabel} limit is <strong>{d.targetW.toFixed(1)} kg</strong>. From <strong>{d.startW.toFixed(1)} kg</strong> today that&rsquo;s a {d.cut.toFixed(1)} kg cut over {d.weeks} weeks — <strong>{d.ratePct.toFixed(2)}%/wk</strong>, under the 1% line that costs muscle. Paced to protect {tagPhrase}.
            </div>
            <div style={{ display: 'flex', marginTop: 20, paddingTop: 18, borderTop: '1px solid var(--rule)' }}>
              <Stat label="Today" value={d.startW.toFixed(1)} unit="kg" i={0} />
              <Stat label="Make-weight" value={d.targetW.toFixed(1)} unit="kg" color="var(--accent)" i={1} />
              <Stat label="To lose" value={'−' + d.cut.toFixed(1)} unit="kg" color="var(--ink-2)" i={1} />
            </div>
          </Card>
        </div>

        {/* ══ WHY YOU CAN TRUST IT — #10's trend-not-noise proof chart ══ */}
        <div>
          <SectionHeader>Why you can trust it</SectionHeader>
          <Card pad={20}>
            <div style={{ fontFamily: 'var(--sans)', fontSize: 17, fontWeight: 700, lineHeight: 1.25, letterSpacing: '-0.01em', color: 'var(--ink)', textWrap: 'balance' }}>We read the trend, not the noise.</div>
            {PosterGlide && <div style={{ marginTop: 14 }}><PosterGlide c={c} width={313} height={182} /></div>}
            {TrendLegend && <div style={{ marginTop: 12 }}><TrendLegend /></div>}
            <div style={{ fontFamily: 'var(--sans)', fontSize: 13, lineHeight: 1.5, color: 'var(--ink-2)', marginTop: 12, textWrap: 'pretty' }}>A water spike doesn&rsquo;t move the trend — so it doesn&rsquo;t move your plan. <strong style={{ fontWeight: 600 }}>You train; we do the weight math</strong> and flag you only when it&rsquo;s real.</div>
          </Card>
        </div>

        {/* ══ YOUR CAMP IS SET — locked plan, ready now with more to refine ══ */}
        <div>
          <SectionHeader>Your camp is set</SectionHeader>
          <Card pad={20}>
            <PlanTicks locked={locked} total={total} />
            <div style={{ marginTop: 16, paddingTop: 14, borderTop: '1px solid var(--rule)', fontFamily: 'var(--sans)', fontSize: 12.5, lineHeight: 1.5, color: 'var(--ink-3)', textWrap: 'pretty' }}>
              Ready to run today. The rest sharpens as you set up camp and start logging — nothing&rsquo;s locked for good.
            </div>
          </Card>
        </div>

        {/* ══ SHARPENS IN SETUP — #10's levers, all open, no selector circle ══ */}
        <div>
          <SectionHeader>Sharpens in setup</SectionHeader>
          <div style={{ display: 'flex', flexDirection: 'column', gap: 11 }}>
            {levers.map((lv) => (
              <div key={lv.key} style={{ background: 'var(--paper)', border: '1px solid var(--rule)', borderRadius: 'var(--radius)', boxShadow: 'var(--card-shadow)', overflow: 'hidden' }}>
                <div style={{ padding: '15px 16px 0' }}>
                  <div style={{ fontFamily: 'var(--sans)', fontSize: 14.5, fontWeight: 600, color: 'var(--ink)' }}>{lv.title}</div>
                  <div style={{ fontFamily: 'var(--sans)', fontSize: 12.5, color: 'var(--ink-3)', marginTop: 2, lineHeight: 1.4 }}>{lv.summary}</div>
                </div>
                <div style={{ padding: '13px 16px 16px' }}>
                  <div style={{ borderTop: '1px solid var(--rule)', paddingTop: 13 }}>{lv.body}</div>
                  <button style={{ marginTop: 15, display: 'inline-flex', alignItems: 'center', gap: 7, background: 'var(--paper-2)', border: '1px solid var(--rule-2)', borderRadius: 100, padding: '8px 14px', cursor: 'pointer', fontFamily: 'var(--sans)', fontSize: 12.5, fontWeight: 600, color: 'var(--ink)' }}>
                    {lv.cta}
                    <svg width="11" height="9" viewBox="0 0 11 9" fill="none"><path d="M1 4.5 H9 M6 1.5 L9 4.5 L6 7.5" stroke="var(--accent)" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" /></svg>
                  </button>
                </div>
              </div>
            ))}
          </div>
        </div>

      </div>
    </rro.RevealFrame>
  );
}

// Shared strategy helpers — also consumed by the ★ Recommended (fc-reveal-recommended.jsx)
// so the two screens group Using / Cap / Skip identically.
Object.assign(window, { RevealRecommendedB, RevealRecommendedC, RevealRecommendedD, RevealRecommendedE, RevealMerged, RROStrategyDescent, rroStratGroups, RROTick, RRO_GREEN, RRO_AMBER });
