// Editor Eye LP — Section components Part 2

// ============================================
// Outcome Story (起承転結)
// ============================================
function OutcomeStory({ t, lang }) {
  return (
    <section id="story" className="section section-rule">
      <div className="container">
        <div className="reveal" style={{ maxWidth: 1100, marginBottom: 56 }}>
          <h2 className="h-section h-mega" style={{ margin: "12px 0 12px" }}>
            {t.outcome.title}
          </h2>
          <p style={{ color: "var(--ink-3)", fontSize: 17, margin: 0 }}>{t.outcome.sub}</p>
        </div>

        <div style={{ display: "grid", gridTemplateColumns: "repeat(4, 1fr)", gap: 0, border: "1px solid var(--rule)", borderRadius: 14, overflow: "hidden", background: "var(--bg-soft)" }} className="story-grid">
          {t.outcome.acts.map((a, i) => {
            const moodChip = {
              stuck: { bg: "var(--bg-tint)", color: "var(--ink-3)", icon: "✕" },
              spark: { bg: "var(--blue-soft)", color: "var(--blue)", icon: "✦" },
              win: { bg: "var(--orange-soft)", color: "var(--orange)", icon: "✓" },
              ship: { bg: "var(--orange-soft)", color: "#B85F0F", icon: "★" }
            }[a.mood];
            return (
              <article key={i} style={{
                padding: "28px 24px",
                borderRight: i < 3 ? "1px solid var(--rule)" : "0",
                background: "var(--bg)",
                position: "relative"
              }}>
                <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 18 }}>
                  <span style={{
                    width: 28, height: 28, borderRadius: 6,
                    background: moodChip.bg, color: moodChip.color,
                    display: "inline-flex", alignItems: "center", justifyContent: "center",
                    fontFamily: "var(--font-mono)", fontWeight: 700, fontSize: 13
                  }}>{a.label}</span>
                  {a.time && (<span className="mono" style={{ fontSize: 10.5, color: "var(--ink-4)", letterSpacing: "0.04em" }}>{a.time}</span>)}
                </div>
                <h3 style={{ fontSize: 17, fontWeight: 700, margin: "0 0 10px", letterSpacing: "-0.012em", lineHeight: 1.3 }}>{a.title}</h3>
                <p style={{ color: "var(--ink-3)", fontSize: 13.5, margin: 0, lineHeight: 1.6 }}>{a.body}</p>
                <div style={{ marginTop: 18, display: "inline-flex", alignItems: "center", gap: 6, color: moodChip.color, fontSize: 13 }}>
                  <span style={{ fontSize: 14 }}>{moodChip.icon}</span>
                  <span className="mono" style={{ fontSize: 10.5, letterSpacing: "0.06em", textTransform: "uppercase" }}>
                    {a.mood === "ship" ? lang === "ja" ? "発売" : "Shipped" :
                    a.mood === "win" ? lang === "ja" ? "解決" : "Solved" :
                    a.mood === "spark" ? lang === "ja" ? "発見" : "Found" :
                    lang === "ja" ? "詰まり" : "Stuck"}
                  </span>
                </div>
              </article>);

          })}
        </div>
      </div>
      <style>{`
        @media (max-width: 880px) {
          .story-grid { grid-template-columns: 1fr 1fr !important; }
          .story-grid > article:nth-child(odd) { border-right: 1px solid var(--rule) !important; }
          .story-grid > article:nth-child(-n+2) { border-bottom: 1px solid var(--rule); }
          .story-grid > article:nth-child(2) { border-right: 0 !important; }
          .story-grid > article:nth-child(4) { border-right: 0 !important; }
        }
        @media (max-width: 540px) {
          .story-grid { grid-template-columns: 1fr !important; }
          .story-grid > article { border-right: 0 !important; border-bottom: 1px solid var(--rule); }
          .story-grid > article:last-child { border-bottom: 0; }
        }
      `}</style>
    </section>);

}
window.OutcomeStory = OutcomeStory;

// ============================================
// Plan Cards (4 plans)
// ============================================
function PlanIcon({ kind }) {
  const stroke = "currentColor";
  const sw = 1.8;
  if (kind === "gear") return (
    <svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke={stroke} strokeWidth={sw} strokeLinecap="round" strokeLinejoin="round">
      <circle cx="12" cy="12" r="3" /><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1Z" />
    </svg>);

  if (kind === "play") return (
    <svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke={stroke} strokeWidth={sw} strokeLinecap="round" strokeLinejoin="round">
      <polygon points="6 4 20 12 6 20 6 4" />
    </svg>);

  if (kind === "camera") return (
    <svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke={stroke} strokeWidth={sw} strokeLinecap="round" strokeLinejoin="round">
      <path d="M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3Z" />
      <circle cx="12" cy="13" r="4" />
    </svg>);

  if (kind === "spark") return (
    <svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke={stroke} strokeWidth={sw} strokeLinecap="round" strokeLinejoin="round">
      <path d="M12 3v3M12 18v3M3 12h3M18 12h3M5.6 5.6l2.1 2.1M16.3 16.3l2.1 2.1M5.6 18.4l2.1-2.1M16.3 7.7l2.1-2.1" />
      <circle cx="12" cy="12" r="3" />
    </svg>);

  return null;
}

function PlanCards({ t, lang }) {
  return (
    <section id="features" className="section section-rule section-dark section-dark--soft">
      <div className="container">
        <div className="reveal" style={{ display: "flex", justifyContent: "space-between", alignItems: "end", flexWrap: "wrap", gap: 24, marginBottom: 56 }}>
          <div style={{ maxWidth: 1100 }}>
            <h2 className="h-section h-mega" style={{ margin: "12px 0 12px", textWrap: "balance" }}>
              {t.plans.title}
            </h2>
            <p style={{ color: "rgba(240,238,230,0.72)", fontSize: 17, margin: 0 }}>{t.plans.sub}</p>
          </div>
          <a href="/signup" className="btn btn-cta">{t.hero.cta}</a>
        </div>

        <div style={{ display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 0, alignItems: "stretch", position: "relative" }} className="plan-grid">
          {t.plans.cards.map((c, i) => {
            const isLast = i === t.plans.cards.length - 1;
            return (
              <React.Fragment key={i}>
                <article className="reveal plan-step-card" style={{
                  background: "#FFFFFF",
                  border: "1px solid #1F4E6E",
                  borderRadius: 4,
                  display: "flex", flexDirection: "column",
                  transitionDelay: `${i * 0.1}s`,
                  position: "relative",
                  overflow: "hidden"
                }}>
                  {/* Dark navy header */}
                  <div style={{
                    background: "#1F4E6E",
                    color: "#FFFFFF",
                    padding: "18px 22px 22px",
                    position: "relative"
                  }}>
                    <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 10 }}>
                      <span style={{
                        background: "#FFFFFF", color: "#1F4E6E",
                        padding: "10px 26px", borderRadius: 999,
                        fontFamily: "var(--font-display)", fontWeight: 800, fontSize: 18,
                        letterSpacing: "0.04em", lineHeight: 1,
                        textTransform: "uppercase",
                        display: "inline-flex", alignItems: "center", justifyContent: "center",
                        minWidth: 96
                      }}>STEP {i + 1}</span>
                      <span style={{
                        background: "#F5821F", color: "#FFFFFF",
                        padding: "4px 12px", borderRadius: 4,
                        fontFamily: "var(--font-mono)", fontSize: 11.5, fontWeight: 600,
                        letterSpacing: "0.02em"
                      }}>{c.time}</span>
                    </div>
                    <div style={{ textAlign: "center", marginTop: 18 }}>
                      <h3 style={{ fontSize: 22, fontWeight: 700, margin: 0, letterSpacing: "-0.01em", color: "#FFFFFF" }}>{c.name}</h3>
                      <p style={{ fontSize: 13, margin: "8px 0 0", color: "rgba(255,255,255,0.78)", lineHeight: 1.5 }}>{c.sub}</p>
                    </div>
                  </div>
                  {/* White body with numbered steps */}
                  <div style={{ padding: "20px 22px 24px", flex: 1, display: "flex", flexDirection: "column", gap: 14 }}>
                    {c.screenshot && (
                      <div style={{ borderRadius: 6, overflow: "hidden", border: "1px solid #E2E8F0", marginBottom: 6 }}>
                        <img src={c.screenshot} alt={c.name} style={{ width: "100%", height: 140, objectFit: "cover", display: "block" }} loading="lazy" />
                      </div>
                    )}
                    {c.downloadUrl && (
                      <div style={{ marginBottom: 4 }}>
                        <a
                          href={c.downloadUrl}
                          download
                          style={{
                            display: "inline-flex", alignItems: "center", gap: 8,
                            background: "#1F4E6E", color: "#FFFFFF",
                            padding: "10px 18px", borderRadius: 6,
                            fontFamily: "var(--font-display)", fontWeight: 700, fontSize: 13,
                            textDecoration: "none", letterSpacing: "0.02em",
                            border: "2px solid #3A7CA5",
                            transition: "background 0.15s"
                          }}
                        >
                          <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round">
                            <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
                            <polyline points="7 10 12 15 17 10"/>
                            <line x1="12" y1="15" x2="12" y2="3"/>
                          </svg>
                          {lang === "ja" ? ".unitypackage をダウンロード" : "Download .unitypackage"}
                        </a>
                      </div>
                    )}
                    {(c.steps || []).map((s, j) =>
                    <div key={j} style={{ display: "flex", gap: 12, alignItems: "flex-start" }}>
                        <span style={{
                        width: 24, height: 24, borderRadius: "50%",
                        background: "#1F4E6E", color: "#FFFFFF",
                        display: "inline-flex", alignItems: "center", justifyContent: "center",
                        fontFamily: "var(--font-display)", fontWeight: 700, fontSize: 12,
                        flexShrink: 0, marginTop: 1
                      }}>{j + 1}</span>
                        <span style={{ fontSize: 13.5, lineHeight: 1.6, color: "rgb(255, 255, 255)" }}>{s}</span>
                      </div>
                    )}
                  </div>
                </article>
                {!isLast &&
                <div className="plan-arrow" aria-hidden="true" style={{
                  position: "absolute",
                  left: `calc(${(i + 1) * 100 / 3}% - 18px)`,
                  top: "50%",
                  transform: "translate(-50%, -50%)",
                  width: 36, height: 36,
                  display: "flex", alignItems: "center", justifyContent: "center",
                  pointerEvents: "none", zIndex: 2
                }}>
                    <svg width="36" height="24" viewBox="0 0 36 24" fill="none">
                      <path d="M0 8 L22 8 L22 2 L36 12 L22 22 L22 16 L0 16 Z" fill="#FF8FA8" />
                    </svg>
                  </div>
                }
              </React.Fragment>);

          })}
        </div>

        {/* Banner CTA */}
        {t.plans.banner &&
        <div className="reveal" style={{
          marginTop: 28,
          background: "#1F2A4F",
          border: "2px solid #E85A6A",
          borderRadius: 4,
          padding: "22px 28px",
          textAlign: "center",
          color: "#FFFFFF"
        }}>
            <div style={{ fontWeight: 700, letterSpacing: "-0.01em", margin: 0, fontSize: "56px" }}>
              {t.plans.banner.title}
            </div>
            <div style={{ fontSize: 14, color: "#FF8FA8", marginTop: 6 }}>
              {t.plans.banner.sub}
            </div>
          </div>
        }
      </div>
      <style>{`
        @media (max-width: 920px) { .plan-grid { grid-template-columns: 1fr !important; } .plan-arrow { display: none !important; } }
        @media (max-width: 560px) { .plan-grid { grid-template-columns: 1fr !important; } .plan-arrow { display: none !important; } }
        .plan-grid { gap: 24px !important; }
      `}</style>
    </section>);

}
window.PlanCards = PlanCards;

// ============================================
// Service Catalog
// ============================================
function ServiceCatalog({ t, lang }) {
  return (
    <section id="catalog" className="section section-rule">
      <div className="container">
        <div className="reveal" style={{ maxWidth: 880, marginBottom: 48 }}>
          <h2 className="h-section h-mega" style={{ margin: "12px 0 12px" }}>
            {t.catalog.title}
          </h2>
          <p style={{ color: "var(--ink-3)", fontSize: 17, margin: 0 }}>{t.catalog.sub}</p>
        </div>

        <div className="reveal" style={{ display: "grid", gridTemplateColumns: "repeat(4, 1fr)", gap: 16, marginBottom: 48 }}>
          {t.catalog.stats.map((s, i) =>
          <div key={i} style={{
            padding: "28px 24px",
            background: i === 0 || i === 1 ? "#0F1624" : "var(--bg-soft)",
            color: i === 0 || i === 1 ? "#fff" : "var(--ink)",
            borderRadius: 14,
            border: i === 0 || i === 1 ? "1px solid #1A2236" : "1px solid var(--rule)",
            display: "flex", flexDirection: "column", justifyContent: "space-between",
            minHeight: 200,
            transitionDelay: `${i * 0.08}s`
          }} className="reveal">
              <div className={i === 0 || i === 1 ? "stat-mega" : ""} style={i === 0 || i === 1 ? {} : {
              fontSize: 44, fontWeight: 800, letterSpacing: "-0.04em", lineHeight: 1, fontFamily: "var(--font-display)", color: "var(--ink)"
            }}>
                {s.num}
              </div>
              <div className="stat-label" style={{ color: i === 0 || i === 1 ? "rgba(255,255,255,0.55)" : undefined }}>
                {s.label}
              </div>
            </div>
          )}
        </div>

        <div style={{ display: "grid", gridTemplateColumns: "repeat(2, 1fr)", gap: 16 }} className="catalog-grid">
          {t.catalog.groups.map((g, i) =>
          <article key={i} style={{
            padding: 24, background: "var(--bg-soft)", borderRadius: 12, border: "1px solid var(--rule)"
          }}>
              <div style={{ display: "flex", alignItems: "baseline", justifyContent: "space-between", marginBottom: 14 }}>
                <div style={{ display: "flex", alignItems: "baseline", gap: 14 }}>
                  <span className="mono" style={{ color: "var(--orange)", fontSize: 22, fontWeight: 700 }}>{g.roman}</span>
                  <div>
                    <h3 style={{ fontSize: 17, fontWeight: 700, margin: 0, letterSpacing: "-0.012em" }}>{g.title}</h3>
                    <span className="mono" style={{ fontSize: 11, color: "var(--ink-3)", letterSpacing: "0.04em" }}>{g.en}</span>
                  </div>
                </div>
                <span className="tag tag-blue mono">{g.count} actions</span>
              </div>
              <ul style={{ margin: 0, padding: 0, listStyle: "none", display: "grid", gap: 8 }}>
                {g.items.map((it, j) =>
              <li key={j} style={{ display: "flex", gap: 10, fontSize: 13.5, color: "var(--ink-2)" }}>
                    <span style={{ color: "var(--blue)", fontWeight: 700, fontSize: 12 }}>—</span>
                    {it}
                  </li>
              )}
              </ul>
            </article>
          )}
        </div>
      </div>
      <style>{`
        @media (max-width: 880px) { .stats-grid { grid-template-columns: 1fr 1fr !important; } .catalog-grid { grid-template-columns: 1fr !important; } }
      `}</style>
    </section>);

}
window.ServiceCatalog = ServiceCatalog;

// ============================================
// FAQ
// ============================================
function FAQ({ t, lang }) {
  const [openIdx, setOpenIdx] = React.useState(-1);
  // 初期値 undefined = 未クリック (一覧非表示)
  // null = 「すべて」クリック後 (全件表示)
  // 文字列 = 個別カテゴリ
  const [activeCat, setActiveCat] = React.useState(undefined);
  const hasClicked = activeCat !== undefined;
  const items = !hasClicked
    ? []
    : (activeCat ? t.faq.items.filter((x) => x.cat === activeCat) : t.faq.items);
  return (
    <section id="faq" className="section section-rule section-dark">
      <div className="container">
        <div className="reveal" style={{ marginBottom: 48, display: "flex", alignItems: "flex-end", justifyContent: "space-between", flexWrap: "wrap", gap: 24 }}>
          <div style={{ maxWidth: 760, flex: "1 1 520px", minWidth: 0 }}>
            <h2 className="h-section h-mega" style={{ margin: "12px 0 12px" }}>
              {t.faq.title}
            </h2>
            <p style={{ color: "rgba(240,238,230,0.72)", fontSize: 17, margin: 0 }}>{t.faq.sub}</p>
          </div>
          <a href="/signup" className="btn btn-cta" style={{ flexShrink: 0 }}>
            {lang === "ja" ? "今すぐ無料で始める" : "Start free now"}
          </a>
        </div>

        <div style={{ display: "flex", gap: 8, flexWrap: "wrap", marginBottom: 28 }}>
          <button onClick={() => setActiveCat(null)} style={{
            padding: "8px 14px", borderRadius: 999,
            background: !activeCat ? "var(--ink)" : "var(--bg)", color: !activeCat ? "#fff" : "var(--ink-2)",
            border: "1px solid var(--rule-2)", fontSize: 13, fontWeight: 500
          }}>{lang === "ja" ? "すべて" : "All"} <span className="mono" style={{ opacity: 0.6, marginLeft: 4 }}>100</span></button>
          {t.faq.cats.map((c) =>
          <button key={c.name} onClick={() => setActiveCat(c.name)} style={{
            padding: "8px 14px", borderRadius: 999,
            background: activeCat === c.name ? "var(--ink)" : "var(--bg)", color: activeCat === c.name ? "#fff" : "var(--ink-2)",
            border: "1px solid var(--rule-2)", fontSize: 13, fontWeight: 500
          }}>{c.name} <span className="mono" style={{ opacity: 0.6, marginLeft: 4 }}>{c.count}</span></button>
          )}
        </div>

        {hasClicked && (
          <div style={{ background: "var(--bg)", borderRadius: 14, border: "1px solid var(--rule)", overflow: "hidden" }}>
            {items.map((it, i) => {
              const isOpen = openIdx === i;
              return (
                <div key={i} style={{ borderTop: i === 0 ? 0 : "1px solid var(--rule)" }}>
                  <button onClick={() => setOpenIdx(isOpen ? -1 : i)} style={{
                    width: "100%", textAlign: "left", padding: "20px 24px",
                    background: isOpen ? "var(--bg-soft)" : "transparent", border: 0,
                    display: "flex", alignItems: "center", justifyContent: "space-between", gap: 16
                  }}>
                    <span style={{ display: "flex", alignItems: "center", gap: 14, flex: 1 }}>
                      <span className="mono" style={{ fontSize: 10.5, color: "var(--ink-4)", letterSpacing: "0.04em", minWidth: 28 }}>
                        {String(i + 1).padStart(2, "0")}
                      </span>
                      <span className="tag" style={{ fontSize: 10.5 }}>{it.cat}</span>
                      <span style={{ fontSize: 15, fontWeight: 600, color: "var(--ink)" }}>{it.q}</span>
                    </span>
                    <span style={{
                      fontSize: 18, color: "var(--ink-3)",
                      transform: isOpen ? "rotate(45deg)" : "rotate(0)",
                      transition: "transform .2s"
                    }}>+</span>
                  </button>
                  {isOpen &&
                  <div style={{ padding: "0 24px 20px 100px", color: "var(--ink-2)", fontSize: 14.5, lineHeight: 1.65 }}>
                      {it.a}
                    </div>
                  }
                </div>);

            })}
            <div style={{
              padding: "18px 24px", textAlign: "center",
              color: "var(--ink-3)", fontSize: 13, fontFamily: "var(--font-mono)",
              borderTop: "1px solid var(--rule)", background: "var(--bg-soft)"
            }}>
              {lang === "ja" ? `+ ${100 - items.length} more questions →` : `+ ${100 - items.length} more questions →`}
            </div>
          </div>
        )}
      </div>
    </section>);

}
window.FAQ = FAQ;

// ============================================
// Generative Audio (Section A — above Context Efficiency)
// ============================================
function GenerativeAudioSection({ t, lang }) {
  const d = t.generativeAudio;
  return (
    <section id="generative-audio" className="section section-rule">
      <div className="container">
        <div className="reveal" style={{ maxWidth: 880, marginBottom: 48 }}>
          <span className="eyebrow">{d.eyebrow}</span>
          <h2 className="h-section h-mega" style={{ margin: "12px 0 14px" }}>{d.title}</h2>
          <p style={{ color: "var(--ink-3)", fontSize: 17, margin: 0, lineHeight: 1.6 }}>{d.subtitle}</p>
        </div>
        <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 20 }} className="gen-audio-grid">
          {d.cards.map((c, i) => (
            <article key={i} className="reveal" style={{
              padding: "30px 26px",
              background: i === 0
                ? "linear-gradient(160deg, #0F1624 0%, #1A2236 100%)"
                : "var(--bg-soft)",
              border: i === 0 ? "1px solid #1A2236" : "1px solid var(--rule)",
              borderRadius: 14,
              display: "flex", flexDirection: "column", gap: 14,
              transitionDelay: `${i * 0.08}s`
            }}>
              <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between" }}>
                <div style={{
                  width: 44, height: 44, borderRadius: 11,
                  background: i === 0 ? "rgba(245,130,31,0.15)" : "var(--blue-soft)",
                  border: i === 0 ? "1px solid rgba(245,130,31,0.3)" : "1px solid rgba(27,108,168,0.2)",
                  display: "flex", alignItems: "center", justifyContent: "center", fontSize: 22
                }}>{c.icon}</div>
                <span className="tag mono" style={{
                  fontSize: 10,
                  background: i === 0 ? "rgba(255,255,255,0.08)" : undefined,
                  color: i === 0 ? "rgba(240,238,230,0.55)" : undefined,
                  borderColor: i === 0 ? "rgba(255,255,255,0.12)" : undefined
                }}>{c.tag}</span>
              </div>
              <h3 style={{ fontSize: 17, fontWeight: 700, letterSpacing: "-0.013em", lineHeight: 1.3, color: i === 0 ? "#FFF" : "var(--ink)", margin: 0 }}>{c.title}</h3>
              <p style={{ fontSize: 13.5, lineHeight: 1.68, margin: 0, flex: 1, color: i === 0 ? "rgba(240,238,230,0.65)" : "var(--ink-3)" }}>{c.body}</p>
              <div style={{ display: "flex", alignItems: "center", gap: 6, paddingTop: 12, borderTop: i === 0 ? "1px solid rgba(255,255,255,0.1)" : "1px solid var(--rule)" }}>
                <span style={{ color: i === 0 ? "var(--orange)" : "var(--blue)", fontWeight: 700, fontSize: 12 }}>—</span>
                <span style={{ fontSize: 12, color: i === 0 ? "rgba(240,238,230,0.45)" : "var(--ink-3)" }}>{c.meta}</span>
              </div>
            </article>
          ))}
        </div>
      </div>
      <style>{`@media (max-width: 640px) { .gen-audio-grid { grid-template-columns: 1fr !important; } }`}</style>
    </section>
  );
}
window.GenerativeAudioSection = GenerativeAudioSection;

// ============================================
// Context Efficiency (K0086 — before Core Value)
// ============================================
function ContextEfficiencySection({ t, lang }) {
  const d = t.contextEfficiency;
  return (
    <section id="context-efficiency" className="section section-dark">
      <div className="container">
        <div className="reveal" style={{ maxWidth: 880, marginBottom: 48 }}>
          <span className="eyebrow">{d.eyebrow}</span>
          <h2 className="h-section h-mega" style={{ margin: "12px 0 14px" }}>
            {d.title}
          </h2>
          <p style={{ fontSize: 17, margin: 0, lineHeight: 1.6 }}>
            {d.subtitle}
          </p>
        </div>

        <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: 16 }} className="ctx-eff-grid">
          {/* Big number card */}
          <div className="reveal" style={{
            padding: "32px 28px",
            background: "#ffffff",
            border: "1px solid rgba(245,130,31,0.40)",
            borderRadius: 14,
            display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center",
            textAlign: "center", gap: 12
          }}>
            <div style={{ fontSize: 60, fontWeight: 900, letterSpacing: "-0.03em", color: "var(--orange)", lineHeight: 1 }}>1/10</div>
            <div style={{ fontSize: 11, fontWeight: 700, color: "rgba(40,40,40,0.65)", letterSpacing: "0.06em", textTransform: "uppercase" }}>{d.ratio.label}</div>
            <div style={{ fontSize: 12, color: "rgba(40,40,40,0.55)", lineHeight: 1.65, marginTop: 4 }}>{d.ratio.detail}</div>
          </div>

          {/* Mech 1 */}
          <article className="reveal ctx-eff-card" style={{ transitionDelay: "0.07s" }}>
            <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 14 }}>
              <div style={{ width: 40, height: 40, borderRadius: 10, background: "rgba(96,165,250,0.12)", border: "1px solid rgba(96,165,250,0.2)", display: "flex", alignItems: "center", justifyContent: "center", fontSize: 20 }}>🗜</div>
              <span className="tag mono">{d.mech1.tag}</span>
            </div>
            <h3 style={{ fontSize: 16, fontWeight: 700, letterSpacing: "-0.012em", lineHeight: 1.3, margin: "0 0 10px" }}>{d.mech1.title}</h3>
            <p style={{ fontSize: 13.5, lineHeight: 1.65, margin: 0, flex: 1 }}>{d.mech1.body}</p>
            <div style={{ paddingTop: 12, borderTop: "1px solid rgba(255,255,255,0.09)", marginTop: 14 }}>
              <span style={{ fontSize: 12, color: "#93C5FD", fontWeight: 700 }}>{d.mech1.pill}</span>
            </div>
          </article>

          {/* Mech 2 */}
          <article className="reveal ctx-eff-card" style={{ transitionDelay: "0.14s" }}>
            <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 14 }}>
              <div style={{ width: 40, height: 40, borderRadius: 10, background: "rgba(96,165,250,0.12)", border: "1px solid rgba(96,165,250,0.2)", display: "flex", alignItems: "center", justifyContent: "center", fontSize: 20 }}>⚙️</div>
              <span className="tag mono">{d.mech2.tag}</span>
            </div>
            <h3 style={{ fontSize: 16, fontWeight: 700, letterSpacing: "-0.012em", lineHeight: 1.3, margin: "0 0 10px" }}>{d.mech2.title}</h3>
            <p style={{ fontSize: 13.5, lineHeight: 1.65, margin: 0, flex: 1 }}>{d.mech2.body}</p>
            <div style={{ paddingTop: 12, borderTop: "1px solid rgba(255,255,255,0.09)", marginTop: 14 }}>
              <span style={{ fontSize: 12, color: "#93C5FD", fontWeight: 700 }}>{d.mech2.pill}</span>
            </div>
          </article>
        </div>

        {/* Benefit bar */}
        <div className="reveal" style={{
          marginTop: 20, padding: "14px 24px",
          background: "rgba(255,255,255,0.05)", borderRadius: 10, border: "1px solid rgba(255,255,255,0.09)",
          display: "flex", gap: 32, justifyContent: "center", flexWrap: "wrap"
        }}>
          {d.benefits.map((b, i) => (
            <div key={i} style={{ display: "flex", alignItems: "center", gap: 8 }}>
              <span style={{ color: "#93C5FD", fontWeight: 700, fontSize: 14 }}>✓</span>
              <span style={{ fontSize: 14 }}>{b}</span>
            </div>
          ))}
        </div>
      </div>
      <style>{`
        .ctx-eff-card {
          padding: 26px 24px;
          background: rgba(255,255,255,0.05);
          border: 1px solid rgba(255,255,255,0.09);
          border-radius: 14px;
          display: flex; flex-direction: column;
        }
        @media (max-width: 720px) { .ctx-eff-grid { grid-template-columns: 1fr !important; } }
      `}</style>
    </section>
  );
}
window.ContextEfficiencySection = ContextEfficiencySection;

// ============================================
// Generative Sprite (Section B — below Context Efficiency)
// ============================================
function GenerativeSpriteSection({ t, lang }) {
  const d = t.generativeSprite;
  return (
    <section id="generative-sprite" className="section section-rule">
      <div className="container">
        <div className="reveal" style={{ maxWidth: 880, marginBottom: 48 }}>
          <span className="eyebrow">{d.eyebrow}</span>
          <h2 className="h-section h-mega" style={{ margin: "12px 0 14px" }}>{d.title}</h2>
          <p style={{ color: "var(--ink-3)", fontSize: 17, margin: 0, lineHeight: 1.6 }}>{d.subtitle}</p>
        </div>
        <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 20 }} className="gen-sprite-grid">
          {d.sizes.map((c, i) => (
            <article key={i} className="reveal" style={{
              padding: "30px 26px",
              background: "var(--bg-soft)",
              border: "1px solid var(--rule)",
              borderRadius: 14,
              display: "flex", flexDirection: "column", gap: 14,
              transitionDelay: `${i * 0.08}s`
            }}>
              <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between" }}>
                <div style={{ display: "flex", alignItems: "center", gap: 12 }}>
                  <div style={{
                    width: 44, height: 44, borderRadius: 11,
                    background: "var(--blue-soft)", border: "1px solid rgba(27,108,168,0.2)",
                    display: "flex", alignItems: "center", justifyContent: "center", fontSize: 22
                  }}>{c.icon}</div>
                  <span style={{
                    fontSize: 22, fontWeight: 900, letterSpacing: "-0.02em",
                    color: "var(--blue)", lineHeight: 1
                  }}>{c.size}</span>
                </div>
                <span className="tag mono" style={{ fontSize: 10 }}>{c.tag}</span>
              </div>
              <h3 style={{ fontSize: 17, fontWeight: 700, letterSpacing: "-0.013em", lineHeight: 1.3, color: "var(--ink)", margin: 0 }}>{c.title}</h3>
              <p style={{ fontSize: 13.5, lineHeight: 1.68, margin: 0, flex: 1, color: "var(--ink-3)" }}>{c.body}</p>
              <div style={{ display: "flex", alignItems: "center", gap: 6, paddingTop: 12, borderTop: "1px solid var(--rule)" }}>
                <span style={{ color: "var(--blue)", fontWeight: 700, fontSize: 12 }}>—</span>
                <span style={{ fontSize: 12, color: "var(--ink-3)" }}>{c.meta}</span>
              </div>
            </article>
          ))}
        </div>
      </div>
      <style>{`@media (max-width: 640px) { .gen-sprite-grid { grid-template-columns: 1fr !important; } }`}</style>
    </section>
  );
}
window.GenerativeSpriteSection = GenerativeSpriteSection;

// ============================================
// Core Value (6-card grid, after FAQ)
// ============================================
function CoreValueSection({ t, lang }) {
  return (
    <section id="core-value" className="section section-dark">
      <div className="container">
        <div className="reveal" style={{ maxWidth: 880, marginBottom: 48 }}>
          <span className="eyebrow">{t.coreValue.eyebrow}</span>
          <h2 className="h-section h-mega" style={{ margin: "12px 0 14px" }}>
            {t.coreValue.title}
          </h2>
          <p style={{ fontSize: 17, margin: 0, lineHeight: 1.6 }}>
            {t.coreValue.subtitle}
          </p>
        </div>

        <div style={{ display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 16 }} className="core-value-grid">
          {t.coreValue.cards.map((c, i) => (
            <article key={i} className="reveal" style={{
              padding: "26px 24px",
              background: c.featured
                ? "#ffffff"
                : "rgba(255,255,255,0.05)",
              border: c.featured
                ? "1px solid rgba(245,130,31,0.40)"
                : "1px solid rgba(255,255,255,0.09)",
              borderRadius: 14,
              display: "flex", flexDirection: "column", gap: 14,
              transitionDelay: `${i * 0.07}s`
            }}>
              {/* Header */}
              <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between" }}>
                <div style={{
                  width: 40, height: 40, borderRadius: 10,
                  background: c.featured ? "rgba(245,130,31,0.18)" : "rgba(96,165,250,0.12)",
                  border: c.featured ? "1px solid rgba(245,130,31,0.35)" : "1px solid rgba(96,165,250,0.2)",
                  display: "flex", alignItems: "center", justifyContent: "center",
                  fontSize: 18
                }}>{c.icon}</div>
                <span className="tag mono" style={{ fontSize: 10 }}>{c.tag}</span>
              </div>

              {/* Body */}
              <h3 style={{
                fontSize: 16, fontWeight: 700, letterSpacing: "-0.012em", lineHeight: 1.3, margin: 0,
                color: c.featured ? "#1a1a1a" : "inherit"
              }}>{c.title}</h3>
              <p style={{ fontSize: 13.5, lineHeight: 1.65, margin: 0, flex: 1, color: c.featured ? "rgba(30,30,30,0.72)" : "inherit" }}>{c.body}</p>

              {/* Footer */}
              <div style={{
                display: "flex", alignItems: "center", gap: 6,
                paddingTop: 12, borderTop: c.featured ? "1px solid rgba(0,0,0,0.09)" : "1px solid rgba(255,255,255,0.09)"
              }}>
                <span style={{ color: c.featured ? "var(--orange)" : "#93C5FD", fontWeight: 700, fontSize: 12 }}>—</span>
                <span style={{ fontSize: 12, color: c.featured ? "rgba(30,30,30,0.55)" : "rgba(240,238,230,0.5)" }}>{c.meta}</span>
              </div>
            </article>
          ))}
        </div>
      </div>
      <style>{`
        @media (max-width: 880px) { .core-value-grid { grid-template-columns: 1fr 1fr !important; } }
        @media (max-width: 560px) { .core-value-grid { grid-template-columns: 1fr !important; } }
      `}</style>
    </section>
  );
}
window.CoreValueSection = CoreValueSection;

// ============================================
// Pricing
// ============================================
function Pricing({ t, lang }) {
  return (
    <section id="pricing" className="section section-rule">
      <div className="container">
        <div className="reveal" style={{ maxWidth: 760, marginBottom: 48 }}>
          <h2 className="h-section h-mega" style={{ margin: "12px 0 12px" }}>
            {t.pricing.title}
          </h2>
          <p style={{ color: "var(--ink-3)", fontSize: 17, margin: 0 }}>{t.pricing.sub}</p>
        </div>

        <div style={{ display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 16 }} className="price-grid">
          {t.pricing.plans.map((p, i) =>
          <article key={i} className="reveal" style={{
            padding: 28,
            background: p.featured ? "var(--ink)" : "var(--bg)",
            color: p.featured ? "#fff" : "var(--ink)",
            border: p.featured ? "1px solid var(--ink)" : "1px solid var(--rule)",
            borderRadius: 16,
            position: "relative",
            boxShadow: p.featured ? "var(--shadow-3)" : "var(--shadow-1)",
            transitionDelay: `${i * 0.1}s`
          }}>
              {p.featured &&
            <span style={{
              position: "absolute", top: -12, right: 24,
              padding: "4px 10px", background: "var(--orange)", color: "#fff",
              borderRadius: 999, fontSize: 11, fontWeight: 700, fontFamily: "var(--font-mono)", letterSpacing: "0.06em"
            }}>{lang === "ja" ? "おすすめ" : "RECOMMENDED"}</span>
            }
              <h3 style={{ fontSize: 22, fontWeight: 700, margin: "0 0 12px", letterSpacing: "-0.015em" }}>{p.name}</h3>
              <div style={{ display: "flex", alignItems: "baseline", gap: 6, marginBottom: 4 }}>
                <span style={{ fontSize: 44, fontWeight: 800, letterSpacing: "-0.03em" }}>{p.price}</span>
                <span style={{ fontSize: 14, color: p.featured ? "rgba(255,255,255,0.6)" : "var(--ink-3)" }}>{p.per}</span>
              </div>
              <div style={{ fontSize: 13, color: p.featured ? "rgba(255,255,255,0.7)" : "var(--ink-3)", fontFamily: "var(--font-mono)", marginBottom: 24, letterSpacing: "0.02em" }}>
                {p.req}
              </div>
              <a href={p.price === "$0" ? "/signup" : "#cta"} className={p.featured ? "btn btn-cta" : "btn btn-ghost"} style={{ width: "100%", marginBottom: 22, ...(p.featured ? {} : {}) }}>{p.cta}</a>
              <ul style={{ margin: 0, padding: 0, listStyle: "none", display: "grid", gap: 10 }}>
                {p.features.map((f, j) =>
              <li key={j} style={{ display: "flex", gap: 10, fontSize: 14, color: p.featured ? "rgba(255,255,255,0.85)" : "var(--ink-2)" }}>
                    <span style={{ color: p.featured ? "var(--orange)" : "var(--blue)", fontWeight: 700 }}>✓</span>
                    {f}
                  </li>
              )}
              </ul>
            </article>
          )}
        </div>
      </div>
      <style>{`@media (max-width: 880px) { .price-grid { grid-template-columns: 1fr !important; } }`}</style>
    </section>);

}
window.Pricing = Pricing;

// ============================================
// Final CTA
// ============================================
function FinalCTA({ t }) {
  return (
    <section id="cta" className="section" style={{
      background: "linear-gradient(180deg, #0A0E1A 0%, #0F1624 100%)",
      borderTop: "1px solid #1A2236",
      color: "#F0EEE6",
      position: "relative", overflow: "hidden"
    }}>
      <div style={{
        position: "absolute", inset: 0, pointerEvents: "none",
        background: "radial-gradient(ellipse 60% 60% at 50% 30%, rgba(255,140,0,0.10) 0%, transparent 70%)"
      }} />
      <div className="container reveal" style={{ textAlign: "center", maxWidth: 880, position: "relative" }}>
        <span className="eyebrow" style={{ color: "rgba(240,238,230,0.55)" }}>{t.finalCta.eyebrow}</span>
        <h2 className="h-display h-mega" style={{ margin: "16px 0 20px", color: "#fff" }}>
          {t.finalCta.title}
        </h2>
        <p style={{ color: "rgba(240,238,230,0.72)", fontSize: 17, margin: "0 0 32px" }}>{t.finalCta.sub}</p>
        <div style={{ display: "inline-flex", alignItems: "center", gap: 16, flexWrap: "wrap", justifyContent: "center" }}>
          <a href="/signup" className="btn btn-cta" style={{ padding: "18px 32px", fontSize: 17 }}>{t.finalCta.cta}</a>
          <a href="#" className="btn btn-quiet" style={{ color: "rgba(240,238,230,0.7)", fontFamily: "var(--font-mono)", fontSize: 13, letterSpacing: "0.04em" }}>{t.finalCta.secondary}</a>
        </div>
      </div>
    </section>);

}
window.FinalCTA = FinalCTA;

// ============================================
// Footer
// ============================================
function Footer({ t, lang }) {
  const cols = [t.footer.download, t.footer.product, t.footer.legal];
  const FALLBACK_URL = "https://downloads.editor-eye.app/extension/v0.18.7/editor-eye-unity-v0.18.7.unitypackage";
  const [downloadUrl, setDownloadUrl] = React.useState(FALLBACK_URL);
  React.useEffect(() => {
    fetch("https://downloads.editor-eye.app/extension/manifest.json")
      .then(r => r.json())
      .then(m => { if (m.download_url) setDownloadUrl(m.download_url); })
      .catch(() => {});
  }, []);
  return (
    <footer style={{ borderTop: "1px solid var(--rule)", padding: "64px 0 32px", background: "var(--bg)" }}>
      <div className="container">
        <div style={{ display: "flex", justifyContent: "space-between", gap: 32, flexWrap: "wrap" }} className="foot-grid">
          <div>
            <Logo size={20} />
            <p style={{ color: "var(--ink-3)", fontSize: 13.5, margin: "14px 0 0", maxWidth: 280, lineHeight: 1.55 }}>
              {t.footer.tagline}
            </p>
          </div>
          <div style={{ display: "flex", gap: 64 }}>
            {cols.map((col, i) =>
            <div key={i}>
                <div className="eyebrow" style={{ marginBottom: 14 }}>{col.title}</div>
                <ul style={{ margin: 0, padding: 0, listStyle: "none", display: "grid", gap: 10 }}>
                  {col.links.map((l) => {
                    const isCta = l && typeof l === "object" && l.cta;
                    if (isCta) {
                      return (
                        <li key={l.label} style={{ marginTop: 4 }}>
                          <a
                            href={downloadUrl}
                            download
                            className="btn btn-cta btn-cta-sm"
                            style={{ display: "inline-flex" }}
                          >
                            {l.label}
                          </a>
                        </li>
                      );
                    }
                    return (
                      <li key={l.label ?? l}>
                        <a href={l.href ?? "#"} style={{ color: "var(--ink-2)", fontSize: 14 }}>
                          {l.label ?? l}
                        </a>
                      </li>
                    );
                  })}
                </ul>
              </div>
            )}
          </div>
        </div>
        <div style={{
          marginTop: 48, paddingTop: 20, borderTop: "1px solid var(--rule)",
          display: "flex", justifyContent: "space-between", alignItems: "center", flexWrap: "wrap", gap: 12,
          color: "var(--ink-3)", fontSize: 12.5, fontFamily: "var(--font-mono)", letterSpacing: "0.04em"
        }}>
          <span>{t.footer.copyright}</span>
          <span>editor-eye.app · v0.4 · {lang.toUpperCase()}</span>
        </div>
      </div>
      <style>{`@media (max-width: 720px) { .foot-grid { flex-direction: column !important; } }`}</style>
    </footer>);

}
window.Footer = Footer;

