// WeaveStudy — Campaigns / Library / Q&A / Alignment Hall

const { useState: useStateExtra } = React;

/* ════════════════════════════════════════════════════════════
   CAMPAIGNS — list + curriculum detail (인강 커리큘럼)
   ════════════════════════════════════════════════════════════ */
function Campaigns({ navigate }) {
  const { CAMPAIGNS, CHARACTERS } = window.WS_DATA;
  return (
    <main>
      <div style={{ background: "white", borderBottom: "1px solid var(--line-normal)" }}>
        <div className="container" style={{ paddingTop: 48, paddingBottom: 32 }}>
          <div className="sec-eyebrow">CURRICULUM</div>
          <h1 style={{ fontSize: 40, fontWeight: 800, margin: "8px 0", letterSpacing: "-0.03em", fontFamily: "var(--font-serif-display)", color: "var(--weave-ink)" }}>
            캠페인 · 커리큘럼
          </h1>
          <p style={{ fontSize: 15, color: "var(--label-neutral)", margin: 0 }}>
            진행 중 / 수료 완료된 모든 캠페인. 각 캠페인은 막(Act) 단위로 구성됩니다.
          </p>
        </div>
      </div>

      <div className="container" style={{ paddingTop: 32 }}>
        <div style={{ display: "grid", gridTemplateColumns: "repeat(2, 1fr)", gap: 20 }}>
          {CAMPAIGNS.map(cmp => (
            <button key={cmp.id} className="card card-hover" onClick={() => navigate({ name: "campaign", id: cmp.id })}
                    style={{ textAlign: "left", padding: 0 }}>
              <div style={{
                height: 140, position: "relative",
                background: cmp.id === "bg3-main"
                  ? "linear-gradient(135deg, #6541F2 0%, #2D1B4E 100%)"
                  : cmp.id === "pholandver"
                  ? "linear-gradient(135deg, #B45309 0%, #7C2D12 100%)"
                  : cmp.id === "strahd"
                  ? "linear-gradient(135deg, #1B1820 0%, #991B1B 100%)"
                  : "linear-gradient(135deg, #2FA89A 0%, #1E40AF 100%)",
                color: "white", padding: 24,
                display: "flex", flexDirection: "column", justifyContent: "space-between"
              }}>
                <div style={{
                  position: "absolute", inset: 0,
                  backgroundImage: "radial-gradient(circle, rgba(255,255,255,0.10) 1px, transparent 1.5px)",
                  backgroundSize: "26px 26px", opacity: 0.6
                }} />
                <div style={{ position: "relative", display: "flex", gap: 6 }}>
                  <span className="tag tag-ink" style={{ background: "rgba(255,255,255,0.18)", color: "white", border: "1px solid rgba(255,255,255,0.25)" }}>{cmp.acts.length}막</span>
                  {cmp.progress >= 1 && <span className="tag" style={{ background: "rgba(255,255,255,0.18)", color: "white" }}>수료 완료</span>}
                </div>
                <div style={{ position: "relative", display: "flex", alignItems: "flex-end", justifyContent: "space-between" }}>
                  <div>
                    <div style={{ fontSize: 12, opacity: 0.7 }}>{cmp.nameSub}</div>
                    <div style={{ fontSize: 26, fontWeight: 800, letterSpacing: "-0.02em", fontFamily: "var(--font-serif-display)", lineHeight: 1.1 }}>{cmp.name}</div>
                  </div>
                  <div style={{ display: "flex" }}>
                    {cmp.members.map((id, i) => {
                      const c = CHARACTERS.find(x => x.id === id);
                      if (!c) return null;
                      return (
                        <div key={id} style={{
                          width: 32, height: 32, borderRadius: 99,
                          background: `linear-gradient(135deg, ${c.portraitColors[0]}, ${c.portraitColors[1]})`,
                          color: "white", display: "flex", alignItems: "center", justifyContent: "center",
                          fontSize: 12, fontWeight: 800,
                          border: "2px solid white",
                          marginLeft: i === 0 ? 0 : -10
                        }}>{c.name[0]}</div>
                      );
                    })}
                  </div>
                </div>
              </div>
              <div style={{ padding: 20 }}>
                <p style={{ fontSize: 13, color: "var(--label-neutral)", margin: "0 0 12px", lineHeight: 1.5 }}>{cmp.tagline}</p>
                <div className="progress"><span style={{ width: `${cmp.progress * 100}%` }} /></div>
                <div style={{ display: "flex", justifyContent: "space-between", marginTop: 8, fontSize: 12 }}>
                  <span style={{ color: "var(--label-alternative)" }}>전체 진행도</span>
                  <span style={{ fontWeight: 700, color: "var(--weave-violet)", fontFamily: "var(--font-mono)" }}>{Math.round(cmp.progress * 100)}%</span>
                </div>
              </div>
            </button>
          ))}
        </div>
      </div>
    </main>
  );
}

/* Campaign detail — 커리큘럼 막 구성 */
function CampaignDetail({ id, navigate }) {
  const { CAMPAIGNS, CHARACTERS } = window.WS_DATA;
  const cmp = CAMPAIGNS.find(x => x.id === id);
  if (!cmp) return <div className="container" style={{ padding: 64 }}>캠페인을 찾을 수 없습니다.</div>;
  return (
    <main>
      <div className="container" style={{ paddingTop: 24 }}>
        <div style={{ display: "flex", alignItems: "center", gap: 8, fontSize: 12, color: "var(--label-alternative)", flexWrap: "wrap" }}>
          <button onClick={() => navigate({ name: "camp" })} style={{ whiteSpace: "nowrap" }}>캠프</button>
          <Icon name="chevron-right" size={12} color="var(--label-alternative)" />
          <button onClick={() => navigate({ name: "campaigns" })} style={{ whiteSpace: "nowrap" }}>커리큘럼</button>
          <Icon name="chevron-right" size={12} color="var(--label-alternative)" />
          <span style={{ color: "var(--weave-ink)", fontWeight: 600, whiteSpace: "nowrap" }}>{cmp.name}</span>
        </div>
      </div>

      <div className="container" style={{ paddingTop: 24 }}>
        <div style={{
          background: cmp.id === "bg3-main"
            ? "linear-gradient(135deg, #6541F2 0%, #2D1B4E 100%)"
            : "linear-gradient(135deg, #6541F2 0%, #5B37ED 100%)",
          borderRadius: 20, padding: 40, color: "white",
          position: "relative", overflow: "hidden"
        }}>
          <div style={{
            position: "absolute", inset: 0,
            backgroundImage: "radial-gradient(circle, rgba(255,255,255,0.10) 1px, transparent 1.5px)",
            backgroundSize: "26px 26px", opacity: 0.6
          }} />
          <div style={{ position: "relative" }}>
            <div style={{ display: "flex", alignItems: "center", gap: 8, marginBottom: 12 }}>
              <span className="tag" style={{ background: "rgba(255,255,255,0.18)", color: "white", border: "1px solid rgba(255,255,255,0.25)" }}>{cmp.acts.length}막 구성</span>
              {cmp.progress >= 1 && <span className="tag" style={{ background: "rgba(255,255,255,0.18)", color: "white" }}>수료 완료</span>}
            </div>
            <div style={{ fontSize: 14, opacity: 0.7, marginBottom: 6 }}>{cmp.nameSub}</div>
            <h1 style={{ fontSize: 48, fontWeight: 800, margin: 0, letterSpacing: "-0.03em", fontFamily: "var(--font-serif-display)", lineHeight: 1.05 }}>{cmp.name}</h1>
            <p style={{ fontSize: 16, opacity: 0.85, marginTop: 12, maxWidth: 540, lineHeight: 1.5 }}>{cmp.tagline}</p>

            <div style={{ display: "flex", gap: 32, marginTop: 28, alignItems: "center" }}>
              <div>
                <div style={{ fontSize: 11, opacity: 0.6, letterSpacing: "0.06em", fontWeight: 700 }}>전체 진행도</div>
                <div style={{ display: "flex", alignItems: "baseline", gap: 4, marginTop: 4 }}>
                  <span style={{ fontSize: 40, fontWeight: 800, fontFamily: "var(--font-serif-display)", letterSpacing: "-0.025em" }}>{Math.round(cmp.progress * 100)}</span>
                  <span style={{ fontSize: 16, opacity: 0.7 }}>%</span>
                </div>
              </div>
              <div>
                <div style={{ fontSize: 11, opacity: 0.6, letterSpacing: "0.06em", fontWeight: 700 }}>등장 캐릭터</div>
                <div style={{ display: "flex", marginTop: 4 }}>
                  {cmp.members.map((id, i) => {
                    const c = CHARACTERS.find(x => x.id === id);
                    if (!c) return null;
                    return (
                      <button key={id} onClick={() => navigate({ name: "character", id: c.id })}
                              style={{
                                width: 36, height: 36, borderRadius: 99,
                                background: `linear-gradient(135deg, ${c.portraitColors[0]}, ${c.portraitColors[1]})`,
                                color: "white", display: "flex", alignItems: "center", justifyContent: "center",
                                fontSize: 14, fontWeight: 800,
                                border: "2px solid rgba(255,255,255,0.5)",
                                marginLeft: i === 0 ? 0 : -10,
                                cursor: "pointer"
                              }} title={c.name}>{c.name[0]}</button>
                    );
                  })}
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>

      {/* 막 구성 — 인강 커리큘럼 스타일 */}
      <div className="container" style={{ paddingTop: 48 }}>
        <SectionTitle eyebrow="MODULES" title="막(Act) 구성" sub="인강 커리큘럼 형식으로 회차별 세션을 정리했습니다." />
        <div style={{ display: "flex", flexDirection: "column", gap: 16 }}>
          {cmp.acts.map(a => (
            <div key={a.act} className="card" style={{ padding: 0, overflow: "hidden" }}>
              <div style={{
                padding: "20px 24px",
                background: a.status === "진행 중" ? "linear-gradient(90deg, var(--weave-violet-soft) 0%, white 60%)" :
                            a.status === "수료" ? "linear-gradient(90deg, var(--weave-teal-soft) 0%, white 60%)" :
                            "var(--cool-neutral-99)",
                display: "flex", alignItems: "center", justifyContent: "space-between",
                borderBottom: "1px solid var(--line-normal)"
              }}>
                <div style={{ display: "flex", alignItems: "center", gap: 16 }}>
                  <div style={{
                    width: 56, height: 56, borderRadius: 14,
                    background: a.status === "진행 중" ? "var(--weave-violet)" :
                                a.status === "수료" ? "var(--weave-teal-deep)" :
                                "var(--cool-neutral-50)",
                    color: "white",
                    display: "flex", alignItems: "center", justifyContent: "center",
                    fontWeight: 800, letterSpacing: "-0.02em",
                    fontFamily: "var(--font-serif-display)",
                    fontSize: 22
                  }}>
                    {a.act}막
                  </div>
                  <div>
                    <div style={{ fontSize: 18, fontWeight: 800, color: "var(--weave-ink)", letterSpacing: "-0.02em" }}>{a.title}</div>
                    <div style={{ fontSize: 12, color: "var(--label-alternative)" }}>{a.sessions.length}회차 · {a.status}</div>
                  </div>
                </div>
                <div>
                  <span className="tag" style={{
                    background: a.status === "진행 중" ? "var(--weave-violet)" : a.status === "수료" ? "var(--weave-teal-deep)" : "var(--fill-strong)",
                    color: a.status === "예정" ? "var(--label-neutral)" : "white"
                  }}>{a.status}</span>
                </div>
              </div>
              <div style={{ padding: "16px 24px", display: "flex", flexDirection: "column", gap: 8 }}>
                {a.sessions.map(s => (
                  <div key={s.id} style={{
                    display: "flex", alignItems: "center", gap: 16,
                    padding: "12px 16px",
                    background: "var(--cool-neutral-99)",
                    borderRadius: 10,
                    cursor: "pointer",
                    transition: "background 120ms"
                  }}
                  onMouseEnter={e => e.currentTarget.style.background = "var(--fill-normal)"}
                  onMouseLeave={e => e.currentTarget.style.background = "var(--cool-neutral-99)"}>
                    <span style={{ fontSize: 13, fontWeight: 800, color: "var(--weave-violet)", fontFamily: "var(--font-mono)", width: 48, flexShrink: 0 }}>
                      SESSION {s.n}
                    </span>
                    <div style={{ flex: 1 }}>
                      <div style={{ fontSize: 14, fontWeight: 700, color: "var(--weave-ink)" }}>{s.t}</div>
                      <div style={{ fontSize: 12, color: "var(--label-alternative)", marginTop: 2 }}>{s.note}</div>
                    </div>
                    <span style={{ fontSize: 12, fontWeight: 700, color: a.status === "수료" ? "var(--weave-teal-deep)" : a.status === "진행 중" ? "var(--weave-violet)" : "var(--label-alternative)" }}>
                      {a.status === "수료" ? "✓ 수강 완료" : a.status === "진행 중" ? "▷ 수강 중" : "예정"}
                    </span>
                    <Icon name="chevron-right" size={14} color="var(--label-alternative)" />
                  </div>
                ))}
              </div>
            </div>
          ))}
        </div>
      </div>
    </main>
  );
}

/* ════════════════════════════════════════════════════════════
   LIBRARY — 자나사의 만물 가이드
   ════════════════════════════════════════════════════════════ */
function Library({ navigate }) {
  const { RESOURCES } = window.WS_DATA;
  return (
    <main>
      {/* parchment hero */}
      <div style={{ background: "var(--weave-parchment)", borderBottom: "1px solid var(--weave-parchment-edge)" }}>
        <div className="container" style={{ paddingTop: 56, paddingBottom: 48, position: "relative" }}>
          <div className="sec-eyebrow" style={{ color: "var(--weave-gold)" }}>XANATHAR'S GUIDE TO EVERYTHING</div>
          <h1 style={{ fontSize: 44, fontWeight: 800, margin: "8px 0", letterSpacing: "-0.03em", fontFamily: "var(--font-serif-display)", color: "var(--weave-ink)" }}>
            자나사의 만물 가이드
          </h1>
          <p style={{ fontSize: 15, color: "var(--label-neutral)", margin: 0, maxWidth: 640 }}>
            세계관 설정 · 룰 요약 · 창작 메모를 모은 자료실.<br />
            모든 항목은 출처(공식 / 창작)를 명확히 표기합니다.
          </p>

          {/* Source legend */}
          <div style={{ display: "flex", gap: 16, marginTop: 24, flexWrap: "wrap" }}>
            <SourceTag color="#6541F2">포가튼 렐름 공식 설정</SourceTag>
            <SourceTag color="#2FA89A">D&D 5e PHB 기준</SourceTag>
            <SourceTag color="#C99E3B">발더스 게이트 3 내 공식 설정</SourceTag>
            <SourceTag color="#1B1820">본 사이트 창작 설정</SourceTag>
          </div>
        </div>
      </div>

      <div className="container" style={{ paddingTop: 48 }}>
        <div style={{ display: "grid", gridTemplateColumns: "repeat(2, 1fr)", gap: 24 }}>
          {RESOURCES.map(r => (
            <div key={r.id} className="card" style={{ padding: 28 }}>
              <div style={{ display: "flex", alignItems: "center", gap: 8, marginBottom: 16 }}>
                <SourceDot color={
                  r.id === "r1" ? "#6541F2" :
                  r.id === "r2" ? "#2FA89A" :
                  r.id === "r3" ? "#C99E3B" : "#1B1820"
                } />
                <div style={{ fontSize: 17, fontWeight: 800, color: "var(--weave-ink)", letterSpacing: "-0.02em" }}>{r.section}</div>
              </div>
              <div style={{ display: "flex", flexDirection: "column", gap: 4 }}>
                {r.items.map((it, i) => (
                  <div key={i} style={{
                    display: "flex", justifyContent: "space-between", alignItems: "center",
                    padding: "12px 0", borderBottom: i < r.items.length - 1 ? "1px solid var(--line-normal)" : "none"
                  }}>
                    <div>
                      <div style={{ fontSize: 14, fontWeight: 700, color: "var(--weave-ink)" }}>{it.t}</div>
                      <div style={{ fontSize: 12, color: "var(--label-alternative)", marginTop: 2 }}>{it.note}</div>
                    </div>
                    <Icon name="arrow-right" size={14} color="var(--label-alternative)" />
                  </div>
                ))}
              </div>
            </div>
          ))}
        </div>

        {/* Bookshelf decorative section */}
        <div style={{
          marginTop: 48, padding: 40,
          background: "linear-gradient(180deg, var(--weave-parchment) 0%, white 100%)",
          borderRadius: 20,
          border: "1px solid var(--weave-parchment-edge)"
        }}>
          <SubHeadAccent gold>책장</SubHeadAccent>
          <p style={{ fontSize: 14, color: "var(--label-neutral)", lineHeight: 1.6, marginTop: 0, maxWidth: 640 }}>
            자나사의 만물 가이드에는 공식 룰북뿐 아니라, 졍이 직접 작성한 캐릭터 노트와 외부 참고 링크가 포함됩니다.
          </p>
          <div style={{ display: "flex", gap: 6, marginTop: 24, overflowX: "auto", paddingBottom: 8 }}>
            {Array.from({ length: 14 }).map((_, i) => {
              const colors = ["#6541F2", "#1B1820", "#7C2D12", "#2FA89A", "#C99E3B", "#5B37ED", "#1E40AF"];
              const c = colors[i % colors.length];
              const h = 140 + ((i * 13) % 40);
              return (
                <div key={i} style={{
                  width: 36, height: h,
                  background: `linear-gradient(180deg, ${c} 0%, ${c}99 100%)`,
                  borderRadius: "2px 2px 0 0",
                  position: "relative",
                  flexShrink: 0,
                  cursor: "pointer",
                  transition: "transform 120ms"
                }}
                onMouseEnter={e => e.currentTarget.style.transform = "translateY(-6px)"}
                onMouseLeave={e => e.currentTarget.style.transform = "translateY(0)"}
                title="책 (장식 요소)">
                  <div style={{
                    position: "absolute", left: 4, right: 4, top: 12,
                    height: 1, background: "rgba(255,255,255,0.4)"
                  }} />
                  <div style={{
                    position: "absolute", left: 4, right: 4, bottom: 8,
                    height: 1, background: "rgba(255,255,255,0.4)"
                  }} />
                  {i === 7 && (
                    <div style={{
                      position: "absolute", top: -20, left: -8, right: -8,
                      fontSize: 9, fontWeight: 700,
                      color: "var(--weave-gold)",
                      textAlign: "center"
                    }}>↓ 클릭?</div>
                  )}
                </div>
              );
            })}
          </div>
          <div style={{ fontSize: 11, color: "var(--label-alternative)", marginTop: 16, fontStyle: "italic" }}>
            ※ 책 한 권을 잘 살펴보면 무언가 발견할지도…
          </div>
        </div>
      </div>
    </main>
  );
}

function SourceTag({ color, children }) {
  return (
    <div style={{
      display: "inline-flex", alignItems: "center", gap: 8,
      padding: "6px 12px",
      background: "white", borderRadius: 999,
      fontSize: 12, fontWeight: 700, color: "var(--label-neutral)",
      border: `1px solid ${color}33`
    }}>
      <span style={{ width: 8, height: 8, background: color, borderRadius: 99 }} />
      {children}
    </div>
  );
}

function SourceDot({ color }) {
  return <span style={{ width: 10, height: 10, background: color, borderRadius: 99, flexShrink: 0 }} />;
}

function SubHeadAccent({ children, gold }) {
  return (
    <div style={{
      fontSize: 12, fontWeight: 800,
      color: gold ? "var(--weave-gold)" : "var(--weave-violet)",
      letterSpacing: "0.1em", textTransform: "uppercase",
      marginBottom: 8
    }}>{children}</div>
  );
}

/* ════════════════════════════════════════════════════════════
   QnA — 위더스에게 묻기
   ════════════════════════════════════════════════════════════ */
function Qna({ navigate }) {
  const { QNAS } = window.WS_DATA;
  const [tab, setTab] = useStateExtra("all");

  return (
    <main>
      <div style={{ background: "white", borderBottom: "1px solid var(--line-normal)" }}>
        <div className="container" style={{ paddingTop: 48, paddingBottom: 32, display: "grid", gridTemplateColumns: "1fr 320px", gap: 48, alignItems: "center" }}>
          <div>
            <div className="sec-eyebrow">ASK WITHERS · Q&A</div>
            <h1 style={{ fontSize: 40, fontWeight: 800, margin: "8px 0", letterSpacing: "-0.03em", fontFamily: "var(--font-serif-display)", color: "var(--weave-ink)" }}>
              위더스에게 묻기
            </h1>
            <p style={{ fontSize: 15, color: "var(--label-neutral)", margin: 0 }}>
              주문 슬롯이 모자라거나, 캐릭터 메이킹이 막힐 때 — 캠프의 위더스가 답해 드립니다.
            </p>
          </div>

          {/* 위더스 NPC card */}
          <div style={{
            background: "var(--weave-ink)", color: "white",
            borderRadius: 16, padding: 20,
            display: "flex", gap: 14, alignItems: "center",
            position: "relative", overflow: "hidden"
          }}>
            <div style={{
              position: "absolute", inset: 0,
              backgroundImage: "radial-gradient(circle, rgba(255,255,255,0.06) 1px, transparent 1.5px)",
              backgroundSize: "22px 22px"
            }} />
            <div style={{
              position: "relative",
              width: 64, height: 64, borderRadius: 99,
              background: "linear-gradient(135deg, #46474C 0%, #1B1820 100%)",
              border: "2px solid rgba(255,255,255,0.15)",
              display: "flex", alignItems: "center", justifyContent: "center",
              fontSize: 28, fontFamily: "var(--font-serif-display)", fontWeight: 800
            }}>W</div>
            <div style={{ position: "relative" }}>
              <div style={{ fontSize: 11, color: "var(--weave-teal)", fontWeight: 700, letterSpacing: "0.06em" }}>NPC · 캠프</div>
              <div style={{ fontSize: 18, fontWeight: 800 }}>위더스 (Withers)</div>
              <div style={{ fontSize: 12, opacity: 0.7, marginTop: 2 }}>"… 무엇이 궁금하십니까?"</div>
            </div>
          </div>
        </div>
      </div>

      <div className="container" style={{ paddingTop: 32 }}>
        {/* 질문 작성 박스 */}
        <div style={{
          background: "white",
          border: "1px solid var(--line-normal)",
          borderRadius: 16,
          padding: 24,
          display: "flex", flexDirection: "column", gap: 12,
          marginBottom: 32
        }}>
          <div style={{ display: "flex", alignItems: "center", gap: 12 }}>
            <span className="badge badge-outline" style={{ borderColor: "var(--weave-violet)", color: "var(--weave-violet)" }}>새 질문</span>
            <span style={{ fontSize: 14, color: "var(--label-alternative)" }}>위더스가 답할 수 있는 형태로 작성해 주십시오.</span>
          </div>
          <div style={{
            border: "1px solid var(--line-normal)",
            borderRadius: 10, padding: 14,
            color: "var(--label-alternative)", fontSize: 14,
            background: "var(--cool-neutral-99)"
          }}>
            예) "예지술사 다미네는 같은 회차에 같은 주사위를 두 번 굴려도 되나요?"
          </div>
          <div style={{ display: "flex", justifyContent: "flex-end", gap: 8 }}>
            <button className="btn btn-secondary btn-sm">초안 저장</button>
            <button className="btn btn-primary btn-sm">위더스에게 보내기</button>
          </div>
        </div>

        {/* 탭 */}
        <div style={{ display: "flex", gap: 12, borderBottom: "1px solid var(--line-normal)", marginBottom: 16 }}>
          {[{ id: "all", l: "전체" }, { id: "hot", l: "인기" }, { id: "wait", l: "답변 대기" }].map(t => (
            <button key={t.id} onClick={() => setTab(t.id)}
                    style={{
                      padding: "10px 16px",
                      fontWeight: 700, fontSize: 14,
                      color: tab === t.id ? "var(--weave-ink)" : "var(--label-alternative)",
                      borderBottom: tab === t.id ? "3px solid var(--weave-violet)" : "3px solid transparent",
                      marginBottom: -1
                    }}>{t.l}</button>
          ))}
        </div>

        {/* 질문 리스트 */}
        <div style={{ background: "white", borderRadius: 14, border: "1px solid var(--line-normal)", overflow: "hidden" }}>
          {QNAS.map((q, i) => (
            <div key={q.id} style={{
              display: "flex", alignItems: "center", gap: 16,
              padding: "20px 24px",
              borderBottom: i < QNAS.length - 1 ? "1px solid var(--line-normal)" : "none",
              cursor: "pointer"
            }}>
              <div style={{
                width: 48, height: 48, borderRadius: 10,
                background: q.status === "답변 대기" ? "var(--fill-normal)" : "var(--weave-violet-soft)",
                color: q.status === "답변 대기" ? "var(--label-alternative)" : "var(--weave-violet-strong)",
                display: "flex", alignItems: "center", justifyContent: "center",
                fontSize: 11, fontWeight: 800, letterSpacing: "0.04em",
                flexShrink: 0, textAlign: "center", lineHeight: 1.2
              }}>
                {q.answers}<br />답변
              </div>
              <div style={{ flex: 1, minWidth: 0 }}>
                <div style={{ display: "flex", alignItems: "center", gap: 6, marginBottom: 4 }}>
                  {q.isHot && <span className="badge badge-hot">HOT</span>}
                  <span style={{ fontSize: 11, fontWeight: 700, color: q.status === "답변 대기" ? "var(--weave-gold)" : "var(--weave-teal-deep)", letterSpacing: "0.04em" }}>
                    · {q.status}
                  </span>
                </div>
                <div style={{ fontSize: 15, fontWeight: 700, color: "var(--weave-ink)", letterSpacing: "-0.015em" }}>
                  Q. {q.q}
                </div>
                <div style={{ fontSize: 12, color: "var(--label-alternative)", marginTop: 4 }}>
                  {q.asker} · {q.at}
                </div>
              </div>
              <Icon name="chevron-right" size={16} color="var(--label-alternative)" />
            </div>
          ))}
        </div>

        <div style={{ marginTop: 32, padding: 20, background: "var(--weave-violet-soft)", borderRadius: 14, fontSize: 13, color: "var(--weave-violet-strong)", lineHeight: 1.6 }}>
          <strong>위더스의 알림:</strong> 모든 답변은 D&D 5e PHB 기준 + 본 사이트 창작 설정을 함께 표기합니다.
          답변이 마음에 들지 않으시면 가까운 캠프파이어에서 다시 한 번 물어 주십시오.
        </div>
      </div>
    </main>
  );
}

Object.assign(window, { Campaigns, CampaignDetail, Library, Qna });
