// HelloReader — page sections

const { useState: useStateS } = React;

function HeroSection({ t }) {
  return (
    <div id="top" style={{ position: "relative", overflow: "hidden", background: "#fff" }}>
      <ConfettiSquares seed={1} count={18} />
      <div style={{
        maxWidth: 1280, margin: "0 auto", padding: "100px 32px 80px",
        position: "relative", zIndex: 1,
      }}>
        <Eyebrow>{t.hero.eyebrow}</Eyebrow>
        <h1 style={{
          fontFamily: "var(--font-sans)", fontWeight: 900, fontSize: 88,
          lineHeight: 1.02, letterSpacing: "-0.035em", color: "#0A0A0A",
          margin: "20px 0 0", maxWidth: 980,
        }}>
          {t.hero.title}{" "}
          <span style={{
            background: "linear-gradient(180deg, transparent 60%, #FED605 60%)",
            padding: "0 4px",
          }}>{t.hero.titleAccent}</span>
        </h1>
        <p style={{
          fontFamily: "var(--font-sans)", fontSize: 20, lineHeight: 1.55,
          color: "#4A4A4A", marginTop: 28, maxWidth: 720,
        }}>{t.hero.sub}</p>
        <div style={{ display: "flex", gap: 14, marginTop: 40, flexWrap: "wrap" }}>
          <a href="#partners" style={{
            background: "#0A0A0A", color: "#FED605", padding: "16px 28px", borderRadius: 999,
            fontFamily: "var(--font-sans)", fontWeight: 800, fontSize: 15,
            textDecoration: "none", display: "inline-flex", alignItems: "center", gap: 10,
          }}>{t.hero.ctaPrimary}
            <svg width="14" height="14" viewBox="0 0 16 16" fill="none">
              <path d="M3 8h10m0 0L9 4m4 4L9 12" stroke="#FED605" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
            </svg>
          </a>
          <a href="#about" style={{
            background: "#fff", color: "#0A0A0A", padding: "16px 28px", borderRadius: 999,
            fontFamily: "var(--font-sans)", fontWeight: 800, fontSize: 15,
            textDecoration: "none", border: "1.5px solid #0A0A0A",
            display: "inline-flex", alignItems: "center", gap: 10,
          }}>{t.hero.ctaSecondary}</a>
        </div>

        <div className="hero-stats" style={{
          marginTop: 80, display: "grid",
          gridTemplateColumns: "repeat(4, 1fr)", gap: 24,
          paddingTop: 40, borderTop: "1px solid #EFEFEF",
        }}>
          <StatBlock value={<Counter to={12} suffix="M+" />} label={t.hero.stat1} />
          <StatBlock value={<Counter to={680} suffix="K+" />} label={t.hero.stat2} />
          <StatBlock value={<><Counter to={4.6} />★</>} label={t.hero.stat3} />
          <StatBlock value={<Counter to={4} />} label={t.hero.stat4} />
        </div>
      </div>

      {/* Ticker */}
      <div style={{
        background: "#0A0A0A", color: "#FED605", overflow: "hidden",
        padding: "14px 0", fontFamily: "var(--font-sans)", fontWeight: 800,
        fontSize: 14, letterSpacing: "0.04em", whiteSpace: "nowrap",
      }}>
        <div style={{
          display: "inline-block", paddingLeft: "100%",
          animation: "marquee 32s linear infinite",
        }}>
          {Array.from({ length: 6 }).map((_, i) => (
            <span key={i} style={{ marginRight: 48 }}>
              ★ {t.ticker}
            </span>
          ))}
        </div>
      </div>
    </div>
  );
}

// ----- Vision / Mission / Values -----
function AboutSection({ t }) {
  return (
    <Section id="about" screenLabel="Vision" style={{ paddingTop: 140 }}>
      <Eyebrow>{t.about.eyebrow}</Eyebrow>
      <h2 style={{
        fontFamily: "var(--font-sans)", fontWeight: 900, fontSize: 64,
        lineHeight: 1.04, letterSpacing: "-0.028em", color: "#0A0A0A",
        margin: "18px 0 0", maxWidth: 1000, textWrap: "pretty",
      }}>
        {t.about.title}{" "}
        <span style={{ color: "#FED605", WebkitTextStroke: "1.5px #0A0A0A" }}>{t.about.titleAccent}</span>
      </h2>

      <div className="about-grid" style={{
        marginTop: 56, display: "grid",
        gridTemplateColumns: "1.25fr 1fr", gap: 40, alignItems: "stretch",
      }}>
        {/* Mission card */}
        <div style={{
          background: "#0A0A0A", borderRadius: 24, padding: 36,
          color: "#fff", position: "relative", overflow: "hidden",
        }}>
          <ConfettiSquares seed={7} count={8} style={{ opacity: 0.25 }} />
          <div style={{ position: "relative", zIndex: 1 }}>
            <div style={{
              fontFamily: "var(--font-sans)", fontSize: 11, fontWeight: 800,
              color: "#FED605", letterSpacing: "0.12em", textTransform: "uppercase",
            }}>{t.about.missionLabel}</div>
            <p style={{
              fontFamily: "var(--font-sans)", fontSize: 22, lineHeight: 1.45,
              color: "#FED605", fontWeight: 800, margin: "16px 0 0",
              letterSpacing: "-0.01em", textWrap: "pretty",
            }}>{t.about.mission}</p>
            <div style={{
              marginTop: 36, paddingTop: 24, borderTop: "1px solid rgba(255,255,255,.12)",
              fontFamily: "var(--font-sans)", fontSize: 15, lineHeight: 1.7,
              color: "#C9C3B8",
            }}>{t.about.body}</div>
          </div>
        </div>

        {/* Values list */}
        <div style={{
          background: "#fff", border: "1.5px solid #EFEFEF", borderRadius: 24,
          padding: 8,
        }}>
          {t.about.values.map((v, i) => (
            <div key={i} style={{
              display: "grid", gridTemplateColumns: "56px 1fr", gap: 16,
              alignItems: "start", padding: "18px 20px",
              borderBottom: i < t.about.values.length - 1 ? "1px solid #F0F0F0" : "none",
            }}>
              <div style={{
                width: 40, height: 40, borderRadius: 10, background: "#FED605",
                display: "flex", alignItems: "center", justifyContent: "center",
                fontFamily: "var(--font-sans)", fontWeight: 900, fontSize: 14,
                color: "#0A0A0A",
              }}>0{i + 1}</div>
              <div>
                <div style={{
                  fontFamily: "var(--font-sans)", fontWeight: 900, fontSize: 17,
                  color: "#0A0A0A", letterSpacing: "-0.005em",
                }}>{v.k}</div>
                <div style={{
                  fontFamily: "var(--font-sans)", fontSize: 14, lineHeight: 1.55,
                  color: "#4A4A4A", marginTop: 4,
                }}>{v.v}</div>
              </div>
            </div>
          ))}
        </div>
      </div>
    </Section>
  );
}

function ProductSection({ t }) {
  return (
    <div id="product" data-screen-label="Product" style={{ background: "#0A0A0A", color: "#fff", position: "relative", overflow: "hidden" }}>
      <ConfettiSquares seed={3} count={10} style={{ opacity: 0.25 }} />
      <div className="product-grid" style={{
        maxWidth: 1280, margin: "0 auto", padding: "120px 32px",
        display: "grid", gridTemplateColumns: "1fr 1.2fr", gap: 80, alignItems: "center",
        position: "relative", zIndex: 1,
      }}>
        <div>
          <Eyebrow color="#FED605">{t.product.eyebrow}</Eyebrow>
          <h2 style={{
            fontFamily: "var(--font-sans)", fontWeight: 900, fontSize: 72,
            lineHeight: 1, letterSpacing: "-0.03em", margin: "18px 0 0",
          }}>
            <span style={{ color: "#FED605" }}>{t.product.title}</span>
            <br />
            <span style={{ color: "#fff", fontSize: 28, fontWeight: 800, letterSpacing: "-0.01em" }}>
              {t.product.titleSub}
            </span>
          </h2>
          <p style={{
            fontSize: 17, lineHeight: 1.7, color: "#C9C3B8",
            marginTop: 28, maxWidth: 520,
          }}>{t.product.body}</p>

          <ul style={{ listStyle: "none", padding: 0, margin: "32px 0 0" }}>
            {[t.product.bullet1, t.product.bullet2, t.product.bullet3, t.product.bullet4].map((b, i) => (
              <li key={i} style={{
                display: "flex", alignItems: "center", gap: 14, padding: "10px 0",
                fontSize: 15, color: "#F0F0F0", fontWeight: 600,
              }}>
                <span style={{
                  width: 22, height: 22, borderRadius: "50%", background: "#FED605",
                  display: "inline-flex", alignItems: "center", justifyContent: "center", flexShrink: 0,
                }}>
                  <svg width="12" height="12" viewBox="0 0 12 12" fill="none">
                    <path d="M2.5 6.5L5 9L9.5 3.5" stroke="#0A0A0A" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
                  </svg>
                </span>
                {b}
              </li>
            ))}
          </ul>

          <div style={{ display: "flex", gap: 12, marginTop: 40 }}>
            <a href="https://apps.apple.com/us/app/readme-fiction-goodnovel/id6447419813"
               target="_blank" rel="noopener noreferrer" aria-label="Download ReadMe on the App Store"
               style={{
              background: "#fff", color: "#0A0A0A", padding: "12px 22px", borderRadius: 14,
              textDecoration: "none", display: "inline-flex", alignItems: "center", gap: 10,
              fontFamily: "var(--font-sans)", fontWeight: 800, fontSize: 13,
            }}>
              <svg width="18" height="18" viewBox="0 0 24 24" fill="#0A0A0A">
                <path d="M17.5 12.5c0-2.2 1.8-3.3 1.9-3.4-1-1.5-2.6-1.7-3.2-1.7-1.4-.1-2.7.8-3.4.8-.7 0-1.7-.8-2.9-.8-1.5 0-2.9.9-3.7 2.2-1.6 2.7-.4 6.8 1.1 9 .7 1.1 1.6 2.3 2.8 2.2 1.1 0 1.5-.7 2.9-.7s1.7.7 2.9.7c1.2 0 1.9-1.1 2.7-2.2.8-1.2 1.1-2.4 1.2-2.5-.1 0-2.3-.9-2.3-3.6zM15.3 5.8c.6-.7 1-1.8.9-2.8-.9 0-1.9.6-2.5 1.3-.6.6-1.1 1.6-.9 2.6 1 .1 2-.5 2.5-1.1z"/>
              </svg>
              {t.product.appStore}
            </a>
            <a href="https://play.google.com/store/apps/details?id=com.xiaoshuo.beststory"
               target="_blank" rel="noopener noreferrer" aria-label="Get ReadMe on Google Play"
               style={{
              background: "#fff", color: "#0A0A0A", padding: "12px 22px", borderRadius: 14,
              textDecoration: "none", display: "inline-flex", alignItems: "center", gap: 10,
              fontFamily: "var(--font-sans)", fontWeight: 800, fontSize: 13,
            }}>
              <svg width="18" height="18" viewBox="0 0 24 24">
                <path fill="#0A0A0A" d="M3.6 2.2c-.3.3-.5.8-.5 1.5v16.7c0 .7.2 1.2.5 1.5l10-10-10-9.7zM14.8 13l2.7 2.7-10.7 6.1c-.4.2-.7.2-1 .1l9-8.9zM17.5 8.3L14.8 11 5.8 2.1c.3-.1.7-.1 1 .1l10.7 6.1zM20.5 10.7c.6.4.9.9.9 1.3 0 .5-.3.9-.9 1.3l-2.5 1.4-2.9-2.7L18 9.3l2.5 1.4z"/>
              </svg>
              {t.product.googlePlay}
            </a>
          </div>
        </div>

        <div className="product-phones" style={{ display: "flex", justifyContent: "center", gap: 24, alignItems: "flex-end" }}>
          <RealShot src="assets/readme-discover.webp" label={t.product.phoneLabel1} tilt={-4} />
          <RealShot src="assets/readme-library.webp" label={t.product.phoneLabel2} tilt={4} />
        </div>
      </div>
    </div>
  );
}

// ----- Content Engine: dual-track supply + catalog mix + Translated→Original shift -----
function ContentSection({ t }) {
  const c = t.content;
  const years = [
    { y: c.splitY1, trans: 70, orig: 30 },
    { y: c.splitY2, trans: 55, orig: 45 },
    { y: c.splitY3, trans: 40, orig: 60 },
  ];
  return (
    <Section id="content" screenLabel="Content">
      <Eyebrow>{c.eyebrow}</Eyebrow>
      <h2 style={{
        fontFamily: "var(--font-sans)", fontWeight: 900, fontSize: 56,
        lineHeight: 1.05, letterSpacing: "-0.025em", color: "#0A0A0A",
        margin: "18px 0 0", maxWidth: 900, textWrap: "pretty",
      }}>
        {c.title}{" "}
        <span style={{
          background: "linear-gradient(180deg, transparent 60%, #FED605 60%)",
          padding: "0 4px",
        }}>{c.titleAccent}</span>
      </h2>
      <p style={{
        fontFamily: "var(--font-sans)", fontSize: 18, lineHeight: 1.65,
        color: "#4A4A4A", marginTop: 24, maxWidth: 780,
      }}>{c.body}</p>

      {/* Two tracks */}
      <div className="content-tracks" style={{
        marginTop: 56, display: "grid", gridTemplateColumns: "1fr 1fr", gap: 20,
      }}>
        <TrackCard
          badge="A"
          badgeColor="#FED605"
          badgeInk="#0A0A0A"
          title={c.trackAtitle}
          body={c.trackAbody}
          points={[c.trackApoint1, c.trackApoint2, c.trackApoint3]}
        />
        <TrackCard
          badge="B"
          badgeColor="#0A0A0A"
          badgeInk="#FED605"
          title={c.trackBtitle}
          body={c.trackBbody}
          points={[c.trackBpoint1, c.trackBpoint2, c.trackBpoint3]}
          dark
        />
      </div>

      {/* Year split (catalog-mix panel removed — genres intentionally de-emphasized) */}
      <div style={{ marginTop: 20 }}>
        <div style={{
          background: "#F7F7F7", borderRadius: 20, padding: 28,
        }}>
          <div style={{
            display: "flex", justifyContent: "space-between", alignItems: "baseline",
            marginBottom: 18,
          }}>
            <div style={{
              fontFamily: "var(--font-sans)", fontSize: 11, fontWeight: 800,
              color: "#737373", letterSpacing: "0.1em", textTransform: "uppercase",
            }}>{c.splitLabel}</div>
            <div style={{ display: "flex", gap: 14, fontFamily: "var(--font-sans)", fontSize: 11, fontWeight: 700, color: "#4A4A4A" }}>
              <span style={{ display: "inline-flex", alignItems: "center", gap: 6 }}>
                <span style={{ width: 10, height: 10, background: "#FED605", borderRadius: 2 }} />Translated
              </span>
              <span style={{ display: "inline-flex", alignItems: "center", gap: 6 }}>
                <span style={{ width: 10, height: 10, background: "#0A0A0A", borderRadius: 2 }} />Original
              </span>
            </div>
          </div>
          <div style={{ display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 18 }}>
            {years.map((y, i) => (
              <div key={i}>
                <div style={{
                  height: 160, background: "#fff", borderRadius: 14, padding: 8,
                  display: "flex", flexDirection: "column", justifyContent: "flex-end",
                  border: "1.5px solid #EFEFEF",
                }}>
                  <div style={{
                    height: `${y.trans}%`, background: "#FED605", borderRadius: 8,
                    marginBottom: 3,
                    display: "flex", alignItems: "flex-start", justifyContent: "center",
                    paddingTop: 6, boxSizing: "border-box",
                  }}>
                    <span style={{ fontFamily: "var(--font-sans)", fontWeight: 900, fontSize: 11, color: "#0A0A0A" }}>
                      {y.trans}%
                    </span>
                  </div>
                  <div style={{
                    height: `${y.orig}%`, background: "#0A0A0A", borderRadius: 8,
                    display: "flex", alignItems: "flex-start", justifyContent: "center",
                    paddingTop: 6, boxSizing: "border-box",
                  }}>
                    <span style={{ fontFamily: "var(--font-sans)", fontWeight: 900, fontSize: 11, color: "#FED605" }}>
                      {y.orig}%
                    </span>
                  </div>
                </div>
                <div style={{
                  marginTop: 10, textAlign: "center",
                  fontFamily: "var(--font-sans)", fontWeight: 900, fontSize: 16, color: "#0A0A0A",
                }}>{y.y}</div>
              </div>
            ))}
          </div>
        </div>
      </div>

      {/* IP strip */}
      <div style={{
        marginTop: 20, background: "#FFF7C2", border: "1.5px solid #FFE96B",
        borderRadius: 20, padding: "22px 28px",
        display: "flex", alignItems: "center", gap: 24, flexWrap: "wrap",
      }}>
        <div style={{
          display: "flex", alignItems: "center", gap: 12, flex: "1 1 320px", minWidth: 260,
        }}>
          <div style={{
            width: 44, height: 44, borderRadius: 12, background: "#FED605",
            display: "flex", alignItems: "center", justifyContent: "center", flexShrink: 0,
          }}>
            <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#0A0A0A" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round">
              <path d="M12 2l2.4 6.2L21 9l-5 4.6L17.4 21 12 17.6 6.6 21 8 13.6 3 9l6.6-.8z"/>
            </svg>
          </div>
          <div style={{
            fontFamily: "var(--font-sans)", fontWeight: 900, fontSize: 20, color: "#0A0A0A",
            letterSpacing: "-0.01em",
          }}>{c.ipHead}</div>
        </div>
        <div style={{
          flex: "2 1 420px",
          fontFamily: "var(--font-sans)", fontSize: 14.5, lineHeight: 1.6, color: "#4A4A4A",
        }}>{c.ipBody}</div>
      </div>
    </Section>
  );
}

function TrackCard({ badge, badgeColor, badgeInk, title, body, points, dark }) {
  const bg = dark ? "#0A0A0A" : "#fff";
  const ink = dark ? "#fff" : "#0A0A0A";
  const sub = dark ? "#C9C3B8" : "#4A4A4A";
  const border = dark ? "transparent" : "#EFEFEF";
  return (
    <div style={{
      background: bg, border: `1.5px solid ${border}`, borderRadius: 24, padding: 32,
      color: ink, position: "relative", overflow: "hidden",
    }}>
      {dark && <ConfettiSquares seed={badge === "B" ? 9 : 11} count={6} style={{ opacity: 0.15 }} />}
      <div style={{ position: "relative", zIndex: 1 }}>
        <div style={{
          display: "inline-flex", alignItems: "center", gap: 10, marginBottom: 18,
        }}>
          <div style={{
            width: 44, height: 44, borderRadius: 12, background: badgeColor,
            display: "flex", alignItems: "center", justifyContent: "center",
            fontFamily: "var(--font-sans)", fontWeight: 900, fontSize: 22, color: badgeInk,
            border: dark ? "none" : "1.5px solid #0A0A0A",
          }}>{badge}</div>
        </div>
        <h3 style={{
          fontFamily: "var(--font-sans)", fontWeight: 900, fontSize: 28,
          margin: "0 0 14px", letterSpacing: "-0.015em", color: ink, textWrap: "pretty",
        }}>{title}</h3>
        <p style={{
          fontFamily: "var(--font-sans)", fontSize: 15.5, lineHeight: 1.65,
          color: sub, margin: "0 0 24px",
        }}>{body}</p>
        <ul style={{ listStyle: "none", padding: 0, margin: 0 }}>
          {points.map((p, i) => (
            <li key={i} style={{
              display: "flex", alignItems: "flex-start", gap: 12, padding: "10px 0",
              borderTop: `1px solid ${dark ? "rgba(255,255,255,.1)" : "#F0F0F0"}`,
              fontFamily: "var(--font-sans)", fontSize: 14, lineHeight: 1.5, color: sub,
            }}>
              <span style={{
                width: 18, height: 18, borderRadius: 4, background: badgeColor,
                display: "inline-flex", alignItems: "center", justifyContent: "center", flexShrink: 0,
                marginTop: 2,
              }}>
                <svg width="10" height="10" viewBox="0 0 12 12" fill="none">
                  <path d="M2.5 6.5L5 9L9.5 3.5" stroke={badgeInk} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
                </svg>
              </span>
              <span>{p}</span>
            </li>
          ))}
        </ul>
      </div>
    </div>
  );
}

function MarketsSection({ t }) {
  const live = [
    { name: t.markets.naName, flag: "🇺🇸", body: t.markets.naBody, stat1Val: 8, stat1Suf: "M", stat1Lbl: t.markets.naStat1, stat2Val: 240, stat2Suf: "+", stat2Lbl: t.markets.naStat2, accent: "#0A0A0A", code: "NA" },
    { name: t.markets.vnName, flag: "🇻🇳", body: t.markets.vnBody, stat1Val: 5.2, stat1Suf: "M+", stat1Lbl: t.markets.vnStat1, stat2Val: 820, stat2Suf: "K", stat2Lbl: t.markets.vnStat2, accent: "#FF3E5F", code: "VN" },
    { name: t.markets.idName, flag: "🇮🇩", body: t.markets.idBody, stat1Val: 4.8, stat1Suf: "M+", stat1Lbl: t.markets.idStat1, stat2Val: 640, stat2Suf: "K", stat2Lbl: t.markets.idStat2, accent: "#FF7A1A", code: "ID" },
    { name: t.markets.thName, flag: "🇹🇭", body: t.markets.thBody, stat1Val: 2.1, stat1Suf: "M+", stat1Lbl: t.markets.thStat1, stat2Val: 410, stat2Suf: "K", stat2Lbl: t.markets.thStat2, accent: "#3B82F6", code: "TH" },
  ];
  const next = [
    { name: t.markets.euName, flag: "🇪🇸", body: t.markets.euBody, stat1Val: 4, stat1Suf: "", stat1Lbl: t.markets.euStat1, stat2Val: 120, stat2Suf: "+", stat2Lbl: t.markets.euStat2, accent: "#0A0A0A", code: "EU·LATAM" },
  ];
  return (
    <Section id="markets" screenLabel="Markets">
      <Eyebrow>{t.markets.eyebrow}</Eyebrow>
      <h2 style={{
        fontFamily: "var(--font-sans)", fontWeight: 900, fontSize: 56,
        lineHeight: 1.05, letterSpacing: "-0.025em", color: "#0A0A0A",
        margin: "18px 0 0", maxWidth: 900, textWrap: "pretty",
      }}>
        {t.markets.title}{" "}
        <span style={{
          background: "linear-gradient(180deg, transparent 60%, #FED605 60%)",
          padding: "0 4px",
        }}>{t.markets.titleAccent}</span>
      </h2>
      <p style={{
        fontFamily: "var(--font-sans)", fontSize: 18, lineHeight: 1.65,
        color: "#4A4A4A", marginTop: 24, maxWidth: 780,
      }}>{t.markets.body}</p>

      {/* Live markets */}
      <MarketBand label={t.markets.liveLabel} tone="live" />
      <div style={{
        display: "grid", gridTemplateColumns: "repeat(4, 1fr)", gap: 18, marginTop: 18,
      }}>
        {live.map((m, i) => <MarketCard key={i} m={m} />)}
      </div>

      {/* Upcoming */}
      <MarketBand label={t.markets.nextLabel} tone="next" />
      <div style={{
        display: "grid", gridTemplateColumns: "repeat(4, 1fr)", gap: 18, marginTop: 18,
      }}>
        {next.map((m, i) => <MarketCard key={i} m={m} upcoming />)}
        {/* 3 placeholder tiles */}
        {Array.from({ length: 3 }).map((_, i) => (
          <div key={i} style={{
            borderRadius: 20, border: "1.5px dashed #D4D4D4",
            minHeight: 240, display: "flex", alignItems: "center", justifyContent: "center",
            color: "#A3A3A3", fontFamily: "var(--font-sans)", fontWeight: 800, fontSize: 13,
            letterSpacing: "0.08em", textTransform: "uppercase",
            background: "repeating-linear-gradient(135deg, transparent 0 14px, rgba(10,10,10,0.02) 14px 16px)",
          }}>2028 →</div>
        ))}
      </div>
    </Section>
  );
}

function MarketBand({ label, tone }) {
  const color = tone === "live" ? "#FED605" : "#0A0A0A";
  const ink = tone === "live" ? "#0A0A0A" : "#FED605";
  return (
    <div style={{
      marginTop: 56, display: "flex", alignItems: "center", gap: 14,
    }}>
      <span style={{
        display: "inline-flex", alignItems: "center", gap: 8,
        background: color, color: ink, padding: "6px 12px", borderRadius: 999,
        fontFamily: "var(--font-sans)", fontWeight: 900, fontSize: 12, letterSpacing: "0.06em",
      }}>
        {tone === "live" && (
          <span style={{
            width: 8, height: 8, borderRadius: "50%", background: "#22C55E",
            boxShadow: "0 0 0 3px rgba(34,197,94,.25)",
          }} />
        )}
        {label}
      </span>
      <span style={{ flex: 1, height: 1, background: "#EFEFEF" }} />
    </div>
  );
}

function MarketCard({ m, upcoming }) {
  return (
    <div style={{
      background: "#fff", border: "1.5px solid #EFEFEF", borderRadius: 20,
      padding: 24, position: "relative", overflow: "hidden",
      opacity: upcoming ? 0.95 : 1,
    }}>
      <div style={{
        position: "absolute", top: -20, right: -20, width: 120, height: 120,
        background: m.accent, borderRadius: "50%", opacity: 0.08,
      }} />
      <div style={{ display: "flex", alignItems: "center", gap: 12, marginBottom: 18 }}>
        <span style={{ fontSize: 36, lineHeight: 1 }}>{m.flag}</span>
        <div>
          <div style={{
            fontFamily: "var(--font-sans)", fontSize: 10, fontWeight: 800,
            color: m.accent, letterSpacing: "0.1em", textTransform: "uppercase",
          }}>{m.code}</div>
          <div style={{
            fontFamily: "var(--font-sans)", fontSize: 20, fontWeight: 900,
            color: "#0A0A0A", lineHeight: 1.1,
          }}>{m.name}</div>
        </div>
      </div>
      <p style={{
        fontFamily: "var(--font-sans)", fontSize: 13, lineHeight: 1.55,
        color: "#4A4A4A", margin: "0 0 18px", minHeight: 60,
      }}>{m.body}</p>

      <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 12, paddingTop: 16, borderTop: "1px solid #EFEFEF" }}>
        <div>
          <div style={{
            fontFamily: "var(--font-sans)", fontWeight: 900, fontSize: 22,
            color: "#0A0A0A", letterSpacing: "-0.02em", lineHeight: 1,
          }}>
            <Counter to={m.stat1Val} suffix={m.stat1Suf} />
          </div>
          <div style={{ fontSize: 10, color: "#737373", fontWeight: 700, marginTop: 6, letterSpacing: "0.04em" }}>
            {m.stat1Lbl}
          </div>
        </div>
        <div>
          <div style={{
            fontFamily: "var(--font-sans)", fontWeight: 900, fontSize: 22,
            color: "#0A0A0A", letterSpacing: "-0.02em", lineHeight: 1,
          }}>
            <Counter to={m.stat2Val} suffix={m.stat2Suf} />
          </div>
          <div style={{ fontSize: 10, color: "#737373", fontWeight: 700, marginTop: 6, letterSpacing: "0.04em" }}>
            {m.stat2Lbl}
          </div>
        </div>
      </div>
    </div>
  );
}

// ----- Featured Titles (real reader data) -----
const FEATURED_MARKETS = [
  {
    code: "EN", name: "English", flag: "🌍",
    books: [
      { title: "Rich Guy", author: "Tessa", readers: "307K", cover: "assets/books/en-1.png" },
      { title: "Who Are You, My Husband", author: "Tessa", readers: "307K", cover: "assets/books/en-2.png" },
      { title: "My Substitute Ugly Wife", author: "L.X", readers: "149K", cover: "assets/books/en-3.png" },
      { title: "A Fallen Woman Expecting True Love", author: "Evening Snow", readers: "82K", cover: "assets/books/en-4.png" },
    ],
  },
  {
    code: "ID", name: "Indonesia", flag: "🇮🇩",
    books: [
      { title: "Wanita Bermuka Dua", author: "Sherin", readers: "373K", cover: "assets/books/id-1.png" },
      { title: "Ternyata Suamiku Seorang Sultan", author: "Alexander Tian", readers: "352K", cover: "assets/books/id-2.png" },
      { title: "Istri Pengganti Tersayang Tuan Muda", author: "Jeanne", readers: "283K", cover: "assets/books/id-3.png" },
      { title: "Ternyata Suamiku Seorang Sultan", author: "Febi", readers: "238K", cover: "assets/books/id-4.png" },
    ],
  },
  {
    code: "VN", name: "Vietnam", flag: "🇻🇳",
    books: [
      { title: "Chàng rể xuất chúng", author: "Linh Vân", readers: "186K", cover: "assets/books/vn-1.png" },
      { title: "Ông bố siêu phàm", author: "Lâu Nghị", readers: "144K", cover: "assets/books/vn-2.png" },
      { title: "Cố tổng lại phát điên rồi!", author: "Mẫn Hạ", readers: "28K", cover: "assets/books/vn-3.png" },
      { title: "Hoắc tổng truy thê", author: "Linh Dạ", readers: "11K", cover: "assets/books/vn-4.png" },
    ],
  },
  {
    code: "TH", name: "Thailand", flag: "🇹🇭",
    books: [
      { title: "พ่อจอมผยอง", author: "พิงตึกเห็นคุณลอยน้ำ", readers: "103K", cover: "assets/books/th-1.png" },
      { title: "บ่วงแค้นแสนรัก", author: "ชิวเซิง", readers: "67K", cover: "assets/books/th-2.png" },
      { title: "ลูกเขยดีเลิศ", author: "อาห่าว", readers: "39K", cover: "assets/books/th-3.png" },
      { title: "ข้าคือหงส์พันปี", author: "เฉียน หราน จวิน เสี้ยว", readers: "23K", cover: "assets/books/th-4.png" },
    ],
  },
];

function FeaturedTitlesSection({ t }) {
  const f = t.featured;
  const [activeIdx, setActiveIdx] = useStateS(0);
  return (
    <Section id="featured" screenLabel="Titles">
      <Eyebrow>{f.eyebrow}</Eyebrow>
      <h2 style={{
        fontFamily: "var(--font-sans)", fontWeight: 900, fontSize: 56,
        lineHeight: 1.05, letterSpacing: "-0.025em", color: "#0A0A0A",
        margin: "18px 0 0", maxWidth: 900, textWrap: "pretty",
      }}>
        {f.title}{" "}
        <span style={{
          background: "linear-gradient(180deg, transparent 60%, #FED605 60%)",
          padding: "0 4px",
        }}>{f.titleAccent}</span>
      </h2>
      <p style={{
        fontFamily: "var(--font-sans)", fontSize: 18, lineHeight: 1.65,
        color: "#4A4A4A", marginTop: 24, maxWidth: 780,
      }}>{f.body}</p>

      {/* Mobile-only market tabs — on desktop these are hidden via CSS */}
      <div className="featured-tabs" style={{
        marginTop: 32,
        display: "flex", flexWrap: "wrap", gap: 8,
      }}>
        {FEATURED_MARKETS.map((m, i) => {
          const on = i === activeIdx;
          return (
            <button
              key={m.code}
              type="button"
              onClick={() => setActiveIdx(i)}
              aria-pressed={on}
              style={{
                flex: "1 1 0",
                minWidth: 0,
                padding: "10px 12px",
                borderRadius: 999,
                border: "1.5px solid " + (on ? "#0A0A0A" : "#E5E5E5"),
                background: on ? "#0A0A0A" : "#fff",
                color: on ? "#FED605" : "#0A0A0A",
                fontFamily: "var(--font-sans)",
                fontWeight: 800, fontSize: 13,
                cursor: "pointer",
                display: "inline-flex", alignItems: "center", justifyContent: "center", gap: 6,
                transition: "all 150ms var(--ease-out)",
              }}
            >
              <span style={{ fontSize: 16 }}>{m.flag}</span>
              <span>{m.code}</span>
            </button>
          );
        })}
      </div>

      <div className="featured-grid" style={{
        marginTop: 20, display: "grid",
        gridTemplateColumns: "repeat(4, 1fr)", gap: 18,
      }}>
        {FEATURED_MARKETS.map((m, i) => (
          <div key={m.code} className="featured-col" data-active={i === activeIdx ? "true" : "false"}>
            <FeaturedMarketColumn market={m} readersLabel={f.readers} />
          </div>
        ))}
      </div>

      <p style={{
        marginTop: 28, fontFamily: "var(--font-sans)", fontSize: 13,
        color: "#737373", fontStyle: "italic",
      }}>{f.footnote}</p>
    </Section>
  );
}

function FeaturedMarketColumn({ market, readersLabel }) {
  return (
    <div style={{
      background: "#fff", border: "1.5px solid #EFEFEF", borderRadius: 20,
      padding: 22, display: "flex", flexDirection: "column",
    }}>
      <div style={{
        display: "flex", alignItems: "center", gap: 10,
        paddingBottom: 16, borderBottom: "1.5px solid #F5F5F5",
      }}>
        <span style={{ fontSize: 28, lineHeight: 1 }}>{market.flag}</span>
        <div>
          <div style={{
            fontFamily: "var(--font-sans)", fontSize: 10, fontWeight: 800,
            color: "#737373", letterSpacing: "0.12em", textTransform: "uppercase",
          }}>{market.code}</div>
          <div style={{
            fontFamily: "var(--font-sans)", fontSize: 16, fontWeight: 900,
            color: "#0A0A0A", lineHeight: 1.15,
          }}>{market.name}</div>
        </div>
      </div>
      <ol style={{ listStyle: "none", padding: 0, margin: 0, flex: 1 }}>
        {market.books.map((b, i) => (
          <li key={i} style={{
            display: "flex", gap: 12, padding: "14px 0",
            borderBottom: i < market.books.length - 1 ? "1px solid #F5F5F5" : "none",
          }}>
            {b.cover && (
              <div style={{
                flexShrink: 0, width: 56, height: 80, borderRadius: 8,
                overflow: "hidden", background: "#F0F0F0",
                boxShadow: "0 2px 8px rgba(0,0,0,0.08)",
              }}>
                <img src={b.cover} alt={b.title} loading="lazy"
                  style={{ width: "100%", height: "100%", objectFit: "cover", display: "block" }} />
              </div>
            )}
            <div style={{ flex: 1, minWidth: 0, display: "flex", flexDirection: "column", justifyContent: "space-between" }}>
              <div style={{
                fontFamily: "var(--font-sans)", fontSize: 13, fontWeight: 800,
                color: "#0A0A0A", lineHeight: 1.3, marginBottom: 4,
                display: "-webkit-box", WebkitLineClamp: 2, WebkitBoxOrient: "vertical",
                overflow: "hidden",
              }}>{b.title}</div>
              <div style={{
                fontFamily: "var(--font-sans)", fontSize: 11, color: "#737373",
                overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap",
                marginBottom: 6,
              }}>{b.author}</div>
              <span style={{
                alignSelf: "flex-start",
                fontFamily: "var(--font-sans)", fontSize: 12, fontWeight: 900,
                color: "#0A0A0A", background: "#FED605", padding: "2px 8px",
                borderRadius: 999, whiteSpace: "nowrap",
              }}>{b.readers}</span>
            </div>
          </li>
        ))}
      </ol>
      <div style={{
        marginTop: 8, paddingTop: 14, borderTop: "1.5px solid #F5F5F5",
        fontFamily: "var(--font-sans)", fontSize: 11, color: "#A3A3A3",
        fontWeight: 700, letterSpacing: "0.04em", textAlign: "right",
      }}>{readersLabel}</div>
    </div>
  );
}

// ----- Slogan Suite -----
function SlogansSection({ t }) {
  const s = t.slogans;
  return (
    <div id="slogans" data-screen-label="Slogans" style={{ background: "#FFF7C2", borderTop: "1.5px solid #FFE96B", borderBottom: "1.5px solid #FFE96B", position: "relative", overflow: "hidden" }}>
      <ConfettiSquares seed={13} count={10} style={{ opacity: 0.35 }} />
      <div style={{ maxWidth: 1280, margin: "0 auto", padding: "100px 32px", position: "relative", zIndex: 1 }}>
        <Eyebrow>{s.eyebrow}</Eyebrow>
        <h2 style={{
          fontFamily: "var(--font-sans)", fontWeight: 900, fontSize: 48,
          lineHeight: 1.05, letterSpacing: "-0.022em", color: "#0A0A0A",
          margin: "18px 0 0", maxWidth: 900, textWrap: "pretty",
        }}>{s.title}</h2>
        <p style={{
          fontFamily: "var(--font-sans)", fontSize: 17, lineHeight: 1.6,
          color: "#4A4A4A", marginTop: 20, maxWidth: 720,
        }}>{s.body}</p>

        <div style={{
          marginTop: 48, background: "#fff", borderRadius: 24, overflow: "hidden",
          boxShadow: "var(--shadow-card)",
        }}>
          {s.rows.map((r, i) => {
            const primary = i === 0;
            return (
              <div key={i} style={{
                display: "grid", gridTemplateColumns: "200px 1fr 44px",
                gap: 24, alignItems: "center",
                padding: "22px 32px",
                background: primary ? "#0A0A0A" : "#fff",
                color: primary ? "#fff" : "#0A0A0A",
                borderTop: i > 0 ? "1px solid #F0F0F0" : "none",
              }}>
                <div style={{
                  fontFamily: "var(--font-sans)", fontSize: 11, fontWeight: 800,
                  color: primary ? "#FED605" : "#737373",
                  letterSpacing: "0.1em", textTransform: "uppercase",
                }}>{r.ctx}</div>
                <div style={{
                  fontFamily: "var(--font-sans)",
                  fontWeight: primary ? 900 : 800,
                  fontSize: primary ? 26 : 20,
                  letterSpacing: "-0.015em",
                  lineHeight: 1.25, textWrap: "pretty",
                }}>
                  {primary ? (
                    <span style={{
                      background: "linear-gradient(180deg, transparent 62%, #FED605 62%)",
                      padding: "0 4px",
                      color: "#fff",
                    }}>{r.slogan}</span>
                  ) : r.slogan}
                </div>
                <div style={{ textAlign: "right" }}>
                  <span style={{
                    display: "inline-flex", width: 32, height: 32, borderRadius: "50%",
                    background: primary ? "#FED605" : "#F5F5F5",
                    alignItems: "center", justifyContent: "center",
                    fontFamily: "var(--font-sans)", fontWeight: 900, fontSize: 12,
                    color: primary ? "#0A0A0A" : "#737373",
                  }}>0{i + 1}</span>
                </div>
              </div>
            );
          })}
        </div>
      </div>
    </div>
  );
}

function PartnersSection({ t }) {
  const [tab, setTab] = useStateS("author");
  const [sent, setSent] = useStateS(false);
  const [sending, setSending] = useStateS(false);
  const [errMsg, setErrMsg] = useStateS("");
  const tabs = [
    { id: "author", label: t.partners.tabAuthor, title: t.partners.authorTitle, body: t.partners.authorBody },
    { id: "agency", label: t.partners.tabAgency, title: t.partners.agencyTitle, body: t.partners.agencyBody },
    { id: "distributor", label: t.partners.tabDistributor, title: t.partners.distributorTitle, body: t.partners.distributorBody },
  ];
  const active = tabs.find(x => x.id === tab);
  return (
    <div id="partners" data-screen-label="Partners" style={{ background: "#F7F7F7", position: "relative" }}>
      <div style={{ maxWidth: 1280, margin: "0 auto", padding: "120px 32px" }}>
        <Eyebrow>{t.partners.eyebrow}</Eyebrow>
        <h2 style={{
          fontFamily: "var(--font-sans)", fontWeight: 900, fontSize: 56,
          lineHeight: 1.05, letterSpacing: "-0.025em", color: "#0A0A0A",
          margin: "18px 0 0", maxWidth: 900,
        }}>
          {t.partners.title}{" "}
          <span style={{ color: "#FED605", WebkitTextStroke: "1.5px #0A0A0A" }}>{t.partners.titleAccent}</span>
        </h2>
        <p style={{
          fontFamily: "var(--font-sans)", fontSize: 18, lineHeight: 1.65,
          color: "#4A4A4A", marginTop: 24, maxWidth: 700,
        }}>{t.partners.body}</p>

        <div className="partners-card" style={{
          marginTop: 56, background: "#fff", borderRadius: 24,
          boxShadow: "var(--shadow-card)", overflow: "hidden",
          display: "grid", gridTemplateColumns: "1fr 1fr",
        }}>
          <div style={{ padding: 40, borderRight: "1px solid #EFEFEF" }}>
            <div style={{ display: "flex", gap: 6, marginBottom: 28, flexWrap: "wrap" }}>
              {tabs.map(x => (
                <button key={x.id} onClick={() => setTab(x.id)} style={{
                  padding: "10px 16px", borderRadius: 999, border: "none",
                  background: tab === x.id ? "#0A0A0A" : "#F5F5F5",
                  color: tab === x.id ? "#FED605" : "#4A4A4A",
                  fontFamily: "var(--font-sans)", fontWeight: 800, fontSize: 13,
                  cursor: "pointer", transition: "all 150ms var(--ease-out)",
                }}>{x.label}</button>
              ))}
            </div>
            <h3 style={{
              fontFamily: "var(--font-sans)", fontWeight: 900, fontSize: 28,
              color: "#0A0A0A", margin: "0 0 14px", letterSpacing: "-0.01em",
            }}>{active.title}</h3>
            <p style={{
              fontFamily: "var(--font-sans)", fontSize: 15, lineHeight: 1.65,
              color: "#4A4A4A", margin: 0,
            }}>{active.body}</p>

            <div style={{ marginTop: 28, padding: 20, background: "#FFF7C2", borderRadius: 14, border: "1.5px solid #FFE96B" }}>
              <div style={{ display: "flex", alignItems: "center", gap: 10 }}>
                <span style={{
                  width: 32, height: 32, borderRadius: "50%",
                  background: "radial-gradient(circle at 30% 30%,#FFEE80,#FED605 55%,#C99C00)",
                  display: "inline-flex", alignItems: "center", justifyContent: "center",
                  color: "#4B3508", fontWeight: 900, fontSize: 14,
                  boxShadow: "inset 0 -2px 4px #00000020",
                }}>¥</span>
                <div style={{ fontFamily: "var(--font-sans)", fontWeight: 800, fontSize: 13, color: "#0A0A0A" }}>
                  Daily earning reports · Transparent splits · Fast payouts
                </div>
              </div>
            </div>
          </div>

          <form
            onSubmit={async (e) => {
              e.preventDefault();
              if (sending) return;
              setErrMsg("");
              setSending(true);
              const fd = new FormData(e.target);
              try {
                const r = await fetch("/api/partner-submit", {
                  method: "POST",
                  headers: { "Content-Type": "application/json" },
                  body: JSON.stringify({
                    type: tab,
                    name: (fd.get("name") || "").toString(),
                    org: (fd.get("org") || "").toString(),
                    email: (fd.get("email") || "").toString(),
                    message: (fd.get("message") || "").toString(),
                  }),
                });
                if (r.ok) {
                  setSent(true);
                } else {
                  const j = await r.json().catch(() => ({}));
                  setErrMsg(j.error === "invalid_email" ? (t.partners.errEmail || "Please enter a valid email.") : (t.partners.errGeneric || "Submission failed. Please try again."));
                }
              } catch {
                setErrMsg(t.partners.errGeneric || "Network error. Please try again.");
              }
              setSending(false);
            }}
            style={{ padding: 40 }}
          >
            {sent ? (
              <div style={{
                height: "100%", minHeight: 320, display: "flex", flexDirection: "column",
                alignItems: "center", justifyContent: "center", gap: 14, textAlign: "center",
              }}>
                <div style={{
                  width: 64, height: 64, borderRadius: "50%", background: "#FED605",
                  display: "flex", alignItems: "center", justifyContent: "center",
                }}>
                  <svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="#0A0A0A" strokeWidth="3" strokeLinecap="round" strokeLinejoin="round">
                    <path d="M5 12l5 5L20 7"/>
                  </svg>
                </div>
                <div style={{ fontFamily: "var(--font-sans)", fontWeight: 900, fontSize: 20, color: "#0A0A0A" }}>
                  {t.partners.formThanks}
                </div>
              </div>
            ) : (
              <>
                <div className="form-row" style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 14 }}>
                  <FormField name="name" label={t.partners.formName} type="text" required />
                  <FormField name="org" label={t.partners.formOrg} type="text" />
                </div>
                <div style={{ marginTop: 14 }}>
                  <FormField name="email" label={t.partners.formEmail} type="email" required />
                </div>
                <div style={{ marginTop: 14 }}>
                  <FormField name="message" label={t.partners.formMsg} textarea required />
                </div>
                {errMsg && (
                  <div style={{
                    marginTop: 14, padding: "10px 14px", borderRadius: 10,
                    background: "#FEF2F2", color: "#B91C1C", border: "1px solid #FECACA",
                    fontFamily: "var(--font-sans)", fontSize: 13, fontWeight: 600,
                  }}>{errMsg}</div>
                )}
                <button type="submit" disabled={sending} style={{
                  marginTop: 24, width: "100%",
                  background: sending ? "#4A4A4A" : "#0A0A0A", color: "#FED605",
                  border: "none", padding: "16px 24px", borderRadius: 999,
                  fontFamily: "var(--font-sans)", fontWeight: 800, fontSize: 15,
                  cursor: sending ? "wait" : "pointer", opacity: sending ? 0.8 : 1,
                  transition: "all 150ms var(--ease-out)",
                }}>{sending ? (t.partners.formSending || "Sending…") : t.partners.formSubmit}</button>
              </>
            )}
          </form>
        </div>
      </div>
    </div>
  );
}

function FormField({ name, label, type = "text", textarea = false, required = false }) {
  return (
    <label style={{ display: "block" }}>
      <div style={{
        fontFamily: "var(--font-sans)", fontSize: 12, fontWeight: 800,
        color: "#4A4A4A", letterSpacing: "0.04em", textTransform: "uppercase",
        marginBottom: 8,
      }}>
        {label}{required ? <span style={{ color: "#B91C1C" }}> *</span> : null}
      </div>
      {textarea ? (
        <textarea name={name} rows={4} required={required} maxLength={5000} style={inputStyle} />
      ) : (
        <input name={name} type={type} required={required} maxLength={500} style={inputStyle} />
      )}
    </label>
  );
}

const inputStyle = {
  width: "100%", boxSizing: "border-box", padding: "12px 14px",
  border: "1.5px solid #E5E5E5", borderRadius: 12, background: "#F7F7F7",
  fontFamily: "var(--font-sans)", fontSize: 14, color: "#0A0A0A",
  outline: "none", resize: "vertical",
};

function ContactSection({ t }) {
  return (
    <Section id="contact" screenLabel="Contact">
      <div className="contact-card" style={{
        background: "#0A0A0A", color: "#fff", borderRadius: 28, padding: 56,
        display: "grid", gridTemplateColumns: "1fr 1fr", gap: 56, position: "relative", overflow: "hidden",
      }}>
        <ConfettiSquares seed={5} count={12} style={{ opacity: 0.35 }} />
        <div style={{ position: "relative", zIndex: 1, display: "flex", flexDirection: "column", justifyContent: "center" }}>
          <Eyebrow color="#FED605">{t.contact.eyebrow}</Eyebrow>
          <h2 style={{
            fontFamily: "var(--font-sans)", fontWeight: 900, fontSize: 48,
            lineHeight: 1.05, letterSpacing: "-0.025em", color: "#FED605",
            margin: "18px 0 20px",
          }}>{t.contact.title}</h2>
          <p style={{
            fontFamily: "var(--font-sans)", fontSize: 16, lineHeight: 1.7, color: "#D4D4D4",
            margin: 0, maxWidth: 420,
          }}>{t.contact.body}</p>
        </div>
        <div style={{ position: "relative", zIndex: 1, display: "flex", flexDirection: "column", justifyContent: "center", gap: 18 }}>
          {[
            { lbl: t.contact.emailLabel, val: t.contact.emailValue },
            { lbl: t.contact.authorLabel, val: t.contact.authorValue },
            { lbl: t.contact.pressLabel, val: t.contact.pressValue },
          ].map((x, i) => (
            <div key={i} style={{
              background: "rgba(255,255,255,0.06)", border: "1px solid rgba(255,255,255,0.12)",
              borderRadius: 14, padding: "16px 20px",
            }}>
              <div style={{ fontSize: 11, fontWeight: 800, color: "#FED605", letterSpacing: "0.1em", textTransform: "uppercase" }}>
                {x.lbl}
              </div>
              <a href={`mailto:${x.val}`} style={{
                fontFamily: "var(--font-sans)", fontSize: 18, fontWeight: 700,
                color: "#fff", textDecoration: "none", marginTop: 4, display: "block",
              }}>{x.val}</a>
            </div>
          ))}
        </div>
      </div>
    </Section>
  );
}

function Footer({ t }) {
  return (
    <footer className="site-footer" style={{ borderTop: "1px solid #EFEFEF", padding: "56px 32px 40px", background: "#fff" }}>
      <div style={{ maxWidth: 1280, margin: "0 auto" }}>
        <div className="footer-cols" style={{ display: "grid", gridTemplateColumns: "1.4fr 1fr 1fr 1fr 1fr", gap: 40 }}>
          <div>
            <Logo />
            <p style={{
              fontFamily: "var(--font-sans)", fontSize: 14, lineHeight: 1.6,
              color: "#737373", marginTop: 16, fontStyle: "italic",
            }}>"{t.footer.tag}"</p>
          </div>
          <FooterCol title={t.footer.col1} items={[t.nav.about, "PlayMate", t.nav.contact]} />
          <FooterCol title={t.footer.col2} items={[
            { label: "ReadMe iOS", href: "https://apps.apple.com/us/app/readme-fiction-goodnovel/id6447419813" },
            { label: "ReadMe Android", href: "https://play.google.com/store/apps/details?id=com.xiaoshuo.beststory" },
            { label: t.product.appStore, href: "https://apps.apple.com/us/app/readme-fiction-goodnovel/id6447419813" },
            { label: t.product.googlePlay, href: "https://play.google.com/store/apps/details?id=com.xiaoshuo.beststory" },
          ]} />
          <FooterCol title={t.footer.col3} items={[t.partners.tabAuthor, t.partners.tabAgency, t.partners.tabDistributor]} />
          <FooterCol title={t.footer.col4} items={[
            { label: t.footer.legal1, href: "/privacy/" },
            { label: t.footer.legal2, href: "/terms/" },
            { label: t.footer.legal3, href: "/dmca/" },
          ]} />
        </div>
        <div className="footer-bottom" style={{
          marginTop: 48, paddingTop: 24, borderTop: "1px solid #EFEFEF",
          display: "flex", justifyContent: "space-between", alignItems: "center",
          gap: 16, flexWrap: "wrap",
          fontFamily: "var(--font-sans)", fontSize: 12, color: "#A3A3A3",
        }}>
          <span>{t.footer.copy}</span>
          <span>Hong Kong · New York · Jakarta · Bangkok · Ho Chi Minh City</span>
        </div>
      </div>
    </footer>
  );
}

function FooterCol({ title, items }) {
  return (
    <div>
      <div style={{
        fontFamily: "var(--font-sans)", fontSize: 11, fontWeight: 800,
        color: "#0A0A0A", letterSpacing: "0.1em", textTransform: "uppercase", marginBottom: 16,
      }}>{title}</div>
      <ul style={{ listStyle: "none", padding: 0, margin: 0 }}>
        {items.map((it, i) => {
          const isObj = typeof it === "object" && it !== null;
          const label = isObj ? it.label : it;
          const href = isObj ? it.href : "#";
          const external = isObj && /^https?:/.test(href || "");
          return (
            <li key={i} style={{ marginBottom: 10 }}>
              <a href={href}
                 {...(external ? { target: "_blank", rel: "noopener noreferrer" } : {})}
                 style={{
                fontFamily: "var(--font-sans)", fontSize: 14, color: "#4A4A4A",
                textDecoration: "none",
              }}>{label}</a>
            </li>
          );
        })}
      </ul>
    </div>
  );
}

Object.assign(window, {
  HeroSection, AboutSection, ProductSection, ContentSection, MarketsSection,
  SlogansSection, PartnersSection, ContactSection, Footer,
});
