/* global React, ReactDOM */
// Livetell — Landing Page
// Production build of the "Classic paper-journal" hero (v1 in the design bundle,
// the variation the user iterated on in chat and landed on).
// Sections: Nav · Hero (with note→hand phone animation) · Features · Demo · Pricing · Footer.

const { useEffect, useState, useRef } = React;

// Force text presentation on the four card-suit codepoints so iOS/macOS don't
// render them as color emoji (which also ignores our CSS color).
const tx = (s) => String(s).replace(/[\u2660\u2665\u2666\u2663]/g, (c) => c + '\uFE0E');

/* ─── App shell ─────────────────────────────────────────────────────────── */

function App() {
  return (
    <>
      <TopNav />
      <main>
        <Hero />
        <Features id="features" />
        <DemoStrip />
        <TribeSection />
        <FounderNote />
        <Pricing />
      </main>
      <Footer />
    </>
  );
}

/* ─── Top nav ───────────────────────────────────────────────────────────── */

function TopNav() {
  return (
    <header style={{
      position: 'sticky', top: 0, zIndex: 40,
      background: 'rgba(243,239,233,0.88)',
      backdropFilter: 'blur(14px)',
      WebkitBackdropFilter: 'blur(14px)',
      borderBottom: '1px solid rgba(0,0,0,0.06)',
    }}>
      <div style={{
        maxWidth: 1200, margin: '0 auto', padding: '16px 32px',
        display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 24,
      }} className="lt-hero-pad">
        <Logo size={32} />
        <nav className="lt-nav-links" style={{ display: 'flex', alignItems: 'center', gap: 28 }}>
          <a href="#features" style={navLink}>Features</a>
          <a href="#demo" style={navLink}>Live demo</a>
          <a href="#pricing" style={navLink}>Pricing</a>
        </nav>
        <div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
          <a href="https://discord.gg/KuMzZP4RbZ" target="_blank" rel="noopener noreferrer" aria-label="Discord" style={{ color: '#2C2A26', display: 'flex' }}>
            <svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor">
              <path d="M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.947 2.418-2.157 2.418z" />
            </svg>
          </a>
          <a href="https://my.livetell.app" style={ctaBtn}>Go to App →</a>
        </div>
      </div>
    </header>
  );
}

const navLink = {
  fontFamily: 'DM Sans, sans-serif', fontSize: 14, fontWeight: 500,
  color: '#2C2A26', textDecoration: 'none', letterSpacing: '-0.005em',
};
const ctaBtn = {
  background: '#E8642C', color: '#FAF8F5',
  padding: '10px 16px', borderRadius: 10,
  fontFamily: 'DM Sans, sans-serif', fontSize: 14, fontWeight: 600,
  textDecoration: 'none', letterSpacing: '-0.01em',
  boxShadow: '0 1px 2px rgba(60,50,40,0.10)',
};

/* ─── Logo ──────────────────────────────────────────────────────────────── */

function Logo({ size = 32 }) {
  return (
    <div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
      <img
        src="assets/logo-lt.png"
        alt="Livetell"
        width={size}
        height={size}
        style={{ display: 'block', borderRadius: size * 0.22 }}
      />
      <span style={{
        fontFamily: 'DM Sans, sans-serif', fontWeight: 800,
        fontSize: size * 0.58, letterSpacing: '-0.03em', color: '#2C2A26',
      }}>Livetell</span>
    </div>
  );
}

/* ─── Hero ──────────────────────────────────────────────────────────────── */

function Hero() {
  return (
    <section className="lt-hero-pad" style={{ position: 'relative', padding: '72px 32px 64px', overflow: 'hidden' }}>
      {/* ruled-paper whisper */}
      <div aria-hidden="true" style={{
        position: 'absolute', inset: 0, pointerEvents: 'none', opacity: 0.6,
        backgroundImage: 'repeating-linear-gradient(transparent, transparent 31px, rgba(0,0,0,0.03) 31px, rgba(0,0,0,0.03) 32px)',
      }} />
      <div className="lt-hero-grid" style={{
        maxWidth: 1200, margin: '0 auto',
        display: 'grid', gridTemplateColumns: '1.1fr 0.9fr', gap: 64,
        alignItems: 'center', position: 'relative',
      }}>
        <div>
          <div style={{
            display: 'inline-flex', alignItems: 'center', gap: 8,
            padding: '6px 12px', background: 'rgba(232,100,44,0.08)', color: '#E8642C',
            borderRadius: 999, fontFamily: 'DM Sans, sans-serif', fontSize: 11, fontWeight: 700,
            letterSpacing: '0.12em', textTransform: 'uppercase',
          }}>
            <span style={{ width: 5, height: 5, borderRadius: 3, background: '#E8642C' }} />
            A journal for live sessions
          </div>
          <h1 style={{
            fontFamily: 'DM Sans, sans-serif', fontWeight: 800,
            fontSize: 'clamp(44px, 5.4vw, 72px)', lineHeight: 0.98,
            letterSpacing: '-0.04em', color: '#2C2A26', margin: '22px 0 10px',
            textWrap: 'balance',
          }}>
            See&nbsp;
            <span style={{ position: 'relative', display: 'inline-block' }}>
              <span style={{ position: 'relative', zIndex: 1 }}>yourself</span>
              <span style={{
                position: 'absolute', left: -6, right: -6, bottom: 6, height: 18,
                background: 'rgba(232,100,44,0.28)', zIndex: 0, borderRadius: 2,
                transform: 'skew(-4deg)',
              }} />
            </span>
            &nbsp;play.
          </h1>
          <p style={{
            fontFamily: 'DM Sans, sans-serif', fontSize: 18, color: '#5A5750',
            lineHeight: 1.5, maxWidth: 540, marginTop: 20, textWrap: 'pretty',
          }}>
            Livetell is a journal for live poker. Type each hand between hands —
            and on the drive home, see the decisions instead of just the pots.
          </p>
          <div style={{ display: 'flex', alignItems: 'center', gap: 14, marginTop: 32, flexWrap: 'wrap' }}>
            <a href="https://my.livetell.app" style={{
              background: '#E8642C', color: '#FAF8F5',
              padding: '14px 22px', borderRadius: 12,
              fontFamily: 'DM Sans, sans-serif', fontSize: 15, fontWeight: 700,
              textDecoration: 'none', letterSpacing: '-0.01em',
              boxShadow: '0 4px 14px rgba(232,100,44,0.30)',
              display: 'inline-flex', alignItems: 'center', gap: 8,
            }}>Start your journal <span style={{ fontFamily: 'JetBrains Mono, monospace' }}>→</span></a>
          </div>

          <div style={{ marginTop: 40, display: 'flex', gap: 18, alignItems: 'center', flexWrap: 'wrap' }}>
            <Sticker label="No forms to learn" rotate={-2} />
            <Sticker label="Built between hands" color="#5A5750" rotate={1.5} />
          </div>
        </div>

        {/* phone column */}
        <div className="lt-hero-phone" style={{
          position: 'relative', display: 'flex', justifyContent: 'center',
          alignItems: 'center', minHeight: 740,
        }}>
          <svg width="140" height="80" viewBox="0 0 140 80"
               style={{ position: 'absolute', top: 80, left: -40, color: '#E8642C' }} aria-hidden="true">
            <path d="M10 20 C 40 10, 80 25, 115 55" stroke="currentColor" strokeWidth="1.5" fill="none" strokeDasharray="3 4" />
            <path d="M108 48 L 118 58 L 104 60" stroke="currentColor" strokeWidth="1.5" fill="none" strokeLinecap="round" strokeLinejoin="round" />
            <text x="0" y="14" fontFamily="DM Sans, sans-serif" fontSize="13" fontWeight="700" fill="#2C2A26"
                  style={{ letterSpacing: '-0.01em' }}>log the hand live</text>
          </svg>
          <div style={{ transform: 'rotate(3deg)', filter: 'drop-shadow(0 30px 40px rgba(60,50,40,0.20))' }}>
            <PhoneFrame>
              <MiniPhoneNoteToHand />
            </PhoneFrame>
          </div>
        </div>
      </div>
    </section>
  );
}

/* ─── Sticker & PhoneFrame ──────────────────────────────────────────────── */

function Sticker({ label, color = '#E8642C', rotate = -3, style }) {
  return (
    <span style={{
      display: 'inline-flex', alignItems: 'center', gap: 6,
      padding: '5px 10px', borderRadius: 4,
      background: `${color}1A`, color,
      border: `1px dashed ${color}55`,
      fontFamily: 'DM Sans, sans-serif', fontSize: 11, fontWeight: 600,
      letterSpacing: '0.08em', textTransform: 'uppercase',
      transform: `rotate(${rotate}deg)`,
      ...style,
    }}>
      <span style={{ width: 5, height: 5, borderRadius: 1, background: color }} />
      {label}
    </span>
  );
}

function PhoneFrame({ children }) {
  return (
    <div style={{
      width: 320, height: 680, borderRadius: 44,
      background: '#1C1A17', padding: 10,
      boxShadow: `0 30px 60px -20px rgba(60,50,40,0.35), 0 8px 20px rgba(60,50,40,0.18), inset 0 0 0 2px rgba(255,255,255,0.04)`,
      flexShrink: 0, position: 'relative',
    }}>
      <div style={{
        width: '100%', height: '100%', borderRadius: 36,
        background: '#F3EFE9', overflow: 'hidden', position: 'relative',
      }}>
        <div aria-hidden="true" style={{
          position: 'absolute', top: 6, left: '50%', transform: 'translateX(-50%)',
          width: 92, height: 24, background: '#0A0908', borderRadius: 14, zIndex: 10,
        }} />
        {children}
      </div>
    </div>
  );
}

/* ─── Hero phone content: 4-phase note→hand→insight loop ────────────────── */

function MiniPhoneNoteToHand() {
  const PHASES = { BLANK: 0, TYPING: 1, PARSING: 2, SEAL: 3, REPLAY: 4, INSIGHT: 5 };
  const [phase, setPhase] = useState(PHASES.BLANK);
  const [typed, setTyped] = useState(0);
  const [timer, setTimer] = useState(33);

  const noteText =
    "Open BTN 2.5bb with AsKd. BB 3-bets to 10bb — I flat IP.\n" +
    "Flop Kd 7s 2h — he c-bets 1/3, I call.\n" +
    "Turn 4c — check/check.\n" +
    "River Ah — he bets 1/2, I jam. Snap, AQ. Won 30k.\n" +
    "---";

  useEffect(() => {
    let cancelled = false;
    const wait = (ms) => new Promise(r => setTimeout(r, ms));
    const run = async () => {
      while (!cancelled) {
        setPhase(PHASES.BLANK); setTyped(0);
        await wait(1600); if (cancelled) return;

        setPhase(PHASES.TYPING);
        for (let i = 0; i <= noteText.length; i += 2) {
          if (cancelled) return;
          setTyped(i);
          await wait(22);
        }
        await wait(400); if (cancelled) return;

        setPhase(PHASES.PARSING);
        await wait(1400); if (cancelled) return;

        setPhase(PHASES.SEAL);
        await wait(2200); if (cancelled) return;

        setPhase(PHASES.REPLAY);
        await wait(5400); if (cancelled) return;

        setPhase(PHASES.INSIGHT);
        await wait(3800);
      }
    };
    run();
    return () => { cancelled = true; };
  }, []);

  useEffect(() => {
    const t = setInterval(() => setTimer(s => s + 1), 1000);
    return () => clearInterval(t);
  }, []);
  const tLabel = `00:${String(timer % 60).padStart(2, '0')}`;
  const visibleText = noteText.slice(0, typed);

  return (
    <div style={{
      height: '100%', display: 'flex', flexDirection: 'column',
      fontFamily: 'DM Sans, sans-serif', color: '#2C2A26',
      background: '#F3EFE9', position: 'relative', overflow: 'hidden',
    }}>
      <div style={{
        paddingTop: 12, display: 'flex', justifyContent: 'space-between',
        padding: '12px 22px 0', fontSize: 11, fontWeight: 600,
        fontFamily: 'JetBrains Mono, monospace',
      }}>
        <span>9:41</span><span>●●●● ▪▪</span>
      </div>

      <div style={{ display: 'flex', alignItems: 'center', padding: '14px 18px 12px' }}>
        <button style={{
          background: 'transparent', border: 'none', display: 'flex', alignItems: 'center', gap: 3,
          fontFamily: 'DM Sans, sans-serif', fontSize: 16, fontWeight: 700, color: '#2C2A26', padding: 0,
        }}>
          <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round"><polyline points="15 18 9 12 15 6"/></svg>
          Home
        </button>
        <div style={{
          flex: 1, display: 'flex', justifyContent: 'center', alignItems: 'center', gap: 7,
          opacity: phase <= PHASES.PARSING ? 1 : 0,
          transition: 'opacity 300ms cubic-bezier(0.22, 1, 0.36, 1)',
          pointerEvents: phase <= PHASES.PARSING ? 'auto' : 'none',
        }}>
          <MiniRing label={tLabel} />
          <span style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 14, fontWeight: 700, color: '#2C2A26' }}>200/400</span>
          <span style={{ fontSize: 13, color: '#7A7670' }}>·</span>
          <span style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 14, fontWeight: 700, color: '#E8642C' }}>30K</span>
          <span style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 12, fontWeight: 700, color: '#E8642C' }}>(75bb)</span>
        </div>
        <button style={{
          width: 32, height: 32, borderRadius: 8, border: '1px solid rgba(0,0,0,0.08)',
          background: '#FAF8F5', display: 'flex', alignItems: 'center', justifyContent: 'center',
          color: '#5A5750', padding: 0, boxShadow: '0 1px 2px rgba(60,50,40,0.04)',
        }}>
          <svg width="15" height="15" viewBox="0 0 24 24" fill="currentColor"><circle cx="12" cy="5" r="1.5"/><circle cx="12" cy="12" r="1.5"/><circle cx="12" cy="19" r="1.5"/></svg>
        </button>
      </div>

      <div style={{ flex: 1, position: 'relative', padding: '4px 14px 100px', overflow: 'hidden' }}>
        <div style={{
          position: 'absolute', inset: '4px 14px 100px',
          opacity: phase <= PHASES.PARSING ? 1 : 0,
          transform: phase <= PHASES.PARSING ? 'translateY(0)' : 'translateY(-16px) scale(0.98)',
          transition: 'all 450ms cubic-bezier(0.22, 1, 0.36, 1)',
          pointerEvents: phase <= PHASES.PARSING ? 'auto' : 'none',
        }}>
          <div style={{
            height: '100%', width: '100%',
            background: '#FAF8F5', borderRadius: 10,
            padding: '18px 18px 18px 20px',
            borderLeft: '2px solid rgba(0,0,0,0.12)',
            position: 'relative', overflow: 'hidden',
            animation: phase === PHASES.PARSING ? 'ltProcessGlow 1.3s ease-in-out infinite' : 'none',
            transition: 'box-shadow 300ms',
          }}>
            {phase === PHASES.BLANK && (
              <span style={{ color: '#ADA99F', fontSize: 14, lineHeight: 1.7, fontFamily: 'DM Sans, sans-serif' }}>
                Describe your hand… type <span style={{ fontFamily: 'JetBrains Mono, monospace', color: '#7A7670' }}>---</span> on a new line to seal this section
              </span>
            )}
            {(phase === PHASES.TYPING || phase === PHASES.PARSING) && (() => {
              const dashMatch = visibleText.match(/\n(-+)\s*$/);
              const showDivider = !!dashMatch && phase === PHASES.PARSING;
              const textBeforeSeal = showDivider ? visibleText.substring(0, dashMatch.index) : visibleText;
              return (
                <>
                  <div style={{ position: 'relative' }}>
                    <span style={{
                      display: 'block',
                      fontFamily: 'DM Sans, sans-serif', fontSize: 14, color: '#2C2A26',
                      lineHeight: 1.7, whiteSpace: 'pre-wrap',
                      filter: phase === PHASES.PARSING ? 'blur(2.5px)' : 'none',
                      opacity: phase === PHASES.PARSING ? 0.55 : 1,
                      transition: 'filter 350ms ease, opacity 350ms ease',
                    }}>
                      {textBeforeSeal}
                      {phase === PHASES.TYPING && !showDivider && (
                        <span style={{
                          display: 'inline-block', width: 2, height: 15, background: '#E8642C',
                          verticalAlign: 'middle', marginLeft: 1,
                          animation: 'ltblink 0.9s step-end infinite',
                        }} />
                      )}
                    </span>

                    {/* Parsing overlay scoped to the sealed text section only */}
                    {phase === PHASES.PARSING && (
                      <>
                        <div aria-hidden="true" style={{
                          position: 'absolute', left: -6, right: -6, top: 0, height: '40%',
                          background: 'linear-gradient(180deg, rgba(232,100,44,0) 0%, rgba(232,100,44,0.35) 50%, rgba(232,100,44,0) 100%)',
                          animation: 'ltScan 1.3s cubic-bezier(0.22, 1, 0.36, 1) infinite',
                          pointerEvents: 'none', mixBlendMode: 'multiply',
                        }} />
                        <div aria-hidden="true" style={{
                          position: 'absolute', left: -6, right: -6, top: 0, height: 2,
                          background: 'linear-gradient(90deg, rgba(232,100,44,0), #E8642C, rgba(232,100,44,0))',
                          boxShadow: '0 0 12px rgba(232,100,44,0.6)',
                          animation: 'ltScan 1.3s cubic-bezier(0.22, 1, 0.36, 1) infinite',
                          pointerEvents: 'none',
                        }} />
                        <div style={{
                          position: 'absolute', left: '50%', top: '50%', transform: 'translate(-50%, -50%)',
                          display: 'inline-flex', alignItems: 'center', gap: 8,
                          padding: '7px 13px', borderRadius: 999,
                          background: 'rgba(250,248,245,0.92)',
                          border: '1px solid rgba(232,100,44,0.35)',
                          boxShadow: '0 4px 16px rgba(232,100,44,0.25), 0 1px 2px rgba(60,50,40,0.08)',
                          backdropFilter: 'blur(4px)',
                          fontFamily: 'DM Sans, sans-serif', fontSize: 10.5, fontWeight: 700,
                          letterSpacing: '0.12em', textTransform: 'uppercase', color: '#E8642C',
                          whiteSpace: 'nowrap',
                        }}>
                          <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round"
                               style={{ animation: 'ltpulse 1.2s ease-in-out infinite' }}>
                            <path d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.582a.5.5 0 0 1 0 .962L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"/>
                          </svg>
                          <span>Parsing hand</span>
                          <span style={{ display: 'inline-flex', gap: 2, marginLeft: 2 }}>
                            <span style={{ width: 3, height: 3, borderRadius: '50%', background: '#E8642C', animation: 'ltDot 1.1s ease-in-out infinite' }} />
                            <span style={{ width: 3, height: 3, borderRadius: '50%', background: '#E8642C', animation: 'ltDot 1.1s ease-in-out 0.18s infinite' }} />
                            <span style={{ width: 3, height: 3, borderRadius: '50%', background: '#E8642C', animation: 'ltDot 1.1s ease-in-out 0.36s infinite' }} />
                          </span>
                        </div>
                      </>
                    )}
                  </div>

                  {/* Seal divider — literal --- becomes a simple line during parsing */}
                  {showDivider && (
                    <div style={{
                      marginTop: 12, marginBottom: 2,
                      height: 1, borderRadius: 1,
                      background: 'rgba(44,42,38,0.18)',
                      animation: 'ltSeal 260ms cubic-bezier(0.22, 1, 0.36, 1)',
                    }} />
                  )}
                </>
              );
            })()}
          </div>
        </div>

        <div style={{
          position: 'absolute', inset: '4px 14px 100px',
          opacity: phase === PHASES.SEAL ? 1 : 0,
          transform: phase === PHASES.SEAL ? 'translateY(0)' : 'translateY(16px) scale(0.98)',
          transition: 'all 500ms cubic-bezier(0.22, 1, 0.36, 1)',
          pointerEvents: phase === PHASES.SEAL ? 'auto' : 'none',
        }}>
          <SealedSummary active={phase === PHASES.SEAL} />
        </div>

        <div style={{
          position: 'absolute', inset: '4px 14px 24px',
          opacity: phase === PHASES.REPLAY ? 1 : 0,
          transform: phase === PHASES.REPLAY ? 'translateY(0)' : 'translateY(16px) scale(0.98)',
          transition: 'all 500ms cubic-bezier(0.22, 1, 0.36, 1)',
          pointerEvents: phase === PHASES.REPLAY ? 'auto' : 'none',
        }}>
          <MiniReplayer active={phase === PHASES.REPLAY} />
        </div>

        <div style={{
          position: 'absolute', inset: '4px 14px 100px',
          opacity: phase === PHASES.INSIGHT ? 1 : 0,
          transform: phase === PHASES.INSIGHT ? 'translateY(0)' : 'translateY(16px) scale(0.98)',
          transition: 'all 500ms cubic-bezier(0.22, 1, 0.36, 1) 80ms',
          pointerEvents: phase === PHASES.INSIGHT ? 'auto' : 'none',
        }}>
          <InsightView active={phase === PHASES.INSIGHT} />
        </div>
      </div>
    </div>
  );
}

/* ─── Sealed-hand summary ───────────────────────────────────────────────── */

function SealedSummary({ active }) {
  return (
    <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
      <div style={{
        display: 'flex', alignItems: 'center', justifyContent: 'space-between',
        padding: '2px 2px 6px',
        opacity: active ? 1 : 0,
        transform: active ? 'translateY(0)' : 'translateY(-4px)',
        transition: 'all 350ms cubic-bezier(0.22, 1, 0.36, 1) 60ms',
      }}>
        <span style={{ fontFamily: 'DM Sans, sans-serif', fontSize: 10, fontWeight: 700, letterSpacing: '0.14em', color: '#7A7670', textTransform: 'uppercase' }}>Hand sealed · #74</span>
        <span style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 10, color: '#3D9B5F', fontWeight: 700 }}>✓ parsed</span>
      </div>

      <div style={{
        background: '#FAF8F5', borderRadius: 12,
        boxShadow: '0 2px 8px rgba(60,50,40,0.08)', padding: '12px 12px',
        opacity: active ? 1 : 0,
        transform: active ? 'scale(1)' : 'scale(0.97)',
        transition: 'all 400ms cubic-bezier(0.22, 1, 0.36, 1) 150ms',
      }}>
        <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
          <div style={{
            width: 20, height: 20, borderRadius: 10, border: '1.5px solid #8AA67A',
            display: 'flex', alignItems: 'center', justifyContent: 'center',
          }}>
            <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="#8AA67A" strokeWidth="3" strokeLinecap="round" strokeLinejoin="round"><polyline points="20 6 9 17 4 12"/></svg>
          </div>
          <SmallCard rank="A" suit={'\u2660'} />
          <SmallCard rank="K" suit={'\u2666'} />
          <span style={{
            background: 'rgba(0,0,0,0.05)', color: '#5A5750',
            padding: '3px 7px', borderRadius: 4,
            fontFamily: 'JetBrains Mono, monospace', fontSize: 11, fontWeight: 700,
            letterSpacing: '0.05em',
          }}>BTN</span>
          <div style={{ display: 'flex', gap: 4, flex: 1, justifyContent: 'center' }}>
            {[
              { r: 'K', s: '♦', c: '#6B9FE8' },
              { r: '7', s: '♠', c: '#2C2A26' },
              { r: '2', s: '♥', c: '#E87566' },
              { r: '4', s: '♣', c: '#8AA67A' },
              { r: 'A', s: '♥', c: '#E87566' },
            ].map((c, i) => (
              <span key={i} style={{
                display: 'inline-flex', flexDirection: 'column', alignItems: 'center', gap: 0,
                fontFamily: 'JetBrains Mono, monospace', lineHeight: 1,
                opacity: active ? 1 : 0,
                transform: active ? 'translateY(0)' : 'translateY(-4px)',
                transition: `all 300ms cubic-bezier(0.22, 1, 0.36, 1) ${300 + i * 60}ms`,
              }}>
                <span style={{ fontSize: 14, fontWeight: 700, color: c.c }}>{c.r}</span>
                <span style={{ fontSize: 9, color: c.c, marginTop: -1 }}>{tx(c.s)}</span>
              </span>
            ))}
          </div>
          <div style={{ textAlign: 'right' }}>
            <div style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 14, fontWeight: 700, color: '#2C2A26' }}>+30,000</div>
            <div style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 9, color: '#7A7670' }}>just now</div>
          </div>
        </div>
      </div>

      <div style={{
        background: '#FAF8F5', borderRadius: 12,
        boxShadow: '0 2px 8px rgba(60,50,40,0.08)', padding: '10px 12px',
        opacity: active ? 1 : 0,
        transform: active ? 'translateY(0)' : 'translateY(8px)',
        transition: 'all 400ms cubic-bezier(0.22, 1, 0.36, 1) 400ms',
      }}>
        {[
          { s: 'PRE',   a: 'Open 2.5bb', b: '3-bet 10bb · Call',     d: 600 },
          { s: 'FLOP',  a: 'K♦ 7♠ 2♥',   b: 'Check · Bet 1/3',       d: 680 },
          { s: 'TURN',  a: '4♣',          b: 'Check / Check',         d: 760 },
          { s: 'RIVER', a: 'A♥',          b: 'Bet 1/2 · Jam · Call',  d: 840 },
        ].map((r, i) => (
          <div key={i} style={{
            display: 'grid', gridTemplateColumns: '38px 1fr auto', gap: 8,
            padding: '5px 0', borderTop: i ? '1px solid rgba(0,0,0,0.05)' : 'none',
            alignItems: 'center',
            opacity: active ? 1 : 0,
            transform: active ? 'translateY(0)' : 'translateY(4px)',
            transition: `all 300ms cubic-bezier(0.22, 1, 0.36, 1) ${r.d}ms`,
          }}>
            <span style={{ fontSize: 9, fontWeight: 700, letterSpacing: '0.1em', color: '#7A7670' }}>{r.s}</span>
            <span style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 11, color: '#2C2A26', fontWeight: 600 }}>{tx(r.a)}</span>
            <span style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 10, color: '#5A5750' }}>{r.b}</span>
          </div>
        ))}
      </div>

      <div style={{
        display: 'flex', alignItems: 'center', gap: 8,
        opacity: active ? 1 : 0,
        transform: active ? 'translateY(0)' : 'translateY(4px)',
        transition: 'all 350ms cubic-bezier(0.22, 1, 0.36, 1) 1000ms',
      }}>
        <span style={{
          display: 'inline-flex', alignItems: 'center', gap: 5,
          padding: '3px 9px', borderRadius: 4,
          background: 'rgba(61,155,95,0.14)', border: '1px solid rgba(61,155,95,0.35)',
          fontFamily: 'DM Sans, sans-serif', fontSize: 11, fontWeight: 600, color: '#2C2A26',
        }}>
          <span style={{ width: 5, height: 5, borderRadius: 1, background: '#3D9B5F' }} />
          #Goodplay
        </span>
        <span style={{ marginLeft: 'auto', fontFamily: 'JetBrains Mono, monospace', fontSize: 10, color: '#7A7670' }}>swipe up ↑</span>
      </div>
    </div>
  );
}

/* ─── Mini hand replayer (portrait oval table + action strip) ──────────── */

const REPLAY_STEPS = [
  { street: 'PRE',   board: 0, pillTop: 'Blinds',    pillBot: 'Post', pot: 600,   hBet: 200,   vBet: 400,   hStack: 29800, vStack: 29600, act: null, bg: '#EEEBE5', txt: '#2C2A26' },
  { street: 'PRE',   board: 0, pillTop: 'Raise 2.5', pillBot: 'BTN',  pot: 1400,  hBet: 1000,  vBet: 400,   hStack: 29000, vStack: 29600, act: 'H',  bg: '#E8A04A', txt: '#FFFFFF', actLbl: 'Raise 2.5' },
  { street: 'PRE',   board: 0, pillTop: '3-bet 10',  pillBot: 'BB',   pot: 5000,  hBet: 1000,  vBet: 4000,  hStack: 29000, vStack: 26000, act: 'V',  bg: '#E8A04A', txt: '#FFFFFF', actLbl: '3-bet 10' },
  { street: 'PRE',   board: 0, pillTop: 'Call',      pillBot: 'BTN',  pot: 8000,  hBet: 4000,  vBet: 4000,  hStack: 26000, vStack: 26000, act: 'H',  bg: '#5BD688', txt: '#1E6B3E', actLbl: 'Call 10' },
  { street: 'FLOP',  board: 3, pillTop: 'Flop',      pillBot: 'Deal', pot: 8000,  hBet: 0,     vBet: 0,     hStack: 26000, vStack: 26000, act: null, bg: '#F3EFE9', txt: '#2C2A26', flopPill: true, streetBreak: true },
  { street: 'FLOP',  board: 3, pillTop: 'Bet 7',     pillBot: 'BB',   pot: 10700, hBet: 0,     vBet: 2700,  hStack: 26000, vStack: 23300, act: 'V',  bg: '#E8A04A', txt: '#FFFFFF', actLbl: 'Bet 7' },
  { street: 'FLOP',  board: 3, pillTop: 'Call',      pillBot: 'BTN',  pot: 13400, hBet: 2700,  vBet: 2700,  hStack: 23300, vStack: 23300, act: 'H',  bg: '#5BD688', txt: '#1E6B3E', actLbl: 'Call 7' },
  { street: 'TURN',  board: 4, pillTop: 'Turn',      pillBot: 'Deal', pot: 13400, hBet: 0,     vBet: 0,     hStack: 23300, vStack: 23300, act: null, bg: '#F3EFE9', txt: '#2C2A26', turnPill: true, streetBreak: true },
  { street: 'TURN',  board: 4, pillTop: 'Check',     pillBot: 'BB',   pot: 13400, hBet: 0,     vBet: 0,     hStack: 23300, vStack: 23300, act: 'V',  bg: '#5BD688', txt: '#1E6B3E', actLbl: 'Check' },
  { street: 'TURN',  board: 4, pillTop: 'Check',     pillBot: 'BTN',  pot: 13400, hBet: 0,     vBet: 0,     hStack: 23300, vStack: 23300, act: 'H',  bg: '#5BD688', txt: '#1E6B3E', actLbl: 'Check' },
  { street: 'RIVER', board: 5, pillTop: 'River',     pillBot: 'Deal', pot: 13400, hBet: 0,     vBet: 0,     hStack: 23300, vStack: 23300, act: null, bg: '#F3EFE9', txt: '#2C2A26', riverPill: true, streetBreak: true },
  { street: 'RIVER', board: 5, pillTop: 'Bet 17',    pillBot: 'BB',   pot: 20100, hBet: 0,     vBet: 6700,  hStack: 23300, vStack: 16600, act: 'V',  bg: '#E8A04A', txt: '#FFFFFF', actLbl: 'Bet 17' },
  { street: 'RIVER', board: 5, pillTop: 'JAM',       pillBot: 'BTN',  pot: 43400, hBet: 23300, vBet: 6700,  hStack: 0,     vStack: 16600, act: 'H',  bg: '#E85A50', txt: '#FFFFFF', actLbl: 'All-in', heroAllIn: true },
  { street: 'RIVER', board: 5, pillTop: 'Call',      pillBot: 'BB',   pot: 60000, hBet: 23300, vBet: 23300, hStack: 0,     vStack: 0,     act: 'V',  bg: '#5BD688', txt: '#1E6B3E', actLbl: 'Call', heroAllIn: true, villAllIn: true },
  { street: 'SHOW',  board: 5, pillTop: 'Win',       pillBot: '+30k', pot: 60000, hBet: 0,     vBet: 0,     hStack: 30000, vStack: 0,     act: null, bg: '#3D9B5F', txt: '#FFFFFF', showdown: true, heroAllIn: false, villAllIn: true },
];

const BOARD_CARDS = [
  { r: 'K', s: '♦', c: '#6B9FE8' },
  { r: '7', s: '♠', c: '#2C2A26' },
  { r: '2', s: '♥', c: '#E87566' },
  { r: '4', s: '♣', c: '#8AA67A' },
  { r: 'A', s: '♥', c: '#E87566' },
];

const HERO_CARDS = [
  { r: 'A', s: '♠', c: '#2C2A26' },
  { r: 'K', s: '♦', c: '#6B9FE8' },
];

const VILL_CARDS = [
  { r: 'A', s: '♦', c: '#6B9FE8' },
  { r: 'Q', s: '♠', c: '#2C2A26' },
];

function MiniReplayer({ active }) {
  const [step, setStep] = useState(0);
  const [actionFlash, setActionFlash] = useState(false);
  const stripRef = useRef(null);

  useEffect(() => {
    if (!active) {
      setStep(0);
      return;
    }
    setStep(0);
    const timers = [];
    REPLAY_STEPS.forEach((_, i) => {
      if (i === 0) return;
      timers.push(setTimeout(() => setStep(i), 420 * i));
    });
    return () => timers.forEach(clearTimeout);
  }, [active]);

  useEffect(() => {
    setActionFlash(true);
    const t = setTimeout(() => setActionFlash(false), 700);
    return () => clearTimeout(t);
  }, [step]);

  const s = REPLAY_STEPS[step];
  const bb = 400;
  const bbs = (n) => `${Math.round(n / bb)}bb`;

  // Ellipse geometry — taller so the table fills the phone.
  const W = 260, H = 370;
  const cx = W / 2, cy = H / 2;
  const rx = W * 0.40;
  const ry = H * 0.34;
  const heroY = cy + ry;    // bottom seat center
  const villY = cy - ry;    // top seat center

  const heroIsActing = s.act === 'H';
  const villIsActing = s.act === 'V';

  // Pill strip geometry
  const PILL_W = 54, PILL_GAP = 5, PILL_STEP = PILL_W + PILL_GAP;
  const STRIP_W = W;
  const stripX = STRIP_W / 2 - PILL_W / 2 - step * PILL_STEP;

  return (
    <div style={{
      display: 'flex', flexDirection: 'column', gap: 4,
      fontFamily: 'DM Sans, sans-serif',
    }}>
      {/* Header: street chip + step counter */}
      <div style={{
        display: 'flex', alignItems: 'center', justifyContent: 'space-between',
        padding: '0 2px',
      }}>
        <span style={{
          display: 'inline-flex', alignItems: 'center', gap: 4,
          padding: '2px 8px', borderRadius: 999,
          background: 'rgba(232,100,44,0.12)',
          fontSize: 8.5, fontWeight: 800, letterSpacing: '0.14em',
          color: '#E8642C', textTransform: 'uppercase',
        }}>
          <span style={{ width: 4, height: 4, borderRadius: 2, background: '#E8642C' }} />
          {s.showdown ? 'Showdown' : s.street}
        </span>
        <span style={{
          fontFamily: 'JetBrains Mono, monospace', fontSize: 9,
          color: '#7A7670', fontWeight: 600,
        }}>
          {step + 1} / {REPLAY_STEPS.length}
        </span>
      </div>

      {/* Table */}
      <div style={{
        position: 'relative', width: W, height: H,
        margin: '0 auto',
      }}>
        {/* Felt ellipse */}
        <svg width={W} height={H} style={{ position: 'absolute', inset: 0, pointerEvents: 'none' }}>
          <defs>
            <radialGradient id="ltFelt" cx="50%" cy="50%" r="55%">
              <stop offset="0%" stopColor="rgba(232,100,44,0.06)" />
              <stop offset="100%" stopColor="rgba(232,100,44,0)" />
            </radialGradient>
          </defs>
          <ellipse cx={cx} cy={cy} rx={rx} ry={ry} fill="url(#ltFelt)" stroke="rgba(44,42,38,0.14)" strokeWidth={1.2} />
        </svg>

        {/* Board cards (community) */}
        <div style={{
          position: 'absolute', left: '50%', top: cy - 34,
          transform: 'translateX(-50%)',
          display: 'flex', gap: 3,
        }}>
          {[0,1,2,3,4].map((i) => {
            const visible = i < s.board;
            const card = BOARD_CARDS[i];
            const justDealt = visible && (
              (i < 3 && s.board === 3 && s.flopPill) ||
              (i === 3 && s.board === 4 && s.turnPill) ||
              (i === 4 && s.board === 5 && s.riverPill)
            );
            return (
              <div key={i} style={{
                width: 22, height: 30, borderRadius: 3,
                background: visible ? '#FAF8F5' : 'transparent',
                border: visible ? '1px solid rgba(0,0,0,0.08)' : '1.3px dashed rgba(44,42,38,0.22)',
                display: 'flex', flexDirection: 'column',
                alignItems: 'center', justifyContent: 'center',
                transform: justDealt ? 'scale(1.1)' : 'scale(1)',
                transition: 'all 260ms cubic-bezier(0.34, 1.56, 0.64, 1)',
                boxShadow: justDealt ? '0 3px 8px rgba(232,100,44,0.25)' : 'none',
              }}>
                {visible && (
                  <>
                    <span style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 12, fontWeight: 700, color: card.c, lineHeight: 1 }}>{card.r}</span>
                    <span style={{ fontSize: 9, color: card.c, lineHeight: 1, marginTop: -1 }}>{tx(card.s)}</span>
                  </>
                )}
              </div>
            );
          })}
        </div>

        {/* Pot */}
        {s.pot > 0 && (
          <div style={{
            position: 'absolute', left: '50%', top: cy + 14,
            transform: 'translateX(-50%)',
            display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 0,
          }}>
            <div style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 13, fontWeight: 700, color: '#2C2A26', lineHeight: 1 }}>
              {bbs(s.pot)}
            </div>
            <div style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 8.5, color: '#7A7670', lineHeight: 1, marginTop: 1 }}>
              pot
            </div>
          </div>
        )}

        {/* Villain current-bet chip (between villain seat and center) */}
        {s.vBet > 0 && !s.showdown && (
          <div style={{
            position: 'absolute', left: '50%', top: villY + 38,
            transform: 'translate(-50%, -50%)',
            display: 'inline-flex', alignItems: 'center', gap: 4,
            padding: '2px 7px', borderRadius: 999,
            background: '#FAF8F5', border: '1px solid rgba(0,0,0,0.1)',
            boxShadow: '0 1px 2px rgba(60,50,40,0.08)',
            fontFamily: 'JetBrains Mono, monospace', fontSize: 9, fontWeight: 700, color: '#2C2A26',
          }}>
            <span style={{ width: 5, height: 5, borderRadius: 2.5, background: '#E8642C' }} />
            {bbs(s.vBet)}
          </div>
        )}

        {/* Hero current-bet chip (between hero seat and center) */}
        {s.hBet > 0 && !s.showdown && (
          <div style={{
            position: 'absolute', left: '50%', top: heroY - 38,
            transform: 'translate(-50%, -50%)',
            display: 'inline-flex', alignItems: 'center', gap: 4,
            padding: '2px 7px', borderRadius: 999,
            background: '#FAF8F5', border: '1px solid rgba(0,0,0,0.1)',
            boxShadow: '0 1px 2px rgba(60,50,40,0.08)',
            fontFamily: 'JetBrains Mono, monospace', fontSize: 9, fontWeight: 700, color: '#2C2A26',
          }}>
            <span style={{ width: 5, height: 5, borderRadius: 2.5, background: '#E8642C' }} />
            {bbs(s.hBet)}
          </div>
        )}

        {/* Villain seat (top) */}
        <Seat
          x={cx} y={villY}
          posLabel="BB"
          posColor="#E87566"
          stack={s.vStack}
          bb={bb}
          cards={s.showdown ? VILL_CARDS : 'hidden'}
          cardsAbove={true}
          isHero={false}
          isActive={villIsActing && actionFlash}
          actLabel={villIsActing ? s.actLbl : null}
          actBg={s.bg}
          actTxt={s.txt}
          isAllIn={s.villAllIn}
          dimmed={false}
        />

        {/* Hero seat (bottom) */}
        <Seat
          x={cx} y={heroY}
          posLabel="BTN"
          posColor="#8AA67A"
          stack={s.hStack}
          bb={bb}
          cards={HERO_CARDS}
          cardsAbove={false}
          isHero={true}
          isActive={heroIsActing && actionFlash}
          actLabel={heroIsActing ? s.actLbl : null}
          actBg={s.bg}
          actTxt={s.txt}
          isAllIn={s.heroAllIn}
          dimmed={false}
          highlightWin={s.showdown}
        />
      </div>

      {/* Action strip */}
      <div style={{
        position: 'relative', height: 38, marginTop: 2,
        overflow: 'hidden',
        maskImage: 'linear-gradient(90deg, transparent 0, #000 18%, #000 82%, transparent 100%)',
        WebkitMaskImage: 'linear-gradient(90deg, transparent 0, #000 18%, #000 82%, transparent 100%)',
      }}>
        <div ref={stripRef} style={{
          position: 'absolute', top: 0, left: 0, height: '100%',
          display: 'flex', alignItems: 'center', gap: PILL_GAP,
          transform: `translateX(${stripX}px)`,
          transition: 'transform 450ms cubic-bezier(0.22, 1, 0.36, 1)',
        }}>
          {REPLAY_STEPS.map((p, i) => {
            const isCurrent = i === step;
            const dist = Math.abs(i - step);
            const opacity = Math.max(0.28, 1 - dist * 0.22);
            const scale = isCurrent ? 1 : 0.9;
            return (
              <div key={i} style={{
                width: PILL_W, flexShrink: 0,
                borderRadius: 6, overflow: 'hidden',
                border: isCurrent ? '1.5px solid #E8642C' : '1px solid rgba(0,0,0,0.08)',
                boxShadow: isCurrent ? '0 2px 6px rgba(232,100,44,0.25)' : '0 1px 2px rgba(60,50,40,0.05)',
                opacity, transform: `scale(${scale})`,
                transition: 'all 300ms cubic-bezier(0.22, 1, 0.36, 1)',
                background: '#FAF8F5',
              }}>
                <div style={{
                  background: p.bg,
                  padding: '2px 4px',
                  textAlign: 'center',
                  fontSize: 8.5, fontWeight: 800,
                  color: p.txt,
                  letterSpacing: '0.02em',
                  lineHeight: 1.1,
                  minHeight: 14,
                  display: 'flex', alignItems: 'center', justifyContent: 'center',
                }}>
                  {p.pillTop}
                </div>
                <div style={{
                  padding: '2px 4px', textAlign: 'center',
                  fontSize: 8, fontWeight: 700, color: '#2C2A26',
                  borderTop: '1px solid rgba(0,0,0,0.06)',
                  minHeight: 14, lineHeight: 1.1,
                  display: 'flex', alignItems: 'center', justifyContent: 'center',
                }}>
                  {p.pillBot || p.street}
                </div>
              </div>
            );
          })}
        </div>
      </div>
    </div>
  );
}

function Seat({ x, y, posLabel, posColor, stack, bb, cards, cardsAbove, isHero, isActive, actLabel, actBg, isAllIn, highlightWin }) {
  const stackBb = Math.round(stack / bb);
  const BADGE = 42;        // badge diameter
  const BADGE_R = BADGE / 2;
  const CARD_W = 18, CARD_H = 26, CARD_GAP = 3;
  const ring = isHero
    ? (isActive ? '0 0 0 2.5px #E8642C, 0 3px 8px rgba(232,100,44,0.35)' : '0 0 0 1.5px rgba(232,100,44,0.7), 0 1px 3px rgba(60,50,40,0.12)')
    : (isActive ? '0 0 0 2.5px #E8642C, 0 3px 8px rgba(232,100,44,0.35)' : '0 0 0 1px rgba(0,0,0,0.12), 0 1px 2px rgba(60,50,40,0.08)');
  const winRing = highlightWin && isHero ? '0 0 0 2.5px #3D9B5F, 0 3px 8px rgba(61,155,95,0.4)' : null;

  return (
    <>
      {/* Seat badge */}
      <div style={{
        position: 'absolute', left: x, top: y,
        transform: `translate(-50%, -50%) scale(${isActive ? 1.08 : 1})`,
        width: BADGE, height: BADGE, borderRadius: BADGE_R,
        background: '#FAF8F5',
        boxShadow: winRing || ring,
        display: 'flex', flexDirection: 'column',
        alignItems: 'center', justifyContent: 'center',
        transition: 'all 240ms cubic-bezier(0.34, 1.56, 0.64, 1)',
      }}>
        {actLabel ? (
          <span style={{
            fontFamily: 'DM Sans, sans-serif',
            fontSize: actLabel.length > 6 ? 8.5 : 10,
            fontWeight: 800, color: actBg === '#EEEBE5' || actBg === '#F3EFE9' ? '#2C2A26' : actBg,
            lineHeight: 1, letterSpacing: '-0.01em',
            padding: '0 3px', textAlign: 'center',
          }}>{actLabel}</span>
        ) : (
          <>
            <span style={{
              fontFamily: 'DM Sans, sans-serif', fontSize: 11, fontWeight: 800,
              color: posColor, lineHeight: 1, letterSpacing: '0.02em',
            }}>{posLabel}</span>
            <span style={{
              fontFamily: 'JetBrains Mono, monospace', fontSize: 9,
              color: '#7A7670', lineHeight: 1, marginTop: 3, fontWeight: 600,
            }}>{stack > 0 ? `${stackBb}bb` : '0'}</span>
          </>
        )}
      </div>

      {/* Cards — outside the badge */}
      <div style={{
        position: 'absolute', left: x,
        top: cardsAbove ? y - BADGE_R - 2 : y + BADGE_R + 2,
        transform: cardsAbove
          ? 'translate(-50%, -100%)'
          : 'translate(-50%, 0)',
        display: 'flex', gap: CARD_GAP,
      }}>
        {cards === 'hidden' ? (
          <>
            <MiniBackCard w={CARD_W} h={CARD_H} />
            <MiniBackCard w={CARD_W} h={CARD_H} />
          </>
        ) : (
          cards.map((c, i) => (
            <div key={i} style={{
              width: CARD_W, height: CARD_H, borderRadius: 3,
              background: '#FAF8F5',
              border: '1px solid rgba(0,0,0,0.08)',
              display: 'flex', flexDirection: 'column',
              alignItems: 'center', justifyContent: 'center',
              boxShadow: '0 1px 2px rgba(60,50,40,0.08)',
            }}>
              <span style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 10, fontWeight: 700, color: c.c, lineHeight: 1 }}>{c.r}</span>
              <span style={{ fontSize: 8, color: c.c, lineHeight: 1, marginTop: -1 }}>{tx(c.s)}</span>
            </div>
          ))
        )}
      </div>

      {/* All-in pill */}
      {isAllIn && (
        <div style={{
          position: 'absolute', left: x,
          top: cardsAbove ? y + BADGE_R + 4 : y - BADGE_R - 4,
          transform: cardsAbove ? 'translate(-50%, 0)' : 'translate(-50%, -100%)',
        }}>
          <div style={{
            padding: '1px 5px', borderRadius: 3,
            background: '#E85A50', color: '#FFFFFF',
            fontFamily: 'DM Sans, sans-serif', fontSize: 6.5, fontWeight: 800,
            letterSpacing: '0.08em',
          }}>ALL-IN</div>
        </div>
      )}
    </>
  );
}

function MiniBackCard({ w = 18, h = 26 }) {
  return (
    <div style={{
      width: w, height: h, borderRadius: 3,
      background: 'linear-gradient(135deg, #8B6B4A 0%, #6B4E33 100%)',
      border: '1px solid rgba(0,0,0,0.12)',
      boxShadow: '0 1px 2px rgba(60,50,40,0.08)',
      position: 'relative', overflow: 'hidden',
    }}>
      <div style={{
        position: 'absolute', inset: 2, borderRadius: 2,
        border: '1px dashed rgba(250,248,245,0.3)',
      }} />
    </div>
  );
}

/* ─── Insight view ──────────────────────────────────────────────────────── */

function InsightView({ active }) {
  return (
    <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
      <div style={{
        display: 'flex', justifyContent: 'space-between', alignItems: 'flex-end',
        padding: '2px 2px 6px',
        opacity: active ? 1 : 0,
        transform: active ? 'translateY(0)' : 'translateY(-4px)',
        transition: 'all 350ms cubic-bezier(0.22, 1, 0.36, 1) 60ms',
      }}>
        <span style={{ fontFamily: 'DM Sans, sans-serif', fontSize: 18, fontWeight: 800, letterSpacing: '-0.02em', color: '#2C2A26' }}>Insights</span>
        <span style={{
          display: 'inline-flex', alignItems: 'center', gap: 4,
          padding: '4px 9px', borderRadius: 8, background: '#FAF8F5',
          boxShadow: '0 1px 2px rgba(60,50,40,0.06)',
          fontFamily: 'DM Sans, sans-serif', fontSize: 10, fontWeight: 700, color: '#2C2A26',
        }}>
          Last 5
          <svg width="8" height="8" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round"><path d="m6 9 6 6 6-6"/></svg>
        </span>
      </div>

      <div style={{
        background: '#FAF8F5', borderRadius: 14, padding: '14px 14px',
        boxShadow: '0 2px 10px rgba(60,50,40,0.07)',
        position: 'relative', overflow: 'hidden',
        opacity: active ? 1 : 0,
        transform: active ? 'scale(1)' : 'scale(0.96)',
        transition: 'all 450ms cubic-bezier(0.22, 1, 0.36, 1) 150ms',
      }}>
        <div style={{
          position: 'absolute', top: 0, left: 0, right: 0, height: 2.5,
          background: 'linear-gradient(90deg, #E8642C, #F0845A, rgba(240,132,90,0.3))',
        }} />
        <div style={{ display: 'flex', alignItems: 'center', gap: 14, marginTop: 2 }}>
          <ProgressRing current={5} goal={5} active={active} />
          <div style={{ flex: 1 }}>
            <div style={{ fontSize: 9, color: '#ADA99F', textTransform: 'uppercase', letterSpacing: '0.1em', fontWeight: 600, marginBottom: 3 }}>Sessions with notes</div>
            <div style={{ fontSize: 12, fontWeight: 700, color: '#2C2A26', lineHeight: 1.35 }}>
              <span style={{ color: '#3D9B5F' }}>Every session noted —</span> trends are sharp
            </div>
            <div style={{ display: 'flex', alignItems: 'center', gap: 6, marginTop: 8 }}>
              <div style={{
                display: 'inline-flex', alignItems: 'center', gap: 4,
                padding: '3px 8px', borderRadius: 6, background: 'rgba(232,100,44,0.14)',
              }}>
                <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="#E8642C" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"/></svg>
                <span style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 10, fontWeight: 700, color: '#E8642C' }}>5</span>
                <span style={{ fontSize: 9, color: '#E8642C', fontWeight: 600 }}>streak</span>
              </div>
            </div>
          </div>
        </div>
      </div>

      <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr 1fr', gap: 5 }}>
        {[
          { l: 'Hands', v: '74' },
          { l: 'Noted', v: '18' },
          { l: 'bb/hr', v: '+8.2' },
        ].map((m, i) => (
          <div key={m.l} style={{
            background: '#FAF8F5', borderRadius: 10, padding: '8px 4px',
            display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 2,
            boxShadow: '0 1px 2px rgba(60,50,40,0.05)',
            opacity: active ? 1 : 0,
            transform: active ? 'scale(1)' : 'scale(0.9)',
            transition: `all 300ms cubic-bezier(0.22, 1, 0.36, 1) ${350 + i * 60}ms`,
          }}>
            <span style={{ fontSize: 7, color: '#ADA99F', fontWeight: 700, textTransform: 'uppercase', letterSpacing: '0.08em' }}>{m.l}</span>
            <span style={{
              fontFamily: 'JetBrains Mono, monospace', fontSize: 15, fontWeight: 700,
              color: m.v.startsWith('+') ? '#3D9B5F' : '#2C2A26', lineHeight: 1,
            }}>{m.v}</span>
          </div>
        ))}
      </div>

      <div style={{ display: 'flex', justifyContent: 'space-between', padding: '4px 2px 0' }}>
        <span style={{ fontSize: 9, fontWeight: 600, color: '#ADA99F', textTransform: 'uppercase', letterSpacing: '0.1em' }}>Recent hands</span>
        <span style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 9, color: '#E8642C', fontWeight: 600 }}>5 noted</span>
      </div>
      <div style={{
        background: '#FAF8F5', borderRadius: 12, overflow: 'hidden',
        boxShadow: '0 1px 4px rgba(60,50,40,0.06)',
        opacity: active ? 1 : 0,
        transform: active ? 'translateY(0)' : 'translateY(8px)',
        transition: 'all 400ms cubic-bezier(0.22, 1, 0.36, 1) 500ms',
      }}>
        <div style={{
          display: 'grid', gridTemplateColumns: '20px 34px 1fr 56px',
          gap: 6, padding: '7px 10px 6px',
          borderBottom: '1px solid rgba(0,0,0,0.06)',
          fontSize: 8, fontWeight: 700, color: '#ADA99F',
          textTransform: 'uppercase', letterSpacing: '0.1em',
        }}>
          <span></span><span>Pos</span><span>Hand · Board</span>
          <span style={{ textAlign: 'right' }}>Result</span>
        </div>
        {[
          { emoji: '✅', pos: 'BTN', hero: [['A','♠','#2C2A26'],['K','♦','#6B9FE8']], board: [['K','♦','#6B9FE8'],['7','♠','#2C2A26'],['2','♥','#E87566'],['4','♣','#8AA67A'],['A','♥','#E87566']], net: '+30,000', fresh: true },
          { emoji: '🧊', pos: 'BB',  hero: [['Q','♠','#2C2A26'],['Q','♣','#8AA67A']], board: [['K','♦','#6B9FE8'],['8','♥','#E87566'],['4','♣','#8AA67A']], net: '-8,400',  fresh: false },
          { emoji: '🔑', pos: 'CO',  hero: [['T','♥','#E87566'],['9','♥','#E87566']], board: [['J','♥','#E87566'],['8','♣','#8AA67A'],['3','♦','#6B9FE8']], net: '+4,200',  fresh: false },
        ].map((h, i) => (
          <div key={i} style={{
            display: 'grid', gridTemplateColumns: '20px 34px 1fr 56px',
            gap: 6, padding: '8px 10px', alignItems: 'center',
            borderBottom: i < 2 ? '1px solid rgba(0,0,0,0.05)' : 'none',
            background: h.fresh ? 'rgba(232,100,44,0.06)' : 'transparent',
            opacity: active ? 1 : 0,
            transform: active ? 'translateX(0)' : 'translateX(-6px)',
            transition: `all 300ms cubic-bezier(0.22, 1, 0.36, 1) ${560 + i * 80}ms`,
          }}>
            <span style={{ fontSize: 14, lineHeight: 1 }}>{h.emoji}</span>
            <span style={{
              background: h.fresh ? 'rgba(232,100,44,0.14)' : 'rgba(0,0,0,0.05)',
              color: h.fresh ? '#E8642C' : '#5A5750',
              padding: '2px 4px', borderRadius: 3, textAlign: 'center',
              fontFamily: 'JetBrains Mono, monospace', fontSize: 9, fontWeight: 700,
              letterSpacing: '0.04em',
            }}>{h.pos}</span>
            <div style={{
              display: 'flex', alignItems: 'center', gap: 3,
              fontFamily: 'JetBrains Mono, monospace', fontSize: 9.5, lineHeight: 1,
              minWidth: 0, flexWrap: 'nowrap', overflow: 'hidden',
            }}>
              {h.hero.map(([r,s,c], k) => (
                <span key={k} style={{ color: c, fontWeight: 700, whiteSpace: 'nowrap' }}>{r}<span style={{ fontSize: 8 }}>{tx(s)}</span></span>
              ))}
              <span style={{ color: '#ADA99F', padding: '0 1px' }}>·</span>
              {h.board.map(([r,s,c], k) => (
                <span key={k} style={{ color: c, fontWeight: 600, opacity: 0.92, whiteSpace: 'nowrap' }}>{r}<span style={{ fontSize: 8 }}>{tx(s)}</span></span>
              ))}
            </div>
            <span style={{
              textAlign: 'right', fontFamily: 'JetBrains Mono, monospace', fontSize: 11,
              fontWeight: h.net.startsWith('+') ? 700 : 500,
              color: h.net.startsWith('+') ? '#2C2A26' : '#ADA99F',
              whiteSpace: 'nowrap',
            }}>{h.net}</span>
          </div>
        ))}
      </div>

      <div style={{ display: 'flex', justifyContent: 'space-between', padding: '4px 2px 0' }}>
        <span style={{ fontSize: 9, fontWeight: 600, color: '#ADA99F', textTransform: 'uppercase', letterSpacing: '0.1em' }}>Patterns discovered</span>
        <span style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 9, color: '#E8642C', fontWeight: 600 }}>2/3</span>
      </div>

      {[
        { c: '#3D9B5F', t: 'Best plays',      m: 'Your best plays happen in SRP pots — especially from CO', d: 600 },
        { c: '#C74B42', t: 'Mistake cluster', m: 'Mistakes cluster in 3-bet pots from the BB',               d: 700 },
      ].map((p, i) => (
        <div key={i} style={{
          background: '#FAF8F5', borderRadius: 12, overflow: 'hidden',
          boxShadow: '0 1px 4px rgba(60,50,40,0.06)',
          display: 'flex',
          opacity: active ? 1 : 0,
          transform: active ? 'translateY(0)' : 'translateY(8px)',
          transition: `all 350ms cubic-bezier(0.22, 1, 0.36, 1) ${p.d}ms`,
        }}>
          <div style={{ width: 3, background: p.c, flexShrink: 0 }} />
          <div style={{ flex: 1, padding: '8px 10px' }}>
            <div style={{ display: 'flex', alignItems: 'center', gap: 5, marginBottom: 2 }}>
              <svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke={p.c} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"/></svg>
              <span style={{ fontSize: 9, fontWeight: 700, color: p.c, textTransform: 'uppercase', letterSpacing: '0.05em' }}>{p.t}</span>
            </div>
            <p style={{ fontSize: 11.5, color: '#2C2A26', lineHeight: 1.35, fontWeight: 500, margin: 0 }}>{p.m}</p>
          </div>
        </div>
      ))}
    </div>
  );
}

/* ─── Primitive helpers ─────────────────────────────────────────────────── */

function ProgressRing({ current, goal, active }) {
  const size = 66, stroke = 4;
  const r = (size - stroke * 2) / 2;
  const circ = 2 * Math.PI * r;
  const pct = Math.min(current / goal, 1);
  const offset = active ? circ * (1 - pct) : circ;
  return (
    <div style={{ position: 'relative', width: size, height: size, flexShrink: 0 }}>
      <svg width={size} height={size} style={{ transform: 'rotate(-90deg)' }}>
        <circle cx={size/2} cy={size/2} r={r} fill="none" stroke="#EEEBE5" strokeWidth={stroke} />
        <circle cx={size/2} cy={size/2} r={r} fill="none" stroke="#E8642C" strokeWidth={stroke}
          strokeDasharray={circ} strokeDashoffset={offset} strokeLinecap="round"
          style={{ transition: 'stroke-dashoffset 1.1s cubic-bezier(0.22, 1, 0.36, 1)' }} />
      </svg>
      <div style={{ position: 'absolute', inset: 0, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }}>
        <span style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 18, fontWeight: 700, color: '#2C2A26', lineHeight: 1 }}>{current}</span>
        <span style={{ fontSize: 7, color: '#ADA99F', textTransform: 'uppercase', letterSpacing: '0.08em', marginTop: 2, fontWeight: 600 }}>/ {goal}</span>
      </div>
    </div>
  );
}

function SmallCard({ rank, suit }) {
  const color = suit === '♥' ? '#E87566' : suit === '♦' ? '#6B9FE8' : suit === '♣' ? '#8AA67A' : '#2C2A26';
  return (
    <div style={{
      width: 22, height: 28, borderRadius: 3, background: '#FAFAF7',
      border: '1px solid rgba(0,0,0,0.10)',
      display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center',
      fontFamily: 'JetBrains Mono, monospace', lineHeight: 1, flexShrink: 0,
    }}>
      <span style={{ fontSize: 11, fontWeight: 700, color }}>{rank}</span>
      <span style={{ fontSize: 8, color }}>{tx(suit)}</span>
    </div>
  );
}

function MiniRing({ label }) {
  const size = 26, stroke = 2;
  const r = (size - stroke) / 2;
  const circ = 2 * Math.PI * r;
  return (
    <div style={{ position: 'relative', width: size, height: size, flexShrink: 0 }}>
      <svg width={size} height={size} style={{ transform: 'rotate(-90deg)' }}>
        <circle cx={size/2} cy={size/2} r={r} fill="none" stroke="#EEEBE5" strokeWidth={stroke} />
        <circle cx={size/2} cy={size/2} r={r} fill="none" stroke="#E8642C" strokeWidth={stroke}
          strokeDasharray={circ} strokeDashoffset={circ * 0.75} strokeLinecap="round" />
      </svg>
      <div style={{
        position: 'absolute', inset: 0, display: 'flex', alignItems: 'center', justifyContent: 'center',
        fontFamily: 'JetBrains Mono, monospace', fontSize: 8, fontWeight: 700, color: '#2C2A26',
      }}>{label}</div>
    </div>
  );
}

/* ─── Features section ─────────────────────────────────────────────────── */

function Features({ id }) {
  const items = [
    {
      k: 'Log',
      t: 'Jot hands in plain English',
      d: 'Type chip stacks, hole cards, the line. Fast as texting — no forms to fill.',
      code: [
        { pos: 'BTN', cards: ['A♠','K♦'], amt: '+420' },
        { pos: 'BB',  cards: ['Q♥','Q♣'], amt: '−180' },
      ],
    },
    {
      k: 'Tag',
      t: 'A vocabulary for mistakes',
      d: 'Tag hands as #Mistake, #Cooler, #Tilt, #Unsure. The tags become a feed.',
      tags: ['#Goodplay', '#Mistake', '#Cooler', '#Tilt', '#Unsure', '#Keypot'],
    },
    {
      k: 'Replay',
      t: 'Session review, not a solver',
      d: 'Filter by tag, position, stakes. Walk through every hand you flagged.',
      pill: true,
    },
    {
      k: 'Leaks',
      t: 'Patterns you miss at the table',
      d: 'Recurring tags become leaks. The journal shows what your memory forgot.',
      leak: true,
    },
  ];
  return (
    <section id={id} className="lt-sec-pad" style={{ padding: '80px 32px', background: 'transparent' }}>
      <div style={{ maxWidth: 1200, margin: '0 auto' }}>
        <div style={{ maxWidth: 720, marginBottom: 48 }}>
          <div style={lblStyle()}>The method</div>
          <h2 style={h2Style()}>Four moves. Fast enough to fit between hands — honest enough to show you yourself.</h2>
        </div>
        <div className="lt-features-grid" style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 18 }}>
          {items.map((it, i) => (
            <div key={it.k} style={{
              background: '#FAF8F5', borderRadius: 16, padding: 20,
              border: '1px solid rgba(0,0,0,0.06)',
              boxShadow: '0 1px 2px rgba(60,50,40,0.06)',
              display: 'flex', flexDirection: 'column', minHeight: 280,
            }}>
              <div style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 11, color: '#E8642C', fontWeight: 700, letterSpacing: '0.1em' }}>0{i+1}</div>
              <div style={{ fontFamily: 'DM Sans, sans-serif', fontSize: 10, fontWeight: 700, letterSpacing: '0.14em', color: '#7A7670', textTransform: 'uppercase', marginTop: 2 }}>{it.k}</div>
              <h3 style={{
                fontFamily: 'DM Sans, sans-serif', fontSize: 19, fontWeight: 700,
                letterSpacing: '-0.015em', color: '#2C2A26', margin: '14px 0 8px', textWrap: 'balance',
              }}>{it.t}</h3>
              <p style={{ fontFamily: 'DM Sans, sans-serif', fontSize: 13.5, color: '#5A5750', lineHeight: 1.5, flex: 1, margin: 0 }}>{it.d}</p>
              <div style={{ marginTop: 16 }}>
                {it.code && (
                  <div style={{
                    background: '#F3EFE9', borderRadius: 8, padding: '8px 10px',
                    display: 'flex', flexDirection: 'column', gap: 6,
                  }}>
                    {it.code.map((r, j) => (
                      <div key={j} style={{
                        display: 'flex', alignItems: 'center', gap: 6,
                        fontFamily: 'JetBrains Mono, monospace', fontSize: 11,
                      }}>
                        <span style={{ padding: '1px 5px', background: 'rgba(0,0,0,0.04)', borderRadius: 3, fontWeight: 700, color: '#5A5750' }}>{r.pos}</span>
                        <span style={{ color: '#2C2A26', fontWeight: 700 }}>{tx(r.cards.join(' '))}</span>
                        <span style={{ marginLeft: 'auto', fontWeight: r.amt.startsWith('+') ? 700 : 500, color: r.amt.startsWith('+') ? '#2C2A26' : '#7A7670' }}>{r.amt}</span>
                      </div>
                    ))}
                  </div>
                )}
                {it.tags && (
                  <div style={{ display: 'flex', flexWrap: 'wrap', gap: 6 }}>
                    {it.tags.map(t => (
                      <span key={t} style={{
                        fontFamily: 'DM Sans, sans-serif', fontSize: 11, fontWeight: 500,
                        padding: '3px 8px', borderRadius: 4,
                        background: 'rgba(0,0,0,0.04)', color: '#2C2A26',
                      }}>{t}</span>
                    ))}
                  </div>
                )}
                {it.pill && (
                  <div style={{ display: 'flex', gap: 6, flexWrap: 'wrap' }}>
                    {['Tag: Mistake', 'Pos: BB', '2/5 NL', 'Last 7 days'].map(p => (
                      <span key={p} style={{
                        fontFamily: 'DM Sans, sans-serif', fontSize: 11, fontWeight: 600,
                        padding: '4px 10px', borderRadius: 999,
                        border: '1px solid rgba(0,0,0,0.10)', color: '#2C2A26',
                      }}>{p}</span>
                    ))}
                  </div>
                )}
                {it.leak && (
                  <div style={{ background: '#F3EFE9', borderRadius: 8, padding: 10 }}>
                    <div style={{ display: 'flex', alignItems: 'center', gap: 6, fontSize: 11, fontFamily: 'DM Sans, sans-serif' }}>
                      <span style={{ width: 6, height: 6, borderRadius: 1, background: '#B07373' }} />
                      <span style={{ fontWeight: 700, color: '#2C2A26' }}>Flatting from SB</span>
                      <span style={{ marginLeft: 'auto', color: '#7A7670', fontFamily: 'JetBrains Mono, monospace' }}>12 hands</span>
                    </div>
                    <div style={{ fontSize: 10.5, color: '#7A7670', marginTop: 6, fontFamily: 'DM Sans, sans-serif' }}>Tagged #Mistake across last 4 sessions.</div>
                  </div>
                )}
              </div>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

/* ─── Demo strip (hand-logger auto-cycle) ───────────────────────────────── */

function DemoStrip() {
  return (
    <section id="demo" className="lt-sec-pad" style={{ padding: '40px 32px 0' }}>
      <div className="lt-demo-pad" style={{
        maxWidth: 1200, margin: '0 auto',
        background: '#EEEBE5', borderRadius: 24, padding: '56px 48px',
        position: 'relative', overflow: 'hidden',
      }}>
        <div aria-hidden="true" style={{
          position: 'absolute', inset: 0, pointerEvents: 'none', opacity: 0.5,
          backgroundImage: 'repeating-linear-gradient(transparent, transparent 31px, rgba(0,0,0,0.03) 31px, rgba(0,0,0,0.03) 32px)',
        }} />
        <div className="lt-demo-grid" style={{
          position: 'relative', display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 48, alignItems: 'center',
        }}>
          <div>
            <div style={lblStyle()}>The loop</div>
            <h2 style={h2Style()}>One session. Every hand moves the line.</h2>
            <p style={{
              fontFamily: 'DM Sans, sans-serif', fontSize: 16, color: '#5A5750',
              lineHeight: 1.55, marginTop: 14, maxWidth: 480,
            }}>
              Type the hand like you'd text a buddy. Seal the note, watch the replay,
              and your stack line updates on the same session chart —
              no second tool, no end-of-night reconciliation.
            </p>
            <div style={{ marginTop: 28, display: 'flex', flexDirection: 'column', gap: 10 }}>
              {[
                ['01', 'Type the hand',   'BTN vs BB 3-bet pot. AK. Jam river. +12K.'],
                ['02', 'Seal with ---',   'Parses into a reviewable hand.'],
                ['03', 'Watch the replay', 'See the decision back before the next deal.'],
                ['04', 'Stack line moves', 'Session chart catches every sealed hand.'],
              ].map(([n, t, d]) => (
                <div key={n} style={{ display: 'flex', gap: 16, alignItems: 'baseline' }}>
                  <span style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 12, fontWeight: 700, color: '#E8642C', letterSpacing: '0.08em', width: 24 }}>{n}</span>
                  <div>
                    <div style={{ fontFamily: 'DM Sans, sans-serif', fontSize: 15, fontWeight: 700, color: '#2C2A26' }}>{t}</div>
                    <div style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 12, color: '#7A7670', marginTop: 2 }}>{d}</div>
                  </div>
                </div>
              ))}
            </div>
          </div>
          <div style={{ display: 'flex', justifyContent: 'center' }}>
            <HandLoggerDemo />
          </div>
        </div>
      </div>
    </section>
  );
}

function HandLoggerDemo() {
  const PHASES = { BLANK: 0, TYPING: 1, TAGGING: 2, SEALING: 3, SEALED: 4, REPLAY: 5, STACK_UPDATE: 6 };
  const [phase, setPhase] = useState(PHASES.BLANK);
  const [typed, setTyped] = useState(0);
  const [tagsShown, setTagsShown] = useState(0);

  const noteText =
    "L11, 30K stack.\n" +
    "BTN vs BB 3-bet pot, AK.\n" +
    "Flop Kd 7s 2h — bet 1/3.\n" +
    "Turn 4c — check/check.\n" +
    "River Ah — he bets,\n" +
    "I jam. Snap, AQo. +12K.\n" +
    "---";
  const tags = ['Keypot', 'Goodplay'];

  useEffect(() => {
    let cancelled = false;
    const wait = (ms) => new Promise(r => setTimeout(r, ms));
    const run = async () => {
      while (!cancelled) {
        setPhase(PHASES.BLANK); setTyped(0); setTagsShown(0);
        await wait(1300); if (cancelled) return;

        setPhase(PHASES.TYPING);
        for (let i = 0; i <= noteText.length; i += 2) {
          if (cancelled) return;
          setTyped(i);
          await wait(24);
        }
        await wait(450); if (cancelled) return;

        setPhase(PHASES.TAGGING);
        for (let i = 1; i <= tags.length; i++) {
          if (cancelled) return;
          setTagsShown(i);
          await wait(520);
        }
        await wait(650); if (cancelled) return;

        setPhase(PHASES.SEALING);
        await wait(1250); if (cancelled) return;

        setPhase(PHASES.SEALED);
        await wait(1500); if (cancelled) return;

        setPhase(PHASES.REPLAY);
        await wait(4600); if (cancelled) return;

        setPhase(PHASES.STACK_UPDATE);
        await wait(3800);
      }
    };
    run();
    return () => { cancelled = true; };
  }, []);

  const visibleText = noteText.slice(0, typed);
  const preSeal = phase < PHASES.SEALED;
  const isReplay = phase === PHASES.REPLAY;
  const stackUpdated = phase === PHASES.STACK_UPDATE;

  return (
    <div style={{ transform: 'rotate(-2deg)' }}>
      <PhoneFrame>
        <div style={{
          padding: '42px 16px 20px', height: '100%',
          display: 'flex', flexDirection: 'column', gap: 12,
          fontFamily: 'DM Sans, sans-serif', color: '#2C2A26',
        }}>
          <div style={{ display: 'flex', justifyContent: 'space-between', fontFamily: 'JetBrains Mono, monospace', fontSize: 11, fontWeight: 600 }}>
            <span>9:41</span><span>●●●● ▪▪</span>
          </div>

          <div>
            <div style={{ fontSize: 9, fontWeight: 700, letterSpacing: '0.14em', color: '#7A7670', textTransform: 'uppercase' }}>
              {stackUpdated ? 'Session · L11 · Stack'
                : isReplay ? 'Replay · #75'
                : phase === PHASES.SEALED ? 'Hand sealed · #75'
                : 'New note · #75'}
            </div>
            <div style={{ fontSize: 18, fontWeight: 800, letterSpacing: '-0.02em', marginTop: 2 }}>Wynn · $20K GTD</div>
          </div>

          <div style={{
            flex: 1,
            background: isReplay ? 'transparent' : '#FAF8F5',
            borderRadius: 12,
            padding: isReplay ? '4px 2px 0' : '14px 14px',
            border: isReplay ? 'none' : '1px solid rgba(0,0,0,0.06)',
            boxShadow: isReplay ? 'none' : '0 1px 2px rgba(60,50,40,0.04)',
            position: 'relative', overflow: 'hidden',
            display: 'flex', flexDirection: 'column',
          }}>
            {isReplay && <MiniReplayer active={true} />}
            {preSeal && (
              <>
                {phase === PHASES.BLANK && (
                  <span style={{ color: '#ADA99F', fontSize: 13, lineHeight: 1.6 }}>
                    Jot the hand… type <span style={{ fontFamily: 'JetBrains Mono, monospace', color: '#7A7670' }}>---</span> to seal it
                  </span>
                )}
                {phase >= PHASES.TYPING && (() => {
                  const dashMatch = visibleText.match(/\n(-+)\s*$/);
                  const showDivider = !!dashMatch && phase >= PHASES.SEALING;
                  const textBeforeSeal = showDivider ? visibleText.substring(0, dashMatch.index) : visibleText;
                  return (
                    <>
                      <div style={{ position: 'relative' }}>
                        <span style={{
                          display: 'block',
                          fontFamily: 'DM Sans, sans-serif', fontSize: 13, color: '#2C2A26',
                          lineHeight: 1.6, whiteSpace: 'pre-wrap',
                          filter: phase === PHASES.SEALING ? 'blur(2px)' : 'none',
                          opacity: phase === PHASES.SEALING ? 0.55 : 1,
                          transition: 'filter 300ms, opacity 300ms',
                        }}>
                          {textBeforeSeal}
                          {phase === PHASES.TYPING && !showDivider && (
                            <span style={{
                              display: 'inline-block', width: 2, height: 13, background: '#E8642C',
                              verticalAlign: 'middle', marginLeft: 1,
                              animation: 'ltblink 0.9s step-end infinite',
                            }} />
                          )}
                        </span>

                        {/* Parsing overlay scoped to the sealed text section only */}
                        {phase === PHASES.SEALING && (
                          <>
                            <div aria-hidden="true" style={{
                              position: 'absolute', left: -4, right: -4, top: 0, height: 2,
                              background: 'linear-gradient(90deg, rgba(232,100,44,0), #E8642C, rgba(232,100,44,0))',
                              boxShadow: '0 0 12px rgba(232,100,44,0.6)',
                              animation: 'ltScan 1.3s cubic-bezier(0.22, 1, 0.36, 1) infinite',
                            }} />
                            <div style={{
                              position: 'absolute', left: '50%', top: '50%', transform: 'translate(-50%, -50%)',
                              display: 'inline-flex', alignItems: 'center', gap: 8,
                              padding: '7px 13px', borderRadius: 999,
                              background: 'rgba(250,248,245,0.92)',
                              border: '1px solid rgba(232,100,44,0.35)',
                              boxShadow: '0 4px 16px rgba(232,100,44,0.25)',
                              fontFamily: 'DM Sans, sans-serif', fontSize: 10.5, fontWeight: 700,
                              letterSpacing: '0.12em', textTransform: 'uppercase', color: '#E8642C',
                              whiteSpace: 'nowrap',
                            }}>
                              <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round"
                                   style={{ animation: 'ltpulse 1.2s ease-in-out infinite' }}>
                                <path d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.582a.5.5 0 0 1 0 .962L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"/>
                              </svg>
                              <span>Parsing</span>
                            </div>
                          </>
                        )}
                      </div>

                      {/* Seal divider — literal --- becomes a simple line during parsing */}
                      {showDivider && (
                        <div style={{
                          marginTop: 10, marginBottom: 2,
                          height: 1, borderRadius: 1,
                          background: 'rgba(44,42,38,0.18)',
                          animation: 'ltSeal 260ms cubic-bezier(0.22, 1, 0.36, 1)',
                        }} />
                      )}
                    </>
                  );
                })()}
                {phase >= PHASES.TAGGING && (
                  <div style={{ marginTop: 10, display: 'flex', gap: 6, flexWrap: 'wrap' }}>
                    {tags.slice(0, tagsShown).map(t => (
                      <span key={t} style={{
                        fontFamily: 'DM Sans, sans-serif', fontSize: 11, fontWeight: 600,
                        padding: '3px 8px', borderRadius: 4,
                        background: 'rgba(138,166,122,0.22)',
                        border: '1px solid rgba(138,166,122,0.45)',
                        color: '#2C2A26',
                        transition: 'transform 260ms',
                        transform: 'translateY(0)',
                      }}>#{t}</span>
                    ))}
                  </div>
                )}
              </>
            )}

            {stackUpdated && <ChipStackCard />}
            {phase === PHASES.SEALED && (
              <div style={{
                display: 'flex', flexDirection: 'column', gap: 10,
                opacity: 1,
                animation: 'ltFadeIn 420ms cubic-bezier(0.22, 1, 0.36, 1)',
              }}>
                <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
                  <span style={{ fontSize: 10, fontWeight: 700, letterSpacing: '0.14em', color: '#7A7670', textTransform: 'uppercase' }}>Parsed hand · #75</span>
                  <span style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 10, color: '#3D9B5F', fontWeight: 700 }}>✓ sealed</span>
                </div>
                <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
                  <SmallCard rank="A" suit={'\u2660'} />
                  <SmallCard rank="K" suit={'\u2666'} />
                  <span style={{
                    background: 'rgba(0,0,0,0.05)', color: '#5A5750',
                    padding: '3px 7px', borderRadius: 4,
                    fontFamily: 'JetBrains Mono, monospace', fontSize: 11, fontWeight: 700,
                    letterSpacing: '0.05em',
                  }}>BTN</span>
                  <div style={{
                    marginLeft: 'auto',
                    fontFamily: 'JetBrains Mono, monospace', fontSize: 14, fontWeight: 700, color: '#2C2A26',
                  }}>+12K</div>
                </div>
                <div style={{
                  display: 'grid', gridTemplateColumns: '44px 1fr', rowGap: 4, columnGap: 8,
                  fontFamily: 'JetBrains Mono, monospace', fontSize: 10.5, color: '#5A5750',
                  background: '#F3EFE9', padding: '8px 10px', borderRadius: 8,
                }}>
                  <span style={{ fontWeight: 700, color: '#7A7670' }}>PRE</span><span>Open 15 · 3-bet 55 · Call</span>
                  <span style={{ fontWeight: 700, color: '#7A7670' }}>FLOP</span><span>{tx('K♦ 7♠ 2♥ · Bet 1/3')}</span>
                  <span style={{ fontWeight: 700, color: '#7A7670' }}>TURN</span><span>{tx('4♣ · Check / Check')}</span>
                  <span style={{ fontWeight: 700, color: '#7A7670' }}>RIVER</span><span>{tx('A♥ · Bet 1/2 · Jam · Call')}</span>
                </div>
                <div style={{ display: 'flex', gap: 6, flexWrap: 'wrap' }}>
                  {tags.map(t => (
                    <span key={t} style={{
                      fontFamily: 'DM Sans, sans-serif', fontSize: 11, fontWeight: 600,
                      padding: '3px 8px', borderRadius: 4,
                      background: 'rgba(138,166,122,0.18)', color: '#2C2A26',
                    }}>#{t}</span>
                  ))}
                </div>
              </div>
            )}
          </div>

          <div style={{
            padding: '13px 0', borderRadius: 12,
            background: stackUpdated ? 'rgba(138,166,122,0.22)'
              : isReplay ? 'rgba(232,100,44,0.14)'
              : phase === PHASES.SEALED ? 'rgba(138,166,122,0.22)'
              : phase === PHASES.SEALING ? 'rgba(232,100,44,0.18)'
              : phase >= PHASES.TYPING ? '#E8642C'
              : 'rgba(232,100,44,0.18)',
            color: stackUpdated ? '#2C2A26'
              : isReplay ? '#E8642C'
              : phase === PHASES.SEALED ? '#2C2A26'
              : phase >= PHASES.TYPING && phase < PHASES.SEALING ? '#FAF8F5'
              : '#E8642C',
            fontFamily: 'DM Sans, sans-serif', fontSize: 14, fontWeight: 700,
            textAlign: 'center', letterSpacing: '-0.01em',
            transition: 'all 300ms',
          }}>
            {stackUpdated ? '● Stack line updated — 42K'
              : isReplay ? '▶ Replaying hand #75'
              : phase === PHASES.SEALED ? '✓ Saved — hand #75'
              : phase === PHASES.SEALING ? 'Sealing…'
              : phase === PHASES.BLANK ? 'Start the hand'
              : 'Type --- to seal'}
          </div>
        </div>
      </PhoneFrame>
    </div>
  );
}

/* ─── Chip-stack card — post-replay chart, Livetell tournament design ──── */

function ChipStackCard() {
  // Session data points: time-fraction (0..1) and stack (K).
  // stepAfter line — value holds until next point, then jumps.
  const points = [
    { t: 0.00, v: 30, label: '2:15p' },
    { t: 0.22, v: 28, label: '2:48p' },
    { t: 0.42, v: 26, label: '3:21p' },
    { t: 0.62, v: 30, label: '3:54p' },
    { t: 0.80, v: 30, label: '4:22p' },
    { t: 0.94, v: 42, label: '4:45p' },
  ];
  const [showBB, setShowBB] = useState(false);
  const bigBlind = 1.2; // 1.2K BB
  const display = (v) => showBB ? `${Math.round(v / bigBlind)}bb` : `${v}K`;

  const W = 280, H = 188;
  const padL = 30, padR = 10, padT = 10, padB = 22;
  const minV = 20, maxV = 50;
  const plot = points.map(p => ({
    ...p,
    x: padL + p.t * (W - padL - padR),
    y: padT + (1 - (p.v - minV) / (maxV - minV)) * (H - padT - padB),
  }));

  let pathD = '';
  let pathLen = 0;
  plot.forEach((p, i) => {
    if (i === 0) { pathD = `M ${p.x.toFixed(1)} ${p.y.toFixed(1)}`; return; }
    const prev = plot[i - 1];
    const dxRun = Math.abs(p.x - prev.x);
    const dyJump = Math.abs(p.y - prev.y);
    pathLen += dxRun + dyJump;
    pathD += ` L ${p.x.toFixed(1)} ${prev.y.toFixed(1)} L ${p.x.toFixed(1)} ${p.y.toFixed(1)}`;
  });
  const drawLen = Math.ceil(pathLen) + 4;

  const yTicks = showBB ? [20, 30, 40, 50] : [20, 30, 40, 50];
  const xTicksIdx = [0, 2, 4, 5];
  const last = plot[plot.length - 1];

  return (
    <div style={{
      width: '100%',
      background: '#FAF8F5',
      border: '1px solid rgba(0,0,0,0.06)',
      borderRadius: 12,
      padding: '12px 12px 10px',
      boxShadow: '0 1px 2px rgba(60,50,40,0.04)',
      animation: 'ltFadeIn 420ms cubic-bezier(0.22, 1, 0.36, 1)',
    }}>
      <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 6 }}>
        <span style={{ fontSize: 10.5, fontWeight: 700, letterSpacing: '0.14em', color: '#78756D', textTransform: 'uppercase' }}>
          Chip Stack
        </span>
        <div style={{
          display: 'inline-flex', alignItems: 'center',
          background: '#EEEBE5', borderRadius: 8, padding: 2,
          fontFamily: 'JetBrains Mono, monospace', fontSize: 10, fontWeight: 700,
        }}>
          <button onClick={() => setShowBB(false)} style={{
            padding: '3px 10px', borderRadius: 6, border: 'none', cursor: 'pointer',
            background: showBB ? 'transparent' : '#FAF8F5',
            color: showBB ? '#78756D' : '#2C2A26',
            boxShadow: showBB ? 'none' : '0 1px 2px rgba(60,50,40,0.08)',
            fontFamily: 'inherit', fontSize: 'inherit', fontWeight: 'inherit',
          }}>¢</button>
          <button onClick={() => setShowBB(true)} style={{
            padding: '3px 10px', borderRadius: 6, border: 'none', cursor: 'pointer',
            background: showBB ? '#FAF8F5' : 'transparent',
            color: showBB ? '#2C2A26' : '#78756D',
            boxShadow: showBB ? '0 1px 2px rgba(60,50,40,0.08)' : 'none',
            fontFamily: 'inherit', fontSize: 'inherit', fontWeight: 'inherit',
          }}>bb</button>
        </div>
      </div>

      <svg viewBox={`0 0 ${W} ${H}`} width="100%" style={{ display: 'block' }}>
        {yTicks.map(v => {
          const y = padT + (1 - (v - minV) / (maxV - minV)) * (H - padT - padB);
          return (
            <text key={v} x={padL - 6} y={y + 3} fontSize="9" fontFamily="DM Sans, sans-serif" fill="#78756D" textAnchor="end">
              {display(v)}
            </text>
          );
        })}
        {xTicksIdx.map(i => {
          const p = plot[i];
          return (
            <text key={i} x={p.x} y={H - 6} fontSize="9" fontFamily="DM Sans, sans-serif" fill="#78756D" textAnchor="middle">
              {p.label}
            </text>
          );
        })}

        <path
          d={pathD}
          stroke="#E8642C"
          strokeWidth={2}
          fill="none"
          strokeLinecap="round"
          strokeLinejoin="round"
          style={{
            strokeDasharray: drawLen,
            strokeDashoffset: drawLen,
            animation: `ltDraw 1200ms cubic-bezier(0.22, 1, 0.36, 1) forwards`,
            ['--draw-len']: drawLen,
          }}
        />

        {last && (
          <g style={{ opacity: 0, animation: 'ltFadeIn 400ms 1100ms cubic-bezier(0.22, 1, 0.36, 1) forwards' }}>
            <circle cx={last.x} cy={last.y} r={4} fill="#E8642C" opacity={0.25}>
              <animate attributeName="r" values="4;10;4" dur="1.6s" repeatCount="indefinite" />
              <animate attributeName="opacity" values="0.35;0;0.35" dur="1.6s" repeatCount="indefinite" />
            </circle>
            <circle cx={last.x} cy={last.y} r={3.5} fill="#E8642C" />
            <text x={last.x - 6} y={last.y - 8} fontSize="10" fontFamily="JetBrains Mono, monospace" fontWeight="700" fill="#E8642C" textAnchor="end">
              {display(last.v)}
            </text>
          </g>
        )}
      </svg>

      <div style={{
        display: 'flex', alignItems: 'center', justifyContent: 'space-between',
        marginTop: 4, paddingTop: 8, borderTop: '1px solid rgba(0,0,0,0.05)',
      }}>
        <div>
          <div style={{ fontSize: 9, fontWeight: 700, letterSpacing: '0.12em', color: '#78756D', textTransform: 'uppercase' }}>
            Hand #75 · BTN
          </div>
          <div style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 11, color: '#5A5750', marginTop: 2 }}>
            4:45p · River jam
          </div>
        </div>
        <div style={{
          fontFamily: 'JetBrains Mono, monospace', fontSize: 13, fontWeight: 700, color: '#3D9B5F',
          animation: 'ltFadeIn 420ms 1200ms cubic-bezier(0.22, 1, 0.36, 1) both',
        }}>
          +12K
        </div>
      </div>
    </div>
  );
}

/* ─── Tribe section (who it's for) ──────────────────────────────────────── */

function TribeSection() {
  return (
    <section className="lt-sec-pad" style={{ padding: '96px 32px 48px' }}>
      <div style={{ maxWidth: 860, margin: '0 auto', textAlign: 'center' }}>
        <div style={{ ...lblStyle(), display: 'inline-block' }}>Who it's for</div>
        <h2 style={{ ...h2Style(), margin: '12px auto 0', textAlign: 'center' }}>
          For the player who refuses to learn from noise.
        </h2>
        <p style={{
          fontFamily: 'DM Sans, sans-serif', fontSize: 17, color: '#5A5750',
          lineHeight: 1.55, marginTop: 20, textWrap: 'pretty', maxWidth: 720,
          margin: '20px auto 0',
        }}>
          Livetell is for live grinders and aspiring winning players — the ones who love the room,
          the faces, the talk, and take the game seriously enough to study.
          It's for the player moving up stakes who knows the difference between running bad and playing bad,
          and wants to prove which one is happening.
        </p>
        <div className="lt-tribe-grid" style={{
          marginTop: 36, display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16,
          textAlign: 'left', maxWidth: 720, marginLeft: 'auto', marginRight: 'auto',
        }}>
          <div style={{
            background: '#FAF8F5', border: '1px solid rgba(0,0,0,0.06)',
            borderRadius: 14, padding: '22px 24px',
            boxShadow: '0 1px 2px rgba(60,50,40,0.06)',
          }}>
            <div style={{
              fontFamily: 'DM Sans, sans-serif', fontSize: 10.5, fontWeight: 700,
              letterSpacing: '0.14em', textTransform: 'uppercase', color: '#3D9B5F',
              display: 'flex', alignItems: 'center', gap: 8,
            }}>
              <span style={{ width: 6, height: 6, borderRadius: 1, background: '#3D9B5F' }} />
              For you if
            </div>
            <p style={{
              fontFamily: 'DM Sans, sans-serif', fontSize: 14.5, color: '#2C2A26',
              lineHeight: 1.55, margin: '10px 0 0',
            }}>
              You've ever driven home from a session replaying one hand — and couldn't tell
              yourself whether you played it right.
            </p>
          </div>
          <div style={{
            background: '#FAF8F5', border: '1px solid rgba(0,0,0,0.06)',
            borderRadius: 14, padding: '22px 24px',
            boxShadow: '0 1px 2px rgba(60,50,40,0.06)',
          }}>
            <div style={{
              fontFamily: 'DM Sans, sans-serif', fontSize: 10.5, fontWeight: 700,
              letterSpacing: '0.14em', textTransform: 'uppercase', color: '#B07373',
              display: 'flex', alignItems: 'center', gap: 8,
            }}>
              <span style={{ width: 6, height: 6, borderRadius: 1, background: '#B07373' }} />
              Not for you if
            </div>
            <p style={{
              fontFamily: 'DM Sans, sans-serif', fontSize: 14.5, color: '#2C2A26',
              lineHeight: 1.55, margin: '10px 0 0',
            }}>
              You play online (trackers already have you covered), or show up once a month for fun.
              Livetell is for the grind.
            </p>
          </div>
        </div>
      </div>
    </section>
  );
}

/* ─── Founder note ──────────────────────────────────────────────────────── */

function FounderNote() {
  return (
    <section className="lt-sec-pad" style={{ padding: '48px 32px 96px' }}>
      <div className="lt-founder-pad" style={{
        maxWidth: 820, margin: '0 auto',
        background: '#EEEBE5', borderRadius: 24, padding: '48px 52px',
        position: 'relative', overflow: 'hidden',
      }}>
        <div aria-hidden="true" style={{
          position: 'absolute', inset: 0, pointerEvents: 'none', opacity: 0.5,
          backgroundImage: 'repeating-linear-gradient(transparent, transparent 31px, rgba(0,0,0,0.03) 31px, rgba(0,0,0,0.03) 32px)',
        }} />
        <div style={{ position: 'relative' }}>
          <div style={lblStyle()}>Why I built this</div>
          <blockquote style={{
            margin: '18px 0 0', padding: '6px 0 6px 22px',
            borderLeft: '3px solid #E8642C',
            fontFamily: 'DM Sans, sans-serif',
            fontSize: 'clamp(24px, 2.8vw, 34px)',
            fontWeight: 600, fontStyle: 'italic',
            lineHeight: 1.25, letterSpacing: '-0.02em',
            color: '#2C2A26', textWrap: 'balance',
          }}>
            "I can hardly remember how I built my bankroll, but I can't stop
            thinking about the way I lost it."
            <footer style={{
              marginTop: 14, fontStyle: 'normal',
              fontFamily: 'JetBrains Mono, monospace', fontSize: 12,
              fontWeight: 500, letterSpacing: '0.02em', color: '#7A7670',
            }}>
              — Mike McDermott, <span style={{ fontStyle: 'italic' }}>Rounders</span> (1998)
            </footer>
          </blockquote>
          <div style={{
            fontFamily: 'DM Sans, sans-serif', fontSize: 16.5, color: '#3D3A33',
            lineHeight: 1.65, marginTop: 28, textWrap: 'pretty',
            display: 'flex', flexDirection: 'column', gap: 16,
          }}>
            <p style={{ margin: 0 }}>
              Every live player knows that feeling. I felt it after a big pot I lost to a friend
              in a home game — it wasn't the money that kept me up, it was not knowing whether
              the decision was right, even after losing. Poker is a decision-making game,
              but I had no way to see my own decisions. I knew I wasn't the only one.
            </p>
            <p style={{ margin: 0 }}>
              I tried Apple Notes — scattered. I tried the tracker apps on the store — too strict to fill
              out at the table when you've got 30 seconds before the next hand deals. So I built the
              mirror I needed.
            </p>
            <p style={{ margin: 0 }}>
              If you play live, take the game seriously, and are tired of judging yourself by the pots
              you lose — this is for you.
            </p>
          </div>
          <div style={{
            marginTop: 28, display: 'flex', alignItems: 'center', gap: 14,
          }}>
            <div style={{
              width: 44, height: 44, borderRadius: 22,
              background: '#2C2A26', color: '#FAF8F5',
              display: 'flex', alignItems: 'center', justifyContent: 'center',
              fontFamily: 'DM Sans, sans-serif', fontWeight: 700, fontSize: 16,
              letterSpacing: '-0.01em',
            }}>K</div>
            <div>
              <div style={{
                fontFamily: 'DM Sans, sans-serif', fontWeight: 700, fontSize: 14.5, color: '#2C2A26',
              }}>Ken</div>
              <div style={{
                fontFamily: 'JetBrains Mono, monospace', fontSize: 12, color: '#7A7670', marginTop: 2,
              }}>Founder · still grinding live</div>
            </div>
          </div>
        </div>
      </div>
    </section>
  );
}

/* ─── Pricing ───────────────────────────────────────────────────────────── */

function Pricing() {
  const [plan, setPlan] = useState('annual');
  const monthly = plan === 'annual' ? '$7.00' : '$9.99';
  const yearNote = plan === 'annual' ? '$83.99/yr billed annually · save $36' : '';

  const benefits = [
    { feature: 'Note logging', free: '10 lifetime', pro: 'Unlimited' },
    { feature: 'Sessions', free: '1 lifetime', pro: 'Unlimited' },
    { feature: 'Tags & filters', free: '—', pro: '✓' },
    { feature: 'Analyze dashboard', free: '—', pro: '✓', soon: true },
    { feature: 'Leak detection', free: '—', pro: '✓', soon: true },
    { feature: 'GTO Wizard export', free: '—', pro: '✓', soon: true },
  ];

  const checkIcon = (size = 11, color = '#E8642C') => (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round">
      <path d="M20 6L9 17l-5-5" />
    </svg>
  );

  return (
    <section id="pricing" className="lt-sec-pad" style={{ padding: '96px 32px 16px' }}>
      <div style={{ maxWidth: 1200, margin: '0 auto' }}>
        <div style={{ textAlign: 'center', marginBottom: 48 }}>
          <div style={{ ...lblStyle(), display: 'inline-block' }}>Pricing</div>
          <h2 style={{ ...h2Style(), maxWidth: 720, margin: '12px auto 0', textAlign: 'center' }}>
            See yourself play. Fix what's costing you.
          </h2>
          <p style={{
            fontFamily: 'DM Sans, sans-serif', fontSize: 15, color: '#7A7670',
            lineHeight: 1.45, maxWidth: 360, margin: '12px auto 0',
          }}>
            Log your hand, spot your leaks, and turn your sessions into real edges.
          </p>
        </div>

        <div style={{
          maxWidth: 440, margin: '0 auto',
          background: '#FAF8F5', borderRadius: 16,
          border: '1px solid rgba(0,0,0,0.06)',
          boxShadow: '0 4px 24px rgba(44,42,38,0.10)',
          padding: 20, position: 'relative', overflow: 'hidden',
        }}>
          <div style={{ position: 'absolute', top: 0, left: 0, right: 0, height: 2.5, background: '#E8642C' }} />

          <div style={{ display: 'inline-flex', padding: '4px 10px', background: 'rgba(232,100,44,0.10)', borderRadius: 999, marginBottom: 16, alignItems: 'center', gap: 6 }}>
            <span style={{ fontSize: 11 }}>🔥</span>
            <span style={{ fontFamily: 'DM Sans, sans-serif', fontSize: 11, fontWeight: 700, letterSpacing: '0.04em', color: '#E8642C' }}>LIVETELL PRO</span>
          </div>

          <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 16 }}>
            <div style={{
              display: 'inline-flex', alignItems: 'center',
              background: '#EEEBE5', borderRadius: 10, padding: 2,
            }}>
              {['monthly', 'annual'].map(p => (
                <button key={p} onClick={() => setPlan(p)} style={{
                  padding: '6px 14px', minHeight: 32, borderRadius: 8,
                  border: 'none', fontSize: 13, fontWeight: 600,
                  fontFamily: 'DM Sans, sans-serif',
                  background: plan === p ? '#FAF8F5' : 'transparent',
                  color: plan === p ? '#2C2A26' : '#7A7670',
                  boxShadow: plan === p ? '0 1px 3px rgba(44,42,38,0.10)' : 'none',
                  cursor: 'pointer', transition: 'all 200ms',
                  textTransform: 'capitalize',
                  display: 'inline-flex', alignItems: 'center', gap: 6,
                }}>
                  <span>{p}</span>
                  {p === 'annual' && (
                    <span style={{
                      fontSize: 10, fontWeight: 700, color: '#E8642C',
                      background: 'rgba(232,100,44,0.10)', padding: '2px 6px',
                      borderRadius: 999, letterSpacing: '0.02em',
                    }}>SAVE 28%</span>
                  )}
                </button>
              ))}
            </div>
          </div>

          <div style={{ display: 'flex', alignItems: 'baseline', gap: 6, marginBottom: yearNote ? 4 : 16 }}>
            <span style={{
              fontFamily: 'JetBrains Mono, monospace', fontSize: 36, fontWeight: 700,
              letterSpacing: '-0.02em', color: '#2C2A26', fontVariantNumeric: 'tabular-nums',
            }}>{monthly}</span>
            <span style={{ fontFamily: 'DM Sans, sans-serif', fontSize: 15, fontWeight: 500, color: '#7A7670' }}>/mo</span>
          </div>
          {yearNote && (
            <div style={{ fontFamily: 'DM Sans, sans-serif', fontSize: 13, color: '#7A7670', marginBottom: 16 }}>{yearNote}</div>
          )}

          <div style={{ borderRadius: 12, border: '1px solid rgba(0,0,0,0.05)', overflow: 'hidden', marginBottom: 20 }}>
            <table style={{ width: '100%', borderCollapse: 'collapse' }}>
              <thead>
                <tr style={{ background: '#EEEBE5' }}>
                  <th style={{ width: '40%', padding: '10px 12px', textAlign: 'left', fontFamily: 'DM Sans, sans-serif', fontSize: 10, fontWeight: 700, letterSpacing: '0.10em', textTransform: 'uppercase', color: '#7A7670' }} />
                  <th style={{ width: '30%', padding: '10px 8px', textAlign: 'center', fontFamily: 'DM Sans, sans-serif', fontSize: 10, fontWeight: 700, letterSpacing: '0.10em', textTransform: 'uppercase', color: '#7A7670' }}>Free</th>
                  <th style={{ width: '30%', padding: '10px 8px', textAlign: 'center', fontFamily: 'DM Sans, sans-serif', fontSize: 10, fontWeight: 700, letterSpacing: '0.10em', textTransform: 'uppercase', color: '#E8642C', background: 'rgba(232,100,44,0.10)' }}>
                    <span style={{ display: 'inline-flex', alignItems: 'center', gap: 4 }}>
                      <span style={{ fontSize: 9 }}>🔥</span> Pro
                    </span>
                  </th>
                </tr>
              </thead>
              <tbody>
                {benefits.map((b, i) => (
                  <tr key={i} style={{ borderTop: '1px solid rgba(0,0,0,0.05)' }}>
                    <td style={{ padding: '12px 12px', fontFamily: 'DM Sans, sans-serif', fontSize: 14, fontWeight: 500, color: '#5A5750', lineHeight: 1.4 }}>
                      {b.feature}
                      {b.soon && <span style={{ fontFamily: 'DM Sans, sans-serif', fontSize: 11, fontWeight: 500, color: '#B8B3A8', marginLeft: 4 }}>· soon</span>}
                    </td>
                    <td style={{ padding: '12px 8px', textAlign: 'center', fontFamily: 'DM Sans, sans-serif', fontSize: 14, lineHeight: 1.4, color: b.free === '—' ? '#B8B3A8' : '#7A7670', fontVariantNumeric: 'tabular-nums' }}>
                      {b.free}
                    </td>
                    <td style={{ padding: '12px 8px', textAlign: 'center', fontFamily: 'DM Sans, sans-serif', fontSize: 14, fontWeight: 700, lineHeight: 1.4, color: '#2C2A26', background: 'rgba(232,100,44,0.06)' }}>
                      <span style={{ display: 'inline-flex', alignItems: 'center', gap: 4 }}>
                        {b.pro === '✓' ? checkIcon(13) : <>{checkIcon(11)} {b.pro}</>}
                      </span>
                    </td>
                  </tr>
                ))}
              </tbody>
            </table>
          </div>

          <a href="https://my.livetell.app/pricing" style={{
            display: 'block', width: '100%', padding: '12px 16px',
            background: '#2C2A26', color: '#FAF8F5', borderRadius: 10,
            fontFamily: 'DM Sans, sans-serif', fontSize: 14, fontWeight: 700,
            textAlign: 'center', textDecoration: 'none', letterSpacing: '-0.01em',
            boxSizing: 'border-box',
          }}>Get started</a>

          <p style={{
            fontFamily: 'DM Sans, sans-serif', fontSize: 12, color: '#7A7670',
            textAlign: 'center', marginTop: 10, lineHeight: 1.4,
          }}>
            Cancel anytime. {plan === 'annual' ? 'Annual renews yearly.' : 'Monthly renews monthly.'}
          </p>
        </div>
      </div>
    </section>
  );
}

function lblStyle() {
  return {
    fontFamily: 'DM Sans, sans-serif', fontSize: 11, fontWeight: 700,
    letterSpacing: '0.14em', textTransform: 'uppercase', color: '#E8642C',
  };
}
function h2Style() {
  return {
    fontFamily: 'DM Sans, sans-serif', fontSize: 'clamp(32px, 3.4vw, 44px)',
    lineHeight: 1.05, letterSpacing: '-0.03em', color: '#2C2A26',
    fontWeight: 800, margin: '12px 0 0', textWrap: 'balance',
  };
}

/* ─── Footer ────────────────────────────────────────────────────────────── */

function Footer() {
  return (
    <footer id="journal" style={{
      borderTop: '1px solid rgba(0,0,0,0.08)',
      marginTop: 80, padding: '48px 32px 36px',
      background: '#EEEBE5',
    }}>
      <div className="lt-ft-grid" style={{
        maxWidth: 1200, margin: '0 auto',
        display: 'grid', gridTemplateColumns: '1fr', gap: 48,
      }}>
        <div>
          <Logo size={28} />
          <p style={{
            fontFamily: 'DM Sans, sans-serif', fontSize: 13, color: '#5A5750',
            marginTop: 16, lineHeight: 1.55, maxWidth: 280,
          }}>
            Type your live sessions, tag the spots that matter, review to find your leaks.
          </p>
          <div style={{ display: 'flex', gap: 6, marginTop: 20, flexWrap: 'wrap' }}>
            <span style={footTag}>Cash</span>
            <span style={footTag}>Tournament</span>
            <span style={footTag}>NLH</span>
          </div>
        </div>
      </div>
      <div style={{
        maxWidth: 1200, margin: '48px auto 0', padding: '20px 0 0',
        borderTop: '1px solid rgba(0,0,0,0.06)',
        display: 'flex', alignItems: 'center', justifyContent: 'space-between',
        fontFamily: 'JetBrains Mono, monospace', fontSize: 11, color: '#7A7670',
        letterSpacing: '0.02em', flexWrap: 'wrap', gap: 12,
      }}>
        <span>© 2026 LIVETELL · BUILT BY PLAYERS</span>
        <div style={{ display: 'flex', gap: 16, alignItems: 'center' }}>
          <a href="https://www.instagram.com/livetell.app/" target="_blank" rel="noopener noreferrer" aria-label="Instagram" style={{ color: '#7A7670', display: 'flex' }}>
            <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round">
              <rect x="2" y="2" width="20" height="20" rx="5" />
              <circle cx="12" cy="12" r="5" />
              <circle cx="17.5" cy="6.5" r="1.5" fill="currentColor" stroke="none" />
            </svg>
          </a>
          <a href="https://x.com/livetell_app" target="_blank" rel="noopener noreferrer" aria-label="X" style={{ color: '#7A7670', display: 'flex' }}>
            <svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor">
              <path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z" />
            </svg>
          </a>
          <a href="https://discord.gg/KuMzZP4RbZ" target="_blank" rel="noopener noreferrer" aria-label="Discord" style={{ color: '#7A7670', display: 'flex' }}>
            <svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor">
              <path d="M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.947 2.418-2.157 2.418z" />
            </svg>
          </a>
        </div>
      </div>
    </footer>
  );
}

function FootCol({ title, links }) {
  return (
    <div>
      <div style={{
        fontFamily: 'DM Sans, sans-serif', fontSize: 10, fontWeight: 600,
        color: '#7A7670', letterSpacing: '0.14em', textTransform: 'uppercase', marginBottom: 14,
      }}>{title}</div>
      <ul style={{ listStyle: 'none', padding: 0, margin: 0, display: 'flex', flexDirection: 'column', gap: 10 }}>
        {links.map(l => (
          <li key={l}>
            <a href="#" style={{ fontFamily: 'DM Sans, sans-serif', fontSize: 13, color: '#2C2A26', textDecoration: 'none' }}>{l}</a>
          </li>
        ))}
      </ul>
    </div>
  );
}

const footTag = {
  fontFamily: 'DM Sans, sans-serif', fontSize: 10, fontWeight: 600,
  padding: '3px 8px', borderRadius: 999,
  background: 'rgba(232,100,44,0.08)', color: '#E8642C',
  letterSpacing: '0.08em', textTransform: 'uppercase',
};

/* ─── Mount ─────────────────────────────────────────────────────────────── */

ReactDOM.createRoot(document.getElementById('root')).render(<App />);
