// no-trx-demo.jsx — "What if I have no TRX?" interactive demo for the beginners section.
// Reuses helpers exported to window by phone-demo.jsx. Exports: NoTrxDemo

const ShellX = window.ScreenShell;
const USDTX = window.USDT;
const TronX = window.TronMark;
const IconX = window.WIcon;
const NavX = window.IOSNavigator;
const StatusX = window.WalletStatusBar;

const NT_ACCENT = 'var(--accent)';
const NT_INK = '#0C1512';
const NT_MUTED = '#7C857F';
const NT_LINE = 'rgba(12,21,18,0.07)';
const NT_DARK = '#1E1E1E';
const NT_TRON = '#EF0027';
const NT_WARN = '#C4453F';

// USDT amount being sent in the demo
const NT_AMOUNT = '250';

// Buy options — match the SUN "Get TRX" sheet
const NT_TIERS = [
{ trx: '17.57', usdt: '5', tx: 2 },
{ trx: '52.71', usdt: '15', tx: 6 },
{ trx: '175.71', usdt: '50', tx: 22 }];


// small inline marks
const NT_Ic = {
  alert: <svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M10.3 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.7 3.86a2 2 0 0 0-3.42 0Z" stroke="currentColor" strokeWidth="2" strokeLinejoin="round" /><path d="M12 9v4.5M12 17.2h.01" stroke="currentColor" strokeWidth="2" strokeLinecap="round" /></svg>,
  check: <svg width="14" height="14" viewBox="0 0 24 24" fill="none"><path d="M5 13l4 4L19 7" stroke="currentColor" strokeWidth="3" strokeLinecap="round" strokeLinejoin="round" /></svg>,
  close: <svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M7 7l10 10M17 7L7 17" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" /></svg>,
  back: <svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M15 5l-7 7 7 7" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round" /></svg>,
  bolt: <svg width="14" height="14" viewBox="0 0 24 24" fill="none"><path d="M13 2L4 14h6l-1 8 9-12h-6l1-8z" fill="currentColor" /></svg>,
  trxCheck: <svg width="34" height="34" viewBox="0 0 24 24" fill="none"><path d="M5 13l4 4L19 7" stroke="currentColor" strokeWidth="2.6" strokeLinecap="round" strokeLinejoin="round" /></svg>
};

// ── SEND screen, but the wallet has no TRX ──
function NoTrxSendScreen({ onGetTrx }) {
  const keys = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '.', '0', '⌫'];
  return (
    <ShellX top={52}>
      <div style={{ display: 'flex', alignItems: 'center', gap: 12, padding: '6px 20px 14px' }}>
        <button style={{ width: 44, height: 44, borderRadius: '50%', border: `1.5px solid ${NT_LINE}`, background: '#fff', display: 'grid', placeItems: 'center', cursor: 'default', color: NT_INK, flexShrink: 0 }}>{NT_Ic.back}</button>
        <div style={{ flex: 1, textAlign: 'center', fontWeight: 700, fontSize: 17 }}>Send USDT</div>
        <div style={{ width: 44, flexShrink: 0 }} />
      </div>

      <div style={{ flex: 1, display: 'flex', flexDirection: 'column', padding: '8px 22px 0' }}>
        <div style={{ display: 'flex', alignItems: 'center', gap: 11, background: '#fff', border: `1.5px solid ${NT_LINE}`, borderRadius: 16, padding: '12px 14px' }}>
          <div style={{ width: 34, height: 34, borderRadius: '50%', background: '#EFEAFE', display: 'grid', placeItems: 'center', fontWeight: 700, color: '#6D4AFF', fontSize: 13 }}>T7</div>
          <div style={{ lineHeight: 1.2 }}>
            <div style={{ fontSize: 12.5, color: NT_MUTED }}>To</div>
            <div style={{ fontFamily: 'var(--font-mono)', fontSize: 14, fontWeight: 600 }}>T7bkq…M2dE9</div>
          </div>
          <div style={{ marginLeft: 'auto', fontSize: 13, color: NT_ACCENT, fontWeight: 700 }}>Edit</div>
        </div>

        <div style={{ flex: 1, display: 'grid', placeItems: 'center', textAlign: 'center' }}>
          <div>
            <div style={{ fontSize: 13.5, color: NT_MUTED, fontWeight: 600 }}>You send</div>
            <div style={{ display: 'flex', alignItems: 'baseline', justifyContent: 'center', gap: 6, marginTop: 6 }}>
              <span style={{ fontFamily: 'var(--font-display)', fontSize: 56, fontWeight: 800, letterSpacing: '-0.03em' }}>{NT_AMOUNT}</span>
              <span style={{ fontSize: 22, fontWeight: 700, color: NT_MUTED }}>USDT</span>
            </div>

            {/* the no-TRX moment */}
            <div style={{ display: 'flex', alignItems: 'center', gap: 11, marginTop: 18, background: 'rgba(196,69,63,.08)', border: '1.5px solid rgba(196,69,63,.22)', color: NT_WARN, padding: '12px 15px', borderRadius: 16, textAlign: 'left', maxWidth: 280 }}>
              <span style={{ flexShrink: 0 }}>{NT_Ic.alert}</span>
              <div style={{ lineHeight: 1.3 }}>
                <div style={{ fontWeight: 700, fontSize: 14.5 }}>Oops — you have no TRX</div>
                <div style={{ fontSize: 12.5, color: '#9A5450', marginTop: 1 }}>TRX pays the network fee. Top up to send.</div>
              </div>
            </div>
          </div>
        </div>

        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3,1fr)', gap: 4, marginBottom: 10, opacity: 0.45, pointerEvents: 'none' }}>
          {keys.map((k) =>
          <div key={k} style={{ height: 42, display: 'grid', placeItems: 'center', fontFamily: 'var(--font-display)', fontSize: 22, fontWeight: 600, color: NT_INK }}>{k}</div>
          )}
        </div>

        {/* Get TRX CTA — pulsing ring like the Send button */}
        <button onClick={onGetTrx} className="nt-cta" style={{ width: '100%', border: 'none', background: NT_DARK, color: '#fff', borderRadius: 18, padding: '13px 18px', cursor: 'pointer', fontFamily: 'var(--font-body)', display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 12, marginBottom: 30 }}>
          <span className="wd-cta-icon" data-comment-anchor="4a44d7747a-span-92-13" style={{ width: 38, height: 38, borderRadius: '50%', background: NT_ACCENT, display: 'grid', placeItems: 'center', position: 'relative', flexShrink: 0 }}>
            <span className="wd-ring" /><span className="wd-ring" style={{ animationDelay: '.9s' }} />
            <TronX size={22} color="#fff" />
          </span>
          <span style={{ textAlign: 'left', lineHeight: 1.15 }}>
            <span style={{ display: 'block', fontSize: 16, fontWeight: 700 }}>Get TRX</span>
            <span style={{ display: 'block', fontSize: 12, fontWeight: 500, opacity: 0.7 }}>Pay with your USDT — no TRX needed</span>
          </span>
        </button>
      </div>
    </ShellX>);
}

// ── Bottom sheet: Get TRX with USDT ──
function GetTrxModal({ onClose, onBuy }) {
  const [sel, setSel] = React.useState(2);
  const t = NT_TIERS[sel];
  return (
    <div style={{ position: 'absolute', inset: 0, zIndex: 60, display: 'flex', flexDirection: 'column', justifyContent: 'flex-end' }}>
      <div className="nt-modal-scrim" onClick={onClose} style={{ position: 'absolute', inset: 0, background: 'rgba(12,21,18,.42)' }} />
      <div className="nt-sheet" style={{ position: 'relative', background: '#FBFCFB', borderTopLeftRadius: 30, borderTopRightRadius: 30, padding: '10px 22px 22px', boxShadow: '0 -20px 60px -20px rgba(12,21,18,.4)', maxHeight: '93%', display: 'flex', flexDirection: 'column' }}>
        <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', position: 'relative', paddingBottom: 6 }}>
          <span style={{ width: 42, height: 5, borderRadius: 999, background: 'rgba(12,21,18,.16)' }} />
          <button onClick={onClose} style={{ position: 'absolute', right: -4, top: -2, width: 34, height: 34, borderRadius: '50%', border: 'none', background: 'transparent', color: NT_INK, display: 'grid', placeItems: 'center', cursor: 'pointer' }}>{NT_Ic.close}</button>
        </div>

        <div style={{ overflowY: 'auto', margin: '0 -22px', padding: '4px 22px 0' }}>
          <h3 style={{ fontFamily: 'var(--font-display)', fontSize: 26, fontWeight: 800, letterSpacing: '-0.02em', margin: '6px 0 6px' }}>Get TRX for fees</h3>
          <p style={{ fontSize: 14, color: NT_MUTED, lineHeight: 1.45, margin: 0 }}>Pay the network fee with the USDT you already hold — no TRX required, even on a brand-new wallet.</p>

          {/* balance card — the key reassurance */}
          <div style={{ marginTop: 16, background: 'var(--tint)', border: '1.5px solid var(--tint-2)', borderRadius: 18, padding: '14px 18px' }}>
            <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', fontSize: 14.5 }}>
              <span style={{ color: NT_MUTED }}>Your TRX balance</span>
              <span style={{ fontWeight: 700, fontFamily: 'var(--font-mono)' }}>0 TRX</span>
            </div>
          </div>

          <div style={{ fontFamily: 'var(--font-display)', fontSize: 17, fontWeight: 700, margin: '18px 0 10px' }}>Choose an amount</div>
          <div style={{ display: 'grid', gap: 9 }}>
            {NT_TIERS.map((tier, i) => {
              const on = i === sel;
              return (
                <button key={i} onClick={() => setSel(i)} style={{ display: 'flex', alignItems: 'center', gap: 12, textAlign: 'left', width: '100%', cursor: 'pointer', background: on ? '#fff' : '#F1F4F2', border: on ? '1.5px solid var(--accent)' : `1.5px solid ${NT_LINE}`, borderRadius: 16, padding: '12px 14px', boxShadow: on ? '0 8px 22px -12px var(--ring)' : 'none', fontFamily: 'var(--font-body)' }}>
                  <span style={{ width: 36, height: 36, borderRadius: '50%', background: '#fff', border: `1.5px solid ${NT_LINE}`, display: 'grid', placeItems: 'center', flexShrink: 0 }}><TronX size={22} /></span>
                  <span style={{ flex: 1, lineHeight: 1.25 }}>
                    <span style={{ display: 'block', fontSize: 15.5 }}><b style={{ fontWeight: 700 }}>Get {tier.trx}</b> <span style={{ color: NT_MUTED, fontSize: 13, fontWeight: 600 }}>TRX</span></span>
                    <span style={{ display: 'block', fontSize: 12.5, color: NT_MUTED, marginTop: 1 }}>Covers ~{tier.tx} transfers</span>
                  </span>
                  <span style={{ display: 'flex', alignItems: 'center', gap: 8, flexShrink: 0 }}>
                    <span style={{ fontSize: 13, color: NT_MUTED, fontWeight: 600 }}>for</span>
                    <span style={{ fontFamily: 'var(--font-display)', fontWeight: 800, fontSize: 17 }}>{tier.usdt}</span>
                    <USDTX size={26} />
                  </span>
                </button>);
            })}
          </div>

        </div>

        <button onClick={() => onBuy(t)} style={{ width: '100%', border: 'none', background: NT_DARK, color: '#fff', borderRadius: 18, padding: '15px 0', fontSize: 16, fontWeight: 700, cursor: 'pointer', fontFamily: 'var(--font-body)', marginTop: 16, flexShrink: 0 }}>Buy {t.trx} TRX for {t.usdt} USDT</button>
      </div>
    </div>);
}

// ── Success: TRX added, ready to send ──
function TrxAddedScreen({ tier, onSend }) {
  const sparks = [0, 60, 120, 180, 240, 300];
  return (
    <ShellX top={52}>
      <div style={{ flex: 1, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', padding: '0 26px', textAlign: 'center' }}>
        <div style={{ position: 'relative', width: 92, height: 92 }}>
          <span className="wd-burst" />
          {sparks.map((deg, i) => {const rad = deg * Math.PI / 180,dist = 62;return <span key={i} className="wd-spark" style={{ '--sx': `${Math.cos(rad) * dist - 3}px`, '--sy': `${Math.sin(rad) * dist - 3}px`, background: i % 2 ? 'var(--accent-2)' : 'var(--accent)' }} />;})}
          <div className="wd-check-pop" style={{ position: 'absolute', inset: 0, borderRadius: '50%', background: NT_ACCENT, color: '#fff', display: 'grid', placeItems: 'center', boxShadow: '0 16px 40px -10px var(--ring)' }}>{NT_Ic.trxCheck}</div>
        </div>

        <div className="wd-rise" style={{ animationDelay: '.18s', fontFamily: 'var(--font-display)', fontSize: 28, fontWeight: 800, marginTop: 22 }}>TRX added!</div>
        <div className="wd-rise" style={{ animationDelay: '.24s', color: NT_MUTED, fontSize: 14.5, marginTop: 7 }}>{tier.trx} TRX is in your wallet — you&rsquo;re ready to send.</div>

        <div className="wd-rise" style={{ animationDelay: '.42s', width: '100%', marginTop: 22, background: 'var(--tint)', border: '1.5px solid var(--tint-2)', borderRadius: 20, padding: '16px 20px', display: 'grid', gap: 11 }}>
          <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', fontSize: 14 }}>
            <span style={{ color: NT_MUTED }}>Paid with</span>
            <span style={{ display: 'flex', alignItems: 'center', gap: 7, fontWeight: 700 }}><USDTX size={20} />{tier.usdt} USDT</span>
          </div>
          <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', fontSize: 14, paddingTop: 11, borderTop: '1px solid var(--tint-2)' }}>
            <span style={{ color: NT_MUTED }}>TRX added to your wallet</span>
            <span style={{ fontWeight: 800, color: 'var(--accent-2)', fontFamily: 'var(--font-mono)' }}>{tier.trx} TRX</span>
          </div>
        </div>

        <div className="wd-rise" style={{ animationDelay: '.62s', display: 'inline-flex', alignItems: 'center', gap: 7, marginTop: 16, color: NT_MUTED, fontSize: 12.5 }}>
          <span style={{ color: NT_ACCENT }}>{NT_Ic.bolt}</span> Enough gas for ~{tier.tx} transfers
        </div>

        <button className="wd-rise" onClick={onSend} style={{ animationDelay: '.82s', width: '100%', border: 'none', background: NT_DARK, color: '#fff', borderRadius: 16, padding: '15px 0', fontSize: 15.5, fontWeight: 700, cursor: 'pointer', fontFamily: 'var(--font-body)', marginTop: 26 }} data-comment-anchor="5bf4d95f86-button-182-9">Send my 250 USDT now</button>
      </div>
    </ShellX>);
}

const NT_DEPTH = { send: 0, gettingTrx: 1, trxAdded: 2, review: 3, broadcasting: 4, sent: 5 };

const SavingsCountX = window.SavingsCount;

// ── REVIEW & CONFIRM — same confirmation page as the Hero app ──
function NoTrxReviewScreen({ onBack, onConfirm }) {
  const amt = parseFloat(NT_AMOUNT) || 0;
  return (
    <ShellX top={52}>
      <div style={{ display: 'flex', alignItems: 'center', gap: 12, padding: '6px 20px 14px' }}>
        <button onClick={onBack} style={{ width: 44, height: 44, borderRadius: '50%', border: `1.5px solid ${NT_LINE}`, background: '#fff', display: 'grid', placeItems: 'center', cursor: 'pointer', color: NT_INK, flexShrink: 0 }}>{NT_Ic.back}</button>
        <div style={{ flex: 1, textAlign: 'center', fontWeight: 700, fontSize: 17 }}>Review</div>
        <div style={{ width: 44, flexShrink: 0 }} />
      </div>
      <div style={{ flex: 1, padding: '8px 22px 0', display: 'flex', flexDirection: 'column' }}>
        <div style={{ background: 'linear-gradient(180deg,#EFEFEF,#E8E8E8)', borderRadius: 22, padding: 22, textAlign: 'center' }}>
          <div style={{ display: 'grid', placeItems: 'center' }}><USDTX size={44} /></div>
          <div style={{ fontFamily: 'var(--font-display)', fontSize: 40, fontWeight: 800, marginTop: 12, letterSpacing: '-0.03em' }}>{amt.toFixed(2)}</div>
          <div style={{ fontSize: 13.5, color: NT_MUTED, fontWeight: 600 }}>USDT to T7bkq…M2dE9</div>
        </div>
        <div style={{ background: '#fff', border: `1.5px solid ${NT_LINE}`, borderRadius: 18, padding: '6px 18px', marginTop: 14 }}>
          {[
          ['Amount', `${amt.toFixed(2)} USDT`],
          ['Network', 'Tron (TRC-20)']].
          map(([k, v], i) =>
          <div key={i} style={{ display: 'flex', justifyContent: 'space-between', padding: '13px 0', borderBottom: `1px solid ${NT_LINE}`, fontSize: 14 }}>
              <span style={{ color: NT_MUTED }}>{k}</span><span style={{ fontWeight: 600, fontFamily: 'var(--font-mono)' }}>{v}</span>
            </div>
          )}
          <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '13px 0' }}>
            <span style={{ color: NT_MUTED, fontSize: 14 }}>Network fee</span>
            <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-end', gap: 3 }}>
              <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
                <span style={{ fontFamily: 'var(--font-mono)', fontSize: 13, color: NT_MUTED, textDecoration: 'line-through' }}>7 TRX</span>
                <span style={{ fontWeight: 700, fontFamily: 'var(--font-mono)', fontSize: 14 }}>3.5 TRX</span>
                <span style={{ fontSize: 11, fontWeight: 700, color: '#fff', background: NT_ACCENT, padding: '3px 7px', borderRadius: 7 }}>−50%</span>
              </div>
              <span style={{ fontSize: 11.5, color: NT_MUTED, fontFamily: 'var(--font-mono)' }}>≈ $1.10</span>
            </div>
          </div>
        </div>
        <div style={{ display: 'flex', alignItems: 'center', gap: 9, marginTop: 14, color: NT_MUTED, fontSize: 12.5 }}>
          <span style={{ color: NT_ACCENT }}>{NT_Ic.bolt}</span>
          Paid from your TRX — just topped up, no seed phrase needed.
        </div>
        <div style={{ flex: 1 }} />
        <button onClick={onConfirm} style={{ width: '100%', border: 'none', background: NT_DARK, color: '#fff', borderRadius: 18, padding: '16px 0', fontSize: 16, fontWeight: 700, cursor: 'pointer', fontFamily: 'var(--font-body)', marginBottom: 34 }}>Confirm &amp; send</button>
      </div>
    </ShellX>);
}

// ── SENT! — successful transfer, offer to run it again ──
function NoTrxSentScreen({ onRepeat }) {
  const amt = parseFloat(NT_AMOUNT) || 0;
  const sparks = [0, 60, 120, 180, 240, 300];
  return (
    <ShellX top={52}>
      <div style={{ flex: 1, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', padding: '0 26px', textAlign: 'center' }}>
        <div style={{ position: 'relative', width: 92, height: 92 }}>
          <span className="wd-burst" />
          {sparks.map((deg, i) => {const rad = deg * Math.PI / 180,dist = 62;return <span key={i} className="wd-spark" style={{ '--sx': `${Math.cos(rad) * dist - 3}px`, '--sy': `${Math.sin(rad) * dist - 3}px`, background: i % 2 ? 'var(--accent-2)' : 'var(--accent)' }} />;})}
          <div className="wd-check-pop" style={{ position: 'absolute', inset: 0, borderRadius: '50%', background: NT_ACCENT, color: '#fff', display: 'grid', placeItems: 'center', boxShadow: '0 16px 40px -10px var(--ring)' }}>{NT_Ic.trxCheck}</div>
        </div>

        <div className="wd-rise" style={{ animationDelay: '.18s', fontFamily: 'var(--font-display)', fontSize: 28, fontWeight: 800, marginTop: 22 }}>Sent!</div>
        <div className="wd-rise" style={{ animationDelay: '.24s', color: NT_MUTED, fontSize: 14.5, marginTop: 7 }}>{amt.toFixed(2)} USDT delivered in seconds.</div>

        <div className="wd-rise" style={{ animationDelay: '.42s', width: '100%', marginTop: 22, background: 'var(--tint)', border: '1.5px solid var(--tint-2)', borderRadius: 20, padding: '18px 20px' }}>
          <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 7, fontSize: 12.5, fontWeight: 700, letterSpacing: '0.04em', textTransform: 'uppercase', color: 'var(--accent-2)' }}>
            <span style={{ color: NT_ACCENT }}>{NT_Ic.bolt}</span> You just saved
          </div>
          <div style={{ display: 'flex', alignItems: 'baseline', justifyContent: 'center', gap: 9, marginTop: 8 }}>
            <span style={{ fontFamily: 'var(--font-display)', fontSize: 44, fontWeight: 800, letterSpacing: '-0.03em', color: NT_INK, lineHeight: 1 }}>$1.10</span>
            <span style={{ fontSize: 11.5, fontWeight: 800, color: '#fff', background: NT_ACCENT, padding: '4px 8px', borderRadius: 8 }}>−50%</span>
          </div>
          <div style={{ fontSize: 13, color: NT_MUTED, marginTop: 9 }}>
            <span style={{ fontFamily: 'var(--font-mono)', textDecoration: 'line-through', opacity: 0.7 }}>7 TRX</span>
            <span style={{ margin: '0 6px' }}>→</span>
            <span style={{ fontFamily: 'var(--font-mono)', fontWeight: 700, color: NT_INK }}>3.5 TRX</span>
            <span> kept in your wallet</span>
          </div>
        </div>

        <button className="wd-rise" onClick={onRepeat} style={{ animationDelay: '.7s', width: '100%', border: 'none', background: NT_DARK, color: '#fff', borderRadius: 16, padding: '15px 0', fontSize: 15.5, fontWeight: 700, cursor: 'pointer', fontFamily: 'var(--font-body)', marginTop: 26 }}>Repeat transaction</button>
        <div className="wd-rise" style={{ animationDelay: '.78s', fontSize: 12.5, color: NT_MUTED, marginTop: 10 }}>Runs the no-TRX flow again from the start</div>
      </div>
    </ShellX>);
}

function NoTrxDemo({ scale = 1 }) {
  const [screen, setScreen] = React.useState('send');
  const [modal, setModal] = React.useState(false);
  const [tier, setTier] = React.useState(NT_TIERS[2]);

  const buy = (t) => {setTier(t);setModal(false);setScreen('gettingTrx');setTimeout(() => setScreen('trxAdded'), 1150);};
  const confirm = () => {setScreen('broadcasting');setTimeout(() => setScreen('sent'), 1100);};

  const Spinner = ({ label }) =>
    <ShellX top={52}>
      <div style={{ flex: 1, display: 'grid', placeItems: 'center' }}>
        <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 16, color: NT_MUTED }}>
          <div className="wd-spin" style={{ width: 46, height: 46, borderRadius: '50%', border: `3px solid ${NT_LINE}`, borderTopColor: NT_ACCENT }} />
          <span style={{ fontSize: 14, fontWeight: 600 }}>{label}</span>
        </div>
      </div>
    </ShellX>;

  const render = (key) => {
    switch (key) {
      case 'send':return <NoTrxSendScreen onGetTrx={() => setModal(true)} />;
      case 'gettingTrx':return <Spinner label="Getting your TRX…" />;
      case 'trxAdded':return <TrxAddedScreen tier={tier} onSend={() => setScreen('review')} />;
      case 'review':return <NoTrxReviewScreen onBack={() => setScreen('trxAdded')} onConfirm={confirm} />;
      case 'broadcasting':return <Spinner label="Signing &amp; broadcasting…" />;
      case 'sent':return <NoTrxSentScreen onRepeat={() => setScreen('send')} />;
      default:return null;
    }
  };

  return (
    <div style={{ transform: `scale(${scale})`, transformOrigin: 'center top' }}>
      <IOSDevice width={392} height={812} statusBar={<StatusX />} hideIsland>
        <NavX screen={screen} render={render} depth={NT_DEPTH} />
        {modal && <GetTrxModal onClose={() => setModal(false)} onBuy={buy} />}
      </IOSDevice>
    </div>);
}

window.NoTrxDemo = NoTrxDemo;