// 튜브픽 v2 — 공통 레이아웃: Header, Footer, 글로벌 스타일
const { useState, useEffect, useRef } = React;
const T = window.TP2_THEME;
const D2 = window.TP2_DATA;
const F2 = window.TP2_FORMAT;

// 글로벌 CSS 인젝트
if (typeof document !== 'undefined' && !document.getElementById('tp2-globals')) {
  const s = document.createElement('style');
  s.id = 'tp2-globals';
  s.textContent = `
    html, body { margin:0; padding:0; background:${T.bg}; color:${T.ink}; font-family:${T.sans}; }
    * { box-sizing: border-box; }
    a { color: inherit; text-decoration: none; }
    button { font-family: ${T.sans}; }
    .tp2-link { color: ${T.sub}; transition: color .15s; }
    .tp2-link:hover { color: ${T.ink}; }
    .tp2-active { color: ${T.ink} !important; font-weight: 700; }
    @keyframes tp2-marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
    @keyframes tp2-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
    @keyframes tp2-fadeup { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
    img, svg, video { max-width: 100%; }
    /* === 관리자 편집 가능 텍스트(rich)에서 사용하는 클래스 === */
    .hot { color: ${T.hot}; }
    .tp2-rich-ink strong { color: ${T.ink}; font-weight: 700; }
    .tp2-rich-dark strong { color: #fff; font-weight: 700; }
    .tp2-rich-ink .hot, .tp2-rich-dark .hot { color: ${T.hot}; }

    /* === TABLET (≤1100px) === */
    @media (max-width: 1100px) {
      main [style*="grid-template-columns: repeat(4, 1fr)"] { grid-template-columns: repeat(2, 1fr) !important; }
      main [style*="grid-template-columns: 1.3fr 1fr"],
      main [style*="grid-template-columns: 1.2fr 1fr"],
      main [style*="grid-template-columns: 1.1fr 1fr"] { grid-template-columns: 1fr !important; }
      main [style*="font-size: 116px"] { font-size: 84px !important; letter-spacing: -2.5px !important; }
    }

    /* === MOBILE (≤768px) === */
    @media (max-width: 768px) {
      /* Header */
      header { padding: 12px 16px !important; flex-wrap: wrap !important; gap: 8px !important; }
      header > nav { order: 3 !important; width: 100% !important; flex-wrap: wrap !important; gap: 6px 14px !important; font-size: 12px !important; justify-content: flex-start !important; }
      header > div:last-child { gap: 6px !important; }
      header a[style*="padding: 10px 18px"] { padding: 8px 12px !important; font-size: 12px !important; }
      header a[style*="padding: 10px 16px"] { padding: 8px 12px !important; font-size: 12px !important; }

      /* Sections — collapse horizontal padding & tame vertical */
      main > section {
        padding-top: 56px !important;
        padding-bottom: 56px !important;
        padding-left: 16px !important;
        padding-right: 16px !important;
      }
      main > section:first-child { padding-top: 48px !important; }

      /* Footer */
      footer { padding: 48px 16px 24px !important; }
      footer > div:first-child { gap: 24px !important; margin-bottom: 32px !important; }
      footer [style*="display: flex"][style*="justify-content: space-between"] { flex-direction: column !important; gap: 8px !important; align-items: flex-start !important; }

      /* Headings (catch-all) */
      main h1 { font-size: 40px !important; line-height: 1.05 !important; letter-spacing: -1.2px !important; }
      main h2 { font-size: 28px !important; line-height: 1.1 !important; letter-spacing: -0.8px !important; }
      main h3 { font-size: 20px !important; line-height: 1.25 !important; letter-spacing: -0.3px !important; }

      /* Specific large fonts (decorative numbers, hero h1, big stats) */
      [style*="font-size: 220px"] { font-size: 80px !important; right: -8px !important; top: 8px !important; letter-spacing: -3px !important; }
      [style*="font-size: 140px"] { font-size: 64px !important; }
      [style*="font-size: 116px"] { font-size: 44px !important; letter-spacing: -1.5px !important; line-height: 1.05 !important; }
      [style*="font-size: 96px"]  { font-size: 56px !important; letter-spacing: -1.5px !important; }
      [style*="font-size: 84px"]  { font-size: 40px !important; letter-spacing: -1.2px !important; line-height: 1.05 !important; }
      [style*="font-size: 80px"]  { font-size: 40px !important; }
      [style*="font-size: 76px"]  { font-size: 36px !important; letter-spacing: -1px !important; line-height: 1.05 !important; }
      [style*="font-size: 64px"]  { font-size: 30px !important; letter-spacing: -1px !important; }
      [style*="font-size: 56px"]  { font-size: 28px !important; letter-spacing: -0.8px !important; }
      [style*="font-size: 52px"]  { font-size: 28px !important; letter-spacing: -0.8px !important; }
      [style*="font-size: 48px"]  { font-size: 26px !important; letter-spacing: -0.8px !important; }
      [style*="font-size: 36px"]  { font-size: 22px !important; }
      [style*="font-size: 28px"]  { font-size: 22px !important; }
      [style*="font-size: 21px"]  { font-size: 15px !important; }
      [style*="font-size: 19px"]  { font-size: 15px !important; }
      [style*="font-size: 17px"]  { font-size: 14px !important; }

      /* Grids → 1 col (catch-all) */
      main [style*="grid-template-columns"], footer [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
      }
      /* Exception: 4-col grids → 2x2 */
      main [style*="grid-template-columns: repeat(4, 1fr)"] {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0 !important;
      }
      /* Exception: footer top → 2x2 */
      footer [style*="grid-template-columns: 1.5fr 1fr 1fr 1fr"] {
        grid-template-columns: 1fr 1fr !important;
        gap: 24px !important;
      }
      /* Compare table — left-align stacked */
      main [style*="grid-template-columns: 1.4fr 1fr 1fr"] > div { text-align: left !important; justify-content: flex-start !important; }
      main [style*="grid-template-columns: 1.4fr 1fr 1fr"] > div:first-child:empty { display: none !important; }

      /* CTA banner inner card */
      [style*="padding: 72px 56px"] { padding: 40px 22px !important; }

      /* Numbers / counter cells */
      [style*="padding: 36px 28px"] { padding: 22px 16px !important; }
      [style*="padding: 36px 32px"] { padding: 22px 18px !important; }

      /* Big rounded cards */
      [style*="padding: 48px"][style*="border-radius: 24px"] { padding: 28px !important; }
      [style*="padding: 40px"][style*="border-radius: 24px"] { padding: 24px !important; }
      [style*="padding: 36px"][style*="border-radius"] { padding: 24px !important; }
      [style*="padding: 28px"][style*="border-radius"] { padding: 20px !important; }

      /* Pricing toggle (channels) → vertical pill */
      main [style*="display: inline-flex"][style*="border-radius: 999"][style*="padding: 4px"] {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 320px !important;
        margin-left: auto !important;
        margin-right: auto !important;
      }
      main [style*="border-radius: 999"][style*="padding: 9px 18px"] { width: 100% !important; text-align: center !important; }

      /* CTA pill / heading buttons compress */
      main a[style*="padding: 16px 32px"], main a[style*="padding: 16px 28px"], main button[style*="padding: 16px"] {
        padding: 13px 20px !important; font-size: 14px !important;
      }
      main a[style*="padding: 14px 28px"] { padding: 12px 18px !important; font-size: 13px !important; }
      main [style*="padding: 14px 20px"] { padding: 10px 14px !important; }

      /* Risk hero book */
      [style*="rotate(-4deg)"] { width: 240px !important; height: 320px !important; padding: 22px !important; }

      /* Mini stat row gaps */
      main [style*="gap: 56px"] { gap: 14px !important; font-size: 12px !important; }
      main [style*="gap: 48"] { gap: 24px !important; }

      /* Seller-story image height */
      img[style*="max-height: 420px"] { max-height: 240px !important; }

      /* Hero halos / radial bg — keep inside */
      main section { overflow: hidden; }

      /* FAQ search input */
      [style*="padding: 6px 6px 6px 24px"] { padding: 4px 4px 4px 16px !important; }
      [style*="padding: 12px 0"] { padding: 10px 0 !important; }

      /* Compare row padding */
      main [style*="padding: 20px 28px"] { padding: 14px 18px !important; }
      main [style*="padding: 20px 28px"][style*="grid-template"] > div + div { margin-top: 4px !important; }
    }

    /* === SMALL (≤420px) — extreme phones === */
    @media (max-width: 420px) {
      main h1 { font-size: 34px !important; }
      main h2 { font-size: 24px !important; }
      [style*="font-size: 116px"] { font-size: 38px !important; }
      [style*="font-size: 84px"]  { font-size: 34px !important; }
      [style*="font-size: 76px"]  { font-size: 32px !important; }
      header > nav { font-size: 11px !important; gap: 4px 12px !important; }
    }
  `;
  document.head.appendChild(s);
}

// HEADER (모든 페이지 공통)
function TP2Header({ active }) {
  return (
    <header style={{
      padding: '18px 48px',
      display: 'flex', alignItems: 'center', justifyContent: 'space-between',
      position: 'sticky', top: 0, zIndex: 50,
      background: 'rgba(250,250,250,.85)', backdropFilter: 'blur(12px)',
      borderBottom: `1px solid ${T.line}`,
    }}>
      <a href="index.html" style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
        <div style={{
          width: 32, height: 32, borderRadius: 9,
          background: `linear-gradient(135deg, ${T.accent}, ${T.accent2})`,
          display: 'grid', placeItems: 'center',
          color: '#fff', fontSize: 17, fontWeight: 800,
        }}>T</div>
        <span style={{ fontSize: 18, fontWeight: 800, letterSpacing: -0.3 }}>튜브픽</span>
        <span style={{
          fontFamily: T.mono, fontSize: 10, color: T.accent,
          background: 'rgba(91,71,224,.1)', padding: '2px 8px', borderRadius: 999,
          marginLeft: 4, letterSpacing: 1, fontWeight: 700,
        }}>LIVE</span>
      </a>
      <nav style={{ display: 'flex', gap: 28, fontSize: 14 }}>
        {D2.nav.map(n => (
          <a
            key={n.href}
            href={n.href}
            className={`tp2-link ${active === n.href ? 'tp2-active' : ''}`}
            style={{ color: T.sub }}
          >{n.label}</a>
        ))}
      </nav>
      <div style={{ display: 'flex', gap: 8 }}>
        <a href="faq.html" style={{
          color: T.ink, border: `1px solid ${T.line}`, background: T.card,
          padding: '10px 16px', fontSize: 13, fontWeight: 600,
          borderRadius: 10,
        }}>FAQ</a>
        <a href="https://open.kakao.com/o/sqs5vuti" target="_blank" style={{
          background: T.ink, color: '#fff',
          padding: '10px 18px', fontSize: 13, fontWeight: 700,
          borderRadius: 10, display: 'inline-flex', alignItems: 'center', gap: 6,
        }}>💬 오픈톡 문의 →</a>
      </div>
    </header>
  );
}

// FOOTER (모든 페이지 공통)
function TP2Footer() {
  return (
    <footer style={{
      background: T.ink, color: '#fff',
      padding: '64px 48px 32px',
    }}>
      <div style={{
        display: 'grid', gridTemplateColumns: '1.5fr 1fr 1fr 1fr',
        gap: 48, marginBottom: 48, maxWidth: 1280, margin: '0 auto 48px',
      }}>
        <div>
          <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 16 }}>
            <div style={{
              width: 32, height: 32, borderRadius: 9,
              background: `linear-gradient(135deg, ${T.accent}, ${T.accent2})`,
              display: 'grid', placeItems: 'center',
              color: '#fff', fontSize: 17, fontWeight: 800,
            }}>T</div>
            <span style={{ fontSize: 18, fontWeight: 800 }}>튜브픽</span>
          </div>
          <p style={{ fontSize: 13, color: 'rgba(255,255,255,.55)', lineHeight: 1.7, margin: 0, maxWidth: 320 }}>
            검증된 유튜브 수익화 채널, 가장 빠르고 안전하게.
            구매부터 운영까지 카카오톡 오픈채팅으로 1:1 상담드립니다.
          </p>
        </div>
        <div>
          <div style={{ fontSize: 12, fontWeight: 700, letterSpacing: 1, color: T.accent2, marginBottom: 16 }}>SITEMAP</div>
          <ul style={{ margin: 0, padding: 0, listStyle: 'none', display: 'flex', flexDirection: 'column', gap: 10, fontSize: 13 }}>
            {D2.nav.map(n => (
              <li key={n.href}>
                <a href={n.href} style={{ color: 'rgba(255,255,255,.7)' }}>{n.label}</a>
              </li>
            ))}
          </ul>
        </div>
        <div>
          <div style={{ fontSize: 12, fontWeight: 700, letterSpacing: 1, color: T.accent2, marginBottom: 16 }}>지원</div>
          <ul style={{ margin: 0, padding: 0, listStyle: 'none', display: 'flex', flexDirection: 'column', gap: 10, fontSize: 13, color: 'rgba(255,255,255,.7)' }}>
            <li>한 달 토탈 AS 케어</li>
            <li>1:1 카톡 상담</li>
            <li>평균 3일 이전</li>
            <li>안전결제</li>
          </ul>
        </div>
        <div>
          <div style={{ fontSize: 12, fontWeight: 700, letterSpacing: 1, color: T.accent2, marginBottom: 16 }}>문의</div>
          <a href="https://open.kakao.com/o/sqs5vuti" target="_blank" style={{
            display: 'inline-block',
            background: T.accent, color: '#fff', padding: '10px 16px',
            borderRadius: 10, fontSize: 13, fontWeight: 700,
          }}>💬 오픈톡 열기 →</a>
          <p style={{ margin: '16px 0 0', fontSize: 12, color: 'rgba(255,255,255,.5)', lineHeight: 1.65 }}>
            평균 응답 30분 이내<br/>
            (영업시간 기준)
          </p>
        </div>
      </div>
      <div style={{
        borderTop: '1px solid rgba(255,255,255,.1)',
        paddingTop: 24, maxWidth: 1280, margin: '0 auto',
        display: 'flex', justifyContent: 'space-between',
        fontSize: 12, color: 'rgba(255,255,255,.4)',
      }}>
        <span>© 2025 튜브픽 (TubePick). All rights reserved.</span>
        <span style={{ fontFamily: T.mono }}>VERIFIED CHANNELS · SINCE 2024</span>
      </div>
    </footer>
  );
}

// PAGE WRAP
function TP2Page({ active, children }) {
  return (
    <>
      <TP2Header active={active} />
      <main>{children}</main>
      <TP2Footer />
    </>
  );
}

// 줄무늬 placeholder
function TP2Placeholder({ label, w, h, bg = T.bg, stripe = 'rgba(91,71,224,.12)', fg = T.accent, radius = 12, style = {} }) {
  return (
    <div style={{
      width: w || '100%', height: h,
      background: `repeating-linear-gradient(135deg, ${bg} 0 14px, ${stripe} 14px 16px)`,
      borderRadius: radius,
      display: 'flex', alignItems: 'center', justifyContent: 'center',
      color: fg,
      fontFamily: T.mono, fontSize: 11,
      letterSpacing: 0.5, textTransform: 'uppercase',
      userSelect: 'none', ...style,
    }}>
      <span style={{ background: bg, padding: '4px 8px' }}>{label}</span>
    </div>
  );
}

// 카운터 (뷰포트 진입)
function TP2Counter({ to, suffix = '', duration = 1400, style = {} }) {
  const [n, setN] = useState(0);
  const ref = useRef(null);
  const started = useRef(false);
  useEffect(() => {
    const el = ref.current;
    if (!el) return;
    const io = new IntersectionObserver((entries) => {
      entries.forEach((e) => {
        if (e.isIntersecting && !started.current) {
          started.current = true;
          const start = performance.now();
          const tick = (t) => {
            const p = Math.min(1, (t - start) / duration);
            const eased = 1 - Math.pow(1 - p, 3);
            setN(Math.floor(eased * to));
            if (p < 1) requestAnimationFrame(tick);
            else setN(to);
          };
          requestAnimationFrame(tick);
        }
      });
    }, { threshold: 0.4 });
    io.observe(el);
    return () => io.disconnect();
  }, [to, duration]);
  return <span ref={ref} style={style}>{n.toLocaleString()}{suffix}</span>;
}

// 가격 티어 토글
function TP2Toggle({ tiers, value, onChange }) {
  return (
    <div style={{
      display: 'inline-flex', background: T.card, padding: 4,
      borderRadius: 999, gap: 2, border: `1px solid ${T.line}`,
    }}>
      {tiers.map((t) => {
        const active = t.id === value;
        return (
          <button
            key={t.id}
            onClick={() => onChange(t.id)}
            style={{
              border: 'none', cursor: 'pointer',
              background: active ? T.ink : 'transparent',
              color: active ? '#fff' : T.sub,
              padding: '9px 18px', borderRadius: 999,
              fontSize: 13, fontWeight: 600, transition: 'all .18s',
              whiteSpace: 'nowrap',
            }}
          >{t.label}</button>
        );
      })}
    </div>
  );
}

// FAQ 아코디언
function TP2FAQ({ items, defaultOpen = -1 }) {
  const [open, setOpen] = useState(defaultOpen);
  return (
    <div style={{ borderTop: `1px solid ${T.line}` }}>
      {items.map((it, i) => {
        const isOpen = open === i;
        return (
          <div key={i} style={{ borderBottom: `1px solid ${T.line}` }}>
            <button
              onClick={() => setOpen(isOpen ? -1 : i)}
              style={{
                width: '100%', background: 'transparent', border: 'none',
                padding: '24px 4px', display: 'flex', alignItems: 'center',
                justifyContent: 'space-between', gap: 16,
                cursor: 'pointer', color: T.ink, fontFamily: 'inherit',
                fontSize: 17, fontWeight: 600, textAlign: 'left', lineHeight: 1.4,
              }}
            >
              <span style={{ flex: 1 }}>{it.q}</span>
              <span style={{
                width: 32, height: 32, borderRadius: '50%',
                background: isOpen ? T.accent : 'rgba(91,71,224,.1)',
                color: isOpen ? '#fff' : T.accent,
                display: 'grid', placeItems: 'center',
                fontSize: 18, flexShrink: 0,
                transition: 'all .2s',
              }}>{isOpen ? '−' : '+'}</span>
            </button>
            <div style={{
              maxHeight: isOpen ? 800 : 0, overflow: 'hidden',
              transition: 'max-height .35s ease',
            }}>
              <div style={{
                padding: '0 4px 28px', color: T.sub,
                fontSize: 15, lineHeight: 1.75, maxWidth: 760,
                whiteSpace: 'pre-wrap',
              }}>{it.a}</div>
            </div>
          </div>
        );
      })}
    </div>
  );
}

// CTA 박스 (페이지 하단 공통)
function TP2CTABanner({
  title = '지금이 가장 좋은 타이밍입니다.',
  sub = '한정 특가는 물량 소진 시 종료됩니다.',
  cta = '오픈톡 문의하기 →',
  primary, secondary,
}) {
  // primary가 주어지면 그걸 쓰고, 아니면 cta 문자열로 오픈톡 버튼
  const primBtn = primary || { label: cta, href: 'https://open.kakao.com/o/sqs5vuti', external: true };
  return (
    <section style={{ padding: '40px 48px 96px' }}>
      <div style={{
        background: `linear-gradient(135deg, ${T.accent} 0%, ${T.accent2} 100%)`,
        borderRadius: 24, padding: '72px 56px',
        color: '#fff', textAlign: 'center',
        position: 'relative', overflow: 'hidden',
        maxWidth: 1280, margin: '0 auto',
      }}>
        <div style={{
          position: 'absolute', top: -100, right: -100,
          width: 320, height: 320, borderRadius: '50%',
          background: 'rgba(255,255,255,.1)',
        }}/>
        <div style={{
          position: 'absolute', bottom: -80, left: -80,
          width: 220, height: 220, borderRadius: '50%',
          background: 'rgba(255,255,255,.08)',
        }}/>
        <div style={{ position: 'relative' }}>
          <h2 style={{
            fontSize: 48, fontWeight: 800, letterSpacing: -1.5,
            margin: '0 0 14px', lineHeight: 1.1,
          }}>{title}</h2>
          <p style={{ fontSize: 17, opacity: 0.9, margin: '0 0 32px' }}>{sub}</p>
          <div style={{ display: 'inline-flex', gap: 12, flexWrap: 'wrap', justifyContent: 'center' }}>
            <a
              href={primBtn.href}
              target={primBtn.external ? '_blank' : undefined}
              style={{
                background: '#fff', color: T.accent, border: 'none',
                padding: '16px 32px', fontSize: 15, fontWeight: 800,
                borderRadius: 12, display: 'inline-block',
              }}>{primBtn.label}</a>
            {secondary && (
              <a
                href={secondary.href}
                target={secondary.external ? '_blank' : undefined}
                style={{
                  background: 'rgba(255,255,255,.12)', color: '#fff',
                  border: '1px solid rgba(255,255,255,.4)',
                  padding: '16px 28px', fontSize: 15, fontWeight: 700,
                  borderRadius: 12, display: 'inline-block',
                  backdropFilter: 'blur(8px)',
                }}>{secondary.label}</a>
            )}
          </div>
        </div>
      </div>
    </section>
  );
}

// 신뢰 섹션 (홈 + 가격 페이지에서 재사용)
function TP2TrustSection() {
  const t = (k, f) => window.tp2t('trust', k, f);
  const h = (k, f) => window.tp2h('trust', k, f);
  return (
    <section style={{ padding: '96px 48px', background: T.bg, borderTop: `1px solid ${T.line}` }}>
      <div style={{ maxWidth: 1280, margin: '0 auto' }}>
        <div style={{ textAlign: 'center', marginBottom: 56 }}>
          <div style={{ fontSize: 13, color: T.hot, fontWeight: 700, letterSpacing: 1.5, marginBottom: 16 }}>
            {t('eyebrow', '━━ WHY TUBEPICK')}
          </div>
          <h2 className="tp2-rich-ink"
            style={{ fontSize: 64, fontWeight: 900, letterSpacing: -2, margin: '0 0 16px', lineHeight: 1.05 }}
            dangerouslySetInnerHTML={h('headline',
              '해외 수익화 채널,<br/><span class="hot">걱정되는 두 가지</span>를 해결해 드립니다!')}
          />
          <p className="tp2-rich-ink"
            style={{ fontSize: 17, color: T.sub, maxWidth: 680, margin: '0 auto', lineHeight: 1.7 }}
            dangerouslySetInnerHTML={h('subhead',
              '① 채널이 날아가지 않는가 · ② 조회수가 잘 나오는가<br/>직구나 검증되지 않은 곳에서 구매한 채널은 늘 이 두 가지 리스크를 안고 있습니다.')}
          />
        </div>

        {/* 두 리스크 카드 */}
        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 16, marginBottom: 16 }}>
          <div style={{
            background: T.card, borderRadius: 20, padding: 36,
            border: `1px solid ${T.line}`, boxShadow: T.shadowSoft,
          }}>
            <div style={{
              display: 'inline-block',
              fontSize: 11, fontWeight: 800, letterSpacing: 1.5,
              background: 'rgba(255,90,95,.1)', color: T.hot,
              padding: '4px 10px', borderRadius: 6, marginBottom: 16,
            }}>{t('risk01.tag', 'RISK 01')}</div>
            <h3 style={{ fontSize: 26, fontWeight: 800, margin: '0 0 14px', letterSpacing: -0.5 }}>
              {t('risk01.title', '"이 채널, 난 아직 업로드도 안했는데 수창 정지???!!"')}
            </h3>
            <p className="tp2-rich-ink"
              style={{ fontSize: 15, color: T.sub, lineHeight: 1.75, margin: 0 }}
              dangerouslySetInnerHTML={h('risk01.body',
                '튜브픽은 <strong>채널이 만들어진 과정</strong>까지 들여다본 뒤, 현재 트렌드에서 살아남는 수익화 채널만 엄선합니다. <strong>5개국 도매 매니저가 1차로 엄선</strong>한 채널을, 튜브픽이 한 번 더 자체 검증·재선별하여 두 단계를 통과한 채널만 판매합니다.')}
            />
          </div>
          <div style={{
            background: T.card, borderRadius: 20, padding: 36,
            border: `1px solid ${T.line}`, boxShadow: T.shadowSoft,
          }}>
            <div style={{
              display: 'inline-block',
              fontSize: 11, fontWeight: 800, letterSpacing: 1.5,
              background: 'rgba(255,213,74,.18)', color: '#a07800',
              padding: '4px 10px', borderRadius: 6, marginBottom: 16,
            }}>{t('risk02.tag', 'RISK 02')}</div>
            <h3 style={{ fontSize: 26, fontWeight: 800, margin: '0 0 14px', letterSpacing: -0.5 }}>
              {t('risk02.title', '"조회수가 안 나오면 어떡하지?"')}
            </h3>
            <p className="tp2-rich-ink"
              style={{ fontSize: 15, color: T.sub, lineHeight: 1.75, margin: 0 }}
              dangerouslySetInnerHTML={h('risk02.body',
                '조회수가 안 나와도 안심하세요. <strong>한 달 토탈 AS 케어</strong>로 보장합니다. 정상 영상 5개를 한 달 안에 업로드 후 모두 500회 미만이면 조회수 AS, 구독자가 1,000명 이하로 떨어지면 구독자 AS, 그래도 해결되지 않으면 한 달 무제한 채널 교체.')}
            />
          </div>
        </div>

        {/* 솔직한 이야기 — 엑셀 이미지 + 카피 */}
        <div style={{
          background: T.ink, color: '#fff', borderRadius: 24,
          overflow: 'hidden',
          display: 'grid', gridTemplateColumns: '1.1fr 1fr',
        }}>
          <div className="tp2-rich-dark" style={{ padding: '48px 44px', display: 'flex', flexDirection: 'column', justifyContent: 'center' }}>
            <div style={{
              display: 'inline-flex', alignItems: 'center', gap: 8,
              background: 'rgba(255,90,95,.18)', color: '#ffafb1',
              padding: '5px 12px', borderRadius: 999,
              fontSize: 11, fontWeight: 700, letterSpacing: 1, marginBottom: 22,
              width: 'fit-content',
            }}>{t('story.chip', '● 판매자의 솔직한 이야기')}</div>
            <h3
              style={{ fontSize: 36, fontWeight: 900, margin: '0 0 20px', letterSpacing: -1, lineHeight: 1.15 }}
              dangerouslySetInnerHTML={h('story.headline',
                '"저도 처음 대량 구매 때<br/><span class="hot">10개 이상의 채널을 날렸습니다."</span>')}
            />
            <p
              style={{ fontSize: 15, color: 'rgba(255,255,255,.78)', lineHeight: 1.8, margin: '0 0 20px' }}
              dangerouslySetInnerHTML={h('story.body1',
                '허위 신고, 기존 사용자 애드센스 불량 — 직구나 잘 모르는 곳에서 사면 이런 일은 <strong>일상적으로</strong> 발생합니다.')}
            />
            <p
              style={{ fontSize: 15, color: 'rgba(255,255,255,.78)', lineHeight: 1.8, margin: '0 0 24px' }}
              dangerouslySetInnerHTML={h('story.body2',
                '튜브픽은 이 모든 시행착오를 직접 겪었기에, <strong>그 리스크를 저희가 먼저 안고</strong> 최대한 품질 좋은 채널을 골라드리는 데에 집중합니다. 품질이 나쁘면 저희도 손해가 나는 구조라, 현재 판매되는 채널들은 최대한 꼼꼼히 챙겨서 고르고 있습니다.')}
            />
            <div style={{
              display: 'flex', gap: 12, paddingTop: 24,
              borderTop: '1px solid rgba(255,255,255,.1)',
            }}>
              <div>
                <div style={{ fontSize: 28, fontWeight: 900, color: T.hot, lineHeight: 1 }}>{t('stat1.v', '10+')}</div>
                <div style={{ fontSize: 11, color: 'rgba(255,255,255,.5)', letterSpacing: 1, marginTop: 6, fontFamily: T.mono }}>{t('stat1.l', '날아간 채널')}</div>
              </div>
              <div style={{ width: 1, background: 'rgba(255,255,255,.1)' }}/>
              <div style={{ marginLeft: 8 }}>
                <div style={{ fontSize: 28, fontWeight: 900, color: T.accent2, lineHeight: 1 }}>{t('stat2.v', '120+')}</div>
                <div style={{ fontSize: 11, color: 'rgba(255,255,255,.5)', letterSpacing: 1, marginTop: 6, fontFamily: T.mono }}>{t('stat2.l', '현재 검증 채널')}</div>
              </div>
              <div style={{ width: 1, background: 'rgba(255,255,255,.1)' }}/>
              <div style={{ marginLeft: 8 }}>
                <div style={{ fontSize: 28, fontWeight: 900, color: '#fff', lineHeight: 1 }}>{t('stat3.v', '5개국')}</div>
                <div style={{ fontSize: 11, color: 'rgba(255,255,255,.5)', letterSpacing: 1, marginTop: 6, fontFamily: T.mono }}>{t('stat3.l', '도매 매니저 협력')}</div>
              </div>
            </div>
          </div>
          <div style={{ position: 'relative', background: '#0a0a14', display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 24 }}>
            <div style={{
              position: 'absolute', top: 20, left: 20,
              fontFamily: T.mono, fontSize: 10, color: 'rgba(255,255,255,.4)',
              letterSpacing: 1.5, zIndex: 2,
            }}>EVIDENCE · LOST CHANNELS LOG</div>
            <img
              src="assets/lost-channels.png"
              alt="실제 날아간 채널 정리 기록"
              style={{
                maxWidth: '100%', maxHeight: 420,
                borderRadius: 8, boxShadow: '0 20px 60px rgba(0,0,0,.5)',
                border: '1px solid rgba(255,255,255,.08)',
                display: 'block',
              }}
            />
            <div style={{
              position: 'absolute', bottom: 20, right: 20,
              background: 'rgba(0,0,0,.7)', backdropFilter: 'blur(8px)',
              padding: '6px 12px', borderRadius: 6,
              fontSize: 10, color: 'rgba(255,255,255,.6)',
              fontFamily: T.mono, letterSpacing: 1,
            }}>● ACTUAL RECORD</div>
          </div>
        </div>
      </div>
    </section>
  );
}

Object.assign(window, {
  TP2Header, TP2Footer, TP2Page, TP2Placeholder,
  TP2Counter, TP2Toggle, TP2FAQ, TP2CTABanner,
  TP2TrustSection,
});
