function OptionPoolCalc() {
  const [pre, setPre] = React.useState("");
  const [inv, setInv] = React.useState("");
  const [pt, setPt] = React.useState("");
  const [es, setEs] = React.useState("");
  const [ep, setEp] = React.useState("");
  const P = parseNum(pre), I = parseNum(inv), T = parseNum(pt) / 100, S = parseNum(es), E = parseNum(ep);
  const ok = P > 0 && I > 0 && T > 0 && T < 1 && S > 0;
  const r = React.useMemo(() => {
    if (!ok) return null;
    const post = P + I, poolValue = T * post, implied = P - poolValue;
    const fo = implied / post, io = I / post, shuffle = P / post - fo;
    const sfp = S - E, pps = sfp > 0 ? implied / sfp : 0, nis = pps > 0 ? I / pps : 0;
    const inc = Math.max(0, (T * (S + nis) - E) / (1 - T)), tot = S + nis + inc;
    return { post, poolValue, implied, fo, io, shuffle, pps, nis, inc, tot, pool: (E + inc) / tot };
  }, [ok, P, I, T, S, E]);
  return (
    <div className="cx-split">
      <Box title="Inputs" sub="Enter your deal terms below to see how the option pool affects founder dilution, the implied pre-money valuation, and the real price per share.">
        <Cells cols={2}>
          <NumIn id="pre" label="Stated Pre-Money Valuation" pre="$" ph="8,000,000" value={pre} set={setPre} />
          <NumIn id="inv" label="New Investment" pre="$" ph="2,000,000" value={inv} set={setInv} />
        </Cells>
        <Cells cols={3}>
          <NumIn id="pt" label="Option Pool Target (%)" suf="%" dec ph="15" value={pt} set={setPt} />
          <NumIn id="es" label="Existing Total Shares" ph="10,000,000" value={es} set={setEs} />
          <NumIn id="ep" label="Existing Pool Shares" ph="500,000" value={ep} set={setEp} />
        </Cells>
      </Box>
      <div className="cx-stick">
        <Box title="Results" right={<PdfButton ready={ok} />}>
          {!r ? <Empty>Enter all required values above to see the calculated results.</Empty> : <>
            <Cells cols={3}><Res label="Post-Money Valuation" value={fmtD(r.post)} /><Res hi label="Pool Value" value={fmtD(r.poolValue)} /><Res hi label="Implied Pre-Money" value={fmtD(r.implied)} /></Cells>
            <Cells cols={3}><Res label="Founder Effective Ownership" value={fmtP(r.fo)} /><Res label="Investor Ownership" value={fmtP(r.io)} /><Res label="Option Pool (Actual)" value={fmtP(r.pool)} /></Cells>
            <Cells cols={2}><Res label="Shuffle Cost to Founder" value={fmtP(r.shuffle)} /><Res label="Price Per Share" value={fmtD(r.pps)} /></Cells>
            <Cells cols={3}><Res label="New Investor Shares" value={fmtN(r.nis)} /><Res label="Pool Increase Shares" value={fmtN(r.inc)} /><Res label="Total Post-Money Shares" value={fmtN(r.tot)} /></Cells>
            <Bar parts={[["Founders", r.fo, CX_COL[0]], ["Option pool", T, CX_COL[1]], ["New investor", r.io, CX_COL[2]]]} />
          </>}
        </Box>
      </div>
    </div>
  );
}

mountCalc(
  <CalcPage slug="option-pool-calculator" title="Option Pool" hl="Impact Calculator"
    lead={<><strong>The Option Pool Shuffle</strong> is one of the most misunderstood mechanics in venture financing. When a VC requires an option pool to be carved out of the pre-money valuation, the effective pre-money for founders is significantly lower than the stated number. This calculator reveals the true impact.</>}
    how={<>
      <h2>Understanding The Option Pool Shuffle</h2>
      <p><strong>The Option Pool Shuffle</strong> is a term coined by venture capitalist Venture Hacks to describe how VCs negotiate option pools into the pre-money valuation, effectively lowering the real price founders receive for their shares. It is one of the most impactful but least understood terms in a venture term sheet.</p>
      <p>Here is how it works: the VC offers you an <strong>$8M pre-money</strong> valuation with a $2M investment. Sounds like founders own $8M / $10M = 80%, right? Not quite. The VC also requires a 15% option pool to be created from the pre-money. The pool is worth 15% of $10M = $1.5M, which comes entirely out of the founders' side. The founders' effective pre-money is actually $8M - $1.5M = <strong>$6.5M</strong>.</p>
      <p>The <strong>implied pre-money valuation</strong> (after the pool carve-out) is what actually determines the price per share and founder dilution. A stated $8M pre-money with a 15% pool is economically equivalent to a $6.5M pre-money with no pool requirement. The difference is the "shuffle cost" — extra dilution founders absorb that is hidden in the option pool requirement.</p>
      <p><strong>Why do VCs do this?</strong> From the VC's perspective, they want the company to have enough equity reserved to hire key employees without needing to come back to the board for more shares. But by requiring the pool to come from pre-money, the cost is borne entirely by existing shareholders (founders), not shared with the new investors.</p>
      <p><strong>How to negotiate:</strong> Founders should (1) right-size the pool based on an actual hiring plan rather than accepting arbitrary percentages, (2) negotiate for a smaller pool with the option to increase later, and (3) understand that a higher stated pre-money with a larger pool may be worse than a lower pre-money with a smaller pool. Always calculate the implied pre-money to compare term sheets on an apples-to-apples basis.</p>
    </>}>
    <OptionPoolCalc />
  </CalcPage>
);
